Commit Graph

45 Commits

Author SHA1 Message Date
tjr
b279cbd60c Implement wcwidth() as an inline function. 2004-08-12 12:19:11 +00:00
tjr
bb8f210d8f Mark functions pure where applicable. 2004-07-23 02:29:37 +00:00
tjr
974c154117 Implement the GNU extensions of mbsnrtowcs() and wcsnrtombs(). These are
convenient when the source string isn't null-terminated.

Implement the other conversion functions (mbstowcs(), mbsrtowcs(), wcstombs(),
wcsrtombs()) in terms of these new functions.
2004-07-21 10:54:57 +00:00
tjr
1f2914b133 Add fgetwln(), a wide character version of fgetln(). 2004-07-16 06:06:09 +00:00
tjr
0fa2dbcc73 Fix typo in putwc().
Noticed by:	stefanf
2004-06-07 10:31:10 +00:00
tjr
0d90c920c9 Bring back the macro versions of getwc(), getwchar(), putwc() and
putwchar(), but this time avoid redundantly declaring __stdinp and
__stdoutp when source files include both <stdio.h> and <wchar.h>.
2004-05-27 10:08:44 +00:00
tjr
8a13b6af74 Revert to rev. 1.36 until issues with -Wredundant-decls are sorted out. 2004-05-25 12:41:02 +00:00
tjr
454d85c779 Fix typo in previous: getwc() should call fgetwc(), not the function
version of itself.

Noticed by:	stefanf
2004-05-25 12:02:49 +00:00
tjr
cecb07db45 Provide trivial macro implementations of getwc(), getwchar(), putwc() and
putwchar() to reduce function call overhead.
2004-05-25 10:42:52 +00:00
marcel
c5ea13017b Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
   by virtue of the generated code implicitly widens ints to longs and
   allows the use of an 32-bit integral type for 64-bit arguments.
   Subsequent arguments are passed onto the memory stack, which does
   not exhibit the same behaviour and consequently do not allow this.
   In practice this means that variadic functions taking pointers
   and given NULL (without cast) work as long as the NULL is passed
   in one of the first 8 arguments. A SIGSEGV is more likely the
   result if such would be done for stack-based arguments. This is
   due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
   exception of ia64, allow 32-bit integral types (specifically NULL)
   when 64-bit pointers are expected in variadic functions by way of
   how the compiler generates code. As such, code that works correctly
   (whether rightfully so or not) on any platform other than ia64, may
   fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...
2003-12-07 21:10:06 +00:00
kan
ad52e8fd70 Add definitions for WCHAR_MIN and WCHAR_MAX. 2003-04-28 22:40:05 +00:00
tjr
66304631e5 MFp4: Implementations of the wcstof() and wcstold() functions. 2003-03-13 06:29:53 +00:00
tjr
43c9c8fe43 Correct visibility for v*wscanf(), wcstoll() and wcstoull(). These functions
did not exist in ISO C Amd. 1. Add #ifdef __LONG_LONG_SUPPORTED and lint
comments around wcstoll() and wcstoull().
2002-10-27 11:30:36 +00:00
tjr
3db1855e0f Add a placeholder implementation of wcscoll() and wcsxfrm() which gives
locale-sensitive collation only in single-byte locales, and just does
binary comparison for the others with extended character sets.
2002-10-04 03:18:26 +00:00
tjr
b7083cd58a Remove masking macros for getwc(), putwc(), putwchar() and getwchar().
Although there was nothing wrong with getwc() and putwc(), getwchar()
and putwchar() assumed that <stdio.h> had been included before <wchar.h>,
which is not allowed by the standard.
2002-09-28 07:43:44 +00:00
tjr
a96fc812c3 Add implementations of wscanf() and related functions: fwscanf(), swscanf(),
vfwscanf(), vswscanf(), vwscanf(). As the name suggests, these are wide-
character versions of the scanf() family of functions.
2002-09-23 12:40:06 +00:00
tjr
441dd35939 Add the remaining C99 wide character string to integer conversion functions.
Restrict qualifiers were added to the existing prototypes in <inttypes.h>
and the typedef for wchar_t was removed.
2002-09-22 08:06:45 +00:00
tjr
a399903ed4 Add implementations of the wprintf() family of functions, which perform
formatted wide-character output.
2002-09-21 13:00:30 +00:00
tjr
d4d7777ee9 Restrict visibility of wcslcat() and wcslcpy() to the __BSD_VISIBLE case. 2002-09-21 08:55:16 +00:00
tjr
238ea7422c Add wcstod() as a wrapper around strtod(). It does not handle any characters
that strtod() does not (alternate digit characters, etc. are not handled).
2002-09-15 08:38:51 +00:00
tjr
e63a7cf8b4 Style: tab between #define and macro name. 2002-09-12 23:33:17 +00:00
tjr
69c5d484ee Protect arguments to the putwc and putwchar macros with parens. 2002-09-12 10:27:48 +00:00
tjr
a371cd3f71 Add an implementation of wcsftime() (wide character version of strftime()). 2002-09-11 08:57:11 +00:00
tjr
4d3ff5375a Replace FILE with struct __sFILE in the prototypes for the wide character
I/O functions to avoid having to bring in pollution from <stdio.h>.

Suggested by:	bde
2002-09-10 09:43:28 +00:00
tjr
fbdbd4df50 Remove the typedef of wctype_t from this header; we don't support the
XSI mistake of making everything from <wctype.h> visible here.
If we did choose to support it, we could just #include <wctype.h>.
2002-09-09 07:17:55 +00:00
tjr
6d330c09f5 Add wcstol() and wcstoul(), based on strtol() and strtoul(). 2002-09-08 13:27:26 +00:00
tjr
1da5db1bd1 Add an implementation of wcstok(), based on strtok_r(). 2002-09-07 08:16:57 +00:00
tjr
58ab355dc3 Add restrict qualifiers to wcsstr()'s arguments. 2002-09-07 03:38:13 +00:00
tjr
e841a730a7 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
mike
5d0fbddc4d o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +00:00
tjr
260d9ffb0f Restrict visibility of wcwidth() and wcswidth(); they are XSI extensions. 2002-08-20 22:44:40 +00:00
ache
eee039d5de Sort unsorted prototypes 2002-08-19 21:00:13 +00:00
ache
7b5c1dee36 Activate (uncomment) wcwidth() and wcswidth() now implemented 2002-08-19 20:48:18 +00:00
tjr
a4e0bb4130 Implement the ISO C90 Amd.1 restartable wide and multibyte character
manipulation functions mbrlen(), mbrtowc(), mbsinit(), mbsrtowcs(),
wcrtomb(), wcsrtombs().
2002-08-18 06:30:10 +00:00
tjr
1b489ba271 Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),
putwc(), fputwc(), putwchar(), ungetwc(), fwide().
2002-08-13 09:30:41 +00:00
tjr
1badcfb467 Sort prototypes by function name. 2002-08-06 06:26:06 +00:00
tjr
2d90a237e5 Whitespace formatting changes: line up macro bodies, function names,
place tabs after #define and typedef. Sort typedefs by name.

Requested by:	mike
2002-08-06 05:19:33 +00:00
tjr
20a53a858b Change wctype_t to an unsigned type to avoid warnings. 2002-08-04 12:43:53 +00:00
tjr
ce6de52497 Add ISO C90 Amd. 1 btowc(3) and wctob(3) functions. 2002-08-03 13:49:55 +00:00
tjr
38509edfd6 Add ISO C90 Amd. 1 wctype(3) and iswctype(3) functions. 2002-08-03 04:18:40 +00:00
obrien
177832b30f Don't define wchar_t if we are a C++ compiler.
PR:		31864, 40084
2002-07-09 05:13:30 +00:00
imp
f05b530a33 Breath deep and take __P out of the system include files.
# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.
2002-03-23 17:24:55 +00:00
obrien
8efd48f545 VCS ID fixup 2001-07-10 17:50:46 +00:00
tshiozak
7f404bf2fa adapt to FreeBSD.
- add #define NULL 0 instead of sys/null.h.
- enable locale-insensitive functions:
	wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c
        wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcspbrk.c wcsrchr.c wcsspn.c
	wcsstr.c wmemchr.c wmemcmp.c wmemcpy.c wmemmove.c wmemset.c
- disable some locale-sensitive functions defined in wchar.h temporarily:
	mbrlen mbrtowc mbsinit mbsrtowcs wcrtomb wcsrtombs wcwidth wcswidth
- disable all functions defined in wctype.h temporarily:
	is* tow*
2001-05-15 20:28:48 +00:00
tshiozak
db51613366 initial import of wchar.h and wctype.h
Obtained from:	NetBSD and Citrus XPG4DL
2001-05-15 19:35:57 +00:00