diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-04-24 15:44:51 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-04-24 15:44:51 +0000 |
commit | 74751ddbe297eeeb6ddcb196f715f3e659dd1e51 (patch) | |
tree | 660ec5e15d11430708b9422a0f99967203b4d695 /lib/sbin/create_c_stuff.pl | |
parent | 32b903fa7a613decea0fae34bfbde5b9ae464593 (diff) |
Changed CCTK_DECLARE_ARGUMENTS and CCTK_DECLARE_PARAMETERS macros so that
local variables/parameters are now used in their declarations block
without requiring separate USE_CCTK_* macros).
This closes PR Cactus/1657: CST doesn't ignore braces "{" instring literals.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3677 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/create_c_stuff.pl')
-rw-r--r-- | lib/sbin/create_c_stuff.pl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sbin/create_c_stuff.pl b/lib/sbin/create_c_stuff.pl index 499f8767..1952a188 100644 --- a/lib/sbin/create_c_stuff.pl +++ b/lib/sbin/create_c_stuff.pl @@ -172,7 +172,7 @@ sub GetThornParameterList sub CreateCStructureParameterHeader { my($prefix, $structure, $rhparameters, $rhparameter_db) = @_; - my($line,@data); + my($line,@data,@use); my(%parameters); my($type, $type_string); my(@definition); @@ -187,6 +187,7 @@ sub CreateCStructureParameterHeader push(@data, 'extern struct'); push(@data, '{'); + push(@use, " const void *${structure}_use = ( \\"); foreach $parameter (&order_params($rhparameters, $rhparameter_db)) { my $type = $rhparameter_db->{"\U$rhparameters->{$parameter} $parameter\E type"}; @@ -207,8 +208,10 @@ sub CreateCStructureParameterHeader push(@data, " $type_string $realname$suffix;"); push(@definition, " $type_string$varprefix const $parameter = $structure.$realname; \\"); - push(@use, " (void) ($parameter + 0); \\"); + push(@use, " ${structure}_use = \&$parameter, \\"); } + push(@use, " &${structure}_use \\"); + push(@use, ' );'); # Some compilers don't like an empty structure. if((keys %$rhparameters) == 0) @@ -226,9 +229,8 @@ sub CreateCStructureParameterHeader push(@data, "#define DECLARE_${structure}_PARAMS \\"); push(@data, @definition); - push(@data, ''); - push(@data, "#define USE_${structure}_PARAMS \\"); push(@data, @use); + push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline return join ("\n", @data); |