aboutsummaryrefslogtreecommitdiff
path: root/generate-command-parser.pl
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2020-04-20 04:14:26 +0200
committerOrestis Floros <orestisflo@gmail.com>2020-04-20 04:25:45 +0200
commitaf7c4ae76b2b4a88af52d77a2ffecb5da2ad051f (patch)
tree345f9a3351642e599f0074582a11dd88b1751552 /generate-command-parser.pl
parent2954125324431c3d5605e2490769b54410d41110 (diff)
downloadi3-af7c4ae76b2b4a88af52d77a2ffecb5da2ad051f.tar.gz
i3-af7c4ae76b2b4a88af52d77a2ffecb5da2ad051f.zip
generate-command-parser: Add '#pragma once'
Diffstat (limited to 'generate-command-parser.pl')
-rwxr-xr-xgenerate-command-parser.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/generate-command-parser.pl b/generate-command-parser.pl
index a017edab..77502db7 100755
--- a/generate-command-parser.pl
+++ b/generate-command-parser.pl
@@ -117,6 +117,7 @@ my @keys = sort { (length($b) <=> length($a)) or ($a cmp $b) } keys %states;
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') {
@@ -131,6 +132,7 @@ close($enumfh);
# 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;
@@ -206,6 +208,7 @@ close($callfh);
# 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};