diff options
author | Robert de Bath <rdebath@poboxes.com> | 2003-11-02 09:31:19 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:48:49 +0200 |
commit | b5dac1e3bdd01a2ce105df747a9073ff0d6a94e2 (patch) | |
tree | 2ce4628567071bbb680b6c81f40f5fd3192eda02 /cpp | |
parent | 22950ba3df3a0b739786243679d69cd4094e8b20 (diff) | |
download | dev86-b5dac1e3bdd01a2ce105df747a9073ff0d6a94e2.tar.gz |
Import Dev86src-0.16.14.tar.gzv0.16.14
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/cc.h | 24 | ||||
-rw-r--r-- | cpp/cpp.c | 43 | ||||
-rw-r--r-- | cpp/cygwin.c | 99 | ||||
-rw-r--r-- | cpp/hash.c | 6 | ||||
-rw-r--r-- | cpp/main.c | 29 | ||||
-rw-r--r-- | cpp/token1.c | 2 | ||||
-rw-r--r-- | cpp/token2.c | 2 |
7 files changed, 54 insertions, 151 deletions
@@ -1,16 +1,16 @@ -#ifndef _P +#ifndef P #if __STDC__ -#define _P(x) x +#define P(x) x #else -#define _P(x) () +#define P(x) () #endif #endif -extern void cfatal _P((char*)); -extern void cerror _P((char*)); -extern void cwarn _P((char*)); -extern FILE * open_include _P((char*, char*, int)); +extern void cfatal P((char*)); +extern void cerror P((char*)); +extern void cwarn P((char*)); +extern FILE * open_include P((char*, char*, int)); extern FILE * curfile; extern char curword[]; @@ -22,11 +22,11 @@ extern int dialect; #define DI_KNR 1 #define DI_ANSI 2 -extern int gettok _P((void)); +extern int gettok P((void)); struct token_trans { char * name; int token; }; -struct token_trans * is_ctok _P((const char *str, unsigned int len)); -struct token_trans * is_ckey _P((const char *str, unsigned int len)); +struct token_trans * is_ctok P((const char *str, unsigned int len)); +struct token_trans * is_ckey P((const char *str, unsigned int len)); #define WORDSIZE 128 #define TK_WSPACE 256 @@ -101,8 +101,8 @@ struct token_trans * is_ckey _P((const char *str, unsigned int len)); #define MAX_INCLUDE 64 /* Nested includes */ #define MAX_DEFINE 64 /* Nested defines */ -extern char * set_entry _P((int,char*,void*)); -extern void * read_entry _P((int,char*)); +extern char * set_entry P((int,char*,void*)); +extern void * read_entry P((int,char*)); struct define_item { @@ -1,9 +1,10 @@ #include <stdio.h> #include <string.h> -#include <malloc.h> #ifdef __STDC__ #include <stdlib.h> +#else +#include <malloc.h> #endif #include "cc.h" @@ -92,26 +93,26 @@ struct arg_store { int in_define; }; -static int chget _P((void)); -static int chget_raw _P((void)); -static void unchget _P((int)); -static int gettok_nosub _P((void)); -static int get_onetok _P((int)); -static int pgetc _P((void)); -static int do_preproc _P((void)); -static int do_proc_copy_hashline _P((void)); -static int do_proc_if _P((int)); -static void do_proc_include _P((void)); -static void do_proc_define _P((void)); -static void do_proc_undef _P((void)); -static void do_proc_else _P((void)); -static void do_proc_endif _P((void)); -static void do_proc_tail _P((void)); -static int get_if_expression _P((void)); -static int_type get_expression _P((int)); -static int_type get_exp_value _P((void)); -static void gen_substrings _P((char *, char *, int)); -static char * insert_substrings _P((char *, struct arg_store *, int)); +static int chget P((void)); +static int chget_raw P((void)); +static void unchget P((int)); +static int gettok_nosub P((void)); +static int get_onetok P((int)); +static int pgetc P((void)); +static int do_preproc P((void)); +static int do_proc_copy_hashline P((void)); +static int do_proc_if P((int)); +static void do_proc_include P((void)); +static void do_proc_define P((void)); +static void do_proc_undef P((void)); +static void do_proc_else P((void)); +static void do_proc_endif P((void)); +static void do_proc_tail P((void)); +static int get_if_expression P((void)); +static int_type get_expression P((int)); +static int_type get_exp_value P((void)); +static void gen_substrings P((char *, char *, int)); +static char * insert_substrings P((char *, struct arg_store *, int)); int gettok() diff --git a/cpp/cygwin.c b/cpp/cygwin.c deleted file mode 100644 index 5cb6e39..0000000 --- a/cpp/cygwin.c +++ /dev/null @@ -1,99 +0,0 @@ -/* 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 */ @@ -1,6 +1,10 @@ #include <stdio.h> +#ifdef __STDC__ +#include <stdlib.h> +#else #include <malloc.h> +#endif #include "cc.h" /* @@ -23,7 +27,7 @@ struct hashentry struct hashentry ** hashtable; int hashsize = 0xFF; /* 2^X -1 */ int hashcount = 0; -static int hashvalue _P((int namespace, char * word)); +static int hashvalue P((int namespace, char * word)); void * read_entry(namespace, word) @@ -3,31 +3,28 @@ #if __STDC__ #include <stdlib.h> #include <locale.h> -#endif -#ifndef __CYGWIN__ -#include <ctype.h> #else -#include "cygwin.c" +#include <malloc.h> #endif +#include <ctype.h> #include <string.h> -#include <malloc.h> #include <time.h> #include "cc.h" #define MAXINCPATH 5 -int main _P((int argc, char ** argv)); -void undefine_macro _P((char * name)); -void define_macro _P((char * name)); -void print_toks_cpp _P((void)); -void print_toks_raw _P((void)); -void define_macro _P((char *)); -void undefine_macro _P((char *)); -void cmsg _P((char * mtype, char * str)); -char * token_txn _P((int)); -void pr_indent _P((int)); -void hash_line _P((void)); +int main P((int argc, char ** argv)); +void undefine_macro P((char * name)); +void define_macro P((char * name)); +void print_toks_cpp P((void)); +void print_toks_raw P((void)); +void define_macro P((char *)); +void undefine_macro P((char *)); +void cmsg P((char * mtype, char * str)); +char * token_txn P((int)); +void pr_indent P((int)); +void hash_line P((void)); char * include_paths[MAXINCPATH]; diff --git a/cpp/token1.c b/cpp/token1.c index 4b966f7..f3aa420 100644 --- a/cpp/token1.c +++ b/cpp/token1.c @@ -6,6 +6,6 @@ #ifdef __GNUC__ __inline #endif -static unsigned int hash1 _P((register const char *, register unsigned int)); +static unsigned int hash1 P((register const char *, register unsigned int)); #include "token1.h" diff --git a/cpp/token2.c b/cpp/token2.c index c535746..b4d22b1 100644 --- a/cpp/token2.c +++ b/cpp/token2.c @@ -6,6 +6,6 @@ #ifdef __GNUC__ __inline #endif -static unsigned int hash2 _P((register const char *, register unsigned int)); +static unsigned int hash2 P((register const char *, register unsigned int)); #include "token2.h" |