Questions tagged [expansion]

428 questions
4
votes
1 answer

Can Rust macros expand like C preprocessor macros for hex numbers?

I'm looking to create a Rust macro that can do what this does in C. #define V(a,b,c,d) 0x##a##b##c##d Which when called with: V(7B,B0,B0,CB) Will simply have the following hexadecimal number placed in the code at compile…
6ft Dan
  • 2,365
  • 1
  • 33
  • 46
4
votes
2 answers

How to prevent filename expansion in for loop in bash

In a for loop like this, for i in `cat *.input`; do echo "$i" done if one of the input file contains entries like *a, it will, and give the filenames ending in 'a'. Is there a simple way of preventing this filename expansion? Because of use…
cagri
  • 43
  • 4
4
votes
7 answers

Algorithm for modeling expanding gases on a 2D grid

I have a simple program, at it's heart is a two dimensional array of floats, supposedly representing gas concentrations, I have been trying to come up with a simple algorithm that will model the gas expanding outwards, like a cloud, eventually…
RichardBennet
4
votes
3 answers

Macros expansion using ## operator

Hi every one the problem is that i have in this macro #define ADD_COMP(s1,s2,type)({\ int _x=0;\ for(int i=0;i##type),6)!=0){\ _x=-1;\ }else{\ break;\ }\ }\ _x;\ }) s1 is a simple…
P.Carlino
  • 661
  • 5
  • 21
4
votes
3 answers

Avoid expansion of * in bash builtin function let

I have a problem with a bash script. I have to use the operator * to multiplicate. Instead the script bugs me with expansion and using as operator the name of the script itself. I tried with single quotes but it doesn't work :( Here's the…
gc5
  • 9,468
  • 24
  • 90
  • 151
4
votes
2 answers

getAPKExpansionZipFile() returns null

Since my game has 100Mb I need to use expansion file. I put below code in the MainActivity in function onCreate() ZipResourceFile expansionFile = null; try { expansionFile =…
draziw
  • 321
  • 3
  • 13
4
votes
2 answers

I don't understand this parameter expansion: ${p//[0-9]/}

In Linux /etc/init.d/functions script I found the following parameter expansions that I don't quite understand: ${p//[0-9]/} replace all instances of any number to/by what? ${1##[-+]} This seems to remove all the longest left instances of minuses…
4
votes
1 answer

Do we need to call wordfree upon wordexp failure?

Do we need to call wordfree upon wordexp failure? Calling wordfree seems to segfault in some cases (eg when wordfree returns error code with string is "foo 'bar"). This isn't clear from man page, and I've seen wordfree used in some error cases.
timotheecour
  • 3,104
  • 3
  • 26
  • 29
4
votes
1 answer

Bash substring expansion on array

I have a set of files with a given suffix. For instance, I have a set of pdf files with suffix .pdf. I would like to obtain the names of the files without the suffix using substring expansion. For a single file I can use: file="test.pdf" echo…
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
4
votes
1 answer

Solving the circular dependency conundrum "elegantly"

So I am developing a programming language which compiles to bytecode for VM execution and also to C as an intermediate language for compiling to native binary. I chose C because it is low level enough and portable, saving a tremendous amount of…
user2341104
4
votes
1 answer

Zsh expand alias to result of function as string

Really quirky title, I know. Basically, I have this: alias vv="xclip -selection clipboard -o" which prints out anything in my clipboard, such as a repository location in ssh-form (git@github.username/repname.git). Now I'd like to: git clone vv I…
mirandalol
  • 445
  • 1
  • 7
  • 16
4
votes
1 answer

Next commands in line get not executed after failglob triggers

shopt -s failglob; ls -l /non-existent/*; echo A; echo B only prints "B" (and the "no-match" error). http://www.gnu.org/software/bash/manual/bashref.html#Filename-Expansion says that the command that caused the expansion failure does not get…
Nico Rittner
  • 189
  • 5
4
votes
0 answers

Encrypting and decrypting android expansion file

I have successfully uploaded and published my android app + apk expansion file (with format .obb but is actually a .zip) on Google Play. I would like to set up some protection to it. Are there any ways to do it to acheieve this without using…
4
votes
1 answer

Google Play APK Expansion Downloader Library broken?

I'm trying to use Google Play APK Expansion Downloader Library, but the freshly installed library seems to be broken: I'm seeing "src/src/com..." and "res/res/..." folders. Anybody else seeing this? Moving everything one folder up seems to solve…
hdort
  • 909
  • 1
  • 8
  • 18
4
votes
3 answers

Including Google Play Downloader Library | APK File Expansion Library

I'm following dev guide at http://developer.android.com/guide/market/expansion-files.html in order to download additional assets to my apk. I've done all the part about the importation of libraries, etc .. I've also implemented the samples code in…
Floy
  • 88
  • 1
  • 1
  • 6