summaryrefslogtreecommitdiff
path: root/src/cmd/5a
diff options
context:
space:
mode:
authorKai Backman <kaib@golang.org>2009-03-25 16:31:38 -0700
committerKai Backman <kaib@golang.org>2009-03-25 16:31:38 -0700
commit8a96d0b0520d810b1c73bf646038ece36939023e (patch)
tree7191f3ca8fa4916312747c406979c1a9c420eba6 /src/cmd/5a
parent87fd31763d912fa3a0b8ae3e7f17448a9152266c (diff)
downloadgo-8a96d0b0520d810b1c73bf646038ece36939023e.tar.gz
This is really two changes in one but given interdependencies
and expected review latency I needed to combine the CLs. 1. Made the 5* toolpath build using the go build system. Hooked the subdirectories to clean.bash but added a separate make5.bash for now. Minor massage to make the code more similar to the current structure of 6c/6a/6l. 2. Change all references from long to int32 in line with similar change for the other toolchains. The end result is that 5c, 5a and 5l can now be compiled and the executables start up properly. Haven't thrown any input at them yet. R=rsc APPROVED=rsc DELTA=1052 (392 added, 328 deleted, 332 changed) OCL=26757 CL=26761
Diffstat (limited to 'src/cmd/5a')
-rw-r--r--src/cmd/5a/Makefile42
-rw-r--r--src/cmd/5a/a.h48
-rw-r--r--src/cmd/5a/a.y4
-rw-r--r--src/cmd/5a/lex.c6
4 files changed, 61 insertions, 39 deletions
diff --git a/src/cmd/5a/Makefile b/src/cmd/5a/Makefile
new file mode 100644
index 000000000..d9e91a03a
--- /dev/null
+++ b/src/cmd/5a/Makefile
@@ -0,0 +1,42 @@
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+include ../../Make.conf
+
+TARG=\
+ 5a\
+
+HFILES=\
+ a.h\
+ y.tab.h\
+ ../5l/5.out.h\
+ compat.h\
+
+OFILES=\
+ y.tab.$O\
+ lex.$O\
+ compat.$O\
+# ../5l/enam.$O\
+
+YFILES=\
+ a.y\
+
+$(TARG): $(OFILES)
+ $(LD) -o $(TARG) -L$(GOROOT)/lib $(OFILES) -lbio -l9
+
+$(OFILES): $(HFILES)
+
+lex.$O: ../cc/macbody ../cc/lexbody
+
+y.tab.h: $(YFILES)
+ bison -y $(YFLAGS) $(YFILES)
+
+y.tab.c: y.tab.h
+ test -f y.tab.c && touch y.tab.c
+
+clean:
+ rm -f $(OFILES) $(TARG) *.5 enam.c 5.out a.out y.tab.h y.tab.c
+
+install: $(TARG)
+ cp $(TARG) $(BIN)/$(TARG)
diff --git a/src/cmd/5a/a.h b/src/cmd/5a/a.h
index c93b73121..939ae563e 100644
--- a/src/cmd/5a/a.h
+++ b/src/cmd/5a/a.h
@@ -30,7 +30,8 @@
#include <lib9.h>
#include <bio.h>
-#include "../5c/5.out.h"
+#include "../5l/5.out.h"
+#include "compat.h"
#ifndef EXTERN
#define EXTERN extern
@@ -59,7 +60,7 @@ struct Sym
{
Sym* link;
char* macro;
- long value;
+ int32 value;
ushort type;
char *name;
char sym;
@@ -91,7 +92,7 @@ EXTERN struct
struct Gen
{
Sym* sym;
- long offset;
+ int32 offset;
short type;
short reg;
short name;
@@ -103,8 +104,8 @@ struct Hist
{
Hist* link;
char* name;
- long line;
- long offset;
+ int32 line;
+ int32 offset;
};
#define H ((Hist*)0)
@@ -130,25 +131,25 @@ EXTERN char* include[NINCLUDE];
EXTERN Io* iofree;
EXTERN Io* ionext;
EXTERN Io* iostack;
-EXTERN long lineno;
+EXTERN int32 lineno;
EXTERN int nerrors;
-EXTERN long nhunk;
+EXTERN int32 nhunk;
EXTERN int ninclude;
EXTERN Gen nullgen;
EXTERN char* outfile;
EXTERN int pass;
EXTERN char* pathname;
-EXTERN long pc;
+EXTERN int32 pc;
EXTERN int peekc;
EXTERN int sym;
EXTERN char symb[NSYMB];
EXTERN int thechar;
EXTERN char* thestring;
-EXTERN long thunk;
+EXTERN int32 thunk;
EXTERN Biobuf obuf;
-void* alloc(long);
-void* allocn(void*, long, long);
+void* alloc(int32);
+void* allocn(void*, int32, int32);
void errorexit(void);
void pushio(void);
void newio(void);
@@ -156,7 +157,7 @@ void newfile(char*, int);
Sym* slookup(char*);
Sym* lookup(void);
void syminit(Sym*);
-long yylex(void);
+int32 yylex(void);
int getc(void);
int getnsc(void);
void unget(int);
@@ -182,31 +183,10 @@ void macif(int);
void macend(void);
void outhist(void);
void dodefine(char*);
-void prfile(long);
+void prfile(int32);
void linehist(char*, int);
void gethunk(void);
void yyerror(char*, ...);
int yyparse(void);
void setinclude(char*);
int assemble(char*);
-
-/*
- * system-dependent stuff from ../cc/compat.c
- */
-
-enum /* keep in synch with ../cc/cc.h */
-{
- Plan9 = 1<<0,
- Unix = 1<<1,
- Windows = 1<<2,
-};
-int mywait(int*);
-int mycreat(char*, int);
-int systemtype(int);
-int pathchar(void);
-char* mygetwd(char*, int);
-int myexec(char*, char*[]);
-int mydup(int, int);
-int myfork(void);
-int mypipe(int*);
-void* mysbrk(ulong);
diff --git a/src/cmd/5a/a.y b/src/cmd/5a/a.y
index b41f9b65d..a1de1ea5a 100644
--- a/src/cmd/5a/a.y
+++ b/src/cmd/5a/a.y
@@ -34,7 +34,7 @@
%union
{
Sym *sym;
- long lval;
+ int32 lval;
double dval;
char sval[8];
Gen gen;
@@ -288,7 +288,7 @@ inst:
/*
* MULA hi,lo,r1,r2
*/
-| LTYPEN cond reg ',' reg ',' reg ',' spreg
+| LTYPEN cond reg ',' reg ',' reg ',' spreg
{
$7.type = D_REGREG;
$7.offset = $9;
diff --git a/src/cmd/5a/lex.c b/src/cmd/5a/lex.c
index 8ca10249e..fc17b9770 100644
--- a/src/cmd/5a/lex.c
+++ b/src/cmd/5a/lex.c
@@ -444,9 +444,9 @@ cinit(void)
}
pathname = allocn(pathname, 0, 100);
- if(mygetwd(pathname, 99) == 0) {
+ if(getwd(pathname, 99) == 0) {
pathname = allocn(pathname, 100, 900);
- if(mygetwd(pathname, 999) == 0)
+ if(getwd(pathname, 999) == 0)
strcpy(pathname, "/???");
}
}
@@ -492,7 +492,7 @@ zname(char *n, int t, int s)
void
zaddr(Gen *a, int s)
{
- long l;
+ int32 l;
int i;
char *n;
Ieee e;