diff options
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Util.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Util.pm | 16 |
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 ec6a1420ab8..ff615a21ba9 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($) |