s4-torture: support AES encryption in interactive samlogon tests in rpc.samr.
[Samba/id10ts.git] / pidl / lib / Parse / Pidl / CUtil.pm
blob9deb6ee1779ab3beac27f24ea734b74f8c8f6266
1 ###################################################
2 # C utility functions for pidl
3 # Copyright jelmer@samba.org 2005-2007
4 # released under the GNU GPL
5 package Parse::Pidl::CUtil;
7 require Exporter;
8 @ISA = qw(Exporter);
9 @EXPORT = qw(get_pointer_to get_value_of get_array_element);
10 use vars qw($VERSION);
11 $VERSION = '0.01';
13 use strict;
15 sub get_pointer_to($)
17 my $var_name = shift;
19 if ($var_name =~ /^\*(.*)$/) {
20 return $1;
21 } elsif ($var_name =~ /^\&(.*)$/) {
22 return "&($var_name)";
23 } else {
24 return "&$var_name";
28 sub get_value_of($)
30 my $var_name = shift;
32 if ($var_name =~ /^\&(.*)$/) {
33 return $1;
34 } else {
35 return "*$var_name";
39 sub get_array_element($$)
41 my ($var_name, $idx) = @_;
43 if ($var_name =~ /^\*.*$/) {
44 $var_name = "($var_name)";
45 } elsif ($var_name =~ /^\&.*$/) {
46 $var_name = "($var_name)";
49 return "$var_name"."[$idx]";