From 2e473be1b9ea835f367635c770c130252fd835fe Mon Sep 17 00:00:00 2001 From: goodale Date: Wed, 20 Jan 1999 08:18:17 +0000 Subject: New library - libCactusBindings.a created by make.configuration. The sources for this are automatically generated by config_parser.pl and should contain everything needed to bind the flesh and the thorns. Specifically have six functions called from the flesh CCTK_BindingsParametersInitialise CCTK_BindingsParameterSet CCTK_BindingsParameterGet CCTK_BindingsVariablesInitialise CCTK_BindingsScheduleInitialise CCTK_BindingsScheduleRegister All the initialise ones are of type int ()(void) CCTK_ParameterSet is of type int ()(const char *, const char *) and takes a parameter specification and a parameter value, as taken from the parameter file, and sets the parameter accordingly. CCTK_BindingsParameterGet is of type int()(const char *, void **) and returns the value of a parameter - the rturn value corresponds to the type of the parameter. CCTK_BindingsScheduleRegister is of type int()(const char *) and will perform registration at, e.g. Startup, or RFR, or any other point we add in future. Thinking about it, it needs to also take a void * if it's going to do rfr init stuff - watch this space... 8-) The c source files for these are put in the $(TOP)/bindings directory by config.ccl, each subsystem in its own directory. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@82 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/make.configuration | 6 +- lib/sbin/config_parser.pl | 239 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 195 insertions(+), 50 deletions(-) diff --git a/lib/make/make.configuration b/lib/make/make.configuration index 443b1cfe..7d2d1086 100644 --- a/lib/make/make.configuration +++ b/lib/make/make.configuration @@ -13,6 +13,7 @@ # Some configuration variables CONFIG = $(TOP)/config-data +BINDINGS_DIR = $(TOP)/bindings DATESTAMP = $(CCTK_HOME)/src/datestamp.c @@ -31,7 +32,7 @@ include $(CONFIG)/make.config.defn -include $(CONFIG)/make.thornlist # Build the executable -$(EXE): $(CONFIG)/make.thornlist $(patsubst %,$(CCTK_LIBDIR)/lib%.a,$(notdir $(THORNS))) $(CCTK_LIBDIR)/libCactus.a +$(EXE): $(CONFIG)/make.thornlist $(patsubst %,$(CCTK_LIBDIR)/lib%.a,$(notdir $(THORNS))) $(CCTK_LIBDIR)/libCactus.a $(CCTK_LIBDIR)/libCactusBindings.a @echo $(DIVIDER) @echo Creating $(EXE) from $(THORNS) $(CC) -c $(DATESTAMP) -o $(TOP)/datestamp.o @@ -57,7 +58,8 @@ $(CCTK_LIBDIR)/lib%.a: update if [ ! -d $(BUILD_DIR) ]; then $(MKDIR) $(BUILD_DIR) ; fi thorn_name=$(@:$(CCTK_LIBDIR)/lib%.a=%); \ if [ "$$thorn_name" = "Cactus" ] ; then src_dir=$(CCTK_HOME)/src ; \ - else src_dir=$(TOOLKIT_DIR)/$(@:$(CCTK_LIBDIR)/lib%.a=$(filter %/$(@:$(CCTK_LIBDIR)/lib%.a=%), $(THORNS)))/src ; fi ; \ + else if [ "$$thorn_name" = "CactusBindings" ] ; then src_dir=$(BINDINGS_DIR) ; \ + else src_dir=$(TOOLKIT_DIR)/$(@:$(CCTK_LIBDIR)/lib%.a=$(filter %/$(@:$(CCTK_LIBDIR)/lib%.a=%), $(THORNS)))/src ; fi ; fi ;\ if [ ! -d $(BUILD_DIR)/$$thorn_name ]; then $(MKDIR) $(BUILD_DIR)/$$thorn_name ; fi ; \ cd $(BUILD_DIR)/$$thorn_name ; \ if [ -r "$$src_dir/Makefile" ] ; then make_file=$$src_dir/Makefile ; \ diff --git a/lib/sbin/config_parser.pl b/lib/sbin/config_parser.pl index 44f52442..2f70cc7d 100644 --- a/lib/sbin/config_parser.pl +++ b/lib/sbin/config_parser.pl @@ -26,50 +26,35 @@ if(! $cctk_home) $cachome =~ s:/$::g; } +if(! $bindings_dir) +{ + $bindings_dir = "$top/bindings"; +} + $activethorns = shift(@ARGV); if (! $activethorns) { - printf "Usage: config_parser [-top=] [-config_dir=] [-cctk_home=] ActiveThornList"; + printf "Usage: config_parser [-top=] [-config_dir=] [-cctk_home=] -bindings_dir= ActiveThornList"; exit; } +$sbin_dir = "$cctk_home/lib/sbin"; -#if (!-e "$cctk_home/lib/perl/thorn_utils.pl" ) { -# print <make.code.defn") || die "Cannot open make.code.defn"; + + print OUT "SRCS = \n"; + print OUT "SUBDIRS = Parameters Variables Schedule\n"; + + close OUT; + chdir $start_dir; +} + +sub CreateParameterBindings +{ + local($bindings_dir, $n_param_database, @rest) = @_; + local(%parameter_database); + local(%interface_database); + local($start_dir); + + %parameter_database = @rest[0..$n_param_database-1]; + %interface_database = @rest[$n_param_database..$#rest]; + + if(! -d $bindings_dir) + { + mkdir("$bindings_dir", 0755) || die "Unable to create $bindings_dir"; + } + $start_dir = `pwd`; + + chdir $bindings_dir; + + if(! -d "Parameters") + { + mkdir("Parameters", 0755) || die "Unable to create Parameters directory"; + } + chdir "Parameters"; + + open (OUT, ">Bindings.c") || die "Cannot open Bindings.c"; + + print OUT <make.code.defn") || die "Cannot open ake.code.defn"; + + print OUT "SRCS = Bindings.c\n"; + + close OUT; + + chdir $start_dir; +} + + +sub CreateVariableBindings +{ + local($bindings_dir, %inteface_database) = @_; + + if(! -d $bindings_dir) + { + mkdir("$bindings_dir", 0755) || die "Unable to create $bindings_dir"; + } + $start_dir = `pwd`; + chdir $bindings_dir; + + if(! -d "Variables") + { + mkdir("Variables", 0755) || die "Unable to create Variables directory"; + } + chdir "Variables"; + + open (OUT, ">Bindings.c") || die "Cannot open Bindings.c"; + + print OUT <make.code.defn") || die "Cannot open make.code.defn"; + + print OUT "SRCS = Bindings.c\n"; + + close OUT; + + chdir $start_dir; +} + +sub CreateScheduleBindings +{ + local($bindings_dir) = @_; + + if(! -d $bindings_dir) + { + mkdir("$bindings_dir", 0755) || die "Unable to create $bindings_dir"; + } + $start_dir = `pwd`; + chdir $bindings_dir; + + if(! -d "Schedule") + { + mkdir("Schedule", 0755) || die "Unable to create Schedule directory"; + } + chdir "Schedule"; + + open (OUT, ">Bindings.c") || die "Cannot open Bindings.c"; + + print OUT <make.code.defn") || die "Cannot open make.code.defn"; + + print OUT "SRCS = Bindings.c\n"; + + close OUT; + + chdir $start_dir; +} -- cgit v1.2.3