summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/CUtil.pm39
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm27
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm24
3 files changed, 42 insertions, 48 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm
new file mode 100644
index 0000000000..bd7b16812c
--- /dev/null
+++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm
@@ -0,0 +1,39 @@
+###################################################
+# C utility functions for pidl
+# Copyright jelmer@samba.org 2005-2007
+# released under the GNU GPL
+package Parse::Pidl::CUtil;
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(get_pointer_to get_value_of);
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use strict;
+
+sub get_pointer_to($)
+{
+ my $var_name = shift;
+
+ if ($var_name =~ /^\*(.*)$/) {
+ return $1;
+ } elsif ($var_name =~ /^\&(.*)$/) {
+ return "&($var_name)";
+ } else {
+ return "&$var_name";
+ }
+}
+
+sub get_value_of($)
+{
+ my $var_name = shift;
+
+ if ($var_name =~ /^\&(.*)$/) {
+ return $1;
+ } else {
+ return "*$var_name";
+ }
+}
+
+1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 2e9bc0953c..36cc469ff6 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -8,10 +8,11 @@ package Parse::Pidl::Samba4::EJS;
use Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(get_pointer_to get_value_of check_null_pointer fn_declare TypeFunctionName);
+@EXPORT_OK = qw(check_null_pointer fn_declare TypeFunctionName);
use strict;
use Parse::Pidl::Typelist;
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
use Parse::Pidl::Util qw(has_property ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel);
use Parse::Pidl::Samba4::NDR::Parser qw(GenerateStructEnv GenerateFunctionInEnv
@@ -54,30 +55,6 @@ sub deindent($)
$self->{tabs} = substr($self->{tabs}, 0, -1);
}
-sub get_pointer_to($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\*(.*)$/) {
- return $1;
- } elsif ($var_name =~ /^\&(.*)$/) {
- return "&($var_name)";
- } else {
- return "&$var_name";
- }
-}
-
-sub get_value_of($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\&(.*)$/) {
- return $1;
- } else {
- return "*$var_name";
- }
-}
-
#####################################################################
# check that a variable we get from ParseExpr isn't a null pointer
sub check_null_pointer($$)
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index c9b48b017c..a261910c17 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -14,6 +14,7 @@ require Exporter;
use strict;
use Parse::Pidl::Typelist qw(hasType getType mapTypeName);
use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use Parse::Pidl::Samba4 qw(is_intree choose_header);
use Parse::Pidl qw(warning);
@@ -89,29 +90,6 @@ sub is_charset_array($$)
return has_property($e, "charset");
}
-sub get_pointer_to($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\*(.*)$/) {
- return $1;
- } elsif ($var_name =~ /^\&(.*)$/) {
- return "&($var_name)";
- } else {
- return "&$var_name";
- }
-}
-
-sub get_value_of($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\&(.*)$/) {
- return $1;
- } else {
- return "*$var_name";
- }
-}
####################################
# pidl() is our basic output routine