diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-11 14:53:48 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-11 14:53:48 -0400 |
| commit | db0d5a1c204fb48afa5e5a53cb3c703590645f8f (patch) | |
| tree | e559f108bb3c198faa3863a32cbfe3402a3f4563 /repl.c | |
| parent | 0b5bb32912cfc68c7783548006fca2dc5874eb93 (diff) | |
Change *:from_text() methods to return optional values and set up CLI
parsing to use that approach
Diffstat (limited to 'repl.c')
| -rw-r--r-- | repl.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -354,11 +354,11 @@ void eval(env_t *env, ast_t *ast, void *dest) case Int: { if (!dest) return; switch (Match(ast, Int)->bits) { - case 0: *(Int_t*)dest = Int$from_text(Text$from_str(Match(ast, Int)->str), NULL); break; - case 64: *(int64_t*)dest = Int64$from_text(Text$from_str(Match(ast, Int)->str), NULL); break; - case 32: *(int32_t*)dest = Int32$from_text(Text$from_str(Match(ast, Int)->str), NULL); break; - case 16: *(int16_t*)dest = Int16$from_text(Text$from_str(Match(ast, Int)->str), NULL); break; - case 8: *(int8_t*)dest = Int8$from_text(Text$from_str(Match(ast, Int)->str), NULL); break; + case 0: *(Int_t*)dest = Int$from_text(Text$from_str(Match(ast, Int)->str)); break; + case 64: *(int64_t*)dest = Int64$from_text(Text$from_str(Match(ast, Int)->str)).i; break; + case 32: *(int32_t*)dest = Int32$from_text(Text$from_str(Match(ast, Int)->str)).i; break; + case 16: *(int16_t*)dest = Int16$from_text(Text$from_str(Match(ast, Int)->str)).i; break; + case 8: *(int8_t*)dest = Int8$from_text(Text$from_str(Match(ast, Int)->str)).i; break; default: errx(1, "Invalid int bits: %ld", Match(ast, Int)->bits); } break; |
