Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-03-23 20:11:24 +0300
committerChristopher Faylor <me@cgf.cx>2005-03-23 20:11:24 +0300
commit6d89e9dd43b4c3878007d9857ea1e55b19aa0c77 (patch)
tree7ddeba711e7b9d5347ae3f987b42e9e9f9302cd9 /winsup/cygwin
parente633fde1baed0151958929cb630311a22df54cad (diff)
* include/ctype.h: New file.
* ctype.cc: Ditto. * Makefile.in: Add ctype.o to DLL_OFILES. * cygwin.din: Remove _ctype_ptr (for now?).
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/Makefile.in8
-rw-r--r--winsup/cygwin/ctype.cc112
-rw-r--r--winsup/cygwin/include/ctype.h71
4 files changed, 194 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1e6ea30e5..2830a490d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-23 Christopher Faylor <cgf@timesys.com>
+
+ * include/ctype.h: New file.
+ * ctype.cc: Ditto.
+ * Makefile.in: Add ctype.o to DLL_OFILES.
+ * cygwin.din: Remove _ctype_ptr (for now?).
+
2005-03-22 Christopher Faylor <cgf@timesys.com>
* Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 589da2b28..dc6096bdf 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -119,10 +119,10 @@ DLL_IMPORTS:=$(w32api_lib)/libkernel32.a $(w32api_lib)/libadvapi32.a
MT_SAFE_OBJECTS:=
# Please maintain this list in sorted order, with maximum files per 85 col line
#
-DLL_OFILES:=assert.o autoload.o bsdlib.o cxx.o cygheap.o cygthread.o cygtls.o \
- dcrt0.o debug.o delqueue.o devices.o dir.o dlfcn.o dll_init.o dtable.o \
- environ.o errno.o exceptions.o exec.o external.o fcntl.o fhandler.o \
- fhandler_clipboard.o fhandler_console.o fhandler_disk_file.o \
+DLL_OFILES:=assert.o autoload.o bsdlib.o ctype.o cxx.o cygheap.o cygthread.o \
+ cygtls.o dcrt0.o debug.o delqueue.o devices.o dir.o dlfcn.o dll_init.o \
+ dtable.o environ.o errno.o exceptions.o exec.o external.o fcntl.o \
+ fhandler.o fhandler_clipboard.o fhandler_console.o fhandler_disk_file.o \
fhandler_dsp.o fhandler_fifo.o fhandler_floppy.o fhandler_mem.o \
fhandler_nodevice.o fhandler_proc.o fhandler_process.o \
fhandler_random.o fhandler_raw.o fhandler_registry.o fhandler_serial.o \
diff --git a/winsup/cygwin/ctype.cc b/winsup/cygwin/ctype.cc
new file mode 100644
index 000000000..b656d3e08
--- /dev/null
+++ b/winsup/cygwin/ctype.cc
@@ -0,0 +1,112 @@
+#include "winsup.h"
+extern "C" {
+#include <ctype.h>
+
+#define _CTYPE_DATA_0_127 \
+ _C, _C, _C, _C, _C, _C, _C, _C, \
+ _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \
+ _C, _C, _C, _C, _C, _C, _C, _C, \
+ _C, _C, _C, _C, _C, _C, _C, _C, \
+ _S|_B, _P, _P, _P, _P, _P, _P, _P, \
+ _P, _P, _P, _P, _P, _P, _P, _P, \
+ _N, _N, _N, _N, _N, _N, _N, _N, \
+ _N, _N, _P, _P, _P, _P, _P, _P, \
+ _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _P, _P, _P, _P, _P, \
+ _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _P, _P, _P, _P, _C
+
+#define _CTYPE_DATA_128_256 \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0
+
+char ctype_b[128 + 256] = {
+ _CTYPE_DATA_128_256,
+ _CTYPE_DATA_0_127,
+ _CTYPE_DATA_128_256
+};
+
+__asm__ (" \n\
+ .data \n\
+ .globl __ctype_ \n\
+ .set __ctype_,_ctype_b+127 \n\
+ .text \n\
+");
+
+#define makefunc(x) \
+ static int __cdecl \
+ c_##x (int c) \
+ { \
+ return x (c); \
+ } \
+ EXPORT_ALIAS(c_##x, x)
+
+makefunc(isalnum)
+makefunc(isalpha)
+makefunc(iscntrl)
+makefunc(isdigit)
+makefunc(isgraph)
+makefunc(islower)
+makefunc(isprint)
+makefunc(ispunct)
+makefunc(isspace)
+makefunc(isupper)
+makefunc(isxdigit)
+makefunc(tolower)
+makefunc(toupper)
+makefunc(isblank)
+makefunc(isascii)
+makefunc(toascii)
+}
+
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
diff --git a/winsup/cygwin/include/ctype.h b/winsup/cygwin/include/ctype.h
new file mode 100644
index 000000000..8e7983a22
--- /dev/null
+++ b/winsup/cygwin/include/ctype.h
@@ -0,0 +1,71 @@
+#ifndef _CTYPE_H_
+#define _CTYPE_H_
+
+#include <_ansi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __cdecl isalnum(int);
+int __cdecl isalpha(int);
+int __cdecl iscntrl(int);
+int __cdecl isdigit(int);
+int __cdecl isgraph(int);
+int __cdecl islower(int);
+int __cdecl isprint(int);
+int __cdecl ispunct(int);
+int __cdecl isspace(int);
+int __cdecl isupper(int);
+int __cdecl isxdigit(int);
+int __cdecl tolower(int);
+int __cdecl toupper(int);
+
+#ifndef __STRICT_ANSI__
+int __cdecl isblank(int);
+int __cdecl isascii(int);
+int __cdecl toascii(int);
+int __cdecl _tolower(int);
+int __cdecl _toupper(int);
+#endif
+
+#define _U 01
+#define _L 02
+#define _N 04
+#define _S 010
+#define _P 020
+#define _C 040
+#define _X 0100
+#define _B 0200
+
+extern const char _ctype_[];
+
+#ifndef __cplusplus
+#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L))
+#define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U)
+#define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L)
+#define isdigit(c) ((_ctype_+1)[(unsigned)(c)]&_N)
+#define isxdigit(c) ((_ctype_+1)[(unsigned)(c)]&(_X|_N))
+#define isspace(c) ((_ctype_+1)[(unsigned)(c)]&_S)
+#define ispunct(c) ((_ctype_+1)[(unsigned)(c)]&_P)
+#define isalnum(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L|_N))
+#define isprint(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B))
+#define isgraph(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N))
+#define iscntrl(c) ((_ctype_+1)[(unsigned)(c)]&_C)
+/* Non-gcc versions will get the library versions, and will be
+ slightly slower */
+# define toupper(c) \
+ __extension__ ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;})
+# define tolower(c) \
+ __extension__ ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;})
+#endif /* !__cplusplus */
+
+#ifndef __STRICT_ANSI__
+#define isascii(c) ((unsigned)(c)<=0177)
+#define toascii(c) ((c)&0177)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _CTYPE_H_ */