From c4d6f155e0ad6c3794fd3e7d2fa28e18ee9410b9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 27 Aug 2002 22:38:19 +0000 Subject: * time/time.h (__strptime_l, strptime_l): Declare them. * time/time.h (__strftime_l, strftime_l): Declare them. * wcsmbs/wchar.h (__wcsftime_l, wcsftime_l): Declare them. * time/strftime_l.c: New file. * time/wcsftime_l.c: New file. * time/Makefile (routines): Add strftime_l, wcsftime_l. * time/Versions (libc: GLIBC_2.3): Add __strftime_l, __wcsftime_l, strftime_l, wcsftime_l. --- ChangeLog | 10 ++++++++++ time/Makefile | 8 ++++---- time/Versions | 9 +++++++++ time/strftime_l.c | 22 ++++++++++++++++++++++ time/time.h | 25 +++++++++++++++++++++++-- time/wcsftime_l.c | 22 ++++++++++++++++++++++ wcsmbs/wchar.h | 15 +++++++++++++++ 7 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 time/strftime_l.c create mode 100644 time/wcsftime_l.c diff --git a/ChangeLog b/ChangeLog index ae7c98c..55da607 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2002-08-27 Roland McGrath + * time/time.h (__strptime_l, strptime_l): Declare them. + + * time/time.h (__strftime_l, strftime_l): Declare them. + * wcsmbs/wchar.h (__wcsftime_l, wcsftime_l): Declare them. + * time/strftime_l.c: New file. + * time/wcsftime_l.c: New file. + * time/Makefile (routines): Add strftime_l, wcsftime_l. + * time/Versions (libc: GLIBC_2.3): Add __strftime_l, __wcsftime_l, + strftime_l, wcsftime_l. + * locale/Versions (libc: GLIBC_PRIVATE): Move __uselocale to ... (libc: GLIBC_2.3): ... here. diff --git a/time/Makefile b/time/Makefile index f60dee0..5e55e35 100644 --- a/time/Makefile +++ b/time/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1991-1999,2000,01,02 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -24,12 +24,12 @@ subdir := time headers := time.h sys/time.h sys/timeb.h bits/time.h routines := offtime asctime clock ctime ctime_r difftime \ - gmtime localtime mktime strftime time \ + gmtime localtime mktime time \ gettimeofday settimeofday adjtime tzset \ tzfile getitimer setitimer \ stime dysize timegm ftime \ - strptime getdate wcsftime - + strptime getdate \ + strftime wcsftime strftime_l wcsftime_l distribute := datemsk tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \ diff --git a/time/Versions b/time/Versions index f3bbb4d..616da7e 100644 --- a/time/Versions +++ b/time/Versions @@ -50,4 +50,13 @@ libc { # w* wcsftime; } + GLIBC_2.3 { + # s* + strftime_l; + # w* + wcsftime_l; + + # these internal names are used by libstdc++ + __strftime_l; __wcsftime_l; + } } diff --git a/time/strftime_l.c b/time/strftime_l.c new file mode 100644 index 0000000..c6ecada --- /dev/null +++ b/time/strftime_l.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL 1 +#include + +weak_alias (__strftime_l, strftime_l) diff --git a/time/time.h b/time/time.h index 117bf7b..dd7ce8d 100644 --- a/time/time.h +++ b/time/time.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999,2000,01,02 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -188,6 +188,28 @@ extern char *strptime (__const char *__restrict __s, __THROW; # endif +# ifdef __USE_GNU +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +# include + +extern size_t __strftime_l (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; + +extern char *__strptime_l (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp, + __locale_t __loc) __THROW; +extern char *strptime_l (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp, + __locale_t __loc) __THROW; +# endif + /* Return the `struct tm' representation of *TIMER in Universal Coordinated Time (aka Greenwich Mean Time). */ @@ -358,7 +380,6 @@ extern int getdate_r (__const char *__restrict __string, struct tm *__restrict __resbufp) __THROW; # endif - __END_DECLS #endif /* included. */ diff --git a/time/wcsftime_l.c b/time/wcsftime_l.c new file mode 100644 index 0000000..9692897 --- /dev/null +++ b/time/wcsftime_l.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define USE_IN_EXTENDED_LOCALE_MODEL 1 +#include + +weak_alias (__wcsftime_l, wcsftime_l) diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 6dacb26..777c73a 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -699,6 +699,21 @@ extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, __const wchar_t *__restrict __format, __const struct tm *__restrict __tp) __THROW; +# ifdef __USE_GNU +# include + +/* Similar to `wcsftime' but takes the information from + the provided locale and not the global locale. */ +extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, + __const wchar_t *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; +extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, + __const wchar_t *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; +# endif + /* The X/Open standard demands that most of the functions defined in the header must also appear here. This is probably because some X/Open members wrote their implementation before the -- cgit v1.1