Changeset 720 in kBuild for trunk/src/gmake/function.c
- Timestamp:
- Dec 15, 2006 2:41:46 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/function.c
r567 r720 2266 2266 } 2267 2267 #endif 2268 2269 2270 #ifdef CONFIG_WITH_STACK 2271 2272 /* Push an item (string without spaces). */ 2273 static char * 2274 func_stack_push (char *o, char **argv, const char *funcname) 2275 { 2276 do_variable_definition(NILF, argv[0], argv[1], o_file, f_append, 0 /* !target_var */); 2277 return o; 2278 } 2279 2280 /* Pops an item off the stack / get the top stack element. 2281 (This is what's tricky to do in pure GNU make syntax.) */ 2282 static char * 2283 func_stack_pop_top (char *o, char **argv, const char *funcname) 2284 { 2285 struct variable *stack_var; 2286 const char *stack = argv[0]; 2287 const int return_item = argv[0][sizeof("stack-pop") - 1] == '\0'; 2288 2289 stack_var = lookup_variable (stack, strlen (stack) ); 2290 if (stack_var) 2291 { 2292 unsigned int len; 2293 char *iterator = stack_var->value; 2294 char *lastitem = NULL; 2295 char *cur; 2296 2297 while ((cur = find_next_token (&iterator, &len))) 2298 lastitem = cur; 2299 2300 if (lastitem != NULL) 2301 { 2302 if (strcmp (funcname, "stack-popv") != 0) 2303 o = variable_buffer_output (o, lastitem, len); 2304 if (strcmp (funcname, "stack-top") != 0) 2305 { 2306 *lastitem = '\0'; 2307 while (lastitem > stack_var->value && isspace (lastitem[-1])) 2308 *--lastitem = '\0'; 2309 #ifdef CONFIG_WITH_VALUE_LENGTH 2310 stack_var->value_length = lastitem - stack_var->value; 2311 #endif 2312 } 2313 } 2314 } 2315 return o; 2316 } 2317 #endif /* CONFIG_WITH_STACK */ 2268 2318 2269 2319 /* Lookup table for builtin functions. … … 2331 2381 { STRING_SIZE_TUPLE("comp-vars"), 3, 3, 1, func_comp_vars}, 2332 2382 #endif 2383 #ifdef CONFIG_WITH_STACK 2384 { STRING_SIZE_TUPLE("stack-push"), 2, 2, 1, func_stack_push}, 2385 { STRING_SIZE_TUPLE("stack-pop"), 1, 1, 1, func_stack_pop_top}, 2386 { STRING_SIZE_TUPLE("stack-popv"), 1, 1, 1, func_stack_pop_top}, 2387 { STRING_SIZE_TUPLE("stack-top"), 1, 1, 1, func_stack_pop_top}, 2388 #endif 2333 2389 #ifdef KMK_HELPERS 2334 2390 { STRING_SIZE_TUPLE("kb-src-tool"), 1, 1, 0, func_kbuild_source_tool},
Note:
See TracChangeset
for help on using the changeset viewer.