Changeset 2021 in kBuild
- Timestamp:
- Nov 2, 2008 1:18:47 AM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/function.c
r2011 r2021 3705 3705 func_if_expr (char *o, char **argv, const char *funcname UNUSED) 3706 3706 { 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3707 int rc; 3708 char *to_expand; 3709 3710 /* Evaluate the condition in argv[0] and expand the 2nd or 3711 3rd argument according to the result. */ 3712 rc = expr_eval_if_conditionals (argv[0], NULL); 3713 to_expand = rc == 0 ? argv[1] : argv[2]; 3714 if (*to_expand) 3715 { 3716 char *expansion = expand_argument (to_expand, NULL); 3717 3718 o = variable_buffer_output (o, expansion, strlen (expansion)); 3719 3720 free (expansion); 3721 } 3722 3723 return o; 3724 3724 } 3725 3725 3726 3726 #endif /* CONFIG_WITH_IF_CONDITIONALS */ 3727 3728 #ifdef CONFIG_WITH_SET_CONDITIONALS 3729 static char * 3730 func_set_intersects (char *o, char **argv, const char *funcname UNUSED) 3731 { 3732 const char *s1_cur; 3733 unsigned int s1_len; 3734 const char *s1_iterator = argv[0]; 3735 3736 while ((s1_cur = find_next_token (&s1_iterator, &s1_len)) != 0) 3737 { 3738 const char *s2_cur; 3739 unsigned int s2_len; 3740 const char *s2_iterator = argv[1]; 3741 while ((s2_cur = find_next_token (&s2_iterator, &s2_len)) != 0) 3742 if (s2_len == s1_len 3743 && strneq (s2_cur, s1_cur, s1_len) ) 3744 return variable_buffer_output (o, "1", 1); /* found intersection */ 3745 } 3746 3747 return o; /* no intersection */ 3748 } 3749 #endif /* CONFIG_WITH_SET_CONDITIONALS */ 3727 3750 3728 3751 #ifdef CONFIG_WITH_STACK … … 4611 4634 { STRING_SIZE_TUPLE("if-expr"), 2, 3, 0, func_if_expr}, 4612 4635 #endif 4636 #ifdef CONFIG_WITH_SET_CONDITIONALS 4637 { STRING_SIZE_TUPLE("intersects"), 2, 2, 1, func_set_intersects}, 4638 #endif 4613 4639 #ifdef CONFIG_WITH_STACK 4614 4640 { STRING_SIZE_TUPLE("stack-push"), 2, 2, 1, func_stack_push}, -
trunk/src/kmk/variable.c
r2011 r2021 1217 1217 " explicit-multitarget" 1218 1218 " prepend-assignment" 1219 " set-conditionals "1219 " set-conditionals intersects" 1220 1220 " date" 1221 1221 " file-size" … … 1261 1261 # endif 1262 1262 # if defined (CONFIG_WITH_SET_CONDITIONALS) 1263 strcat (buf, " set-conditionals ");1263 strcat (buf, " set-conditionals intersects"); 1264 1264 # endif 1265 1265 # if defined (CONFIG_WITH_DATE)
Note:
See TracChangeset
for help on using the changeset viewer.