#include <ctype.h>
#include <stdbool.h>
+#include <string.h>
#include <stdio.h>
char choice[256];
int main(int argc, char** argv) {
FILE* out = stdout;
bool load = false;
+ bool def = false;
+
+ int stack_size = 1024;
+
if(argv[1] != NULL) {
out = fopen(argv[1], "w");
if(out != NULL) {
fprintf(stderr, "%s: %s: couldn't open the file\n", argv[0], argv[1]);
return 1;
}
+ if(argv[2] != NULL && strcmp(argv[2], "default") == 0){
+ def = true;
+ }
}
fprintf(out, "/* Autogenerated config */\n");
+ if(def){
+ int n;
+ for(n = 0; asks[n * 4] != NULL; n++){
+ fprintf(out, "#%s %s\n", asks[n * 4 + 1][0] == 'y' ? "define" : "undef", asks[n * 4 + 2]);
+ }
+ fprintf(out, "#define PARSER_STACK_SIZE %d\n", stack_size);
+ fprintf(out, "#define SUPPORT \"");
+ for(n = 0; asks[n * 4] != NULL; n++) {
+ if(n > 0) fprintf(out, " ");
+ fprintf(out, "%c%s", asks[n * 4 + 1][0] == 'y' ? '+' : '-', asks[n * 4]);
+ }
+ fprintf(out, "\"\n");
+ return 0;
+ }
char c;
char oldc;
bool nl = false;
nl = true;
}
}
- int stack_size = 1024;
fprintf(stderr, "[recommended: 1024] Parser stack size? ");
fflush(stderr);
scanf("%d", &stack_size);