From: Tassilo von Parseval Date: Fri, 22 Aug 2003 09:01:09 +0000 (+0200) Subject: grok_* symbols missing in Devel::PPPort (2nd attempt) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7dcda43074c71d11cd90211ea44a51a39b19fd4e;p=p5sagit%2Fp5-mst-13.2.git grok_* symbols missing in Devel::PPPort (2nd attempt) Message-id: <20030822070109.GA1029@ethan> p4raw-id: //depot/perl@20819 --- diff --git a/ext/Devel/PPPort/Changes b/ext/Devel/PPPort/Changes index 0f43224..c9abb7e 100755 --- a/ext/Devel/PPPort/Changes +++ b/ext/Devel/PPPort/Changes @@ -1,3 +1,7 @@ +2.004 - 22th August 2003 + + * Added grok_(hex|oct|bin) and related constants + 2.003 - 8th May 2003 * Added get_av, get_cv, get_hv and get_sv diff --git a/ext/Devel/PPPort/PPPort.pm b/ext/Devel/PPPort/PPPort.pm index 02f160a..56c153a 100644 --- a/ext/Devel/PPPort/PPPort.pm +++ b/ext/Devel/PPPort/PPPort.pm @@ -77,6 +77,9 @@ even if available, access to a fixed interface): get_cv get_hv get_sv + grok_hex + grok_oct + grok_bin gv_stashpvn(str,len,flags) INT2PTR(type,int) IVdf @@ -151,7 +154,7 @@ require DynaLoader; use strict; use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $data ); -$VERSION = "2.003"; +$VERSION = "2.004"; @ISA = qw(Exporter DynaLoader); @EXPORT = qw(); @@ -762,6 +765,67 @@ SV *sv; # define get_hv(name,create) perl_get_hv(name,create) #endif +#ifndef PERL_SCAN_GREATER_THAN_UV_MAX +# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 +#endif + +#ifndef PERL_SCAN_SILENT_ILLDIGIT +# define PERL_SCAN_SILENT_ILLDIGIT 0x04 +#endif + +#ifndef PERL_SCAN_ALLOW_UNDERSCORES +# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 +#endif + +#ifndef PERL_SCAN_DISALLOW_PREFIX +# define PERL_SCAN_DISALLOW_PREFIX 0x02 +#endif + +#ifndef grok_hex +static UV _grok_hex (char *string, STRLEN *len, I32 *flags, NV *result) { + NV r = scan_hex(string, *len, len); + if (r > UV_MAX) { + *flags |= PERL_SCAN_GREATER_THAN_UV_MAX; + if (result) *result = r; + return UV_MAX; + } + return (UV)r; +} + +# define grok_hex(string, len, flags, result) \ + _grok_hex((string), (len), (flags), (result)) +#endif + +#ifndef grok_oct +static UV _grok_oct (char *string, STRLEN *len, I32 *flags, NV *result) { + NV r = scan_oct(string, *len, len); + if (r > UV_MAX) { + *flags |= PERL_SCAN_GREATER_THAN_UV_MAX; + if (result) *result = r; + return UV_MAX; + } + return (UV)r; +} + +# define grok_oct(string, len, flags, result) \ + _grok_oct((string), (len), (flags), (result)) +#endif + +#ifndef grok_bin +static UV _grok_bin (char *string, STRLEN *len, I32 *flags, NV *result) { + NV r = scan_bin(string, *len, len); + if (r > UV_MAX) { + *flags |= PERL_SCAN_GREATER_THAN_UV_MAX; + if (result) *result = r; + return UV_MAX; + } + return (UV)r; +} + +# define grok_bin(string, len, flags, result) \ + _grok_bin((string), (len), (flags), (result)) +#endif + #endif /* _P_P_PORTABILITY_H_ */ /* End of File ppport.h */ diff --git a/ext/Devel/PPPort/t/test.t b/ext/Devel/PPPort/t/test.t index 82af5e9..95b3055 100644 --- a/ext/Devel/PPPort/t/test.t +++ b/ext/Devel/PPPort/t/test.t @@ -99,3 +99,7 @@ get_cv get_av get_hv get_sv + +grok_hex +grok_oct +grok_bin