comparison src/gearsTools/generate_stub.pl @ 242:26be78edaf83

impl auto collection for data gears from interface
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 03 Feb 2020 17:12:35 +0900
parents d419660ad71d
children 4f72a447d518
comparison
equal deleted inserted replaced
240:875ad11af596 242:26be78edaf83
108 $codeGearName = "$1/$codeGearName"; 108 $codeGearName = "$1/$codeGearName";
109 } 109 }
110 if ( -f "$codeGearName.cbc") { 110 if ( -f "$codeGearName.cbc") {
111 &getCodeGear("$codeGearName.cbc"); 111 &getCodeGear("$codeGearName.cbc");
112 } 112 }
113 } elsif(/^#interface "(.*)"/) { 113 } elsif(/^#interface "(.*)"/) {
114 # use interface 114 # use interface
115 my $interfaceHeader = $1; 115 my $interfaceHeader = $1;
116 next if ($interfaceHeader =~ /context.h/); 116 next if ($interfaceHeader =~ /context.h/);
117 if (-f $interfaceHeader) { 117 if (-f $interfaceHeader) {
118 &getDataGear("$interfaceHeader"); 118 &getDataGear("$interfaceHeader");
136 my $tname = $2; 136 my $tname = $2;
137 if ($ttype =~ /^(union|struct)?\s*(\w+)/) { 137 if ($ttype =~ /^(union|struct)?\s*(\w+)/) {
138 $ttype = $2; 138 $ttype = $2;
139 } 139 }
140 $var{$name}->{$tname} = $ttype; 140 $var{$name}->{$tname} = $ttype;
141 }
142 if (/__code (\w+)/) {
143 my $args = $';
144 while ($args =~ /((?:struct|union|const)\s+)?([\w\[\]_]+)\*?\s*(\w+),?/g) {
145 #$args eq (Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...));
146 my $const_type = $1;
147 my $ttype = $2;
148 my $tname = $3;
149
150 $ttype =~ s/Impl/struct $name/;
151 if ($const_type eq 'const') {
152 $ttype = "const $ttype";
153 }
154 $var{$name}->{$tname} = $ttype;
155 }
141 } 156 }
142 if (/^}/) { 157 if (/^}/) {
143 $inTypedef = 0; 158 $inTypedef = 0;
144 } 159 }
145 } 160 }