diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-11 05:03:49 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-11 05:03:49 +0200 |
commit | 1b8a56941708e6fe884f4649f718fae7c543c045 (patch) | |
tree | 3d7be0a7e43b01aba6dd986bff06bcc3947a6d78 /sys/src/cmd/2a | |
parent | 9d46360c9d83fa95f42f1eebbad49ecd9281fb0d (diff) |
cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
for gethunk() to work, all allocators have to use it,
including allocations done by libc thru malloc(),
so the fake allocation functions are mandatory for
everyone.
to avoid duplication the code is moved to cc/compat
and prototypes provided in new cc/compat.h header.
Diffstat (limited to 'sys/src/cmd/2a')
-rw-r--r-- | sys/src/cmd/2a/a.h | 31 | ||||
-rw-r--r-- | sys/src/cmd/2a/mkfile | 1 |
2 files changed, 2 insertions, 30 deletions
diff --git a/sys/src/cmd/2a/a.h b/sys/src/cmd/2a/a.h index 68cd1e8dc..798b2a1d7 100644 --- a/sys/src/cmd/2a/a.h +++ b/sys/src/cmd/2a/a.h @@ -2,10 +2,7 @@ #include <libc.h> #include <bio.h> #include "../2c/2.out.h" - -#ifndef EXTERN -#define EXTERN extern -#endif +#include "../cc/compat.h" typedef struct Sym Sym; typedef struct Ref Ref; @@ -115,14 +112,12 @@ EXTERN int nDlist; EXTERN Hist* ehist; EXTERN int newflag; EXTERN Hist* hist; -EXTERN char* hunk; EXTERN char* include[NINCLUDE]; EXTERN Io* iofree; EXTERN Io* ionext; EXTERN Io* iostack; EXTERN long lineno; EXTERN int nerrors; -EXTERN long nhunk; EXTERN int ninclude; EXTERN Gen nullgen; EXTERN char* outfile; @@ -134,10 +129,8 @@ EXTERN int sym; EXTERN char symb[NSYMB]; EXTERN int thechar; EXTERN char* thestring; -EXTERN uintptr thunk; EXTERN Biobuf obuf; -void* allocn(void*, long, long); void errorexit(void); void pushio(void); void newio(void); @@ -173,29 +166,7 @@ void macend(void); void dodefine(char*); void prfile(long); void linehist(char*, int); -void gethunk(void); void yyerror(char*, ...); int yyparse(void); void setinclude(char*); int assemble(char*); - -enum /* keep in synch with ../cc/cc.h */ -{ - Plan9 = 1<<0, - Unix = 1<<1, - Windows = 1<<2 -}; - -/* - * system-dependent stuff from ../cc/compat.c - */ -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/sys/src/cmd/2a/mkfile b/sys/src/cmd/2a/mkfile index f5584a7e5..73ccb3d20 100644 --- a/sys/src/cmd/2a/mkfile +++ b/sys/src/cmd/2a/mkfile @@ -7,6 +7,7 @@ OFILES=\ HFILES=\ ../2c/2.out.h\ + ../cc/compat.h\ y.tab.h\ a.h\ |