int main (int argc, char **argv) { int i; int utf8 = 0; for (i = 1; i < argc; i++) { char *arg = argv[i]; if (*arg != '-') break; if (0 == strcmp (arg, "-utf8")) { utf8 = 1; continue; } i = argc; } if (i >= argc) { fprintf (stderr, "Usage: %s [-utf8] FILE...\n", argv[0]); return 1; } (void) SLutf8_enable (utf8); if ((-1 == SLang_init_all ()) || (-1 == SLang_init_array_extra ()) || (-1 == SLadd_intrin_fun_table (Intrinsics, NULL)) || (-1 == add_test_classes ())) return 1; SLang_Traceback = 1; if (-1 == SLang_set_argc_argv (argc, argv)) return 1; #ifdef HAVE_FPSETMASK # ifndef FP_X_OFL # define FP_X_OFL 0 # endif # ifndef FP_X_INV # define FP_X_INV 0 # endif # ifndef FP_X_DZ # define FP_X_DZ 0 # endif # ifndef FP_X_DNML # define FP_X_DNML 0 # endif # ifndef FP_X_UFL # define FP_X_UFL 0 # endif # ifndef FP_X_IMP # define FP_X_IMP 0 # endif fpsetmask (~(FP_X_OFL|FP_X_INV|FP_X_DZ|FP_X_DNML|FP_X_UFL|FP_X_IMP)); #endif if (i + 1 < argc) Ignore_Exit = 1; while (i < argc) { char *file = argv[i]; if (0 == strncmp (SLpath_extname (file), ".slc", 4)) { char *file_sl = SLmake_string (file); file_sl[strlen(file_sl)-1] = 0; if (-1 == SLang_byte_compile_file (file_sl, 0)) { SLfree (file_sl); return 1; } SLfree (file_sl); } if (-1 == SLang_load_file (file)) return 1; i++; } return SLang_get_error (); }
static void byte_compile_file (char *f, int *m) { SLang_byte_compile_file (f, *m); }