diff options
-rw-r--r-- | lib/sbin/CreateParameterBindings.pl | 9 | ||||
-rw-r--r-- | lib/sbin/create_c_stuff.pl | 14 |
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl index b13b75fc..7905238b 100644 --- a/lib/sbin/CreateParameterBindings.pl +++ b/lib/sbin/CreateParameterBindings.pl @@ -201,6 +201,7 @@ sub CreateParameterBindings if($header_files{"\U$thorn\E PRIVATE"}); @use = (); + my $delim = ' '; foreach $friend (split(' ',$rhparameter_db->{"\U$thorn\E SHARES implementations"})) { $rhinterface_db->{"IMPLEMENTATION \U$friend\E THORNS"} =~ m:([^ ]*):; @@ -222,16 +223,16 @@ sub CreateParameterBindings } push(@data, " $type_string$varprefix const $parameter = RESTRICTED_\U$friend\E_STRUCT.$realname; \\"); - push(@use, " RESTRICTED_FRIENDS_STRUCT_use = \&$parameter, \\"); + push(@use, " $delim dummy_$friend\_$realname = sizeof( $parameter ) \\"); + $delim = ','; } } if(@use) { - push(@data, ' const void *RESTRICTED_FRIENDS_STRUCT_use = ( \\'); + push(@data, " enum { \\"); push(@data, @use); - push(@data, ' RESTRICTED_FRIENDS_STRUCT_use = &RESTRICTED_FRIENDS_STRUCT_use \\'); - push(@data, ' );'); + push(@data, " };"); } push(@data, ''); push(@data, "#endif /* _\U$thorn\E_PARAMETERS_H_ */"); diff --git a/lib/sbin/create_c_stuff.pl b/lib/sbin/create_c_stuff.pl index 9c541bac..124fd560 100644 --- a/lib/sbin/create_c_stuff.pl +++ b/lib/sbin/create_c_stuff.pl @@ -186,8 +186,8 @@ sub CreateCStructureParameterHeader push(@data, ''); push(@data, 'extern struct'); push(@data, '{'); + my $delim = ' '; - push(@use, " const void *${structure}_use = ( \\"); foreach $parameter (&order_params($rhparameters, $rhparameter_db)) { my $type = $rhparameter_db->{"\U$rhparameters->{$parameter} $parameter\E type"}; @@ -208,10 +208,9 @@ sub CreateCStructureParameterHeader push(@data, " $type_string $realname$suffix;"); push(@definition, " $type_string$varprefix const $parameter = $structure.$realname; \\"); - push(@use, " ${structure}_use = \&$parameter, \\"); + push(@use, " $delim dummy\_$structure\_$parameter = sizeof( $parameter ) \\"); + $delim = ','; } - push(@use, " &${structure}_use \\"); - push(@use, ' );'); # Some compilers don't like an empty structure. if((keys %$rhparameters) == 0) @@ -229,7 +228,12 @@ sub CreateCStructureParameterHeader push(@data, "#define DECLARE_${structure}_PARAMS \\"); push(@data, @definition); - push(@data, @use); + if( @use ) + { + push(@data, " enum { \\"); + push(@data, @use); + push(@data, " }; \\"); + } push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline |