X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/68270520285b0dc869565573fce3b02e860ffa7f..a41aa156f28753613f38924fc856d3dc992cfc56:/src/execute.gperf diff --git a/src/execute.gperf b/src/execute.gperf index ddebd5d..a45413d 100644 --- a/src/execute.gperf +++ b/src/execute.gperf @@ -1,6 +1,6 @@ %{ /* - * Copyright © 2021 Nick Bowler + * Copyright © 2021, 2023 Nick Bowler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ static int run_cmd_help(void) int w; w = printf(" %s", stringpool+c->name); - if (w < 0 || w > 13) { + if (w <= 0 || w > 13) { putchar('\n'); w = 0; } @@ -104,11 +104,16 @@ int run_command(const char *line, int batch) } switch (c->cmd) { - case cmd_help: return run_cmd_help(); - case cmd_declare: case cmd_type: return run_command_declare(cmd); - case cmd_simplify: return run_command_simplify(arg); - case cmd_explain: return run_command_explain(arg); - case cmd_quit: return 1; + case cmd_help: + return run_cmd_help(); + case cmd_declare: case cmd_type: + return run_command_cdecl(cmd, INPUT_ENGLISH, OUTPUT_C); + case cmd_simplify: + return run_command_cdecl(arg, INPUT_C, OUTPUT_C); + case cmd_explain: + return run_command_cdecl(arg, INPUT_C, OUTPUT_ENGLISH); + case cmd_quit: + return 1; } assert(0);