comparison src/gearsTools/lib/Gears/Context.pm @ 133:ae25a4e76377

fix gen_context.pl
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Wed, 11 Dec 2019 17:10:43 +0900
parents c690327cabc8
children 2a0de2f8596e
comparison
equal deleted inserted replaced
132:8e93917ce4be 133:ae25a4e76377
164 } 164 }
165 165
166 sub tree2data_struct_str { 166 sub tree2data_struct_str {
167 my ($self, $dg_str) = @_; 167 my ($self, $dg_str) = @_;
168 my $data_struct_str = ""; 168 my $data_struct_str = "";
169
170 #もとのxv6に登録されているものはcontext.hには定義を書かない
171 my $alread_defined_str = _already_defined_struct();
172 for my $str (sort keys %$dg_str) {
173 if (defined $alread_defined_str->{$str}) {
174 my $str_name = $alread_defined_str->{$str};
175 $data_struct_str .= "struct $str_name $str_name;\n";
176 delete $dg_str->{$str_name};
177 }
178 }
179
180 #定義されてないものはcontext.hに書くフォーマットに合わせておく
169 for my $interface (sort keys %$dg_str) { 181 for my $interface (sort keys %$dg_str) {
170 $data_struct_str .= Gears::Util->h2context_str($dg_str->{$interface}->{elem}); 182 $data_struct_str .= Gears::Util->h2context_str($dg_str->{$interface}->{elem});
171 next unless ($dg_str->{$interface}->{impl}); 183 next unless ($dg_str->{$interface}->{impl});
172 for my $impl (sort keys %{$dg_str->{$interface}->{impl}}) { 184 for my $impl (sort keys %{$dg_str->{$interface}->{impl}}) {
173 $data_struct_str .= Gears::Util->h2context_str($dg_str->{$interface}->{impl}->{$impl}); 185 $data_struct_str .= Gears::Util->h2context_str($dg_str->{$interface}->{impl}->{$impl});
219 } 231 }
220 } sort @$header_paths; 232 } sort @$header_paths;
221 return \%res; 233 return \%res;
222 } 234 }
223 235
236 sub _already_defined_struct {
237 my @struct_list = qw/
238 __jmp_buf_tag
239 buf
240 cbc_devsw
241 context
242 cpu
243 devsw
244 dinode
245 dirent
246 elfhdr
247 file
248 inode
249 pipe
250 proc
251 proghdr
252 spinlock
253 stat
254 superblock
255 trapframe
256 /;
257
258 my %def_hash;
259 map { $def_hash{$_} = $_} @struct_list;
260 return \%def_hash;
261 }
262
224 1; 263 1;