1
// Copyright 2012 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
7
// The Time unit is unspecified; we just need to
8
// be able to compare whether t1 is older than t2 with t1 < t2.
9
typedef long long Time;
11
#define nil ((void*)0)
12
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
14
#define USED(x) ((void)(x))
17
// A Buf is a byte buffer, like Go's []byte.
18
typedef struct Buf Buf;
26
// A Vec is a string vector, like Go's []string.
27
typedef struct Vec Vec;
41
bool bequal(Buf *s, Buf *t);
42
void bsubst(Buf *b, char *x, char *y);
44
void bgrow(Buf *b, int n);
46
char* bpathf(Buf *b, char *fmt, ...);
47
char* bprintf(Buf *b, char *fmt, ...);
48
void bwritef(Buf *b, char *fmt, ...);
52
void bwrite(Buf *b, void *v, int n);
53
void bwriteb(Buf *dst, Buf *src);
54
void bwritestr(Buf *b, char *p);
55
void bswap(Buf *b, Buf *b1);
56
void vadd(Vec *v, char *p);
57
void vcopy(Vec *dst, char **src, int n);
59
void vgrow(Vec *v, int n);
63
void splitlines(Vec*, char*);
64
void splitfields(Vec*, char*);
70
extern char *gohostarch;
71
extern char *gohostos;
74
extern char *goroot_final;
75
extern char *goextlinkenabled;
76
extern char *goversion;
77
extern char *defaultcc;
78
extern char *defaultcxx;
82
extern bool rebuildall;
83
extern bool defaultclang;
85
int find(char*, char**, int);
87
void cmdbanner(int, char**);
88
void cmdbootstrap(int, char**);
89
void cmdclean(int, char**);
90
void cmdenv(int, char**);
91
void cmdinstall(int, char**);
92
void cmdversion(int, char**);
95
void gcopnames(char*, char*);
96
void mkenam(char*, char*);
99
void mkzasm(char*, char*);
100
void mkzsys(char*, char*);
101
void mkzgoarch(char*, char*);
102
void mkzgoos(char*, char*);
103
void mkzruntimedefs(char*, char*);
104
void mkzversion(char*, char*);
105
void mkzexperiment(char*, char*);
108
void mkzdefaultcc(char*, char*);
111
void goc2c(char*, char*);
117
void xmain(int argc, char **argv);
119
// portability layer (plan9.c, unix.c, windows.c)
120
bool contains(char *p, char *sep);
121
void errprintf(char*, ...);
122
void fatal(char *msg, ...);
123
bool hasprefix(char *p, char *prefix);
124
bool hassuffix(char *p, char *suffix);
127
bool isfile(char *p);
128
char* lastelem(char*);
130
void readfile(Buf*, char*);
131
void run(Buf *b, char *dir, int mode, char *cmd, ...);
132
void runv(Buf *b, char *dir, int mode, Vec *argv);
133
void bgrunv(char *dir, int mode, Vec *argv);
135
bool streq(char*, char*);
137
void writefile(Buf*, char*, int);
138
void xatexit(void (*f)(void));
141
void xgetenv(Buf *b, char *name);
143
void* xmalloc(int n);
145
int xmemcmp(void*, void*, int);
146
void xmemmove(void*, void*, int);
147
void xmkdir(char *p);
148
void xmkdirall(char*);
149
Time xmtime(char *p);
150
void xprintf(char*, ...);
151
void xqsort(void*, int, int, int(*)(const void*, const void*));
152
void xreaddir(Vec *dst, char *dir);
153
void* xrealloc(void*, int);
154
void xrealwd(Buf *b, char *path);
155
void xremove(char *p);
156
void xremoveall(char *p);
157
void xsetenv(char*, char*);
158
int xstrcmp(char*, char*);
159
char* xstrdup(char *p);
161
char* xstrrchr(char*, int);
162
char* xstrstr(char*, char*);
163
char* xworkdir(void);
164
int xsamefile(char*, char*);
165
char* xgetgoarm(void);
166
int xtryexecfunc(void (*)(void));