This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Continue what #4494 started; introduce uid and gid formats.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 29 Oct 1999 23:36:19 +0000 (23:36 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 29 Oct 1999 23:36:19 +0000 (23:36 +0000)
p4raw-id: //depot/metaconfig@4495

U/a_dvisory/quadtype.U [moved from U/typedefs/quadtype.U with 100% similarity]
U/perl/perlxv.U
U/typedefs/gidf.U [new file with mode: 0644]
U/typedefs/uidf.U [new file with mode: 0644]

similarity index 100%
rename from U/typedefs/quadtype.U
rename to U/a_dvisory/quadtype.U
index 6b9dc9f..e09df72 100644 (file)
@@ -11,7 +11,7 @@
        echo rm use64bits quadtype uquadtype \
        d_longdbl uselongdouble longdblsize doublesize \
        charsize shortsize intsize longsize \
-       cat Compile i_inttypes exe_ext
+       cat Compile i_inttypes exe_ext test
 ?MAKE: -pick add $@ %<
 ?S:ivtype:
 ?S:    This variable contains the C type used for Perl's IV.
@@ -227,64 +227,81 @@ int main() {
   uint32_t u = UINT32_MAX;
   printf("int32_t\n");
 #endif
-#ifdef INT64
-   int64_t i =  INT64_MAX;
-  uint64_t u = UINT64_MAX;
-  printf("int64_t\n");
-#endif
 }
 EOCP
-set try -DINT8
-if eval $compile; then
-       case "`./try$exe_ext`" in
-       int8_t) i8type=int8_t
-               u8type=uint8_t
-               i8size=1
-               u8size=1
+
+case "$i8type" in
+'')    case "$charsize" in
+       1)      i8type=char
+               u8type="unsigned char"
+               i8size=$charsize
+               u8size=$charsize
                ;;
        esac
-fi
+       ;;
+esac
+case "$i8type" in
+'')    set try -DINT8
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int8_t) i8type=int8_t
+                       u8type=uint8_t
+                       i8size=1
+                       u8size=1
+                       ;;
+               esac
+       fi
+       ;;
+esac
 case "$i8type" in
-'')    i8type=char
-       u8type="unsigned char"
-       i8size=$charsize
-       u8size=$charsize
+'')    if $test $charsize -ge 1; then
+               i8type=char
+               u8type="unsigned char"
+               i8size=$charsize
+               u8size=$charsize
+       fi
        ;;
 esac
-set try -DINT16
-if eval $compile; then
-       case "`./try$exe_ext`" in
-       int16_t)
-               i16type=int16_t
-               u16type=uint16_t
-               i16size=2
-               u16size=2
+
+case "$i16type" in
+'')    case "$shortsize" in
+       2)      i16type=short
+               u16type="unsigned short"
+               i16size=$shortsize
+               u16size=$shortsize
                ;;
        esac
-fi
+       ;;
+esac
 case "$i16type" in
-'')    i16type=short
-       u16type="unsigned short"
-       i16size=$shortsize
-       u16size=$shortsize
+'')    set try -DINT16
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int16_t)
+                       i16type=int16_t
+                       u16type=uint16_t
+                       i16size=2
+                       u16size=2
+                       ;;
+               esac
+       fi
        ;;
 esac
-set try -DINT32
-if eval $compile; then
-       case "`./try$exe_ext`" in
-       int32_t)
-               i32type=int32_t
-               u32type=uint32_t
-               i32size=4
-               u32size=4
-               ;;
-       esac
-fi
+case "$i16type" in
+'')    if $test $shortsize -ge 2; then
+               i16type=short
+               u16type="unsigned short"
+               i16size=$shortsize
+               u16size=$shortsize
+       fi
+       ;;
+esac
+
 case "$i32type" in
 '')    case "$longsize" in
        4)      i32type=long
                u32type="unsigned long"
-               i32size=longsize
+               i32size=$longsize
                u32size=$longsize
                ;;
        *)      case "$intsize" in
@@ -298,17 +315,30 @@ case "$i32type" in
        esac
        ;;
 esac
-set try -DINT64
-if eval $compile; then
-       case "`./try$exe_ext`" in
-       int64_t)
-               i64type=int64_t
-               u64type=uint64_t
-               i64size=8
-               u64size=8
-               ;;
-       esac
-fi
+case "$i32type" in
+'')    set try -DINT32
+       if eval $compile; then
+               case "`./try$exe_ext`" in
+               int32_t)
+                       i32type=int32_t
+                       u32type=uint32_t
+                       i32size=4
+                       u32size=4
+                       ;;
+               esac
+       fi
+       ;;
+esac
+case "$i32type" in
+'')    if $test $intsize -ge 4; then
+               i32type=int
+               u32type="unsigned int"
+               i32size=$intsize
+               u32size=$intsize
+       fi
+       ;;
+esac
+
 case "$i64type" in
 '')    case "$quadtype" in
        '')     ;;
diff --git a/U/typedefs/gidf.U b/U/typedefs/gidf.U
new file mode 100644 (file)
index 0000000..9964458
--- /dev/null
@@ -0,0 +1,57 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 1999 Jarkko Hietaniemi
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?MAKE:gidformat: gidsize gidsign ivsize uvsize longsize intsize shortsize \
+       ivdformat uvuformat test
+?MAKE: -pick add $@ %<
+?S:gidformat:
+?S:    This variable contains the format string used for printing a Gid_t.
+?S:.
+?C:Gid_t_f:
+?C:    This symbol defines the format string used for printing a Gid_t.
+?C:.
+?H:#define     Gid_t_f         $gidformat              /**/
+?H:.
+
+echo " "
+$echo "Checking the format string to be used for gids..." >&4
+
+case "$gidsign" in
+-1)    if $test X"$gidsize" = X"$ivsize"; then
+               gidformat="$ivdformat"
+       else
+               if $test X"$gidsize" = X"$longsize"; then
+                       gidformat='"ld"'
+               else
+                       if $test X"$gidsize" = X"$intsize"; then
+                               gidformat='"d"'
+                       else
+                               if $test X"$gidsize" = X"$shortsize"; then
+                                       gidformat='"hd"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+*)     if $test X"$gidsize" = X"$uvsize"; then
+               gidformat="$uvuformat"
+       else
+               if $test X"$gidsize" = X"$longsize"; then
+                       gidformat='"lu"'
+               else
+                       if $test X"$gidsize" = X"$intsize"; then
+                               gidformat='"u"'
+                       else
+                               if $test X"$gidsize" = X"$shortsize"; then
+                                       gidformat='"hu"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+esac
+
diff --git a/U/typedefs/uidf.U b/U/typedefs/uidf.U
new file mode 100644 (file)
index 0000000..4d1d26a
--- /dev/null
@@ -0,0 +1,57 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 1999 Jarkko Hietaniemi
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?MAKE:uidformat: uidsize uidsign ivsize uvsize longsize intsize shortsize \
+       ivdformat uvuformat test
+?MAKE: -pick add $@ %<
+?S:uidformat:
+?S:    This variable contains the format string used for printing a Uid_t.
+?S:.
+?C:Uid_t_f:
+?C:    This symbol defines the format string used for printing a Uid_t.
+?C:.
+?H:#define     Uid_t_f         $uidformat              /**/
+?H:.
+
+echo " "
+$echo "Checking the format string to be used for uids..." >&4
+
+case "$uidsign" in
+-1)    if $test X"$uidsize" = X"$ivsize"; then
+               uidformat="$ivdformat"
+       else
+               if $test X"$uidsize" = X"$longsize"; then
+                       uidformat='"ld"'
+               else
+                       if $test X"$uidsize" = X"$intsize"; then
+                               uidformat='"d"'
+                       else
+                               if $test X"$uidsize" = X"$shortsize"; then
+                                       uidformat='"hd"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+*)     if $test X"$uidsize" = X"$uvsize"; then
+               uidformat="$uvuformat"
+       else
+               if $test X"$uidsize" = X"$longsize"; then
+                       uidformat='"lu"'
+               else
+                       if $test X"$uidsize" = X"$intsize"; then
+                               uidformat='"u"'
+                       else
+                               if $test X"$uidsize" = X"$shortsize"; then
+                                       uidformat='"hu"'
+                               fi
+                       fi
+               fi
+       fi
+       ;;
+esac
+