2 ### Class SDI: Create a generic SDI Stub file ################################
10 my $class = ref($proto) || $proto;
12 $self->{SFD
} = $params{'sfd'};
13 $self->{PROTO
} = $params{'proto'};
14 $self->{LIBPROTO
} = $params{'libproto'};
15 bless ($self, $class);
21 my $sfd = $self->{SFD
};
24 print "/* Automatically generated header! Do not edit! */\n";
26 print "#ifndef _$$sfd{'BASENAME'}_H\n";
27 print "#define _$$sfd{'BASENAME'}_H\n";
30 print "/* Automatically generated SDI stubs! Do not edit! */\n";
34 foreach my $inc (@
{$$sfd{'includes'}}) {
35 print "#include $inc\n";
38 foreach my $td (@
{$$sfd{'typedefs'}}) {
39 print "typedef $td;\n";
43 print "#ifdef __cplusplus\n";
44 print "extern \"C\" {\n";
45 print "#endif /* __cplusplus */\n";
52 my $prototype = $params{'prototype'};
53 my $sfd = $self->{SFD
};
55 if ($prototype->{type
} eq 'function') {
56 $self->function_proto (prototype => $prototype);
57 $self->function_start (prototype => $prototype);
58 for my $i (0 .. $$prototype{'numargs'} - 1 ) {
59 $self->function_arg (prototype => $prototype,
60 argtype
=> $$prototype{'argtypes'}[$i],
61 argname
=> $$prototype{'___argnames'}[$i],
62 argreg
=> $$prototype{'regs'}[$i],
65 $self->function_end (prototype => $prototype);
73 my $sfd = $self->{SFD
};
76 print "#ifdef __cplusplus\n";
78 print "#endif /* __cplusplus */\n";
82 print "#endif /* _$$sfd{'BASENAME'}_H */\n";
92 my $prototype = $params{'prototype'};
93 my $sfd = $self->{SFD
};
99 my $prototype = $params{'prototype'};
100 my $sfd = $self->{SFD
};
102 if ($self->{PROTO
}) {
105 elsif (!$self->{LIBPROTO
}) {
108 print " return $libprefix$prototype->{funcname}(";
110 if ($libarg eq 'first' && !$prototype->{nb
}) {
112 print $prototype->{numargs
} > 0 ?
", " : "";
120 if (!$self->{PROTO
} && !$self->{LIBPROTO
}) {
122 my $argname = $params{'argname'};
123 my $argnum = $params{'argnum'};
125 print $argnum > 0 ?
", " : "";
133 if (!$self->{PROTO
} && !$self->{LIBPROTO
}) {
135 my $prototype = $params{'prototype'};
136 my $sfd = $self->{SFD
};
138 if ($libarg eq 'last' && !$prototype->{nb
}) {
139 print $prototype->{numargs
} > 0 ?
", " : "";