/* construct floorplan slicing tree from NPE */ tree_node_t *tree_from_NPE(flp_desc_t *flp_desc, tree_node_stack_t *stack, NPE_t *expr) { int i; tree_node_t *node = NULL, *left, *right; if (!tree_node_stack_isempty(stack)) fatal("stack not empty\n"); for (i=0; i < expr->size; i++) { node = (tree_node_t *) calloc(1, sizeof(tree_node_t)); if (!node) fatal("memory allocation error\n"); /* leaf */ if (expr->elements[i] >= 0) { node->curve = shape_duplicate(flp_desc->units[expr->elements[i]].shape); node->left = node->right = NULL; node->label.unit = expr->elements[i]; /* internal node denoting a cut */ } else { right = tree_node_stack_pop(stack); left = tree_node_stack_pop(stack); node->curve = shape_add(left->curve, right->curve, expr->elements[i]); node->left = left; node->right = right; node->label.cut_type = expr->elements[i]; } tree_node_stack_push(stack, node); } tree_node_stack_clear(stack); return node; }
int do_switches (int argc, const char **argv) { int i; const char *cp, *color, *type; SHAPE_TYPE t; #ifdef DDS_SECURITY const char *arg_input; #endif progname = argv [0]; for (i = 1; i < argc; i++) { cp = argv [i]; if (*cp++ != '-') break; while (*cp) { switch (*cp++) { case 'p': INC_ARG (); if (!get_str (&cp, &type)) { printf ("shape type expected!\r\n"); usage (); } t = shape_type (type); INC_ARG(); if (!get_str (&cp, &color)) { printf ("color expected!\r\n"); usage (); } shape_add (t, color); break; case 's': INC_ARG (); if (!get_str (&cp, &type)) { printf ("shape type expected!\r\n"); usage (); } t = shape_type (type); subscriptions |= 1 << t; break; #ifdef DDS_DEBUG case 'd': debug = 1; break; #endif case 'i': INC_ARG (); get_num (&cp, &domain_id, 0, 255); break; #ifdef DDS_SECURITY case 'e': INC_ARG () if (!get_str (&cp, &arg_input)) usage(); engine_id = malloc (strlen (arg_input) + 1); strcpy (engine_id, arg_input); break; case 'c': INC_ARG () if (!get_str (&cp, &arg_input)) usage (); cert_path = malloc (strlen (arg_input) + 1); strcpy (cert_path, arg_input); break; case 'k': INC_ARG () if (!get_str (&cp, &arg_input)) usage (); key_path = malloc (strlen (arg_input) + 1); strcpy (key_path, arg_input); break; case 'z': INC_ARG () if (!get_str (&cp, &arg_input)) usage (); realm_name = malloc (strlen (arg_input) + 1); strcpy (realm_name, arg_input); break; case 'j': INC_ARG () if (!get_str (&cp, &arg_input)) usage (); sname = malloc (strlen (arg_input) + 1); strcpy (sname, arg_input); sfile = 1; break; #endif case 't': trace = 1; break; case 'v': verbose = 1; if (*cp == 'v') { verbose = 2; cp++; } break; case 'x': INC_ARG (); exclusive = 1; get_num (&cp, &strength, 0, 0x7fffffff); break; case 'b': white_bg = 1; break; #ifdef XTYPES_USED case 'y': dyn_type = dyn_data = 1; break; #endif default: usage (); break; } } } return (i); }
int do_switches (int argc, const char **argv) { int i; const char *cp, *type; #if 0 const char *color; #endif SHAPE_TYPE t; progname = argv [0]; for (i = 1; i < argc; i++) { cp = argv [i]; if (*cp++ != '-') break; while (*cp) { switch (*cp++) { # if 0 case 'p': INC_ARG(); if (!get_str (&cp, &type)) { printf ("shape type expected!\r\n"); usage (); } t = shape_type (type); INC_ARG(); if (!get_str (&cp, &color)) { printf ("color expected!\r\n"); usage (); } shape_add (t, color); break; # endif case 's': INC_ARG(); if (!get_str (&cp, &type)) { printf ("shape type expected!\r\n"); usage (); } t = shape_type (type); subscriptions |= 1 << t; break; #ifdef DDS_DEBUG case 'd': debug = 1; break; #endif case 't': trace = 1; break; case 'v': verbose = 1; if (*cp == 'v') { verbose = 2; cp++; } break; default: usage (); break; } } } return (i); }