Code rewiev 1
This commit is contained in:
parent
359f88fb79
commit
66da645093
@ -1,7 +1,7 @@
|
||||
#if (!defined(NTSYS__S_ASSEMBLER_H___))
|
||||
#define NTSYS__S_ASSEMBLER_H___
|
||||
|
||||
#define create_ntsys_asm_parser(cache, str, table) ((ntsys_argument_parser_t){(cache), (str), (table)})
|
||||
#define create_ntsys_asm_parser(cache, str, fp, table) ((ntsys_argument_parser_t){(cache), (fp), (str), (table)})
|
||||
#define create_ntsys_asm_save(ss) ((ntsys_asm_save_t){(ss), (ss)})
|
||||
#define create_ntsys_asm_cache(ss) ((ntsys_asm_cache_t)&(ss))
|
||||
#define ntsys_asm_arg_new(str, __cache) ((ntsys_get_arg((__cache))) && ((str) = __cache->string))
|
||||
@ -128,12 +128,16 @@ char* ntsys_get_arg(ntsys_asm_cache_t save) {
|
||||
|
||||
typedef struct {
|
||||
ntsys_asm_cache_t cache;
|
||||
FILE* fp;
|
||||
char* string;
|
||||
char** table;
|
||||
} ntsys_argument_parser_t;
|
||||
|
||||
int ntsys_run_asm_parser(ntsys_argument_parser_t parser) {
|
||||
ntsys_asm_arg_new(parser.string, parser.cache);
|
||||
char* str = parser.string;
|
||||
while (ntsys_asm_arg_new(str, parser.cache)) {
|
||||
puts(str);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ char* ntsys_asm_table[] = {
|
||||
int ntsys_asm_from_string(size_t* mempos, char* str, FILE* fp) {
|
||||
ntsys_asm_save_t __save = create_ntsys_asm_save(str);
|
||||
ntsys_asm_cache_t __cache = create_ntsys_asm_cache(__save);
|
||||
ntsys_argument_parser_t __parser = create_ntsys_asm_parser(__cache, str, ntsys_asm_table);
|
||||
ntsys_argument_parser_t __parser = create_ntsys_asm_parser(__cache, str, fp, ntsys_asm_table);
|
||||
return ntsys_run_asm_parser(__parser);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user