all: remove need for -fcommon

Use `extern` where appropriate so that we can remove `-fcommon`
on macOS and others.  On macOS, `-fcommon` generates a number of
linker warnings.

I've tested building on macOS, Linux, FreeBSD, NetBSD, OpenBSD
and illumos.  I am not in a position to test on AIX or other
more esoteric platforms, however.
This commit is contained in:
Dan Cross
2025-07-23 06:47:21 -04:00
parent 1e6e30e91e
commit 156e745be9
39 changed files with 330 additions and 184 deletions

4
bin/9c
View File

@@ -23,7 +23,7 @@ usegcc()
-Wno-deprecated-declarations \ -Wno-deprecated-declarations \
-fno-omit-frame-pointer \ -fno-omit-frame-pointer \
-fsigned-char \ -fsigned-char \
-fcommon \ -fno-common \
-std=gnu11 \ -std=gnu11 \
" "
# want to put -fno-optimize-sibling-calls here but # want to put -fno-optimize-sibling-calls here but
@@ -85,7 +85,7 @@ useclang()
-Wno-unused-but-set-variable \ -Wno-unused-but-set-variable \
-fsigned-char \ -fsigned-char \
-fno-caret-diagnostics \ -fno-caret-diagnostics \
-fcommon \ -fno-common \
" "
cflags="$cflags -g" cflags="$cflags -g"
cflags="$cflags $CC9FLAGS" cflags="$cflags $CC9FLAGS"

View File

@@ -15,8 +15,6 @@ Conform *map;
static void addprotofile(char *new, char *old, Dir *d, void *a); static void addprotofile(char *new, char *old, Dir *d, void *a);
void usage(void); void usage(void);
char *argv0;
void void
usage(void) usage(void)
{ {

View File

@@ -60,7 +60,6 @@
#endif #endif
int debug; int debug;
char *argv0;
char *aname = ""; char *aname = "";
void fusedispatch(void*); void fusedispatch(void*);
Channel *fusechan; Channel *fusechan;

View File

@@ -209,19 +209,19 @@ struct Timer
#define Extern extern #define Extern extern
#endif #endif
Extern Font *font; extern Font *font;
Extern Mousectl *mousectl; Extern Mousectl *mousectl;
Extern Mouse *mouse; Extern Mouse *mouse;
Extern Keyboardctl *keyboardctl; Extern Keyboardctl *keyboardctl;
Extern Display *display; extern Display *display;
Extern Image *view; Extern Image *view;
Extern Screen *wscreen; Extern Screen *wscreen;
Extern Cursor boxcursor; extern Cursor boxcursor;
Extern Cursor crosscursor; extern Cursor crosscursor;
Extern Cursor sightcursor; extern Cursor sightcursor;
Extern Cursor whitearrow; extern Cursor whitearrow;
Extern Cursor query; extern Cursor query;
Extern Cursor *corners[9]; extern Cursor *corners[9];
Extern Image *background; Extern Image *background;
Extern Image *lightgrey; Extern Image *lightgrey;
Extern Image *red; Extern Image *red;

View File

@@ -47,14 +47,14 @@ Extern Node* code;
Extern int na; Extern int na;
Extern int wtflag; Extern int wtflag;
Extern Regs* acidregs; Extern Regs* acidregs;
Extern Regs* correg; extern Regs* correg;
Extern Map* cormap; extern Map* cormap;
Extern Map* symmap; extern Map* symmap;
Extern Lsym* hash[Hashsize]; Extern Lsym* hash[Hashsize];
Extern long dogc; Extern long dogc;
Extern Rplace* ret; Extern Rplace* ret;
Extern char* symfil; extern char* symfil;
Extern char* corfil; extern char* corfil;
Extern int gotint; Extern int gotint;
Extern long flen; Extern long flen;
Extern Gc* gcl; Extern Gc* gcl;
@@ -66,8 +66,8 @@ Extern Node* fomt;
Extern List* tracelist; Extern List* tracelist;
Extern int initialising; Extern int initialising;
Extern int quiet; Extern int quiet;
Extern Fhdr* corhdr; extern Fhdr* corhdr;
Extern Fhdr* symhdr; extern Fhdr* symhdr;
extern void (*expop[])(Node*, Node*); extern void (*expop[])(Node*, Node*);
#define expr(n, r) (r)->store.comt=0; (*expop[(unsigned char)((n)->op)])(n, r); #define expr(n, r) (r)->store.comt=0; (*expop[(unsigned char)((n)->op)])(n, r);

62
src/cmd/acme/dat.c Normal file
View File

@@ -0,0 +1,62 @@
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <thread.h>
#include <cursor.h>
#include <mouse.h>
#include <keyboard.h>
#include <frame.h>
#include <fcall.h>
#include <plumb.h>
#include <libsec.h>
#include "dat.h"
uint globalincref;
uint seq;
uint maxtab; /* size of a tab, in units of the '0' character */
Mouse *mouse;
Mousectl *mousectl;
Keyboardctl *keyboardctl;
Reffont reffont;
Image *modbutton;
Image *colbutton;
Image *button;
Image *but2col;
Image *but3col;
Row row;
int timerpid;
Disk *disk;
Text *seltext;
Text *argtext;
Text *mousetext; /* global because Text.close needs to clear it */
Text *typetext; /* global because Text.close needs to clear it */
Text *barttext; /* shared between mousetask and keyboardthread */
int bartflag;
Window *activewin;
Column *activecol;
Rectangle nullrect;
int fsyspid;
char *cputype;
char *objtype;
char *acmeshell;
//char *fontnames[2];
extern char wdir[]; /* must use extern because no dimension given */
int globalautoindent;
int dodollarsigns;
Channel *cplumb; /* chan(Plumbmsg*) */
Channel *cwait; /* chan(Waitmsg) */
Channel *ccommand; /* chan(Command*) */
Channel *ckill; /* chan(Rune*) */
Channel *cxfidalloc; /* chan(Xfid*) */
Channel *cxfidfree; /* chan(Xfid*) */
Channel *cnewwindow; /* chan(Channel*) */
Channel *mouseexit0; /* chan(int) */
Channel *mouseexit1; /* chan(int) */
Channel *cexit; /* chan(int) */
Channel *cerr; /* chan(char*) */
Channel *cedit; /* chan(int) */
Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */
QLock editoutlk;

View File

@@ -509,53 +509,53 @@ enum /* editing */
Collecting Collecting
}; };
uint globalincref; extern uint globalincref;
uint seq; extern uint seq;
uint maxtab; /* size of a tab, in units of the '0' character */ extern uint maxtab; /* size of a tab, in units of the '0' character */
Display *display; extern Display *display;
Image *screen; extern Image *screen;
Font *font; extern Font *font;
Mouse *mouse; extern Mouse *mouse;
Mousectl *mousectl; extern Mousectl *mousectl;
Keyboardctl *keyboardctl; extern Keyboardctl *keyboardctl;
Reffont reffont; extern Reffont reffont;
Image *modbutton; extern Image *modbutton;
Image *colbutton; extern Image *colbutton;
Image *button; extern Image *button;
Image *but2col; extern Image *but2col;
Image *but3col; extern Image *but3col;
Cursor boxcursor; extern Cursor boxcursor;
Cursor2 boxcursor2; extern Cursor2 boxcursor2;
Row row; extern Row row;
int timerpid; extern int timerpid;
Disk *disk; extern Disk *disk;
Text *seltext; extern Text *seltext;
Text *argtext; extern Text *argtext;
Text *mousetext; /* global because Text.close needs to clear it */ extern Text *mousetext; /* global because Text.close needs to clear it */
Text *typetext; /* global because Text.close needs to clear it */ extern Text *typetext; /* global because Text.close needs to clear it */
Text *barttext; /* shared between mousetask and keyboardthread */ extern Text *barttext; /* shared between mousetask and keyboardthread */
int bartflag; extern int bartflag;
int swapscrollbuttons; extern int swapscrollbuttons;
Window *activewin; extern Window *activewin;
Column *activecol; extern Column *activecol;
Buffer snarfbuf; extern Buffer snarfbuf;
Rectangle nullrect; extern Rectangle nullrect;
int fsyspid; extern int fsyspid;
char *cputype; extern char *cputype;
char *objtype; extern char *objtype;
char *home; extern char *home;
char *acmeshell; extern char *acmeshell;
char *fontnames[2]; extern char *fontnames[2];
Image *tagcols[NCOL]; extern Image *tagcols[NCOL];
Image *textcols[NCOL]; extern Image *textcols[NCOL];
extern char wdir[]; /* must use extern because no dimension given */ extern char wdir[]; /* must use extern because no dimension given */
int editing; extern int editing;
int erroutfd; extern int erroutfd;
int messagesize; /* negotiated in 9P version setup */ extern int messagesize; /* negotiated in 9P version setup */
int globalautoindent; extern int globalautoindent;
int dodollarsigns; extern int dodollarsigns;
char* mtpt; extern char* mtpt;
enum enum
{ {
@@ -563,20 +563,20 @@ enum
Kscrollonedown = KF|0x21 Kscrollonedown = KF|0x21
}; };
Channel *cplumb; /* chan(Plumbmsg*) */ extern Channel *cplumb; /* chan(Plumbmsg*) */
Channel *cwait; /* chan(Waitmsg) */ extern Channel *cwait; /* chan(Waitmsg) */
Channel *ccommand; /* chan(Command*) */ extern Channel *ccommand; /* chan(Command*) */
Channel *ckill; /* chan(Rune*) */ extern Channel *ckill; /* chan(Rune*) */
Channel *cxfidalloc; /* chan(Xfid*) */ extern Channel *cxfidalloc; /* chan(Xfid*) */
Channel *cxfidfree; /* chan(Xfid*) */ extern Channel *cxfidfree; /* chan(Xfid*) */
Channel *cnewwindow; /* chan(Channel*) */ extern Channel *cnewwindow; /* chan(Channel*) */
Channel *mouseexit0; /* chan(int) */ extern Channel *mouseexit0; /* chan(int) */
Channel *mouseexit1; /* chan(int) */ extern Channel *mouseexit1; /* chan(int) */
Channel *cexit; /* chan(int) */ extern Channel *cexit; /* chan(int) */
Channel *cerr; /* chan(char*) */ extern Channel *cerr; /* chan(char*) */
Channel *cedit; /* chan(int) */ extern Channel *cedit; /* chan(int) */
Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */ extern Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */
QLock editoutlk; extern QLock editoutlk;
#define STACK 65536 #define STACK 65536

View File

@@ -19,7 +19,7 @@ char Enoname[] = "no file name given";
Address addr; Address addr;
File *menu; File *menu;
Rangeset sel; extern Rangeset sel;
extern Text* curtext; extern Text* curtext;
Rune *collection; Rune *collection;
int ncollection; int ncollection;

View File

@@ -18,7 +18,7 @@ char *srvname;
Window *wbox; Window *wbox;
Message mbox; Message mbox;
Message replies; Message replies;
char *home; extern char *home;
CFid *plumbsendfd; CFid *plumbsendfd;
CFid *plumbseemailfd; CFid *plumbseemailfd;
CFid *plumbshowmailfd; CFid *plumbshowmailfd;

View File

@@ -25,6 +25,7 @@ OFILES=\
util.$O\ util.$O\
wind.$O\ wind.$O\
xfid.$O\ xfid.$O\
dat.$O\
HFILES=dat.h\ HFILES=dat.h\
edit.h\ edit.h\

View File

@@ -85,55 +85,55 @@ struct Tim
char tz[4]; char tz[4];
}; };
double converge; extern double converge;
char flags[128]; extern char flags[128];
int nperiods; extern int nperiods;
double wlong, awlong, nlat, elev; extern double wlong, awlong, nlat, elev;
double obliq, phi, eps, tobliq; extern double obliq, phi, eps, tobliq;
double dphi, deps; extern double dphi, deps;
double day, deld, per; extern double day, deld, per;
double eday, capt, capt2, capt3, gst; extern double eday, capt, capt2, capt3, gst;
double pi, pipi, radian, radsec, deltat; extern double pi, pipi, radian, radsec, deltat;
double erad, glat; extern double erad, glat;
double xms, yms, zms; extern double xms, yms, zms;
double xdot, ydot, zdot; extern double xdot, ydot, zdot;
double ecc, incl, node, argp, mrad, anom, motion; extern double ecc, incl, node, argp, mrad, anom, motion;
double lambda, beta, rad, mag, semi; extern double lambda, beta, rad, mag, semi;
double alpha, delta, rp, hp; extern double alpha, delta, rp, hp;
double ra, decl, semi2; extern double ra, decl, semi2;
double lha, decl2, lmb2; extern double lha, decl2, lmb2;
double az, el; extern double az, el;
double meday, seday, mhp, salph, sdelt, srad; extern double meday, seday, mhp, salph, sdelt, srad;
double* cafp; extern double* cafp;
char* cacp; extern char* cacp;
double rah, ram, ras, dday, dmin, dsec; extern double rah, ram, ras, dday, dmin, dsec;
long sao; extern long sao;
double da, dd, px, epoch; extern double da, dd, px, epoch;
char line[100]; extern char line[100];
Obj2 osun; extern Obj2 osun;
Obj2 omoon; extern Obj2 omoon;
Obj2 oshad; extern Obj2 oshad;
Obj2 omerc; extern Obj2 omerc;
Obj2 ovenus; extern Obj2 ovenus;
Obj2 omars; extern Obj2 omars;
Obj2 osat; extern Obj2 osat;
Obj2 ouran; extern Obj2 ouran;
Obj2 onept; extern Obj2 onept;
Obj2 oplut; extern Obj2 oplut;
Obj2 ojup; extern Obj2 ojup;
Obj2 ostar; extern Obj2 ostar;
Obj2 ocomet; extern Obj2 ocomet;
Obj3 occ; extern Obj3 occ;
Obj2* eobj1; extern Obj2* eobj1;
Obj2* eobj2; extern Obj2* eobj2;
char* startab; extern char* startab;
extern int dmo[]; extern int dmo[];
extern Obj2* objlst[]; extern Obj2* objlst[];

View File

@@ -1,5 +1,53 @@
#include "astro.h" #include "astro.h"
double converge;
char flags[128];
int nperiods;
double wlong, awlong, nlat, elev;
double obliq, phi, eps, tobliq;
double dphi, deps;
double day, deld, per;
double eday, capt, capt2, capt3, gst;
double pi, pipi, radian, radsec, deltat;
double erad, glat;
double xms, yms, zms;
double xdot, ydot, zdot;
double ecc, incl, node, argp, mrad, anom, motion;
double lambda, beta, rad, mag, semi;
double alpha, delta, rp, hp;
double ra, decl, semi2;
double lha, decl2, lmb2;
double az, el;
double meday, seday, mhp, salph, sdelt, srad;
double* cafp;
char* cacp;
double rah, ram, ras, dday, dmin, dsec;
long sao;
double da, dd, px, epoch;
char line[100];
Obj2 osun;
Obj2 omoon;
Obj2 oshad;
Obj2 omerc;
Obj2 ovenus;
Obj2 omars;
Obj2 osat;
Obj2 ouran;
Obj2 onept;
Obj2 oplut;
Obj2 ojup;
Obj2 ostar;
Obj2 ocomet;
Obj3 occ;
Obj2* eobj1;
Obj2* eobj2;
char* herefile; char* herefile;
int int

View File

@@ -4,12 +4,12 @@
#include "defs.h" #include "defs.h"
#include "fns.h" #include "fns.h"
char *symfil; extern char *symfil;
char *corfil; extern char *corfil;
Map *symmap; extern Map *symmap;
Map *cormap; extern Map *cormap;
Regs *correg; extern Regs *correg;
Map *dotmap; Map *dotmap;
void void

View File

@@ -1,10 +1,10 @@
#define stdout bstdout #define stdout bstdout
char mode; /* '\0', 'e', 'f', 'h' */ extern char mode; /* '\0', 'e', 'f', 'h' */
char bflag; /* ignore multiple and trailing blanks */ extern char bflag; /* ignore multiple and trailing blanks */
char rflag; /* recurse down directory trees */ extern char rflag; /* recurse down directory trees */
char mflag; /* pseudo flag: doing multiple files, one dir */ extern char mflag; /* pseudo flag: doing multiple files, one dir */
int anychange; extern int anychange;
extern Biobuf stdout; extern Biobuf stdout;
extern int binary; extern int binary;

View File

@@ -8,6 +8,12 @@
Biobuf stdout; Biobuf stdout;
char mode; /* '\0', 'e', 'f', 'h' */
char bflag; /* ignore multiple and trailing blanks */
char rflag; /* recurse down directory trees */
char mflag; /* pseudo flag: doing multiple files, one dir */
int anychange;
static char *tmp[] = {"/tmp/diff1XXXXXXXXXXX", "/tmp/diff2XXXXXXXXXXX"}; static char *tmp[] = {"/tmp/diff1XXXXXXXXXXX", "/tmp/diff2XXXXXXXXXXX"};
static int whichtmp; static int whichtmp;
static char *progname; static char *progname;

View File

@@ -1,6 +1,6 @@
typedef struct XFont XFont; typedef struct XFont XFont;
XFont *xfont; extern XFont *xfont;
int nxfont; extern int nxfont;
enum { enum {
SubfontSize = 32, SubfontSize = 32,

View File

@@ -13,6 +13,9 @@
#include "a.h" #include "a.h"
XFont *xfont;
int nxfont;
void void
usage(void) usage(void)
{ {

View File

@@ -22,7 +22,7 @@ struct Fsys {
Fsys* next; Fsys* next;
}; };
int mempcnt; /* from fossil.c */ extern int mempcnt; /* from fossil.c */
int fsGetBlockSize(Fs *fs); int fsGetBlockSize(Fs *fs);

View File

@@ -15,7 +15,7 @@ Inst *progp; /* next free spot for code generation */
Inst *pc; /* program counter during execution */ Inst *pc; /* program counter during execution */
Inst *progbase = prog; /* start of current subprogram */ Inst *progbase = prog; /* start of current subprogram */
int returning; /* 1 if return stmt seen */ int returning; /* 1 if return stmt seen */
int indef; /* 1 if parsing a func or proc */ extern int indef; /* 1 if parsing a func or proc */
typedef struct Frame { /* proc/func call stack frame */ typedef struct Frame { /* proc/func call stack frame */
Symbol *sp; /* symbol table entry */ Symbol *sp; /* symbol table entry */

View File

@@ -30,7 +30,9 @@ enum
ArgMode = 1<<3, ArgMode = 1<<3,
HtmlMode = 1<<4, HtmlMode = 1<<4,
MaxLine = 1024 MaxLine = 1024,
MAXIF = 20
}; };
Rune* L(char*); Rune* L(char*);
@@ -77,7 +79,7 @@ int linefmt(Fmt*);
void nr(Rune*, int); void nr(Rune*, int);
void _nr(Rune*, Rune*); void _nr(Rune*, Rune*);
void out(Rune*); void out(Rune*);
void (*outcb)(Rune); extern void (*outcb)(Rune);
void outhtml(Rune*); void outhtml(Rune*);
void outrune(Rune); void outrune(Rune);
void outtrap(void); void outtrap(void);

View File

@@ -6,7 +6,6 @@ enum
MAXRAW = 40, MAXRAW = 40,
MAXESC = 60, MAXESC = 60,
MAXLINE = 1024, MAXLINE = 1024,
MAXIF = 20,
MAXARG = 10 MAXARG = 10
}; };

View File

@@ -16,9 +16,8 @@
* .if .ie .el * .if .ie .el
* *
*/ */
extern int iftrue[MAXIF];
int iftrue[20]; extern int niftrue;
int niftrue;
void void
startbody(void) startbody(void)

View File

@@ -101,7 +101,8 @@ char *udpaddr = "udp!*!domain";
char *logfile = "dns"; char *logfile = "dns";
char *dbfile; char *dbfile;
char mntpt[Maxpath]; char mntpt[Maxpath];
char *LOG;
extern char *LOG;
void void
usage(void) usage(void)

View File

@@ -23,11 +23,12 @@ char mntpt[Maxpath];
ulong now; ulong now;
int maxage; int maxage;
uchar ipaddr[IPaddrlen]; /* my ip address */ uchar ipaddr[IPaddrlen]; /* my ip address */
char *LOG;
char *zonerefreshprogram; char *zonerefreshprogram;
char *tcpaddr; char *tcpaddr;
char *udpaddr; char *udpaddr;
extern char *LOG;
void void
usage(void) usage(void)
{ {

View File

@@ -7,10 +7,11 @@
#include "plumber.h" #include "plumber.h"
int debug; int debug;
int nports;
char **ports;
int foreground=0; int foreground=0;
char *plumbfile; char *plumbfile;
char *user; char *user;
char *home;
char *progname; char *progname;
Ruleset **rules; Ruleset **rules;
int printerrors=1; int printerrors=1;

View File

@@ -89,11 +89,11 @@ void makeports(Ruleset*[]);
void printinputstack(void); void printinputstack(void);
int popinput(void); int popinput(void);
Ruleset **rules; extern Ruleset **rules;
char *user; extern char *user;
char *home; extern char *home;
jmp_buf parsejmp; extern jmp_buf parsejmp;
char *lasterror; extern char *lasterror;
char **ports; extern char **ports;
int nports; extern int nports;
int debug; extern int debug;

View File

@@ -8,6 +8,24 @@
*/ */
char *argv0="rc"; char *argv0="rc";
thread *runq;
code *codebuf; /* compiler output */
int ntrap; /* number of outstanding traps */
int trap[NSIG]; /* number of outstanding traps per type */
int eflagok; /* kludge flag so that -e doesn't exit in startup */
tree *cmdtree;
char *promptstr;
char tok[NTOK];
var *gvar[NVAR]; /* hash for globals */
int mypid;
char **argp;
char **args;
int nerror; /* number of errors encountered during compilation */
int ndot;
int lastc;
int kidpid;
io *err;
void void
start(code *c, int pc, var *local) start(code *c, int pc, var *local)
{ {

View File

@@ -56,17 +56,17 @@ struct thread{
tree *treenodes; /* tree nodes created by this process */ tree *treenodes; /* tree nodes created by this process */
thread *ret; /* who continues when this finishes */ thread *ret; /* who continues when this finishes */
}; };
thread *runq; extern thread *runq;
code *codecopy(code*); code *codecopy(code*);
code *codebuf; /* compiler output */ extern code *codebuf; /* compiler output */
int ntrap; /* number of outstanding traps */ extern int ntrap; /* number of outstanding traps */
int trap[NSIG]; /* number of outstanding traps per type */ extern int trap[NSIG]; /* number of outstanding traps per type */
struct builtin{ struct builtin{
char *name; char *name;
void (*fnc)(void); void (*fnc)(void);
}; };
extern struct builtin Builtin[]; extern struct builtin Builtin[];
int eflagok; /* kludge flag so that -e doesn't exit in startup */ extern int eflagok; /* kludge flag so that -e doesn't exit in startup */
extern int havefork; extern int havefork;
void execcd(void), execwhatis(void), execeval(void), execexec(void); void execcd(void), execwhatis(void), execeval(void), execexec(void);

View File

@@ -10,7 +10,7 @@ struct io{
int fd; int fd;
char *bufp, *ebuf, *strp, buf[NBUF]; char *bufp, *ebuf, *strp, buf[NBUF];
}; };
io *err; extern io *err;
io *openfd(int), *openstr(void), *opencore(char *, int); io *openfd(int), *openstr(void), *opencore(char *, int);
int emptybuf(io*); int emptybuf(io*);
void pchr(io*, int); void pchr(io*, int);

View File

@@ -65,7 +65,7 @@ tree *mung1(tree*, tree*), *mung2(tree*, tree*, tree*);
tree *mung3(tree*, tree*, tree*, tree*), *epimung(tree*, tree*); tree *mung3(tree*, tree*, tree*, tree*), *epimung(tree*, tree*);
tree *simplemung(tree*), *heredoc(tree*); tree *simplemung(tree*), *heredoc(tree*);
void freetree(tree*); void freetree(tree*);
tree *cmdtree; extern tree *cmdtree;
/* /*
* The first word of any code vector is a reference count. * The first word of any code vector is a reference count.
* Always create a new reference to a code vector by calling codecopy(.). * Always create a new reference to a code vector by calling codecopy(.).
@@ -76,9 +76,9 @@ union code{
int i; int i;
char *s; char *s;
}; };
char *promptstr; extern char *promptstr;
#define NTOK 8192 #define NTOK 8192
char tok[NTOK]; extern char tok[NTOK];
#define APPEND 1 #define APPEND 1
#define WRITE 2 #define WRITE 2
#define READ 3 #define READ 3
@@ -98,7 +98,7 @@ struct var{
}; };
var *vlook(char*), *gvlook(char*), *newvar(char*, var*); var *vlook(char*), *gvlook(char*), *newvar(char*, var*);
#define NVAR 521 #define NVAR 521
var *gvar[NVAR]; /* hash for globals */ extern var *gvar[NVAR]; /* hash for globals */
#define new(type) ((type *)emalloc(sizeof(type))) #define new(type) ((type *)emalloc(sizeof(type)))
char *emalloc(long); char *emalloc(long);
void *Malloc(ulong); void *Malloc(ulong);
@@ -109,7 +109,7 @@ struct here{
char *name; char *name;
struct here *next; struct here *next;
}; };
int mypid; extern int mypid;
/* /*
* Glob character escape in strings: * Glob character escape in strings:
* In a string, GLOB must be followed by *?[ or GLOB. * In a string, GLOB must be followed by *?[ or GLOB.
@@ -128,9 +128,9 @@ int mypid;
#define threebyte(c) ((c&0xf0)==0xe0) #define threebyte(c) ((c&0xf0)==0xe0)
#define fourbyte(c) ((c&0xf8)==0xf0) #define fourbyte(c) ((c&0xf8)==0xf0)
char **argp; extern char **argp;
char **args; extern char **args;
int nerror; /* number of errors encountered during compilation */ extern int nerror; /* number of errors encountered during compilation */
extern int doprompt; /* is it time for a prompt? */ extern int doprompt; /* is it time for a prompt? */
/* /*
* Which fds are the reading/writing end of a pipe? * Which fds are the reading/writing end of a pipe?
@@ -146,8 +146,8 @@ extern char *Rcmain(), Fdprefix[];
* How many dot commands have we executed? * How many dot commands have we executed?
* Used to ensure that -v flag doesn't print rcmain. * Used to ensure that -v flag doesn't print rcmain.
*/ */
int ndot; extern int ndot;
char *getstatus(void); char *getstatus(void);
int lastc; extern int lastc;
int lastword; extern int lastword;
int kidpid; extern int kidpid;

View File

@@ -33,7 +33,7 @@ int onwin;
int rows, cols; int rows, cols;
int sortlabels; int sortlabels;
int showwmnames; int showwmnames;
Font *font; extern Font *font;
Image *lightblue; Image *lightblue;

View File

@@ -20,7 +20,7 @@ int downloaded;
int dflag; int dflag;
int Rflag; int Rflag;
char *machine; char *machine;
char *home; extern char *home;
int bpipeok; int bpipeok;
int termlocked; int termlocked;
char *samterm = SAMTERM; char *samterm = SAMTERM;

View File

@@ -5,7 +5,6 @@
static void dodecode(Biobuf*, Pix*, int, int, uchar*); static void dodecode(Biobuf*, Pix*, int, int, uchar*);
static int32 getlong(uchar*); static int32 getlong(uchar*);
int debug;
Img* Img*
dssread(char *file) dssread(char *file)

View File

@@ -34,6 +34,11 @@ Record *rec;
Record *orec; Record *orec;
Record *cur; Record *cur;
int nplate;
Plate plate[2000]; /* needs to go to 2000 when the north comes */
int debug;
Gam gam;
char *dir; char *dir;
int saodb; int saodb;
int ngcdb; int ngcdb;

View File

@@ -303,13 +303,14 @@ struct Img
#define ARCSECONDS_PER_RADIAN (DEG(1)*3600) #define ARCSECONDS_PER_RADIAN (DEG(1)*3600)
#define MILLIARCSEC (1000*60*60) #define MILLIARCSEC (1000*60*60)
int nplate; extern int nplate;
Plate plate[2000]; /* needs to go to 2000 when the north comes */ extern Plate plate[2000]; /* needs to go to 2000 when the north comes */
double PI_180; extern double PI_180;
double TWOPI; extern double TWOPI;
double LN2; extern double LN2;
int debug; extern int debug;
struct typedef struct Gam Gam;
struct Gam
{ {
float min; float min;
float max; float max;
@@ -318,7 +319,8 @@ struct
float mult1; float mult1;
float mult2; float mult2;
int neg; int neg;
} gam; };
extern Gam gam;
typedef struct Picture Picture; typedef struct Picture Picture;
struct Picture struct Picture

View File

@@ -28,7 +28,6 @@ int clean = 0;
int verbose = 0; int verbose = 0;
long ninput, noutput, nrunes, nerrors; long ninput, noutput, nrunes, nerrors;
char *file = "stdin"; char *file = "stdin";
char *argv0;
Rune runes[N]; Rune runes[N];
char obuf[UTFmax*N]; /* maximum bloat from N runes */ char obuf[UTFmax*N]; /* maximum bloat from N runes */
long tab[NRUNE]; long tab[NRUNE];

View File

@@ -17,6 +17,7 @@
#include "fns.h" #include "fns.h"
u32int maxblocksize; u32int maxblocksize;
#pragma weak readonly
int readonly; int readonly;
int findsubpart(Part *part, char *name); int findsubpart(Part *part, char *name);

View File

@@ -1,5 +1,6 @@
#include <lib9.h> #include <lib9.h>
#pragma weak argv0
char *argv0; char *argv0;
/* /*

View File

@@ -690,6 +690,7 @@ threadrwakeup(Rendez *r, int all, ulong pc)
static int threadargc; static int threadargc;
static char **threadargv; static char **threadargv;
#pragma weak mainstacksize
int mainstacksize; int mainstacksize;
extern int _p9usepwlibrary; /* getgrgid etc. smash the stack - tell _p9dir just say no */ extern int _p9usepwlibrary; /* getgrgid etc. smash the stack - tell _p9dir just say no */
static void static void