summaryrefslogtreecommitdiffstats
path: root/qemu/roms/SLOF/lib/libc/ctype
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/roms/SLOF/lib/libc/ctype')
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/Makefile.inc20
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/isdigit.c25
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/isprint.c18
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/isspace.c29
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/isxdigit.c21
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/tolower.c18
-rw-r--r--qemu/roms/SLOF/lib/libc/ctype/toupper.c21
7 files changed, 152 insertions, 0 deletions
diff --git a/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc b/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc
new file mode 100644
index 000000000..25513a9a7
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc
@@ -0,0 +1,20 @@
+# *****************************************************************************
+# * Copyright (c) 2004, 2008 IBM Corporation
+# * All rights reserved.
+# * This program and the accompanying materials
+# * are made available under the terms of the BSD License
+# * which accompanies this distribution, and is available at
+# * http://www.opensource.org/licenses/bsd-license.php
+# *
+# * Contributors:
+# * IBM Corporation - initial implementation
+# ****************************************************************************/
+
+
+CTYPE_SRC_C = isdigit.c isprint.c isspace.c isxdigit.c tolower.c toupper.c
+CTYPE_SRC_ASM =
+CTYPE_SRCS = $(CTYPE_SRC_C:%=$(CTYPECMNDIR)/%) $(CTYPE_SRC_ASM:%=$(CTYPECMNDIR)/%)
+CTYPE_OBJS = $(CTYPE_SRC_C:%.c=%.o) $(CTYPE_SRC_ASM:%.S=%.o)
+
+%.o : $(CTYPECMNDIR)/%.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
diff --git a/qemu/roms/SLOF/lib/libc/ctype/isdigit.c b/qemu/roms/SLOF/lib/libc/ctype/isdigit.c
new file mode 100644
index 000000000..62d08a1cf
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/isdigit.c
@@ -0,0 +1,25 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2008 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include <ctype.h>
+
+int isdigit(int ch)
+{
+ switch (ch) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ return 1;
+
+ default:
+ return 0;
+ }
+}
diff --git a/qemu/roms/SLOF/lib/libc/ctype/isprint.c b/qemu/roms/SLOF/lib/libc/ctype/isprint.c
new file mode 100644
index 000000000..c74880f1c
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/isprint.c
@@ -0,0 +1,18 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2008 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include <ctype.h>
+
+int isprint(int ch)
+{
+ return (ch >= 32 && ch < 127);
+}
diff --git a/qemu/roms/SLOF/lib/libc/ctype/isspace.c b/qemu/roms/SLOF/lib/libc/ctype/isspace.c
new file mode 100644
index 000000000..51230192f
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/isspace.c
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2008 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include <ctype.h>
+
+int isspace(int ch)
+{
+ switch (ch) {
+ case ' ':
+ case '\f':
+ case '\n':
+ case '\r':
+ case '\t':
+ case '\v':
+ return 1;
+
+ default:
+ return 0;
+ }
+}
diff --git a/qemu/roms/SLOF/lib/libc/ctype/isxdigit.c b/qemu/roms/SLOF/lib/libc/ctype/isxdigit.c
new file mode 100644
index 000000000..9d323f3c0
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/isxdigit.c
@@ -0,0 +1,21 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2008 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include <ctype.h>
+
+int isxdigit(int ch)
+{
+ return (
+ (ch >= '0' && ch <= '9') |
+ (ch >= 'A' && ch <= 'F') |
+ (ch >= 'a' && ch <= 'f') );
+}
diff --git a/qemu/roms/SLOF/lib/libc/ctype/tolower.c b/qemu/roms/SLOF/lib/libc/ctype/tolower.c
new file mode 100644
index 000000000..f775e9096
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/tolower.c
@@ -0,0 +1,18 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2008 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+#include <ctype.h>
+
+int tolower(int c)
+{
+ return (((c >= 'A') && (c <= 'Z')) ? (c - 'A' + 'a' ) : c);
+}
diff --git a/qemu/roms/SLOF/lib/libc/ctype/toupper.c b/qemu/roms/SLOF/lib/libc/ctype/toupper.c
new file mode 100644
index 000000000..9bcee523d
--- /dev/null
+++ b/qemu/roms/SLOF/lib/libc/ctype/toupper.c
@@ -0,0 +1,21 @@
+/******************************************************************************
+ * Copyright (c) 2004, 2008 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *****************************************************************************/
+
+
+#include "ctype.h"
+
+int toupper (int cha)
+{
+ if((cha >= 'a') && (cha <= 'z'))
+ return(cha - 'a' + 'A');
+ return(cha);
+}