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

Go to the source code of this file.

Macros

#define EXTERN   extern

Functions

void build_cross_reference (void)

Macro Definition Documentation

◆ EXTERN

#define EXTERN   extern

Definition at line 5 of file xr.c.

Function Documentation

◆ build_cross_reference()

void build_cross_reference ( void )

Definition at line 20 of file xr.c.

20 {
21 char ch;
22 long d, i, n, v;
23 long len1, len2;
24 char buf[LINLENGTH] = {'\0'};
25
26 if (!List_Flag) { /* Only for cross reference */
27 return;
28 }
29
30 (void) fprintf(STDERR, "\nNAPA List:\n");
31 (void) fprintf(STDERR, " Nodes, variables ... are listed as requested.\n");
32 (void) fprintf(STDERR, " No C file has been created.\n\n\n");
33
34 (void) fprintf(STDERR, "\n\n**********************************");
35 (void) fprintf(STDERR, "%s", multiple('*', 76L));
36 (void) fprintf(STDERR, " START *********\n");
37
38 (void) fprintf(STDOUT, "/* ******** CROSS REFERENCE for %s *", Main_File_Name);
39 (void) fprintf(STDOUT, "%s", multiple('*', 79L - LENGTH(Main_File_Name)));
40 (void) fprintf(STDOUT, " START ****** */\n");
41
42 /* Files */
43 if (25L < Num_FileCells) {
44 ch = 'A';
45 } else {
46 ch = ' ';
47 }
48 (void) f2printf(STDERR, STDOUT, "\nList of Files\n");
49 for (i = 0L; i < Num_FileCells; i++) {
50 (void) snprintf(buf, (size_t) (LINLENGTH-1L), "\"%s\"", Record_Cell_File_Table[i]);
51 (void) f2printf(STDERR, STDOUT, " %c%c. -> %s\n", ch + (char) (i/26L), 'A' + (char) (i%26L), buf);
52 }
53 (void) fprintf(STDERR, "\n%s\n\n", multiple('*', 126L));
54 (void) fprintf(STDOUT, "\n%s\n", multiple('*', 130L));
55
56 /* Headers */
57 (void) f2printf(STDERR, STDOUT, "\nList of Headers\n");
58 qsort((void*) Header_List, (size_t) Num_Headers, sizeof (Header_List[0]), sort_names);
59 for (i = 0L; i < Num_Headers; i++) {
60 (void) f2printf(STDERR, STDOUT, " ");
61 for (d = 0L; d <= Max_Depth; d++) {
62 if (0UL != Header_List[i].mline[d]) {
63 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Header_List[i].mfile[d] / 26UL),
64 'A' + (char) (Header_List[i].mfile[d] % 26UL), Header_List[i].mline[d]);
65 } else {
66 (void) f2printf(STDERR, STDOUT, " ");
67 }
68 }
69 (void) f2printf(STDERR, STDOUT, " <- \"%s\"\n", Header_List[i].fname);
70 }
71
72 /* Command line */
73 if (Cmdline_Flag) {
74 (void) f2printf(STDERR, STDOUT, "\nList of Command Line Parameters\n");
75 if (0L == Num_Cmdlines) {
76 for (d = 0L; d <= Max_Depth; d++) {
77 if (0UL != Cmdline_List[i].mline[d]) {
78 (void) f2printf(STDERR, STDOUT, " %c%c.%-4u ", ch + (char) (Cmdline_List[i].mfile[d] / 26UL),
79 'A' + (char) (Cmdline_List[i].mfile[d] % 26UL), Cmdline_List[i].mline[d]);
80 } else {
81 (void) f2printf(STDERR, STDOUT, " ");
82 }
83 }
84 (void) f2printf(STDERR, STDOUT, " <- [ no parameter ]\n");
85 } else {
86 for (i = 0L; i < Num_Cmdlines; i++) {
87 for (d = 0L; d <= Max_Depth; d++) {
88 if (0UL != Cmdline_List[i].mline[d]) {
89 (void) f2printf(STDERR, STDOUT, " %c%c.%-4u ", ch + (char) (Cmdline_List[i].mfile[d] / 26UL),
90 'A' + (char) (Cmdline_List[i].mfile[d] % 26UL), Cmdline_List[i].mline[d]);
91 } else {
92 (void) f2printf(STDERR, STDOUT, " ");
93 }
94 }
95 if (ISEMPTY(Cmdline_List[i].parms)) {
96 (void) f2printf(STDERR, STDOUT, " <- [ no parameter ]\n");
97 } else {
98 (void) f2printf(STDERR, STDOUT, " <- %s\n", Cmdline_List[i].parms);
99 }
100 }
101 }
102 }
103
104 /* Sampling */
105 (void) f2printf(STDERR, STDOUT, "\nSampling Information\n");
106 (void) f2printf(STDERR, STDOUT, " ");
107 for (d = 0L; d <= Max_Depth; d++) {
108 if (0UL != Sampling_List.mline[d]) {
109 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Sampling_List.mfile[d] / 26UL),
110 'A' + (char) (Sampling_List.mfile[d] % 26UL), Sampling_List.mline[d]);
111 } else {
112 if (0L == d) {
113 (void) f2printf(STDERR, STDOUT, " [NA] ");
114 } else {
115 (void) f2printf(STDERR, STDOUT, " ");
116 }
117 }
118 }
119 if (Periodic_Flag) {
120 if (Fs_Flag) {
121 (void) f2printf(STDERR, STDOUT, " <- [ main sampling frequency ]\n");
122 } else {
123 (void) f2printf(STDERR, STDOUT, " <- [ main sampling period ]\n");
124 }
125 } else {
126 (void) f2printf(STDERR, STDOUT, " <- [ main sampling rate ]\n");
127 }
128 for (i = 0L; i < Num_Segments; i++) { /* no sort here as order is important */
129 for (d = 0L; d <= Max_Depth; d++) {
130 if (MAIN_SEGMENT_TYPE == Segment_List[i].type) {
131 continue;
132 }
133 if (0UL != Segment_List[i].mline[d]) {
134 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Segment_List[i].mfile[d] / 26UL),
135 'A' + (char) (Segment_List[i].mfile[d] % 26UL), Segment_List[i].mline[d]);
136 } else {
137 (void) f2printf(STDERR, STDOUT, " ");
138 }
139 }
140 if (NOMINAL_SEGMENT_TYPE == Segment_List[i].type) {
141 (void) f2printf(STDERR, STDOUT, " <- [ nominal ]\n");
142 }
143 if (DECIMATE_SEGMENT_TYPE == Segment_List[i].type) {
144 (void) f2printf(STDERR, STDOUT, " <- [ decimate ]\n");
145 }
146 if (INTERPOLATE_SEGMENT_TYPE == Segment_List[i].type) {
147 (void) f2printf(STDERR, STDOUT, " <- [ interpolate ]\n");
148 }
149 if (DROP_SEGMENT_TYPE == Segment_List[i].type) {
150 (void) f2printf(STDERR, STDOUT, " <- [ drop ]\n");
151 }
152 (void) f2printf(STDERR, STDOUT, " ");
153 }
154
155 /* Interlude */
156 if (Interlude_Flag1) {
157 (void) f2printf(STDERR, STDOUT, "\nInterlude\n");
158 (void) f2printf(STDERR, STDOUT, " ");
159 for (d = 0L; d <= Max_Depth; d++) {
160 if (0UL != Interlude_List.mline[d]) {
161 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Interlude_List.mfile[d] / 26L),
162 'A' + (char) (Interlude_List.mfile[d] % 26L), Interlude_List.mline[d]);
163 } else {
164 (void) f2printf(STDERR, STDOUT, " ");
165 }
166 }
167 (void) f2printf(STDERR, STDOUT, " <- [ Interlude ]\n");
168 }
169
170 /* Random Seed */
171 if (Seed_Flag) {
172 (void) f2printf(STDERR, STDOUT, "\nRandom Seed\n");
173 (void) f2printf(STDERR, STDOUT, " ");
174 for (d = 0L; d <= Max_Depth; d++) {
175 if (0UL != Seed_List.mline[d]) {
176 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Seed_List.mfile[d] / 26L),
177 'A' + (char) (Seed_List.mfile[d] % 26L), Seed_List.mline[d]);
178 } else {
179 (void) f2printf(STDERR, STDOUT, " ");
180 }
181 }
182 (void) f2printf(STDERR, STDOUT, " <- [ seed ]\n");
183 }
184
185 /* Directives */
186 if (1L <= Num_Directives) {
187 (void) f2printf(STDERR, STDOUT, "\nList of Directives\n");
188 qsort((void*) Directive_List, (size_t) Num_Directives, sizeof (Directive_List[0]), sort_names);
189 for (i = 0L; i < Num_Directives; i++) {
190 (void) f2printf(STDERR, STDOUT, " ");
191 for (d = 0L; d <= Max_Depth; d++) {
192 if (0UL != Directive_List[i].mline[d]) {
193 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Directive_List[i].mfile[d] / 26L),
194 'A' + (char) (Directive_List[i].mfile[d] % 26L), Directive_List[i].mline[d]);
195 } else {
196 (void) f2printf(STDERR, STDOUT, " ");
197 }
198 }
199 (void) f2printf(STDERR, STDOUT, " <- %s\n", Directive_List[i].name);
200 }
201 }
202
203 /* Aliases */
204 if (1L <= Num_Aliases) {
205 (void) f2printf(STDERR, STDOUT, "\nList of Aliases\n");
206 qsort((void*) Alias_List, (size_t) Num_Aliases, sizeof (Alias_List[0]), sort_names);
207 for (i = 0L; i < Num_Aliases; i++) {
208 (void) f2printf(STDERR, STDOUT, " ");
209 for (d = 0L; d <= Max_Depth; d++) {
210 if (0UL != Alias_List[i].mline[d]) {
211 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Alias_List[i].mfile[d] / 26L),
212 'A' + (char) (Alias_List[i].mfile[d] % 26L), Alias_List[i].mline[d]);
213 } else {
214 (void) f2printf(STDERR, STDOUT, " ");
215 }
216 }
217 (void) f2printf(STDERR, STDOUT, " <- %s\n", Alias_List[i].name);
218 }
219 }
220
221 /* Nodes */
222 (void) f2printf(STDERR, STDOUT, "\nList of Nodes\n");
223 qsort((void*) Node_List, (size_t) Num_Nodes, sizeof (Node_List[0]), sort_names);
224 len1 = 16L;
225 for (i = 0L; i < Num_Nodes; i++) {
226 if (Node_List[i].aliased) {
227 len1 = MAX(LENGTH(Node_List[i].name2), len1);
228 }
229 }
230 for (i = 0L; i < Num_Nodes; i++) {
231 if ('_' == Node_List[i].name2[0]) {
232 continue; /* drop void nodes */
233 }
234 (void) f2printf(STDERR, STDOUT, " ");
235 for (d = 0L; d <= Max_Depth; d++) {
236 if (0UL != Node_List[i].mline[d]) {
237 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Node_List[i].mfile[d] / 26L),
238 'A' + (char) (Node_List[i].mfile[d] % 26L), Node_List[i].mline[d]);
239 } else {
240 (void) f2printf(STDERR, STDOUT, " ");
241 }
242 }
243 if (Node_List[i].aliased) {
244 len2 = len1 - LENGTH(Node_List[i].name2) + 3L;
245 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Node_List[i].name2, len2, " ", Node_List[i].name1);
246 } else {
247 (void) f2printf(STDERR, STDOUT, " <- %s\n", Node_List[i].name2);
248 }
249 }
250 for (i = 0L; i < Num_Nodes; i++) {
251 if ('_' != Node_List[i].name2[0]) {
252 continue; /* drop non void nodes */
253 }
254 (void) f2printf(STDERR, STDOUT, " ");
255 for (d = 0; d <= Max_Depth; d++) {
256 if (0UL != Node_List[i].mline[d]) {
257 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Node_List[i].mfile[d] / 26L),
258 'A' + (char) (Node_List[i].mfile[d] % 26L), Node_List[i].mline[d]);
259 } else {
260 (void) f2printf(STDERR, STDOUT, " ");
261 }
262 }
263 (void) f2printf(STDERR, STDOUT, " <- void\n");
264 }
265
266
267 /* Opcodes */
268 if (1L <= Num_Opcodes) {
269 (void) f2printf(STDERR, STDOUT, "\nList of Opcodes\n");
270 qsort((void*) Opcode_List, (size_t) Num_Opcodes, sizeof (Opcode_List[0]), sort_names);
271 for (i = 0L; i < Num_Opcodes; i++) {
272 (void) f2printf(STDERR, STDOUT, " ");
273 for (d = 0L; d <= Max_Depth; d++) {
274 if (0UL != Opcode_List[i].mline[d]) {
275 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Opcode_List[i].mfile[d] / 26L),
276 'A' + (char) (Opcode_List[i].mfile[d] % 26L), Opcode_List[i].mline[d]);
277 } else {
278 (void) f2printf(STDERR, STDOUT, " ");
279 }
280 }
281 (void) f2printf(STDERR, STDOUT, " <- %s %ld\n", Opcode_List[i].name, Opcode_List[i].code);
282 }
283 }
284
285 /* Variables */
286 if (1L <= Num_Vars) {
287 (void) f2printf(STDERR, STDOUT, "\nList of Variables\n");
288 qsort((void*) Var_List, (size_t) Num_Vars, sizeof (Var_List[0]), sort_names);
289 len1 = 16L;
290 for (i = 0L; i < Num_Vars; i++) {
291 if (Var_List[i].aliased) {
292 len1 = MAX(LENGTH(Var_List[i].name2), len1);
293 }
294 }
295 for (i = 0L; i < Num_Vars; i++) {
296 if ('$' == Var_List[i].name2[0]) {
297 continue; /* drop special variables: $...$ */
298 }
299 (void) f2printf(STDERR, STDOUT, " ");
300 for (d = 0L; d <= Max_Depth; d++) {
301 if (0UL != Var_List[i].mline[d]) {
302 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Var_List[i].mfile[d] / 26L),
303 'A' + (char) (Var_List[i].mfile[d] % 26L), Var_List[i].mline[d]);
304 } else {
305 (void) f2printf(STDERR, STDOUT, " ");
306 }
307 }
308 if (Var_List[i].aliased) {
309 len2 = len1 - LENGTH(Var_List[i].name2) + 3L;
310 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Var_List[i].name2, len2, " ", Var_List[i].name1);
311 } else {
312 (void) f2printf(STDERR, STDOUT, " <- %s\n", Var_List[i].name2);
313 }
314 }
315 for (i = 0L; i < Num_Vars; i++) {
316 if ((0 != strncmp(Var_List[i].name2, "$init$", (size_t) 6)) && (0 != strncmp(Var_List[i].name2, "$declare$", (size_t) 9))) {
317 continue; /* drop non init variable */
318 }
319 (void) f2printf(STDERR, STDOUT, " ");
320 for (d = 0L; d <= Max_Depth; d++) {
321 if (0UL != Var_List[i].mline[d]) {
322 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Var_List[i].mfile[d] / 26L),
323 'A' + (char) (Var_List[i].mfile[d] % 26L), Var_List[i].mline[d]);
324 } else {
325 (void) f2printf(STDERR, STDOUT, " ");
326 }
327 }
328 if (0 == strncmp(Var_List[i].name2, "$init$", (size_t) 6)) {
329 (void) f2printf(STDERR, STDOUT, " <- [ init ]\n");
330 continue;
331 }
332 if (0 == strncmp(Var_List[i].name2, "$declare$", (size_t) 9)) {
333 (void) f2printf(STDERR, STDOUT, " <- [ declare ]\n");
334 continue;
335 }
336 }
337 }
338
339 /* Updates */
340 if (1L <= Num_Updates) {
341 (void) f2printf(STDERR, STDOUT, "\nList of Updates\n");
342 qsort((void*) Update_List, (size_t) Num_Updates, sizeof (Update_List[0]), sort_names);
343 for (i = 0L; i < Num_Updates; i++) {
344 if ((0 != strncmp(Update_List[i].name, "$call$", (size_t) 6))
345 && (0 != strncmp(Update_List[i].name, "$restart$", (size_t) 9))
346 && (0 != strncmp(Update_List[i].name, "$assert$", (size_t) 8))) {
347 continue; /* drop non call, assert or restart */
348 }
349 (void) f2printf(STDERR, STDOUT, " ");
350 for (d = 0L; d <= Max_Depth; d++) {
351 if (0UL != Update_List[i].mline[d]) {
352 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Update_List[i].mfile[d] / 26L),
353 'A' + (char) (Update_List[i].mfile[d] % 26L), Update_List[i].mline[d]);
354 } else {
355 (void) f2printf(STDERR, STDOUT, " ");
356 }
357 }
358 if (0 == strncmp(Update_List[i].name, "$call$", (size_t) 6)) {
359 (void) f2printf(STDERR, STDOUT, " <- [ call ]\n");
360 continue;
361 }
362 if (0 == strncmp(Update_List[i].name, "$restart$", (size_t) 9)) {
363 (void) f2printf(STDERR, STDOUT, " <- [ restart ]\n");
364 continue;
365 }
366 if (0 == strncmp(Update_List[i].name, "$assert$", (size_t) 8)) {
367 (void) f2printf(STDERR, STDOUT, " <- [ assert ]\n");
368 continue;
369 }
370 }
371 len1 = 16L;
372 for (i = 0L; i < Num_Updates; i++) {
373 if ('$' == Update_List[i].name[0]) {
374 continue; /* drop special: $assert$, $call$, $restart$ */
375 }
376 v = var_id(Update_List[i].name);
377 if (Var_List[v].aliased) {
378 len1 = MAX(LENGTH(Update_List[i].name), len1);
379 }
380 }
381 for (i = 0L; i < Num_Updates; i++) {
382 if ('$' == Update_List[i].name[0]) {
383 continue; /* drop special: $assert$, $call$, $restart$ */
384 }
385 (void) f2printf(STDERR, STDOUT, " ");
386 for (d = 0L; d <= Max_Depth; d++) {
387 if (0UL != Update_List[i].mline[d]) {
388 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Update_List[i].mfile[d] / 26L),
389 'A' + (char) (Update_List[i].mfile[d] % 26L), Update_List[i].mline[d]);
390 } else {
391 (void) f2printf(STDERR, STDOUT, " ");
392 }
393 }
394 v = var_id(Update_List[i].name);
395 if ((Var_List[v].aliased) && (0 != strcmp(Update_List[i].name, Var_List[v].name1))) {
396 len2 = len1 - LENGTH(Update_List[i].name) + 3L;
397 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Update_List[i].name, len2, " ", Var_List[v].name1);
398 } else {
399 (void) f2printf(STDERR, STDOUT, " <- %s\n", Update_List[i].name);
400 }
401 }
402 }
403
404 /* Arrays */
405 if (1L <= Num_Arrays) {
406 (void) f2printf(STDERR, STDOUT, "\nList of Arrays\n");
407 qsort((void*) Array_List, (size_t) Num_Arrays, sizeof (Array_List[0]), sort_names);
408 for (i = 0L; i < Num_Arrays; i++) {
409 (void) f2printf(STDERR, STDOUT, " ");
410 for (d = 0L; d <= Max_Depth; d++) {
411 if (0UL != Array_List[i].mline[d]) {
412 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Array_List[i].mfile[d] / 26L),
413 'A' + (char) (Array_List[i].mfile[d] % 26L), Array_List[i].mline[d]);
414 } else {
415 (void) f2printf(STDERR, STDOUT, " ");
416 }
417 }
418 (void) f2printf(STDERR, STDOUT, " <- %s\n", Array_List[i].name);
419 }
420 }
421
422 /* Records */
423 if (1L <= Num_Records) {
424 (void) f2printf(STDERR, STDOUT, "\nList of Records\n");
425 qsort((void*) Record_List, (size_t) Num_Records, sizeof (Record_List[0]), sort_names);
426 for (i = 0L; i < Num_Records; i++) {
427 (void) f2printf(STDERR, STDOUT, " ");
428 for (d = 0L; d <= Max_Depth; d++) {
429 if (0UL != Record_List[i].mline[d]) {
430 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Record_List[i].mfile[d] / 26L),
431 'A' + (char) (Record_List[i].mfile[d] % 26L), Record_List[i].mline[d]);
432 } else {
433 (void) f2printf(STDERR, STDOUT, " ");
434 }
435 }
436 (void) f2printf(STDERR, STDOUT, " <- %s[]\n", Record_List[i].name); /* no size as it is not yet computed */
437 }
438 }
439
440 /* Declarations */
441 if (1L <= Num_Declares) {
442 (void) f2printf(STDERR, STDOUT, "\nList of Declarations\n");
443 qsort((void*) Declare_List, (size_t) Num_Declares, sizeof (Declare_List[0]), sort_names);
444 len1 = 16L;
445 for (i = 0L; i < Num_Declares; i++) {
446 n = node_id(Declare_List[i].name);
447 if (UNDEFINED != n) {
448 if (Node_List[n].aliased) {
449 len1 = MAX(LENGTH(Declare_List[i].name), len1);
450 }
451 continue;
452 }
453 v = var_id(Declare_List[i].name);
454 if (UNDEFINED != v) {
455 if (Var_List[v].aliased) {
456 len1 = MAX(LENGTH(Declare_List[i].name), len1);
457 }
458 continue;
459 }
460 }
461 for (i = 0L; i < Num_Declares; i++) {
462 (void) f2printf(STDERR, STDOUT, " ");
463 for (d = 0L; d <= Max_Depth; d++) {
464 if (0UL != Declare_List[i].mline[d]) {
465 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Declare_List[i].mfile[d] / 26L),
466 'A' + (char) (Declare_List[i].mfile[d] % 26L), Declare_List[i].mline[d]);
467 } else {
468 (void) f2printf(STDERR, STDOUT, " ");
469 }
470 }
471 n = node_id(Declare_List[i].name);
472 if (UNDEFINED != n) { /* node declaration */
473 if ((Node_List[n].aliased) && (0 != strcmp(Declare_List[i].name, Node_List[n].name1))) {
474 len2 = len1 - LENGTH(Declare_List[i].name) + 3L;
475 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Declare_List[i].name, len2, " ", Node_List[n].name1);
476 } else {
477 (void) f2printf(STDERR, STDOUT, " <- %s\n", Declare_List[i].name);
478 }
479 continue;
480 }
481 v = var_id(Declare_List[i].name);
482 if (UNDEFINED != v) { /* var declaration */
483 if ((Var_List[v].aliased) && (0 != strcmp(Declare_List[i].name, Var_List[v].name1))) {
484 len2 = len1 - LENGTH(Declare_List[i].name) + 3L;
485 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Declare_List[i].name, len2, " ", Var_List[v].name1);
486 } else {
487 (void) f2printf(STDERR, STDOUT, " <- %s\n", Declare_List[i].name);
488 }
489 continue;
490 }
491 (void) f2printf(STDERR, STDOUT, " <- %s\n", Declare_List[i].name);
492 }
493 }
494
495 /* Inject lines */
496 if (1L <= Num_Injects) {
497 (void) f2printf(STDERR, STDOUT, "\nList of Injects\n");
498 qsort((void*) Inject_List, (size_t) Num_Injects, sizeof (Inject_List[0]), sort_names);
499 len1 = 16L;
500 for (i = 0L; i < Num_Injects; i++) {
501 n = node_id(Inject_List[i].name);
502 if (Node_List[n].aliased) {
503 len1 = MAX(LENGTH(Inject_List[i].name), len1);
504 }
505 }
506 for (i = 0L; i < Num_Injects; i++) {
507 (void) f2printf(STDERR, STDOUT, " ");
508 for (d = 0L; d <= Max_Depth; d++) {
509 if (0UL != Inject_List[i].mline[d]) {
510 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Inject_List[i].mfile[d] / 26L),
511 'A' + (char) (Inject_List[i].mfile[d] % 26L), Inject_List[i].mline[d]);
512 } else {
513 (void) f2printf(STDERR, STDOUT, " ");
514 }
515 }
516 n = node_id(Inject_List[i].name);
517 if ((Node_List[n].aliased) && (0 != strcmp(Inject_List[i].name, Node_List[n].name1))) {
518 len2 = len1 - LENGTH(Inject_List[i].name) + 3L;
519 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Inject_List[i].name, len2, " ", Node_List[n].name1);
520 } else {
521 (void) f2printf(STDERR, STDOUT, " <- %s\n", Inject_List[i].name);
522 }
523 }
524 }
525
526 /* Stuck lines */
527 if (1L <= Num_Stucks) {
528 (void) f2printf(STDERR, STDOUT, "\nList of Stucks\n");
529 qsort((void*) Stuck_List, (size_t) Num_Stucks, sizeof (Stuck_List[0]), sort_names);
530 len1 = 16L;
531 for (i = 0L; i < Num_Stucks; i++) {
532 n = node_id(Stuck_List[i].name);
533 if (Node_List[n].aliased) {
534 len1 = MAX(LENGTH(Stuck_List[i].name), len1);
535 }
536 }
537 for (i = 0L; i < Num_Stucks; i++) {
538 (void) f2printf(STDERR, STDOUT, " ");
539 for (d = 0L; d <= Max_Depth; d++) {
540 if (0UL != Stuck_List[i].mline[d]) {
541 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Stuck_List[i].mfile[d] / 26L),
542 'A' + (char) (Stuck_List[i].mfile[d] % 26L), Stuck_List[i].mline[d]);
543 } else {
544 (void) f2printf(STDERR, STDOUT, " ");
545 }
546 }
547 n = node_id(Stuck_List[i].name);
548 if ((Node_List[n].aliased) && (0 != strcmp(Stuck_List[i].name, Node_List[n].name1))) {
549 len2 = len1 - LENGTH(Stuck_List[i].name) + 3L;
550 (void) f2printf(STDERR, STDOUT, " <- %s %*s [ aka %s ]\n", Stuck_List[i].name, len2, " ", Node_List[n].name1);
551 } else {
552 (void) f2printf(STDERR, STDOUT, " <- %s\n", Stuck_List[i].name);
553 }
554 }
555 }
556
557 /* IO lines */
558 if (1L <= Num_IOs) {
559 (void) f2printf(STDERR, STDOUT, "\nList of IO's\n");
560 for (i = 0L; i < Num_IOs; i++) {
561 (void) f2printf(STDERR, STDOUT, " ");
562 for (d = 0L; d <= Max_Depth; d++) {
563 if (0UL != IO_List[i].mline[d]) {
564 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (IO_List[i].mfile[d] / 26L),
565 'A' + (char) (IO_List[i].mfile[d] % 26L), IO_List[i].mline[d]);
566 } else {
567 (void) f2printf(STDERR, STDOUT, " ");
568 }
569 }
570 if (OUTPUT_TYPE == IO_List[i].type) {
571 (void) f2printf(STDERR, STDOUT, " <- [ output ]\n");
572 }
573 if (INPUT_TYPE == IO_List[i].type) {
574 (void) f2printf(STDERR, STDOUT, " <- [ input ]\n");
575 }
576 }
577 }
578
579 /* Debug lines */
580 if (1L <= Num_Debugs) {
581 (void) f2printf(STDERR, STDOUT, "\nList of Debug Directives\n");
582 for (i = 0L; i < Num_Debugs; i++) {
583 (void) f2printf(STDERR, STDOUT, " ");
584 for (d = 0L; d <= Max_Depth; d++) {
585 if (0UL != Debug_List[i].mline[d]) {
586 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Debug_List[i].mfile[d] / 26L),
587 'A' + (char) (Debug_List[i].mfile[d] % 26L), Debug_List[i].mline[d]);
588 } else {
589 (void) f2printf(STDERR, STDOUT, " ");
590 }
591 }
592 len1 = f2printf(STDERR, STDOUT, " <- %s", Debug_List[i].name);
593 if (1L < Debug_List[i].usage) {
594 (void) f2printf(STDERR, STDOUT, "%*s[ %ld definitions in source ]\n", MAX(2, 15-len1), " ", Debug_List[i].usage);
595 } else {
596 (void) f2printf(STDERR, STDOUT, "\n");
597 }
598 }
599 }
600
601 /* Dump lines */
602 if (Dump_Flag) {
603 (void) f2printf(STDERR, STDOUT, "\nDump\n");
604 (void) f2printf(STDERR, STDOUT, " ");
605 for (d = 0L; d <= Max_Depth; d++) {
606 if (0UL != Dump_List.mline[d]) {
607 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Dump_List.mfile[d] / 26L),
608 'A' + (char) (Dump_List.mfile[d] % 26UL), Dump_List.mline[d]);
609 } else {
610 (void) f2printf(STDERR, STDOUT, " ");
611 }
612 }
613 (void) f2printf(STDERR, STDOUT, " <- [ dump ]\n");
614 }
615
616 /* Load lines */
617 if (Load_Flag) {
618 (void) f2printf(STDERR, STDOUT, "\nLoad\n");
619 (void) f2printf(STDERR, STDOUT, " ");
620 for (d = 0L; d <= Max_Depth; d++) {
621 if (0UL != Load_List.mline[d]) {
622 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Load_List.mfile[d] / 26L),
623 'A' + (char) (Load_List.mfile[d] % 26UL), Load_List.mline[d]);
624 } else {
625 (void) f2printf(STDERR, STDOUT, " ");
626 }
627 }
628 (void) f2printf(STDERR, STDOUT, " <- [ load ]\n");
629 }
630
631 /* Terminate */
632 (void) f2printf(STDERR, STDOUT, "\nTerminate\n");
633 (void) f2printf(STDERR, STDOUT, " ");
634 for (d = 0L; d <= Max_Depth; d++) {
635 if (0UL != Terminate_List.mline[d]) {
636 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Terminate_List.mfile[d] / 26L),
637 'A' + (char) (Terminate_List.mfile[d] % 26UL), Terminate_List.mline[d]);
638 } else {
639 (void) f2printf(STDERR, STDOUT, " ");
640 }
641 }
642 (void) f2printf(STDERR, STDOUT, " <- [ terminate ]\n");
643
644/* Ping */
645 if (Ping_Flag) {
646 (void) f2printf(STDERR, STDOUT, "\nPing\n");
647 (void) f2printf(STDERR, STDOUT, " ");
648 for (d = 0L; d <= Max_Depth; d++) {
649 if (0UL != Ping_List.mline[d]) {
650 (void) f2printf(STDERR, STDOUT, "%c%c.%-4u ", ch + (char) (Ping_List.mfile[d] / 26L),
651 'A' + (char) (Ping_List.mfile[d] % 26UL), Ping_List.mline[d]);
652 } else {
653 (void) f2printf(STDERR, STDOUT, " ");
654 }
655 }
656 (void) f2printf(STDERR, STDOUT, " <- [ ping ]\n");
657 }
658
659 (void) f2printf(STDERR, STDOUT, "\n");
660
661 (void) fprintf(STDERR, "**********************************");
662 (void) fprintf(STDERR, "%s", multiple('*', 78L));
663 (void) fprintf(STDERR, " END *********\n\n\n");
664
665 (void) fprintf(STDOUT, "******** CROSS REFERENCE for %s *", Main_File_Name);
666 (void) fprintf(STDOUT, "%s", multiple('*', 83L - LENGTH(Main_File_Name)));
667 (void) fprintf(STDOUT, "* END ****** */\n");
668 exit(EXIT_SUCCESS); /* End of the program after cross reference */
669
670}
long f2printf(FILE *fp1, FILE *fp2, char *fmt,...)
Definition fc.c:157
long node_id(const char *identifier)
Definition id.c:718
long var_id(const char *identifier)
Definition id.c:855
int sort_names(const void *a, const void *b)
Definition id.c:572
EXTERN long Num_Injects
Definition napa.h:820
#define DECIMATE_SEGMENT_TYPE
Definition napa.h:351
#define DROP_SEGMENT_TYPE
Definition napa.h:353
EXTERN long Num_Aliases
Definition napa.h:799
EXTERN RANDOMSEED_TYPE Seed_List
Definition napa.h:979
EXTERN VAR_TYPE Var_List[2047L]
Definition napa.h:970
EXTERN RECORD_TYPE Record_List[127L]
Definition napa.h:965
EXTERN long Num_Debugs
Definition napa.h:809
EXTERN long Num_Vars
Definition napa.h:836
EXTERN ARRAY_TYPE Array_List[63L]
Definition napa.h:950
#define LENGTH(s)
Definition napa.h:397
EXTERN DECLARE_TYPE Declare_List[1023L]
Definition napa.h:953
EXTERN int Load_Flag
Definition napa.h:865
#define UNDEFINED
Definition napa.h:331
EXTERN long Num_Records
Definition napa.h:828
EXTERN long Num_Updates
Definition napa.h:834
EXTERN long Num_Arrays
Definition napa.h:800
#define STDERR
Definition napa.h:105
EXTERN NODE_TYPE Node_List[4095L]
Definition napa.h:962
EXTERN long Max_Depth
Definition napa.h:797
EXTERN int Dump_Flag
Definition napa.h:852
EXTERN int Fs_Flag
Definition napa.h:856
#define INPUT_TYPE
Definition napa.h:358
EXTERN SAMPLING_TYPE Sampling_List
Definition napa.h:978
EXTERN long Num_Headers
Definition napa.h:818
EXTERN char * Record_Cell_File_Table[511L]
Definition napa.h:940
EXTERN ALIAS_TYPE Alias_List[127L]
Definition napa.h:949
EXTERN DIRECTIVE_TYPE Directive_List[255L]
Definition napa.h:955
EXTERN DEBUG_TYPE Debug_List[63L]
Definition napa.h:952
EXTERN HEADER_TYPE Header_List[63L]
Definition napa.h:959
EXTERN long Num_Declares
Definition napa.h:810
#define INTERPOLATE_SEGMENT_TYPE
Definition napa.h:352
EXTERN int Cmdline_Flag
Definition napa.h:846
#define LINLENGTH
Definition napa.h:216
EXTERN long Num_Nodes
Definition napa.h:824
EXTERN INJECT_TYPE Inject_List[63L]
Definition napa.h:960
EXTERN LOAD_TYPE Load_List
Definition napa.h:975
EXTERN PING_TYPE Ping_List
Definition napa.h:977
EXTERN INTERLUDE_TYPE Interlude_List
Definition napa.h:974
EXTERN long Num_Directives
Definition napa.h:812
#define STDOUT
Definition napa.h:104
EXTERN int Interlude_Flag1
Definition napa.h:868
EXTERN OPCODE_TYPE Opcode_List[127L]
Definition napa.h:963
EXTERN long Num_FileCells
Definition napa.h:814
#define NOMINAL_SEGMENT_TYPE
Definition napa.h:350
EXTERN int List_Flag
Definition napa.h:864
EXTERN long Num_IOs
Definition napa.h:822
EXTERN long Num_Segments
Definition napa.h:831
#define MAX(x, y)
Definition napa.h:377
EXTERN CMDLINE_TYPE Cmdline_List[63L]
Definition napa.h:951
EXTERN long Num_Cmdlines
Definition napa.h:804
#define MAIN_SEGMENT_TYPE
Definition napa.h:349
EXTERN TERMINATE_TYPE Terminate_List
Definition napa.h:980
EXTERN SEGMENT_TYPE Segment_List[127L]
Definition napa.h:966
EXTERN char * Main_File_Name
Definition napa.h:911
EXTERN long Num_Opcodes
Definition napa.h:826
EXTERN long Num_Stucks
Definition napa.h:832
#define ISEMPTY(s)
Definition napa.h:394
EXTERN int Seed_Flag
Definition napa.h:877
EXTERN int Ping_Flag
Definition napa.h:874
EXTERN STUCK_TYPE Stuck_List[63L]
Definition napa.h:967
EXTERN DUMP_TYPE Dump_List
Definition napa.h:972
#define OUTPUT_TYPE
Definition napa.h:359
EXTERN IO_TYPE IO_List[63L]
Definition napa.h:961
EXTERN UPDATE_TYPE Update_List[2047L]
Definition napa.h:968
EXTERN int Periodic_Flag
Definition napa.h:873
char * multiple(char c, long n)
Definition tk.c:1801

References Alias_List, Array_List, Cmdline_Flag, Cmdline_List, Debug_List, DECIMATE_SEGMENT_TYPE, Declare_List, Directive_List, DROP_SEGMENT_TYPE, Dump_Flag, Dump_List, f2printf(), Fs_Flag, Header_List, Inject_List, INPUT_TYPE, Interlude_Flag1, Interlude_List, INTERPOLATE_SEGMENT_TYPE, IO_List, ISEMPTY, LENGTH, LINLENGTH, List_Flag, Load_Flag, Load_List, Main_File_Name, MAIN_SEGMENT_TYPE, MAX, Max_Depth, multiple(), node_id(), Node_List, NOMINAL_SEGMENT_TYPE, Num_Aliases, Num_Arrays, Num_Cmdlines, Num_Debugs, Num_Declares, Num_Directives, Num_FileCells, Num_Headers, Num_Injects, Num_IOs, Num_Nodes, Num_Opcodes, Num_Records, Num_Segments, Num_Stucks, Num_Updates, Num_Vars, Opcode_List, OUTPUT_TYPE, Periodic_Flag, Ping_Flag, Ping_List, Record_Cell_File_Table, Record_List, Sampling_List, Seed_Flag, Seed_List, Segment_List, sort_names(), STDERR, STDOUT, Stuck_List, Terminate_List, UNDEFINED, Update_List, var_id(), and Var_List.

Referenced by main().