~hidravfx-dev-team/hidravfx/trunk

« back to all changes in this revision

Viewing changes to src/codegen.pl

  • Committer: Laszlo.simon
  • Date: 2011-03-13 11:41:02 UTC
  • Revision ID: git-v1:0d51d435885d2b0ef73eac9a9f4b5ee18e9019a3
Missing command descriptions added, test generation added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
}
72
72
 
73
73
CODE
74
 
conform => <<CODE,
 
74
distortions => <<CODE,
75
75
/** <DESC> 
76
76
 *  \\return Error value */
77
77
int <NAME>(
127
127
  }
128
128
CODE
129
129
 
 
130
my $testcalls    = '';
130
131
my $funcdefs     = '';
131
132
my $funcdecls    = '';
132
133
my $funccalls    = '';
140
141
my $paramcnt     = 0;
141
142
my @cmdlist      = '';
142
143
 
143
 
for my $type (sort(keys(%effects)))
 
144
for my $group (sort(keys(%effects)))
144
145
{
145
 
  for my $func (sort(keys(%{$effects{$type}})))
 
146
 for my $type (sort(keys(%{$effects{$group}})))
 
147
 {
 
148
  for my $func (sort(keys(%{$effects{$group}->{$type}})))
146
149
  {
147
150
    my $name = $func;
148
 
    my $desc = $effects{$type}->{$func}->{desc};
149
 
    my $calc = $effects{$type}->{$func}->{calc};
150
 
    my $init = $effects{$type}->{$func}->{init};
151
 
    my $prms = $effects{$type}->{$func}->{prms};
 
151
    my $funchash = $effects{$group}->{$type}->{$func}; 
 
152
    my $desc = $funchash->{desc};
 
153
    my $calc = $funchash->{calc};
 
154
    my $init = $funchash->{init};
 
155
    my $prms = $funchash->{prms};
152
156
    my $paramdefs  = '';
153
157
    my $paramcalls = '';
154
158
    my $paramindex = $paramcnt;
155
159
    
 
160
    $testcalls    .= "$func";
156
161
    push @cmdlist, $name; 
157
162
    $paramindices .= "$paramindex, ";
158
163
    for (keys(%{$prms}))
162
167
      $paramcalls.= ", getOpt(\"$_\")";
163
168
      $paramlist .= "\"$_\",\n";
164
169
      $paramdescs.= "\"$prms->{$_}->{desc}\",\n";
 
170
      $testcalls .= (exists $prms->{$_}->{test}) ? " --$_=$prms->{$_}->{test}" : 
 
171
                    (exists $prms->{$_}->{def})  ? " --$_=$prms->{$_}->{def}"  : 
 
172
                                                   '';
165
173
      $paramcnt++;
166
174
    } 
167
 
    $paramnums .= ($paramcnt-$paramindex).", ";
168
 
    
 
175
    $testcalls   .= "\n";
 
176
    $paramnums   .= ($paramcnt-$paramindex).", ";
 
177
 
169
178
    $effectlist  .= "  \"$name\",\n";
170
179
    $effectdescs .= "  \"$desc\",\n";
171
180
      
172
 
    my $fdf = $funcdef{$type};
 
181
    my $fdf = $funcdef{$group};
173
182
    $fdf =~ s/<NAME>/$name/g;
174
183
    $fdf =~ s/<DESC>/$desc/g;
175
184
    $fdf =~ s/<CALC>/$calc/g;
190
199
  
191
200
    $effectcnt++;
192
201
  }
 
202
 }
193
203
}
194
204
open OUT, '>cmdproc.i';
195
205
print OUT <<CODE;
268
278
complete -F _hidravfx hidravfx
269
279
CODE
270
280
 
 
281
open OUT, '>../test/tests'; print OUT $testcalls; close OUT;
 
282
 
271
283
print "codegen.pl: Code generation done.\n";
 
 
b'\\ No newline at end of file'