summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Util.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-27 16:22:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:48 -0500
commitd658de65d32e6746ac51aeb4da7aa74b3da40c2b (patch)
tree3057af6864b3eb0b26d523aa4c100213380551f5 /source4/pidl/lib/Parse/Pidl/Util.pm
parent8270e1e31071d23915cc3aa408ad6c7074ea1c11 (diff)
downloadsamba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.tar.gz
samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.tar.bz2
samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.zip
r12512: Use GUID structs in API functions everywhere rather then converting back and
forth between GUID structs and strings in several places. (This used to be commit 3564e2f967ef72d6301b4f7e9a311cebcded4d75)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Util.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Util.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Util.pm b/source4/pidl/lib/Parse/Pidl/Util.pm
index ec6a1420ab..ff615a21ba 100644
--- a/source4/pidl/lib/Parse/Pidl/Util.pm
+++ b/source4/pidl/lib/Parse/Pidl/Util.pm
@@ -6,7 +6,7 @@ package Parse::Pidl::Util;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str);
+@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str print_uuid);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -75,6 +75,20 @@ sub make_str($)
return "\"" . $str . "\"";
}
+sub print_uuid($)
+{
+ my ($uuid) = @_;
+ $uuid =~ s/"//g;
+ my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid;
+
+ my @clock_seq = $clock_seq =~ /(..)/g;
+ my @node = $node =~ /(..)/g;
+
+ return "{0x$time_low,0x$time_mid,0x$time_hi," .
+ "{".join(',', map {"0x$_"} @clock_seq)."}," .
+ "{".join(',', map {"0x$_"} @node)."}}";
+}
+
# a hack to build on platforms that don't like negative enum values
my $useUintEnums = 0;
sub setUseUintEnums($)