1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#/*@@
# @file CreateScheduleBindings.pl
# @date Sun Jul 25 00:53:43 1999
# @author Tom Goodale
# @desc
# Schedule bindings stuff
# @enddesc
#@@*/
#/*@@
# @routine CreateScheduleBindings
# @date Thu Jan 28 15:27:16 1999
# @author Tom Goodale
# @desc
# Create the bindings used for the scheduler.
# @enddesc
# @calls
# @calledby
# @history
#
# @endhistory
#
#@@*/
sub CreateScheduleBindings
{
local($bindings_dir,$n_thorns,@rest) = @_;
local(%thorns);
local(%interface_database);
local($wrapper, $rfr, $startup, %schedule_data);
%thorns = @rest[0..2*$n_thorns-1];
%interface_database = @rest[2*$n_thorns..$#rest];
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";
# Parse the schedule.ccl files
if ($CST_debug)
{
print "DEBUG: Parsing schedule.ccl files\n";
}
($wrapper,$rfr,$startup, %schedule_data) = &create_schedule_code($bindings_dir,$n_thorns,%thorns,%interface_database);
@rfr_files = split(" ",$rfr);
# Write the contents of BindingsScheduleRegisterRFR.c
if ($CST_debug)
{
print "DEBUG: Creating RFR registration files\n";
}
&create_RegisterRFR($bindings_dir,scalar(@rfr_files), @rfr_files, %schedule_data);
# Write the contents of BindingsScheduleRegisterSTARTUP.c
if ($CST_debug)
{
print "DEBUG: Creating STARTUP registration files\n";
}
&create_RegisterSTARTUP($bindings_dir,split(" ",$startup));
open (OUT, ">BindingsSchedule.c") || die "Cannot open BindingsSchedule.c";
print OUT <<EOT;
#include <stdio.h>
int CCTKi_BindingsScheduleInitialise(void)
{
return 0;
}
int CCTKi_BindingsScheduleRegister(const char *type, void *data)
{
if (CCTK_Equals(type,"STARTUP"))
{
Cactus_RegisterSTARTUP();
}
else if (CCTK_Equals(type,"RFRINIT"))
{
Cactus_RegisterRFR(data);
} else {
printf ("Unknown type in CCTKi_BindingsScheduleRegister");
}
return 0;
}
EOT
close OUT;
open (OUT, ">make.code.defn") || die "Cannot open make.code.defn";
$files = "";
foreach $file (split(" ",$rfr),split(" ",$startup),split(" ",$wrapper)) {
if($file)
{
$files = "$files ".$file.".c";
}
}
print OUT "SRCS = BindingsSchedule.c Cactus_RegisterSTARTUP.c Cactus_RegisterRFR.c $files\n";
close OUT;
chdir $start_dir;
}
1;
|