shithub: scc

Download patch

ref: 91922108644eb444fd8942da683e1324598942e7
parent: 3a1fdd58d1df1f03f38e29a7f578cb22b2728efc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun May 20 04:15:21 EDT 2018

Revert "[as] Allow left to right or right to left parsing"

This reverts commit 3a967c42aea6b064d29b12d499413a1470c44959.

--- a/as/ins.c
+++ b/as/ins.c
@@ -247,14 +247,3 @@
 {
 	addinput(args[0]->sym->name.buf);
 }
-
-void
-att(Op *op, Node **args)
-{
-	Symbol *sym = args[0]->sym;
-	extern int left2right;
-
-	if ((sym->flags & FABS) == 0)
-		error("align expression is not an absolute expression");
-	left2right = sym->value;
-}
--- a/as/main.c
+++ b/as/main.c
@@ -105,7 +105,6 @@
 main(int argc, char *argv[])
 {
 	char **p;
-	extern int left2right;
 
 	outfile = "a.out";
 
@@ -112,12 +111,6 @@
 	ARGBEGIN {
 	case 'o':
 		outfile = EARGF(usage());
-		break;
-	case 'l':
-		left2right = 1;
-		break;
-	case 'r':
-		left2right = 0;
 		break;
 	default:
 		usage();
--- a/as/parser.c
+++ b/as/parser.c
@@ -300,24 +300,14 @@
 getargs(char *s)
 {
 	Node **ap;
-	extern int left2right;
-	static Node *args[NARGS+1];
+	static Node *args[NARGS];
 
 	if (!s)
 		return NULL;
 
-	if (!left2right) {
-		ap = args;
-		do {
-			if ((*ap = operand(&s)) == NULL)
-				return args;
-		} while (++ap < &args[NARGS]);
-	} else {
-		ap = &args[NARGS];
-		do {
-			if ((*--ap = operand(&s)) == NULL)
-				return ap+1;
-		} while (ap > args+1);
+	for (ap = args; ap < &args[NARGS-1]; ++ap) {
+		if ((*ap = operand(&s)) == NULL)
+			return args;
 	}
 	error("too many arguments in one instruction");
 }
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -33,7 +33,6 @@
 .STRING	string+	0	none	string	Z80,R800,GB80
 .ASCII	string+	0	none	ascii	Z80,R800,GB80
 .ALIGN	imm16+	0	none	align	Z80,R800,GB80
-.ATT	imm8	0	none	att	Z80,R800,GB80
 .END	none	0	none	end	Z80,R800,GB80
 .INCLUDE	string	0	none	include	Z80,R800,GB80
 
--- a/as/target/x80/z80.c
+++ b/as/target/x80/z80.c
@@ -8,7 +8,6 @@
 
 TUINT maxaddr = 0xFFFFFFFF;
 int endian = LITTLE_ENDIAN;
-int left2right = 0;
 
 void
 iarch(void)
--- a/as/target/x86/amd64.c
+++ b/as/target/x86/amd64.c
@@ -5,7 +5,6 @@
 
 TUINT maxaddr = 0xFFFFFFFFFFFFFFFF;
 int endian = LITTLE_ENDIAN;
-int left2right = 0;
 
 void
 iarch(void)
--- a/as/target/x86/i386.c
+++ b/as/target/x86/i386.c
@@ -6,7 +6,6 @@
 
 TUINT maxaddr = 0xFFFFFFFF;
 int endian = LITTLE_ENDIAN;
-int left2right = 0;
 
 void
 iarch(void)