On Saturday, October 01, 2005 at 10:45, Sergey Poznyakoff wrote:
> 
> > Perhaps GNU extensions PRIoSIZE, PRIuSIZE, PRIxSIZE, PRIXSIZE could be
> > added to GNU gettext.  That would mean we could write this instead:
> > 
> >      printf (_("The size is %"PRIuSIZE".\n"), size);
> 
> It would be nice. However, I doubt if it is possible: the string within
> _() will be expanded by preprocessor and glued together by cc itself,
> which means it will result in different literal strings on different
> machines. Gettext will have no means of knowing how exactly is PRIuSIZE
> expanded, so it will not be able to match the msgid.

That is already solved for other PRIxyy-macros by Bruno Haible I think.
This (untested) patch adds support for PRI*SIZE-macros to gettext,
which of course should to be defined somewhere else as well...

Regards

Oskar
diff -u -p loadmsgcat.c.v0 loadmsgcat.c
--- loadmsgcat.c.v0     2005-05-20 22:07:47.000000000 +0200
+++ loadmsgcat.c        2005-10-01 10:47:52.000000000 +0200
@@ -450,6 +450,48 @@ char *alloca ();
    sizeof (void *) == sizeof (int) ? "X" : \
    "llX")
 #endif
+#if !defined PRIdSIZE || PRI_MACROS_BROKEN
+# undef PRIdSIZE
+# define PRIdSIZE \
+  (sizeof (size_t) == sizeof (long) ? "ld" : \
+   sizeof (size_t) == sizeof (int) ? "d" : \
+   "lld")
+#endif
+#if !defined PRIiSIZE || PRI_MACROS_BROKEN
+# undef PRIiSIZE
+# define PRIiSIZE \
+  (sizeof (size_t) == sizeof (long) ? "li" : \
+   sizeof (size_t) == sizeof (int) ? "i" : \
+   "lli")
+#endif
+#if !defined PRIoSIZE || PRI_MACROS_BROKEN
+# undef PRIoSIZE
+# define PRIoSIZE \
+  (sizeof (size_t) == sizeof (long) ? "lo" : \
+   sizeof (size_t) == sizeof (int) ? "o" : \
+   "llo")
+#endif
+#if !defined PRIuSIZE || PRI_MACROS_BROKEN
+# undef PRIuSIZE
+# define PRIuSIZE \
+  (sizeof (size_t) == sizeof (long) ? "lu" : \
+   sizeof (size_t) == sizeof (int) ? "u" : \
+   "llu")
+#endif
+#if !defined PRIxSIZE || PRI_MACROS_BROKEN
+# undef PRIxSIZE
+# define PRIxSIZE \
+  (sizeof (size_t) == sizeof (long) ? "lx" : \
+   sizeof (size_t) == sizeof (int) ? "x" : \
+   "llx")
+#endif
+#if !defined PRIXSIZE || PRI_MACROS_BROKEN
+# undef PRIXSIZE
+# define PRIXSIZE \
+  (sizeof (size_t) == sizeof (long) ? "lX" : \
+   sizeof (size_t) == sizeof (int) ? "X" : \
+   "llX")
+#endif
 
 /* @@ end of prolog @@ */
 
@@ -746,6 +788,23 @@ get_sysdep_segment_value (const char *na
                return PRIXPTR;
              abort ();
            }
+          if (name[4] == 'S' && name[5] == 'I' && name[6] == 'Z'
+              && name[7] == 'E' && name[8] == '\0')
+           {
+             if (name[3] == 'd')
+               return PRIdSIZE;
+             if (name[3] == 'i')
+               return PRIiSIZE;
+             if (name[3] == 'o')
+               return PRIoSIZE;
+             if (name[3] == 'u')
+               return PRIuSIZE;
+             if (name[3] == 'x')
+               return PRIxSIZE;
+             if (name[3] == 'X')
+               return PRIXSIZE;
+             abort ();
+           }
        }
     }
   /* Test for a glibc specific printf() format directive flag.  */
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to