Changes in uspace/app/sbi/src/main.c [074444f:23de644] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/main.c
r074444f r23de644 37 37 #include <stdlib.h> 38 38 #include "ancr.h" 39 #include "os/os.h"40 39 #include "builtin.h" 41 40 #include "imode.h" 42 41 #include "mytypes.h" 43 #include "program.h"44 42 #include "strtab.h" 45 43 #include "stree.h" … … 50 48 #include "run.h" 51 49 52 staticvoid syntax_print(void);50 void syntax_print(void); 53 51 54 52 /** Main entry point. … … 58 56 int main(int argc, char *argv[]) 59 57 { 58 input_t *input; 59 lex_t lex; 60 parse_t parse; 60 61 stree_program_t *program; 61 62 stype_t stype; … … 63 64 int rc; 64 65 65 /* Store executable file path under which we have been invoked. */ 66 os_store_ef_path(*argv); 67 68 argv += 1; 69 argc -= 1; 70 71 if (argc == 0) { 66 if (argc == 1) { 72 67 /* Enter interactive mode */ 73 68 strtab_init(); … … 76 71 } 77 72 78 if ( os_str_cmp(*argv, "-h") == 0) {73 if (argc != 2) { 79 74 syntax_print(); 80 return 0; 75 exit(1); 76 } 77 78 rc = input_new_file(&input, argv[1]); 79 if (rc != EOK) { 80 printf("Failed opening source file '%s'.\n", argv[1]); 81 exit(1); 81 82 } 82 83 … … 88 89 builtin_declare(program); 89 90 90 /* Process source files in the library. */ 91 if (program_lib_process(program) != EOK) 91 /* Parse input file. */ 92 lex_init(&lex, input); 93 parse_init(&parse, program, &lex); 94 parse_module(&parse); 95 96 /* Check for parse errors. */ 97 if (parse.error) 92 98 return 1; 93 99 94 /* Process all source files specified in command-line arguments. */95 while (argc > 0) {96 rc = program_file_process(program, *argv);97 if (rc != EOK)98 return 1;99 100 argv += 1;101 argc -= 1;102 }103 104 100 /* Resolve ancestry. */ 105 ancr_module_process(program, p rogram->module);101 ancr_module_process(program, parse.cur_mod); 106 102 107 103 /* Type program. */ … … 126 122 127 123 /** Print command-line syntax help. */ 128 staticvoid syntax_print(void)124 void syntax_print(void) 129 125 { 126 printf("Missing or invalid arguments.\n"); 130 127 printf("Syntax: sbi <source_file.sy>\n"); 131 128 }
Note:
See TracChangeset
for help on using the changeset viewer.