summaryrefslogtreecommitdiff
path: root/lib/sbin/create_c_stuff.pl
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-01-21 16:29:30 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-01-21 16:29:30 +0000
commitb9a04270ac9323cf74f22b7c83c09cd7affda301 (patch)
tree3d42d05b0533d2f6c98ba914cf781bcd13b51003 /lib/sbin/create_c_stuff.pl
parent81b3057b07e225171a91d180ac3259d78749fc81 (diff)
Creates lots of parameter header files. These provide extern statements
for the appropriate structures, and #defines for declarations for each structure. To do: for each thorn generate code to #include the appropriate headers and make a DECLARE_PARSER #define which calls the appropriate DECLARE for the public, protected, and private parameters, and a mangled form for the friend parameters. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@100 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/create_c_stuff.pl')
-rw-r--r--lib/sbin/create_c_stuff.pl66
1 files changed, 64 insertions, 2 deletions
diff --git a/lib/sbin/create_c_stuff.pl b/lib/sbin/create_c_stuff.pl
index 75c8fd4c..2b5b33ad 100644
--- a/lib/sbin/create_c_stuff.pl
+++ b/lib/sbin/create_c_stuff.pl
@@ -62,7 +62,7 @@ sub CreateParameterBindingFile
$type_string = &get_c_type_string($type);
- $line = $type_string ." " .$parameter . ";";
+ $line = " " . $type_string ." " .$parameter . ";";
push(@data, $line);
}
@@ -283,7 +283,7 @@ sub get_c_type_string
# @date Wed Jan 20 15:29:40 1999
# @author Tom Goodale
# @desc
-# Gets a list of all parameters in a aprticular block in a thorn.
+# Gets a list of all parameters in a particular block in a thorn.
# Returns a hash table.
# @enddesc
# @calls
@@ -358,5 +358,67 @@ sub create_c_parameter_type_declaration
}
+sub CreateThornCParameterHeaders
+{
+ local($thorn, %parameter_database);
+ local(@header);
+
+#
+# &getpublicparameters();
+#
+# generatestructure, getinteface_protected_params, generate structure, get private params, make structure, foreach friend get structure
+#
+# for each param, point at the appropriate structure
+
+}
+
+sub CreateCStructureParameterHeader
+{
+ local($prefix, $structure, $n_parameters, @rest) = @_;
+ local(%parameter_database);
+ local($line,@data);
+ local(%parameters);
+ local($type, $type_string);
+ local(@data);
+ local(@definition);
+
+ %parameters = @rest[0..2*$n_parameters-1];
+ %parameter_database = @rest[2*$n_parameters..$#rest];
+
+ # Create the structure
+
+ push(@data,( "extern struct ", "{"));
+
+ foreach $parameter (keys %parameters)
+ {
+ $type = $parameter_database{"\U$parameters{$parameter} $parameter\E type"};
+
+ $type_string = &get_c_type_string($type);
+
+ $line = " ".$type_string ." " .$parameter . ";";
+
+ push(@data, $line);
+
+ $line = $type_string ." " .$parameter . " = $structure.$parameter;";
+
+ push(@definition, $line)
+ }
+
+ push(@data, "} $structure;");
+
+ push(@data, "");
+
+
+ push(@data, "#define DECLARE_$structure"."_PARAMS \\");
+
+ foreach $line (@definition)
+ {
+ push(@data, " $line \\");
+ }
+
+ push(@data, "");
+
+ return @data;
+}
1;