- Timestamp:
- Dec 29, 2008 4:08:15 PM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/function.c
r2157 r2159 5175 5175 unsigned int len; 5176 5176 #endif 5177 #if defined (CONFIG_WITH_EVALPLUS) || defined (CONFIG_WITH_VALUE_LENGTH) 5178 char num[11]; 5179 #endif 5177 5180 5178 5181 /* There is no way to define a variable with a space in the name, so strip … … 5230 5233 5231 5234 for (i=0; *argv; ++i, ++argv) 5235 #ifdef CONFIG_WITH_VALUE_LENGTH 5236 define_variable (num, sprintf (num, "%d", i), *argv, o_automatic, 0); 5237 #else 5232 5238 { 5233 5239 char num[11]; … … 5236 5242 define_variable (num, strlen (num), *argv, o_automatic, 0); 5237 5243 } 5244 #endif 5245 5246 #ifdef CONFIG_WITH_EVALPLUS 5247 /* $(.ARGC) is the argument count. */ 5248 5249 len = sprintf (num, "%d", i - 1); 5250 define_variable_vl (".ARGC", sizeof (".ARGC") - 1, num, len, 5251 1 /* dup val */, o_automatic, 0); 5252 define_variable (".ARGC", sizeof (".ARGC") - 1, num, o_automatic, 0); 5253 #endif 5238 5254 5239 5255 /* If the number of arguments we have is < max_args, it means we're inside … … 5243 5259 5244 5260 for (; i < max_args; ++i) 5261 #ifdef CONFIG_WITH_VALUE_LENGTH 5262 define_variable (num, sprintf (num, "%d", i), "", o_automatic, 0); 5263 #else 5245 5264 { 5246 5265 char num[11]; 5247 5266 5248 #ifndef CONFIG_WITH_VALUE_LENGTH5249 5267 sprintf (num, "%d", i); 5250 5268 define_variable (num, strlen (num), "", o_automatic, 0); 5251 #else 5252 define_variable (num, sprintf (num, "%d", i), "", o_automatic, 0); 5253 #endif 5254 } 5269 } 5270 #endif 5255 5271 5256 5272 saved_args = max_args; -
trunk/src/kmk/tests/scripts/functions/evalcall
r2158 r2159 77 77 endif 78 78 79 # negative tests: 79 80 # Negative tests: 80 81 81 82 .RETURN = $2 $1 … … 91 92 endif 92 93 94 95 # Test .ARGC: 96 97 FUNC = local .RETURN = $(.ARGC) 98 ifneq ($(evalcall FUNC,a,b),2) 99 $(error sub-test 20 failed) 100 endif 101 ifneq ($(evalcall FUNC),0) 102 $(error sub-test 21 failed) 103 endif 104 ifneq ($(evalcall FUNC,aasdfasdf),1) 105 $(error sub-test 22 failed) 106 endif 107 108 93 109 .PHONY: all 94 110 all: ; @: … … 99 115 100 116 101 102 117 # Indicate that we're done. 103 118 1;
Note:
See TracChangeset
for help on using the changeset viewer.