BRL-CAD
comb_std.c
Go to the documentation of this file.
1 /* C O M B _ S T D . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file libged/comb_std.c
21  *
22  * The c command.
23  *
24  */
25 
26 
27 #include "common.h"
28 
29 #include <string.h>
30 
31 #include "tcl.h"
32 
33 #include "bu/getopt.h"
34 #include "vmath.h"
35 #include "rtgeom.h"
36 #include "ged.h"
37 
38 
39 struct tokens {
40  struct bu_list l;
41  short type;
42  union tree *tp;
43 };
44 
45 
46 /* token types */
47 #define TOK_NULL 0
48 #define TOK_LPAREN 1
49 #define TOK_RPAREN 2
50 #define TOK_UNION 3
51 #define TOK_INTER 4
52 #define TOK_SUBTR 5
53 #define TOK_TREE 6
54 
55 HIDDEN void
56 free_tokens(struct bu_list *hp)
57 {
58  struct tokens *tok;
59 
60  BU_CK_LIST_HEAD(hp);
61 
62  while (BU_LIST_WHILE(tok, tokens, hp)) {
63  BU_LIST_DEQUEUE(&tok->l);
64  if (tok->type == TOK_TREE) {
66  }
67  }
68 }
69 
70 
71 HIDDEN void
72 append_union(struct bu_list *hp)
73 {
74  struct tokens *tok;
75 
76  BU_CK_LIST_HEAD(hp);
77 
78  BU_ALLOC(tok, struct tokens);
79  tok->type = TOK_UNION;
80  tok->tp = (union tree *)NULL;
81  BU_LIST_INSERT(hp, &tok->l);
82 }
83 
84 
85 HIDDEN void
86 append_inter(struct bu_list *hp)
87 {
88  struct tokens *tok;
89 
90  BU_CK_LIST_HEAD(hp);
91 
92  BU_ALLOC(tok, struct tokens);
93  tok->type = TOK_INTER;
94  tok->tp = (union tree *)NULL;
95  BU_LIST_INSERT(hp, &tok->l);
96 }
97 
98 
99 HIDDEN void
101 {
102  struct tokens *tok;
103 
104  BU_CK_LIST_HEAD(hp);
105 
106  BU_ALLOC(tok, struct tokens);
107  tok->type = TOK_SUBTR;
108  tok->tp = (union tree *)NULL;
109  BU_LIST_INSERT(hp, &tok->l);
110 }
111 
112 
113 HIDDEN void
115 {
116  struct tokens *tok;
117 
118  BU_CK_LIST_HEAD(hp);
119 
120  BU_ALLOC(tok, struct tokens);
121  tok->type = TOK_LPAREN;
122  tok->tp = (union tree *)NULL;
123  BU_LIST_INSERT(hp, &tok->l);
124 }
125 
126 
127 HIDDEN void
129 {
130  struct tokens *tok;
131 
132  BU_CK_LIST_HEAD(hp);
133 
134  BU_ALLOC(tok, struct tokens);
135  tok->type = TOK_RPAREN;
136  tok->tp = (union tree *)NULL;
137  BU_LIST_INSERT(hp, &tok->l);
138 }
139 
140 
141 HIDDEN int
142 add_operator(struct ged *gedp, struct bu_list *hp, char *ptr, short int *last_tok)
143 {
144  db_op_t op = db_str2op(ptr);
145 
146  BU_CK_LIST_HEAD(hp);
147 
148  switch (op) {
149  case DB_OP_UNION:
150  append_union(hp);
151  *last_tok = TOK_UNION;
152  break;
153  case DB_OP_INTERSECT:
154  append_inter(hp);
155  *last_tok = TOK_INTER;
156  break;
157  case DB_OP_SUBTRACT:
158  append_subtr(hp);
159  *last_tok = TOK_SUBTR;
160  break;
161  default:
162  bu_vls_printf(gedp->ged_result_str, "Illegal operator: %c (0x%x), aborting\n", ptr[0], ptr[0]);
163  free_tokens(hp);
164  return GED_ERROR;
165  }
166  return GED_OK;
167 }
168 
169 
170 HIDDEN int
171 add_operand(struct ged *gedp, struct bu_list *hp, char *name)
172 {
173  char *ptr_lparen;
174  char *ptr_rparen;
175  int name_len;
176  union tree *node;
177  struct tokens *tok;
178 
179  BU_CK_LIST_HEAD(hp);
180 
181  ptr_lparen = strchr(name, '(');
182  ptr_rparen = strchr(name, ')');
183 
184  RT_GET_TREE(node, &rt_uniresource);
185  node->tr_op = OP_DB_LEAF;
186  node->tr_l.tl_mat = (matp_t)NULL;
187  if (ptr_lparen || ptr_rparen) {
188  int tmp1, tmp2;
189 
190  if (ptr_rparen)
191  tmp1 = ptr_rparen - name;
192  else
193  tmp1 = (-1);
194  if (ptr_lparen)
195  tmp2 = ptr_lparen - name;
196  else
197  tmp2 = (-1);
198 
199  if (tmp2 == (-1) && tmp1 > 0)
200  name_len = tmp1;
201  else if (tmp1 == (-1) && tmp2 > 0)
202  name_len = tmp2;
203  else if (tmp1 > 0 && tmp2 > 0) {
204  if (tmp1 < tmp2)
205  name_len = tmp1;
206  else
207  name_len = tmp2;
208  } else {
209  bu_vls_printf(gedp->ged_result_str, "Cannot determine length of operand name: %s, aborting\n", name);
210  return 0;
211  }
212  } else
213  name_len = (int)strlen(name);
214 
215  node->tr_l.tl_name = (char *)bu_malloc(name_len+1, "node name");
216  bu_strlcpy(node->tr_l.tl_name, name, name_len+1);
217 
218  BU_ALLOC(tok, struct tokens);
219  tok->type = TOK_TREE;
220  tok->tp = node;
221  BU_LIST_INSERT(hp, &tok->l);
222  return name_len;
223 }
224 
225 
226 HIDDEN void
227 do_inter(struct bu_list *hp)
228 {
229  struct tokens *tok;
230 
231  for (BU_LIST_FOR(tok, tokens, hp)) {
232  struct tokens *prev, *next;
233  union tree *tp;
234 
235  if (tok->type != TOK_INTER)
236  continue;
237 
238  prev = BU_LIST_PREV(tokens, &tok->l);
239  next = BU_LIST_NEXT(tokens, &tok->l);
240 
241  if (prev->type !=TOK_TREE || next->type != TOK_TREE)
242  continue;
243 
244  /* this is an eligible intersection operation */
245  BU_ALLOC(tp, union tree);
246  RT_TREE_INIT(tp);
247  tp->tr_b.tb_op = OP_INTERSECT;
248  tp->tr_b.tb_regionp = (struct region *)NULL;
249  tp->tr_b.tb_left = prev->tp;
250  tp->tr_b.tb_right = next->tp;
251  BU_LIST_DEQUEUE(&tok->l);
252  bu_free((char *)tok, "tok");
253  BU_LIST_DEQUEUE(&prev->l);
254  bu_free((char *)prev, "prev");
255  next->tp = tp;
256  tok = next;
257  }
258 }
259 
260 
261 HIDDEN void
263 {
264  struct tokens *tok;
265 
266  for (BU_LIST_FOR(tok, tokens, hp)) {
267  struct tokens *prev, *next;
268  union tree *tp;
269 
270  if (tok->type != TOK_UNION && tok->type != TOK_SUBTR)
271  continue;
272 
273  prev = BU_LIST_PREV(tokens, &tok->l);
274  next = BU_LIST_NEXT(tokens, &tok->l);
275 
276  if (prev->type !=TOK_TREE || next->type != TOK_TREE)
277  continue;
278 
279  /* this is an eligible operation */
280  BU_ALLOC(tp, union tree);
281  RT_TREE_INIT(tp);
282  if (tok->type == TOK_UNION)
283  tp->tr_b.tb_op = OP_UNION;
284  else
285  tp->tr_b.tb_op = OP_SUBTRACT;
286  tp->tr_b.tb_regionp = (struct region *)NULL;
287  tp->tr_b.tb_left = prev->tp;
288  tp->tr_b.tb_right = next->tp;
289  BU_LIST_DEQUEUE(&tok->l);
290  bu_free((char *)tok, "tok");
291  BU_LIST_DEQUEUE(&prev->l);
292  bu_free((char *)prev, "prev");
293  next->tp = tp;
294  tok = next;
295  }
296 }
297 
298 
299 HIDDEN int
300 do_paren(struct bu_list *hp)
301 {
302  struct tokens *tok;
303 
304  for (BU_LIST_FOR(tok, tokens, hp)) {
305  struct tokens *prev, *next;
306 
307  if (tok->type != TOK_TREE)
308  continue;
309 
310  prev = BU_LIST_PREV(tokens, &tok->l);
311  next = BU_LIST_NEXT(tokens, &tok->l);
312 
313  if (prev->type !=TOK_LPAREN || next->type != TOK_RPAREN)
314  continue;
315 
316  /* this is an eligible operand surrounded by parens */
317  BU_LIST_DEQUEUE(&next->l);
318  bu_free((char *)next, "next");
319  BU_LIST_DEQUEUE(&prev->l);
320  bu_free((char *)prev, "prev");
321  }
322 
323  if (hp->forw == hp->back && hp->forw != hp)
324  return 1; /* done */
325  else if (BU_LIST_IS_EMPTY(hp))
326  return -1; /* empty tree!!!! */
327  else
328  return 0; /* more to do */
329 
330 }
331 
332 
333 HIDDEN union tree *
334 eval_bool(struct bu_list *hp)
335 {
336  int done=0;
337  union tree *final_tree;
338  struct tokens *tok;
339 
340  while (done != 1) {
341  do_inter(hp);
342  do_union_subtr(hp);
343  done = do_paren(hp);
344  }
345 
346  tok = BU_LIST_NEXT(tokens, hp);
347  final_tree = tok->tp;
348  BU_LIST_DEQUEUE(&tok->l);
349  bu_free((char *)tok, "tok");
350 
351  return final_tree;
352 }
353 
354 
355 HIDDEN int
356 check_syntax(struct ged *gedp, struct bu_list *hp, char *comb_name, struct directory *dp)
357 {
358  struct tokens *tok;
359  int paren_count = 0;
360  int paren_error = 0;
361  int missing_exp = 0;
362  int missing_op = 0;
363  int op_count = 0;
364  int arg_count = 0;
365  int circular_ref = 0;
366  int errors = 0;
367  short last_tok = TOK_NULL;
368 
369  for (BU_LIST_FOR(tok, tokens, hp)) {
370  switch (tok->type) {
371  case TOK_LPAREN:
372  paren_count++;
373  if (last_tok == TOK_RPAREN)
374  missing_op++;
375  break;
376  case TOK_RPAREN:
377  paren_count--;
378  if (last_tok == TOK_LPAREN)
379  missing_exp++;
380  break;
381  case TOK_UNION:
382  case TOK_SUBTR:
383  case TOK_INTER:
384  op_count++;
385  break;
386  case TOK_TREE:
387  arg_count++;
388  if (!dp && BU_STR_EQUAL(comb_name, tok->tp->tr_l.tl_name))
389  circular_ref++;
390  else if (db_lookup(gedp->ged_wdbp->dbip, tok->tp->tr_l.tl_name, LOOKUP_QUIET) == RT_DIR_NULL)
391  bu_vls_printf(gedp->ged_result_str, "WARNING: '%s' does not currently exist\n", tok->tp->tr_l.tl_name);
392  break;
393  }
394  if (paren_count < 0)
395  paren_error++;
396  last_tok = tok->type;
397  }
398 
399  if (paren_count || paren_error) {
400  bu_vls_printf(gedp->ged_result_str, "ERROR: unbalanced parenthesis\n");
401  errors++;
402  }
403 
404  if (missing_exp) {
405  bu_vls_printf(gedp->ged_result_str, "ERROR: empty parenthesis (missing expression)\n");
406  errors++;
407  }
408 
409  if (missing_op) {
410  bu_vls_printf(gedp->ged_result_str, "ERROR: must have operator between ')('\n");
411  errors++;
412  }
413 
414  if (op_count != arg_count-1) {
415  bu_vls_printf(gedp->ged_result_str, "ERROR: mismatch of operators and operands\n");
416  errors++;
417  }
418 
419  if (circular_ref) {
420  bu_vls_printf(gedp->ged_result_str, "ERROR: combination cannot reference itself during initial creation\n");
421  errors++;
422  }
423 
424  if (errors) {
425  bu_vls_printf(gedp->ged_result_str, "\t---------aborting!\n");
426  return 1;
427  }
428 
429  return 0;
430 }
431 
432 
433 int
434 ged_comb_std(struct ged *gedp, int argc, const char *argv[])
435 {
436  char *comb_name;
437  int ch;
438  int region_flag = -1;
439  struct directory *dp = RT_DIR_NULL;
440  struct rt_db_internal intern;
441  struct rt_comb_internal *comb = NULL;
442  struct tokens tok_hd;
443  short last_tok;
444  int i;
445  union tree *final_tree;
446  static const char *usage = "[-cr] comb_name <boolean_expr>";
447 
450  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
451 
452  /* initialize result */
453  bu_vls_trunc(gedp->ged_result_str, 0);
454 
455  /* must be wanting help */
456  if (argc == 1) {
457  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
458  return GED_HELP;
459  }
460 
461  if (argc < 3) {
462  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
463  return GED_ERROR;
464  }
465 
466  /* Parse options */
467  bu_optind = 1; /* re-init bu_getopt() */
468  while ((ch = bu_getopt(argc, (char * const *)argv, "cgr?")) != -1) {
469  switch (ch) {
470  case 'c':
471  case 'g':
472  region_flag = 0;
473  break;
474  case 'r':
475  region_flag = 1;
476  break;
477  /* XXX How about -p and -v for FASTGEN? */
478  case '?':
479  default:
480  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
481  return GED_OK;
482  }
483  }
484  argc -= (bu_optind + 1);
485  argv += bu_optind;
486 
487  comb_name = (char *)*argv++;
488  if (argc == -1) {
489  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
490  return GED_OK;
491  }
492 
493  if ((region_flag != -1) && (argc == 0)) {
494  /*
495  * Set/Reset the REGION flag of an existing combination
496  */
497  GED_DB_LOOKUP(gedp, dp, comb_name, LOOKUP_NOISY, GED_ERROR & GED_QUIET);
498 
499  if (!(dp->d_flags & RT_DIR_COMB)) {
500  bu_vls_printf(gedp->ged_result_str, "%s is not a combination\n", comb_name);
501  return GED_ERROR;
502  }
503 
504  GED_DB_GET_INTERNAL(gedp, &intern, dp, (fastf_t *)NULL, &rt_uniresource, GED_ERROR);
505  comb = (struct rt_comb_internal *)intern.idb_ptr;
506  RT_CK_COMB(comb);
507 
508  if (region_flag) {
509  if (!comb->region_flag) {
510  /* assign values from the defaults */
511  comb->region_id = gedp->ged_wdbp->wdb_item_default++;
512  comb->aircode = gedp->ged_wdbp->wdb_air_default;
513  comb->GIFTmater = gedp->ged_wdbp->wdb_mat_default;
514  comb->los = gedp->ged_wdbp->wdb_los_default;
515  }
516  comb->region_flag = 1;
517  } else
518  comb->region_flag = 0;
519 
520  GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
521 
522  return GED_OK;
523  }
524  /*
525  * At this point, we know we have a Boolean expression.
526  * If the combination already existed and region_flag is -1,
527  * then leave its region_flag alone.
528  * If the combination didn't exist yet,
529  * then pretend region_flag was 0.
530  * Otherwise, make sure to set its c_flags according to region_flag.
531  */
532 
533  GED_CHECK_EXISTS(gedp, comb_name, LOOKUP_QUIET, GED_ERROR);
534  dp = RT_DIR_NULL;
535 
536  /* parse Boolean expression */
537  BU_LIST_INIT(&tok_hd.l);
538  tok_hd.type = TOK_NULL;
539 
540  last_tok = TOK_LPAREN;
541  for (i = 0; i < argc; i++) {
542  char *ptr;
543 
544  ptr = (char *)argv[i];
545  while (*ptr) {
546  while (*ptr == '(' || *ptr == ')') {
547  switch (*ptr) {
548  case '(':
549  append_lparen(&tok_hd.l);
550  last_tok = TOK_LPAREN;
551  break;
552  case ')':
553  append_rparen(&tok_hd.l);
554  last_tok = TOK_RPAREN;
555  break;
556  }
557  ptr++;
558  }
559 
560  if (*ptr == '\0')
561  continue;
562 
563  if (last_tok == TOK_RPAREN) {
564  /* next token MUST be an operator */
565  if (add_operator(gedp, &tok_hd.l, ptr, &last_tok) == GED_ERROR) {
566  free_tokens(&tok_hd.l);
567  return GED_ERROR;
568  }
569  ptr++;
570  } else if (last_tok == TOK_LPAREN) {
571  /* next token MUST be an operand */
572  int name_len;
573 
574  name_len = add_operand(gedp, &tok_hd.l, ptr);
575  if (name_len < 1) {
576  free_tokens(&tok_hd.l);
577  return GED_ERROR;
578  }
579  last_tok = TOK_TREE;
580  ptr += name_len;
581  } else if (last_tok == TOK_TREE) {
582  /* must be an operator */
583  if (add_operator(gedp, &tok_hd.l, ptr, &last_tok) == GED_ERROR) {
584  free_tokens(&tok_hd.l);
585  return GED_ERROR;
586  }
587  ptr++;
588  } else if (last_tok == TOK_UNION ||
589  last_tok == TOK_INTER ||
590  last_tok == TOK_SUBTR) {
591  /* must be an operand */
592  int name_len;
593 
594  name_len = add_operand(gedp, &tok_hd.l, ptr);
595  if (name_len < 1) {
596  free_tokens(&tok_hd.l);
597  return GED_ERROR;
598  }
599  last_tok = TOK_TREE;
600  ptr += name_len;
601  }
602  }
603  }
604 
605  if (check_syntax(gedp, &tok_hd.l, comb_name, dp)) {
606  free_tokens(&tok_hd.l);
607  return GED_ERROR;
608  }
609 
610  final_tree = eval_bool(&tok_hd.l);
611 
612  {
613  int flags;
614 
615  flags = RT_DIR_COMB;
616  BU_ALLOC(comb, struct rt_comb_internal);
617  RT_COMB_INTERNAL_INIT(comb);
618 
619  comb->tree = final_tree;
620 
621  comb->region_id = -1;
622  if (region_flag == (-1))
623  comb->region_flag = 0;
624  else
625  comb->region_flag = region_flag;
626 
627  if (comb->region_flag) {
628  comb->region_flag = 1;
629  comb->region_id = gedp->ged_wdbp->wdb_item_default++;
630  comb->aircode = gedp->ged_wdbp->wdb_air_default;
631  comb->los = gedp->ged_wdbp->wdb_los_default;
632  comb->GIFTmater = gedp->ged_wdbp->wdb_mat_default;
633 
634  bu_vls_printf(gedp->ged_result_str, "Creating region with attrs: region_id=%d, ", comb->region_id);
635  if (comb->aircode)
636  bu_vls_printf(gedp->ged_result_str, "air=%d, ", comb->aircode);
637  bu_vls_printf(gedp->ged_result_str, "los=%d, material_id=%d\n",
638  comb->los,
639  comb->GIFTmater);
640 
641  flags |= RT_DIR_REGION;
642  }
643 
644  RT_DB_INTERNAL_INIT(&intern);
645  intern.idb_major_type = DB5_MAJORTYPE_BRLCAD;
646  intern.idb_type = ID_COMBINATION;
647  intern.idb_meth = &OBJ[ID_COMBINATION];
648  intern.idb_ptr = (void *)comb;
649 
650  GED_DB_DIRADD(gedp, dp, comb_name, RT_DIR_PHONY_ADDR, 0, flags, (void *)&intern.idb_type, GED_ERROR);
651  GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
652  }
653 
654  return GED_OK;
655 }
656 
657 
658 /*
659  * Local Variables:
660  * mode: C
661  * tab-width: 8
662  * indent-tabs-mode: t
663  * c-file-style: "stroustrup"
664  * End:
665  * ex: shiftwidth=4 tabstop=8
666  */
int wdb_item_default
GIFT region ID.
Definition: raytrace.h:1278
void usage(struct ged *gedp)
Definition: coil.c:315
#define GED_DB_DIRADD(_gedp, _dp, _name, _laddr, _len, _dirflags, _ptr, _flags)
Definition: ged.h:213
#define GED_OK
Definition: ged.h:55
#define BU_LIST_FOR(p, structure, hp)
Definition: list.h:365
short type
Definition: comb_std.c:41
#define BU_LIST_INSERT(old, new)
Definition: list.h:183
#define TOK_UNION
Definition: comb_std.c:50
char region_flag
!0 ==> this COMB is a REGION
Definition: raytrace.h:939
Definition: list.h:118
int wdb_mat_default
GIFT material code.
Definition: raytrace.h:1280
int tb_op
non-leaf
Definition: raytrace.h:1147
Definition: ged.h:338
struct db_i * dbip
Definition: raytrace.h:1266
Definition: clone.c:90
#define GED_DB_LOOKUP(_gedp, _dp, _name, _noisy, _flags)
Definition: ged.h:223
#define TOK_TREE
Definition: comb_std.c:53
#define TOK_SUBTR
Definition: comb_std.c:52
void bu_vls_trunc(struct bu_vls *vp, int len)
Definition: vls.c:198
#define BU_LIST_IS_EMPTY(hp)
Definition: list.h:295
#define GED_CHECK_ARGC_GT_0(_gedp, _argc, _flags)
Definition: ged.h:202
struct directory * db_lookup(const struct db_i *, const char *name, int noisy)
Definition: db_lookup.c:153
#define RT_CK_COMB(_p)
Definition: raytrace.h:955
struct region * tb_regionp
ptr to containing region
Definition: raytrace.h:1148
#define TOK_INTER
Definition: comb_std.c:51
struct rt_wdb * ged_wdbp
Definition: ged.h:340
Header file for the BRL-CAD common definitions.
int bu_optind
Definition: globals.c:89
db_op_t db_str2op(const char *str)
Definition: op.c:31
#define RT_DIR_REGION
region
Definition: raytrace.h:885
#define ID_COMBINATION
Combination Record.
Definition: raytrace.h:499
int bu_getopt(int nargc, char *const nargv[], const char *ostr)
Definition: getopt.c:43
#define TOK_LPAREN
Definition: comb_std.c:48
#define TOK_NULL
Definition: comb_std.c:47
#define GED_ERROR
Definition: ged.h:61
#define HIDDEN
Definition: common.h:86
#define RT_TREE_INIT(_p)
Definition: raytrace.h:1189
union tree * tb_left
Definition: raytrace.h:1149
void * bu_malloc(size_t siz, const char *str)
Definition: malloc.c:314
HIDDEN union tree * eval_bool(struct bu_list *hp)
Definition: comb_std.c:334
#define GED_DB_PUT_INTERNAL(_gedp, _dp, _intern, _resource, _flags)
Definition: ged.h:243
char * strchr(const char *sp, int c)
int idb_major_type
Definition: raytrace.h:192
#define OP_SUBTRACT
Binary: L subtract R.
Definition: raytrace.h:1129
#define OP_INTERSECT
Binary: L intersect R.
Definition: raytrace.h:1128
struct resource rt_uniresource
default. Defined in librt/globals.c
Definition: globals.c:41
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
db_op_t
Definition: op.h:33
#define OP_DB_LEAF
Leaf of combination, db fmt.
Definition: raytrace.h:1139
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
HIDDEN void do_inter(struct bu_list *hp)
Definition: comb_std.c:227
#define RT_DB_INTERNAL_INIT(_p)
Definition: raytrace.h:199
#define LOOKUP_QUIET
Definition: raytrace.h:893
const struct rt_functab * idb_meth
for ft_ifree(), etc.
Definition: raytrace.h:194
#define bu_strlcpy(dst, src, size)
Definition: str.h:60
void db_free_tree(union tree *tp, struct resource *resp)
Definition: db_tree.c:1296
struct bu_list * back
"back", "last"
Definition: list.h:121
#define GED_QUIET
Definition: ged.h:64
matp_t tl_mat
xform matp, NULL ==> identity
Definition: raytrace.h:1173
#define RT_DIR_PHONY_ADDR
Special marker for d_addr field.
Definition: raytrace.h:879
char * tl_name
Name of this leaf (bu_strdup'ed)
Definition: raytrace.h:1174
int wdb_los_default
Line-of-sight estimate.
Definition: raytrace.h:1281
struct tree::tree_node tr_b
#define GED_CHECK_EXISTS(_gedp, _name, _noisy, _flags)
Definition: ged.h:171
#define TOK_RPAREN
Definition: comb_std.c:49
struct bu_vls * ged_result_str
Definition: ged.h:357
#define BU_LIST_WHILE(p, structure, hp)
Definition: list.h:410
HIDDEN void append_subtr(struct bu_list *hp)
Definition: comb_std.c:100
struct tree::tree_db_leaf tr_l
HIDDEN int add_operand(struct ged *gedp, struct bu_list *hp, char *name)
Definition: comb_std.c:171
union tree * tb_right
Definition: raytrace.h:1150
#define BU_LIST_INIT(_hp)
Definition: list.h:148
void * idb_ptr
Definition: raytrace.h:195
HIDDEN void free_tokens(struct bu_list *hp)
Definition: comb_std.c:56
#define RT_DIR_COMB
combination
Definition: raytrace.h:884
const struct rt_functab OBJ[]
Definition: table.c:159
Definition: op.h:35
#define RT_GET_TREE(_tp, _res)
Definition: raytrace.h:1210
#define RT_COMB_INTERNAL_INIT(_p)
Definition: raytrace.h:960
int ged_comb_std(struct ged *gedp, int argc, const char *argv[])
Definition: comb_std.c:434
union tree * tree
Leading to tree_db_leaf leaves.
Definition: raytrace.h:938
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
#define RT_DIR_NULL
Definition: raytrace.h:875
HIDDEN int check_syntax(struct ged *gedp, struct bu_list *hp, char *comb_name, struct directory *dp)
Definition: comb_std.c:356
#define LOOKUP_NOISY
Definition: raytrace.h:892
HIDDEN void append_rparen(struct bu_list *hp)
Definition: comb_std.c:128
#define GED_HELP
Definition: ged.h:62
HIDDEN void append_union(struct bu_list *hp)
Definition: comb_std.c:72
#define GED_DB_GET_INTERNAL(_gedp, _intern, _dp, _mat, _resource, _flags)
Definition: ged.h:233
HIDDEN int add_operator(struct ged *gedp, struct bu_list *hp, char *ptr, short int *last_tok)
Definition: comb_std.c:142
HIDDEN void append_lparen(struct bu_list *hp)
Definition: comb_std.c:114
void bu_free(void *ptr, const char *str)
Definition: malloc.c:328
#define BU_CK_LIST_HEAD(_p)
Definition: list.h:142
HIDDEN void do_union_subtr(struct bu_list *hp)
Definition: comb_std.c:262
HIDDEN void append_inter(struct bu_list *hp)
Definition: comb_std.c:86
int wdb_air_default
Definition: raytrace.h:1279
#define BU_LIST_DEQUEUE(cur)
Definition: list.h:209
struct bu_list * forw
"forward", "next"
Definition: list.h:120
#define GED_CHECK_READ_ONLY(_gedp, _flags)
Definition: ged.h:181
int d_flags
flags
Definition: raytrace.h:869
double fastf_t
Definition: defines.h:300
#define OP_UNION
Binary: L union R.
Definition: raytrace.h:1127
#define BU_LIST_NEXT(structure, hp)
Definition: list.h:316
HIDDEN int do_paren(struct bu_list *hp)
Definition: comb_std.c:300
struct bu_list l
Definition: comb_std.c:40
#define BU_LIST_PREV(structure, hp)
Definition: list.h:310
union tree * tp
Definition: comb_std.c:42
#define BU_STR_EQUAL(s1, s2)
Definition: str.h:126