NAPA Compiler V4.50
Author: Yves Leduc, yves.leduc.be@gmail.com
Loading...
Searching...
No Matches
C:/Simulate/Napados/Source/id.c
Go to the documentation of this file.
1/* ** ID RELATED FUNCTIONS DEFINITIONS ****************************************************************************************** */
2
3#undef EXTERN
4#define EXTERN extern
5
6#include "./napa.h"
7#include "./proto.h"
8
9
10/* *** In this file: ************************************************************************************************************ */
11
12/* int is_an_instruction(const char *identifier) */
13/* int is_an_operator(const char *identifier) */
14/* int is_a_keyword(const char *identifier) */
15/* int is_a_known_function(const char *identifier) */
16/* int is_a_known_pure_function(const char *identifier) */
17/* int is_a_constant_or_a_macro_constant(const char *identifier) */
18/* int is_a_modifier(const char *identifier) */
19/* int is_node_flagged(long num) */
20/* int node_update_block(void) */
21/* int time_output_block(void) */
22/* int variable_update_block(void) */
23
24/* long alias_id(char *identifier) */
25/* long array_id(char *identifier) */
26/* long array_name_id(char *identifier) */
27/* long cmdline_id(char *identifier) */
28/* long constant_type(char *identifier) */
29/* long debug_id(char *identifier) */
30/* long declare_id(char *identifier) */
31/* long directive_id(char *identifier) */
32/* long get_type(char *identifier) */
33/* long node_kind(char *identifier) */
34/* long node_id(char *identifier) */
35/* long op_id(char *identifier) */
36/* long postprocess_id(char *identifier) */
37/* long record_id(char *identifier) */
38/* long sort_names(const void*, const void*) */
39/* long update_id(char *identifier, long num) */
40/* long user_id(char *identifier) */
41/* long usertool_num(const char *nam) */
42/* long var_id(char *identifier) */
43
44/* void flag_node(long num) */
45/* void increment_alias_number(const char *kind) */
46/* void increment_array_number(const char *kind) */
47/* void increment_assert_number(const char *kind) */
48/* void increment_call_number(const char *kind) */
49/* void increment_cmdline_number(const char *kind) */
50/* void increment_comment_number(const char *kind) */
51/* void increment_common_number(const char *kind) */
52/* void increment_const_number(void) */
53/* void increment_debug_number(const char *kind) */
54/* void increment_declare_number(const char *kind) */
55/* void increment_directive_number(const char *kind) */
56/* void increment_export_number(const char *kind) */
57/* void increment_filecell_number(const char *kind) */
58/* void increment_function_number(const char *kind) */
59/* void increment_generator_number(const char *kind) */
60/* void increment_group_number(const char *kind) */
61/* void increment_header_number(const char *kind) */
62/* void increment_inject_number(const char *kind) */
63/* void increment_init_number(const char *kind) */
64/* void increment_instance_number(const char *kind) */
65/* void increment_IO_number(const char *kind) */
66/* void increment_node_number(const char *kind) */
67/* void increment_opcode_number(const char *kind) */
68/* void increment_post_number(const char *kind) */
69/* void increment_record_number(const char *kind) */
70/* void increment_segment_number(const char *kind) */
71/* void increment_stuck_number(const char *kind) */
72/* void increment_tool_number(const char *kind) */
73/* void increment_update_number(const char *kind) */
74/* void increment_usertool_number(const char *kind) */
75/* void increment_var_number(const char *kind) */
76/* void increment_void_number(void) */
77/* void mark_constants(void) */
78/* void mark_updates_if_constant(void) */
79/* void strcpy_alloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long * mfil) */
80/* void strcpy_realloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil) */
81/* void swap_delay_inputs(long i, long j) */
82/* void swap_nodes(long i, long j) */
83/* void swap_records(long i, long j) */
84/* void swap_updates(long i, long j) */
85/* void swap_vars(long i, long j) */
86
87
88/* ***** MACROS USED IN THIS FILE *********************************************************************************************** */
89
90#define IS_IDENTIFIER(x) (0 == strcmp(identifier, x))
91
92#define IS_NAPA_PREFIX() (0 == strncmp(identifier, "napa_", (size_t) 5))
93#define IS_DEBUG_PREFIX() (0 == strncmp(identifier, "DEBUG_", (size_t) 6))
94#define IS_COMPILE_PREFIX() (0 == strncmp(identifier, "COMPILE_", (size_t) 8))
95
96
97/* ****************************************************************************************************************************** */
98
99void flag_node(long num) { /* set to -1 a node flagged in error */
100 Node_List[num].errflag = -1;
101 return;
102}
103
104
105int is_node_flagged(long num) { /* node flagged in error is set to -1 */
106 return (int) (-1 >= Node_List[num].errflag);
107}
108
109
110/* ****************************************************************************************************************************** */
111
112/* copy string after appropriate memory allocation */
113
114void strcpy_alloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil) {
115 *dest = (char*) malloc((size_t) (LENGTH(sour) + 1L));
116 if ((char*) NULL == *dest) {
117 print_error_location("malloc", mlin, mfil);
118 (void) fprintf(STDERR, " dynamic memory allocation error\n");
120 } else {
121 (void) strcpy(*dest, sour);
122 }
123 return;
124}
125
126
127/* Copy string after appropriate memory reallocation */
128
129void strcpy_realloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil) {
130 if ((char*) NULL == *dest) {
131 print_error_location("malloc", mlin, mfil);
132 (void) fprintf(STDERR, " impossible to reallocate memory for something not yet allocated\n");
133 (void) fprintf(STDERR, " when processing data <%s>\n", sour);
135 }
136 free(*dest);
137 *dest = (char*) NULL;
138 *dest = (char*) malloc((size_t) (LENGTH(sour) + 1L));
139 if ((char*) NULL == *dest) {
140 print_error_location("malloc", mlin, mfil);
141 (void) fprintf(STDERR, " dynamic memory allocation error during reallocation when processing data <%s>\n", sour);
143 } else {
144 (void) strcpy(*dest, sour);
145 }
146 return;
147}
148
149
150void increment_alias_number(const char *kind) {
151 if ((MAXALIASES - 1L) <= Num_Aliases) {
152 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
153 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
154 (void) fprintf(STDERR, " too many aliases (current max = %ld)\n", MAXALIASES);
155 print_limits();
157 }
158 Num_Aliases++;
159 return;
160}
161
162
163void increment_array_number(const char *kind) {
164 if ((MAXARRAYS - 1L) <= Num_Arrays) {
165 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
166 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
167 (void) fprintf(STDERR, " too many node arrays (current max = %ld)\n", MAXARRAYS);
168 print_limits();
170 }
171 Num_Arrays++;
172 return;
173}
174
175
176void increment_assert_number(const char *kind) {
177 if ((MAXUPDATES - 2L) <= Num_Updates) { /* YES! 'update' to prevent cryptic error message */
178 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
179 (void) fprintf(STDERR, " (%s / update) internal array overflow!", kind);
180 (void) fprintf(STDERR, " assert instruction is overflowing the update table\n");
181 print_limits();
183 }
184 Num_Asserts++;
185 return;
186}
187
188
189void increment_call_number(const char *kind) {
190 if ((MAXUPDATES - 2L) <= Num_Updates) { /* YES! 'update' to prevent cryptic error message */
191 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
192 (void) fprintf(STDERR, " (%s / update) internal array overflow!", kind);
193 (void) fprintf(STDERR, " call instruction is overflowing the update table\n");
194 print_limits();
196 }
197 Num_Calls++;
198 return;
199}
200
201
202void increment_cmdline_number(const char *kind) {
203 if ((MAXCMDLINES - 1L) <= Num_Cmdlines) {
204 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
205 (void) fprintf(STDERR, " (%s) internal command line overflow!", kind);
206 (void) fprintf(STDERR, " too many parameters in 'command_line' instructions (current max = %ld)\n", MAXCMDLINES);
207 print_limits();
209 }
210 Num_Cmdlines++;
211 return;
212}
213
214
215void increment_comment_number(const char *kind) {
216 if ((MAXCOMMENTS - 1L) <= Num_Comments) {
217 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
218 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
219 (void) fprintf(STDERR, " too many comments (current max = %ld)\n", MAXCOMMENTS);
220 print_limits();
222 }
223 Num_Comments++;
224 return;
225}
226
227
228void increment_common_number(const char *kind) {
230 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
231 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
232 (void) fprintf(STDERR, " too many declare() instructions (current max = %ld)\n", MAXDECLARECOMMONS);
233 print_limits();
235 }
237 return;
238}
239
240
241void increment_debug_number(const char *kind) {
242 if ((MAXDEBUGS - 1L) <= Num_Debugs) {
243 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
244 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
245 (void) fprintf(STDERR, " too many debug instructions (current max = %ld)\n", MAXDEBUGS);
246 print_limits();
248 }
249 Num_Debugs++;
250 return;
251}
252
253
254void increment_declare_number(const char *kind) {
255 if ((MAXDECLARES - 1L) <= Num_Declares) {
256 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
257 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
258 (void) fprintf(STDERR, " too many declare instructions (current max = %ld)\n", MAXDECLARES);
259 print_limits();
261 }
262 Num_Declares++;
263 return;
264}
265
266
267void increment_directive_number(const char *kind) {
268 if ((MAXDIRS - 1L) <= Num_Directives) {
269 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
270 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
271 (void) fprintf(STDERR, " too many user's directives (current max = %ld)\n", MAXDIRS);
272 print_limits();
274 }
276 return;
277}
278
279
280void increment_export_number(const char *kind) {
281 if ((MAXEXPORTS - 1L) <= Num_Exports) {
282 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
283 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
284 (void) fprintf(STDERR, " too many export variables (current max = %ld)\n", MAXEXPORTS);
285 print_limits();
287 }
288 Num_Exports++;
289 return;
290}
291
292
293void increment_filecell_number(const char *kind) {
294 if ((MAXFILECELLS - 1L) <= Num_FileCells) {
295 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
296 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
297 (void) fprintf(STDERR, " too many different cells (current max = %ld)\n", MAXFILECELLS);
298 print_limits();
300 }
302 return;
303}
304
305
306void increment_function_number(const char *kind) {
307 Function_Flag = true;
308 if ((MAXFUNCTIONS - 1L) <= Num_Functions) {
309 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
310 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
311 (void) fprintf(STDERR, " too many external functions (current max = %ld)\n", MAXFUNCTIONS);
312 print_limits();
314 }
316 return;
317}
318
319
320void increment_generator_number(const char *kind) {
321 /* no limit to number of generators, but each generator adds a cell instantiation */
322 static int flag = false;
323 if ((!flag) && ((MAXINSTANCES / 2L) <= Num_Generators)) {
324 flag = true;
325 (void) fprintf(STDERR, "\nNAPA Compiler Warning:\n");
326 (void) fprintf(STDERR, " (%s) large number of generators!", kind);
327 (void) fprintf(STDERR, " consider to review the number of authorized instances (current max = %ld)\n", MAXINSTANCES);
328 }
330 return;
331}
332
333
334void increment_group_number(const char *kind) {
335 if ((MAXGROUPS - 1L) <= Num_Groups) {
336 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
337 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
338 (void) fprintf(STDERR, " too many groups of postprocess functions (current max = %ld)\n", MAXGROUPS);
339 print_limits();
341 }
342 Num_Groups++;
343 return;
344}
345
346
347void increment_header_number(const char *kind) {
348 if ((MAXHEADERS - 1L) <= Num_Headers) {
349 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
350 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
351 (void) fprintf(STDERR, " too many header files (current max = %ld)\n", MAXHEADERS);
352 print_limits();
354 }
355 Num_Headers++;
356 return;
357}
358
359
360void increment_init_number(const char *kind) {
361 if ((MAXVARS - 2L) <= Num_Vars) { /* YES! 'var' to prevent cryptic error message */
362 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
363 (void) fprintf(STDERR, " (%s / var) internal array overflow!", kind);
364 (void) fprintf(STDERR, " %s instruction is overflowing the var table\n", kind);
365 print_limits();
367 }
368 Num_Inits++;
369 return;
370}
371
372
373void increment_inject_number(const char *kind) {
374 if ((MAXINJECTS - 1L) <= Num_Injects) {
375 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
376 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
377 (void) fprintf(STDERR, " too many node injections (current max = %ld)\n", MAXINJECTS);
378 print_limits();
380 }
381 Num_Injects++;
382 return;
383}
384
385
386void increment_instance_number(const char *kind) {
387 if ((MAXINSTANCES - 1L) <= Num_Instances) {
388 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
389 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
390 (void) fprintf(STDERR, " cell name registering overflow (current max = %ld)\n", MAXINSTANCES);
391 print_limits();
393 }
395 return;
396}
397
398
399void increment_IO_number(const char *kind) {
400 if ((MAXIOS - 1L) <= Num_IOs) {
401 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
402 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
403 (void) fprintf(STDERR, " too many input and output instructions (current max = %ld)\n", MAXIOS);
404 print_limits();
406 }
407 Num_Groups = 0L;
408 Num_IOs++;
409 return;
410}
411
412
413void increment_node_number(const char *kind) {
414 if ((MAXNODES - 1L) <= Num_Nodes) {
415 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
416 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
417 (void) fprintf(STDERR, " too many nodes (current max = %ld)\n", MAXNODES);
418 print_limits();
420 }
421 Num_Groups = 0L;
422 Num_Nodes++;
423 return;
424}
425
426
427void increment_opcode_number(const char *kind) {
428 if ((MAXOPCODES - 1L) <= Num_Opcodes) {
429 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
430 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
431 (void) fprintf(STDERR, " too many opcodes (current max = %ld)\n", MAXOPCODES);
432 print_limits();
434 }
435 Num_Opcodes++;
436 return;
437}
438
439
440void increment_post_number(const char *kind) {
441 if ((MAXPOSTS - 1L) <= Num_Posts) {
442 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
443 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
444 (void) fprintf(STDERR, " too many postprocessing functions (current max = %ld)\n", MAXPOSTS);
445 print_limits();
447 }
448 Num_Posts++;
449 return;
450}
451
452
453void increment_record_number(const char *kind) {
454 if ((MAXRECORDS - 1L) <= Num_Records) {
455 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
456 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
457 (void) fprintf(STDERR, " array of pointers name registering overflow (current max = %ld)\n", MAXRECORDS);
458 print_limits();
460 }
461 Num_Records++;
462 return;
463}
464
465
466void increment_restart_number(const char *kind) {
467 if ((MAXUPDATES - 2L) <= Num_Updates) { /* YES! 'update' to prevent cryptic error message */
468 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
469 (void) fprintf(STDERR, " (%s / update) internal array overflow!", kind);
470 (void) fprintf(STDERR, " call instruction is overflowing the update table\n");
471 print_limits();
473 }
474 Num_Restarts++;
475 return;
476}
477
478
479void increment_segment_number(const char *kind) {
480 if ((MAXSEGMENTS - 1L) <= Num_Segments) {
481 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
482 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
483 (void) fprintf(STDERR, " too many simulation segments (current max = %ld)\n", MAXSEGMENTS);
484 print_limits();
486 }
487 Num_Segments++;
488 return;
489}
490
491
492void increment_stuck_number(const char *kind) {
493 if ((MAXSTUCKS - 1L) <= Num_Stucks) {
494 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
495 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
496 (void) fprintf(STDERR, " too many stuck nodes (current max = %ld)\n", MAXSTUCKS);
497 print_limits();
499 }
500 Num_Stucks++;
501 return;
502}
503
504
505void increment_tool_number(const char *kind) {
506 if ((MAXUSERTOOLS - 1L) <= Num_Tools) {
507 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
508 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
509 (void) fprintf(STDERR, " too many tool functions (current max = %ld)\n", MAXUSERTOOLS);
510 print_limits();
512 }
513 Num_Tools++;
514 return;
515}
516
517
518void increment_update_number(const char *kind) {
519 if ((MAXUPDATES - 1L) <= Num_Updates) {
520 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
521 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
522 (void) fprintf(STDERR, " too many update of variables (current max = %ld)\n", MAXUPDATES);
523 print_limits();
525 }
526 Num_Updates++;
527 return;
528}
529
530
531void increment_usertool_number(const char *kind) {
532 UserTool_Flag = true;
533 if ((MAXUSERTOOLS - 1L) <= Num_UserTools) {
534 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
535 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
536 (void) fprintf(STDERR, " too many user functions (current max = %ld)\n", MAXUSERTOOLS);
537 print_limits();
539 }
541 return;
542}
543
544
545void increment_var_number(const char *kind) {
546 if ((MAXVARS - 1L) <= Num_Vars) {
547 (void) fprintf(STDERR, "\nNAPA Compiler Error:\n");
548 (void) fprintf(STDERR, " (%s) internal array overflow!", kind);
549 (void) fprintf(STDERR, " too many variables (current max = %ld)\n", MAXVARS);
550 print_limits();
552 }
553 Num_Vars++;
554 return;
555}
556
557
558void increment_const_number(void) { /* there is no limit to const numbering */
559 Num_Consts++;
560 return;
561}
562
563
564void increment_void_number(void) { /* there is no limit to void numbering */
565 Num_Voids++;
566 return;
567}
568
569
570/* ****************************************************************************************************************************** */
571
572int sort_names(const void *a, const void *b) { /* function 'sort_names(...) used by 'qsort' */
573 int num;
574 num = strcmp(*(char**) a, *(char**) b);
575 return num;
576}
577
578
579/* ****************************************************************************************************************************** */
580
581void swap_delay_inputs(long i, long j) {
582 long k;
583 k = Delay_Input[j];
584 Delay_Input[j] = Delay_Input[i];
585 Delay_Input[i] = k;
586 return;
587}
588
589
590void swap_nodes(long i, long j) { /* use last location as storage for node swapping */
592 Node_List[i] = Node_List[j];
594 return;
595}
596
597
598void swap_records(long i, long j) { /* use last location as storage for array swap */
600 Record_List[i] = Record_List[j];
602 return;
603}
604
605
606void swap_vars(long i, long j) { /* use last location as storage for var swapping */
608 Var_List[i] = Var_List[j];
610 return;
611}
612
613
614void swap_updates(long i, long j) { /* use last location as storage for var swapping */
616 Update_List[i] = Update_List[j];
618 return;
619}
620
621
622/* ****************************************************************************************************************************** */
623
624long alias_id(const char *identifier) { /* get alias ID if already defined */
625 long i;
626 for (i = 0L; i < Num_Aliases; i++) {
627 if (IS_IDENTIFIER(Alias_List[i].name)) {
628 return i;
629 }
630 }
631 return UNDEFINED;
632}
633
634
635long array_id(const char *identifier) { /* get array ID if -array- already defined */
636 long i;
637 for (i = 0L; i < Num_Arrays; i++) {
638 if (IS_IDENTIFIER(Array_List[i].name)) {
639 return i;
640 }
641 }
642 return UNDEFINED;
643}
644
645
646long array_name_id(const char *identifier) { /* get array ID if -file- already defined */
647 long i;
648 for (i = 0L; i < Num_Arrays; i++) {
649 if (IS_IDENTIFIER(Array_List[i].fname)) {
650 return i;
651 }
652 }
653 return UNDEFINED;
654}
655
656
657long cmdline_id(const char *identifier) { /* get ID if already defined */
658 long i, v;
659 char tok[STRLENGTH] = {'\0'};
660 if (!Cmdline_Flag) {
661 return UNDEFINED;
662 }
663 v = var_id(identifier);
664 if (UNDEFINED == v) {
665 return UNDEFINED;
666 }
667 (void) strcpy(tok, Var_List[v].name1);
668 for (i = 0L; i < Num_Cmdlines; i++) {
669 if (0 == strcmp(tok, Cmdline_List[i].parms)) {
670 return i;
671 }
672 }
673 if (Var_List[v].aliased) { /* search also for aliased name if any */
674 (void) strcpy(tok, Var_List[v].name2);
675 for (i = 0L; i < Num_Cmdlines; i++) {
676 if (0 == strcmp(tok, Cmdline_List[i].parms)) {
677 return i;
678 }
679 }
680 }
681 return UNDEFINED;
682}
683
684
685long debug_id(const char *identifier) { /* get ID if already defined */
686 long i;
687 for (i = 0L; i < Num_Debugs; i++) {
688 if (IS_IDENTIFIER(Debug_List[i].name)) {
689 return i;
690 }
691 }
692 return UNDEFINED;
693}
694
695
696long declare_id(const char *identifier) { /* get declare ID if already defined */
697 long i;
698 for (i = 0L; i < Num_Declares; i++) {
699 if (IS_IDENTIFIER(Declare_List[i].name)) {
700 return i;
701 }
702 }
703 return UNDEFINED;
704}
705
706
707long directive_id(const char *identifier) { /* get directive ID if already defined */
708 long i;
709 for (i = 0L; i < Num_Directives; i++) {
710 if (IS_IDENTIFIER(Directive_List[i].name)) {
711 return i;
712 }
713 }
714 return UNDEFINED;
715}
716
717
718long node_id(const char *identifier) { /* get node ID if already defined */
719 long i, j, m, n;
720 char tok1[STRLENGTH] = {'\0'};
721 char tok2[STRLENGTH] = {'\0'};
722 char tok3[STRLENGTH] = {'\0'};
723 char buf[LINLENGTH] = {'\0'};
724 char *str = (char*) NULL;
725 if (IS_IDENTIFIER("TOOL_INDEX")) {
726 Tool_Index_Flag = true; /* to know if TOOL_INDEX is explicitely used */
727 }
728 for (i = 0L; i < Num_Nodes; i++) {
729 if (IS_IDENTIFIER(Node_List[i].name1)) {
730 return i;
731 }
732 if (IS_IDENTIFIER(Node_List[i].name2)) {
733 return i;
734 }
735 }
736 for (i = 0L; i < Num_Records; i++) { /* get node through an 'array_id'.'number' id */
737 (void) strcpy(tok1, identifier);
738 str = strchr(tok1, '.');
739 if ((char*) NULL == str) {
740 continue;
741 }
742 (void) strcpy(tok2, str + 1); /* 'tok2' contains the right part of the identifier */
743 *str = '\0'; /* 'tok1' contains the id of the array */
744 if (0 == strcmp(tok1, Record_List[i].name)) { /* record matches ! */
745 if ((1 != sscanf(tok2, "%li", &m)) || (1L > m)) {
746 print_error_location("array", Record_List[i].mline, Record_List[i].mfile);
747 (void) fprintf(STDERR, " <%s.%s> is not a correct identifier, <%s> must be a strictly positive integer\n",tok1,tok2,tok2);
748 exit(EXIT_FAILURE);
749 }
750 (void) strcpy(buf, Record_List[i].list1);
751 str = buf;
752 j = 0L;
753 while (ISNOTEMPTY(str) && (j < m)) {
754 str = get_token(str, tok3, false);
755 j++;
756 }
757 if (j != m) {
758 print_error_location("array", Record_List[i].mline, Record_List[i].mfile);
759 (void) fprintf(STDERR, " there is no element #%s in array <%s>\n", tok2, tok1);
760 exit(EXIT_FAILURE);
761 }
762 n = node_id(tok3); /* recursive call */
763 if (UNDEFINED != n) {
764 return n;
765 } else {
766 continue;
767 }
768 }
769 }
770 return UNDEFINED;
771}
772
773
774long op_id(const char *identifier) { /* get FIRST opcode ID if already defined */
775 long i;
776 for (i = 0L; i < Num_Opcodes; i++) {
777 if (IS_IDENTIFIER(Opcode_List[i].name)) {
778 return i;
779 }
780 }
781 return UNDEFINED;
782}
783
784
785long postprocess_id(const char *identifier) { /* get postprocess function ID if already defined */
786 long i;
787 for (i = 0L; i < Num_Posts; i++) {
788 if (IS_IDENTIFIER(Post_List[i].function)) {
789 return i;
790 }
791 }
792 return UNDEFINED;
793}
794
795
796long record_id(const char *identifier) { /* get record ID if -record- already defined */
797 long i;
798 for (i = 0L; i < Num_Records; i++) {
799 if (IS_IDENTIFIER(Record_List[i].name)) {
800 return i;
801 }
802 }
803 return UNDEFINED;
804}
805
806
807long update_id(const char *identifier, long num) { /* get the #num-th update ID if already defined */
808 long i, k, v;
809 char tok[STRLENGTH] = {'\0'};
810 if (IS_IDENTIFIER("TOOL_INDEX")) {
811 Tool_Index_Flag = true; /* to know if TOOL_INDEX is explicitely used */
812 return UNDEFINED; /* there is no update as TOOL_INDEX is not defined */
813 }
814 v = var_id(identifier);
815 if (UNDEFINED == v) {
816 return UNDEFINED; /* there is no update as variable does not exist */
817 }
818 (void) strcpy(tok, Var_List[v].name1);
819 k = 0L;
820 for (i = 0L; i < Num_Updates; i++) {
821 if (0 == strcmp(tok, Update_List[i].name)) {
822 k++;
823 if (k == num) {
824 return i;
825 }
826 }
827 }
828 if (Var_List[v].aliased) { /* search also for aliased name if any */
829 (void) strcpy(tok, Var_List[v].name2);
830 k = 0L;
831 for (i = 0L; i < Num_Updates; i++) {
832 if (0 == strcmp(tok, Update_List[i].name)) {
833 k++;
834 if (k == num) {
835 return i;
836 }
837 }
838 }
839 }
840 return UNDEFINED;
841}
842
843
844long user_id(const char *identifier) { /* get user defined function ID if already defined */
845 long i;
846 for (i = 0L; i < Num_UserTools; i++) {
847 if (IS_IDENTIFIER(UserTool_List[i].name)) {
848 return i;
849 }
850 }
851 return UNDEFINED;
852}
853
854
855long var_id(const char *identifier) { /* get var ID if already defined */
856 long i, j, m, v;
857 char tok1[STRLENGTH] = {'\0'};
858 char tok2[STRLENGTH] = {'\0'};
859 char tok3[STRLENGTH] = {'\0'};
860 char buf[LINLENGTH] = {'\0'};
861 char *str = (char*) NULL;
862 if (IS_IDENTIFIER("TOOL_INDEX")) {
863 Tool_Index_Flag = true; /* to know if TOOL_INDEX is explicitely used */
864 }
865 for (i = 0L; i < Num_Vars; i++) {
866 if (IS_IDENTIFIER(Var_List[i].name1)) {
867 return i;
868 }
869 if (IS_IDENTIFIER(Var_List[i].name2)) {
870 return i;
871 }
872 }
873 for (i = 0L; i < Num_Records; i++) { /* get var through an 'array_id'.'number' id */
874 (void) strcpy(tok1, identifier);
875 str = strchr(tok1, '.');
876 if ((char*) NULL == str) {
877 continue;
878 }
879 (void) strcpy(tok2, str + 1); /* 'tok2' contains the right part of the identifier */
880 *str = '\0'; /* 'tok1' contains the id of the array */
881 if (0 == strcmp(tok1, Record_List[i].name)) { /* record matches ! */
882 if ((1 != sscanf(tok2, "%li", &m)) || (1L > m)) {
883 print_error_location("array", Record_List[i].mline, Record_List[i].mfile);
884 (void) fprintf(STDERR, " <%s.%s> is not a correct identifier, <%s> must be a strictly positive integer\n",tok1,tok2,tok2);
885 exit(EXIT_FAILURE);
886 }
887 (void) strcpy(buf, Record_List[i].list1);
888 str = buf;
889 j = 0L;
890 while (ISNOTEMPTY(str) && (j < m)) {
891 str = get_token(str, tok3, false);
892 j++;
893 }
894 if (j != m) {
895 print_error_location("array", Record_List[i].mline, Record_List[i].mfile);
896 (void) fprintf(STDERR, " there is no element #%s in array <%s>\n", tok2, tok1);
897 exit(EXIT_FAILURE);
898 }
899 v = var_id(tok3); /* recursive call */
900 if (UNDEFINED != v) {
901 return v;
902 } else {
903 continue;
904 }
905 }
906 }
907 return UNDEFINED;
908}
909
910
911/* ****************************************************************************************************************************** */
912
913/* Mark update of constants. Their updates will be skipped in the simulator. */
914
915/* by default, if not already set-up to false for good reasons, the status is MAYBE. */
916/* Updates tagged with MAYBE are analysed could be tagged false during this process. */
917/* Updates tagged with false are tagged false for ever. At the end of this process, all MAYBE are transformed in false. */
918
920 long i, j, k, m, n, u, v;
921 char *nam = (char*) NULL;
922 char *str = (char*) NULL;
923 char tok[LINLENGTH] = {'\0'};
924 int flag;
925 if (0L >= Num_Updates) {
926 return;
927 }
928 /* fix obvious update definitions to constant or not constant */
929 for (i = 0L; i < Num_Updates; i++) {
930 nam = Update_List[i].name;
931 if ((0 == strncmp(nam, "$call$", (size_t) 6)) || (0 == strncmp(nam, "$null$", (size_t) 6))
932 || (0 == strncmp(nam, "$assert$", (size_t) 8)) || (0 == strncmp(nam, "$restart$", (size_t) 9))) {
933 Update_List[i].constant = false; /* must be always processed */
934 continue;
935 }
936 if (0 == strcmp(nam, Update_List[i].value)) { /* identity! weird but OK */
937 Update_List[i].constant = true;
938 continue;
939 }
940 v = var_id(nam);
941 if (UNDEFINED != v) {
942 if (0 != strcmp(Update_List[i].value, Var_List[v].value)) { /* update != variable */
943 Update_List[i].constant = false; /* must be updated! */
944 }
945 }
946 }
947 do {
948 flag = false;
949 for (i = 0L; i < Num_Updates; i++) {
950 if (MAYBE != Update_List[i].constant) { /* already determined */
951 continue;
952 }
953 Update_List[i].constant = true; /* if there is no doubt, it will be a constant */
954 nam = Update_List[i].name;
955 str = Update_List[i].value;
956 for (;;) { /* scanning the update definition, token by token */
957 v = UNDEFINED;
958 n = UNDEFINED;
959 str = get_token(str, tok, true);
960 if (ISEMPTY(tok)) { /* end of scan of the update definition of ID i */
961 break;
962 }
963 if (UNKNOWN_TYPE != constant_type(tok)) { /* a known constant, continue scanning */
964 continue;
965 }
966 if (is_a_constant_or_a_macro_constant(tok)) { /* a known constant, continue scanning */
967 continue;
968 }
969 if (STRING_DATA_TYPE == get_type(tok)) { /* a known constant, continue scanning */
970 continue;
971 }
972 if (is_a_known_pure_function(tok)) { /* harmless, continue scanning */
973 continue;
974 }
975 if (is_an_operator(tok)) { /* harmless as ++ and -- are forbidden */
976 continue;
977 }
978 if (is_a_modifier(tok)) { /* harmless, continue scanning */
979 continue;
980 }
981 n = node_id(tok);
982 if (UNDEFINED != n) {
983 if ((DC_KIND == Node_List[n].kind) || (CONST_KIND == Node_List[n].kind)) {
984 continue;
985 } else { /* nodes are not constant (DC excepted) */
986 flag = true;
987 Update_List[i].constant = false;
988 break;
989 }
990 }
991 v = var_id(tok); /* this is searching for alias also */
992 if (UNDEFINED != v) { /* this is a variable */
993 if ((0 == strcmp(nam, Var_List[v].name1)) || (0 == strcmp(nam, Var_List[v].name2))) {
994 flag = true; /* self-reference: not a constant ! */
995 Update_List[i].constant = false;
996 break;
997 }
998 k = 0L;
999 u = -999L;
1000 while (UNDEFINED != u) {
1001 k++;
1002 u = update_id(tok, k); /* this is searching for alias also */
1003 if (UNDEFINED != u) { /* reference to an updated variable */
1004 if (true == Update_List[u].constant) { /* true, false or MAYBE */
1005 continue;
1006 } else if (!Update_List[u].constant) {
1007 flag = true;
1008 Update_List[i].constant = false;
1009 break;
1010 } else { /* undetermined, continue scanning */
1011 flag = true;
1012 Update_List[i].constant = MAYBE;
1013 continue;
1014 }
1015 } else {
1016 continue; /* a constant, continue scanning */
1017 }
1018 }
1019 }
1020 if ((UNDEFINED == n) && (UNDEFINED == v)) {
1021 flag = true; /* depends on unknown identifier */
1022 Update_List[i].constant = false;
1023 }
1024 }
1025 flag = true;
1026 }
1027 } while (flag); /* repeat until everything is stable */
1028 for (i = 0L; i < Num_Updates; i++) {
1029 if (MAYBE == Update_List[i].constant) {
1030 Update_List[i].constant = false; /* for some reason, not proven to be a constant */
1031 }
1032 }
1033 /* We have to spread the status for multiple updates of the same variables */
1034 for (i = 0L; i < Num_Updates; i++) {
1035 if (!Update_List[i].constant) {
1036 continue;
1037 }
1038 for (j = 0L; j < Num_Updates; j++) {
1039 if (i == j) {
1040 continue;
1041 }
1042 if (!Update_List[j].constant) {
1043 m = var_id(Update_List[i].name);
1044 n = var_id(Update_List[j].name);
1045 if (m == n) {
1046 Update_List[i].constant = false;
1047 break;
1048 }
1049 }
1050 }
1051 }
1052 /* We have to tag the segment including an effective update as used */
1053 for (i = 0L; i < Num_Updates; i++) {
1054 if (!Update_List[i].constant) {
1055 Segment_List[Update_List[i].segment].used1 = true;
1056 }
1057 }
1058 return;
1059}
1060
1061
1062/* Identify true constants among variables. */
1063
1064void mark_constants(void) {
1065 long i, v;
1066 if (0L >= Num_Updates) {
1067 return;
1068 }
1069 for (i = 0L; i < Num_Updates; i++) {
1070 if (!Update_List[i].constant) {
1071 v = var_id(Update_List[i].name);
1072 if (UNDEFINED != v) {
1073 Var_List[v].constant = false;
1074 }
1075 }
1076 }
1077 return;
1078}
1079
1080
1081/* ****************************************************************************************************************************** */
1082
1084 long nseg;
1085 long u;
1086 u = 0L;
1087 for (nseg = 0L; nseg < Num_Segments; nseg++) {
1088 u += (long) (Segment_List[nseg].used1);
1089 }
1090 if (Inject_Flag) {
1091 u++;
1092 }
1093 if (0L < u) {
1094 return true;
1095 }
1096 return false;
1097}
1098
1099
1101 long nseg;
1102 long u;
1103 u = 0L;
1104 for (nseg = 0L; nseg < Num_Segments; nseg++) {
1105 u += (long) (Segment_List[nseg].used2);
1106 }
1107 if (0L < u) {
1108 return true;
1109 }
1110 return false;
1111}
1112
1113
1115
1116 long nseg;
1117 long u;
1118 u = 0L;
1119 for (nseg = 0L; nseg < Num_Segments; nseg++) {
1120 u += (long) (Segment_List[nseg].used3);
1121 }
1122 if (0L < u) {
1123 return true;
1124 }
1125 return false;
1126}
1127
1128/* ****************************************************************************************************************************** */
1129
1130long constant_type(char *identifier) { /* returns the number type of string */
1131 char *str = (char*) NULL;
1132 double r;
1133 unsigned long long x;
1134 if (IS_IDENTIFIER("true") || IS_IDENTIFIER("false")
1135 || IS_IDENTIFIER("TRUE") || IS_IDENTIFIER("FALSE")
1136 || IS_IDENTIFIER("YES") || IS_IDENTIFIER("NO")
1137 || IS_IDENTIFIER("START") || IS_IDENTIFIER("STOP")
1138 || IS_IDENTIFIER("DIGITAL_INI")
1139 || IS_IDENTIFIER("ANTITHETIC")
1140 || IS_IDENTIFIER("RANDOM_SEED")
1141 || IS_IDENTIFIER("NUM_OF_SEGMENTS")
1142 || IS_IDENTIFIER("NUM_OF_TIME_OUTPUTS")
1143 || IS_IDENTIFIER("PERIODIC")
1144 || IS_IDENTIFIER("INT_MAX") || IS_IDENTIFIER("INT_MIN")
1145 || IS_IDENTIFIER("LONG_MAX") || IS_IDENTIFIER("LONG_MIN")
1146 || IS_IDENTIFIER("LLONG_MAX") || IS_IDENTIFIER("LLONG_MIN")) {
1147 return DIGITAL_DATA_TYPE;
1148 }
1149 if (IS_IDENTIFIER("_PI_") || IS_IDENTIFIER("_pi_")
1150 || IS_IDENTIFIER("_2PI_") || IS_IDENTIFIER("_2pi_")
1151 || IS_IDENTIFIER("_PI2_") || IS_IDENTIFIER("_pi2_")
1152 || IS_IDENTIFIER("_PI4_") || IS_IDENTIFIER("_pi4_")
1153 || IS_IDENTIFIER("_PI8_") || IS_IDENTIFIER("_pi8_")
1154 || IS_IDENTIFIER("_E_") || IS_IDENTIFIER("_e_")
1155 || IS_IDENTIFIER("FLT_MAX") || IS_IDENTIFIER("FLT_MIN")
1156 || IS_IDENTIFIER("DBL_MAX") || IS_IDENTIFIER("DBL_MIN")
1157 || IS_IDENTIFIER("LDBL_MAX") || IS_IDENTIFIER("LDBL_MIN")
1158 || IS_IDENTIFIER("EPSILON")
1159 || IS_IDENTIFIER("ANALOG_INI")
1160 || IS_IDENTIFIER("FS") || IS_IDENTIFIER("FSL")
1161 || IS_IDENTIFIER("SIM_RATE")) {
1162 return ANALOG_DATA_TYPE;
1163 }
1164 if (('0' == *identifier) && ('x' == *(identifier+1))) {
1165 if (1 == sscanf(identifier, "%llux", &x)) {
1166 return HEX_DATA_TYPE;
1167 }
1168 }
1169 if (1 != sscanf(identifier, "%lf", &r)) { /* not analog */
1170 if (('"' == identifier[0]) && ('"' == identifier[LENGTH(identifier)-1L])) {
1171 return STRING_DATA_TYPE;
1172 } else {
1173 return UNKNOWN_TYPE;
1174 }
1175 }
1176 if (ISNOTEQUAL(floor(r), r)) { /* non zero decimal part. Analog type. */
1177 return ANALOG_DATA_TYPE;
1178 }
1179 str = identifier;
1180 while ('\0' != *str) { /* decimal point. Analog type! */
1181 if ('.' == *str) {
1182 return ANALOG_DATA_TYPE;
1183 }
1184 str++;
1185 }
1186 return DIGITAL_DATA_TYPE; /* 'true' integer type */
1187}
1188
1189
1190long get_type(char *identifier) {
1191 long n;
1192 n = node_id(identifier);
1193 if (UNDEFINED != n) {
1194 return Node_List[n].type;
1195 }
1196 n = var_id(identifier);
1197 if (UNDEFINED != n) {
1198 return Var_List[n].type;
1199 }
1200 n = array_id(identifier);
1201 if (UNDEFINED != n) {
1202 return Array_List[n].type;
1203 }
1204 if ((0 == strcmp(identifier, "LOOP_INDEX"))
1205 || (0 == strcmp(identifier, "ABS_LOOP_INDEX"))
1206 || (0 == strcmp(identifier, "REL_LOOP_INDEX"))
1207 || (0 == strcmp(identifier, "RANDOM_SEED"))) {
1208 return DIGITAL_DATA_TYPE;
1209 }
1210 if ((0 == strcmp(identifier, "ABS_TIME"))
1211 || (0 == strcmp(identifier, "REF_TIME"))
1212 || (0 == strcmp(identifier, "REL_TIME"))
1213 || (0 == strcmp(identifier, "TIME"))
1214 || (0 == strcmp(identifier, "WALL_CLOCK"))
1215 || (0 == strcmp(identifier, "SIM_RATE"))
1216 || (0 == strcmp(identifier, "FS"))
1217 || (0 == strcmp(identifier, "FSL"))) {
1218 return ANALOG_DATA_TYPE;
1219 }
1220 return constant_type(identifier); /* could be UNKNOWN_TYPE */
1221}
1222
1223
1224long usertool_num(const char *nam) { /* number of user functions defined with same name */
1225 long i;
1226 long c = 0L;
1227 for (i = 0L; i < Num_UserTools; i++) {
1228 if (0 == strcmp(nam, UserTool_List[i].function)) {
1229 c++;
1230 }
1231 }
1232 return c;
1233}
1234
1235
1236long node_kind(const char *identifier) {
1237 if (IS_IDENTIFIER("adc" )) { return ADC_KIND ;
1238 } else if (IS_IDENTIFIER("algebra" )) { return ALGEBRA_KIND ;
1239 } else if (IS_IDENTIFIER("alu" )) { return ALU_KIND ;
1240 } else if (IS_IDENTIFIER("and" )) { return AND_KIND ;
1241 } else if (IS_IDENTIFIER("average" )) { return AVERAGE_KIND ;
1242 } else if (IS_IDENTIFIER("bshift" )) { return BSHIFT_KIND ;
1243 } else if (IS_IDENTIFIER("btoi" )) { return BTOI_KIND ;
1244 } else if (IS_IDENTIFIER("buffer" )) { return BUF_KIND ; /* NOT a copy! */
1245 } else if (IS_IDENTIFIER("bwand" )) { return BWAND_KIND ;
1246 } else if (IS_IDENTIFIER("bwbuffer" )) { return COPY_KIND ; /* a strict copy! */
1247 } else if (IS_IDENTIFIER("bwinv" )) { return BWINV_KIND ;
1248 } else if (IS_IDENTIFIER("bwnand" )) { return BWNAND_KIND ;
1249 } else if (IS_IDENTIFIER("bwnor" )) { return BWNOR_KIND ;
1250 } else if (IS_IDENTIFIER("bwnot" )) { return BWINV_KIND ; /* alias of bwinv */
1251 } else if (IS_IDENTIFIER("bwor" )) { return BWOR_KIND ;
1252 } else if (IS_IDENTIFIER("bwxnor" )) { return BWXNOR_KIND ;
1253 } else if (IS_IDENTIFIER("bwxor" )) { return BWXOR_KIND ;
1254 } else if (IS_IDENTIFIER("cell" )) { return CELL_KIND ; /* special process */
1255 } else if (IS_IDENTIFIER("change" )) { return CHG_KIND ;
1256 } else if (IS_IDENTIFIER("clip" )) { return CLIP_KIND ;
1257 } else if (IS_IDENTIFIER("clock" )) { return CLOCK_KIND ;
1258 } else if (IS_IDENTIFIER("comp" )) { return COMP_KIND ;
1259 } else if (IS_IDENTIFIER("const" )) { return CONST_KIND ; /* -> DC_KIND */
1260 } else if (IS_IDENTIFIER("copy" )) { return COPY_KIND ;
1261 } else if (IS_IDENTIFIER("cosine" )) { return COS_KIND ;
1262 } else if (IS_IDENTIFIER("dac" )) { return DAC_KIND ;
1263 } else if (IS_IDENTIFIER("dalgebra" )) { return DALGEBRA_KIND ;
1264 } else if (IS_IDENTIFIER("dc" )) { return DC_KIND ;
1265 } else if (IS_IDENTIFIER("delay" )) { return DELAY_KIND ;
1266 } else if (IS_IDENTIFIER("differentiator" )) { return DIFFERENTIATOR_KIND;
1267 } else if (IS_IDENTIFIER("div" )) { return DIV_KIND ;
1268 } else if (IS_IDENTIFIER("dtoi" )) { return DTOI_KIND ;
1269 } else if (IS_IDENTIFIER("dtool" )) { return DTOOL_KIND ;
1270 } else if (IS_IDENTIFIER("duser" )) { return DUSER_KIND ;
1271 } else if (IS_IDENTIFIER("equal" )) { return EQUAL_KIND ;
1272 } else if (IS_IDENTIFIER("fzand" )) { return FZAND_KIND ;
1273 } else if (IS_IDENTIFIER("fzbuffer" )) { return FZBUF_KIND ;
1274 } else if (IS_IDENTIFIER("fzinv" )) { return FZINV_KIND ;
1275 } else if (IS_IDENTIFIER("fznand" )) { return FZNAND_KIND ;
1276 } else if (IS_IDENTIFIER("fznor" )) { return FZNOR_KIND ;
1277 } else if (IS_IDENTIFIER("fznot" )) { return FZINV_KIND ; /* alias of fzinv */
1278 } else if (IS_IDENTIFIER("fzor" )) { return FZOR_KIND ;
1279 } else if (IS_IDENTIFIER("fzxnor" )) { return FZXNOR_KIND ;
1280 } else if (IS_IDENTIFIER("fzxor" )) { return FZXOR_KIND ;
1281 } else if (IS_IDENTIFIER("gain" )) { return GAIN_KIND ;
1282 } else if (IS_IDENTIFIER("generator" )) { return GEN_KIND ; /* special process */
1283 } else if (IS_IDENTIFIER("hold" )) { return HOLD_KIND ;
1284 } else if (IS_IDENTIFIER("ialgebra" )) { return IALGEBRA_KIND ;
1285 } else if (IS_IDENTIFIER("integrator" )) { return INTEGRATOR_KIND ;
1286 } else if (IS_IDENTIFIER("inv" )) { return INV_KIND ;
1287 } else if (IS_IDENTIFIER("itob" )) { return ITOB_KIND ;
1288 } else if (IS_IDENTIFIER("itod" )) { return ITOD_KIND ;
1289 } else if (IS_IDENTIFIER("itool" )) { return ITOOL_KIND ;
1290 } else if (IS_IDENTIFIER("iuser" )) { return IUSER_KIND ;
1291 } else if (IS_IDENTIFIER("latch" )) { return LATCH_KIND ;
1292 } else if (IS_IDENTIFIER("lshift" )) { return LSHIFT_KIND ;
1293 } else if (IS_IDENTIFIER("max" )) { return MAX_KIND ;
1294 } else if (IS_IDENTIFIER("merge" )) { return MERGE_KIND ;
1295 } else if (IS_IDENTIFIER("min" )) { return MIN_KIND ;
1296 } else if (IS_IDENTIFIER("mod" )) { return MOD_KIND ;
1297 } else if (IS_IDENTIFIER("muller" )) { return MULLER_KIND ;
1298 } else if (IS_IDENTIFIER("mux" )) { return MUX_KIND ;
1299 } else if (IS_IDENTIFIER("nand" )) { return NAND_KIND ;
1300 } else if (IS_IDENTIFIER("noise" )) { return NOISE_KIND ;
1301 } else if (IS_IDENTIFIER("nor" )) { return NOR_KIND ;
1302 } else if (IS_IDENTIFIER("not" )) { return INV_KIND ; /* alias of inv */
1303 } else if (IS_IDENTIFIER("offset" )) { return OFFSET_KIND ;
1304 } else if (IS_IDENTIFIER("or" )) { return OR_KIND ;
1305 } else if (IS_IDENTIFIER("osc" )) { return OSC_KIND ;
1306 } else if (IS_IDENTIFIER("poly" )) { return POLY_KIND ;
1307 } else if (IS_IDENTIFIER("prod" )) { return PROD_KIND ;
1308 } else if (IS_IDENTIFIER("quant" )) { return QUANT_KIND ;
1309 } else if (IS_IDENTIFIER("ram" )) { return RAM_KIND ;
1310 } else if (IS_IDENTIFIER("ram2" )) { return RAM2_KIND ;
1311 } else if (IS_IDENTIFIER("rect" )) { return RECT_KIND ;
1312 } else if (IS_IDENTIFIER("register" )) { return TRACK_KIND ; /* alias of track */
1313 } else if (IS_IDENTIFIER("relay" )) { return RELAY_KIND ;
1314 } else if (IS_IDENTIFIER("rip" )) { return RIP_KIND ;
1315 } else if (IS_IDENTIFIER("rom" )) { return ROM_KIND ;
1316 } else if (IS_IDENTIFIER("rom2" )) { return ROM2_KIND ;
1317 } else if (IS_IDENTIFIER("rshift" )) { return RSHIFT_KIND ;
1318 } else if (IS_IDENTIFIER("rshift1" )) { return RSHIFT1_KIND ;
1319 } else if (IS_IDENTIFIER("rshift2" )) { return RSHIFT2_KIND ;
1320 } else if (IS_IDENTIFIER("sign" )) { return SIGN_KIND ;
1321 } else if (IS_IDENTIFIER("sine" )) { return SIN_KIND ;
1322 } else if (IS_IDENTIFIER("square" )) { return SQUARE_KIND ;
1323 } else if (IS_IDENTIFIER("step" )) { return STEP_KIND ;
1324 } else if (IS_IDENTIFIER("sub" )) { return SUB_KIND ;
1325 } else if (IS_IDENTIFIER("sum" )) { return SUM_KIND ;
1326 } else if (IS_IDENTIFIER("test" )) { return TEST_KIND ;
1327 } else if (IS_IDENTIFIER("toggle" )) { return TOGGLE_KIND ;
1328 } else if (IS_IDENTIFIER("tool" )) { return ITOOL_KIND ; /* instruction tool is expanded as a node itool */
1329 } else if (IS_IDENTIFIER("track" )) { return TRACK_KIND ;
1330 } else if (IS_IDENTIFIER("triangle" )) { return TRIANGLE_KIND ;
1331 } else if (IS_IDENTIFIER("trig" )) { return TRIG_KIND ;
1332 } else if (IS_IDENTIFIER("uadc" )) { return UADC_KIND ;
1333 } else if (IS_IDENTIFIER("udac" )) { return UDAC_KIND ;
1334 } else if (IS_IDENTIFIER("wsum" )) { return WSUM_KIND ;
1335 } else if (IS_IDENTIFIER("xnor" )) { return XNOR_KIND ;
1336 } else if (IS_IDENTIFIER("xor" )) { return XOR_KIND ;
1337 } else if (IS_IDENTIFIER("zero" )) { return ZERO_KIND ;
1338 } else { return UNKNOWN_KIND ;
1339 }
1340}
1341
1342
1343/* A precompiler directive is issued for any unknown function. Known functions and macros */
1344/* functions are listed here to limit such directives to a minimum. */
1345
1346int is_a_known_function(const char *identifier) {
1347 if (is_a_known_pure_function(identifier)) { return true;
1348 } else if (IS_IDENTIFIER("GETPARMADDRESS" )) { return true;
1349 } else if (IS_IDENTIFIER("IO_COMMAND_NAME" )) { return true;
1350 } else if (IS_IDENTIFIER("ISTIME" )) { return true;
1351 } else if (IS_IDENTIFIER("RAND_01" )) { return true;
1352 } else if (IS_IDENTIFIER("RAND_01_X" )) { return true;
1353 } else if (IS_IDENTIFIER("ISDELAYED" )) { return true;
1354 } else if (IS_IDENTIFIER("ISOPTION" )) { return true;
1355 } else if (IS_IDENTIFIER("ISPARAMETER" )) { return true;
1356 } else if (IS_IDENTIFIER("ISNOTOPTION" )) { return true;
1357 } else if (IS_IDENTIFIER("TIMER" )) { return true;
1358 } else if (IS_IDENTIFIER("PING" )) { return true;
1359 } else if (IS_IDENTIFIER("PING_FAIL" )) { return true;
1360 } else { return false;
1361 }
1362}
1363
1364
1365/* It is MANDATORY to list only PURE functions or PURE macro functions, as this procedure */
1366/* will be used to determine if an update is built from constant or not. */
1367
1368int is_a_known_pure_function(const char *identifier) {
1369 if (IS_IDENTIFIER("abs" )) { return true; /* C function (math.h) */
1370 } else if (IS_IDENTIFIER("acos" )) { return true; /* C function (math.h) */
1371 } else if (IS_IDENTIFIER("acosh" )) { return true; /* C function (math.h) */
1372 } else if (IS_IDENTIFIER("acosl" )) { return true; /* C function (math.h) */
1373 } else if (IS_IDENTIFIER("asin" )) { return true; /* C function (math.h) */
1374 } else if (IS_IDENTIFIER("asinh" )) { return true; /* C function (math.h) */
1375 } else if (IS_IDENTIFIER("asinl" )) { return true; /* C function (math.h) */
1376 } else if (IS_IDENTIFIER("atan" )) { return true; /* C function (math.h) */
1377 } else if (IS_IDENTIFIER("atanh" )) { return true; /* C function (math.h) */
1378 } else if (IS_IDENTIFIER("atanl" )) { return true; /* C function (math.h) */
1379 } else if (IS_IDENTIFIER("atan2" )) { return true; /* C function (math.h) */
1380 } else if (IS_IDENTIFIER("atan2l" )) { return true; /* C function (math.h) */
1381 } else if (IS_IDENTIFIER("ceil" )) { return true; /* C function (math.h) */
1382 } else if (IS_IDENTIFIER("cos" )) { return true; /* C function (math.h) */
1383 } else if (IS_IDENTIFIER("cosh" )) { return true; /* C function (math.h) */
1384 } else if (IS_IDENTIFIER("cosl" )) { return true; /* C function (math.h) */
1385 } else if (IS_IDENTIFIER("erf" )) { return true; /* C function (math.h) */
1386 } else if (IS_IDENTIFIER("erfc" )) { return true; /* C function (math.h) */
1387 } else if (IS_IDENTIFIER("exp" )) { return true; /* C function (math.h) */
1388 } else if (IS_IDENTIFIER("fabs" )) { return true; /* C function (math.h) */
1389 } else if (IS_IDENTIFIER("floor" )) { return true; /* C function (math.h) */
1390 } else if (IS_IDENTIFIER("fmod" )) { return true; /* C function (math.h) */
1391 } else if (IS_IDENTIFIER("fprintf" )) { return true; /* C function (stdio.h) */
1392 } else if (IS_IDENTIFIER("labs" )) { return true; /* C function (math.h) */
1393 } else if (IS_IDENTIFIER("log" )) { return true; /* C function (math.h) */
1394 } else if (IS_IDENTIFIER("log2" )) { return true; /* C function (math.h) */
1395 } else if (IS_IDENTIFIER("log10" )) { return true; /* C function (math.h) */
1396 } else if (IS_IDENTIFIER("napa_array_setup" )) { return true; /* NAPA C function */
1397 } else if (IS_IDENTIFIER("napa_check_directives")) { return true; /* NAPA C function */
1398 /* "napa_check_for_option" ......................... NAPA C function is NOT A PURE FUNCTION */
1399 /* "napa_rand_integer" ......................... NAPA C function is NOT A PURE FUNCTION */
1400 } else if (IS_IDENTIFIER("napa_record_manager" )) { return true; /* NAPA C function */
1401 } else if (IS_IDENTIFIER("napa_record_setup" )) { return true; /* NAPA C function */
1402 } else if (IS_IDENTIFIER("pow" )) { return true; /* C function (math.h) */
1403 } else if (IS_IDENTIFIER("sin" )) { return true; /* C function (math.h) */
1404 } else if (IS_IDENTIFIER("sinh" )) { return true; /* C function (math.h) */
1405 } else if (IS_IDENTIFIER("sinl" )) { return true; /* C function (math.h) */
1406 } else if (IS_IDENTIFIER("sizeof" )) { return true; /* C function */
1407 } else if (IS_IDENTIFIER("sqrt" )) { return true; /* C function (math.h) */
1408 } else if (IS_IDENTIFIER("tan" )) { return true; /* C function (math.h) */
1409 } else if (IS_IDENTIFIER("tanh" )) { return true; /* C function (math.h) */
1410 } else if (IS_IDENTIFIER("tanl" )) { return true; /* C function (math.h) */
1411 } else if (IS_IDENTIFIER("ABS" )) { return true; /* NAPA macro */
1412 } else if (IS_IDENTIFIER("B2A" )) { return true; /* NAPA macro */
1413 } else if (IS_IDENTIFIER("CLIP" )) { return true; /* NAPA macro */
1414 } else if (IS_IDENTIFIER("COS" )) { return true; /* NAPA macro */
1415 } else if (IS_IDENTIFIER("DB2LIN" )) { return true; /* NAPA macro */
1416 } else if (IS_IDENTIFIER("DB2POW" )) { return true; /* NAPA macro */
1417 } else if (IS_IDENTIFIER("DEG2RAD" )) { return true; /* NAPA macro */
1418 } else if (IS_IDENTIFIER("D2I" )) { return true; /* NAPA macro */
1419 } else if (IS_IDENTIFIER("FSS" )) { return true; /* NAPA macro */
1420 } else if (IS_IDENTIFIER("IONAME" )) { return true; /* NAPA macro */
1421 } else if (IS_IDENTIFIER("ISEQUAL" )) { return true; /* NAPA macro */
1422 } else if (IS_IDENTIFIER("ISEVEN" )) { return true; /* NAPA macro */
1423 } else if (IS_IDENTIFIER("ISINSIDE" )) { return true; /* NAPA macro */
1424 } else if (IS_IDENTIFIER("ISINTEGER" )) { return true; /* NAPA macro */
1425 } else if (IS_IDENTIFIER("ISINTEGER" )) { return true; /* NAPA macro */
1426 } else if (IS_IDENTIFIER("ISNAN" )) { return true; /* NAPA macro */
1427 } else if (IS_IDENTIFIER("ISNOTSMALL" )) { return true; /* NAPA macro */
1428 } else if (IS_IDENTIFIER("ISODD" )) { return true; /* NAPA macro */
1429 } else if (IS_IDENTIFIER("ISOUTSIDE" )) { return true; /* NAPA macro */
1430 } else if (IS_IDENTIFIER("ISSMALL" )) { return true; /* NAPA macro */
1431 /* "ISTIME" ..................................... NAPA macro, NOT A PURE FUNCTION !!! */
1432 } else if (IS_IDENTIFIER("I2D" )) { return true; /* NAPA macro */
1433 } else if (IS_IDENTIFIER("LENGTH" )) { return true; /* NAPA macro */
1434 } else if (IS_IDENTIFIER("LIN2DB" )) { return true; /* NAPA macro */
1435 } else if (IS_IDENTIFIER("LINDOMAIN" )) { return true; /* NAPA macro */
1436 } else if (IS_IDENTIFIER("LINSWEEP" )) { return true; /* NAPA macro */
1437 } else if (IS_IDENTIFIER("LOGDOMAIN" )) { return true; /* NAPA macro */
1438 } else if (IS_IDENTIFIER("LOGSWEEP" )) { return true; /* NAPA macro */
1439 } else if (IS_IDENTIFIER("LOG" )) { return true; /* NAPA macro */
1440 } else if (IS_IDENTIFIER("LOG10" )) { return true; /* NAPA macro */
1441 } else if (IS_IDENTIFIER("MAX" )) { return true; /* NAPA macro */
1442 } else if (IS_IDENTIFIER("MIN" )) { return true; /* NAPA macro */
1443 } else if (IS_IDENTIFIER("MODULO" )) { return true; /* NAPA macro */
1444 } else if (IS_IDENTIFIER("NIS" )) { return true; /* NAPA macro */
1445 } else if (IS_IDENTIFIER("POW" )) { return true; /* NAPA macro */
1446 } else if (IS_IDENTIFIER("POWEROF2" )) { return true; /* NAPA macro */
1447 } else if (IS_IDENTIFIER("POW2DB" )) { return true; /* NAPA macro */
1448 } else if (IS_IDENTIFIER("POW2LIN" )) { return true; /* NAPA macro */
1449 } else if (IS_IDENTIFIER("POW10" )) { return true; /* NAPA macro */
1450 } else if (IS_IDENTIFIER("RAD2DEG" )) { return true; /* NAPA macro */
1451 /* "RAND_01" ..................................... NAPA macro NOT A PURE FUNCTION */
1452 /* "RAND_01_X" ..................................... NAPA macro NOT A PURE FUNCTION */
1453 } else if (IS_IDENTIFIER("RANDOM_SEED" )) { return true; /* NAPA macro */
1454 } else if (IS_IDENTIFIER("ROOT" )) { return true; /* NAPA macro */
1455 } else if (IS_IDENTIFIER("SQR" )) { return true; /* NAPA macro */
1456 } else if (IS_IDENTIFIER("SQRT" )) { return true; /* NAPA macro */
1457 } else if (IS_IDENTIFIER("SIGN" )) { return true; /* NAPA macro */
1458 } else if (IS_IDENTIFIER("SIN" )) { return true; /* NAPA macro */
1459 } else if (IS_IDENTIFIER("STS" )) { return true; /* NAPA macro */
1460 } else { return false; /* Not a known function */
1461 }
1462}
1463
1464
1465/* It is important to avoid side effects from identifiers collision or misuse. Critical identifiers are listed here. */
1466/* The choice between error or warning depends mainly on the possible consequence of the misuse. */
1467
1468int is_an_instruction(const char *identifier) {
1469 if (IS_IDENTIFIER("alias" )) { return true; /* NAPA instruction */
1470 } else if (IS_IDENTIFIER("assert" )) { return true; /* NAPA instruction */
1471 } else if (IS_IDENTIFIER("array" )) { return true; /* NAPA instruction */
1472 } else if (IS_IDENTIFIER("call" )) { return true; /* NAPA instruction */
1473 } else if (IS_IDENTIFIER("cell" )) { return true; /* NAPA instruction keyword */
1474 } else if (IS_IDENTIFIER("cell_interface" )) { return true; /* NAPA cell keyword */
1475 } else if (IS_IDENTIFIER("command_line" )) { return true; /* NAPA instruction */
1476 } else if (IS_IDENTIFIER("comment" )) { return true; /* NAPA instruction */
1477 } else if (IS_IDENTIFIER("data" )) { return true; /* NAPA instruction */
1478 } else if (IS_IDENTIFIER("data_interface" )) { return true; /* NAPA data keyword */
1479 } else if (IS_IDENTIFIER("debug" )) { return true; /* NAPA instruction */
1480 } else if (IS_IDENTIFIER("decimate" )) { return true; /* NAPA instruction */
1481 } else if (IS_IDENTIFIER("declare" )) { return true; /* NAPA instruction */
1482 } else if (IS_IDENTIFIER("directive" )) { return true; /* NAPA instruction */
1483 } else if (IS_IDENTIFIER("drop" )) { return true; /* NAPA instruction */
1484 } else if (IS_IDENTIFIER("dump" )) { return true; /* NAPA instruction */
1485 } else if (IS_IDENTIFIER("dvar" )) { return true; /* NAPA instruction */
1486 } else if (IS_IDENTIFIER("error" )) { return true; /* NAPA instruction */
1487 } else if (IS_IDENTIFIER("event" )) { return true; /* NAPA instruction */
1488 } else if (IS_IDENTIFIER("export" )) { return true; /* NAPA instruction */
1489 } else if (IS_IDENTIFIER("format" )) { return true; /* NAPA instruction */
1490 } else if (IS_IDENTIFIER("fs" )) { return false; /* NAPA special instruction ! */
1491 } else if (IS_IDENTIFIER("gateway" )) { return true; /* NAPA instruction */
1492 } else if (IS_IDENTIFIER("ganging" )) { return true; /* NAPA instruction */
1493 } else if (IS_IDENTIFIER("header" )) { return true; /* NAPA instruction */
1494 } else if (IS_IDENTIFIER("init" )) { return true; /* NAPA instruction */
1495 } else if (IS_IDENTIFIER("inject" )) { return true; /* NAPA instruction */
1496 } else if (IS_IDENTIFIER("input" )) { return true; /* NAPA instruction */
1497 } else if (IS_IDENTIFIER("interlude" )) { return true; /* NAPA instruction */
1498 } else if (IS_IDENTIFIER("interface" )) { return true; /* NAPA cell and data keyword */
1499 } else if (IS_IDENTIFIER("interpolate" )) { return true; /* NAPA instruction */
1500 } else if (IS_IDENTIFIER("ivar" )) { return true; /* NAPA instruction */
1501 } else if (IS_IDENTIFIER("load" )) { return true; /* NAPA instruction */
1502 } else if (IS_IDENTIFIER("napa_short_title")) { return true; /* NAPA instruction */
1503 } else if (IS_IDENTIFIER("napa_title" )) { return true; /* NAPA instruction */
1504 } else if (IS_IDENTIFIER("napa_version" )) { return true; /* NAPA instruction */
1505 } else if (IS_IDENTIFIER("node" )) { return true; /* NAPA instruction */
1506 } else if (IS_IDENTIFIER("nominal" )) { return true; /* NAPA instruction */
1507 } else if (IS_IDENTIFIER("opcode" )) { return true; /* NAPA instruction */
1508 } else if (IS_IDENTIFIER("output" )) { return true; /* NAPA instruction */
1509 } else if (IS_IDENTIFIER("ping" )) { return true; /* NAPA instruction */
1510 } else if (IS_IDENTIFIER("post" )) { return true; /* NAPA instruction */
1511 } else if (IS_IDENTIFIER("random_seed" )) { return true; /* NAPA instruction */
1512 } else if (IS_IDENTIFIER("restart" )) { return true; /* NAPA instruction */
1513 } else if (IS_IDENTIFIER("sampling" )) { return true; /* NAPA instruction (new feature under test) */
1514 } else if (IS_IDENTIFIER("string" )) { return true; /* NAPA instruction */
1515 } else if (IS_IDENTIFIER("stuck" )) { return true; /* NAPA instruction */
1516 } else if (IS_IDENTIFIER("synchronize" )) { return true; /* NAPA instruction */
1517 } else if (IS_IDENTIFIER("terminate" )) { return true; /* NAPA instruction */
1518 } else if (IS_IDENTIFIER("tool" )) { return true; /* NAPA instruction */
1519 } else if (IS_IDENTIFIER("ts" )) { return true; /* NAPA instruction */
1520 } else if (IS_IDENTIFIER("update" )) { return true; /* NAPA instruction */
1521 } else if (IS_IDENTIFIER("warning" )) { return true; /* NAPA instruction */
1522 } else { return false;
1523 }
1524}
1525
1526
1527int is_a_keyword(const char *identifier) {
1528 if (UNKNOWN_KIND != node_kind(identifier) ) {
1529 return WARNING; /* NAPA node kind */
1530 } else if (is_an_instruction(identifier) ) {
1531 return WARNING; /* NAPA instruction */
1532 } else if (is_a_known_function(identifier)) {
1533 return ERROR; /* 'standard' C function */
1534 }
1535 if (IS_NAPA_PREFIX() ) { return ERROR; /* NAPA reserved prefix */
1536 } else if (IS_DEBUG_PREFIX() ) { return ERROR; /* NAPA reserved prefix */
1537 } else if (IS_COMPILE_PREFIX() ) { return ERROR; /* NAPA reserved prefix */
1538 } else if (IS_IDENTIFIER("after" )) { return ERROR; /* NAPA qualifier */
1539 } else if (IS_IDENTIFIER("analog" )) { return WARNING; /* NAPA qualifier */
1540 } else if (IS_IDENTIFIER("arithmetic" )) { return WARNING; /* NAPA qualifier */
1541 } else if (IS_IDENTIFIER("before" )) { return ERROR; /* NAPA qualifier */
1542 } else if (IS_IDENTIFIER("char" )) { return ERROR; /* C keyword */
1543 } else if (IS_IDENTIFIER("constant" )) { return WARNING; /* NAPA qualifier */
1544 } else if (IS_IDENTIFIER("digital" )) { return WARNING; /* NAPA qualifier */
1545 } else if (IS_IDENTIFIER("double" )) { return ERROR; /* C keyword */
1546 } else if (IS_IDENTIFIER("dual" )) { return WARNING; /* NAPA qualifier */
1547 } else if (IS_IDENTIFIER("expand" )) { return WARNING; /* NAPA qualifier */
1548 } else if (IS_IDENTIFIER("false" )) { return ERROR; /* C keyword and C keyword */
1549 } else if (IS_IDENTIFIER("float" )) { return ERROR; /* C keyword */
1550 } else if (IS_IDENTIFIER("geometric" )) { return WARNING; /* NAPA qualifier */
1551 } else if (IS_IDENTIFIER("harmonic" )) { return WARNING; /* NAPA qualifier */
1552 } else if (IS_IDENTIFIER("hex" )) { return WARNING; /* NAPA qualifier */
1553 } else if (IS_IDENTIFIER("int" )) { return ERROR; /* C keyword */
1554 } else if (IS_IDENTIFIER("interface" )) { return WARNING; /* NAPA cell keyword */
1555 } else if (IS_IDENTIFIER("negative" )) { return WARNING; /* NAPA qualifier */
1556 } else if (IS_IDENTIFIER("new" )) { return WARNING; /* NAPA qualifier */
1557 } else if (IS_IDENTIFIER("noexpand" )) { return WARNING; /* NAPA qualifier */
1558 } else if (IS_IDENTIFIER("long" )) { return ERROR; /* C keyword */
1559 } else if (IS_IDENTIFIER("normal" )) { return WARNING; /* NAPA qualifier */
1560 } else if (IS_IDENTIFIER("pointer" )) { return WARNING; /* NAPA qualifier */
1561 } else if (IS_IDENTIFIER("positive" )) { return WARNING; /* NAPA qualifier */
1562 } else if (IS_IDENTIFIER("rms" )) { return WARNING; /* NAPA qualifier */
1563 } else if (IS_IDENTIFIER("short" )) { return ERROR; /* C keyword */
1564 } else if (IS_IDENTIFIER("string" )) { return WARNING; /* NAPA qualifier */
1565 } else if (IS_IDENTIFIER("true" )) { return ERROR; /* NAPA qualifier and C keyword */
1566 } else if (IS_IDENTIFIER("uniform" )) { return WARNING; /* NAPA qualifier */
1567 } else if (IS_IDENTIFIER("unsigned" )) { return ERROR; /* C keyword */
1568 } else if (IS_IDENTIFIER("when" )) { return ERROR; /* NAPA qualifier */
1569 } else if (IS_IDENTIFIER("with" )) { return ERROR; /* NAPA qualifier */
1570 }
1571 if (IS_IDENTIFIER("ABS_LOOP_INDEX" )) { return ERROR; /* NAPA macro */
1572 } else if (IS_IDENTIFIER("ABS_TIME" )) { return ERROR; /* NAPA macro */
1573 } else if (IS_IDENTIFIER("ALLOCATE" )) { return ERROR; /* NAPA macro */
1574 } else if (IS_IDENTIFIER("ANALOG_INI" )) { return ERROR; /* NAPA macro */
1575 } else if (IS_IDENTIFIER("ANTITHETIC" )) { return ERROR; /* NAPA macro */
1576 } else if (IS_IDENTIFIER("ASSERT_FLAG" )) { return ERROR; /* NAPA macro */
1577 } else if (IS_IDENTIFIER("CELLS_LIB" )) { return ERROR; /* NAPA macro */
1578 } else if (IS_IDENTIFIER("C_TYPE" )) { return ERROR; /* C code internal typdef */
1579 } else if (IS_IDENTIFIER("CLOSE" )) { return ERROR; /* NAPA macro */
1580 } else if (IS_IDENTIFIER("CODE" )) { return ERROR; /* NAPA macro */
1581 } else if (IS_IDENTIFIER("COMMAND_LINE" )) { return ERROR; /* NAPA macro */
1582 } else if (IS_IDENTIFIER("COMMAND_PARMS" )) { return ERROR; /* NAPA macro */
1583 } else if (IS_IDENTIFIER("COMMENT" )) { return ERROR; /* NAPA macro */
1584 } else if (IS_IDENTIFIER("CREATED" )) { return ERROR; /* NAPA macro */
1585 } else if (IS_IDENTIFIER("DATA_RECORD" )) { return ERROR; /* C code internal typdef */
1586 } else if (IS_IDENTIFIER("DEBUG" )) { return ERROR; /* NAPA macro */
1587 } else if (IS_IDENTIFIER("DELETE" )) { return ERROR; /* NAPA macro */
1588 } else if (IS_IDENTIFIER("DIGITAL_INI" )) { return ERROR; /* NAPA macro */
1589 } else if (IS_IDENTIFIER("DUMP_FLAG" )) { return ERROR; /* NAPA macro */
1590 } else if (IS_IDENTIFIER("E_FORMAT" )) { return ERROR; /* NAPA macro */
1591 } else if (IS_IDENTIFIER("E_HEAD" )) { return ERROR; /* NAPA macro */
1592 } else if (IS_IDENTIFIER("E_LIST" )) { return ERROR; /* NAPA macro */
1593 } else if (IS_IDENTIFIER("EPSILON" )) { return ERROR; /* C code internal const */
1594 } else if (IS_IDENTIFIER("ERROR_FLAG" )) { return ERROR; /* NAPA macro */
1595 } else if (IS_IDENTIFIER("EXPORT" )) { return ERROR; /* NAPA macro */
1596 } else if (IS_IDENTIFIER("false" )) { return ERROR; /* NAPA macro */
1597 } else if (IS_IDENTIFIER("FREE" )) { return ERROR; /* NAPA macro */
1598 } else if (IS_IDENTIFIER("FS" )) { return ERROR; /* NAPA macro */
1599 } else if (IS_IDENTIFIER("FSL" )) { return ERROR; /* NAPA macro */
1600 } else if (IS_IDENTIFIER("GENERATORS_LIB" )) { return ERROR; /* NAPA macro */
1601 } else if (IS_IDENTIFIER("HEADERS_LIB" )) { return ERROR; /* NAPA macro */
1602 } else if (IS_IDENTIFIER("I_FORMAT" )) { return ERROR; /* NAPA macro */
1603 } else if (IS_IDENTIFIER("IO_RECORD" )) { return ERROR; /* C code internal typdef */
1604 } else if (IS_IDENTIFIER("I_TYPE" )) { return ERROR; /* C code internal typdef */
1605 } else if (IS_IDENTIFIER("LOOP_INDEX" )) { return ERROR; /* NAPA macro */
1606 } else if (IS_IDENTIFIER("MAILBOX" )) { return ERROR; /* NAPA macro */
1607 } else if (IS_IDENTIFIER("MAILBOX_RECORD" )) { return ERROR; /* NAPA macro */
1608 } else if (IS_IDENTIFIER("NO" )) { return ERROR; /* NAPA macro */
1609 } else if (IS_IDENTIFIER("NUM_OF_SEGMENTS" )) { return ERROR; /* NAPA macro */
1610 } else if (IS_IDENTIFIER("NUM_OF_TIME_OUTPUTS")) { return ERROR; /* NAPA macro */
1611 } else if (IS_IDENTIFIER("OPENAPPEND" )) { return ERROR; /* NAPA macro */
1612 } else if (IS_IDENTIFIER("OPENAPPEND_BINARY" )) { return ERROR; /* NAPA macro */
1613 } else if (IS_IDENTIFIER("OPENREAD" )) { return ERROR; /* NAPA macro */
1614 } else if (IS_IDENTIFIER("OPENREAD_BINARY" )) { return ERROR; /* NAPA macro */
1615 } else if (IS_IDENTIFIER("OPENWRITE" )) { return ERROR; /* NAPA macro */
1616 } else if (IS_IDENTIFIER("OPENWRITE_BINARY" )) { return ERROR; /* NAPA macro */
1617 } else if (IS_IDENTIFIER("ORIGIN" )) { return ERROR; /* NAPA macro */
1618 } else if (IS_IDENTIFIER("P_TYPE" )) { return ERROR; /* C code internal typdef */
1619 } else if (IS_IDENTIFIER("PACKET" )) { return ERROR; /* NAPA macro */
1620 } else if (IS_IDENTIFIER("PERIODIC" )) { return ERROR; /* NAPA macro */
1621 } else if (IS_IDENTIFIER("PLATFORM" )) { return ERROR; /* NAPA macro */
1622 } else if (IS_IDENTIFIER("QUERY" )) { return ERROR; /* NAPA macro */
1623 } else if (IS_IDENTIFIER("RAM_I_RECORD" )) { return ERROR; /* C code internal typdef */
1624 } else if (IS_IDENTIFIER("RAM2_I_RECORD" )) { return ERROR; /* C code internal typdef */
1625 } else if (IS_IDENTIFIER("RAM_R_RECORD" )) { return ERROR; /* C code internal typdef */
1626 } else if (IS_IDENTIFIER("RAM2_R_RECORD" )) { return ERROR; /* C code internal typdef */
1627 } else if (IS_IDENTIFIER("RANDOM_SEED" )) { return ERROR; /* NAPA macro */
1628 } else if (IS_IDENTIFIER("REF_TIME" )) { return ERROR; /* NAPA macro */
1629 } else if (IS_IDENTIFIER("REL_LOOP_INDEX" )) { return ERROR; /* NAPA macro */
1630 } else if (IS_IDENTIFIER("REL_TIME" )) { return ERROR; /* NAPA macro */
1631 } else if (IS_IDENTIFIER("RESET" )) { return ERROR; /* NAPA macro */
1632 } else if (IS_IDENTIFIER("REWIND" )) { return ERROR; /* NAPA macro */
1633 } else if (IS_IDENTIFIER("REWRITE" )) { return ERROR; /* NAPA macro */
1634 } else if (IS_IDENTIFIER("R_FORMAT" )) { return ERROR; /* NAPA macro */
1635 } else if (IS_IDENTIFIER("ROM_I_RECORD" )) { return ERROR; /* C code internal typdef */
1636 } else if (IS_IDENTIFIER("ROM2_I_RECORD" )) { return ERROR; /* C code internal typdef */
1637 } else if (IS_IDENTIFIER("ROM_R_RECORD" )) { return ERROR; /* C code internal typdef */
1638 } else if (IS_IDENTIFIER("ROM2_R_RECORD" )) { return ERROR; /* C code internal typdef */
1639 } else if (IS_IDENTIFIER("R_TYPE" )) { return ERROR; /* C code internal typdef */
1640 } else if (IS_IDENTIFIER("SEGMENT" )) { return ERROR; /* NAPA macro */
1641 } else if (IS_IDENTIFIER("SEPARATOR" )) { return ERROR; /* NAPA macro */
1642 } else if (IS_IDENTIFIER("S_FORMAT" )) { return ERROR; /* NAPA macro */
1643 } else if (IS_IDENTIFIER("SHORT_TITLE" )) { return ERROR; /* NAPA macro */
1644 } else if (IS_IDENTIFIER("SIM_RATE" )) { return ERROR; /* NAPA macro */
1645 } else if (IS_IDENTIFIER("SOURCE" )) { return ERROR; /* NAPA macro */
1646 } else if (IS_IDENTIFIER("START" )) { return ERROR; /* C code internal const */
1647 } else if (IS_IDENTIFIER("STL" )) { return ERROR; /* NAPA macro */
1648 } else if (IS_IDENTIFIER("STOP" )) { return ERROR; /* C code internal const */
1649 } else if (IS_IDENTIFIER("SYNCHRONIZE" )) { return ERROR; /* NAPA macro */
1650 } else if (IS_IDENTIFIER("TERMINATE" )) { return ERROR; /* NAPA macro */
1651 } else if (IS_IDENTIFIER("TIME" )) { return ERROR; /* NAPA macro */
1652 } else if (IS_IDENTIFIER("TITLE" )) { return ERROR; /* NAPA macro */
1653 } else if (IS_IDENTIFIER("TOOL_INDEX" )) { return ERROR; /* NAPA macro */
1654 } else if (IS_IDENTIFIER("true" )) { return ERROR; /* NAPA macro */
1655 } else if (IS_IDENTIFIER("UNKNOWN" )) { return ERROR; /* NAPA macro */
1656 } else if (IS_IDENTIFIER("_2PI_" )) { return ERROR; /* C code internal const */
1657 } else if (IS_IDENTIFIER("USER" )) { return ERROR; /* NAPA macro */
1658 } else if (IS_IDENTIFIER("V_FORMAT" )) { return ERROR; /* NAPA macro */
1659 } else if (IS_IDENTIFIER("V_HEAD" )) { return ERROR; /* NAPA macro */
1660 } else if (IS_IDENTIFIER("V_NAME" )) { return ERROR; /* NAPA macro */
1661 } else if (IS_IDENTIFIER("V_TYPE" )) { return ERROR; /* C code internal typdef */
1662 } else if (IS_IDENTIFIER("WALL_CLOCK" )) { return ERROR; /* NAPA macro */
1663 } else if (IS_IDENTIFIER("X_FORMAT" )) { return ERROR; /* NAPA macro */
1664 } else if (IS_IDENTIFIER("YES" )) { return ERROR; /* NAPA macro */
1665 }
1666 if (IS_IDENTIFIER("_e_" )) { return ERROR; /* C code internal const */
1667 } else if (IS_IDENTIFIER("_pi_" )) { return ERROR; /* C code internal const */
1668 } else if (IS_IDENTIFIER("_pi2_" )) { return ERROR; /* C code internal const */
1669 } else if (IS_IDENTIFIER("_pi4_" )) { return ERROR; /* C code internal const */
1670 } else if (IS_IDENTIFIER("_pi8_" )) { return ERROR; /* C code internal const */
1671 } else if (IS_IDENTIFIER("_E_" )) { return ERROR; /* C code internal const */
1672 } else if (IS_IDENTIFIER("_PI_" )) { return ERROR; /* C code internal const */
1673 } else if (IS_IDENTIFIER("_PI2_" )) { return ERROR; /* C code internal const */
1674 } else if (IS_IDENTIFIER("_PI4_" )) { return ERROR; /* C code internal const */
1675 } else if (IS_IDENTIFIER("_PI8_" )) { return ERROR; /* C code internal const */
1676 }
1677 return false; /* Not a keyword ! */
1678}
1679
1680
1681int is_an_operator(const char *identifier) {
1682 if (IS_IDENTIFIER("+" )) { return true;
1683 } else if (IS_IDENTIFIER("-" )) { return true;
1684 } else if (IS_IDENTIFIER("*" )) { return true;
1685 } else if (IS_IDENTIFIER("/" )) { return true;
1686 } else if (IS_IDENTIFIER("%" )) { return true;
1687 } else if (IS_IDENTIFIER("=" )) { return true;
1688 } else if (IS_IDENTIFIER("!" )) { return true;
1689 } else if (IS_IDENTIFIER(">" )) { return true;
1690 } else if (IS_IDENTIFIER("<" )) { return true;
1691 } else if (IS_IDENTIFIER("&" )) { return true;
1692 } else if (IS_IDENTIFIER("~" )) { return true;
1693 } else if (IS_IDENTIFIER("^" )) { return true;
1694 } else if (IS_IDENTIFIER("|" )) { return true;
1695 } else if (IS_IDENTIFIER("(" )) { return true;
1696 } else if (IS_IDENTIFIER(")" )) { return true;
1697 } else if (IS_IDENTIFIER("[" )) { return true;
1698 } else if (IS_IDENTIFIER("]" )) { return true;
1699 } else if (IS_IDENTIFIER("{" )) { return true;
1700 } else if (IS_IDENTIFIER("}" )) { return true;
1701 } else if (IS_IDENTIFIER("?" )) { return true;
1702 } else if (IS_IDENTIFIER(":" )) { return true;
1703 } else if (IS_IDENTIFIER("," )) { return true;
1704 } else { return false; /* Not an operator */
1705 }
1706}
1707
1708
1709/* A collection of constants or macro constants defined in NAPA at the exception of */
1710/* too specialized macros which are not used in regular expressions (like OPEN_WRITE...) */
1711
1712int is_a_constant_or_a_macro_constant(const char *identifier) {
1713 if (IS_IDENTIFIER("ANALOG_INI" )) { return true;
1714 } else if (IS_IDENTIFIER("ANTITHETIC" )) { return true;
1715 } else if (IS_IDENTIFIER("BIG_ENDIAN" )) { return true;
1716 } else if (IS_IDENTIFIER("CODE" )) { return true;
1717 } else if (IS_IDENTIFIER("CREATED" )) { return true;
1718 } else if (IS_IDENTIFIER("DIGITAL_INI" )) { return true;
1719 } else if (IS_IDENTIFIER("_e_" )) { return true;
1720 } else if (IS_IDENTIFIER("_E_" )) { return true;
1721 } else if (IS_IDENTIFIER("EPSILON" )) { return true;
1722 } else if (IS_IDENTIFIER("false" )) { return true;
1723 } else if (IS_IDENTIFIER("FALSE" )) { return true;
1724 } else if (IS_IDENTIFIER("FS" )) { return true;
1725 } else if (IS_IDENTIFIER("FSL" )) { return true;
1726 } else if (IS_IDENTIFIER("I_FORMAT" )) { return true;
1727 } else if (IS_IDENTIFIER("LITTLE_ENDIAN" )) { return true;
1728 } else if (IS_IDENTIFIER("NO" )) { return true;
1729 } else if (IS_IDENTIFIER("ORIGIN" )) { return true;
1730 } else if (IS_IDENTIFIER("PERIODIC" )) { return true;
1731 } else if (IS_IDENTIFIER("_pi_" )) { return true;
1732 } else if (IS_IDENTIFIER("_pi_2" )) { return true;
1733 } else if (IS_IDENTIFIER("_pi_4" )) { return true;
1734 } else if (IS_IDENTIFIER("_pi_8" )) { return true;
1735 } else if (IS_IDENTIFIER("_2pi_" )) { return true;
1736 } else if (IS_IDENTIFIER("_PI_" )) { return true;
1737 } else if (IS_IDENTIFIER("_PI_2" )) { return true;
1738 } else if (IS_IDENTIFIER("_PI_4" )) { return true;
1739 } else if (IS_IDENTIFIER("_PI_8" )) { return true;
1740 } else if (IS_IDENTIFIER("_2PI_" )) { return true;
1741 } else if (IS_IDENTIFIER("NAPA_JOB_ID" )) { return true;
1742 } else if (IS_IDENTIFIER("NAPA_VERSION" )) { return true;
1743 } else if (IS_IDENTIFIER("NUM_OF_SEGMENTS" )) { return true;
1744 } else if (IS_IDENTIFIER("NUM_OF_TIME_OUTPUTS")) { return true;
1745 } else if (IS_IDENTIFIER("RANDOM_SEED" )) { return true;
1746 } else if (IS_IDENTIFIER("R_FORMAT" )) { return true;
1747 } else if (IS_IDENTIFIER("S_FORMAT" )) { return true;
1748 } else if (IS_IDENTIFIER("SEPARATOR" )) { return true;
1749 } else if (IS_IDENTIFIER("SHORT_TITLE" )) { return true;
1750 } else if (IS_IDENTIFIER("SIM_RATE" )) { return true;
1751 } else if (IS_IDENTIFIER("SOURCE" )) { return true;
1752 } else if (IS_IDENTIFIER("START" )) { return true;
1753 } else if (IS_IDENTIFIER("STL" )) { return true;
1754 } else if (IS_IDENTIFIER("STOP" )) { return true;
1755 } else if (IS_IDENTIFIER("TITLE" )) { return true;
1756 } else if (IS_IDENTIFIER("true" )) { return true;
1757 } else if (IS_IDENTIFIER("TRUE" )) { return true;
1758 } else if (IS_IDENTIFIER("USER" )) { return true;
1759 } else if (IS_IDENTIFIER("X_FORMAT" )) { return true;
1760 } else if (IS_IDENTIFIER("YES" )) { return true;
1761
1762 } else { return false; /* not a constant */
1763 }
1764}
1765
1766
1767int is_a_modifier(const char *identifier) {
1768 if (IS_IDENTIFIER("long" )) { return true;
1769 } else if (IS_IDENTIFIER("int" )) { return true;
1770 } else if (IS_IDENTIFIER("short" )) { return true;
1771 } else if (IS_IDENTIFIER("double" )) { return true;
1772 } else if (IS_IDENTIFIER("float" )) { return true;
1773 } else if (IS_IDENTIFIER("char" )) { return true;
1774 } else if (IS_IDENTIFIER("unsigned" )) { return true;
1775 } else if (IS_IDENTIFIER("FILE" )) { return true;
1776 } else if (IS_IDENTIFIER("R_TYPE" )) { return true;
1777 } else if (IS_IDENTIFIER("I_TYPE" )) { return true;
1778 } else if (IS_IDENTIFIER("S_TYPE" )) { return true;
1779 } else if (IS_IDENTIFIER("P_TYPE" )) { return true;
1780 } else if (IS_IDENTIFIER("V_TYPE" )) { return true;
1781 } else if (IS_IDENTIFIER("L_PREC" )) { return true;
1782 } else if (IS_IDENTIFIER("H_PREC" )) { return true;
1783 } else { return false; /* not a modifier */
1784 }
1785}
1786
1787
1788/* ****************************************************************************************************************************** */
1789/* end of file */
void print_error_location(const char *type, const unsigned long *mlin, const unsigned long *mfil)
Definition fc.c:1476
void print_limits(void)
Definition fc.c:56
void increment_debug_number(const char *kind)
Definition id.c:241
long constant_type(char *identifier)
Definition id.c:1130
int is_an_operator(const char *identifier)
Definition id.c:1681
void increment_call_number(const char *kind)
Definition id.c:189
long get_type(char *identifier)
Definition id.c:1190
void increment_post_number(const char *kind)
Definition id.c:440
int is_a_modifier(const char *identifier)
Definition id.c:1767
long alias_id(const char *identifier)
Definition id.c:624
#define IS_DEBUG_PREFIX()
Definition id.c:93
long postprocess_id(const char *identifier)
Definition id.c:785
void increment_opcode_number(const char *kind)
Definition id.c:427
void increment_array_number(const char *kind)
Definition id.c:163
void mark_updates_if_constant(void)
Definition id.c:919
void swap_nodes(long i, long j)
Definition id.c:590
void increment_generator_number(const char *kind)
Definition id.c:320
int variable_update_block(void)
Definition id.c:1083
void increment_function_number(const char *kind)
Definition id.c:306
void increment_node_number(const char *kind)
Definition id.c:413
void increment_alias_number(const char *kind)
Definition id.c:150
void increment_declare_number(const char *kind)
Definition id.c:254
void increment_assert_number(const char *kind)
Definition id.c:176
long user_id(const char *identifier)
Definition id.c:844
void increment_record_number(const char *kind)
Definition id.c:453
void increment_IO_number(const char *kind)
Definition id.c:399
#define IS_IDENTIFIER(x)
Definition id.c:90
int is_a_constant_or_a_macro_constant(const char *identifier)
Definition id.c:1712
#define IS_NAPA_PREFIX()
Definition id.c:92
long update_id(const char *identifier, long num)
Definition id.c:807
long cmdline_id(const char *identifier)
Definition id.c:657
#define IS_COMPILE_PREFIX()
Definition id.c:94
void increment_comment_number(const char *kind)
Definition id.c:215
void increment_cmdline_number(const char *kind)
Definition id.c:202
void increment_tool_number(const char *kind)
Definition id.c:505
long usertool_num(const char *nam)
Definition id.c:1224
void increment_inject_number(const char *kind)
Definition id.c:373
void swap_records(long i, long j)
Definition id.c:598
void strcpy_alloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
Definition id.c:114
int is_an_instruction(const char *identifier)
Definition id.c:1468
long declare_id(const char *identifier)
Definition id.c:696
int is_a_known_function(const char *identifier)
Definition id.c:1346
void flag_node(long num)
Definition id.c:99
void increment_init_number(const char *kind)
Definition id.c:360
int is_a_known_pure_function(const char *identifier)
Definition id.c:1368
long array_id(const char *identifier)
Definition id.c:635
long directive_id(const char *identifier)
Definition id.c:707
long node_kind(const char *identifier)
Definition id.c:1236
long op_id(const char *identifier)
Definition id.c:774
void increment_export_number(const char *kind)
Definition id.c:280
void swap_vars(long i, long j)
Definition id.c:606
void increment_void_number(void)
Definition id.c:564
int is_a_keyword(const char *identifier)
Definition id.c:1527
void increment_restart_number(const char *kind)
Definition id.c:466
void increment_directive_number(const char *kind)
Definition id.c:267
int time_output_block(void)
Definition id.c:1114
void increment_const_number(void)
Definition id.c:558
long array_name_id(const char *identifier)
Definition id.c:646
long node_id(const char *identifier)
Definition id.c:718
long var_id(const char *identifier)
Definition id.c:855
void increment_filecell_number(const char *kind)
Definition id.c:293
void increment_usertool_number(const char *kind)
Definition id.c:531
void swap_updates(long i, long j)
Definition id.c:614
int is_node_flagged(long num)
Definition id.c:105
long debug_id(const char *identifier)
Definition id.c:685
void increment_common_number(const char *kind)
Definition id.c:228
int sort_names(const void *a, const void *b)
Definition id.c:572
void increment_var_number(const char *kind)
Definition id.c:545
void increment_segment_number(const char *kind)
Definition id.c:479
int node_update_block(void)
Definition id.c:1100
void increment_update_number(const char *kind)
Definition id.c:518
long record_id(const char *identifier)
Definition id.c:796
void increment_instance_number(const char *kind)
Definition id.c:386
void increment_group_number(const char *kind)
Definition id.c:334
void increment_stuck_number(const char *kind)
Definition id.c:492
void swap_delay_inputs(long i, long j)
Definition id.c:581
void strcpy_realloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
Definition id.c:129
void increment_header_number(const char *kind)
Definition id.c:347
void mark_constants(void)
Definition id.c:1064
#define MAXEXPORTS
Definition napa.h:213
EXTERN long Num_Injects
Definition napa.h:820
#define MUX_KIND
Definition napa.h:288
#define MAXVARS
Definition napa.h:187
EXTERN long Num_Voids
Definition napa.h:837
EXTERN long Num_Groups
Definition napa.h:817
EXTERN long Num_Aliases
Definition napa.h:799
EXTERN VAR_TYPE Var_List[2047L]
Definition napa.h:970
#define EQUAL_KIND
Definition napa.h:262
EXTERN RECORD_TYPE Record_List[127L]
Definition napa.h:965
EXTERN long Num_Consts
Definition napa.h:807
#define MAXINSTANCES
Definition napa.h:190
EXTERN long Num_Debugs
Definition napa.h:809
EXTERN long Num_Calls
Definition napa.h:802
#define ITOD_KIND
Definition napa.h:278
#define MOD_KIND
Definition napa.h:286
EXTERN long Num_Functions
Definition napa.h:815
EXTERN long Num_Vars
Definition napa.h:836
#define RIP_KIND
Definition napa.h:302
EXTERN ARRAY_TYPE Array_List[63L]
Definition napa.h:950
#define LENGTH(s)
Definition napa.h:397
#define MULLER_KIND
Definition napa.h:287
#define WSUM_KIND
Definition napa.h:323
EXTERN DECLARE_TYPE Declare_List[1023L]
Definition napa.h:953
#define TRACK_KIND
Definition napa.h:318
#define UNKNOWN_TYPE
Definition napa.h:332
#define UNDEFINED
Definition napa.h:331
EXTERN long Num_Records
Definition napa.h:828
#define RSHIFT2_KIND
Definition napa.h:307
EXTERN long Num_Updates
Definition napa.h:834
#define AND_KIND
Definition napa.h:229
#define ROM2_KIND
Definition napa.h:304
EXTERN long Num_Arrays
Definition napa.h:800
EXTERN int Function_Flag
Definition napa.h:858
#define TRIANGLE_KIND
Definition napa.h:319
EXTERN POST_TYPE Post_List[63L]
Definition napa.h:964
#define STDERR
Definition napa.h:105
#define MAXINJECTS
Definition napa.h:210
EXTERN NODE_TYPE Node_List[4095L]
Definition napa.h:962
#define LATCH_KIND
Definition napa.h:281
#define DIFFERENTIATOR_KIND
Definition napa.h:257
#define RSHIFT1_KIND
Definition napa.h:306
#define LSHIFT_KIND
Definition napa.h:282
EXTERN long Num_UserTools
Definition napa.h:835
#define INV_KIND
Definition napa.h:276
#define BWNAND_KIND
Definition napa.h:236
EXTERN USERTOOL_TYPE UserTool_List[511L]
Definition napa.h:969
#define DTOI_KIND
Definition napa.h:259
#define FZNOR_KIND
Definition napa.h:267
#define OSC_KIND
Definition napa.h:294
#define CONST_KIND
Definition napa.h:246
#define CLOCK_KIND
Definition napa.h:244
#define NOR_KIND
Definition napa.h:291
EXTERN long Num_Restarts
Definition napa.h:830
#define ANALOG_DATA_TYPE
Definition napa.h:338
EXTERN int Tool_Index_Flag
Definition napa.h:882
#define ADC_KIND
Definition napa.h:226
#define MAXGROUPS
Definition napa.h:214
#define COPY_KIND
Definition napa.h:247
#define OFFSET_KIND
Definition napa.h:292
#define MAXCOMMENTS
Definition napa.h:203
#define OR_KIND
Definition napa.h:293
#define WARNING
Definition napa.h:409
EXTERN long Num_Headers
Definition napa.h:818
#define CLIP_KIND
Definition napa.h:243
EXTERN ALIAS_TYPE Alias_List[127L]
Definition napa.h:949
#define RELAY_KIND
Definition napa.h:301
EXTERN DIRECTIVE_TYPE Directive_List[255L]
Definition napa.h:955
EXTERN DEBUG_TYPE Debug_List[63L]
Definition napa.h:952
#define MAXDECLARES
Definition napa.h:189
EXTERN long Num_Declares
Definition napa.h:810
#define SQUARE_KIND
Definition napa.h:312
#define MIN_KIND
Definition napa.h:285
#define UADC_KIND
Definition napa.h:321
#define IUSER_KIND
Definition napa.h:280
#define NAND_KIND
Definition napa.h:289
EXTERN long Num_Asserts
Definition napa.h:801
EXTERN int Cmdline_Flag
Definition napa.h:846
#define AVERAGE_KIND
Definition napa.h:230
#define LINLENGTH
Definition napa.h:216
#define PROD_KIND
Definition napa.h:296
#define MAXFUNCTIONS
Definition napa.h:195
#define DUSER_KIND
Definition napa.h:261
#define TEST_KIND
Definition napa.h:316
EXTERN long Num_Nodes
Definition napa.h:824
#define MAXPOSTS
Definition napa.h:206
#define GAIN_KIND
Definition napa.h:271
#define ITOB_KIND
Definition napa.h:277
#define BUF_KIND
Definition napa.h:233
#define HOLD_KIND
Definition napa.h:273
#define XOR_KIND
Definition napa.h:325
#define MAXARRAYS
Definition napa.h:202
#define RAM_KIND
Definition napa.h:298
EXTERN long Num_Tools
Definition napa.h:833
#define SIN_KIND
Definition napa.h:310
EXTERN long Num_Exports
Definition napa.h:813
#define TOGGLE_KIND
Definition napa.h:317
#define MAXFILECELLS
Definition napa.h:191
EXTERN long Num_Directives
Definition napa.h:812
EXTERN long Num_Inits
Definition napa.h:819
#define XNOR_KIND
Definition napa.h:324
#define BWXNOR_KIND
Definition napa.h:239
#define MAXDECLARECOMMONS
Definition napa.h:193
#define ERROR
Definition napa.h:410
EXTERN long Num_Posts
Definition napa.h:827
#define DALGEBRA_KIND
Definition napa.h:251
#define MAXOPCODES
Definition napa.h:199
#define RECT_KIND
Definition napa.h:300
#define MERGE_KIND
Definition napa.h:284
#define ROM_KIND
Definition napa.h:303
#define FZBUF_KIND
Definition napa.h:264
EXTERN OPCODE_TYPE Opcode_List[127L]
Definition napa.h:963
#define DC_KIND
Definition napa.h:252
#define SIGN_KIND
Definition napa.h:309
EXTERN long Num_FileCells
Definition napa.h:814
#define MAXHEADERS
Definition napa.h:209
#define FZXNOR_KIND
Definition napa.h:269
#define IALGEBRA_KIND
Definition napa.h:274
#define ALU_KIND
Definition napa.h:228
#define SUM_KIND
Definition napa.h:315
EXTERN int UserTool_Flag
Definition napa.h:888
EXTERN long Num_IOs
Definition napa.h:822
#define MAXIOS
Definition napa.h:205
#define BWXOR_KIND
Definition napa.h:240
#define BTOI_KIND
Definition napa.h:232
#define FZNAND_KIND
Definition napa.h:266
#define MAXNODES
Definition napa.h:186
#define MAXUPDATES
Definition napa.h:188
EXTERN long Num_Segments
Definition napa.h:831
EXTERN long Delay_Input[4095L]
Definition napa.h:984
EXTERN long Num_Comments
Definition napa.h:805
#define ISNOTEMPTY(s)
Definition napa.h:395
#define ITOOL_KIND
Definition napa.h:279
#define DTOOL_KIND
Definition napa.h:260
EXTERN int Inject_Flag
Definition napa.h:861
#define RAM2_KIND
Definition napa.h:299
#define SUB_KIND
Definition napa.h:314
#define DIV_KIND
Definition napa.h:258
#define FZOR_KIND
Definition napa.h:268
EXTERN long Num_Instances
Definition napa.h:821
EXTERN CMDLINE_TYPE Cmdline_List[63L]
Definition napa.h:951
#define MAXRECORDS
Definition napa.h:198
#define MAXUSERTOOLS
Definition napa.h:192
#define BWOR_KIND
Definition napa.h:238
#define FZXOR_KIND
Definition napa.h:270
#define POLY_KIND
Definition napa.h:295
#define RSHIFT_KIND
Definition napa.h:305
EXTERN long Num_Cmdlines
Definition napa.h:804
#define UDAC_KIND
Definition napa.h:322
#define ZERO_KIND
Definition napa.h:326
#define ISNOTEQUAL(x, y)
Definition napa.h:380
#define INTEGRATOR_KIND
Definition napa.h:275
#define MAX_KIND
Definition napa.h:283
EXTERN SEGMENT_TYPE Segment_List[127L]
Definition napa.h:966
#define GEN_KIND
Definition napa.h:272
#define MAXDEBUGS
Definition napa.h:208
#define MAXALIASES
Definition napa.h:197
#define STRLENGTH
Definition napa.h:217
#define BWNOR_KIND
Definition napa.h:237
#define COMP_KIND
Definition napa.h:245
EXTERN long Num_Opcodes
Definition napa.h:826
EXTERN long Num_Stucks
Definition napa.h:832
#define MAXCMDLINES
Definition napa.h:207
#define ISEMPTY(s)
Definition napa.h:394
#define STRING_DATA_TYPE
Definition napa.h:339
#define BSHIFT_KIND
Definition napa.h:231
#define DELAY_KIND
Definition napa.h:253
#define FZINV_KIND
Definition napa.h:265
#define ALGEBRA_KIND
Definition napa.h:227
#define HEX_DATA_TYPE
Definition napa.h:340
#define BWINV_KIND
Definition napa.h:235
#define FZAND_KIND
Definition napa.h:263
#define QUANT_KIND
Definition napa.h:297
#define STEP_KIND
Definition napa.h:313
EXTERN long Num_Generators
Definition napa.h:816
#define UNKNOWN_KIND
Definition napa.h:224
#define CHG_KIND
Definition napa.h:242
#define MAYBE
Definition napa.h:405
#define MAXSEGMENTS
Definition napa.h:201
#define BWAND_KIND
Definition napa.h:234
#define DAC_KIND
Definition napa.h:250
#define TRIG_KIND
Definition napa.h:320
#define COS_KIND
Definition napa.h:248
#define NOISE_KIND
Definition napa.h:290
EXTERN long Num_Declare_Commons
Definition napa.h:806
#define DIGITAL_DATA_TYPE
Definition napa.h:337
#define MAXDIRS
Definition napa.h:194
#define CELL_KIND
Definition napa.h:241
EXTERN UPDATE_TYPE Update_List[2047L]
Definition napa.h:968
#define MAXSTUCKS
Definition napa.h:211
void print_error_banner_and_exit(void)
Definition pr.c:5482
char * get_token(char *str, char *tok, long keep_quotes)
Definition tk.c:1210