Changeset 074444f in mainline for uspace/app/sbi/src/main.c
- Timestamp:
- 2010-04-10T11:15:33Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1ef0fc3, 38aaacc2
- Parents:
- 23de644
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/main.c
r23de644 r074444f 37 37 #include <stdlib.h> 38 38 #include "ancr.h" 39 #include "os/os.h" 39 40 #include "builtin.h" 40 41 #include "imode.h" 41 42 #include "mytypes.h" 43 #include "program.h" 42 44 #include "strtab.h" 43 45 #include "stree.h" … … 48 50 #include "run.h" 49 51 50 void syntax_print(void);52 static void syntax_print(void); 51 53 52 54 /** Main entry point. … … 56 58 int main(int argc, char *argv[]) 57 59 { 58 input_t *input;59 lex_t lex;60 parse_t parse;61 60 stree_program_t *program; 62 61 stype_t stype; … … 64 63 int rc; 65 64 66 if (argc == 1) { 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) { 67 72 /* Enter interactive mode */ 68 73 strtab_init(); … … 71 76 } 72 77 73 if ( argc != 2) {78 if (os_str_cmp(*argv, "-h") == 0) { 74 79 syntax_print(); 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); 80 return 0; 82 81 } 83 82 … … 89 88 builtin_declare(program); 90 89 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) 90 /* Process source files in the library. */ 91 if (program_lib_process(program) != EOK) 98 92 return 1; 99 93 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 100 104 /* Resolve ancestry. */ 101 ancr_module_process(program, p arse.cur_mod);105 ancr_module_process(program, program->module); 102 106 103 107 /* Type program. */ … … 122 126 123 127 /** Print command-line syntax help. */ 124 void syntax_print(void)128 static void syntax_print(void) 125 129 { 126 printf("Missing or invalid arguments.\n");127 130 printf("Syntax: sbi <source_file.sy>\n"); 128 131 }
Note:
See TracChangeset
for help on using the changeset viewer.