diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-03-27 15:34:19 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-03-27 15:34:19 +0000 |
commit | 489ed36e225fbadf3618d9e338d158750347fa9f (patch) | |
tree | 606b59cd9a8da7b83da483f23d54a9fb8a21e53e /lib/sbin/GridFuncStuff.pl | |
parent | 358c188550d74a47d1fb817de7d9add766720f04 (diff) |
Reworked treatment of CCTK_DECLARE macros. Now the C file preprocessor
will put everything up to the closing bracket for a routine into a new block.
Also, the USE_CCTK macro is now appended directly to the CCTK_DECLARE macro.
There is no need anymore to use CCTK_NO_AUTOUSE_MACRO.
Also changed the way how parameters and arguments are used within the USE_CCTK
macros: now it's done by "(void) (parameter = 0);" which is better than
assigning the address of it to some dummy pointer.
This fixes problems where one had to parse for a possible return statement
at the end of the routine.
This fix closes PR Cactus/949.
Also did some perl code optimization and added grdoc headers for files
generated by the CST.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2676 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/GridFuncStuff.pl')
-rw-r--r-- | lib/sbin/GridFuncStuff.pl | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index 4a4c400f..c9d9c7b4 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -43,8 +43,6 @@ sub CreateVariableBindings { mkdir("include", 0755) || die "Unable to create include directory"; } - chdir "include"; - foreach $thorn (split(" ",$rhinterface_db->{"THORNS"})) { @@ -58,7 +56,7 @@ sub CreateVariableBindings $dataout .= "$line\n"; } - &WriteFile("$thorn\_arguments.h",\$dataout); + &WriteFile("include/$thorn\_arguments.h",\$dataout); } $dataout = "/* get the CCTK datatype definitions */\n"; @@ -66,7 +64,8 @@ sub CreateVariableBindings $dataout .= "#ifdef CCODE\n"; $dataout .= "#define CCTK_ARGUMENTS CCTK_CARGUMENTS\n"; $dataout .= "#define _CCTK_ARGUMENTS _CCTK_CARGUMENTS\n"; - $dataout .= "#define DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_CARGUMENTS\n"; + $dataout .= "#define DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_CARGUMENTS \\\n"; + $dataout .= " USE_CCTK_CARGUMENTS\n"; $dataout .= "#endif\n\n"; $dataout .= "#ifdef FCODE\n"; $dataout .= "#define CCTK_ARGUMENTS CCTK_FARGUMENTS\n"; @@ -86,15 +85,12 @@ sub CreateVariableBindings $dataout .= "#endif\n\n"; } - &WriteFile("cctk_Arguments.h",\$dataout); - - chdir ".."; + &WriteFile("include/cctk_Arguments.h",\$dataout); if(! -d "Variables") { mkdir("Variables", 0755) || die "Unable to create Variables directory"; } - chdir "Variables"; $filelist = "BindingsVariables.c"; @@ -122,7 +118,7 @@ sub CreateVariableBindings $dataout .= " return 0;\n}\n\n"; - &WriteFile("BindingsVariables.c",\$dataout); + &WriteFile("Variables/BindingsVariables.c",\$dataout); foreach $thorn (split(" ",$rhinterface_db->{"THORNS"})) { @@ -149,7 +145,7 @@ sub CreateVariableBindings $dataout .= " return 0;\n}\n"; - &WriteFile("$thorn.c",\$dataout); + &WriteFile("Variables/$thorn.c",\$dataout); $filelist .= " $thorn.c"; } @@ -165,12 +161,12 @@ sub CreateVariableBindings $dataout .= "$line\n"; } - &WriteFile("$thorn\_FortranWrapper.c",\$dataout); + &WriteFile("Variables/$thorn\_FortranWrapper.c",\$dataout); $filelist .= " $thorn\_FortranWrapper.c"; } $dataout = "SRCS = $filelist\n"; - &WriteFile("make.code.defn",\$dataout); + &WriteFile("Variables/make.code.defn",\$dataout); chdir $start_dir; } @@ -538,18 +534,16 @@ sub CreateCArgumentUses $suffix .= "_p"; } - push(@declarations, "cctk_dummy_pointer = \&$argument$suffix;"); + push(@declarations, "(void) ($argument$suffix + 0);"); } } } return @declarations; - } - #/*@@ # @routine CreateFortranArgumentList # @date Thu Jan 28 14:33:50 1999 |