Questions tagged [expansion]

428 questions
3
votes
4 answers

Bash: trim a parameter from both ends

Greetings! This are well know Bash parameter expansion patterns: ${parameter#word}, ${parameter##word} and ${parameter%word}, ${parameter%%word} I need to chop one part from the beginning and anoter part from the trailing of the parameter. Could you…
Andrey Kazak
  • 161
  • 1
  • 2
  • 5
3
votes
2 answers

Brace expansion from a variable in Bash

I would like to expand a variable in Bash. Here's my example: variable="{1,2,3}" echo $variable Expected output: 1 2 3 Actual output: {1,2,3}
3
votes
1 answer

C/C++ macro expansion

I have the following code: #define UNIT_BASIC_UNIT_DEF2 (name) UNIT_BASIC_ ## name #define UNIT_UNIT_TYPE_DEF2 (basic_type, name) UNIT_ ## basic_type ## _ ## name #define UNIT_BASIC_UNIT_CLASS_NAME2(name) CUnit ## name #define…
G. Ko
  • 403
  • 6
  • 15
3
votes
2 answers

Is there a way to control macro expansion order

I am hoping that someone may have an idea on how to control/specify the order of macro expansion. Here is the context: // 32 bit increments, processor has registers for set, clear and invert #define CLR_OFF 1 #define SET_OFF 2 #define INV_OFF…
daicoden
  • 69
  • 1
  • 5
3
votes
2 answers

In Bash, is it possible to write an 'identity' function (relative to arguments passing/returning)

Such 'identity' function should satisfy the following 2 properties : identity $(identity a\ b c\ d) # (Expected output:) # a b # c d And, given the following 'argv_count' function: argv_count () { echo "argv_count('$@'):$#"; } argv_count $(identity…
Lucas Cimon
  • 1,859
  • 2
  • 24
  • 33
3
votes
1 answer

batch reinitialize global variable inside loop and use it outside loop

firts of all im beginner. i have multiple file in directory which its name contain date, i need to find which file is the latest one(just need the date). this is what i have so far set currentYear=2013 set logDate=0 set tempLogDate=0 set…
paiseha
  • 169
  • 1
  • 3
  • 10
3
votes
1 answer

zsh: parameter expansion inserting quotes

I'm having trouble during parameter expansion in zsh: It's enclosing my variable in quotes. Here is my script. (Apologies for the noise, the only real important line is the last one with the find call, but I wanted to make sure I'm not hiding…
t-mart
  • 890
  • 11
  • 27
3
votes
1 answer

m4 expand macro inside words

I am very new to m4 but cannot find this simple thing: Is it possible to expand a macro in the middle of a word? (I would use it for a counter that would be used in a C symbol name in low-level code) I mean like: define(`foo',`bar') Happy…
dennis90
  • 239
  • 1
  • 4
  • 12
3
votes
1 answer

WordNet, Query Expansion, Step by Step

I want to make a project about query expansion using WordNet,but it's hard to find step by step method to do it. Based on this article, I should take the following steps (assuming a sentence as input to the program): Tokenization Tagging part of…
Ahimsa Afrizal
  • 81
  • 1
  • 2
  • 9
3
votes
2 answers

I don't know how lisp macro construct its expansion? what's the exact step?

I tried to write a macro and execute it as follow. but it failed to execute. (defmacro times_two (var) (* 2 var)) (times_two '(+ 1 2)) In my imagination, I think the expansion would be (* 2 (+ 1 2)). and after execution, the result would be 6. But…
3
votes
1 answer

Android Expansion Files Library Setup

I have been trying to implement Expansion files unsuccessfully. I have included the libraries for Licensing, Expansion, and zip files as external jar files to the sample project and everything seems to be fine and all errors go away. When I run the…
Dan D.
  • 31
  • 2
3
votes
3 answers

Android expansion apk problems

We recently started making use of the new Google Expansion APK mechanism. Overall it works well, but it seems somewhat flakey for us. Some questions: Some users get the expansion app downloaded along with the app while others don't and our app…
btschumy
  • 1,435
  • 1
  • 18
  • 35
2
votes
1 answer

Will the expansion files be deleted when an user removes your application from there phone / tablet?

Google just gave us a new option to add expansion files to our android apps. Very great idea! But something is bugging me for a long time in Android and I'm wondering if the Google developers have solved that issue with this solution. When I'm…
Peter Fortuin
  • 5,041
  • 8
  • 41
  • 69
2
votes
4 answers

String expansion in bash with embedded quotes

Problem: The following shell script code does not produce the expected result: # MYSQL, MyUSER MyHost etc ... all defined above as normal TARG_DB="zztest"; DB_CREATE="$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse 'create database…
dreftymac
  • 31,404
  • 26
  • 119
  • 182
2
votes
2 answers

Scala Case Class Map Expansion

In groovy one can do: class Foo { Integer a,b } Map map = [a:1,b:2] def foo = new Foo(map) // map expanded, object created I understand that Scala is not in any sense of the word, Groovy, but am wondering if map expansion in this context is…
virtualeyes
  • 11,147
  • 6
  • 56
  • 91