diff options
author | Robert de Bath <rdebath@poboxes.com> | 2003-09-20 19:44:36 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:48:49 +0200 |
commit | 22950ba3df3a0b739786243679d69cd4094e8b20 (patch) | |
tree | 942907e918e556d340dcbcb8ffdc0f7d020a275e /cpp | |
parent | 5613ba3c0749fa494d35c4dc36b57c5b4e6edb55 (diff) | |
download | dev86-22950ba3df3a0b739786243679d69cd4094e8b20.tar.gz |
Import Dev86src-0.16.13.tar.gzv0.16.13
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/c | bin | 6204 -> 0 bytes | |||
-rw-r--r-- | cpp/c.c | 88 | ||||
-rw-r--r-- | cpp/cygwin.c | 99 | ||||
-rw-r--r-- | cpp/main.c | 4 | ||||
-rw-r--r-- | cpp/q.c | 26 |
5 files changed, 103 insertions, 114 deletions
Binary files differ diff --git a/cpp/c.c b/cpp/c.c deleted file mode 100644 index 03b3ee3..0000000 --- a/cpp/c.c +++ /dev/null @@ -1,88 +0,0 @@ -#include <stdio.h> -#include <errno.h> - -#if __STDC__ == (1UL) -#define strong_alias(Y,X) asm("export _" #X, "_" #X " = _" #Y ) -#else -#define strong_alias(Y,X) asm("export _" "X", "_" "X" " = _" "Y" ) -#endif - -#if 1 -# if __STDC__ -# define comb(x,y) x ## y -# warning Using Ansi combine -# elif __BCC__ -# define comb(x,y) x/**/y -# warning Using bcc combine -# else -# define comb(x,y) x/**/y -# warning Using K&R combine -# endif -#endif - -#define o define -#o signed unsigned -#o unsigned signed - -#ifdef signed -typedef signed char t_sc; -typedef comb(un,signed) char t_uc; - -char c; -t_sc sc; -t_uc uc; -#endif - -#pragma full optimise -strong_alias(main,zulu); -main() -{ - int i1, i2, i3; - - printf("sizeof(long double) = %d\n", sizeof(long double)); -#ifdef __GNUC__ - printf("sizeof(long float) = ERROR!\n"); - printf("sizeof(long long) = %d\n", sizeof(long long)); -#else - printf("sizeof(long float) = %d\n", sizeof(long float)); - printf("sizeof(long long) = ERROR!\n"); -#endif - printf("sizeof(double) = %d\n", sizeof(double)); - printf("sizeof(float) = %d\n", sizeof(float)); - - c = -6; - uc = -6; - sc = -6; - - printf("%ld, ", (long)c); - printf("%ld, ", (long)uc); - printf("%ld\n", (long)sc); - - printf("%d, ", c); - printf("%d, ", uc); - printf("%d\n", sc); - - i1 = c; i2 = uc; i3 = sc; - - printf("%d, ", i1); - printf("%d, ", i2); - printf("%d\n", i3); - - i1 = (char) 200 + (char) 50; - i2 = (t_uc) 200 + (t_uc) 50; - i3 = (t_sc) 200 + (t_sc) 50; - - printf("%d, ", i1); - printf("%d, ", i2); - printf("%d\n", i3); - - c = 200; uc = 200; sc = 200; - - i1 = c + (long) 50; - i2 = uc + (long) 50; - i3 = sc + (long) 50; - - printf("%d, ", i1); - printf("%d, ", i2); - printf("%d\n", i3); -} diff --git a/cpp/cygwin.c b/cpp/cygwin.c new file mode 100644 index 0000000..5cb6e39 --- /dev/null +++ b/cpp/cygwin.c @@ -0,0 +1,99 @@ +/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk> + * This file is part of the Linux-8086 C library and is distributed + * under the GNU Library General Public License. + */ + +/* + * CTYPE Character classification and conversion + */ + +/* + * I've copied this here from the bcc libs because cygwin's version has + * the _very_ silly feature of using _P as a private library constant. + * + * Single underscore variables are generally used for private variables + * in user libraries; the few stdio ones being 'leftovers' from version7 + * where user and system libraries were one and the same. + * + */ +#ifndef __CTYPE_H +#define __CTYPE_H + +static unsigned char __ctype[]; + +#define __CT_d 0x01 /* numeric digit */ +#define __CT_u 0x02 /* upper case */ +#define __CT_l 0x04 /* lower case */ +#define __CT_c 0x08 /* control character */ +#define __CT_s 0x10 /* whitespace */ +#define __CT_p 0x20 /* punctuation */ +#define __CT_x 0x40 /* hexadecimal */ + +/* Define these as simple old style ascii versions */ +#define toupper(c) (((c)>='a'&&(c)<='z') ? (c)^0x20 : (c)) +#define tolower(c) (((c)>='A'&&(c)<='Z') ? (c)^0x20 : (c)) +#define _toupper(c) ((c)^0x20) +#define _tolower(c) ((c)^0x20) +#define toascii(c) ((c)&0x7F) + +#define __CT(c) (__ctype[1+(unsigned char)c]) + +/* Note the '!!' is a cast to 'bool' and even BCC deletes it in an if() */ +#define isalnum(c) (!!(__CT(c)&(__CT_u|__CT_l|__CT_d))) +#define isalpha(c) (!!(__CT(c)&(__CT_u|__CT_l))) +#define isascii(c) (!((c)&~0x7F)) +#define iscntrl(c) (!!(__CT(c)&__CT_c)) +#define isdigit(c) (!!(__CT(c)&__CT_d)) +#define isgraph(c) (!(__CT(c)&(__CT_c|__CT_s))) +#define islower(c) (!!(__CT(c)&__CT_l)) +#define isprint(c) (!(__CT(c)&__CT_c)) +#define ispunct(c) (!!(__CT(c)&__CT_p)) +#define isspace(c) (!!(__CT(c)&__CT_s)) +#define isupper(c) (!!(__CT(c)&__CT_u)) +#define isxdigit(c) (!!(__CT(c)&__CT_x)) + +static unsigned char __ctype[257] = +{ + 0, /* -1 */ + __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 */ +}; + +#endif /* __CTYPE_H */ @@ -4,7 +4,11 @@ #include <stdlib.h> #include <locale.h> #endif +#ifndef __CYGWIN__ #include <ctype.h> +#else +#include "cygwin.c" +#endif #include <string.h> #include <malloc.h> #include <time.h> diff --git a/cpp/q.c b/cpp/q.c deleted file mode 100644 index 8ca4402..0000000 --- a/cpp/q.c +++ /dev/null @@ -1,26 +0,0 @@ -#define m_size(p) ((p) [0].size) /* For malloc */ -#define m_next(p) ((p) [1].next) /* For malloc and alloca */ -#define m_deep(p) ((p) [0].depth) /* For alloca */ - m_size(p1) += m_size(m_next(p1)); - m_next(p1) = m_next(m_next(p1)); - noise("JÖIN \"2\" EOF?->˙", p1); -#asm - hello?? -??=warning oooer -/\ -* wtf! */ -#define LOCK_NB 4 /* or'd with one of the above to prevent - blocking */ -#define LOCK_UN 8 /* remove lock */ -#define bb 11 -#define cc 22 -#define bbcc 4455 -#define comba(x,y) x/**/y -#define combb(x,y) x ## y -#define empty - - \0 \00 \000 \0000 \200 \x34f \xff -bb\ -cc - comba(un,signed); ++ -- >> << {} combb(un,signed); -#endasm |