@@ -68,12 +68,12 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
68
68
fprintf (f , "main(int argc, char *argv[])\n" );
69
69
fprintf (f , "{\n" );
70
70
71
- fprintf (f , "\tenum lx_token t;\n" );
72
- fprintf (f , "\tstruct lx lx = { 0 };\n" );
71
+ fprintf (f , "\tenum %stoken t;\n" , prefix . api );
72
+ fprintf (f , "\tstruct %slx lx = { 0 };\n" , prefix . lx );
73
73
74
74
switch (opt -> io ) {
75
75
case FSM_IO_GETC :
76
- fprintf (f , "\tint (*lgetc)(struct lx *lx);\n" );
76
+ fprintf (f , "\tint (*lgetc)(struct %slx *lx);\n" , prefix . lx );
77
77
fprintf (f , "\tvoid *getc_opaque;\n" );
78
78
break ;
79
79
@@ -135,7 +135,7 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
135
135
136
136
switch (api_getc ) {
137
137
case API_FGETC :
138
- fprintf (f , "\tlgetc = lx_fgetc ;\n" );
138
+ fprintf (f , "\tlgetc = %sfgetc ;\n" , prefix . api );
139
139
fprintf (f , "\tgetc_opaque = stdin;\n" );
140
140
fprintf (f , "\n" );
141
141
break ;
@@ -144,7 +144,7 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
144
144
fprintf (f , "\ts = argv[1];\n" );
145
145
fprintf (f , "\n" );
146
146
147
- fprintf (f , "\tlgetc = lx_sgetc ;\n" );
147
+ fprintf (f , "\tlgetc = %ssgetc ;\n" , prefix . api );
148
148
fprintf (f , "\tgetc_opaque = &s;\n" );
149
149
fprintf (f , "\n" );
150
150
break ;
@@ -154,7 +154,7 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
154
154
fprintf (f , "\tarr.len = strlen(arr.p);\n" );
155
155
fprintf (f , "\n" );
156
156
157
- fprintf (f , "\tlgetc = lx_agetc ;\n" );
157
+ fprintf (f , "\tlgetc = %sagetc ;\n" , prefix . api );
158
158
fprintf (f , "\tgetc_opaque = &arr;\n" );
159
159
fprintf (f , "\n" );
160
160
break ;
@@ -167,13 +167,13 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
167
167
fprintf (f , "\td.fd = fileno(stdin);\n" );
168
168
fprintf (f , "\n" );
169
169
170
- fprintf (f , "\tlgetc = lx_dgetc ;\n" );
170
+ fprintf (f , "\tlgetc = %sdgetc ;\n" , prefix . api );
171
171
fprintf (f , "\tgetc_opaque = &d;\n" );
172
172
fprintf (f , "\n" );
173
173
break ;
174
174
}
175
175
176
- fprintf (f , "\tlx_init (&lx);\n" );
176
+ fprintf (f , "\t%sinit (&lx);\n" , prefix . api );
177
177
fprintf (f , "\n" );
178
178
179
179
switch (opt -> io ) {
@@ -203,9 +203,9 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
203
203
204
204
if (~api_exclude & API_BUF ) {
205
205
fprintf (f , "\tlx.buf_opaque = &buf;\n" );
206
- fprintf (f , "\tlx.push = lx_dynpush ;\n" );
207
- fprintf (f , "\tlx.clear = lx_dynclear ;\n" );
208
- fprintf (f , "\tlx.free = lx_dynfree ;\n" );
206
+ fprintf (f , "\tlx.push = %sdynpush ;\n" , prefix . api );
207
+ fprintf (f , "\tlx.clear = %sdynclear ;\n" , prefix . api );
208
+ fprintf (f , "\tlx.free = %sdynfree ;\n" , prefix . api );
209
209
}
210
210
fprintf (f , "\n" );
211
211
break ;
@@ -218,8 +218,8 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
218
218
219
219
if (~api_exclude & API_BUF ) {
220
220
fprintf (f , "\tlx.buf_opaque = &buf;\n" );
221
- fprintf (f , "\tlx.push = lx_fixedpush ;\n" );
222
- fprintf (f , "\tlx.clear = lx_fixedclear ;\n" );
221
+ fprintf (f , "\tlx.push = %sfixedpush ;\n" , prefix . api );
222
+ fprintf (f , "\tlx.clear = %sfixedclear ;\n" , prefix . api );
223
223
fprintf (f , "\tlx.free = NULL;\n" );
224
224
}
225
225
fprintf (f , "\n" );
@@ -231,7 +231,7 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
231
231
fprintf (f , "\t\tconst char *q;\n" );
232
232
fprintf (f , "\n" );
233
233
234
- fprintf (f , "\t\tt = lx_next (&lx);\n" );
234
+ fprintf (f , "\t\tt = %snext (&lx);\n" , prefix . api );
235
235
fprintf (f , "\n" );
236
236
237
237
switch (api_tokbuf ) {
@@ -278,7 +278,7 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
278
278
fprintf (f , "\n" );
279
279
280
280
fprintf (f , "\t\tcase TOK_ERROR:\n" );
281
- fprintf (f , "\t\t\tperror(\"lx_next \");\n" );
281
+ fprintf (f , "\t\t\tperror(\"%snext \");\n" , prefix . api );
282
282
fprintf (f , "\t\t\tbreak;\n" );
283
283
fprintf (f , "\n" );
284
284
@@ -291,7 +291,7 @@ lx_print_dump(FILE *f, const struct ast *ast, const struct fsm_options *opt)
291
291
292
292
fprintf (f , "\t\tdefault:\n" );
293
293
if (~api_exclude & API_NAME ) {
294
- fprintf (f , "\t\t\tprintf(\"<%%s\", lx_name (t));\n" );
294
+ fprintf (f , "\t\t\tprintf(\"<%%s\", %sname (t));\n" , prefix . api );
295
295
fprintf (f , "\t\t\tdump_buf(q, l);\n" );
296
296
fprintf (f , "\t\t\tprintf(\">\\n\");\n" );
297
297
} else {
0 commit comments