From 1eb3e9989a8241c1654788fc7589e1f679e73dff Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 11 Oct 2000 22:08:28 +0000 Subject: New misc tree that actually has misc stuff in it. --- libc/misc/ctype/.indent.pro | 33 ++++++++++++++++++++++ libc/misc/ctype/Makefile | 42 ++++++++++++++++++++++++++++ libc/misc/ctype/ctype.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 libc/misc/ctype/.indent.pro create mode 100644 libc/misc/ctype/Makefile create mode 100644 libc/misc/ctype/ctype.c (limited to 'libc/misc/ctype') diff --git a/libc/misc/ctype/.indent.pro b/libc/misc/ctype/.indent.pro new file mode 100644 index 000000000..492ecf1c7 --- /dev/null +++ b/libc/misc/ctype/.indent.pro @@ -0,0 +1,33 @@ +--blank-lines-after-declarations +--blank-lines-after-procedures +--break-before-boolean-operator +--no-blank-lines-after-commas +--braces-on-if-line +--braces-on-struct-decl-line +--comment-indentation25 +--declaration-comment-column25 +--no-comment-delimiters-on-blank-lines +--cuddle-else +--continuation-indentation4 +--case-indentation0 +--else-endif-column33 +--space-after-cast +--line-comments-indentation0 +--declaration-indentation1 +--dont-format-first-column-comments +--dont-format-comments +--honour-newlines +--indent-level4 +/* changed from 0 to 4 */ +--parameter-indentation4 +--line-length78 /* changed from 75 */ +--continue-at-parentheses +--no-space-after-function-call-names +--dont-break-procedure-type +--dont-star-comments +--leave-optional-blank-lines +--dont-space-special-semicolon +--tab-size4 +/* additions by Mark */ +--case-brace-indentation0 +--leave-preprocessor-space diff --git a/libc/misc/ctype/Makefile b/libc/misc/ctype/Makefile new file mode 100644 index 000000000..7c5d5fae6 --- /dev/null +++ b/libc/misc/ctype/Makefile @@ -0,0 +1,42 @@ +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + +TOPDIR=../../ +include $(TOPDIR)Rules.make +LIBC=$(TOPDIR)libc.a + +CSRC=ctype.c +COBJS=$(patsubst %.c,%.o, $(CSRC)) +OBJS=$(COBJS) + +all: $(OBJS) $(LIBC) + +$(LIBC): ar-target + +ar-target: $(OBJS) + $(AR) $(ARFLAGS) $(LIBC) $(OBJS) + +$(OBJS): Makefile + +clean: + rm -f *.[oa] *~ core + diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c new file mode 100644 index 000000000..689ea50aa --- /dev/null +++ b/libc/misc/ctype/ctype.c @@ -0,0 +1,67 @@ +/* Copyright (C) 1995,1996 Robert de Bath + * This file is part of the Linux-8086 C library and is distributed + * under the GNU Library General Public License. + */ + +/* + * CTYPE.C Character classification and conversion + */ + +#include + +#undef toupper +#undef tolower + +unsigned char __ctype[128] = { + __CT_c, __CT_c, __CT_c, __CT_c, /* 0x00..0x03 */ + __CT_c, __CT_c, __CT_c, __CT_c, /* 0x04..0x07 */ + __CT_c, __CT_c | __CT_s, __CT_c | __CT_s, __CT_c | __CT_s, /* 0x08..0x0B */ + __CT_c | __CT_s, __CT_c | __CT_s, __CT_c, __CT_c, /* 0x0C..0x0F */ + + __CT_c, __CT_c, __CT_c, __CT_c, /* 0x10..0x13 */ + __CT_c, __CT_c, __CT_c, __CT_c, /* 0x14..0x17 */ + __CT_c, __CT_c, __CT_c, __CT_c, /* 0x18..0x1B */ + __CT_c, __CT_c, __CT_c, __CT_c, /* 0x1C..0x1F */ + + __CT_s, __CT_p, __CT_p, __CT_p, /* 0x20..0x23 */ + __CT_p, __CT_p, __CT_p, __CT_p, /* 0x24..0x27 */ + __CT_p, __CT_p, __CT_p, __CT_p, /* 0x28..0x2B */ + __CT_p, __CT_p, __CT_p, __CT_p, /* 0x2C..0x2F */ + + __CT_d | __CT_x, __CT_d | __CT_x, __CT_d | __CT_x, __CT_d | __CT_x, /* 0x30..0x33 */ + __CT_d | __CT_x, __CT_d | __CT_x, __CT_d | __CT_x, __CT_d | __CT_x, /* 0x34..0x37 */ + __CT_d | __CT_x, __CT_d | __CT_x, __CT_p, __CT_p, /* 0x38..0x3B */ + __CT_p, __CT_p, __CT_p, __CT_p, /* 0x3C..0x3F */ + + __CT_p, __CT_u | __CT_x, __CT_u | __CT_x, __CT_u | __CT_x, /* 0x40..0x43 */ + __CT_u | __CT_x, __CT_u | __CT_x, __CT_u | __CT_x, __CT_u, /* 0x44..0x47 */ + __CT_u, __CT_u, __CT_u, __CT_u, /* 0x48..0x4B */ + __CT_u, __CT_u, __CT_u, __CT_u, /* 0x4C..0x4F */ + + __CT_u, __CT_u, __CT_u, __CT_u, /* 0x50..0x53 */ + __CT_u, __CT_u, __CT_u, __CT_u, /* 0x54..0x57 */ + __CT_u, __CT_u, __CT_u, __CT_p, /* 0x58..0x5B */ + __CT_p, __CT_p, __CT_p, __CT_p, /* 0x5C..0x5F */ + + __CT_p, __CT_l | __CT_x, __CT_l | __CT_x, __CT_l | __CT_x, /* 0x60..0x63 */ + __CT_l | __CT_x, __CT_l | __CT_x, __CT_l | __CT_x, __CT_l, /* 0x64..0x67 */ + __CT_l, __CT_l, __CT_l, __CT_l, /* 0x68..0x6B */ + __CT_l, __CT_l, __CT_l, __CT_l, /* 0x6C..0x6F */ + + __CT_l, __CT_l, __CT_l, __CT_l, /* 0x70..0x73 */ + __CT_l, __CT_l, __CT_l, __CT_l, /* 0x74..0x77 */ + __CT_l, __CT_l, __CT_l, __CT_p, /* 0x78..0x7B */ + __CT_p, __CT_p, __CT_p, __CT_c /* 0x7C..0x7F */ +}; + +int toupper(c) +int c; +{ + return (islower(c) ? (c ^ 0x20) : (c)); +} + +int tolower(c) +int c; +{ + return (isupper(c) ? (c ^ 0x20) : (c)); +} -- cgit v1.2.3