summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Makefile19
-rw-r--r--src/common/alloc.c23
-rw-r--r--src/common/dlrgint.c252
-rw-r--r--src/common/doincl.c77
-rw-r--r--src/common/error.h33
-rw-r--r--src/common/filepart.c18
-rw-r--r--src/common/identify.c2
-rw-r--r--src/common/infer.c4
-rw-r--r--src/common/ipp.c4
-rw-r--r--src/common/munix.c14
-rw-r--r--src/common/pscript.icn6
-rw-r--r--src/common/rswitch.c173
-rw-r--r--src/common/rtdb.c3
-rw-r--r--src/common/yylex.h33
14 files changed, 193 insertions, 468 deletions
diff --git a/src/common/Makefile b/src/common/Makefile
index bb5546a..9456be5 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -3,13 +3,9 @@ include ../../Makedefs
OBJS = long.o getopt.o time.o filepart.o identify.o strtbl.o rtdb.o\
munix.o literals.o rswitch.o alloc.o long.o getopt.o time.o\
- xwindow.o dlrgint.o ipp.o
+ xwindow.o ipp.o
-common: doincl $(OBJS) gpxmaybe
-
-doincl: doincl.c ../h/arch.h
- $(CC) $(CFLAGS) -o doincl doincl.c
- -./doincl -o ../../bin/rt.h ../h/rt.h
+common: $(OBJS) gpxmaybe
patchstr: patchstr.c
$(CC) $(CFLAGS) -o patchstr patchstr.c
@@ -40,20 +36,13 @@ literals.o: ../h/esctab.h
rtdb.o: ../h/version.h icontype.h
-dlrgint.o: ../h/rproto.h ../h/rexterns.h ../h/rmacros.h ../h/rstructs.h
-
xwindow.o: ../h/graphics.h ../h/xwin.h
-# for rswitch, $(CFLAGS) is deliberately omitted (-O may cause problems)
-rswitch.o: ../h/define.h ../h/arch.h $(RSW)
- $(CC) -c $(RSW)
-
# The following section is needed if changes are made to the Icon grammar,
# but it is not run as part of the normal installation process. If it is
-# needed, it is run by changing ../icont/Makefile and/or ../iconc/Makefile;
-# see the comments there for details. icont must be in the search path
-# for this section to work.
+# needed, it is run by changing ../icont/Makefile; see the comments there
+# for details. icont must be in the search path for this section to work.
gfiles: lextab.h yacctok.h fixgram pscript
diff --git a/src/common/alloc.c b/src/common/alloc.c
index 7a048b1..e3b7503 100644
--- a/src/common/alloc.c
+++ b/src/common/alloc.c
@@ -4,11 +4,6 @@
#include "../h/gsupport.h"
-#ifdef TypTrc
- int typealloc = 0; /* type allocation switch */
- long typespace = 0; /* type allocation amount */
-#endif /* TypTrc */
-
/*
* salloc - allocate and initialize string
*/
@@ -35,24 +30,6 @@ unsigned int n;
{
register pointer a;
-#ifdef AllocTrace
- static int sum = 0;
-#endif /* AllocTrace */
-
-#ifdef TypTrc
- if (typealloc)
- typespace += (long)n;
-#endif /* TypTrc */
-
-#ifdef AllocTrace
- sum = sum + n;
- if (sum > 5000) {
- fprintf(stderr, ".");
- fflush(stderr);
- sum = 0;
- };
-#endif /* AllocTrace */
-
if (n == 0) /* Work-around for 0 allocation */
n = 1;
diff --git a/src/common/dlrgint.c b/src/common/dlrgint.c
deleted file mode 100644
index 3ca79d1..0000000
--- a/src/common/dlrgint.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * dlrgint.c - versions of "large integer" routines for compiled programs
- * that do not support large integers.
- */
-#define COMPILER 1
-#include "../h/rt.h"
-
-/*
- *****************************************************************
- *
- * Routines in the first set are only called when large integers
- * exist and thus these versions will never be called. They need
- * only have the correct signature and compile without error.
- */
-
-/*
- * bignum -> file
- */
-void bigprint(f, da)
-FILE *f;
-dptr da;
- {
- }
-
-/*
- * bignum -> real
- */
-double bigtoreal(da)
-dptr da;
- {
- return 0.0;
- }
-
-/*
- * bignum -> string
- */
-int bigtos(da, dx)
-dptr da, dx;
- {
- return 0;
- }
-
-/*
- * da -> dx
- */
-int cpbignum(da, dx)
-dptr da, dx;
- {
- return 0;
- }
-
-/*
- * da / db -> dx
- */
-int bigdiv(da, db, dx)
-dptr da, db, dx;
- {
- return 0;
- }
-
-/*
- * da % db -> dx
- */
-int bigmod(da, db, dx)
-dptr da, db, dx;
- {
- return 0;
- }
-
-/*
- * iand(da, db) -> dx
- */
-int bigand(da, db, dx)
-dptr da, db, dx;
- {
- return 0;
- }
-
-/*
- * ior(da, db) -> dx
- */
-int bigor(da, db, dx)
-dptr da, db, dx;
- {
- return 0;
- }
-
-/*
- * xor(da, db) -> dx
- */
-int bigxor(da, db, dx)
-dptr da, db, dx;
- {
- return 0;
- }
-
-/*
- * negative if da < db
- * zero if da == db
- * positive if da > db
- */
-word bigcmp(da, db)
-dptr da, db;
- {
- return (word)0;
- }
-
-/*
- * ?da -> dx
- */
-int bigrand(da, dx)
-dptr da, dx;
- {
- return 0;
- }
-
-/*
- *************************************************************
- *
- * The following routines are called when overflow has occurred
- * during ordinary arithmetic.
- */
-
-/*
- * da + db -> dx
- */
-int bigadd(da, db, dx)
-dptr da, db;
-dptr dx;
- {
- t_errornumber = 203;
- t_errorvalue = nulldesc;
- t_have_val = 0;
- return Error;
- }
-
-/*
- * da * db -> dx
- */
-int bigmul(da, db, dx)
-dptr da, db, dx;
- {
- t_errornumber = 203;
- t_errorvalue = nulldesc;
- t_have_val = 0;
- return Error;
- }
-
-/*
- * -i -> dx
- */
-int bigneg(da, dx)
-dptr da, dx;
- {
- t_errornumber = 203;
- t_errorvalue = nulldesc;
- t_have_val = 0;
- return Error;
- }
-
-/*
- * da - db -> dx
- */
-int bigsub(da, db, dx)
-dptr da, db, dx;
- {
- t_errornumber = 203;
- t_errorvalue = nulldesc;
- t_have_val = 0;
- return Error;
- }
-
-/*
- * ********************************************************
- *
- * The remaining routines each requires different handling.
- */
-
-/*
- * real -> bignum
- */
-int realtobig(da, dx)
-dptr da, dx;
- {
- return Failed; /* conversion cannot be done */
- }
-
-/*
- * da ^ db -> dx
- */
-int bigpow(da, db, dx)
-dptr da, db, dx;
- {
- C_integer r;
- extern int over_flow;
-
- /*
- * Just do ordinary interger exponentiation and check for overflow.
- */
- r = iipow(IntVal(*da), IntVal(*db));
- if (over_flow) {
- k_errornumber = 203;
- k_errortext = "";
- k_errorvalue = nulldesc;
- have_errval = 0;
- return Error;
- }
- MakeInt(r, dx);
- return Succeeded;
- }
-
-/*
- * string -> bignum
- */
-word bigradix(sign, r, s, end_s, result)
-int sign; /* '-' or not */
-int r; /* radix 2 .. 36 */
-char *s, *end_s; /* input string */
-union numeric *result; /* output T_Integer or T_Lrgint */
- {
- /*
- * Just do string to ordinary integer.
- */
- return radix(sign, r, s, end_s, result);
- }
-
-/*
- * bigshift(da, db) -> dx
- */
-int bigshift(da, db, dx)
-dptr da, db, dx;
- {
- uword ci; /* shift in 0s, even if negative */
- C_integer cj;
-
- /*
- * Do an ordinary shift - note that db is always positive when this
- * routine is called.
- */
- ci = (uword)IntVal(*da);
- cj = IntVal(*db);
- /*
- * Check for a shift of WordSize or greater; return an explicit 0 because
- * this is beyond C's defined behavior. Otherwise shift as requested.
- */
- if (cj >= WordBits)
- ci = 0;
- else
- ci <<= cj;
- MakeInt(ci, dx);
- return Succeeded;
- }
diff --git a/src/common/doincl.c b/src/common/doincl.c
deleted file mode 100644
index 8f80c87..0000000
--- a/src/common/doincl.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * doincl.c -- expand include directives (recursively)
- *
- * Usage: doinclude [-o outfile] filename...
- *
- * Doinclude copies a C source file, expanding non-system include directives.
- * For each line of the form
- * #include "filename"
- * the named file is interpolated; all other lines are copied verbatim.
- *
- * No error is generated if a file cannot be opened.
- */
-
-#include "../h/rt.h"
-
-void doinclude (char *fname);
-
-#define MAXLINE 500 /* maximum line length */
-
-FILE *outfile; /* output file */
-
-int main(argc, argv)
-int argc;
-char *argv[];
- {
- char *progname = argv[0];
-
- outfile = stdout;
- if (argc > 3 && strcmp(argv[1], "-o") == 0) {
- if ((outfile = fopen(argv[2], "w")) != NULL) {
- argv += 2;
- argc -= 2;
- }
- else {
- perror(argv[2]);
- exit(1);
- }
- }
- if (argc < 2) {
- fprintf(stderr, "usage: %s [-o outfile] filename...\n", progname);
- exit(1);
- }
-
- fprintf(outfile,
- "/***** do not edit -- this file was generated mechanically *****/\n\n");
- while (--argc > 0)
- doinclude(*++argv);
- exit(0);
- /*NOTREACHED*/
- }
-
-void doinclude(fname)
-char *fname;
- {
- FILE *f;
- char line[MAXLINE], newname[MAXLINE], *p;
-
- fprintf(outfile, "\n\n/****************************************");
- fprintf(outfile, " from %s: */\n\n", fname);
- if ((f = fopen(fname, "r")) != NULL) {
- while (fgets(line, MAXLINE, f))
- if (sscanf(line, " # include \"%s\"", newname) == 1) {
- for (p = newname; *p != '\0' && *p != '"'; p++)
- ;
- *p = '\0'; /* strip off trailing '"' */
- doinclude(newname); /* include file */
- }
- else
- fputs(line, outfile); /* not an include directive */
- fclose(f);
- }
- else {
- fprintf(outfile, "/* [file not found] */\n");
- }
- fprintf(outfile, "\n/****************************************");
- fprintf(outfile, " end %s */\n", fname);
- }
diff --git a/src/common/error.h b/src/common/error.h
index 0c5cb83..77ce243 100644
--- a/src/common/error.h
+++ b/src/common/error.h
@@ -2,8 +2,6 @@
* error.h -- routines for producing error messages.
*
* This source file contains the routines for issuing error messages.
- * It is built by inclusion in ../icont/tlex.c and ../iconc/clex.c,
- * with slight variations depending on whether "Iconc" is defined.
*/
/*
@@ -110,25 +108,6 @@ char *s1, *s2;
nocode++;
}
-#ifdef Iconc
-/*
- * twarn produces s1 and s2 (if nonnull) as translator warning messages.
- * The location of the error is found in tok_loc.
- */
-void twarn(s1, s2)
-char *s1, *s2;
- {
-
- if (tok_loc.n_file)
- fprintf(stderr, "File %s; ", tok_loc.n_file);
- fprintf(stderr, "Line %d # ", tok_loc.n_line);
- if (s2)
- fprintf(stderr, "\"%s\": ", s2);
- fprintf(stderr, "%s\n", s1);
- twarns++;
- }
-#endif /* Iconc */
-
/*
* tsyserr is called for fatal errors. The message s is produced and the
* translator exits.
@@ -162,18 +141,12 @@ void quitf(msg,arg)
char *msg, *arg;
{
extern char *progname;
+ extern char *ofile;
fprintf(stderr,"%s: ",progname);
fprintf(stderr,msg,arg);
fprintf(stderr,"\n");
-
- #if !defined(Iconc)
- {
- extern char *ofile;
- if (ofile)
- remove(ofile); /* remove bad icode file */
- }
- #endif /* !Iconc */
-
+ if (ofile)
+ remove(ofile); /* remove bad icode file */
exit(EXIT_FAILURE);
}
diff --git a/src/common/filepart.c b/src/common/filepart.c
index ab8049a..3c0b2de 100644
--- a/src/common/filepart.c
+++ b/src/common/filepart.c
@@ -38,22 +38,14 @@ static char *tryfile (char *buf, char *dir, char *name, char *extn);
char *pathfind(buf, path, name, extn)
char *buf, *path, *name, *extn;
{
- char *s;
char pbuf[MaxPath];
if (tryfile(buf, (char *)NULL, name, extn)) /* try curr directory first */
return buf;
- if (!path) /* if no path, use default */
+ if (!path) /* if no path, use default */
path = DefPath;
- #if CYGWIN
- s = alloca(cygwin_win32_to_posix_path_list_buf_size(path));
- cygwin_win32_to_posix_path_list(path, s);
- #else /* CYGWIN */
- s = path;
- #endif /* CYGWIN */
-
- while ((s = pathelem(s, pbuf)) != 0) /* for each path element */
+ while ((path = pathelem(path, pbuf)) != 0) /* for each path element */
if (tryfile(buf, pbuf, name, extn)) /* look for file */
return buf;
return NULL; /* return NULL if no file found */
@@ -123,12 +115,6 @@ char *s;
int n;
char *p, *q;
- #if CYGWIN
- char posix_s[_POSIX_PATH_MAX + 1];
- cygwin_conv_to_posix_path(s, posix_s);
- s = posix_s;
- #endif /* CYGWIN */
-
q = s;
fp.ext = p = s + strlen(s);
while (--p >= s) {
diff --git a/src/common/identify.c b/src/common/identify.c
index a1b7038..a9e4319 100644
--- a/src/common/identify.c
+++ b/src/common/identify.c
@@ -1,7 +1,5 @@
#include "../h/gsupport.h"
-#undef COMPILER
-#define COMPILER 1 /* insure compiler Version number */
#include "../h/version.h"
extern char *progname;
diff --git a/src/common/infer.c b/src/common/infer.c
index 819bf8b..aa38ea8 100644
--- a/src/common/infer.c
+++ b/src/common/infer.c
@@ -23,8 +23,8 @@ int main(int argc, char *argv[]) {
assert (sizeof(int) >= 4); /* need 32-bit ints or better */
assert (sizeof(long) <= 8); /* but can't handle over 64 */
printf("/* generated by infer.c */\n");
- printf("#define IntBits %d\n", 8 * sizeof(int));
- printf("#define WordBits %d\n", 8 * sizeof(void *));
+ printf("#define IntBits %d\n", (int) (8 * sizeof(int)));
+ printf("#define WordBits %d\n", (int) (8 * sizeof(void *)));
if (offsetof(tstruct, d) > sizeof(void *))
printf("#define Double\n");
if (atdepth(2) > atdepth(1))
diff --git a/src/common/ipp.c b/src/common/ipp.c
index 8913ee5..36a0990 100644
--- a/src/common/ipp.c
+++ b/src/common/ipp.c
@@ -18,7 +18,7 @@
* ppinit(fname,inclpath,m4flag) -- open input file
* ppdef(s,v) -- "$define s v", or "$undef s" if v is a null pointer
* ppch() -- return next preprocessed character
- * ppecho() -- preprocess to stdout (for icont/iconc -E)
+ * ppecho() -- preprocess to stdout (for icont -E)
*
* See ../h/features.h for the set of predefined symbols.
*/
@@ -115,7 +115,7 @@ static char *lpath; /* LPATH for finding source files */
static int ifdepth; /* depth of $if nesting */
-extern int tfatals, nocode; /* provided by icont, iconc */
+extern int tfatals, nocode; /* provided by icont */
/*
* ppinit(fname, inclpath, m4) -- initialize preprocessor to read from fname.
diff --git a/src/common/munix.c b/src/common/munix.c
index 132f397..f7dc6d0 100644
--- a/src/common/munix.c
+++ b/src/common/munix.c
@@ -29,12 +29,6 @@ char *relfile(char *prog, char *mod) {
if (baseloc[0] == 0) { /* if argv[0] not already found */
- #if CYGWIN
- char posix_prog[_POSIX_PATH_MAX + 1];
- cygwin_conv_to_posix_path(prog, posix_prog);
- prog = posix_prog;
- #endif /* CYGWIN */
-
if (findexe(prog, baseloc, sizeof(baseloc)) == NULL) {
fprintf(stderr, "cannot find location of %s\n", prog);
exit(EXIT_FAILURE);
@@ -102,14 +96,6 @@ char *findonpath(char *name, char *buf, size_t len) {
if (path == NULL || *path == '\0')
path = ".";
- #if CYGWIN
- else {
- char *posix_path;
- posix_path = alloca(cygwin_win32_to_posix_path_list_buf_size(path));
- cygwin_win32_to_posix_path_list(path, posix_path);
- path = posix_path;
- }
- #endif /* CYGWIN */
end = path + strlen(path);
for (next = path; next <= end; next = sep + 1) {
diff --git a/src/common/pscript.icn b/src/common/pscript.icn
index d9b2ee7..10d10d2 100644
--- a/src/common/pscript.icn
+++ b/src/common/pscript.icn
@@ -6,11 +6,7 @@ procedure sws()
return tab( many( ' \t' ) ) | ""
end
-$ifdef _CYGWIN
- $define YY_STATE "yystate"
-$else # _CYGWIN
- $define YY_STATE "yy_state"
-$endif # _CYGWIN
+$define YY_STATE "yy_state"
procedure main()
local line, prefix
diff --git a/src/common/rswitch.c b/src/common/rswitch.c
new file mode 100644
index 0000000..9373b4e
--- /dev/null
+++ b/src/common/rswitch.c
@@ -0,0 +1,173 @@
+/*
+ * rswitch.c -- context switch code using POSIX threads and semaphores
+ *
+ * This code implements co-expression context switching on any system that
+ * provides POSIX threads and semaphores.
+ *
+ * Anonymous semaphores are used unless NamedSemaphores is defined.
+ * (This is for MacOS which does not have anonymous semaphores.)
+ */
+
+#include <fcntl.h>
+#include <limits.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "../h/define.h"
+
+extern void new_context(int, void *);
+extern void syserr(char *msg);
+extern void *alloc(unsigned int n);
+
+extern long stksize; /* value of COEXPSIZE */
+
+static int inited = 0; /* has first-time initialization been done? */
+static pthread_attr_t attribs; /* thread creation attributes */
+
+/*
+ * Define a "context" struct to hold the thread information we need.
+ */
+typedef struct {
+ pthread_t thread; /* thread ID (thread handle) */
+ sem_t sema; /* synchronization semaphore (if unnamed) */
+ sem_t *semp; /* pointer to semaphore */
+ int alive; /* set zero when thread is to die */
+ } context;
+
+static void makesem(context *ctx);
+static void *nctramp(void *arg);
+static void uerror(char *msg);
+
+/*
+ * Treat an Icon "cstate" array as an array of context pointers.
+ * cstate[0] is used by Icon code that thinks it's setting a stack pointer.
+ * We use cstate[1] to point to the actual context struct.
+ * (Both of these are initialized to NULL by Icon 9.4.1 or later.)
+ */
+typedef context **cstate;
+
+/*
+ * coswitch(old, new, first) -- switch contexts.
+ */
+int coswitch(void *o, void *n, int first) {
+
+ cstate ocs = o; /* old cstate pointer */
+ cstate ncs = n; /* new cstate pointer */
+ context *old, *new; /* old and new context pointers */
+ size_t newsize; /* stack size for new thread */
+ size_t pagesize; /* system page size */
+
+ if (inited) /* if not first call */
+ old = ocs[1]; /* load current context pointer */
+ else {
+ /*
+ * This is the first coswitch() call.
+ * Allocate and initialize the context struct for &main.
+ */
+ old = ocs[1] = alloc(sizeof(context));
+ makesem(old);
+ old->thread = pthread_self();
+ old->alive = 1;
+
+ /*
+ * Set up thread attributes to honor COEXPSIZE for setting stack size.
+ */
+ pagesize = sysconf(_SC_PAGESIZE);
+ newsize = stksize;
+ #ifdef PTHREAD_STACK_MIN
+ if (newsize < PTHREAD_STACK_MIN) /* ensure system minimum is met */
+ newsize = PTHREAD_STACK_MIN;
+ #endif
+ if (pagesize > 0 && (newsize % pagesize) != 0) {
+ /* some systems require an exact multiple of the system page size */
+ newsize = newsize + pagesize - (newsize % pagesize);
+ }
+ pthread_attr_init(&attribs);
+ if (pthread_attr_setstacksize(&attribs, newsize) != 0) {
+ uerror("cannot set stacksize for thread");
+ }
+
+ inited = 1;
+ }
+
+ if (first != 0) /* if not first call for this cstate */
+ new = ncs[1]; /* load new context pointer */
+ else {
+ /*
+ * This is a newly allocated cstate array.
+ * Allocate and initialize a context struct.
+ */
+ new = ncs[1] = alloc(sizeof(context));
+ makesem(new);
+ if (pthread_create(&new->thread, &attribs, nctramp, new) != 0)
+ uerror("cannot create thread");
+ new->alive = 1;
+ }
+
+ sem_post(new->semp); /* unblock the new thread */
+ sem_wait(old->semp); /* block this thread */
+
+ if (!old->alive)
+ pthread_exit(NULL); /* if unblocked because unwanted */
+ return 0; /* else return to continue running */
+ }
+
+/*
+ * coclean(old) -- clean up co-expression state before freeing.
+ */
+void coclean(void *o) {
+ cstate ocs = o; /* old cstate pointer */
+ context *old = ocs[1]; /* old context pointer */
+ if (old == NULL) /* if never initialized, do nothing */
+ return;
+ old->alive = 0; /* signal thread to exit */
+ sem_post(old->semp); /* unblock it */
+ pthread_join(old->thread, NULL); /* wait for thread to exit */
+ #ifdef NamedSemaphores
+ sem_close(old->semp); /* close associated semaphore */
+ #else
+ sem_destroy(old->semp); /* destroy associated semaphore */
+ #endif
+ free(old); /* free context block */
+ }
+
+/*
+ * makesem(ctx) -- initialize semaphore in context struct.
+ */
+static void makesem(context *ctx) {
+ #ifdef NamedSemaphores /* if cannot use unnamed semaphores */
+ char name[50];
+ sprintf(name, "i%ld.sem", (long)getpid());
+ ctx->semp = sem_open(name, O_CREAT, S_IRUSR | S_IWUSR, 0);
+ if (ctx->semp == (sem_t *)SEM_FAILED)
+ uerror("cannot create semaphore");
+ sem_unlink(name);
+ #else /* NamedSemaphores */
+ if (sem_init(&ctx->sema, 0, 0) == -1)
+ uerror("cannot init semaphore");
+ ctx->semp = &ctx->sema;
+ #endif /* NamedSemaphores */
+ }
+
+/*
+ * nctramp() -- trampoline for calling new_context(0,0).
+ */
+static void *nctramp(void *arg) {
+ context *new = arg; /* new context pointer */
+ sem_wait(new->semp); /* wait for signal */
+ new_context(0, 0); /* call new_context; will not return */
+ syserr("new_context returned to nctramp");
+ return NULL;
+ }
+
+/*
+ * uerror(s) -- abort due to Unix error.
+ */
+static void uerror(char *msg) {
+ perror(msg);
+ syserr(NULL);
+ }
diff --git a/src/common/rtdb.c b/src/common/rtdb.c
index 5467244..d656d29 100644
--- a/src/common/rtdb.c
+++ b/src/common/rtdb.c
@@ -1066,9 +1066,6 @@ static struct il_c *db_ilc()
case 'g':
db_chstr("$cg", "oto");
*nxtp = new_ilc(ILC_CGto);
-#ifdef MultiThread
- #undef code
-#endif /* MultiThead */
(*nxtp)->code[0] = db_ilc();
c = getc(db);
SkipWhSp(c);
diff --git a/src/common/yylex.h b/src/common/yylex.h
index 9850417..37643f5 100644
--- a/src/common/yylex.h
+++ b/src/common/yylex.h
@@ -2,14 +2,10 @@
* yylex.h -- the lexical analyzer.
*
* This source file contains the lexical analyzer, yylex(), and its
- * support routines. It is built by inclusion in ../icont/tlex.c and
- * ../iconc/clex.c, with slight variations depending on whether "Iconc"
- * is defined.
+ * support routines. It is built by inclusion in ../icont/tlex.c.
*/
-#if !defined(Iconc)
- #include "../h/esctab.h"
-#endif /* !Iconc */
+#include "../h/esctab.h"
/*
* Prototypes.
@@ -23,11 +19,9 @@ static struct toktab *getstring (int ac,int *cc);
static int setfilenm (int c);
static int setlineno (void);
-#if !defined(Iconc)
- static int ctlesc (void);
- static int hexesc (void);
- static int octesc (int ac);
-#endif /* !Iconc */
+static int ctlesc (void);
+static int hexesc (void);
+static int octesc (int ac);
#define isletter(s) (isupper(c) | islower(c))
#define tonum(c) (isdigit(c) ? (c - '0') : ((c & 037) + 9))
@@ -399,16 +393,6 @@ int *cc;
c = NextChar;
if (c == EOF)
break;
-
-#if defined(Iconc)
- AppChar(lex_sbuf, Escape);
- if (c == '^') {
- c = NextChar;
- if (c == EOF)
- break;
- AppChar(lex_sbuf, '^');
- }
-#else /* Iconc */
if (isoctal(c))
c = octesc(c);
else if (c == 'x')
@@ -417,9 +401,8 @@ int *cc;
c = ctlesc();
else
c = esctab[c];
-#endif /* Iconc */
-
}
+
AppChar(lex_sbuf, c);
c = NextChar;
@@ -451,8 +434,6 @@ int *cc;
}
}
-#if !defined(Iconc)
-
/*
* ctlesc - translate a control escape -- backslash followed by
* caret and one character.
@@ -523,8 +504,6 @@ static int hexesc()
return c;
}
-
-#endif /* !Iconc */
/*
* setlineno - set line number from #line comment, return following char.