diff options
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/CUtil.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/CUtil.pm | 39 |
1 files changed, 39 insertions, 0 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; |