From: Abigail Date: Tue, 15 Aug 2000 04:06:38 +0000 (+0000) Subject: Introduce NVef, NVff, and NVgf, use the middle one. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b4667fc1b974ce7a433cfefaaba43c525667a61;p=p5sagit%2Fp5-mst-13.2.git Introduce NVef, NVff, and NVgf, use the middle one. (helps for lib/peek + Linux + long doubles) Reported in Subject: [ID 20000814.005] Not OK: perl v5.6.0 on i686-linux-64int 2.2.13 Message-Id: <20000815040638.8524.qmail@foad.org> (note: the lib/complex failure has not yet been addressed) p4raw-id: //depot/perl@6685 --- diff --git a/Configure b/Configure index 5fcc8ff..c5d2051 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Thu Aug 17 22:38:49 EET DST 2000 [metaconfig 3.0 PL70] +# Generated on Fri Aug 18 03:43:53 EET DST 2000 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <& 4 exit 1 @@ -15899,6 +15926,12 @@ nm_opt='$nm_opt' nm_so_opt='$nm_so_opt' nonxs_ext='$nonxs_ext' nroff='$nroff' +nvEformat='$nvEformat' +nvFformat='$nvFformat' +nvGformat='$nvGformat' +nveformat='$nveformat' +nvfformat='$nvfformat' +nvgformat='$nvgformat' nvsize='$nvsize' nvtype='$nvtype' o_nonblock='$o_nonblock' @@ -16061,6 +16094,7 @@ usevendorprefix='$usevendorprefix' usevfork='$usevfork' usrinc='$usrinc' uuname='$uuname' +uvXformat='$uvXformat' uvoformat='$uvoformat' uvsize='$uvsize' uvtype='$uvtype' diff --git a/Porting/Glossary b/Porting/Glossary index f289baa..c148f11 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -2749,6 +2749,30 @@ nroff (Loc.U): full pathname (if any) of the nroff program. After Configure runs, the value is reset to a plain "nroff" and is not useful. +nveformat (perlxvf.U): + This variable contains the format string used for printing + a Perl NV using %e-ish floating point format. + +nvEformat (perlxvf.U): + This variable contains the format string used for printing + a Perl NV using %E-ish floating point format. + +nvfformat (perlxvf.U): + This variable confains the format string used for printing + a Perl NV using %f-ish floating point format. + +nvFformat (perlxvf.U): + This variable confains the format string used for printing + a Perl NV using %F-ish floating point format. + +nvgformat (perlxvf.U): + This variable contains the format string used for printing + a Perl NV using %g-ish floating point format. + +nvGformat (perlxvf.U): + This variable contains the format string used for printing + a Perl NV using %G-ish floating point format. + nvsize (perlxv.U): This variable is the size of an NV in bytes. @@ -3585,7 +3609,11 @@ uvuformat (perlxvf.U): uvxformat (perlxvf.U): This variable contains the format string used for printing - a Perl UV as an unsigned hexadecimal integer. + a Perl UV as an unsigned hexadecimal integer in lowercase abcdef. + +uvXformat (perlxvf.U): + This variable contains the format string used for printing + a Perl UV as an unsigned hexadecimal integer in uppercase ABCDEF. vendorarch (vendorarch.U): This variable contains the value of the PERL_VENDORARCH symbol. diff --git a/Porting/config.sh b/Porting/config.sh index a6c619f..004fc8c 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : /m/fs/work/work/permanent/perl/pp4/perl -# Configuration time: Thu Aug 17 02:55:55 EET DST 2000 +# Configuration time: Fri Aug 18 04:57:25 EET DST 2000 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -60,7 +60,7 @@ ccflags_uselargefiles='' ccsymbols='__alpha=1 __LANGUAGE_C__=1 __osf__=1 __unix__=1 _LONGLONG=1 _SYSTYPE_BSD=1 SYSTYPE_BSD=1 unix=1' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Thu Aug 17 02:55:55 EET DST 2000' +cf_time='Fri Aug 18 04:57:25 EET DST 2000' charsize='1' chgrp='' chmod='' @@ -610,6 +610,12 @@ nm_opt='-p' nm_so_opt='' nonxs_ext='Errno' nroff='nroff' +nvEformat='"E"' +nvFformat='"F"' +nvGformat='"G"' +nveformat='"e"' +nvfformat='"f"' +nvgformat='"g"' nvsize='8' nvtype='double' o_nonblock='O_NONBLOCK' @@ -772,6 +778,7 @@ usevendorprefix='undef' usevfork='false' usrinc='/usr/include' uuname='' +uvXformat='"lX"' uvoformat='"lo"' uvsize='8' uvtype='unsigned long' diff --git a/Porting/config_H b/Porting/config_H index 88e7967..7053239 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : /m/fs/work/work/permanent/perl/pp4/perl - * Configuration time: Thu Aug 17 02:55:55 EET DST 2000 + * Configuration time: Fri Aug 18 04:57:25 EET DST 2000 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -2732,12 +2732,27 @@ */ /* UVxf: * This symbol defines the format string used for printing a Perl UV - * as an unsigned hexadecimal integer. + * as an unsigned hexadecimal integer in lowercase abcdef. + */ +/* NVef: + * This symbol defines the format string used for printing a Perl NV + * using %e-ish floating point format. + */ +/* NVff: + * This symbol defines the format string used for printing a Perl NV + * using %f-ish floating point format. + */ +/* NVgf: + * This symbol defines the format string used for printing a Perl NV + * using %g-ish floating point format. */ #define IVdf "ld" /**/ #define UVuf "lu" /**/ #define UVof "lo" /**/ #define UVxf "lx" /**/ +#define NVef "e" /**/ +#define NVff "f" /**/ +#define NVgf "g" /**/ /* Pid_t: * This symbol holds the type used to declare process ids in the kernel. diff --git a/config_h.SH b/config_h.SH index e66e0c5..c186dfd 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2752,12 +2752,27 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ /* UVxf: * This symbol defines the format string used for printing a Perl UV - * as an unsigned hexadecimal integer. + * as an unsigned hexadecimal integer in lowercase abcdef. + */ +/* NVef: + * This symbol defines the format string used for printing a Perl NV + * using %e-ish floating point format. + */ +/* NVff: + * This symbol defines the format string used for printing a Perl NV + * using %f-ish floating point format. + */ +/* NVgf: + * This symbol defines the format string used for printing a Perl NV + * using %g-ish floating point format. */ #define IVdf $ivdformat /**/ #define UVuf $uvuformat /**/ #define UVof $uvoformat /**/ #define UVxf $uvxformat /**/ +#define NVef $nveformat /**/ +#define NVff $nvfformat /**/ +#define NVgf $nvgformat /**/ /* Pid_t: * This symbol holds the type used to declare process ids in the kernel. diff --git a/dump.c b/dump.c index 0037daf..88af6ef 100644 --- a/dump.c +++ b/dump.c @@ -1047,7 +1047,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo theoret = HvKEYS(sv); theoret += theoret * theoret/pow2; PerlIO_putc(file, '\n'); - Perl_dump_indent(aTHX_ level, file, " hash quality = %.1f%%", theoret/sum*100); + Perl_dump_indent(aTHX_ level, file, " hash quality = %.1"NVff"%%", theoret/sum*100); } PerlIO_putc(file, '\n'); Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvKEYS(sv)); diff --git a/perl.h b/perl.h index e5fa988..8276c46 100644 --- a/perl.h +++ b/perl.h @@ -3369,6 +3369,10 @@ typedef struct am_table_short AMTS; I_SYSMMAN Mmap_t + NVef + NVff + NVgf + so that Configure picks them up. */ #endif /* Include guard */ diff --git a/pod/perlguts.pod b/pod/perlguts.pod index f2b4b90..b1cd636 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -1877,18 +1877,26 @@ This function isn't exported out of the Perl core. If you edit F, you will need to run C to force a rebuild of F and other auto-generated files. -=head2 Formatted Printing of IVs and UVs +=head2 Formatted Printing of IVs, UVs, and NVs -If you are printing IVs or UVs instead of the stdio(3) style formatting -codes like C<%d> you should use the following macros for portability +If you are printing IVs, UVs, or NVS instead of the stdio(3) style +formatting codes like C<%d>, C<%ld>, C<%f>, you should use the +following macros for portability IVdf IV in decimal UVuf UV in decimal UVof UV in octal UVxf UV in hexadecimal + NVef NV %e-like + NVff NV %f-like + NVgf NV %g-like -For example: printf("IV is %"IVdf"\n", iv); That will expand -to whatever is the correct format for the IVs. +These will take care of 64-bit integers and long doubles. +For example: + + printf("IV is %"IVdf"\n", iv); + +The IVdf will expand to whatever is the correct format for the IVs. =head2 Source Documentation