Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
generate-command-parser: Add '#pragma once'
  • Loading branch information
orestisfl committed Apr 20, 2020
1 parent 2954125 commit af7c4ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions generate-command-parser.pl
Expand Up @@ -117,6 +117,7 @@ sub slurp {
open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");

my %statenum;
say $enumfh '#pragma once';
say $enumfh 'typedef enum {';
my $cnt = 0;
for my $state (@keys, '__CALL') {
Expand All @@ -131,6 +132,7 @@ sub slurp {
# Third step: Generate the call function.
open(my $callfh, '>', "GENERATED_${prefix}_call.h");
my $resultname = uc(substr($prefix, 0, 1)) . substr($prefix, 1) . 'ResultIR';
say $callfh '#pragma once';
say $callfh "static void GENERATED_call(const int call_identifier, struct $resultname *result) {";
say $callfh ' switch (call_identifier) {';
my $call_id = 0;
Expand Down Expand Up @@ -206,6 +208,7 @@ sub slurp {
# Fourth step: Generate the token datastructures.

open(my $tokfh, '>', "GENERATED_${prefix}_tokens.h");
say $tokfh '#pragma once';

for my $state (@keys) {
my $tokens = $states{$state};
Expand Down

0 comments on commit af7c4ae

Please sign in to comment.