summaryrefslogtreecommitdiff
path: root/bcc
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-05-31 21:33:17 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:30:46 +0200
commite85ee07172eccafd9441362e774f7b184810d008 (patch)
tree5dc12259ab7a61b12d9df284fe58ad5cb312c526 /bcc
parentdcc973ea3e31710429858c99d4f040334ac67c06 (diff)
downloaddev86-e85ee07172eccafd9441362e774f7b184810d008.tar.gz
Import Dev86-0.0.6.tar.gzv0.0.6
Diffstat (limited to 'bcc')
-rw-r--r--bcc/Makefile6
-rw-r--r--bcc/bcc.c75
-rw-r--r--bcc/const.h4
-rw-r--r--bcc/input.c24
-rw-r--r--bcc/input.h2
-rw-r--r--bcc/ncc.c215
-rw-r--r--bcc/os.h20
-rw-r--r--bcc/preproc.c29
-rw-r--r--bcc/scan.c4
-rw-r--r--bcc/scan.h3
-rw-r--r--bcc/state.c23
-rw-r--r--bcc/table.c3
-rw-r--r--bcc/tags341
13 files changed, 336 insertions, 413 deletions
diff --git a/bcc/Makefile b/bcc/Makefile
index 9cc0f0a..eb09e52 100644
--- a/bcc/Makefile
+++ b/bcc/Makefile
@@ -11,6 +11,8 @@ else
CC=bcc
CFLAGS=-Mf
LDFLAGS=-s -M
+BINDIR=/usr/bin
+LIBDIR=/usr/lib/bcc
endif
OBJS = bcc-cc1.o codefrag.o debug.o declare.o express.o exptree.o floatop.o \
@@ -42,3 +44,7 @@ bcc-cc1: $(OBJS)
clean:
rm -f bcc bcc-cc1 bcc09 ccc bcc.o $(OBJS)
+
+
+$(OBJS): align.h byteord.h condcode.h const.h gencode.h input.h label.h os.h \
+ output.h parse.h proto.h reg.h sc.h scan.h sizes.h table.h type.h types.h
diff --git a/bcc/bcc.c b/bcc/bcc.c
index 265553b..c5b0074 100644
--- a/bcc/bcc.c
+++ b/bcc/bcc.c
@@ -6,8 +6,10 @@
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef MSDOS
#include <sys/wait.h>
#include <unistd.h>
+#endif
#include <signal.h>
#include <stdlib.h>
#include <string.h>
@@ -25,26 +27,45 @@
#define P(x) ()
#endif
-#define AS "as86"
+#ifdef MSDOS
+#define LOCALPREFIX "/linux86"
+#define EXESUF ".exe"
+#define R_OK 4 /* Test for read permission. */
+#define W_OK 2 /* Test for write permission. */
+#define X_OK 1 /* Test for execute permission. */
+#define F_OK 0 /* Test for existence. */
+#else
+#define EXESUF
+#endif
+
+#define AS "as86" EXESUF
#define BAS86
#define BCC86
-#define CC1 "bcc-cc1"
+#define CC1 "bcc-cc1" EXESUF
#define CC1_MINUS_O_BROKEN FALSE
-#define CPP "bcc-cc1" /* normally a link to /usr/bin/bcc-cc1 */
+#define CPP "bcc-cc1" EXESUF /* normally a link to /usr/bin/bcc-cc1 */
#define CPPFLAGS "-E"
#define CRT0 "crt0.o"
#define GCC "gcc"
-#define LD "ld86"
+#define LD "ld86" EXESUF
#ifndef NO_ANSI_SUPPORT
-#define UNPROTO "unproto"
-#endif
+#define UNPROTO "unproto" EXESUF
+#endif
+#ifdef MSDOS
+#define STANDARD_CRT0_0_PREFIX LOCALPREFIX "/lib/"
+#define STANDARD_EXEC_PREFIX LOCALPREFIX "/lib/"
+#define STANDARD_EXEC_PREFIX_2 "/bin/"
+#define DEFAULT_INCLUDE "-I" LOCALPREFIX "/libc/include"
+#define DEFAULT_LIBDIR0 "-L" LOCALPREFIX "/lib/"
+#else
#define STANDARD_CRT0_0_PREFIX LOCALPREFIX "/lib/bcc/i86/"
#define STANDARD_CRT0_3_PREFIX LOCALPREFIX "/lib/bcc/i386/"
#define STANDARD_EXEC_PREFIX LOCALPREFIX "/lib/bcc/"
-#define STANDARD_EXEC_PREFIX_2 LOCALPREFIX "/bin/"
+#define STANDARD_EXEC_PREFIX_2 "/usr/bin/"
#define DEFAULT_INCLUDE "-I" LOCALPREFIX "/include"
#define DEFAULT_LIBDIR0 "-L" LOCALPREFIX "/lib/bcc/i86/"
#define DEFAULT_LIBDIR3 "-L" LOCALPREFIX "/lib/bcc/i386/"
+#endif
#ifdef CCC
#undef BCC86
@@ -430,10 +451,12 @@ char **argv;
if( add_default_lib )
{
#ifdef BCC86
+#ifdef DEFAULT_LIBDIR3
if( bits32 )
addarg(&ldargs, DEFAULT_LIBDIR3);
else
#endif
+#endif
addarg(&ldargs, DEFAULT_LIBDIR0);
}
addprefix(&exec_prefix, STANDARD_EXEC_PREFIX);
@@ -442,7 +465,9 @@ char **argv;
ccargs.prog = fixpath(ccargs.prog, &exec_prefix, X_OK);
asargs.prog = fixpath(asargs.prog, &exec_prefix, X_OK);
ldargs.prog = fixpath(ldargs.prog, &exec_prefix, X_OK);
+#ifdef BAS86
ldrargs.prog = fixpath(ldrargs.prog, &exec_prefix, X_OK);
+#endif
#ifndef NO_ANSI_SUPPORT
unprotoargs.prog=fixpath(unprotoargs.prog, &exec_prefix, X_OK);
#endif
@@ -452,12 +477,14 @@ char **argv;
if (prep_only && !prep_line_numbers)
addarg(&cppargs, "-P");
#ifdef BCC86
+#ifdef STANDARD_CRT0_3_PREFIX
if (bits32)
{
bits_arg = "-3";
crt0 = fixpath(CRT0, &crt0_3_prefix, R_OK);
}
else
+#endif
{
bits_arg = "-0";
crt0 = fixpath(CRT0, &crt0_0_prefix, R_OK);
@@ -854,6 +881,9 @@ struct arg_s *argp;
}
writen();
}
+#ifdef MSDOS
+ status = spawnv(0, argp->prog, argp->argv+arg0);
+#else
switch (fork())
{
case -1:
@@ -866,23 +896,24 @@ struct arg_s *argp;
fatal(" failed");
default:
wait(&status);
- for (i = tmpargs.argc - 1; i >= START_ARGS; --i)
- if (in_name == tmpargs.argv[i])
- {
- my_unlink(in_name);
- --tmpargs.argc;
- memmove(tmpargs.argv + i, tmpargs.argv + i + 1,
- (tmpargs.argc - i) * sizeof tmpargs.argv[0]);
- tmpargs.argv[tmpargs.argc] = NUL_PTR;
- break;
- }
- if (status != 0)
+ }
+#endif
+ for (i = tmpargs.argc - 1; i >= START_ARGS; --i)
+ if (in_name == tmpargs.argv[i])
{
- killtemps();
- runerror = TRUE;
+ my_unlink(in_name);
+ --tmpargs.argc;
+ memmove(tmpargs.argv + i, tmpargs.argv + i + 1,
+ (tmpargs.argc - i) * sizeof tmpargs.argv[0]);
+ tmpargs.argv[tmpargs.argc] = NUL_PTR;
+ break;
}
- return status;
+ if (status != 0)
+ {
+ killtemps();
+ runerror = TRUE;
}
+ return status;
}
PRIVATE void set_trap()
@@ -896,7 +927,7 @@ PRIVATE void set_trap()
#endif
#else
- /* This is being too trap happy! */
+ /* This is being too trap happy IMO - Rdb */
#ifndef _NSIG
#define _NSIG NSIG
#endif
diff --git a/bcc/const.h b/bcc/const.h
index 8df8bcb..fda6914 100644
--- a/bcc/const.h
+++ b/bcc/const.h
@@ -28,6 +28,10 @@
/*#define SOS_MSDOS*/ /* source O/S is MSDOS */
/*#define TOS_EDOS*/ /* target O/S is EDOS */
+#ifdef MSDOS
+#define SOS_MSDOS
+#endif
+
/* switches for source machine dependencies */
#ifndef SOS_EDOS
diff --git a/bcc/input.c b/bcc/input.c
index 4cf699a..3d77bbf 100644
--- a/bcc/input.c
+++ b/bcc/input.c
@@ -89,30 +89,30 @@ more:
}
ch = *++lineptr;
more1:
- if (!eof && lineptr >= input.limit)
+ if (!eofile && lineptr >= input.limit)
skipeol();
if (ch == EOL)
{
--nbackslash;
- if (eof)
+ if (eofile)
eofin("backslash-newline");
else
{
skipeol();
- if (ch == EOL && !eof && lineptr >= input.limit)
+ if (ch == EOL && !eofile && lineptr >= input.limit)
skipeol();
#ifdef COEOL /* XXX - this should go through specialchar() */
if (ch == COEOL)
{
ch = *++lineptr;
- if (ch == EOL && !eof && lineptr >= input.limit)
+ if (ch == EOL && !eofile && lineptr >= input.limit)
skipeol();
}
#endif
}
if (ch == '\\')
goto more;
- if (nbackslash != 0 && ch == EOL && !eof)
+ if (nbackslash != 0 && ch == EOL && !eofile)
goto more1;
if (nbackslash != 0)
{
@@ -124,7 +124,7 @@ more1:
}
if (ch == '\\')
goto more;
- if (ch == EOL && !eof)
+ if (ch == EOL && !eofile)
goto more1;
ch = *--lineptr = '\\'; /* pushback */
if (--nbackslash != 0)
@@ -165,7 +165,7 @@ PUBLIC void errorloc()
return;
outstr(infbuf->fname);
outbyte(':');
- if (eof)
+ if (eofile)
outstr("eof");
else
{
@@ -604,7 +604,7 @@ PUBLIC void skipeol()
#endif
int nread;
- if (eof)
+ if (eofile)
return;
if (lineptr < input.limit)
{
@@ -672,7 +672,7 @@ case0:
{
if (inclevel == 0)
{
- eof = TRUE;
+ eofile = TRUE;
checknotinif();
}
else
@@ -705,7 +705,7 @@ more:
if (ch == '\\')
backslash();
#endif
- if (!eof && lineptr >= input.limit)
+ if (!eofile && lineptr >= input.limit)
{
skipeol();
#ifdef ARBITRARY_BACKSLASH_NEWLINES
@@ -726,7 +726,7 @@ more:
}
if (*(lineptr + 1) == EOL)
{
- if (eof)
+ if (eofile)
eofin("backslash-newline");
else
{
@@ -746,7 +746,7 @@ more:
#endif
}
#ifdef COEOL
- if (ch == EOL && !eof)
+ if (ch == EOL && !eofile)
{
if (*(lineptr + 1) == EOL && lineptr + 1 >= input.limit)
{
diff --git a/bcc/input.h b/bcc/input.h
index 0563059..0cda8d0 100644
--- a/bcc/input.h
+++ b/bcc/input.h
@@ -27,7 +27,7 @@ EXTERN bool_t asmmode; /* nonzero when processing assembler code */
/* depends on zero init */
EXTERN char ch; /* current char */
EXTERN bool_t cppmode; /* nonzero if acting as cpp not as compiler */
-EXTERN bool_t eof; /* nonzero after end of main file reached */
+EXTERN bool_t eofile; /* nonzero after end of main file reached */
/* depends on zero init */
EXTERN struct fcbstruct input; /* current input file control block */
/* input.lineptr is not kept up to date */
diff --git a/bcc/ncc.c b/bcc/ncc.c
new file mode 100644
index 0000000..d48e522
--- /dev/null
+++ b/bcc/ncc.c
@@ -0,0 +1,215 @@
+
+#include <stdio.h>
+
+/* Normal passes ...
+ * p: C preprocessor .c -> .0
+ * 1: cc1 .1 -> .2
+ * 2: opt .2 -> .3
+ * 3: cg .3 -> .s
+ * a: as .s -> .o
+ * l: ld .o -> .out
+ *
+ * c: Is alias for one or more of 0,1,2
+ * d: This command. (Semi-colon seperators)
+ */
+
+#define MAXPASSES 16
+#define MAXOPTIONS 32
+
+struct pass {
+ char * command;
+ char pass_id;
+ char source;
+ char result;
+ char * args;
+} passes[MAXPASSES];
+
+struct option {
+ char * optname;
+ char * subst;
+} options[MAXOPTS];
+
+/* The default argument list ... */
+extern int standard_argc;
+extern char ** standard_argv;
+
+#ifdef __MSDOS__
+int standard_argc = 0; /* Nothing ... use the files */
+char ** standard_argv = 0;
+#endif
+
+struct { char * opt, *spec; } builtin_models[] = {
+ { "-0", "i8086" }
+ { "-3", "i386" }
+ { "-9", "mc6809" }
+ {0,0}
+};
+
+/* What sort of compile ? */
+char model[20] = "-";
+int model_found = 0;
+int args_active = 1;
+
+/* Linker output file */
+char * output_file = "a.out";
+
+char ** file_list = 0;
+int file_count = 0;
+int pass_count = 0;
+int opts_count = 0;
+
+/* A temp buffer */
+char little_buf[128];
+
+main(argc, argv)
+int argc;
+char ** argv;
+{
+ int ar;
+ /* First, is there a model ? */
+ /* PROBLEM: This doesn't find -b specifiers that are embedded in user opts */
+ for(ar=1; ar<argc; ar++)
+ if(argv[ar][0] == '-') switch(argv[ar][1])
+ {
+ case 'o': ar++; break;
+ case 'b': if(argv[ar][2]) break;
+ ar++;
+ if( argv[ar] == 0 ) fatal("-b needs specifier");
+ strncpy(model, argv[ar], sizeof(model)-1);
+ break;
+ default: /* Scan builtin_models */
+ }
+
+ /* Space for filenames */
+ file_list = calloc(argc, sizeof(char*));
+ if( file_list == 0 ) fatal("Out of memory");
+
+ /* Perhaps: make builtin_models[0].spec the default ? */
+
+ for(ar=0; ar<standard_argc; )
+ ar += decode_arg(standard_argv[ar], standard_argv[ar+1]);
+
+ /* The model isn't in the standard args ... */
+ if( !model_found )
+ {
+ strcat(little_buf, exec_paths[0]);
+ strcat(little_buf, "/spec");
+ include_file(little_buf);
+ }
+ if( !model_found && strcmp(model, "-") != 0 )
+ {
+ strcat(little_buf, exec_paths[0]);
+ strcat(little_buf, "/spec.");
+ strcat(little_buf, model);
+ include_file(little_buf);
+ }
+ if( !model_found ) fatal("Unable to find compiler specification");
+
+ /* Now we can do the command line for real */
+ for(ar=1; ar<argc; )
+ ar += decode_arg(argv[ar], argv[ar+1]);
+
+ /* Compile all the files to objects; save the names back in file_table */
+ for(ar=0; ar<file_count; ar++)
+ do_compile(file_table[ar]);
+
+ /* If everything was OK then find the pass with a nul result type */
+ if( exit_status == 0 )
+ do_link_command();
+
+ return exit_status;
+}
+
+decode_arg(arg1, arg2)
+char * arg1;
+char * arg2;
+{
+ if(arg1[0] == '-' && arg1[2] == '\0') switch(arg1[1])
+ {
+ case 'v': verbose++; return 1;
+ case 'o': if( arg2 == 0 ) fatal("-o needs filename");
+ output_file = arg2;
+ return 2;
+ case 'b': if( arg2 == 0 ) fatal("-b needs specifier");
+ args_active = 1;
+ if( strcmp(arg2, "-") == 0)
+ return 2;
+ else if( strcmp(arg2, model) == 0)
+ ;
+ else if( strcmp(model, "-") == 0)
+ strncpy(model, arg2, sizeof(model)-1);
+ else
+ {
+ args_active=0;
+ return 2;
+ }
+ model_found = 1;
+ return 2;
+
+ default: /* Lookup item in conversion table */
+ }
+ else if( args_active == 0 )
+ return 1;
+ else if(arg1[0] == '-' ) switch(arg1[1])
+ {
+ case '@': include_file(arg1+2); return 1;
+ case 'B': add_path(exec_path, arg1+2); return 1;
+ case 'W': command_W(arg1+2); return 1;
+ case 'T': command_T(arg1+2); return 1;
+ /* -T0,bcc-cc1,-0,-i,$1,$2,-o,$3 ie add standard args */
+
+ default: /* Lookup item in conversion table */
+ }
+ else
+ {
+ file_names[file_count++] = arg1;
+ return 1;
+ }
+
+ /* Do conversion ... */
+ /*
+ * 1) Locate arg in options
+ * 2) for each semicolon seperated item
+ * 3) pass it to decode_arg
+ * 4) remember to give it 2 args for '-b'
+ *
+ * Note: char '*' in the options table matches the rest of the arg.
+ */
+ return 1;
+}
+
+include_file(fname)
+char * fname;
+{
+ FILE * fd;
+ char line_buffer[512];
+ char * p;
+
+ RIGHT HERE
+
+ fd = fopen(fname, "r");
+ if( fd == 0 ) fatal("Cannot open command line file");
+
+ while( fgets(line_buffer, sizeof(line_buffer), fd) )
+ {
+ if( line_buffer[0] == '#' ) continue;
+
+ }
+ fclose(fd);
+}
+
+command_T(arg1)
+char * arg1;
+{
+ /* Is it an option specifier ? */
+ if(arg1[0] == '-')
+ {
+ argend = strchr(arg1, ';');
+
+
+ }
+ else /* Must be a pass specifier or modifier */
+ {
+
+ }
+}
diff --git a/bcc/os.h b/bcc/os.h
index 71dfcef..b42ce3f 100644
--- a/bcc/os.h
+++ b/bcc/os.h
@@ -47,26 +47,6 @@
(fnameptr)[1] == DIRCHAR)
#endif
-#ifdef SOS_MSDOS
-# define COEOL 10
-# undef DEFAULT_INCLUDE_DIR
-# define DEFAULT_INCLUDE_DIR "\\usr\\include"
-# undef DIRCHAR
-# define DIRCHAR '\\'
-# undef DIRSTRING
-# define DIRSTRING "\\"
-# undef EOL
-# define EOL 13
-/*
- Problems with newline on MSDOS (as usual).
- Defining EOL as 10 (LF) handles LF-terminated lines as well as
- CRLF-terminated lines, but escaped CRLF's do not work. The compiler
- should handle the escapes better. (Perhaps it does now.)
- Defining EOL as 13 (CR) handles CRLF-terminated lines but fails on
- LF-terminated lines.
-*/
-#endif
-
#ifdef TOS_EDOS
# undef EOLTO
# define EOLTO 13
diff --git a/bcc/preproc.c b/bcc/preproc.c
index 90f5a8c..b4de99a 100644
--- a/bcc/preproc.c
+++ b/bcc/preproc.c
@@ -70,12 +70,15 @@ PRIVATE void asmcontrol()
if (orig_cppmode)
outstr("#asm\n");
else
+ {
+ outstr("!BCC_ASM\n");
dumplocs();
+ }
while (TRUE)
{
skipline();
skipeol();
- if (eof)
+ if (eofile)
{
eofin("#asm");
break;
@@ -119,6 +122,8 @@ PRIVATE void asmcontrol()
}
if (orig_cppmode)
outstr("#endasm"); /* nl is done by skipeol */
+ else
+ outstr("!BCC_ENDASM\n");
}
/* blanksident() - return nonzero if at blanks followed by an identifier */
@@ -403,8 +408,8 @@ ts_s_fakeline_tot += 3 + len + 2 + 2;
endfakeline[0] = EOL; /* guards any trailing backslash */
endfakeline[1] = EOL; /* line ends here or before */
}
- old_eof = eof;
- eof = TRUE; /* valid after first EOL */
+ old_eof = eofile;
+ eofile = TRUE; /* valid after first EOL */
ch = *(lineptr = fakeline);
if (defineflag)
{
@@ -428,7 +433,7 @@ ts_s_fakeline_tot += 3 + len + 2 + 2;
}
else
undef();
- eof = old_eof;
+ eofile = old_eof;
#ifdef TS
ts_s_fakeline_tot -= len + 2 + 2;
#endif
@@ -454,7 +459,7 @@ PUBLIC void docontrol()
while (TRUE)
{
skipeol();
- if (eof)
+ if (eofile)
return;
blanks();
if (ch == '#')
@@ -532,7 +537,7 @@ ts_s_macparam += sizeof *paramlist * nparleft;
ts_s_macparam_tot += sizeof *paramlist * nparleft;
#endif
blanks();
- while (ch == EOL && !eof)
+ while (ch == EOL && !eofile)
{
skipeol();
blanks();
@@ -604,7 +609,7 @@ ts_s_macparam_tot += sizeof *paramlist * nparleft;
skipeol(); /* macro case disposed of already */
if (SYMOFCHAR(ch) == SPECIALCHAR)
specialchar();
- if (eof)
+ if (eofile)
break;
}
else
@@ -642,12 +647,12 @@ ts_s_macparam_string_tot -= charptr - oldparam;
}
}
blanks();
- while (ch == EOL && !eof)
+ while (ch == EOL && !eofile)
{
skipeol();
blanks();
}
- if (eof)
+ if (eofile)
eofin("macro parameter expansion");
if (nparleft)
{
@@ -670,7 +675,7 @@ ts_s_macparam_string_tot -= charptr - oldparam;
if (ch == EOL)
{
skipeol();
- if (eof)
+ if (eofile)
break;
continue;
}
@@ -883,14 +888,14 @@ PUBLIC void skipcomment()
if (ch == EOL)
{
skipeol();
- if (eof)
+ if (eofile)
break;
}
else if (ch != '*')
gch1();
}
gch1();
- if (eof)
+ if (eofile)
{
eofin("comment");
return;
diff --git a/bcc/scan.c b/bcc/scan.c
index 0baecf8..5b7bb9a 100644
--- a/bcc/scan.c
+++ b/bcc/scan.c
@@ -212,7 +212,7 @@ PUBLIC void cppscan()
if (ch == EOL)
{
skipeol();
- if (eof)
+ if (eofile)
return;
break;
}
@@ -488,7 +488,7 @@ PUBLIC void nextsym()
return;
}
skipeol();
- if (eof)
+ if (eofile)
{
sym = EOFSYM;
return;
diff --git a/bcc/scan.h b/bcc/scan.h
index 5333e96..98db208 100644
--- a/bcc/scan.h
+++ b/bcc/scan.h
@@ -7,7 +7,7 @@
/* scanner codes */
-enum
+enum scan_states
{
/* The first group of entries consists of all the values that occur in the
switch for cppscan().
@@ -148,6 +148,7 @@ enum
STATICDECL,
TYPEDEFDECL,
+ ASMSYM,
BREAKSYM,
CASESYM,
CONTSYM,
diff --git a/bcc/state.c b/bcc/state.c
index cc821e3..36140c2 100644
--- a/bcc/state.c
+++ b/bcc/state.c
@@ -73,6 +73,7 @@ FORWARD void doswitch P((void));
FORWARD void dowhile P((void));
FORWARD void jumptocases P((void));
FORWARD void statement P((void));
+FORWARD void doasm P((void));
/* --- utility routines --- */
@@ -231,6 +232,22 @@ PUBLIC void compound() /* have just seen "{" */
rbrace();
}
+PRIVATE void doasm()
+{
+ lparen();
+ if (sym!=STRINGCONST)
+ error("string const expected");
+ else {
+ nextsym();
+ constant.value.s[charptr-constant.value.s]='\0';
+ outnstr("!BCC_ASM");
+ outnstr(constant.value.s);
+ outnstr("!BCC_ENDASM");
+ rparen();
+ semicolon();
+ }
+}
+
PRIVATE void dobreak()
{
offset_t spmark;
@@ -747,10 +764,14 @@ more:
case SEMICOLON:
nextsym();
return;
+ case ASMSYM:
+ nextsym();
+ doasm();
+ break;
case IDENT:
case TYPEDEFNAME:
blanks(); /* cannot afford nextsym() */
- while (ch == EOL && !eof)
+ while (ch == EOL && !eofile)
{
/* this now fails only on #controls and macros giving ':' */
skipeol();
diff --git a/bcc/table.c b/bcc/table.c
index 5a5c34e..e2580da 100644
--- a/bcc/table.c
+++ b/bcc/table.c
@@ -27,7 +27,7 @@
#define MARKER ((unsigned) 0x18C396A5L) /* lint everywhere it is used */
#define MAXEXPR 500
#define MAXLOCAL 100
-#define NKEYWORDS 34
+#define NKEYWORDS 35
#define NSCALTYPES 12
#define STACKSPACE 256 /* punt for normal recursions - switch extra */
@@ -92,6 +92,7 @@ PRIVATE struct keywordstruct keywords[NKEYWORDS] =
{ "typedef", TYPEDEFDECL, },
+ { "asm", ASMSYM, },
{ "break", BREAKSYM, },
{ "case", CASESYM, },
{ "continue", CONTSYM, },
diff --git a/bcc/tags b/bcc/tags
deleted file mode 100644
index c0babfc..0000000
--- a/bcc/tags
+++ /dev/null
@@ -1,341 +0,0 @@
-adc0 codefrag.c /^PUBLIC void adc0()$/
-add hardop.c /^PUBLIC void add(source, target)$/
-addconst codefrag.c /^PUBLIC void addconst(offset, reg)$/
-addglb table.c /^PUBLIC struct symstruct *addglb(name, type)$/
-addloc table.c /^PUBLIC struct symstruct *addloc(name, type)$/
-addlorg table.c /^PUBLIC struct symstruct *addlorg(name, type)$/
-addoffset genloads.c /^PUBLIC void addoffset(source)$/
-address genloads.c /^PUBLIC void address(source)$/
-addstruct type.c /^PUBLIC struct typestruct *addstruct(structname)$/
-addsym table.c /^PUBLIC void addsym(name, type, symptr)$/
-adjlc codefrag.c /^PUBLIC void adjlc(offset, reg)$/
-adjsp codefrag.c /^PUBLIC void adjsp(label)$/
-andconst codefrag.c /^PUBLIC void andconst(offset)$/
-assign assign.c /^PUBLIC void assign(source, target)$/
-assignment_exp express.c /^PUBLIC struct nodestruct *assignment_exp()$/
-bileaf gencode.c /^PUBLIC void bileaf(exp)$/
-bitcount gencode.c /^PUBLIC fastin_pt bitcount(number)$/
-blanks scan.c /^PUBLIC void blanks()$/
-blanksident preproc.c /^PUBLIC bool_pt blanksident()$/
-bssseg codefrag.c /^PUBLIC void bssseg()$/
-bugerror output.c /^PUBLIC void bugerror(message)$/
-bumplc label.c /^PUBLIC void bumplc()$/
-bumplc2 label.c /^PUBLIC void bumplc2()$/
-bumplc3 label.c /^PUBLIC void bumplc3()$/
-call function.c /^PUBLIC void call(name)$/
-casejump codefrag.c /^PUBLIC label_t casejump()$/
-cast assign.c /^PUBLIC void cast(type, target)$/
-castnode exptree.c /^PUBLIC struct nodestruct *castnode(type, nodeptr)$/
-changesp preserve.c /^PUBLIC void changesp(newsp, absflag)$/
-checknotinif preproc.c /^PUBLIC void checknotinif()$/
-clearfunclabels label.c /^PUBLIC void clearfunclabels()$/
-clearlabels label.c /^PUBLIC void clearlabels(patchbuf, patchtop)$/
-clearswitchlabels label.c /^PUBLIC void clearswitchlabels()$/
-closein input.c /^PUBLIC void closein()$/
-closeout output.c /^PUBLIC void closeout()$/
-clrBreg codefrag.c /^PUBLIC void clrBreg()$/
-clrBreg codefrag.c /^PUBLIC void clrBreg()$/
-cmp glogcode.c /^PUBLIC void cmp(source, target, pcondtrue)$/
-codeinit gencode.c /^PUBLIC void codeinit()$/
-colon declare.c /^PUBLIC void colon()$/
-comDreg codefrag.c /^PUBLIC void comDreg()$/
-comDreg codefrag.c /^PUBLIC void comDreg()$/
-comment codefrag.c /^PUBLIC void comment()$/
-comment codefrag.c /^PUBLIC void comment()$/
-common codefrag.c /^PUBLIC void common(name)$/
-compound state.c /^PUBLIC void compound() /* have just seen "{" */$/
-condop glogcode.c /^PUBLIC void condop(exp)$/
-constexpression loadexp.c /^PUBLIC value_t constexpression()$/
-constsym table.c /^PUBLIC struct symstruct *constsym(longconst)$/
-cppscan scan.c /^PUBLIC void cppscan()$/
-cseg codefrag.c /^PUBLIC void cseg()$/
-ctoi codefrag.c /^PUBLIC void ctoi()$/
-ctoi codefrag.c /^PUBLIC void ctoi()$/
-dbitem debug.c /^PUBLIC void dbitem(item)$/
-dbtype debug.c /^PUBLIC void dbtype(type)$/
-debug debug.c /^PUBLIC void debug(exp) /* sub-nodes must be leaves */$/
-debugswap debug.c /^PUBLIC void debugswap()$/
-decllist declare.c /^PUBLIC void decllist()$/
-defbyte codefrag.c /^PUBLIC void defbyte()$/
-defbyte codefrag.c /^PUBLIC void defbyte()$/
-defdword codefrag.c /^PUBLIC void defdword()$/
-define preproc.c /^PUBLIC void define()$/
-definestring preproc.c /^PUBLIC void definestring(str)$/
-deflabel label.c /^PUBLIC void deflabel(label)$/
-deflong codefrag.c /^PUBLIC void deflong(value)$/
-defnulls codefrag.c /^PUBLIC void defnulls(nullcount)$/
-defstr codefrag.c /^PUBLIC label_t defstr(sptr, stop, dataflag)$/
-defword codefrag.c /^PUBLIC void defword()$/
-defword codefrag.c /^PUBLIC void defword()$/
-defword codefrag.c /^PUBLIC void defword()$/
-delsym table.c /^PUBLIC void delsym(symptr)$/
-diveasy codefrag.c /^PUBLIC bool_pt diveasy(divisor, uflag)$/
-docontrol preproc.c /^PUBLIC void docontrol()$/
-dpseg codefrag.c /^PUBLIC void dpseg()$/
-dseg codefrag.c /^PUBLIC void dseg()$/
-dumpglbs table.c /^PUBLIC void dumpglbs()$/
-dumplocs table.c /^PUBLIC void dumplocs()$/
-dumpstrings table.c /^PUBLIC void dumpstrings()$/
-entermac preproc.c /^PUBLIC void entermac()$/
-eofin scan.c /^PUBLIC void eofin(message)$/
-equ codefrag.c /^PUBLIC void equ(name, string)$/
-equlab codefrag.c /^PUBLIC void equlab(label, offset)$/
-error output.c /^PUBLIC void error(message)$/
-error2error output.c /^PUBLIC void error2error(message1, message2)$/
-errorloc input.c /^PUBLIC void errorloc()$/
-etreeinit exptree.c /^PUBLIC void etreeinit()$/
-even codefrag.c /^PUBLIC void even()$/
-exchange genloads.c /^PUBLIC void exchange(source, target)$/
-expression express.c /^PUBLIC struct nodestruct *expression()$/
-exprsym table.c /^PUBLIC struct symstruct *exprsym(symptr)$/
-extend assign.c /^PUBLIC void extend(target)$/
-f_indirect floatop.c /^PUBLIC bool_pt f_indirect(target)$/
-fatalerror output.c /^PUBLIC void fatalerror(message)$/
-findlorg table.c /^PUBLIC struct symstruct *findlorg(name)$/
-findstruct table.c /^PUBLIC struct symstruct *findstruct(name)$/
-finishup output.c /^PUBLIC void finishup()$/
-float1op floatop.c /^PUBLIC void float1op(op, source)$/
-floatop floatop.c /^PUBLIC void floatop(op, source, target)$/
-flushout output.c /^PUBLIC void flushout()$/
-for table.c /^ for (i = 0; i < HASHTABSIZE; ++i)$/
-for table.c /^for (tp = &ts[0]; tp < &ts[sizeof ts / sizeof ts[0]]; ++tp)$/
-fpush floatop.c /^PUBLIC void fpush(source)$/
-function function.c /^PUBLIC void function(source)$/
-gch1 input.c /^PUBLIC void gch1()$/
-gethashptr table.c /^PUBLIC struct symstruct **gethashptr(sname)$/
-gethighlabel label.c /^PUBLIC label_t gethighlabel()$/
-getindexreg genloads.c /^PUBLIC store_pt getindexreg()$/
-getlabel label.c /^PUBLIC label_t getlabel()$/
-getlc label.c /^PUBLIC uoffset_t getlc()$/
-globl codefrag.c /^PUBLIC void globl(name)$/
-growheap table.c /^PUBLIC void growheap(size)$/
-growobject table.c /^PUBLIC void *growobject(object, extra)$/
-highbit gencode.c /^PUBLIC fastin_pt highbit(number)$/
-holdstr table.c /^PUBLIC label_t holdstr(sptr, stop)$/
-ifinit preproc.c /^PUBLIC void ifinit()$/
-import codefrag.c /^PUBLIC void import(name)$/
-incdec hardop.c /^PUBLIC void incdec(op, source)$/
-include input.c /^PUBLIC void include()$/
-indexadr genloads.c /^PUBLIC void indexadr(source, target)$/
-indirec genloads.c /^PUBLIC void indirec(source)$/
-initexpression loadexp.c /^PUBLIC void initexpression(type)$/
-initout output.c /^PUBLIC void initout()$/
-iscalartotype type.c /^PUBLIC struct typestruct *iscalartotype(scalar)$/
-isident scan.c /^PUBLIC bool_pt isident()$/
-itol codefrag.c /^PUBLIC void itol(reg)$/
-jump label.c /^PUBLIC void jump(label)$/
-jumpfalse glogcode.c /^PUBLIC void jumpfalse(exp, label)$/
-jumptrue glogcode.c /^PUBLIC void jumptrue(exp, label)$/
-justpushed floatop.c /^PUBLIC void justpushed(target)$/
-lbranch label.c /^PUBLIC void lbranch(cond, label)$/
-lcommlab codefrag.c /^PUBLIC void lcommlab(label)$/
-lcommon codefrag.c /^PUBLIC void lcommon(name)$/
-ldregargs function.c /^PUBLIC void ldregargs()$/
-lea codefrag.c /^PUBLIC void lea(offset, sourcereg, targreg)$/
-leafnode exptree.c /^PUBLIC struct nodestruct *leafnode(source)$/
-leavemac preproc.c /^PUBLIC void leavemac()$/
-limiterror output.c /^PUBLIC void limiterror(message)$/
-listo function.c /^PUBLIC void listo(target, lastargsp)$/
-listroot function.c /^PUBLIC void listroot(target)$/
-load genloads.c /^PUBLIC void load(source, targreg)$/
-loadany genloads.c /^PUBLIC void loadany(source)$/
-loadconst codefrag.c /^PUBLIC void loadconst(offset, reg)$/
-loadexpression loadexp.c /^PUBLIC struct typestruct *loadexpression(targreg, targtype)$/
-loadpres preserve.c /^PUBLIC void loadpres(source, target)$/
-loadreg genloads.c /^PUBLIC void loadreg(source, targreg)$/
-loadretexpression function.c /^PUBLIC void loadretexpression()$/
-logop glogcode.c /^PUBLIC void logop(exp)$/
-long1op longop.c /^PUBLIC void long1op(op, target)$/
-longop longop.c /^PUBLIC void longop(op, source, target)$/
-lparen declare.c /^PUBLIC void lparen()$/
-lslconst codefrag.c /^PUBLIC int lslconst(shift, reg)$/
-lsrconst codefrag.c /^PUBLIC int lsrconst(shift, reg, uflag)$/
-main bcc-cc1.c /^PUBLIC int main(argc, argv)$/
-main bcc.c /^PUBLIC int main(argc, argv)$/
-makeleaf gencode.c /^PUBLIC void makeleaf(exp)$/
-makelessindirect genloads.c /^PUBLIC void makelessindirect(source)$/
-modeasy codefrag.c /^PUBLIC bool_pt modeasy(divisor, uflag)$/
-modstk preserve.c /^PUBLIC void modstk(newsp)$/
-movereg genloads.c /^PUBLIC void movereg(source, targreg)$/
-muleasy codefrag.c /^PUBLIC bool_pt muleasy(factor, reg)$/
-namedlabel label.c /^PUBLIC struct symstruct *namedlabel()$/
-needvarname declare.c /^PUBLIC void needvarname()$/
-neg hardop.c /^PUBLIC void neg(target)$/
-negDreg codefrag.c /^PUBLIC void negDreg()$/
-negDreg codefrag.c /^PUBLIC void negDreg()$/
-negreg codefrag.c /^PUBLIC void negreg(reg)$/
-newlevel table.c /^PUBLIC void newlevel()$/
-newtype type.c /^PUBLIC struct typestruct *newtype()$/
-nextsym scan.c /^PUBLIC void nextsym()$/
-node exptree.c /^PUBLIC struct nodestruct *node(t, p1, p2)$/
-not hardop.c /^PUBLIC void not(target)$/
-oldlevel table.c /^PUBLIC void oldlevel()$/
-onstack genloads.c /^PUBLIC void onstack(target)$/
-op1 hardop.c /^PUBLIC void op1(op, source, target)$/
-openio input.c /^PUBLIC void openio(argc, argv)$/
-openout output.c /^PUBLIC void openout(oname)$/
-opstring codefrag.c /^PUBLIC char *opstring(op)$/
-ourfree table.c /^PUBLIC void ourfree(ptr)$/
-ourmalloc table.c /^PUBLIC void *ourmalloc(nbytes)$/
-outABX codefrag.c /^PUBLIC void outABX()$/
-outadd codefrag.c /^PUBLIC void outadd()$/
-outadd codefrag.c /^PUBLIC void outadd()$/
-outaddsp codefrag.c /^PUBLIC void outaddsp()$/
-outaddsp codefrag.c /^PUBLIC void outaddsp()$/
-outadr genloads.c /^PUBLIC void outadr(adr)$/
-outbyte output.c /^PUBLIC void outbyte(c)$/
-outcalladr codefrag.c /^PUBLIC void outcalladr()$/
-outcalladr codefrag.c /^PUBLIC void outcalladr()$/
-outcalladr codefrag.c /^PUBLIC void outcalladr()$/
-outccname codefrag.c /^PUBLIC void outccname(name)$/
-outcmp codefrag.c /^PUBLIC void outcmp()$/
-outcmp codefrag.c /^PUBLIC void outcmp()$/
-outcomma output.c /^PUBLIC void outcomma()$/
-outcond label.c /^PUBLIC void outcond(cond)$/
-outcpplinenumber output.c /^PUBLIC void outcpplinenumber(nr, fname, str)$/
-outcregname genloads.c /^PUBLIC void outcregname(reg)$/
-outdec codefrag.c /^PUBLIC void outdec()$/
-outdec codefrag.c /^PUBLIC void outdec()$/
-outdirectpage codefrag.c /^PUBLIC void outdirectpage()$/
-outdword codefrag.c /^PUBLIC void outdword()$/
-outextended codefrag.c /^PUBLIC void outextended()$/
-outfail codefrag.c /^PUBLIC void outfail()$/
-outfail codefrag.c /^PUBLIC void outfail()$/
-outhex output.c /^PUBLIC void outhex(num)$/
-outhexdigs output.c /^PUBLIC void outhexdigs(num)$/
-outhiaccum codefrag.c /^PUBLIC void outhiaccum()$/
-outimadj codefrag.c /^PUBLIC void outimadj(offset, targreg)$/
-outimmadr codefrag.c /^PUBLIC void outimmadr(offset)$/
-outimmed codefrag.c /^PUBLIC void outimmed()$/
-outinc codefrag.c /^PUBLIC void outinc()$/
-outinc codefrag.c /^PUBLIC void outinc()$/
-outindframereg codefrag.c /^PUBLIC void outindframereg()$/
-outindleft codefrag.c /^PUBLIC void outindleft()$/
-outindleft codefrag.c /^PUBLIC void outindleft()$/
-outindleft codefrag.c /^PUBLIC void outindleft()$/
-outindright codefrag.c /^PUBLIC void outindright()$/
-outindright codefrag.c /^PUBLIC void outindright()$/
-outindright codefrag.c /^PUBLIC void outindright()$/
-outindstackreg codefrag.c /^PUBLIC void outindstackreg()$/
-outjumpstring codefrag.c /^PUBLIC void outjumpstring()$/
-outlabel label.c /^PUBLIC void outlabel(label)$/
-outldaccum codefrag.c /^PUBLIC void outldaccum()$/
-outldaccum codefrag.c /^PUBLIC void outldaccum()$/
-outldmulreg codefrag.c /^PUBLIC void outldmulreg()$/
-outldmulreg codefrag.c /^PUBLIC void outldmulreg()$/
-outlea codefrag.c /^PUBLIC void outlea()$/
-outlea codefrag.c /^PUBLIC void outlea()$/
-outleasp codefrag.c /^PUBLIC void outleasp()$/
-outleasp codefrag.c /^PUBLIC void outleasp()$/
-outline output.c /^PUBLIC void outline(s)$/
-outload codefrag.c /^PUBLIC void outload()$/
-outload codefrag.c /^PUBLIC void outload()$/
-outlongendian longop.c /^PUBLIC void outlongendian()$/
-outminus output.c /^PUBLIC void outminus()$/
-outmulmulreg codefrag.c /^PUBLIC void outmulmulreg()$/
-outmulmulreg codefrag.c /^PUBLIC void outmulmulreg()$/
-outnbyte output.c /^PUBLIC void outnbyte(byte)$/
-outnccname codefrag.c /^PUBLIC void outnccname(name)$/
-outncimmadr codefrag.c /^PUBLIC void outncimmadr(offset)$/
-outncregname genloads.c /^PUBLIC void outncregname(reg)$/
-outncspregname codefrag.c /^PUBLIC void outncspregname()$/
-outnhex output.c /^PUBLIC void outnhex(num)$/
-outnl output.c /^PUBLIC void outnl()$/
-outnlabel label.c /^PUBLIC void outnlabel(label)$/
-outnop1str output.c /^PUBLIC void outnop1str(s)$/
-outnop2str output.c /^PUBLIC void outnop2str(s)$/
-outnregname genloads.c /^PUBLIC void outnregname(reg)$/
-outnstr output.c /^PUBLIC void outnstr(s)$/
-outntypechar type.c /^PUBLIC void outntypechar(type)$/
-outoffset codefrag.c /^PUBLIC void outoffset(offset)$/
-outofmemoryerror table.c /^PUBLIC void outofmemoryerror(message)$/
-outop0str output.c /^PUBLIC void outop0str(s)$/
-outop1str output.c /^PUBLIC void outop1str(s)$/
-outop2str output.c /^PUBLIC void outop2str(s)$/
-outop3str output.c /^PUBLIC void outop3str(s)$/
-outopsep codefrag.c /^PUBLIC void outopsep()$/
-outopsep codefrag.c /^PUBLIC void outopsep()$/
-outplus output.c /^PUBLIC void outplus()$/
-outpshs codefrag.c /^PUBLIC void outpshs()$/
-outpshs codefrag.c /^PUBLIC void outpshs()$/
-outpuls codefrag.c /^PUBLIC void outpuls()$/
-outpuls codefrag.c /^PUBLIC void outpuls()$/
-outregname genloads.c /^PUBLIC void outregname(reg)$/
-outreturn codefrag.c /^PUBLIC void outreturn()$/
-outreturn codefrag.c /^PUBLIC void outreturn()$/
-outshex output.c /^PUBLIC void outshex(num)$/
-outshortregname genloads.c /^PUBLIC void outshortregname(reg)$/
-outstore codefrag.c /^PUBLIC void outstore()$/
-outstore codefrag.c /^PUBLIC void outstore()$/
-outstr output.c /^PUBLIC void outstr(s)$/
-outsub codefrag.c /^PUBLIC void outsub()$/
-outsub codefrag.c /^PUBLIC void outsub()$/
-outswoffset state.c /^PUBLIC void outswoffset (offset)$/
-outswstacklab state.c /^PUBLIC void outswstacklab()$/
-outtab output.c /^PUBLIC void outtab()$/
-outtest codefrag.c /^PUBLIC void outtest()$/
-outtest codefrag.c /^PUBLIC void outtest()$/
-outudec output.c /^PUBLIC void outudec(num)$/
-outuvalue output.c /^PUBLIC void outuvalue(num)$/
-outvalue output.c /^PUBLIC void outvalue(num)$/
-outword codefrag.c /^PUBLIC void outword()$/
-pointat genloads.c /^PUBLIC void pointat(target)$/
-pointype type.c /^PUBLIC struct typestruct *pointype(type)$/
-popframe function.c /^PUBLIC void popframe()$/
-poplist genloads.c /^PUBLIC void poplist(reglist)$/
-predefine preproc.c /^PUBLIC void predefine()$/
-prefix type.c /^PUBLIC struct typestruct *prefix(constructor, size, type)$/
-pres2 preserve.c /^PUBLIC void pres2(source, target)$/
-preserve preserve.c /^PUBLIC void preserve(source)$/
-preslval preserve.c /^PUBLIC store_pt preslval(source, target)$/
-program declare.c /^PUBLIC void program()$/
-promote type.c /^PUBLIC struct typestruct *promote(type)$/
-ptrsub hardop.c /^PUBLIC void ptrsub(source, target)$/
-public codefrag.c /^PUBLIC void public(name)$/
-push genloads.c /^PUBLIC void push(source)$/
-pushlist genloads.c /^PUBLIC void pushlist(reglist)$/
-pushreg genloads.c /^PUBLIC void pushreg(reg)$/
-pushudec output.c /^PUBLIC char *pushudec(s, num)$/
-qmalloc table.c /^PUBLIC void *qmalloc(size)$/
-rbrace declare.c /^PUBLIC void rbrace()$/
-rbracket declare.c /^PUBLIC void rbracket()$/
-recovlist preserve.c /^PUBLIC void recovlist(reglist)$/
-regexchange codefrag.c /^PUBLIC void regexchange(sourcereg, targreg)$/
-regtransfer codefrag.c /^PUBLIC void regtransfer(sourcereg, targreg)$/
-reslocals function.c /^PUBLIC void reslocals()$/
-restoreopreg codefrag.c /^PUBLIC void restoreopreg()$/
-ret function.c /^PUBLIC void ret()$/
-rparen declare.c /^PUBLIC void rparen()$/
-savedlineptr preproc.c /^PUBLIC char *savedlineptr()$/
-saveopreg codefrag.c /^PUBLIC void saveopreg()$/
-savereturn preserve.c /^PUBLIC void savereturn(savelist, saveoffset)$/
-sbc0 codefrag.c /^PUBLIC void sbc0()$/
-sbranch label.c /^PUBLIC void sbranch(cond, label)$/
-sctoi codefrag.c /^PUBLIC void sctoi()$/
-sctoi codefrag.c /^PUBLIC void sctoi()$/
-semicolon declare.c /^PUBLIC void semicolon()$/
-set codefrag.c /^PUBLIC void set(name, value)$/
-setoutbufs output.c /^PUBLIC void setoutbufs()$/
-skipcomment preproc.c /^PUBLIC void skipcomment()$/
-skipeol input.c /^PUBLIC void skipeol()$/
-skipline preproc.c /^PUBLIC void skipline()$/
-sl1 codefrag.c /^PUBLIC void sl1(reg)$/
-slconst codefrag.c /^PUBLIC void slconst(shift, reg)$/
-softop softop.c /^PUBLIC void softop(op, source, target)$/
-specialchar input.c /^PUBLIC void specialchar()$/
-srconst codefrag.c /^PUBLIC void srconst(shift, uflag)$/
-stoi codefrag.c /^PUBLIC void stoi()$/
-storereg genloads.c /^PUBLIC void storereg(sourcereg, target)$/
-stringorcharconst scan.c /^PUBLIC void stringorcharconst()$/
-struc genloads.c /^PUBLIC void struc(source, target)$/
-sub hardop.c /^PUBLIC void sub(source, target)$/
-swapsym table.c /^PUBLIC void swapsym(sym1, sym2)$/
-syminit table.c /^PUBLIC void syminit()$/
-tounsigned type.c /^PUBLIC struct typestruct *tounsigned(type)$/
-transfer genloads.c /^PUBLIC void transfer(source, targreg)$/
-typeinit type.c /^PUBLIC void typeinit()$/
-typename declare.c /^PUBLIC struct typestruct *typename()$/
-uitol codefrag.c /^PUBLIC void uitol(reg)$/
-unbumplc label.c /^PUBLIC void unbumplc()$/
-undefinestring preproc.c /^PUBLIC void undefinestring(str)$/
-ustoi codefrag.c /^PUBLIC void ustoi()$/