summaryrefslogtreecommitdiff
path: root/copt
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1999-01-23 13:29:22 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:40:39 +0200
commite62b35169cdcd13632ae353b1e5ffde7dec44201 (patch)
tree2646548ca84edb365354a6e68459f92943532cee /copt
parent2233d47f9d89c107b6c425626d6eb2669363b055 (diff)
downloaddev86-e62b35169cdcd13632ae353b1e5ffde7dec44201.tar.gz
Import Dev86src-0.14.7.tar.gzv0.14.7
Diffstat (limited to 'copt')
-rw-r--r--copt/copt.c21
-rw-r--r--copt/rules.8613
2 files changed, 12 insertions, 22 deletions
diff --git a/copt/copt.c b/copt/copt.c
index 12a5ac2..24577ae 100644
--- a/copt/copt.c
+++ b/copt/copt.c
@@ -54,9 +54,7 @@ struct line_s {
char *text;
struct line_s *prev;
struct line_s *next;
-#ifdef KEEPCOMMENTS
int comment_flg;
-#endif
};
@@ -196,9 +194,7 @@ static struct line_s *readlist(FILE *fp, char quit, char comment)
if (quit != NOCHAR && quit == *cp)
break;
if (comment != NOCHAR && comment == *cp)
-#ifdef KEEPCOMMENTS
if (quit != NOCHAR)
-#endif
continue;
if (*cp == '\0')
continue;
@@ -206,9 +202,7 @@ static struct line_s *readlist(FILE *fp, char quit, char comment)
lp->text = install(cp, -1);
lp->prev = last_line;
lp->next = NULL;
-#ifdef KEEPCOMMENTS
lp->comment_flg = (comment != NOCHAR && *cp == comment);
-#endif
if (first_line == NULL)
first_line = lp;
if (last_line != NULL)
@@ -677,12 +671,6 @@ static struct line_s *optline(struct line_s *cur)
/* Scan through pattern texts and match them against the input file */
ins = cur;
pat = rp->old;
-#ifndef KEEPCOMMENTS
- while (ins != NULL && pat != NULL && match(ins->text, pat->text)) {
- ins = ins->next;
- pat = pat->next;
- }
-#else
while (ins != NULL
&& pat != NULL
&& ( ins->comment_flg ||
@@ -693,7 +681,6 @@ static struct line_s *optline(struct line_s *cur)
pat = pat->next;
ins = ins->next;
}
-#endif
/* Current pattern matched input line, so replace input with new */
if (pat == NULL) {
@@ -701,7 +688,6 @@ static struct line_s *optline(struct line_s *cur)
lp1 = cur;
cur = cur->prev;
while (lp1 != ins) {
-#ifdef KEEPCOMMENTS
#if 0 /* I'd like to keep the comment lines but this doesn't work XXX */
if( lp1->comment_flg )
{
@@ -714,7 +700,6 @@ static struct line_s *optline(struct line_s *cur)
}
else
#endif
-#endif
{
lp2 = lp1;
lp1 = lp1->next;
@@ -730,9 +715,7 @@ static struct line_s *optline(struct line_s *cur)
lp2->text = subst(pat->text);
lp2->next = NULL;
lp2->prev = lp1;
-#ifdef KEEPCOMMENTS
lp2->comment_flg = 0;
-#endif
if (lp1 != NULL)
lp1->next = lp2;
else
@@ -763,14 +746,11 @@ static void optimize(int backup)
{
struct line_s *cur, *lp;
int i;
-#ifdef KEEPCOMMENTS
int in_asm = 0;
-#endif
/* Scan through all lines in the input file */
cur = infile;
while (cur != NULL) {
-#ifdef KEEPCOMMENTS
if (cur->comment_flg || in_asm)
{
lp=cur->next;
@@ -778,7 +758,6 @@ static void optimize(int backup)
in_asm = (memcmp(cur->text+5, "ASM", 3) == 0);
}
else
-#endif
if ((lp = optline(cur)) != NULL && lp != cur->next) {
for (i = 0; i < backup && lp != NULL; i++)
lp = lp->prev;
diff --git a/copt/rules.86 b/copt/rules.86
index b788312..f0654f4 100644
--- a/copt/rules.86
+++ b/copt/rules.86
@@ -344,7 +344,7 @@ ret
jmp .%1
.%1:
=
-.%1
+.%1:
jmp .%1
.%2:
@@ -435,3 +435,14 @@ add sp,*%4
%1 %2
add sp,*%3+%4
+# And a great bug floating push/pop
+push dx
+push cx
+push bx
+push ax
+pop ax
+pop bx
+pop cx
+pop dx
+=
+! push/pop