NAPA Compiler V4.50
Author: Yves Leduc, yves.leduc.be@gmail.com
Loading...
Searching...
No Matches
C:/Simulate/Napados/Source/id.c File Reference
#include "./napa.h"
#include "./proto.h"

Go to the source code of this file.

Macros

#define EXTERN   extern
#define IS_IDENTIFIER(x)
#define IS_NAPA_PREFIX()
#define IS_DEBUG_PREFIX()
#define IS_COMPILE_PREFIX()

Functions

void flag_node (long num)
int is_node_flagged (long num)
void strcpy_alloc (char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
void strcpy_realloc (char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
void increment_alias_number (const char *kind)
void increment_array_number (const char *kind)
void increment_assert_number (const char *kind)
void increment_call_number (const char *kind)
void increment_cmdline_number (const char *kind)
void increment_comment_number (const char *kind)
void increment_common_number (const char *kind)
void increment_debug_number (const char *kind)
void increment_declare_number (const char *kind)
void increment_directive_number (const char *kind)
void increment_export_number (const char *kind)
void increment_filecell_number (const char *kind)
void increment_function_number (const char *kind)
void increment_generator_number (const char *kind)
void increment_group_number (const char *kind)
void increment_header_number (const char *kind)
void increment_init_number (const char *kind)
void increment_inject_number (const char *kind)
void increment_instance_number (const char *kind)
void increment_IO_number (const char *kind)
void increment_node_number (const char *kind)
void increment_opcode_number (const char *kind)
void increment_post_number (const char *kind)
void increment_record_number (const char *kind)
void increment_restart_number (const char *kind)
void increment_segment_number (const char *kind)
void increment_stuck_number (const char *kind)
void increment_tool_number (const char *kind)
void increment_update_number (const char *kind)
void increment_usertool_number (const char *kind)
void increment_var_number (const char *kind)
void increment_const_number (void)
void increment_void_number (void)
int sort_names (const void *a, const void *b)
void swap_delay_inputs (long i, long j)
void swap_nodes (long i, long j)
void swap_records (long i, long j)
void swap_vars (long i, long j)
void swap_updates (long i, long j)
long alias_id (const char *identifier)
long array_id (const char *identifier)
long array_name_id (const char *identifier)
long cmdline_id (const char *identifier)
long debug_id (const char *identifier)
long declare_id (const char *identifier)
long directive_id (const char *identifier)
long node_id (const char *identifier)
long op_id (const char *identifier)
long postprocess_id (const char *identifier)
long record_id (const char *identifier)
long update_id (const char *identifier, long num)
long user_id (const char *identifier)
long var_id (const char *identifier)
void mark_updates_if_constant (void)
void mark_constants (void)
int variable_update_block (void)
int node_update_block (void)
int time_output_block (void)
long constant_type (char *identifier)
long get_type (char *identifier)
long usertool_num (const char *nam)
long node_kind (const char *identifier)
int is_a_known_function (const char *identifier)
int is_a_known_pure_function (const char *identifier)
int is_an_instruction (const char *identifier)
int is_a_keyword (const char *identifier)
int is_an_operator (const char *identifier)
int is_a_constant_or_a_macro_constant (const char *identifier)
int is_a_modifier (const char *identifier)

Macro Definition Documentation

◆ EXTERN

#define EXTERN   extern

Definition at line 4 of file id.c.

◆ IS_COMPILE_PREFIX

#define IS_COMPILE_PREFIX ( )
Value:
(0 == strncmp(identifier, "COMPILE_", (size_t) 8))

Definition at line 94 of file id.c.

Referenced by is_a_keyword().

◆ IS_DEBUG_PREFIX

#define IS_DEBUG_PREFIX ( )
Value:
(0 == strncmp(identifier, "DEBUG_", (size_t) 6))

Definition at line 93 of file id.c.

Referenced by is_a_keyword().

◆ IS_IDENTIFIER

◆ IS_NAPA_PREFIX

#define IS_NAPA_PREFIX ( )
Value:
(0 == strncmp(identifier, "napa_", (size_t) 5))

Definition at line 92 of file id.c.

Referenced by is_a_keyword().

Function Documentation

◆ alias_id()

long alias_id ( const char * identifier)

Definition at line 624 of file id.c.

624 { /* 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}
#define IS_IDENTIFIER(x)
Definition id.c:90
EXTERN long Num_Aliases
Definition napa.h:799
#define UNDEFINED
Definition napa.h:331
EXTERN ALIAS_TYPE Alias_List[127L]
Definition napa.h:949

References Alias_List, IS_IDENTIFIER, Num_Aliases, and UNDEFINED.

Referenced by get_alias(), get_array(), get_directive(), get_node(), and get_var().

◆ array_id()

long array_id ( const char * identifier)

Definition at line 635 of file id.c.

635 { /* 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}
EXTERN ARRAY_TYPE Array_List[63L]
Definition napa.h:950
EXTERN long Num_Arrays
Definition napa.h:800

References Array_List, IS_IDENTIFIER, Num_Arrays, and UNDEFINED.

Referenced by build_name(), check_array_usage(), check_syntax(), get_alias(), get_array(), get_debug(), get_directive(), get_node(), get_type(), get_var(), node_determination(), print_ram(), print_rom(), print_usertool(), record_function_identifier(), syntax_nodes(), and syntax_updates().

◆ array_name_id()

long array_name_id ( const char * identifier)

Definition at line 646 of file id.c.

646 { /* 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}

References Array_List, IS_IDENTIFIER, Num_Arrays, and UNDEFINED.

Referenced by check_array_usage().

◆ cmdline_id()

long cmdline_id ( const char * identifier)

Definition at line 657 of file id.c.

657 { /* 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}
long var_id(const char *identifier)
Definition id.c:855
EXTERN VAR_TYPE Var_List[2047L]
Definition napa.h:970
EXTERN int Cmdline_Flag
Definition napa.h:846
EXTERN CMDLINE_TYPE Cmdline_List[63L]
Definition napa.h:951
EXTERN long Num_Cmdlines
Definition napa.h:804
#define STRLENGTH
Definition napa.h:217

References Cmdline_Flag, Cmdline_List, Num_Cmdlines, STRLENGTH, UNDEFINED, var_id(), and Var_List.

Referenced by build_usage_comment(), and get_command_line().

◆ constant_type()

long constant_type ( char * identifier)

Definition at line 1130 of file id.c.

1130 { /* 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}
#define LENGTH(s)
Definition napa.h:397
#define UNKNOWN_TYPE
Definition napa.h:332
#define ANALOG_DATA_TYPE
Definition napa.h:338
#define ISNOTEQUAL(x, y)
Definition napa.h:380
#define STRING_DATA_TYPE
Definition napa.h:339
#define HEX_DATA_TYPE
Definition napa.h:340
#define DIGITAL_DATA_TYPE
Definition napa.h:337

References ANALOG_DATA_TYPE, DIGITAL_DATA_TYPE, HEX_DATA_TYPE, IS_IDENTIFIER, ISNOTEQUAL, LENGTH, STRING_DATA_TYPE, and UNKNOWN_TYPE.

Referenced by build_update(), check_syntax(), declaration_type_A(), declare_a_digital_node(), expand_indirections(), get_data(), get_fs_ts(), get_type(), mark_updates_if_constant(), print_bshift(), print_rlshift(), print_rshift1(), print_rshift2(), process_cell(), purge_constants_in_ganging(), purge_constants_in_options(), reset_a_digital_node(), reset_arrays_function(), and syntax_records().

◆ debug_id()

long debug_id ( const char * identifier)

Definition at line 685 of file id.c.

685 { /* 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}
EXTERN long Num_Debugs
Definition napa.h:809
EXTERN DEBUG_TYPE Debug_List[63L]
Definition napa.h:952

References Debug_List, IS_IDENTIFIER, Num_Debugs, and UNDEFINED.

Referenced by define_macros(), and get_debug().

◆ declare_id()

long declare_id ( const char * identifier)

Definition at line 696 of file id.c.

696 { /* 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}
EXTERN DECLARE_TYPE Declare_List[1023L]
Definition napa.h:953
EXTERN long Num_Declares
Definition napa.h:810

References Declare_List, IS_IDENTIFIER, Num_Declares, and UNDEFINED.

◆ directive_id()

long directive_id ( const char * identifier)

Definition at line 707 of file id.c.

707 { /* 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}
EXTERN DIRECTIVE_TYPE Directive_List[255L]
Definition napa.h:955
EXTERN long Num_Directives
Definition napa.h:812

References Directive_List, IS_IDENTIFIER, Num_Directives, and UNDEFINED.

Referenced by build_main_loop_time(), complete_directives(), define_macros(), dump_function(), expand_indirections(), get_alias(), get_array(), get_debug(), get_directive(), get_function_identifier(), get_node(), get_var(), and mark_directives().

◆ flag_node()

void flag_node ( long num)

Definition at line 99 of file id.c.

99 { /* set to -1 a node flagged in error */
100 Node_List[num].errflag = -1;
101 return;
102}
EXTERN NODE_TYPE Node_List[4095L]
Definition napa.h:962

References Node_List.

Referenced by authorize_option(), check_syntax(), check_types(), redefine_nodes(), something_else(), and syntax_nodes().

◆ get_type()

long get_type ( char * identifier)

Definition at line 1190 of file id.c.

1190 {
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}
long constant_type(char *identifier)
Definition id.c:1130
long array_id(const char *identifier)
Definition id.c:635
long node_id(const char *identifier)
Definition id.c:718

References ANALOG_DATA_TYPE, array_id(), Array_List, constant_type(), DIGITAL_DATA_TYPE, node_id(), Node_List, UNDEFINED, var_id(), and Var_List.

Referenced by build_name(), build_update(), check_types(), collect_export_definitions(), declaration_type_B(), expand_indirections(), get_post(), mark_updates_if_constant(), print_equal(), print_output_banner_2(), print_rect(), reset_arrays_function(), reset_records_function(), and syntax_directives().

◆ increment_alias_number()

void increment_alias_number ( const char * kind)

Definition at line 150 of file id.c.

150 {
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}
void print_limits(void)
Definition fc.c:56
#define STDERR
Definition napa.h:105
#define MAXALIASES
Definition napa.h:197
void print_error_banner_and_exit(void)
Definition pr.c:5482

References MAXALIASES, Num_Aliases, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_alias().

◆ increment_array_number()

void increment_array_number ( const char * kind)

Definition at line 163 of file id.c.

163 {
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}
#define MAXARRAYS
Definition napa.h:202

References MAXARRAYS, Num_Arrays, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_array().

◆ increment_assert_number()

void increment_assert_number ( const char * kind)

Definition at line 176 of file id.c.

176 {
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}
EXTERN long Num_Updates
Definition napa.h:834
EXTERN long Num_Asserts
Definition napa.h:801
#define MAXUPDATES
Definition napa.h:188

References MAXUPDATES, Num_Asserts, Num_Updates, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_assert().

◆ increment_call_number()

void increment_call_number ( const char * kind)

Definition at line 189 of file id.c.

189 {
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}
EXTERN long Num_Calls
Definition napa.h:802

References MAXUPDATES, Num_Calls, Num_Updates, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_call().

◆ increment_cmdline_number()

void increment_cmdline_number ( const char * kind)

Definition at line 202 of file id.c.

202 {
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}
#define MAXCMDLINES
Definition napa.h:207

References MAXCMDLINES, Num_Cmdlines, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_command_line().

◆ increment_comment_number()

void increment_comment_number ( const char * kind)

Definition at line 215 of file id.c.

215 {
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}
#define MAXCOMMENTS
Definition napa.h:203
EXTERN long Num_Comments
Definition napa.h:805

References MAXCOMMENTS, Num_Comments, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_comment().

◆ increment_common_number()

void increment_common_number ( const char * kind)

Definition at line 228 of file id.c.

228 {
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}
#define MAXDECLARECOMMONS
Definition napa.h:193
EXTERN long Num_Declare_Commons
Definition napa.h:806

References MAXDECLARECOMMONS, Num_Declare_Commons, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_declare().

◆ increment_const_number()

void increment_const_number ( void )

Definition at line 558 of file id.c.

558 { /* there is no limit to const numbering */
559 Num_Consts++;
560 return;
561}
EXTERN long Num_Consts
Definition napa.h:807

References Num_Consts.

Referenced by create_constant_var().

◆ increment_debug_number()

void increment_debug_number ( const char * kind)

Definition at line 241 of file id.c.

241 {
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}
#define MAXDEBUGS
Definition napa.h:208

References MAXDEBUGS, Num_Debugs, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_debug().

◆ increment_declare_number()

void increment_declare_number ( const char * kind)

Definition at line 254 of file id.c.

254 {
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}
#define MAXDECLARES
Definition napa.h:189

References MAXDECLARES, Num_Declares, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_declare().

◆ increment_directive_number()

void increment_directive_number ( const char * kind)

Definition at line 267 of file id.c.

267 {
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}
#define MAXDIRS
Definition napa.h:194

References MAXDIRS, Num_Directives, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by complete_directives(), and get_directive().

◆ increment_export_number()

void increment_export_number ( const char * kind)

Definition at line 280 of file id.c.

280 {
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}
#define MAXEXPORTS
Definition napa.h:213
EXTERN long Num_Exports
Definition napa.h:813

References MAXEXPORTS, Num_Exports, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_export().

◆ increment_filecell_number()

void increment_filecell_number ( const char * kind)

Definition at line 293 of file id.c.

293 {
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}
#define MAXFILECELLS
Definition napa.h:191
EXTERN long Num_FileCells
Definition napa.h:814

References MAXFILECELLS, Num_FileCells, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by record_file_nam().

◆ increment_function_number()

void increment_function_number ( const char * kind)

Definition at line 306 of file id.c.

306 {
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}
EXTERN long Num_Functions
Definition napa.h:815
EXTERN int Function_Flag
Definition napa.h:858
#define MAXFUNCTIONS
Definition napa.h:195

References Function_Flag, MAXFUNCTIONS, Num_Functions, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by record_function_identifier().

◆ increment_generator_number()

void increment_generator_number ( const char * kind)

Definition at line 320 of file id.c.

320 {
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}
#define MAXINSTANCES
Definition napa.h:190
EXTERN long Num_Generators
Definition napa.h:816

References MAXINSTANCES, Num_Generators, and STDERR.

Referenced by process_gen().

◆ increment_group_number()

void increment_group_number ( const char * kind)

Definition at line 334 of file id.c.

334 {
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}
EXTERN long Num_Groups
Definition napa.h:817
#define MAXGROUPS
Definition napa.h:214

References MAXGROUPS, Num_Groups, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_post().

◆ increment_header_number()

void increment_header_number ( const char * kind)

Definition at line 347 of file id.c.

347 {
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}
EXTERN long Num_Headers
Definition napa.h:818
#define MAXHEADERS
Definition napa.h:209

References MAXHEADERS, Num_Headers, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_header().

◆ increment_init_number()

void increment_init_number ( const char * kind)

Definition at line 360 of file id.c.

360 {
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}
#define MAXVARS
Definition napa.h:187
EXTERN long Num_Vars
Definition napa.h:836
EXTERN long Num_Inits
Definition napa.h:819

References MAXVARS, Num_Inits, Num_Vars, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_declare(), and get_init().

◆ increment_inject_number()

void increment_inject_number ( const char * kind)

Definition at line 373 of file id.c.

373 {
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}
EXTERN long Num_Injects
Definition napa.h:820
#define MAXINJECTS
Definition napa.h:210

References MAXINJECTS, Num_Injects, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_inject().

◆ increment_instance_number()

void increment_instance_number ( const char * kind)

Definition at line 386 of file id.c.

386 {
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}
EXTERN long Num_Instances
Definition napa.h:821

References MAXINSTANCES, Num_Instances, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by record_cell_nam().

◆ increment_IO_number()

void increment_IO_number ( const char * kind)

Definition at line 399 of file id.c.

399 {
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}
EXTERN long Num_IOs
Definition napa.h:822
#define MAXIOS
Definition napa.h:205

References MAXIOS, Num_Groups, Num_IOs, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_input(), and get_output().

◆ increment_node_number()

void increment_node_number ( const char * kind)

Definition at line 413 of file id.c.

413 {
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}
EXTERN long Num_Nodes
Definition napa.h:824
#define MAXNODES
Definition napa.h:186

References MAXNODES, Num_Groups, Num_Nodes, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by create_automatic_node(), and get_node().

◆ increment_opcode_number()

void increment_opcode_number ( const char * kind)

Definition at line 427 of file id.c.

427 {
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}
#define MAXOPCODES
Definition napa.h:199
EXTERN long Num_Opcodes
Definition napa.h:826

References MAXOPCODES, Num_Opcodes, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_opcode().

◆ increment_post_number()

void increment_post_number ( const char * kind)

Definition at line 440 of file id.c.

440 {
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}
#define MAXPOSTS
Definition napa.h:206
EXTERN long Num_Posts
Definition napa.h:827

References MAXPOSTS, Num_Posts, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_post().

◆ increment_record_number()

void increment_record_number ( const char * kind)

Definition at line 453 of file id.c.

453 {
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}
EXTERN long Num_Records
Definition napa.h:828
#define MAXRECORDS
Definition napa.h:198

References MAXRECORDS, Num_Records, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_array().

◆ increment_restart_number()

void increment_restart_number ( const char * kind)

Definition at line 466 of file id.c.

466 {
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}
EXTERN long Num_Restarts
Definition napa.h:830

References MAXUPDATES, Num_Restarts, Num_Updates, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_restart().

◆ increment_segment_number()

void increment_segment_number ( const char * kind)

Definition at line 479 of file id.c.

479 {
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}
EXTERN long Num_Segments
Definition napa.h:831
#define MAXSEGMENTS
Definition napa.h:201

References MAXSEGMENTS, Num_Segments, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by determine_output_segment_rate(), get_decimate(), get_drop(), get_interpolate(), get_nominal(), and line_parsing().

◆ increment_stuck_number()

void increment_stuck_number ( const char * kind)

Definition at line 492 of file id.c.

492 {
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}
EXTERN long Num_Stucks
Definition napa.h:832
#define MAXSTUCKS
Definition napa.h:211

References MAXSTUCKS, Num_Stucks, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_stuck().

◆ increment_tool_number()

void increment_tool_number ( const char * kind)

Definition at line 505 of file id.c.

505 {
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}
EXTERN long Num_Tools
Definition napa.h:833
#define MAXUSERTOOLS
Definition napa.h:192

References MAXUSERTOOLS, Num_Tools, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by name_mangling().

◆ increment_update_number()

void increment_update_number ( const char * kind)

Definition at line 518 of file id.c.

518 {
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}

References MAXUPDATES, Num_Updates, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by get_assert(), get_call(), get_restart(), and get_update().

◆ increment_usertool_number()

void increment_usertool_number ( const char * kind)

Definition at line 531 of file id.c.

531 {
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}
EXTERN long Num_UserTools
Definition napa.h:835
EXTERN int UserTool_Flag
Definition napa.h:888

References MAXUSERTOOLS, Num_UserTools, print_error_banner_and_exit(), print_limits(), STDERR, and UserTool_Flag.

Referenced by name_mangling().

◆ increment_var_number()

void increment_var_number ( const char * kind)

Definition at line 545 of file id.c.

545 {
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}

References MAXVARS, Num_Vars, print_error_banner_and_exit(), print_limits(), and STDERR.

Referenced by create_constant_var(), get_declare(), get_init(), and get_var().

◆ increment_void_number()

void increment_void_number ( void )

Definition at line 564 of file id.c.

564 { /* there is no limit to void numbering */
565 Num_Voids++;
566 return;
567}
EXTERN long Num_Voids
Definition napa.h:837

References Num_Voids.

Referenced by get_node().

◆ is_a_constant_or_a_macro_constant()

int is_a_constant_or_a_macro_constant ( const char * identifier)

Definition at line 1712 of file id.c.

1712 {
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}

References IS_IDENTIFIER.

Referenced by mark_updates_if_constant().

◆ is_a_keyword()

int is_a_keyword ( const char * identifier)

Definition at line 1527 of file id.c.

1527 {
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}
#define IS_DEBUG_PREFIX()
Definition id.c:93
#define IS_NAPA_PREFIX()
Definition id.c:92
#define IS_COMPILE_PREFIX()
Definition id.c:94
int is_an_instruction(const char *identifier)
Definition id.c:1468
int is_a_known_function(const char *identifier)
Definition id.c:1346
long node_kind(const char *identifier)
Definition id.c:1236
#define WARNING
Definition napa.h:409
#define ERROR
Definition napa.h:410
#define UNKNOWN_KIND
Definition napa.h:224

References ERROR, is_a_known_function(), is_an_instruction(), IS_COMPILE_PREFIX, IS_DEBUG_PREFIX, IS_IDENTIFIER, IS_NAPA_PREFIX, node_kind(), UNKNOWN_KIND, and WARNING.

Referenced by get_alias(), get_directive(), get_node(), and get_var().

◆ is_a_known_function()

int is_a_known_function ( const char * identifier)

Definition at line 1346 of file id.c.

1346 {
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}
int is_a_known_pure_function(const char *identifier)
Definition id.c:1368

References is_a_known_pure_function(), and IS_IDENTIFIER.

Referenced by is_a_keyword(), and record_function_identifier().

◆ is_a_known_pure_function()

int is_a_known_pure_function ( const char * identifier)

Definition at line 1368 of file id.c.

1368 {
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}

References IS_IDENTIFIER.

Referenced by is_a_known_function(), and mark_updates_if_constant().

◆ is_a_modifier()

int is_a_modifier ( const char * identifier)

Definition at line 1767 of file id.c.

1767 {
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}

References IS_IDENTIFIER.

Referenced by mark_updates_if_constant().

◆ is_an_instruction()

int is_an_instruction ( const char * identifier)

Definition at line 1468 of file id.c.

1468 {
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}

References IS_IDENTIFIER.

Referenced by get_debug(), and is_a_keyword().

◆ is_an_operator()

int is_an_operator ( const char * identifier)

Definition at line 1681 of file id.c.

1681 {
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}

References IS_IDENTIFIER.

Referenced by mark_updates_if_constant().

◆ is_node_flagged()

int is_node_flagged ( long num)

Definition at line 105 of file id.c.

105 { /* node flagged in error is set to -1 */
106 return (int) (-1 >= Node_List[num].errflag);
107}

References Node_List.

Referenced by authorize_option(), check_syntax(), something_else(), and syntax_nodes().

◆ mark_constants()

void mark_constants ( void )

Definition at line 1064 of file id.c.

1064 {
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}
EXTERN UPDATE_TYPE Update_List[2047L]
Definition napa.h:968

References Num_Updates, UNDEFINED, Update_List, var_id(), and Var_List.

Referenced by main().

◆ mark_updates_if_constant()

void mark_updates_if_constant ( void )

Definition at line 919 of file id.c.

919 {
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}
int is_an_operator(const char *identifier)
Definition id.c:1681
long get_type(char *identifier)
Definition id.c:1190
int is_a_modifier(const char *identifier)
Definition id.c:1767
int is_a_constant_or_a_macro_constant(const char *identifier)
Definition id.c:1712
long update_id(const char *identifier, long num)
Definition id.c:807
#define CONST_KIND
Definition napa.h:246
#define LINLENGTH
Definition napa.h:216
#define DC_KIND
Definition napa.h:252
EXTERN SEGMENT_TYPE Segment_List[127L]
Definition napa.h:966
#define ISEMPTY(s)
Definition napa.h:394
#define MAYBE
Definition napa.h:405
char * get_token(char *str, char *tok, long keep_quotes)
Definition tk.c:1210

References CONST_KIND, constant_type(), DC_KIND, get_token(), get_type(), is_a_constant_or_a_macro_constant(), is_a_known_pure_function(), is_a_modifier(), is_an_operator(), ISEMPTY, LINLENGTH, MAYBE, node_id(), Node_List, Num_Updates, Segment_List, STRING_DATA_TYPE, UNDEFINED, UNKNOWN_TYPE, update_id(), Update_List, var_id(), and Var_List.

Referenced by main().

◆ node_id()

long node_id ( const char * identifier)

Definition at line 718 of file id.c.

718 { /* 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}
void print_error_location(const char *type, const unsigned long *mlin, const unsigned long *mfil)
Definition fc.c:1476
EXTERN RECORD_TYPE Record_List[127L]
Definition napa.h:965
EXTERN int Tool_Index_Flag
Definition napa.h:882
#define ISNOTEMPTY(s)
Definition napa.h:395

References get_token(), IS_IDENTIFIER, ISNOTEMPTY, LINLENGTH, node_id(), Node_List, Num_Nodes, Num_Records, print_error_location(), Record_List, STDERR, STRLENGTH, Tool_Index_Flag, and UNDEFINED.

Referenced by build_cross_reference(), build_input(), build_main_loop_inject(), build_name(), build_node_dependencies(), build_output(), build_to_be_delayed_node_list(), build_update(), call_user_functions(), check_syntax(), check_types(), collect_export_definitions(), create_automatic_node(), declaration_type_A(), declaration_type_B(), declare_a_digital_node(), declare_an_analog_node(), declare_vars(), determine_output_segment_rate(), dump_function(), get_alias(), get_array(), get_debug(), get_directive(), get_node(), get_type(), get_update(), get_var(), inject_nodes(), mark_updates_if_constant(), node_determination(), node_id(), open_IO_files(), open_ping_file(), print_algebra(), print_bshift(), print_C_code_banner_b(), print_change(), print_delay(), print_delay1(), print_delay2(), print_delay3(), print_holdtrack(), print_merge(), print_poly(), print_ram(), print_relay(), print_rip(), print_rlshift(), print_rom(), print_rshift1(), print_rshift2(), print_sign(), print_test(), print_trig(), print_usertool(), print_zero(), process_aliases(), process_condition(), process_init(), record_function_identifier(), redefine_node_segments(), reset_a_dc_node(), reset_a_digital_node(), reset_an_analog_node(), reset_user_variables(), stuck_nodes(), syntax_directives(), syntax_nodes(), and syntax_records().

◆ node_kind()

long node_kind ( const char * identifier)

Definition at line 1236 of file id.c.

1236 {
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}
#define MUX_KIND
Definition napa.h:288
#define EQUAL_KIND
Definition napa.h:262
#define ITOD_KIND
Definition napa.h:278
#define MOD_KIND
Definition napa.h:286
#define RIP_KIND
Definition napa.h:302
#define MULLER_KIND
Definition napa.h:287
#define WSUM_KIND
Definition napa.h:323
#define TRACK_KIND
Definition napa.h:318
#define RSHIFT2_KIND
Definition napa.h:307
#define AND_KIND
Definition napa.h:229
#define ROM2_KIND
Definition napa.h:304
#define TRIANGLE_KIND
Definition napa.h:319
#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
#define INV_KIND
Definition napa.h:276
#define BWNAND_KIND
Definition napa.h:236
#define DTOI_KIND
Definition napa.h:259
#define FZNOR_KIND
Definition napa.h:267
#define OSC_KIND
Definition napa.h:294
#define CLOCK_KIND
Definition napa.h:244
#define NOR_KIND
Definition napa.h:291
#define ADC_KIND
Definition napa.h:226
#define COPY_KIND
Definition napa.h:247
#define OFFSET_KIND
Definition napa.h:292
#define OR_KIND
Definition napa.h:293
#define CLIP_KIND
Definition napa.h:243
#define RELAY_KIND
Definition napa.h:301
#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
#define AVERAGE_KIND
Definition napa.h:230
#define PROD_KIND
Definition napa.h:296
#define DUSER_KIND
Definition napa.h:261
#define TEST_KIND
Definition napa.h:316
#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 RAM_KIND
Definition napa.h:298
#define SIN_KIND
Definition napa.h:310
#define TOGGLE_KIND
Definition napa.h:317
#define XNOR_KIND
Definition napa.h:324
#define BWXNOR_KIND
Definition napa.h:239
#define DALGEBRA_KIND
Definition napa.h:251
#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
#define SIGN_KIND
Definition napa.h:309
#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
#define BWXOR_KIND
Definition napa.h:240
#define BTOI_KIND
Definition napa.h:232
#define FZNAND_KIND
Definition napa.h:266
#define ITOOL_KIND
Definition napa.h:279
#define DTOOL_KIND
Definition napa.h:260
#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
#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
#define UDAC_KIND
Definition napa.h:322
#define ZERO_KIND
Definition napa.h:326
#define INTEGRATOR_KIND
Definition napa.h:275
#define MAX_KIND
Definition napa.h:283
#define GEN_KIND
Definition napa.h:272
#define BWNOR_KIND
Definition napa.h:237
#define COMP_KIND
Definition napa.h:245
#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 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
#define CHG_KIND
Definition napa.h:242
#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
#define CELL_KIND
Definition napa.h:241

References ADC_KIND, ALGEBRA_KIND, ALU_KIND, AND_KIND, AVERAGE_KIND, BSHIFT_KIND, BTOI_KIND, BUF_KIND, BWAND_KIND, BWINV_KIND, BWNAND_KIND, BWNOR_KIND, BWOR_KIND, BWXNOR_KIND, BWXOR_KIND, CELL_KIND, CHG_KIND, CLIP_KIND, CLOCK_KIND, COMP_KIND, CONST_KIND, COPY_KIND, COS_KIND, DAC_KIND, DALGEBRA_KIND, DC_KIND, DELAY_KIND, DIFFERENTIATOR_KIND, DIV_KIND, DTOI_KIND, DTOOL_KIND, DUSER_KIND, EQUAL_KIND, FZAND_KIND, FZBUF_KIND, FZINV_KIND, FZNAND_KIND, FZNOR_KIND, FZOR_KIND, FZXNOR_KIND, FZXOR_KIND, GAIN_KIND, GEN_KIND, HOLD_KIND, IALGEBRA_KIND, INTEGRATOR_KIND, INV_KIND, IS_IDENTIFIER, ITOB_KIND, ITOD_KIND, ITOOL_KIND, IUSER_KIND, LATCH_KIND, LSHIFT_KIND, MAX_KIND, MERGE_KIND, MIN_KIND, MOD_KIND, MULLER_KIND, MUX_KIND, NAND_KIND, NOISE_KIND, NOR_KIND, OFFSET_KIND, OR_KIND, OSC_KIND, POLY_KIND, PROD_KIND, QUANT_KIND, RAM2_KIND, RAM_KIND, RECT_KIND, RELAY_KIND, RIP_KIND, ROM2_KIND, ROM_KIND, RSHIFT1_KIND, RSHIFT2_KIND, RSHIFT_KIND, SIGN_KIND, SIN_KIND, SQUARE_KIND, STEP_KIND, SUB_KIND, SUM_KIND, TEST_KIND, TOGGLE_KIND, TRACK_KIND, TRIANGLE_KIND, TRIG_KIND, UADC_KIND, UDAC_KIND, UNKNOWN_KIND, WSUM_KIND, XNOR_KIND, XOR_KIND, and ZERO_KIND.

Referenced by get_node(), and is_a_keyword().

◆ node_update_block()

int node_update_block ( void )

Definition at line 1100 of file id.c.

1100 {
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}

References Num_Segments, and Segment_List.

Referenced by build_main_loop_block2(), and print_C_code_banner_a().

◆ op_id()

long op_id ( const char * identifier)

Definition at line 774 of file id.c.

774 { /* 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}
EXTERN OPCODE_TYPE Opcode_List[127L]
Definition napa.h:963

References IS_IDENTIFIER, Num_Opcodes, Opcode_List, and UNDEFINED.

Referenced by check_syntax().

◆ postprocess_id()

long postprocess_id ( const char * identifier)

Definition at line 785 of file id.c.

785 { /* 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}
EXTERN POST_TYPE Post_List[63L]
Definition napa.h:964

References IS_IDENTIFIER, Num_Posts, Post_List, and UNDEFINED.

◆ record_id()

long record_id ( const char * identifier)

Definition at line 796 of file id.c.

796 { /* 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}

References IS_IDENTIFIER, Num_Records, Record_List, and UNDEFINED.

Referenced by build_name(), build_node_dependencies(), build_record_dependencies(), call_user_functions(), check_record_usage(), expand_records(), get_alias(), get_array(), get_debug(), get_directive(), get_node(), get_var(), print_usertool(), syntax_nodes(), syntax_records(), syntax_updates(), and syntax_variables().

◆ sort_names()

int sort_names ( const void * a,
const void * b )

Definition at line 572 of file id.c.

572 { /* function 'sort_names(...) used by 'qsort' */
573 int num;
574 num = strcmp(*(char**) a, *(char**) b);
575 return num;
576}

Referenced by build_cross_reference(), define_directives(), and print_ping_function().

◆ strcpy_alloc()

void strcpy_alloc ( char ** dest,
const char * sour,
const unsigned long * mlin,
const unsigned long * mfil )

◆ strcpy_realloc()

void strcpy_realloc ( char ** dest,
const char * sour,
const unsigned long * mlin,
const unsigned long * mfil )

Definition at line 129 of file id.c.

129 {
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}

References LENGTH, print_error_banner_and_exit(), print_error_location(), and STDERR.

Referenced by build_usage_comment(), declare_vars(), determine_output_segment_rate(), expand_records(), expand_string_variables(), expand_update_definitions(), get_header(), get_post(), process_aliases(), process_command_line(), process_init(), purge_constants_in_ganging(), purge_constants_in_options(), redefine_node_segments(), redefine_nodes(), separe_qualifiers(), and stuck_nodes().

◆ swap_delay_inputs()

void swap_delay_inputs ( long i,
long j )

Definition at line 581 of file id.c.

581 {
582 long k;
583 k = Delay_Input[j];
584 Delay_Input[j] = Delay_Input[i];
585 Delay_Input[i] = k;
586 return;
587}
EXTERN long Delay_Input[4095L]
Definition napa.h:984

References Delay_Input.

Referenced by sort_nodes().

◆ swap_nodes()

void swap_nodes ( long i,
long j )

Definition at line 590 of file id.c.

590 { /* use last location as storage for node swapping */
592 Node_List[i] = Node_List[j];
594 return;
595}

References Node_List, and Num_Nodes.

Referenced by node_determination(), and sort_nodes().

◆ swap_records()

void swap_records ( long i,
long j )

Definition at line 598 of file id.c.

598 { /* use last location as storage for array swap */
600 Record_List[i] = Record_List[j];
602 return;
603}

References Num_Records, and Record_List.

Referenced by sort_records().

◆ swap_updates()

void swap_updates ( long i,
long j )

Definition at line 614 of file id.c.

614 { /* use last location as storage for var swapping */
616 Update_List[i] = Update_List[j];
618 return;
619}

References Num_Updates, and Update_List.

Referenced by sort_updates().

◆ swap_vars()

void swap_vars ( long i,
long j )

Definition at line 606 of file id.c.

606 { /* use last location as storage for var swapping */
608 Var_List[i] = Var_List[j];
610 return;
611}

References Num_Vars, and Var_List.

Referenced by sort_vars().

◆ time_output_block()

int time_output_block ( void )

Definition at line 1114 of file id.c.

1114 {
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}

References Num_Segments, and Segment_List.

Referenced by build_main_loop_block3(), and print_C_code_banner_a().

◆ update_id()

long update_id ( const char * identifier,
long num )

Definition at line 807 of file id.c.

807 { /* 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}

References IS_IDENTIFIER, Num_Updates, STRLENGTH, Tool_Index_Flag, UNDEFINED, Update_List, var_id(), and Var_List.

Referenced by build_update_dependencies(), declaration_type_A(), determine_output_segment_rate(), mark_updates_if_constant(), reset_a_digital_node(), reset_an_analog_node(), reset_arrays_function(), reset_user_variables(), and syntax_command_line().

◆ user_id()

long user_id ( const char * identifier)

Definition at line 844 of file id.c.

844 { /* 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}
EXTERN USERTOOL_TYPE UserTool_List[511L]
Definition napa.h:969

References IS_IDENTIFIER, Num_UserTools, UNDEFINED, and UserTool_List.

Referenced by print_usertool().

◆ usertool_num()

long usertool_num ( const char * nam)

Definition at line 1224 of file id.c.

1224 { /* 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}

References Num_UserTools, and UserTool_List.

Referenced by name_mangling().

◆ var_id()

long var_id ( const char * identifier)

Definition at line 855 of file id.c.

855 { /* 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}

References get_token(), IS_IDENTIFIER, ISNOTEMPTY, LINLENGTH, Num_Records, Num_Vars, print_error_location(), Record_List, STDERR, STRLENGTH, Tool_Index_Flag, UNDEFINED, var_id(), and Var_List.

Referenced by build_condition(), build_cross_reference(), build_input(), build_main_loop_inject(), build_name(), build_output(), build_update(), build_usage_comment(), build_var_dependencies(), call_user_functions(), check_record_usage(), check_syntax(), close_IO_files(), cmdline_id(), collect_export_definitions(), collect_functions(), command_line_usage_function(), create_automatic_node(), declaration_type_A(), declaration_type_B(), declare_a_digital_node(), declare_an_analog_node(), dump_function(), expand_indirections(), expand_update_definitions(), get_alias(), get_array(), get_data(), get_debug(), get_decimate(), get_directive(), get_dump(), get_interpolate(), get_load(), get_node(), get_ping(), get_post(), get_type(), get_var(), inject_nodes(), mark_constants(), mark_directives(), mark_updates_if_constant(), node_determination(), open_IO_files(), open_ping_file(), print_algebra(), print_C_code_banner_b(), print_delay(), print_output_banner_2(), print_ram(), print_rom(), print_test(), print_usertool(), process_aliases(), process_cell(), process_condition(), process_gen(), record_function_identifier(), redefine_nodes(), reset_a_command_line_parameter(), reset_a_dc_node(), reset_a_digital_node(), reset_an_analog_node(), reset_arrays_function(), reset_user_variables(), stuck_nodes(), syntax_command_line(), syntax_directives(), syntax_records(), syntax_updates(), update_id(), and var_id().

◆ variable_update_block()

int variable_update_block ( void )

Definition at line 1083 of file id.c.

1083 {
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}
EXTERN int Inject_Flag
Definition napa.h:861

References Inject_Flag, Num_Segments, and Segment_List.

Referenced by build_main_loop_block1(), and print_C_code_banner_a().