16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * doname.c
28 *
29 * Figure out which targets are out of date and rebuild them
30 */
31
32 /*
33 * Included files
34 */
35 #include <alloca.h> /* alloca() */
36 #if defined(TEAMWARE_MAKE_CMN)
37 #include <avo/util.h> /* avo_get_user(), avo_hostname() */
38 #endif
39
40 #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
41 # include <avo/strings.h> /* AVO_STRDUP() */
42 # include <dm/Avo_MToolJobResultMsg.h>
43 # include <dm/Avo_MToolJobStartMsg.h>
44 # include <dm/Avo_MToolRsrcInfoMsg.h>
45 # include <dm/Avo_macro_defs.h> /* AVO_BLOCK_INTERUPTS & AVO_UNBLOCK_INTERUPTS */
46 # include <dmthread/Avo_ServerState.h>
47 # include <rw/pstream.h>
48 # include <rw/xdrstrea.h>
49 #endif
50
51 #include <fcntl.h>
52 #include <mk/defs.h>
53 #include <mksh/i18n.h> /* get_char_semantics_value() */
54 #include <mksh/macro.h> /* getvar(), expand_value() */
55 #include <mksh/misc.h> /* getmem() */
56 #include <poll.h>
57
58
3284 * Each target carries a possibly empty set of conditional properties.
3285 *
3286 * Parameters:
3287 * target The target to set conditional macros for
3288 * old_locals Space to store old values in
3289 *
3290 * Global variables used:
3291 * debug_level Should we trace activity?
3292 * is_conditional We need to preserve this value
3293 * recursion_level Used for tracing
3294 */
3295 void
3296 set_locals(register Name target, register Property old_locals)
3297 {
3298 register Property conditional;
3299 register int i;
3300 register Boolean saved_conditional_macro_used;
3301 Chain cond_name;
3302 Chain cond_chain;
3303
3304 #ifdef DISTRIBUTED
3305 if (target->dont_activate_cond_values) {
3306 return;
3307 }
3308 #endif
3309
3310 saved_conditional_macro_used = conditional_macro_used;
3311
3312 /* Scan the list of conditional properties and apply each one */
3313 for (conditional = get_prop(target->prop, conditional_prop), i = 0;
3314 conditional != NULL;
3315 conditional = get_prop(conditional->next, conditional_prop),
3316 i++) {
3317 /* Save the old value */
3318 old_locals[i].body.macro =
3319 maybe_append_prop(conditional->body.conditional.name,
3320 macro_prop)->body.macro;
3321 if (debug_level > 1) {
3322 (void) printf(catgets(catd, 1, 38, "%*sActivating conditional value: "),
3323 recursion_level,
3324 "");
3325 }
3326 /* Set the conditional value. Macros are expanded when the */
3327 /* macro is refd as usual */
3328 if ((conditional->body.conditional.name != virtual_root) ||
3345 /*
3346 * reset_locals(target, old_locals, conditional, index)
3347 *
3348 * Removes any conditional macros for the target.
3349 *
3350 * Parameters:
3351 * target The target we are retoring values for
3352 * old_locals The values to restore
3353 * conditional The first conditional block for the target
3354 * index into the old_locals vector
3355 * Global variables used:
3356 * debug_level Should we trace activities?
3357 * recursion_level Used for tracing
3358 */
3359 void
3360 reset_locals(register Name target, register Property old_locals, register Property conditional, register int index)
3361 {
3362 register Property this_conditional;
3363 Chain cond_chain;
3364
3365 #ifdef DISTRIBUTED
3366 if (target->dont_activate_cond_values) {
3367 return;
3368 }
3369 #endif
3370
3371 /* Scan the list of conditional properties and restore the old value */
3372 /* to each one Reverse the order relative to when we assigned macros */
3373 this_conditional = get_prop(conditional->next, conditional_prop);
3374 if (this_conditional != NULL) {
3375 reset_locals(target, old_locals, this_conditional, index+1);
3376 } else {
3377 /* Remove conditional target from chain */
3378 if (conditional_targets == NULL ||
3379 conditional_targets->name != target) {
3380 warning(catgets(catd, 1, 39, "Internal error: reset target not at head of condtional_targets chain"));
3381 } else {
3382 cond_chain = conditional_targets->next;
3383 retmem_mb((caddr_t) conditional_targets);
3384 conditional_targets = cond_chain;
3385 }
3386 }
3387 get_prop(conditional->body.conditional.name->prop,
3388 macro_prop)->body.macro = old_locals[index].body.macro;
3389 if (conditional->body.conditional.name == virtual_root) {
|
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * doname.c
28 *
29 * Figure out which targets are out of date and rebuild them
30 */
31
32 /*
33 * Included files
34 */
35 #include <alloca.h> /* alloca() */
36
37 #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
38 # include <avo/strings.h> /* AVO_STRDUP() */
39 # include <dm/Avo_MToolJobResultMsg.h>
40 # include <dm/Avo_MToolJobStartMsg.h>
41 # include <dm/Avo_MToolRsrcInfoMsg.h>
42 # include <dm/Avo_macro_defs.h> /* AVO_BLOCK_INTERUPTS & AVO_UNBLOCK_INTERUPTS */
43 # include <dmthread/Avo_ServerState.h>
44 # include <rw/pstream.h>
45 # include <rw/xdrstrea.h>
46 #endif
47
48 #include <fcntl.h>
49 #include <mk/defs.h>
50 #include <mksh/i18n.h> /* get_char_semantics_value() */
51 #include <mksh/macro.h> /* getvar(), expand_value() */
52 #include <mksh/misc.h> /* getmem() */
53 #include <poll.h>
54
55
3281 * Each target carries a possibly empty set of conditional properties.
3282 *
3283 * Parameters:
3284 * target The target to set conditional macros for
3285 * old_locals Space to store old values in
3286 *
3287 * Global variables used:
3288 * debug_level Should we trace activity?
3289 * is_conditional We need to preserve this value
3290 * recursion_level Used for tracing
3291 */
3292 void
3293 set_locals(register Name target, register Property old_locals)
3294 {
3295 register Property conditional;
3296 register int i;
3297 register Boolean saved_conditional_macro_used;
3298 Chain cond_name;
3299 Chain cond_chain;
3300
3301 if (target->dont_activate_cond_values) {
3302 return;
3303 }
3304
3305 saved_conditional_macro_used = conditional_macro_used;
3306
3307 /* Scan the list of conditional properties and apply each one */
3308 for (conditional = get_prop(target->prop, conditional_prop), i = 0;
3309 conditional != NULL;
3310 conditional = get_prop(conditional->next, conditional_prop),
3311 i++) {
3312 /* Save the old value */
3313 old_locals[i].body.macro =
3314 maybe_append_prop(conditional->body.conditional.name,
3315 macro_prop)->body.macro;
3316 if (debug_level > 1) {
3317 (void) printf(catgets(catd, 1, 38, "%*sActivating conditional value: "),
3318 recursion_level,
3319 "");
3320 }
3321 /* Set the conditional value. Macros are expanded when the */
3322 /* macro is refd as usual */
3323 if ((conditional->body.conditional.name != virtual_root) ||
3340 /*
3341 * reset_locals(target, old_locals, conditional, index)
3342 *
3343 * Removes any conditional macros for the target.
3344 *
3345 * Parameters:
3346 * target The target we are retoring values for
3347 * old_locals The values to restore
3348 * conditional The first conditional block for the target
3349 * index into the old_locals vector
3350 * Global variables used:
3351 * debug_level Should we trace activities?
3352 * recursion_level Used for tracing
3353 */
3354 void
3355 reset_locals(register Name target, register Property old_locals, register Property conditional, register int index)
3356 {
3357 register Property this_conditional;
3358 Chain cond_chain;
3359
3360 if (target->dont_activate_cond_values) {
3361 return;
3362 }
3363
3364 /* Scan the list of conditional properties and restore the old value */
3365 /* to each one Reverse the order relative to when we assigned macros */
3366 this_conditional = get_prop(conditional->next, conditional_prop);
3367 if (this_conditional != NULL) {
3368 reset_locals(target, old_locals, this_conditional, index+1);
3369 } else {
3370 /* Remove conditional target from chain */
3371 if (conditional_targets == NULL ||
3372 conditional_targets->name != target) {
3373 warning(catgets(catd, 1, 39, "Internal error: reset target not at head of condtional_targets chain"));
3374 } else {
3375 cond_chain = conditional_targets->next;
3376 retmem_mb((caddr_t) conditional_targets);
3377 conditional_targets = cond_chain;
3378 }
3379 }
3380 get_prop(conditional->body.conditional.name->prop,
3381 macro_prop)->body.macro = old_locals[index].body.macro;
3382 if (conditional->body.conditional.name == virtual_root) {
|