URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/or1k/trunk/newlib-1.10.0/newlib/libc/ctype
- from Rev 1005 to Rev 1765
- ↔ Reverse comparison
Rev 1005 → Rev 1765
/toupper.c
0,0 → 1,54
/* |
FUNCTION |
<<toupper>>---translate characters to upper case |
|
INDEX |
toupper |
INDEX |
_toupper |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int toupper(int <[c]>); |
int _toupper(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int toupper(<[c]>); |
int _toupper(<[c]>); |
|
|
DESCRIPTION |
<<toupper>> is a macro which converts lower-case characters to upper |
case, leaving all other characters unchanged. It is only defined when |
<[c]> is an integer in the range <<EOF>> to <<255>>. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining this macro using `<<#undef toupper>>'. |
|
<<_toupper>> performs the same conversion as <<toupper>>, but should |
only be used when <[c]> is known to be a lowercase character (<<a>>--<<z>>). |
|
RETURNS |
<<toupper>> returns the upper-case equivalent of <[c]> when it is a |
character between <<a>> and <<z>>, and <[c]> otherwise. |
|
<<_toupper>> returns the upper-case equivalent of <[c]> when it is a |
character between <<a>> and <<z>>. If <[c]> is not one of these |
characters, the behaviour of <<_toupper>> is undefined. |
|
PORTABILITY |
<<toupper>> is ANSI C. <<_toupper>> is not recommended for portable programs. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
#undef toupper |
int |
_DEFUN(toupper,(c),int c) |
{ |
return islower(c) ? c - 'a' + 'A' : c; |
} |
/Makefile.in
0,0 → 1,406
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
|
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
# PARTICULAR PURPOSE. |
|
|
|
SHELL = @SHELL@ |
|
srcdir = @srcdir@ |
top_srcdir = @top_srcdir@ |
VPATH = @srcdir@ |
prefix = @prefix@ |
exec_prefix = @exec_prefix@ |
|
bindir = @bindir@ |
sbindir = @sbindir@ |
libexecdir = @libexecdir@ |
datadir = @datadir@ |
sysconfdir = @sysconfdir@ |
sharedstatedir = @sharedstatedir@ |
localstatedir = @localstatedir@ |
libdir = @libdir@ |
infodir = @infodir@ |
mandir = @mandir@ |
includedir = @includedir@ |
oldincludedir = /usr/include |
|
DESTDIR = |
|
pkgdatadir = $(datadir)/@PACKAGE@ |
pkglibdir = $(libdir)/@PACKAGE@ |
pkgincludedir = $(includedir)/@PACKAGE@ |
|
top_builddir = .. |
|
ACLOCAL = @ACLOCAL@ |
AUTOCONF = @AUTOCONF@ |
AUTOMAKE = @AUTOMAKE@ |
AUTOHEADER = @AUTOHEADER@ |
|
INSTALL = @INSTALL@ |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) |
INSTALL_DATA = @INSTALL_DATA@ |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
transform = @program_transform_name@ |
|
NORMAL_INSTALL = : |
PRE_INSTALL = : |
POST_INSTALL = : |
NORMAL_UNINSTALL = : |
PRE_UNINSTALL = : |
POST_UNINSTALL = : |
host_alias = @host_alias@ |
host_triplet = @host@ |
AR = @AR@ |
AS = @AS@ |
CC = @CC@ |
CPP = @CPP@ |
CRT0 = @CRT0@ |
DLLTOOL = @DLLTOOL@ |
EXEEXT = @EXEEXT@ |
LDFLAGS = @LDFLAGS@ |
LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@ |
LIBC_POSIX_LIB = @LIBC_POSIX_LIB@ |
LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@ |
LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@ |
LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@ |
LIBC_SYS_LIB = @LIBC_SYS_LIB@ |
LIBC_UNIX_LIB = @LIBC_UNIX_LIB@ |
LIBTOOL = @LIBTOOL@ |
LN_S = @LN_S@ |
MAINT = @MAINT@ |
MAKEINFO = @MAKEINFO@ |
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ |
OBJDUMP = @OBJDUMP@ |
PACKAGE = @PACKAGE@ |
RANLIB = @RANLIB@ |
VERSION = @VERSION@ |
aext = @aext@ |
libm_machine_dir = @libm_machine_dir@ |
machine_dir = @machine_dir@ |
newlib_basedir = @newlib_basedir@ |
oext = @oext@ |
sys_dir = @sys_dir@ |
|
AUTOMAKE_OPTIONS = cygnus |
|
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) |
|
LIB_SOURCES = \ |
ctype_.c \ |
isalnum.c \ |
isalpha.c \ |
isascii.c \ |
iscntrl.c \ |
isdigit.c \ |
islower.c \ |
isupper.c \ |
isprint.c \ |
ispunct.c \ |
isspace.c \ |
isxdigit.c \ |
toascii.c \ |
tolower.c \ |
toupper.c \ |
_tolower.c \ |
_toupper.c |
|
|
libctype_la_LDFLAGS = -Xcompiler -nostdlib |
|
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libctype.la |
@USE_LIBTOOL_TRUE@libctype_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) |
@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in |
@USE_LIBTOOL_FALSE@noinst_DATA = |
@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a |
@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) |
|
CHEWOUT_FILES = \ |
isalnum.def \ |
isalpha.def \ |
isascii.def \ |
iscntrl.def \ |
isdigit.def \ |
islower.def \ |
isprint.def \ |
ispunct.def \ |
isspace.def \ |
isupper.def \ |
isxdigit.def \ |
toascii.def \ |
tolower.def \ |
toupper.def |
|
|
SUFFIXES = .def |
|
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str |
|
TARGETDOC = ../tmp.texi |
|
CLEANFILES = $(CHEWOUT_FILES) *.ref |
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs |
CONFIG_CLEAN_FILES = |
LIBRARIES = $(noinst_LIBRARIES) |
|
|
DEFS = @DEFS@ -I. -I$(srcdir) |
CPPFLAGS = @CPPFLAGS@ |
LIBS = @LIBS@ |
lib_a_LIBADD = |
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = ctype_.o isalnum.o isalpha.o \ |
@USE_LIBTOOL_FALSE@isascii.o iscntrl.o isdigit.o islower.o isupper.o \ |
@USE_LIBTOOL_FALSE@isprint.o ispunct.o isspace.o isxdigit.o toascii.o \ |
@USE_LIBTOOL_FALSE@tolower.o toupper.o _tolower.o _toupper.o |
LTLIBRARIES = $(noinst_LTLIBRARIES) |
|
libctype_la_LIBADD = |
@USE_LIBTOOL_TRUE@libctype_la_OBJECTS = ctype_.lo isalnum.lo isalpha.lo \ |
@USE_LIBTOOL_TRUE@isascii.lo iscntrl.lo isdigit.lo islower.lo \ |
@USE_LIBTOOL_TRUE@isupper.lo isprint.lo ispunct.lo isspace.lo \ |
@USE_LIBTOOL_TRUE@isxdigit.lo toascii.lo tolower.lo toupper.lo \ |
@USE_LIBTOOL_TRUE@_tolower.lo _toupper.lo |
CFLAGS = @CFLAGS@ |
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
CCLD = $(CC) |
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ |
DATA = $(noinst_DATA) |
|
DIST_COMMON = Makefile.am Makefile.in |
|
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) |
|
TAR = gtar |
GZIP_ENV = --best |
SOURCES = $(lib_a_SOURCES) $(libctype_la_SOURCES) |
OBJECTS = $(lib_a_OBJECTS) $(libctype_la_OBJECTS) |
|
all: all-redirect |
.SUFFIXES: |
.SUFFIXES: .S .c .def .lo .o .s |
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../Makefile.shared |
cd $(top_srcdir) && $(AUTOMAKE) --cygnus ctype/Makefile |
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
cd $(top_builddir) \ |
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status |
|
|
mostlyclean-noinstLIBRARIES: |
|
clean-noinstLIBRARIES: |
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) |
|
distclean-noinstLIBRARIES: |
|
maintainer-clean-noinstLIBRARIES: |
|
.c.o: |
$(COMPILE) -c $< |
|
.s.o: |
$(COMPILE) -c $< |
|
.S.o: |
$(COMPILE) -c $< |
|
mostlyclean-compile: |
-rm -f *.o core *.core |
|
clean-compile: |
|
distclean-compile: |
-rm -f *.tab.c |
|
maintainer-clean-compile: |
|
.c.lo: |
$(LIBTOOL) --mode=compile $(COMPILE) -c $< |
|
.s.lo: |
$(LIBTOOL) --mode=compile $(COMPILE) -c $< |
|
.S.lo: |
$(LIBTOOL) --mode=compile $(COMPILE) -c $< |
|
mostlyclean-libtool: |
-rm -f *.lo |
|
clean-libtool: |
-rm -rf .libs _libs |
|
distclean-libtool: |
|
maintainer-clean-libtool: |
|
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) |
-rm -f lib.a |
$(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) |
$(RANLIB) lib.a |
|
mostlyclean-noinstLTLIBRARIES: |
|
clean-noinstLTLIBRARIES: |
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) |
|
distclean-noinstLTLIBRARIES: |
|
maintainer-clean-noinstLTLIBRARIES: |
|
libctype.la: $(libctype_la_OBJECTS) $(libctype_la_DEPENDENCIES) |
$(LINK) $(libctype_la_LDFLAGS) $(libctype_la_OBJECTS) $(libctype_la_LIBADD) $(LIBS) |
|
tags: TAGS |
|
ID: $(HEADERS) $(SOURCES) $(LISP) |
list='$(SOURCES) $(HEADERS)'; \ |
unique=`for i in $$list; do echo $$i; done | \ |
awk ' { files[$$0] = 1; } \ |
END { for (i in files) print i; }'`; \ |
here=`pwd` && cd $(srcdir) \ |
&& mkid -f$$here/ID $$unique $(LISP) |
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) |
tags=; \ |
here=`pwd`; \ |
list='$(SOURCES) $(HEADERS)'; \ |
unique=`for i in $$list; do echo $$i; done | \ |
awk ' { files[$$0] = 1; } \ |
END { for (i in files) print i; }'`; \ |
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ |
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) |
|
mostlyclean-tags: |
|
clean-tags: |
|
distclean-tags: |
-rm -f TAGS ID |
|
maintainer-clean-tags: |
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) |
|
subdir = ctype |
|
distdir: $(DISTFILES) |
@for file in $(DISTFILES); do \ |
if test -f $$file; then d=.; else d=$(srcdir); fi; \ |
if test -d $$d/$$file; then \ |
cp -pr $$d/$$file $(distdir)/$$file; \ |
else \ |
test -f $(distdir)/$$file \ |
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ |
|| cp -p $$d/$$file $(distdir)/$$file || :; \ |
fi; \ |
done |
info-am: |
info: info-am |
dvi-am: |
dvi: dvi-am |
check-am: |
check: check-am |
installcheck-am: |
installcheck: installcheck-am |
install-info-am: |
install-info: install-info-am |
install-exec-am: |
install-exec: install-exec-am |
|
install-data-am: |
install-data: install-data-am |
|
install-am: all-am |
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
install: install-am |
uninstall-am: |
uninstall: uninstall-am |
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) |
all-redirect: all-am |
install-strip: |
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install |
installdirs: |
|
|
mostlyclean-generic: |
|
clean-generic: |
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) |
|
distclean-generic: |
-rm -f Makefile $(CONFIG_CLEAN_FILES) |
-rm -f config.cache config.log stamp-h stamp-h[0-9]* |
|
maintainer-clean-generic: |
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ |
mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ |
mostlyclean-tags mostlyclean-generic |
|
mostlyclean: mostlyclean-am |
|
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ |
clean-noinstLTLIBRARIES clean-tags clean-generic \ |
mostlyclean-am |
|
clean: clean-am |
|
distclean-am: distclean-noinstLIBRARIES distclean-compile \ |
distclean-libtool distclean-noinstLTLIBRARIES \ |
distclean-tags distclean-generic clean-am |
-rm -f libtool |
|
distclean: distclean-am |
|
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ |
maintainer-clean-compile maintainer-clean-libtool \ |
maintainer-clean-noinstLTLIBRARIES \ |
maintainer-clean-tags maintainer-clean-generic \ |
distclean-am |
@echo "This command is intended for maintainers to use;" |
@echo "it deletes files that may require special tools to rebuild." |
|
maintainer-clean: maintainer-clean-am |
|
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ |
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ |
mostlyclean-compile distclean-compile clean-compile \ |
maintainer-clean-compile mostlyclean-libtool distclean-libtool \ |
clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ |
distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ |
maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ |
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ |
check-am installcheck-am installcheck install-info-am install-info \ |
install-exec-am install-exec install-data-am install-data install-am \ |
install uninstall-am uninstall all-redirect all-am all installdirs \ |
mostlyclean-generic distclean-generic clean-generic \ |
maintainer-clean-generic clean mostlyclean distclean maintainer-clean |
|
|
objectlist.awk.in: $(noinst_LTLIBRARIES) |
-rm -f objectlist.awk.in |
for i in `ls *.lo` ; \ |
do \ |
echo $$i `pwd`/$$i >> objectlist.awk.in ; \ |
done |
|
.c.def: |
$(CHEW) < $< > $*.def 2> $*.ref |
touch stmp-def |
|
doc: $(CHEWOUT_FILES) |
cat $(srcdir)/ctype.tex >> $(TARGETDOC) |
|
# Tell versions [3.59,3.63) of GNU make to not export all variables. |
# Otherwise a system limit (for SysV at least) may be exceeded. |
.NOEXPORT: |
/ctype.tex
0,0 → 1,68
@node Ctype |
@chapter Character Type Macros and Functions (@file{ctype.h}) |
This chapter groups macros (which are also available as subroutines) |
to classify characters into several categories (alphabetic, |
numeric, control characters, whitespace, and so on), or to perform |
simple character mappings. |
|
The header file @file{ctype.h} defines the macros. |
@menu |
* isalnum:: Alphanumeric character predicate |
* isalpha:: Alphabetic character predicate |
* isascii:: ASCII character predicate |
* iscntrl:: Control character predicate |
* isdigit:: Decimal digit predicate |
* islower:: Lower-case character predicate |
* isprint:: Printable character predicates (isprint, isgraph) |
* ispunct:: Punctuation character predicate |
* isspace:: Whitespace character predicate |
* isupper:: Uppercase character predicate |
* isxdigit:: Hexadecimal digit predicate |
* toascii:: Force integers to ASCII range |
* tolower:: Translate characters to lower case |
* toupper:: Translate characters to upper case |
@end menu |
|
@page |
@include ctype/isalnum.def |
|
@page |
@include ctype/isalpha.def |
|
@page |
@include ctype/isascii.def |
|
@page |
@include ctype/iscntrl.def |
|
@page |
@include ctype/isdigit.def |
|
@page |
@include ctype/islower.def |
|
@page |
@include ctype/isprint.def |
|
@page |
@include ctype/ispunct.def |
|
@page |
@include ctype/isspace.def |
|
@page |
@include ctype/isupper.def |
|
@page |
@include ctype/isxdigit.def |
|
@page |
@include ctype/toascii.def |
|
@page |
@include ctype/tolower.def |
|
@page |
@include ctype/toupper.def |
|
|
/isalnum.c
0,0 → 1,46
/* |
FUNCTION |
<<isalnum>>---alphanumeric character predicate |
|
INDEX |
isalnum |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isalnum(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isalnum(<[c]>); |
|
|
DESCRIPTION |
<<isalnum>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for alphabetic or |
numeric ASCII characters, and <<0>> for other arguments. It is defined |
for all integer values. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isalnum>>'. |
|
RETURNS |
<<isalnum>> returns non-zero if <[c]> is a letter (<<a>>--<<z>> or |
<<A>>--<<Z>>) or a digit (<<0>>--<<9>>). |
|
PORTABILITY |
<<isalnum>> is ANSI C. |
|
No OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
#undef isalnum |
|
int |
_DEFUN(isalnum,(c),int c) |
{ |
return((_ctype_ + 1)[c] & (_U|_L|_N)); |
} |
|
/iscntrl.c
0,0 → 1,48
|
/* |
FUNCTION |
<<iscntrl>>---control character predicate |
|
INDEX |
iscntrl |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int iscntrl(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int iscntrl(<[c]>); |
|
DESCRIPTION |
<<iscntrl>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for control characters, and 0 |
for other characters. It is defined only when <<isascii>>(<[c]>) is |
true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef iscntrl>>'. |
|
RETURNS |
<<iscntrl>> returns non-zero if <[c]> is a delete character or ordinary |
control character (<<0x7F>> or <<0x00>>--<<0x1F>>). |
|
PORTABILITY |
<<iscntrl>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
|
|
#undef iscntrl |
int |
_DEFUN(iscntrl,(c),int c) |
{ |
return((_ctype_ + 1)[c] & _C); |
} |
|
|
/isalpha.c
0,0 → 1,44
/* |
FUNCTION |
<<isalpha>>---alphabetic character predicate |
|
INDEX |
isalpha |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isalpha(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isalpha(<[c]>); |
|
DESCRIPTION |
<<isalpha>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero when <[c]> represents an |
alphabetic ASCII character, and 0 otherwise. It is defined only when |
<<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isalpha>>'. |
|
RETURNS |
<<isalpha>> returns non-zero if <[c]> is a letter (<<A>>--<<Z>> or |
<<a>>--<<z>>). |
|
PORTABILITY |
<<isalpha>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
#undef isalpha |
int |
_DEFUN(isalpha,(c),int c) |
{ |
return((_ctype_ + 1)[c] & (_U|_L)); |
} |
|
/ctype_.c
0,0 → 1,108
/* |
* 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. |
*/ |
|
#if defined(LIBC_SCCS) && !defined(lint) |
static char sccsid[] = "@(#)ctype_.c 5.6 (Berkeley) 6/1/90"; |
#endif /* LIBC_SCCS and not lint */ |
|
#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 |
|
#if defined(__GNUC__) && !defined(__CHAR_UNSIGNED__) && !defined(COMPACT_CTYPE) |
#define ALLOW_NEGATIVE_CTYPE_INDEX |
#endif |
|
#if defined(ALLOW_NEGATIVE_CTYPE_INDEX) |
static _CONST char _ctype_b[128 + 256] = { |
_CTYPE_DATA_128_256, |
_CTYPE_DATA_0_127, |
_CTYPE_DATA_128_256 |
}; |
|
#if defined(__CYGWIN__) || defined(__CYGWIN32__) |
extern _CONST char __declspec(dllexport) _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127"))); |
_CONST char __declspec(dllexport) *__ctype_ptr = _ctype_b + 128; |
#else |
extern _CONST char _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127"))); |
_CONST char *__ctype_ptr = _ctype_b + 128; |
#endif |
|
#else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */ |
|
#if defined(__CYGWIN__) || defined(__CYGWIN32__) |
_CONST char __declspec(dllexport) _ctype_[1 + 256] = { |
#else |
_CONST char _ctype_[1 + 256] = { |
#endif |
0, |
_CTYPE_DATA_0_127, |
_CTYPE_DATA_128_256 |
}; |
|
_CONST char *__ctype_ptr = _ctype_ + 1; |
#endif |
/islower.c
0,0 → 1,43
|
/* |
FUNCTION |
<<islower>>---lower-case character predicate |
|
INDEX |
islower |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int islower(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int islower(<[c]>); |
|
DESCRIPTION |
<<islower>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for minuscules |
(lower-case alphabetic characters), and 0 for other characters. |
It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef islower>>'. |
|
RETURNS |
<<islower>> returns non-zero if <[c]> is a lower case letter (<<a>>--<<z>>). |
|
PORTABILITY |
<<islower>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
#include <_ansi.h> |
#include <ctype.h> |
|
#undef islower |
int |
_DEFUN(islower,(c),int c) |
{ |
return((_ctype_ + 1)[c] & _L); |
} |
|
/isascii.c
0,0 → 1,43
/* |
FUNCTION |
<<isascii>>---ASCII character predicate |
|
INDEX |
isascii |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isascii(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isascii(<[c]>); |
|
DESCRIPTION |
<<isascii>> is a macro which returns non-zero when <[c]> is an ASCII |
character, and 0 otherwise. It is defined for all integer values. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isascii>>'. |
|
RETURNS |
<<isascii>> returns non-zero if the low order byte of <[c]> is in the range |
0 to 127 (<<0x00>>--<<0x7F>>). |
|
PORTABILITY |
<<isascii>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
#include <_ansi.h> |
#include <ctype.h> |
|
|
|
#undef isascii |
|
int |
_DEFUN(isascii,(c),int c) |
{ |
return c >= 0 && c< 128; |
} |
/isxdigit.c
0,0 → 1,45
|
/* |
FUNCTION |
<<isxdigit>>---hexadecimal digit predicate |
|
INDEX |
isxdigit |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isxdigit(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isxdigit(int <[c]>); |
|
DESCRIPTION |
<<isxdigit>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for hexadecimal digits, |
and <<0>> for other characters. It is defined only when |
<<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isxdigit>>'. |
|
RETURNS |
<<isxdigit>> returns non-zero if <[c]> is a hexadecimal digit |
(<<0>>--<<9>>, <<a>>--<<f>>, or <<A>>--<<F>>). |
|
PORTABILITY |
<<isxdigit>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
#include <_ansi.h> |
#include <ctype.h> |
|
|
#undef isxdigit |
int |
_DEFUN(isxdigit,(c),int c) |
{ |
return((_ctype_ + 1)[c] & ((_X)|(_N))); |
} |
|
/ispunct.c
0,0 → 1,46
|
/* |
FUNCTION |
<<ispunct>>---punctuation character predicate |
|
INDEX |
ispunct |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int ispunct(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int ispunct(<[c]>); |
|
DESCRIPTION |
<<ispunct>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for printable |
punctuation characters, and 0 for other characters. It is defined |
only when <<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef ispunct>>'. |
|
RETURNS |
<<ispunct>> returns non-zero if <[c]> is a printable punctuation character |
(<<isgraph(<[c]>) && !isalnum(<[c]>)>>). |
|
PORTABILITY |
<<ispunct>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
|
#undef ispunct |
int |
_DEFUN(ispunct,(c),int c) |
{ |
return((_ctype_ + 1)[c] & _P); |
} |
|
/isupper.c
0,0 → 1,43
|
/* |
FUNCTION |
<<isupper>>---uppercase character predicate |
|
INDEX |
isupper |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isupper(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isupper(<[c]>); |
|
DESCRIPTION |
<<isupper>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for upper-case letters |
(<<A>>--<<Z>>), and 0 for other characters. It is defined only when |
<<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isupper>>'. |
|
RETURNS |
<<isupper>> returns non-zero if <[c]> is a upper case letter (A-Z). |
|
PORTABILITY |
<<isupper>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
#include <_ansi.h> |
#include <ctype.h> |
|
#undef isupper |
int |
_DEFUN(isupper,(c),int c) |
{ |
return((_ctype_ + 1)[c] & _U); |
} |
|
/isspace.c
0,0 → 1,44
|
/* |
FUNCTION |
<<isspace>>---whitespace character predicate |
|
INDEX |
isspace |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isspace(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isspace(<[c]>); |
|
DESCRIPTION |
<<isspace>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for whitespace |
characters, and 0 for other characters. It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isspace>>'. |
|
RETURNS |
<<isspace>> returns non-zero if <[c]> is a space, tab, carriage return, new |
line, vertical tab, or formfeed (<<0x09>>--<<0x0D>>, <<0x20>>). |
|
PORTABILITY |
<<isspace>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
#include <_ansi.h> |
#include <ctype.h> |
|
|
#undef isspace |
int |
_DEFUN(isspace,(c),int c) |
{ |
return((_ctype_ + 1)[c] & _S); |
} |
|
/isprint.c
0,0 → 1,60
|
/* |
FUNCTION |
<<isprint>>, <<isgraph>>---printable character predicates |
|
INDEX |
isprint |
INDEX |
isgraph |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isprint(int <[c]>); |
int isgraph(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isprint(<[c]>); |
int isgraph(<[c]>); |
|
|
DESCRIPTION |
<<isprint>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for printable |
characters, and 0 for other character arguments. |
It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining either macro using `<<#undef isprint>>' or `<<#undef isgraph>>'. |
|
RETURNS |
<<isprint>> returns non-zero if <[c]> is a printing character, |
(<<0x20>>--<<0x7E>>). |
<<isgraph>> behaves identically to <<isprint>>, except that the space |
character (<<0x20>>) is excluded. |
|
PORTABILITY |
<<isprint>> and <<isgraph>> are ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
#undef isgraph |
int |
_DEFUN(isgraph,(c),int c) |
{ |
return((_ctype_ + 1)[c] & (_P|_U|_L|_N)); |
} |
|
|
#undef isprint |
int |
_DEFUN(isprint,(c),int c) |
{ |
return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B)); |
} |
|
/Makefile.am
0,0 → 1,69
## Process this file with automake to generate Makefile.in |
|
AUTOMAKE_OPTIONS = cygnus |
|
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) |
|
LIB_SOURCES = \ |
ctype_.c \ |
isalnum.c \ |
isalpha.c \ |
isascii.c \ |
iscntrl.c \ |
isdigit.c \ |
islower.c \ |
isupper.c \ |
isprint.c \ |
ispunct.c \ |
isspace.c \ |
isxdigit.c \ |
toascii.c \ |
tolower.c \ |
toupper.c \ |
_tolower.c \ |
_toupper.c |
|
libctype_la_LDFLAGS = -Xcompiler -nostdlib |
|
if USE_LIBTOOL |
noinst_LTLIBRARIES = libctype.la |
libctype_la_SOURCES = $(LIB_SOURCES) |
noinst_DATA = objectlist.awk.in |
else |
noinst_LIBRARIES = lib.a |
lib_a_SOURCES = $(LIB_SOURCES) |
noinst_DATA = |
endif # USE_LIBTOOL |
|
include $(srcdir)/../../Makefile.shared |
|
CHEWOUT_FILES= \ |
isalnum.def \ |
isalpha.def \ |
isascii.def \ |
iscntrl.def \ |
isdigit.def \ |
islower.def \ |
isprint.def \ |
ispunct.def \ |
isspace.def \ |
isupper.def \ |
isxdigit.def \ |
toascii.def \ |
tolower.def \ |
toupper.def |
|
SUFFIXES = .def |
|
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str |
|
.c.def: |
$(CHEW) < $< > $*.def 2> $*.ref |
touch stmp-def |
|
TARGETDOC = ../tmp.texi |
|
doc: $(CHEWOUT_FILES) |
cat $(srcdir)/ctype.tex >> $(TARGETDOC) |
|
CLEANFILES = $(CHEWOUT_FILES) *.ref |
/_tolower.c
0,0 → 1,9
#include <_ansi.h> |
#include <ctype.h> |
|
#undef _tolower |
int |
_DEFUN(_tolower,(c),int c) |
{ |
return isupper(c) ? (c) - 'A' + 'a' : c; |
} |
/toascii.c
0,0 → 1,41
/* |
FUNCTION |
<<toascii>>---force integers to ASCII range |
|
INDEX |
toascii |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int toascii(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int toascii(<[c]>); |
int (<[c]>); |
|
DESCRIPTION |
<<toascii>> is a macro which coerces integers to the ASCII range (0--127) by zeroing any higher-order bits. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining this macro using `<<#undef toascii>>'. |
|
RETURNS |
<<toascii>> returns integers between 0 and 127. |
|
PORTABILITY |
<<toascii>> is not ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
#undef toascii |
|
int |
_DEFUN(toascii,(c),int c) |
{ |
return (c)&0177; |
} |
|
/tolower.c
0,0 → 1,55
/* |
FUNCTION |
<<tolower>>---translate characters to lower case |
|
INDEX |
tolower |
INDEX |
_tolower |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int tolower(int <[c]>); |
int _tolower(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int tolower(<[c]>); |
int _tolower(<[c]>); |
|
|
DESCRIPTION |
<<tolower>> is a macro which converts upper-case characters to lower |
case, leaving all other characters unchanged. It is only defined when |
<[c]> is an integer in the range <<EOF>> to <<255>>. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining this macro using `<<#undef tolower>>'. |
|
<<_tolower>> performs the same conversion as <<tolower>>, but should |
only be used when <[c]> is known to be an uppercase character (<<A>>--<<Z>>). |
|
RETURNS |
<<tolower>> returns the lower-case equivalent of <[c]> when it is a |
character between <<A>> and <<Z>>, and <[c]> otherwise. |
|
<<_tolower>> returns the lower-case equivalent of <[c]> when it is a |
character between <<A>> and <<Z>>. If <[c]> is not one of these |
characters, the behaviour of <<_tolower>> is undefined. |
|
PORTABILITY |
<<tolower>> is ANSI C. <<_tolower>> is not recommended for portable |
programs. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
#undef tolower |
int |
_DEFUN(tolower,(c),int c) |
{ |
return isupper(c) ? (c) - 'A' + 'a' : c; |
} |
/isdigit.c
0,0 → 1,43
/* |
FUNCTION |
<<isdigit>>---decimal digit predicate |
|
INDEX |
isdigit |
|
ANSI_SYNOPSIS |
#include <ctype.h> |
int isdigit(int <[c]>); |
|
TRAD_SYNOPSIS |
#include <ctype.h> |
int isdigit(<[c]>); |
|
DESCRIPTION |
<<isdigit>> is a macro which classifies ASCII integer values by table |
lookup. It is a predicate returning non-zero for decimal digits, and 0 for |
other characters. It is defined only when <<isascii>>(<[c]>) is true |
or <[c]> is EOF. |
|
You can use a compiled subroutine instead of the macro definition by |
undefining the macro using `<<#undef isdigit>>'. |
|
RETURNS |
<<isdigit>> returns non-zero if <[c]> is a decimal digit (<<0>>--<<9>>). |
|
PORTABILITY |
<<isdigit>> is ANSI C. |
|
No supporting OS subroutines are required. |
*/ |
|
#include <_ansi.h> |
#include <ctype.h> |
|
|
#undef isdigit |
int |
_DEFUN(isdigit,(c),int c) |
{ |
return((_ctype_ + 1)[c] & _N); |
} |
/_toupper.c
0,0 → 1,9
#include <_ansi.h> |
#include <ctype.h> |
|
#undef _toupper |
int |
_DEFUN(_toupper,(c),int c) |
{ |
return islower(c) ? c - 'a' + 'A' : c; |
} |