diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-05-20 16:53:20 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-05-20 16:53:20 +0000 |
commit | 198f32a7660442c2f7c0f83c2ad179e932074db8 (patch) | |
tree | 49e00822cb466dc3b8c3e1642424d430574100e8 /lib/sbin/CreateParameterBindings.pl | |
parent | 2e56de0aaa761f45dc3fb81fae41566c85c03db1 (diff) |
Added AS for parameters. You can now have one name for a parameter as seen
by the user, and another name for the vaiable in your code.
This will be particularly useful for avoiding conflicts when sharing parameters
from other implementations.
Syntax:
[uses|extends] <type> <name> ["<description>"] AS <newname>
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2832 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CreateParameterBindings.pl')
-rw-r--r-- | lib/sbin/CreateParameterBindings.pl | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl index dc1b0d02..dc9049be 100644 --- a/lib/sbin/CreateParameterBindings.pl +++ b/lib/sbin/CreateParameterBindings.pl @@ -225,19 +225,21 @@ sub CreateParameterBindings foreach $parameter (split(' ',$rhparameter_db->{"\U$thorn SHARES $friend\E variables"})) { - $type = $rhparameter_db->{"\U$friend_thorn $parameter\E type"}; + my $realname = $rhparameter_db->{"\U$thorn $parameter\E realname"}; + + $type = $rhparameter_db->{"\U$friend_thorn $realname\E type"}; + $array = $rhparameter_db->{"\U$friend_thorn $realname\E array_size"}; $type_string = &get_c_type_string($type); - # See if we are sharing it AS something - my $name = $rhparameter_db->{"\U$thorn $parameter\E alias"}; + my $varprefix = ''; - if(! $name) + if($array_size) { - $name = "$parameter"; + $varprefix = '*'; } - push(@data, " const $type_string$name = RESTRICTED_\U$friend\E_STRUCT.$parameter; \\"); - push(@use, " (void) ($name + 0); \\"); + push(@data, " const $type_string $varprefix$parameter = RESTRICTED_\U$friend\E_STRUCT.$realname; \\"); + push(@use, " (void) ($parameter + 0); \\"); } } @@ -499,6 +501,8 @@ sub CreateParameterRegistrationStuff &CST_error(0,$message,'',__LINE__,__FILE__); } + my $realname = $rhparameter_db->{"\U$thorn $parameter\E realname"}; + my $array_size = $rhparameter_db->{"\U$thorn $parameter\E array_size"}; my $dereference = ''; @@ -534,7 +538,7 @@ sub CreateParameterRegistrationStuff " $steerable_type,\n" . " " . $rhparameter_db->{"\U$thorn $parameter\E description"} . ",\n" . " \"" . $quoted_default . "\",\n" . - " $dereference($structure.$parameter),\n" . + " $dereference($structure.$realname),\n" . " $array_size,\n" . " $accumulator_expression,\n" . # " $accumulator_base,\n" . @@ -629,7 +633,7 @@ sub CreateParameterAccumulationStuff if($accumulator_base) { - print "accumulator_base = $accumulator_base\n"; +# print "accumulator_base = $accumulator_base\n"; $accumulator_base =~ m/([^:]+)::(.+)/; |