diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-15 09:38:53 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-15 09:39:34 -0500 |
commit | f95a4a932476be2ba99e2fd081e8d2bc6ea12813 (patch) | |
tree | 75f67192cb2d7b7b575c94edda318e475239b63c /newlib/libc/ctype | |
parent | f60aca96985e68c7d8a52eb7bc955fb80e132f73 (diff) |
Import newlib and create makefile
Diffstat (limited to 'newlib/libc/ctype')
-rw-r--r-- | newlib/libc/ctype/Makefile.am | 57 | ||||
-rw-r--r-- | newlib/libc/ctype/Makefile.in | 307 | ||||
-rw-r--r-- | newlib/libc/ctype/_tolower.c | 9 | ||||
-rw-r--r-- | newlib/libc/ctype/_toupper.c | 9 | ||||
-rw-r--r-- | newlib/libc/ctype/ctype.tex | 68 | ||||
-rw-r--r-- | newlib/libc/ctype/ctype_.c | 62 | ||||
-rw-r--r-- | newlib/libc/ctype/isalnum.c | 46 | ||||
-rw-r--r-- | newlib/libc/ctype/isalpha.c | 44 | ||||
-rw-r--r-- | newlib/libc/ctype/isascii.c | 43 | ||||
-rw-r--r-- | newlib/libc/ctype/iscntrl.c | 48 | ||||
-rw-r--r-- | newlib/libc/ctype/isdigit.c | 43 | ||||
-rw-r--r-- | newlib/libc/ctype/islower.c | 43 | ||||
-rw-r--r-- | newlib/libc/ctype/isprint.c | 60 | ||||
-rw-r--r-- | newlib/libc/ctype/ispunct.c | 46 | ||||
-rw-r--r-- | newlib/libc/ctype/isspace.c | 44 | ||||
-rw-r--r-- | newlib/libc/ctype/isupper.c | 43 | ||||
-rw-r--r-- | newlib/libc/ctype/isxdigit.c | 45 | ||||
-rw-r--r-- | newlib/libc/ctype/toascii.c | 41 | ||||
-rw-r--r-- | newlib/libc/ctype/tolower.c | 55 | ||||
-rw-r--r-- | newlib/libc/ctype/toupper.c | 54 |
20 files changed, 1167 insertions, 0 deletions
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am new file mode 100644 index 0000000..4aab995 --- /dev/null +++ b/newlib/libc/ctype/Makefile.am @@ -0,0 +1,57 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +noinst_LIBRARIES = lib.a + +lib_a_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 + +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 diff --git a/newlib/libc/ctype/Makefile.in b/newlib/libc/ctype/Makefile.in new file mode 100644 index 0000000..1f62071 --- /dev/null +++ b/newlib/libc/ctype/Makefile.in @@ -0,0 +1,307 @@ +# Makefile.in generated automatically by automake 1.3b from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997, 1998 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@ +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@ +EXEEXT = @EXEEXT@ +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@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +mach_add_objs = @mach_add_objs@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +noinst_LIBRARIES = lib.a + +lib_a_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 + +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@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +lib_a_LIBADD = +lib_a_OBJECTS = ctype_.o isalnum.o isalpha.o isascii.o iscntrl.o \ +isdigit.o islower.o isupper.o isprint.o ispunct.o isspace.o isxdigit.o \ +toascii.o tolower.o toupper.o _tolower.o _toupper.o +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +SOURCES = $(lib_a_SOURCES) +OBJECTS = $(lib_a_OBJECTS) + +all: Makefile $(LIBRARIES) + +.SUFFIXES: +.SUFFIXES: .S .c .def .o .s +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + 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: + +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 + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(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; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +info: +dvi: +check: +installcheck: +install-info: +install-exec: + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' 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: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-generic + +clean: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ + mostlyclean + +distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ + distclean-generic clean + -rm -f config.status + +maintainer-clean: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info dvi installcheck \ +install-info install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +.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: diff --git a/newlib/libc/ctype/_tolower.c b/newlib/libc/ctype/_tolower.c new file mode 100644 index 0000000..968dcf7 --- /dev/null +++ b/newlib/libc/ctype/_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; +} diff --git a/newlib/libc/ctype/_toupper.c b/newlib/libc/ctype/_toupper.c new file mode 100644 index 0000000..db4e00d --- /dev/null +++ b/newlib/libc/ctype/_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; +} diff --git a/newlib/libc/ctype/ctype.tex b/newlib/libc/ctype/ctype.tex new file mode 100644 index 0000000..a0971d8 --- /dev/null +++ b/newlib/libc/ctype/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 + + diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c new file mode 100644 index 0000000..45fcaa7 --- /dev/null +++ b/newlib/libc/ctype/ctype_.c @@ -0,0 +1,62 @@ +/* + * 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> + +#if defined(__CYGWIN__) || defined(__CYGWIN32__) +_CONST char __declspec(dllexport) _ctype_[1 + 256] = { +#else +_CONST char _ctype_[1 + 256] = { +#endif + 0, + _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 +}; diff --git a/newlib/libc/ctype/isalnum.c b/newlib/libc/ctype/isalnum.c new file mode 100644 index 0000000..7e05bd1 --- /dev/null +++ b/newlib/libc/ctype/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)); +} + diff --git a/newlib/libc/ctype/isalpha.c b/newlib/libc/ctype/isalpha.c new file mode 100644 index 0000000..35f14d3 --- /dev/null +++ b/newlib/libc/ctype/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)); +} + diff --git a/newlib/libc/ctype/isascii.c b/newlib/libc/ctype/isascii.c new file mode 100644 index 0000000..109fd3a --- /dev/null +++ b/newlib/libc/ctype/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; +} diff --git a/newlib/libc/ctype/iscntrl.c b/newlib/libc/ctype/iscntrl.c new file mode 100644 index 0000000..7b6da34 --- /dev/null +++ b/newlib/libc/ctype/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); +} + + diff --git a/newlib/libc/ctype/isdigit.c b/newlib/libc/ctype/isdigit.c new file mode 100644 index 0000000..5c21898 --- /dev/null +++ b/newlib/libc/ctype/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); +} diff --git a/newlib/libc/ctype/islower.c b/newlib/libc/ctype/islower.c new file mode 100644 index 0000000..81ad0bb --- /dev/null +++ b/newlib/libc/ctype/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); +} + diff --git a/newlib/libc/ctype/isprint.c b/newlib/libc/ctype/isprint.c new file mode 100644 index 0000000..2ff00f4 --- /dev/null +++ b/newlib/libc/ctype/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)); +} + diff --git a/newlib/libc/ctype/ispunct.c b/newlib/libc/ctype/ispunct.c new file mode 100644 index 0000000..c567932 --- /dev/null +++ b/newlib/libc/ctype/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); +} + diff --git a/newlib/libc/ctype/isspace.c b/newlib/libc/ctype/isspace.c new file mode 100644 index 0000000..1bc0798 --- /dev/null +++ b/newlib/libc/ctype/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); +} + diff --git a/newlib/libc/ctype/isupper.c b/newlib/libc/ctype/isupper.c new file mode 100644 index 0000000..8127e25 --- /dev/null +++ b/newlib/libc/ctype/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); +} + diff --git a/newlib/libc/ctype/isxdigit.c b/newlib/libc/ctype/isxdigit.c new file mode 100644 index 0000000..f8a035f --- /dev/null +++ b/newlib/libc/ctype/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))); +} + diff --git a/newlib/libc/ctype/toascii.c b/newlib/libc/ctype/toascii.c new file mode 100644 index 0000000..4506f35 --- /dev/null +++ b/newlib/libc/ctype/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; +} + diff --git a/newlib/libc/ctype/tolower.c b/newlib/libc/ctype/tolower.c new file mode 100644 index 0000000..e43fa6c --- /dev/null +++ b/newlib/libc/ctype/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; +} diff --git a/newlib/libc/ctype/toupper.c b/newlib/libc/ctype/toupper.c new file mode 100644 index 0000000..7977beb --- /dev/null +++ b/newlib/libc/ctype/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; +} |