mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
Renamed functions from Dump* to Parse*
(This used to be commit 952b47dc23
)
This commit is contained in:
parent
e581569a87
commit
de5f7da321
@ -10,8 +10,8 @@ use Data::Dumper;
|
||||
my($res);
|
||||
|
||||
#####################################################################
|
||||
# dump a properties list
|
||||
sub DumpProperties($)
|
||||
# parse a properties list
|
||||
sub ParseProperties($)
|
||||
{
|
||||
my($props) = shift;
|
||||
foreach my $d (@{$props}) {
|
||||
@ -26,12 +26,12 @@ sub DumpProperties($)
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump a structure element
|
||||
sub DumpElement($)
|
||||
# parse a structure element
|
||||
sub ParseElement($)
|
||||
{
|
||||
my($element) = shift;
|
||||
(defined $element->{PROPERTIES}) && DumpProperties($element->{PROPERTIES});
|
||||
DumpType($element->{TYPE});
|
||||
(defined $element->{PROPERTIES}) && ParseProperties($element->{PROPERTIES});
|
||||
ParseType($element->{TYPE});
|
||||
$res .= " ";
|
||||
if ($element->{POINTERS}) {
|
||||
for (my($i)=0; $i < $element->{POINTERS}; $i++) {
|
||||
@ -43,14 +43,14 @@ sub DumpElement($)
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump a struct
|
||||
sub DumpStruct($)
|
||||
# parse a struct
|
||||
sub ParseStruct($)
|
||||
{
|
||||
my($struct) = shift;
|
||||
$res .= "struct {\n";
|
||||
if (defined $struct->{ELEMENTS}) {
|
||||
foreach my $e (@{$struct->{ELEMENTS}}) {
|
||||
DumpElement($e);
|
||||
ParseElement($e);
|
||||
$res .= ";\n";
|
||||
}
|
||||
}
|
||||
@ -59,85 +59,85 @@ sub DumpStruct($)
|
||||
|
||||
|
||||
#####################################################################
|
||||
# dump a union element
|
||||
sub DumpUnionElement($)
|
||||
# parse a union element
|
||||
sub ParseUnionElement($)
|
||||
{
|
||||
my($element) = shift;
|
||||
$res .= "[case($element->{CASE})] ";
|
||||
DumpElement($element->{DATA});
|
||||
ParseElement($element->{DATA});
|
||||
$res .= ";\n";
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump a union
|
||||
sub DumpUnion($)
|
||||
# parse a union
|
||||
sub ParseUnion($)
|
||||
{
|
||||
my($union) = shift;
|
||||
(defined $union->{PROPERTIES}) && DumpProperties($union->{PROPERTIES});
|
||||
(defined $union->{PROPERTIES}) && ParseProperties($union->{PROPERTIES});
|
||||
$res .= "union {\n";
|
||||
foreach my $e (@{$union->{DATA}}) {
|
||||
DumpUnionElement($e);
|
||||
ParseUnionElement($e);
|
||||
}
|
||||
$res .= "}";
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump a type
|
||||
sub DumpType($)
|
||||
# parse a type
|
||||
sub ParseType($)
|
||||
{
|
||||
my($data) = shift;
|
||||
if (ref($data) eq "HASH") {
|
||||
($data->{TYPE} eq "STRUCT") &&
|
||||
DumpStruct($data);
|
||||
ParseStruct($data);
|
||||
($data->{TYPE} eq "UNION") &&
|
||||
DumpUnion($data);
|
||||
ParseUnion($data);
|
||||
} else {
|
||||
$res .= "$data";
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump a typedef
|
||||
sub DumpTypedef($)
|
||||
# parse a typedef
|
||||
sub ParseTypedef($)
|
||||
{
|
||||
my($typedef) = shift;
|
||||
$res .= "typedef ";
|
||||
DumpType($typedef->{DATA});
|
||||
ParseType($typedef->{DATA});
|
||||
$res .= " $typedef->{NAME};\n\n";
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump a function
|
||||
sub DumpFunction($)
|
||||
# parse a function
|
||||
sub ParseFunction($)
|
||||
{
|
||||
my($function) = shift;
|
||||
$res .= "/* ignoring function $function->{NAME} */\n";
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# dump the interface definitions
|
||||
sub DumpInterface($)
|
||||
# parse the interface definitions
|
||||
sub ParseInterface($)
|
||||
{
|
||||
my($interface) = shift;
|
||||
my($data) = $interface->{DATA};
|
||||
foreach my $d (@{$data}) {
|
||||
($d->{TYPE} eq "TYPEDEF") &&
|
||||
DumpTypedef($d);
|
||||
ParseTypedef($d);
|
||||
($d->{TYPE} eq "FUNCTION") &&
|
||||
DumpFunction($d);
|
||||
ParseFunction($d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#####################################################################
|
||||
# dump a parsed IDL structure back into an IDL file
|
||||
sub Dump($)
|
||||
# parse a parsed IDL structure back into an IDL file
|
||||
sub Parse($)
|
||||
{
|
||||
my($idl) = shift;
|
||||
$res = "/* parser auto-generated by pidl */\n\n";
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "INTERFACE") &&
|
||||
DumpInterface($x);
|
||||
ParseInterface($x);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user