Mercurial > hg > CbC > CbC_xv6
changeset 350:26ab43de3654
tweak...
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 02 Mar 2020 16:17:24 +0900 |
parents | 0e72eb96b6b1 |
children | 1fb6c09db515 |
files | src/gearsTools/lib/Gears/Context.pm |
diffstat | 1 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gearsTools/lib/Gears/Context.pm Mon Mar 02 15:38:42 2020 +0900 +++ b/src/gearsTools/lib/Gears/Context.pm Mon Mar 02 16:17:24 2020 +0900 @@ -86,10 +86,10 @@ my ($self, $dg_str) = @_; my $data_struct_str = ""; for my $interface (sort keys %$dg_str) { - $data_struct_str .= $self->h2context_str($dg_str->{$interface}->{elem}); + $data_struct_str .= $self->h2context_str_w_macro($dg_str->{$interface}->{elem}); next unless ($dg_str->{$interface}->{impl}); for my $impl (sort keys %{$dg_str->{$interface}->{impl}}) { - $data_struct_str .= $self->h2context_str($dg_str->{$interface}->{impl}->{$impl}); + $data_struct_str .= $self->h2context_str_w_macro($dg_str->{$interface}->{impl}->{$impl}); } } return $data_struct_str; @@ -121,13 +121,24 @@ return \%dg_str; } +sub h2context_str_w_macro { + my ($self, $h2context) = @_; + my $space = ' '; + my $context = "${space}//$h2context->{file_name}\n"; + $context .= "#ifndef ". uc($h2context->{name}) ."_STRUCT \n"; + $context .= $self->h2context_str($h2context); + $context .= "#define ". uc($h2context->{name}) ."_STRUCT \n"; + $context .= "#else\n"; + $context .= "${space}struct $h2context->{name};\n"; + $context .= "#endif\n"; + return $context; +} + sub h2context_str { my ($self, $h2context) = @_; my $space = ' '; - my $context = "${space}//$h2context->{file_name}\n"; - $context .= "#ifndef ". uc($h2context->{name}) ."_STRUCT \n"; - $context .= "${space}struct $h2context->{name} {\n"; + my $context = "${space}struct $h2context->{name} {\n"; my $content_space; my @enumCodes; @@ -164,10 +175,6 @@ } $context .= "${space}} $h2context->{name};\n"; - $context .= "#define ". uc($h2context->{name}) ."_STRUCT \n"; - $context .= "#else\n"; - $context .= "${space}struct $h2context->{name};\n"; - $context .= "#endif\n"; return $context; }