diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-05-21 10:38:44 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-05-21 10:38:44 +0000 |
commit | 9e9ae09fdf13b595c4053e803e6a396d7f843c95 (patch) | |
tree | 1d9bf55cd6d4f4045aecb5087c3ebd7ac96eeb9f /lib/sbin/CreateImplementationBindings.pl | |
parent | 9291fe92c464ba411050fa1758937af49906d805 (diff) |
Several inter-twined changes: -
Make system now looks in
bindings/build/$(THORN)/make.code.defn
for additional objects to be built and linked into a library.
The CST puts a file cctk_ThornBindings.c into this directory.
This should solve the empty library problem - PR 638.
The interface to the internal routine CCTKi_RegisterThorn has changed.
The new file created by the CST uses the correct new syntax, ands passes
information about ancestors and friends into the flesh. Hence the
commit of two separate things in one commit, as the both changes
require a -rebuild.
Please do a
make <config>-rebuild
or your code will not compile.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2199 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CreateImplementationBindings.pl')
-rw-r--r-- | lib/sbin/CreateImplementationBindings.pl | 89 |
1 files changed, 81 insertions, 8 deletions
diff --git a/lib/sbin/CreateImplementationBindings.pl b/lib/sbin/CreateImplementationBindings.pl index 38dd25b5..7ee96263 100644 --- a/lib/sbin/CreateImplementationBindings.pl +++ b/lib/sbin/CreateImplementationBindings.pl @@ -14,6 +14,11 @@ sub CreateImplementationBindings my($thorn); my(@data); + if(! $build_dir) + { + $build_dir = "$bindings_dir/build"; + } + if(! -d $bindings_dir) { mkdir("$bindings_dir", 0755) || die "Unable to create $bindings_dir"; @@ -36,18 +41,16 @@ sub CreateImplementationBindings @data = (); - push(@data, "#include <stdio.h>\n"); - push(@data, "/* FIXME - remove when ActiveThorns does not need this */\n"); - push(@data, "#include \"SKBinTree.h\"\n\n"); - push(@data, "#include \"cctk_ActiveThorns.h\"\n\n"); - push(@data, "#include \"cctki_ActiveThorns.h\"\n\n"); + foreach $thorn (sort split(" ", $rhinterface_db->{"THORNS"})) + { + push(@data, "int CCTKi_BindingsThorn_$thorn(void);\n") + } push(@data, "int CCTKi_BindingsImplementationsInitialise(void)\n{\n"); foreach $thorn (sort split(" ", $rhinterface_db->{"THORNS"})) { - push(@data, " CCTKi_RegisterThorn(\"$thorn\",\"" . - $rhinterface_db->{"\U$thorn\E IMPLEMENTS"} ."\");\n"); + push(@data, " CCTKi_BindingsThorn_$thorn();\n") } push(@data, "\n return 0;\n}\n"); @@ -61,8 +64,78 @@ sub CreateImplementationBindings &WriteFile("make.code.defn",\$dataout); + if(! -d "$build_dir") + { + mkdir("$build_dir", 0755) || die "Unable to create $build_dir"; + } + + chdir "$build_dir"; + + foreach $thorn (sort split(" ", $rhinterface_db->{"THORNS"})) + { + + if(! -d "$thorn") + { + mkdir("$thorn", 0755) || die "Unable to create $build_dir/$thorn"; + } + + chdir "$thorn"; + + $myimp = $rhinterface_db->{"\U$thorn\E IMPLEMENTS"}; + + @data = (); - chdir $start_dir; + push(@data, "#include <stdio.h>\n"); + push(@data, "#include \"cctki_ActiveThorns.h\"\n\n"); + + push(@data, "int CCTKi_BindingsThorn_${thorn}(void)\n{\n"); + + push(@data, " int retval;\n"); + + push(@data, " const char *name[] = {\"$thorn\",0};"); + push(@data, " const char *implementation[]={\"$myimp\",0};"); + + push(@data, " const char *ancestors[]=\n {"); + foreach $ancestor (split(" ",$rhinterface_db->{"IMPLEMENTATION \U$myimp\E ANCESTORS"})) + { + push(@data, " \"$ancestor\","); + } + push(@data, " 0,"); + push(@data, " };\n"); + + push(@data, " const char *friends[]=\n {"); + foreach $friend (split(" ",$rhinterface_db->{"IMPLEMENTATION \U$myimp\E FRIENDS"})) + { + push(@data, " \"$friend\","); + } + push(@data, " 0,"); + push(@data, " };\n"); + + push(@data, "\n struct iAttributeList attributes[] ="); + push(@data, " {"); + push(@data, " {\"name\", {name}},"); + push(@data, " {\"implementation\",{implementation}},"); + push(@data, " {\"ancestors\",{ancestors}},"); + push(@data, " {\"friends\",{friends}},"); + push(@data, " {0,{0}},"); + push(@data, " };\n"); + + push(@data, " retval = CCTKi_RegisterThorn(attributes);"); + + push(@data, "\n return retval;\n}\n"); + + &OutputFile(".", "cctk_ThornBindings.c", @data); + + + $dataout = ""; + $dataout .= "\n"; + $dataout .= "SRCS = cctk_ThornBindings.c\n\n"; + + &WriteFile("make.code.defn",\$dataout); + + chdir ".."; + } + } 1; |