Date: Thu, 06 Mar 2003 11:26:58 +0000 From: "Richard Dawe" Sender: rich AT phekda DOT freeserve DOT co DOT uk To: djgpp-workers AT delorie DOT com X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 Subject: New POSIX: _tolower, _toupper [PATCH] Message-Id: Reply-To: djgpp-workers AT delorie DOT com Hello. Below is a patch to add the _tolower and _toupper functions required by new POSIX. OK to commit? Bye, Rich =] Index: include/ctype.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/ctype.h,v retrieving revision 1.3 diff -p -c -3 -r1.3 ctype.h *** include/ctype.h 20 Feb 2003 19:07:47 -0000 1.3 --- include/ctype.h 6 Mar 2003 11:22:04 -0000 *************** int isblank(int c); *** 42,47 **** --- 42,54 ---- #ifndef __STRICT_ANSI__ + int _tolower(int c); + int _toupper(int c); + + #ifndef __dj_ENFORCE_FUNCTION_CALLS + #include + #endif /* !__dj_ENFORCE_FUNCTION_CALLS */ + #ifndef _POSIX_SOURCE int isascii(int c); Index: src/docs/kb/wc204.txi =================================================================== RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v retrieving revision 1.145 diff -p -c -3 -r1.145 wc204.txi *** src/docs/kb/wc204.txi 2 Mar 2003 23:16:37 -0000 1.145 --- src/docs/kb/wc204.txi 6 Mar 2003 11:22:15 -0000 *************** to @code{EBADF}. *** 904,906 **** --- 904,910 ---- @findex perror The function @code{perror} no longer prints a colon and blank if called with a null pointer or a pointer to a null string. + + @findex _tolower + @findex _toupper + The functions @code{_tolower} and @code{_toupper} were added. *** /dev/null Thu Mar 6 11:26:07 2003 --- include/inlines/ctype.hp Wed Mar 5 17:54:04 2003 *************** *** 0 **** --- 1,11 ---- + /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ + #ifndef __dj_include_inline_ctype_hp_ + #define __dj_include_inline_ctype_hp_ + + extern unsigned char __dj_ctype_toupper[]; + extern unsigned char __dj_ctype_tolower[]; + + #define _tolower(c) (__dj_ctype_tolower[(int)(c)+1]) + #define _toupper(c) (__dj_ctype_toupper[(int)(c)+1]) + + #endif /* __dj_include_inline_ctype_hp_ */ *** /dev/null Thu Mar 6 11:26:07 2003 --- src/libc/posix/ctype/makefile Wed Mar 5 17:59:32 2003 *************** *** 0 **** --- 1,7 ---- + # Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details + TOP=../.. + + SRC += _tolower.S + SRC += _toupper.S + + include $(TOP)/../makefile.inc *** /dev/null Thu Mar 6 11:26:07 2003 --- src/libc/posix/ctype/_tolower.S Wed Mar 5 18:42:06 2003 *************** *** 0 **** --- 1,4 ---- + /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ + .global __tolower + __tolower: + jmp _tolower *** /dev/null Thu Mar 6 11:26:07 2003 --- src/libc/posix/ctype/_tolower.txh Wed Mar 5 18:03:26 2003 *************** *** 0 **** --- 1,33 ---- + @c ---------------------------------------------------------------------- + @node _tolower, ctype + @findex _tolower + @subheading Syntax + + @example + #include + + int _tolower(int c); + @end example + + @subheading Description + + This function returns @var{c}, converting it to lower case. For the reverse, + use @code{_toupper} (@pxref{_toupper}). + + This function is like @code{tolower} (@pxref{tolower}), except that + the caller should ensure that @var{c} is upper case. + + @subheading Return Value + + The lower case letter. + + @subheading Portability + + @portability !ansi, posix + + @subheading Example + + @example + for (i=0; buf[i]; i++) + buf[i] = _tolower(buf[i]); + @end example *** /dev/null Thu Mar 6 11:26:07 2003 --- src/libc/posix/ctype/_toupper.S Wed Mar 5 18:42:06 2003 *************** *** 0 **** --- 1,4 ---- + /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ + .global __toupper + __toupper: + jmp _toupper *** /dev/null Thu Mar 6 11:26:07 2003 --- src/libc/posix/ctype/_toupper.txh Wed Mar 5 18:03:36 2003 *************** *** 0 **** --- 1,33 ---- + @c ---------------------------------------------------------------------- + @node _toupper, ctype + @findex _toupper + @subheading Syntax + + @example + #include + + int _toupper(int c); + @end example + + @subheading Description + + This function returns @var{c}, converting it to upper case. For the reverse, + use @code{_tolower} (@pxref{_tolower}). + + This function is like @code{toupper} (@pxref{toupper}), except that + the caller should ensure that @var{c} is lower case. + + @subheading Return Value + + The upper case letter. + + @subheading Portability + + @portability !ansi, posix + + @subheading Example + + @example + for (i=0; buf[i]; i++) + buf[i] = _toupper(buf[i]); + @end example