Skip to content

Instantly share code, notes, and snippets.

@Skarsnik
Created November 27, 2021 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Skarsnik/f3adb82dcc630b6a401b3a697d01838b to your computer and use it in GitHub Desktop.
Save Skarsnik/f3adb82dcc630b6a401b3a697d01838b to your computer and use it in GitHub Desktop.
sub fix-struct-name {# CASTXML does not give a name to struct defined like typedef struct {} name
say "fix stuff";
for %structs.keys -> $id {
next if %structs{$id} !~~ Struct;
say %structs{$id};
if %structs{$id}.name eq $PLACEHOLDER {
for @typedefs -> $td {
if $td.ref-id eq $id {
say "merging struct ", $id , " with typedef ", $td.id;
%structs{$id}.name = $td.name;
%structs{$id}.id = $td.id;
%types{$id}.id = $td.id;
%types{$id}.name = $td.name;
%types{$td.id} = %types{$id};
%types{$id}:delete;
%structs{$td.id} = %structs{$id};
%structs{$id}:delete;
@typedefs.splice(@typedefs.first($td, :k), 1);
last;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment