X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=generate-command-parser.pl;h=993c64fcaa570dcc73d229ef4bc6130223078369;hb=5edacf49435023ab5a876d3425693ea530872918;hp=175d7101592839e379b546845f347cd3df70187d;hpb=51728bab77210a1050f11df0f0e27b3b88dc6674;p=i3%2Fi3 diff --git a/generate-command-parser.pl b/generate-command-parser.pl index 175d7101..993c64fc 100755 --- a/generate-command-parser.pl +++ b/generate-command-parser.pl @@ -118,8 +118,7 @@ close($enumfh); # Third step: Generate the call function. open(my $callfh, '>', 'GENERATED_call.h'); -say $callfh 'static char *GENERATED_call(const int call_identifier) {'; -say $callfh ' char *output = NULL;'; +say $callfh 'static void GENERATED_call(const int call_identifier, struct CommandResult *result) {'; say $callfh ' switch (call_identifier) {'; my $call_id = 0; for my $state (@keys) { @@ -143,11 +142,11 @@ for my $state (@keys) { say $callfh '#ifndef TEST_PARSER'; my $real_cmd = $cmd; if ($real_cmd =~ /\(\)/) { - $real_cmd =~ s/\(/(¤t_match/; + $real_cmd =~ s/\(/(¤t_match, result/; } else { - $real_cmd =~ s/\(/(¤t_match, /; + $real_cmd =~ s/\(/(¤t_match, result, /; } - say $callfh " output = $real_cmd;"; + say $callfh " $real_cmd;"; say $callfh '#else'; # debug $cmd =~ s/[^(]+\(//; @@ -164,7 +163,6 @@ for my $state (@keys) { say $callfh ' default:'; say $callfh ' printf("BUG in the parser. state = %d\n", call_identifier);'; say $callfh ' }'; -say $callfh ' return output;'; say $callfh '}'; close($callfh);