FreeCalypso > hg > freecalypso-sw
annotate rvinterf/ctracedec/readtab.c @ 986:65418b391513
tfc139: -m option restores bogus mot931c.exe-mimicking operation
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 12 Dec 2015 03:48:19 +0000 |
parents | 4c6e7ada647b |
children |
rev | line source |
---|---|
858
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This module handles the reading and parsing of str2ind.tab |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <stdio.h> |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <ctype.h> |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <string.h> |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <strings.h> |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <stdlib.h> |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 extern char *str2ind_tab_filename; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 int str2ind_array_size; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 char **str2ind_orig_strings; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 char **str2ind_param_strings; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 static FILE *readF; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 static char linebuf[256]; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 static int lineno; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 static void |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 read_line() |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 char *cp; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 if (!fgets(linebuf, sizeof linebuf, readF)) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 fprintf(stderr, "error: premature EOF reading from %s\n", |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 str2ind_tab_filename); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 lineno++; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 cp = index(linebuf, '\n'); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 if (!cp) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 fprintf(stderr, |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 "error: %s line %d is too long or unterminated\n", |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 str2ind_tab_filename, lineno); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 *cp = '\0'; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 if (cp > linebuf && cp[-1] == '\r') |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 cp[-1] = '\0'; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 static void |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 line_pure_num() |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 char *cp; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 for (cp = linebuf; isspace(*cp); cp++) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 ; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 if (!isdigit(*cp)) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 inv: fprintf(stderr, "%s line %d: pure number expected\n", |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 str2ind_tab_filename, lineno); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 while (isdigit(*cp)) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 cp++; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 if (*cp) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 goto inv; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 static char * |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 copystr(str) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 char *str; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 static char null = '\0'; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 char *buf; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 if (str[0]) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 buf = malloc(strlen(str) + 1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 if (!buf) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 perror("malloc"); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 strcpy(buf, str); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 return(buf); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 } else |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 return(&null); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 static void |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 process_record_line(idx) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 char *cp, *cp2; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 int i; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 for (cp = linebuf; isspace(*cp); cp++) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 ; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 if (!isdigit(*cp)) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 syntaxerr: fprintf(stderr, "%s line %d: unexpected syntax\n", |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 str2ind_tab_filename, lineno); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 while (isdigit(*cp)) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 cp++; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 if (*cp++ != ',') |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 goto syntaxerr; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 i = atoi(linebuf); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 if (i != idx) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 fprintf(stderr, "%s line %d lists wrong index (expected %d)\n", |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 str2ind_tab_filename, lineno, idx); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 cp2 = index(cp, ','); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 if (!cp2) |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 goto syntaxerr; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 *cp2++ = '\0'; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 str2ind_param_strings[idx] = copystr(cp); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 str2ind_orig_strings[idx] = copystr(cp2); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 read_str2ind_tab() |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 int idx; |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 readF = fopen(str2ind_tab_filename, "r"); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 if (!readF) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 perror(str2ind_tab_filename); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 /* skip the timestamp line: the user is responsible for matching */ |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 read_line(); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 line_pure_num(); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 /* read the line with the array size */ |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 read_line(); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 line_pure_num(); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 str2ind_array_size = atoi(linebuf); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 if (str2ind_array_size < 1) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 fprintf(stderr, "error: %s gives index array size < 1\n", |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 str2ind_tab_filename); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 str2ind_orig_strings = malloc(sizeof(char *) * str2ind_array_size); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 str2ind_param_strings = malloc(sizeof(char *) * str2ind_array_size); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 if (!str2ind_orig_strings || !str2ind_param_strings) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 perror("malloc"); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 exit(1); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 for (idx = 0; idx < str2ind_array_size; idx++) { |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 read_line(); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 process_record_line(idx); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 } |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 fclose(readF); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 return(0); |
4c6e7ada647b
compressed trace decoder almost fully implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 } |