comparison lwbasic/main.c @ 25:87590f43e76d

Started lwbasic parser; checkpoint
author lost@l-w.ca
date Mon, 24 Jan 2011 20:08:09 -0700
parents 7c35fa8dbc91
children bcd532a90e53
comparison
equal deleted inserted replaced
24:421d7ceb4d86 25:87590f43e76d
23 main program startup handling for lwbasic 23 main program startup handling for lwbasic
24 */ 24 */
25 25
26 #include <stdlib.h> 26 #include <stdlib.h>
27 #include <stdio.h> 27 #include <stdio.h>
28 #include <stdarg.h>
28 29
29 #include <lw_cmdline.h> 30 #include <lw_cmdline.h>
30 #include <lw_string.h> 31 #include <lw_string.h>
31 #include <lw_alloc.h> 32 #include <lw_alloc.h>
32 33
34 #define __main_c_seen__
33 #include "lwbasic.h" 35 #include "lwbasic.h"
34 36
35 #define PROGVER "lwbasic from " PACKAGE_STRING 37 #define PROGVER "lwbasic from " PACKAGE_STRING
36 38
37 static struct lw_cmdline_options options[] = 39 static struct lw_cmdline_options options[] =
88 "INPUTFILE", 90 "INPUTFILE",
89 "lwbasic, a compiler for a dialect of Basic\vPlease report bugs to lost@l-w.ca.", 91 "lwbasic, a compiler for a dialect of Basic\vPlease report bugs to lost@l-w.ca.",
90 PROGVER 92 PROGVER
91 }; 93 };
92 94
95 extern void compiler(cstate *state);
96
93 int main(int argc, char **argv) 97 int main(int argc, char **argv)
94 { 98 {
95 cstate state = { 0 }; 99 cstate state = { 0 };
96 100
97 lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, &state); 101 lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, &state);
98 102
103 compiler(&state);
104
99 exit(0); 105 exit(0);
100 } 106 }
107
108 void lwb_error(const char *fmt, ...)
109 {
110 va_list args;
111
112 va_start(args, fmt);
113 vfprintf(stderr, fmt, args);
114 va_end(args);
115
116 exit(1);
117 }