fns.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. int addfile(File*);
  2. void addfnptrs(Decl*, int);
  3. void addiface(Decl*, Decl*);
  4. void addinclude(char*);
  5. char *addrprint(char*, char*, int, Addr*);
  6. Typelist *addtype(Type*, Typelist*);
  7. Node *adtdecl(Decl *ids, Node *fields);
  8. void adtdecled(Node *n);
  9. void adtdefd(Type*);
  10. Decl *adtmeths(Type*);
  11. void adtstub(Decl*);
  12. long align(long, int);
  13. void *allocmem(ulong);
  14. void altcheck(Node *an, Type *ret);
  15. void altcom(Node*);
  16. Inst *andand(Node*, int, Inst*);
  17. Decl *appdecls(Decl*, Decl*);
  18. int argcompat(Node*, Decl*, Node*);
  19. void arraycom(Node*, Node*);
  20. void arraydefault(Node*, Node*);
  21. Type *arrowtype(Type*, Decl*);
  22. void asmdesc(Desc*);
  23. void asmentry(Decl*);
  24. void asmexc(Except*);
  25. void asminitializer(long, Node*);
  26. void asminst(Inst*);
  27. void asmldt(long, Decl*);
  28. void asmmod(Decl*);
  29. void asmpath(void);
  30. void asmstring(long, Sym*);
  31. void asmvar(long, Decl*);
  32. int assignindices(Node*);
  33. void bccom(Node*, Inst**);
  34. Inst *bcom(Node*, int, Inst*);
  35. void bindnames(Node*);
  36. void bindtypes(Type *t);
  37. Ok callcast(Node*, int, int);
  38. void callcom(Src*, int, Node*, Node*);
  39. Type* calltype(Type*, Node*, Type*);
  40. double canontod(ulong v[2]);
  41. void casecheck(Node *cn, Type *ret);
  42. int casecmp(Type*, Node*, Node*);
  43. void casecom(Node*);
  44. Node *caselist(Node*, Node*);
  45. void casesort(Type*, Label*, Label*, int, int);
  46. Case *checklabels(Node *inits, Type *ctype, int nlab, char *title);
  47. void checkrefs(Decl*);
  48. Node *checkused(Node*);
  49. int circlval(Node*, Node*);
  50. void concheck(Node *n, int isglobal);
  51. Node *condecl(Decl*, Node*);
  52. void condecled(Node *n);
  53. void constub(Decl*);
  54. Type *copytypeids(Type*);
  55. char *ctprint(char*, char*, Type*);
  56. int ctypeconv(Fmt*);
  57. Line curline(void);
  58. Decl *curscope(void);
  59. int cycarc(Type*, Type*);
  60. void cycfield(Type*, Decl*);
  61. void cycsizetype(Type*);
  62. void cyctype(Type*);
  63. int dasdecl(Node *n);
  64. void declaserr(Node*);
  65. int declasinfer(Node*, Type*);
  66. int declconv(Fmt*);
  67. Decl *declsort(Decl*);
  68. void declstart(void);
  69. void decltozero(Node *n);
  70. void deldecl(Decl*);
  71. int dequal(Decl*, Decl*, int);
  72. long descmap(Decl*, uchar*, long);
  73. void disaddr(int, Addr*);
  74. void disbcon(long);
  75. void discon(long);
  76. void disdata(int, long);
  77. void disdesc(Desc*);
  78. void disentry(Decl*);
  79. void disexc(Except*);
  80. void disinst(Inst*);
  81. void disldt(long, Decl*);
  82. void dismod(Decl*);
  83. void dispath(void);
  84. void disvar(long, Decl*);
  85. void disword(long);
  86. int dotconv(Fmt*);
  87. char *dotprint(char*, char*, Decl*, int);
  88. Type *dottype(Type*, Decl*);
  89. void dtocanon(double, ulong[2]);
  90. Decl *dupdecl(Decl*);
  91. Decl *dupdecls(Decl*);
  92. Node *dupn(int, Src*, Node*);
  93. Node *eacom(Node*, Node*, Node*);
  94. Ok echeck(Node *n, int typeok, int isglobal, Node* par);
  95. Node *ecom(Src*, Node*, Node*);
  96. Node *efold(Node *n);
  97. Node *elemsort(Node*);
  98. void emit(Decl*);
  99. Decl *encpolys(Decl*);
  100. Sym *enter(char*, int);
  101. Desc *enterdesc(uchar*, long, long);
  102. Sym *enterstring(char*, int);
  103. char *eprint(char*, char*, Node*);
  104. char *eprintlist(char*, char*, Node*, char*);
  105. void error(Line, char*, ...);
  106. #pragma varargck argpos error 2
  107. int etconv(Fmt*);
  108. Node *etolist(Node*);
  109. void excheck(Node *n, int isglobal);
  110. void exccheck(Node *cn, Type *ret);
  111. void excom(Node*);
  112. Node *exdecl(Decl*, Decl*);
  113. void exdecled(Node *n);
  114. Type *expandtype(Type*, Type*, Decl*, Tpair**);
  115. Type *expandtypes(Type*, Decl*);
  116. int expconv(Fmt*);
  117. Type *exptotype(Node*);
  118. void fatal(char*, ...);
  119. #pragma varargck argpos fatal 1
  120. void fielddecled(Node *n);
  121. Node *fielddecl(int store, Decl *ids);
  122. int findlab(Type *ty, Node *v, Label *labs, int nlab);
  123. int fixop(int, Type*, Type*, Type*, int*, int*);
  124. Fline fline(int);
  125. void fmtcheck(Node*, Node*, Node*);
  126. void fncheck(Decl *d);
  127. Decl *fnchk(Node *n);
  128. void fncom(Decl*);
  129. Node *fndecl(Node *n, Type *t, Node *body);
  130. void fndecled(Node *n);
  131. Decl* fnlookup(Sym*, Type*, Node**);
  132. Node *fold(Node*);
  133. void foldbranch(Inst*);
  134. Node *foldc(Node*);
  135. Node *foldcast(Node*, Node*);
  136. Node *foldcasti(Node*, Node*);
  137. Node *foldr(Node*);
  138. Node *foldvc(Node*);
  139. void gbind(Node *n);
  140. int gcheck(Node*, Decl**, int);
  141. void gdasdecl(Node *n);
  142. void gdecl(Node *n);
  143. Addr genaddr(Node*);
  144. Inst *genbra(Src*, int, Node*, Node*);
  145. Inst *genchan(Src*, Node*, Type*, Node*);
  146. Desc *gendesc(Decl*, long, Decl*);
  147. Inst *genfixcastop(Src*, int, Node*, Node*);
  148. Inst *genmove(Src*, int, Type*, Node*, Node*);
  149. Inst *genop(Src*, int, Node*, Node*, Node*);
  150. Inst *genrawop(Src*, int, Node*, Node*, Node*);
  151. void genstart(void);
  152. long getpc(Inst*);
  153. int gfltconv(Fmt*);
  154. Decl *globalBconst(Node*);
  155. Node *globalas(Node*, Node*, int);
  156. Decl *globalbconst(Node*);
  157. Decl *globalconst(Node*);
  158. Decl *globalfconst(Node*);
  159. Decl *globalsconst(Node*);
  160. void gsort(Node*);
  161. int hasasgns(Node*);
  162. int hascall(Node*);
  163. Node *hascomm(Node*);
  164. int hasside(Node*, int);
  165. long idindices(Decl*);
  166. long idoffsets(Decl*, long, int);
  167. Type *idtype(Type*);
  168. void importcheck(Node *n, int isglobal);
  169. void importchk(Node*);
  170. Node *importdecl(Node *m, Decl *ids);
  171. void importdecled(Node *n);
  172. void includef(Sym*);
  173. Node *indsascom(Src*, Node*, Node*);
  174. int initable(Node*, Node*, int);
  175. int inloop(void);
  176. void installids(int store, Decl *ids);
  177. int instconv(Fmt*);
  178. Type *insttype(Type*, Decl*, Tpair**);
  179. Type *internaltype(Type*);
  180. int isimpmod(Sym*);
  181. int islval(Node*);
  182. int ispoly(Decl*);
  183. int ispolyadt(Type*);
  184. int istuple(Node*);
  185. void joiniface(Type*, Type*);
  186. void lexinit(void);
  187. void lexstart(char*);
  188. int lineconv(Fmt*);
  189. int local(Decl*);
  190. Decl *lookdot(Decl*, Sym*);
  191. Decl *lookup(Sym*);
  192. int mapconv(Fmt*);
  193. int marklval(Node*);
  194. int mathchk(Node*, int);
  195. void mergepolydecs(Type*);
  196. Type *mkadtcon(Type*);
  197. Type *mkadtpickcon(Type*, Type*);
  198. Type *mkarrowtype(Line*, Line*, Type*, Sym*);
  199. Node *mkbin(int, Node*, Node*);
  200. Node *mkconst(Src*, Long);
  201. Decl *mkdecl(Src*, int, Type*);
  202. Node *mkdeclname(Src*, Decl*);
  203. Desc *mkdesc(long, Decl*);
  204. Type *mkdottype(Line*, Line*, Type*, Sym*);
  205. Type *mkexbasetype(Type*);
  206. Type *mkextuptype(Type*);
  207. Type *mkextype(Type*);
  208. File *mkfile(char*, int, int, int, char*, int, int);
  209. Decl *mkids(Src*, Sym*, Type*, Decl*);
  210. Type *mkidtype(Src*, Sym*);
  211. Type *mkiface(Decl*);
  212. Inst *mkinst(void);
  213. Type *mkinsttype(Src*, Type*, Typelist*);
  214. Node *mkname(Src*, Sym*);
  215. Node *mknil(Src*);
  216. Node *mkn(int, Node*, Node*);
  217. Node *mkrconst(Src*, Real);
  218. Node *mksconst(Src*, Sym*);
  219. Node *mkscope(Node *body);
  220. Type *mktalt(Case*);
  221. Desc *mktdesc(Type*);
  222. Node *mktn(Type*);
  223. Type *mktype(Line*, Line*, int, Type*, Decl*);
  224. Node *mkunary(int, Node*);
  225. Type *mkvarargs(Node*, Node*);
  226. Teq *modclass(void);
  227. void modcode(Decl*);
  228. void modcom(Decl*);
  229. void moddataref(void);
  230. Node *moddecl(Decl *ids, Node *fields);
  231. void moddecled(Node *n);
  232. Decl *modglobals(Decl*, Decl*);
  233. Decl *modimp(Dlist*, Decl*);
  234. void modrefable(Type*);
  235. void modresolve(void);
  236. void modstub(Decl*);
  237. void modtab(Decl*);
  238. Decl *module(Decl*);
  239. int mustzero(Decl *);
  240. int mpatof(char*, double*);
  241. Decl *namedot(Decl*, Sym*);
  242. Decl *namesort(Decl*);
  243. void narrowmods(void);
  244. void nerror(Node*, char*, ...);
  245. #pragma varargck argpos nerror 2
  246. int nested(void);
  247. Inst *nextinst(void);
  248. int nodeconv(Fmt*);
  249. int nodes(Node*);
  250. char *nprint(char*, char*, Node*, int);
  251. void nwarn(Node*, char*, ...);
  252. #pragma varargck argpos nwarn 2
  253. int occurs(Decl*, Node*);
  254. int opconv(Fmt*);
  255. void optabinit(void);
  256. void optim(Inst*, Decl*);
  257. Inst *oror(Node*, int, Inst*);
  258. Decl *outerpolys(Node*);
  259. Node *passfns(Src*, Decl*, Node*, Node*, Type*, Tpair*);
  260. Node *passimplicit(Node*, Node*);
  261. void patch(Inst*, Inst*);
  262. void pickcheck(Node*, Type*);
  263. int pickdecled(Node *n);
  264. Decl *pickdefd(Type*, Decl*);
  265. void pickdupcom(Src*, Node*, Node*);
  266. Decl* polydecl(Decl*);
  267. int polyequal(Decl*, Decl*);
  268. void popblock(void);
  269. Decl *popids(Decl*);
  270. void popscopes(void);
  271. Decl *popscope(void);
  272. void printdecls(Decl*);
  273. int pushblock(void);
  274. void pushlabel(Node*);
  275. void pushscope(Node *, int);
  276. void raisescheck(Type*);
  277. int raisescompat(Node*, Node*);
  278. void reach(Inst*);
  279. void *reallocmem(void*, ulong);
  280. void recvacom(Src*, Node*, Node*);
  281. void redecl(Decl *d);
  282. void reftype(Type*);
  283. void repushblock(int);
  284. void repushids(Decl*);
  285. void resizetype(Type*);
  286. long resolvedesc(Decl*, long, Decl*);
  287. Decl* resolveldts(Decl*, Decl**);
  288. int resolvemod(Decl*);
  289. long resolvepcs(Inst*);
  290. Node *retalloc(Node*, Node*);
  291. Decl *revids(Decl*);
  292. Node *rewrite(Node *n);
  293. Node *rewritecomm(Node*, Node*, Node*, Node*);
  294. Inst *rewritedestreg(Inst*, int, int);
  295. Inst *rewritesrcreg(Inst*, int, int, int);
  296. void rmfnptrs(Decl*);
  297. Node *rotater(Node*);
  298. double rpow(double, int);
  299. int sameaddr(Node*, Node*);
  300. int sametree(Node*, Node*);
  301. void sblfiles(void);
  302. void sblfn(Decl**, int);
  303. void sblinst(Inst*, long);
  304. void sblmod(Decl*);
  305. void sblty(Decl**, int);
  306. void sblvar(Decl*);
  307. double scale(Type*);
  308. double scale2(Type*, Type*);
  309. Node* scheck(Node*, Type*, int);
  310. void scom(Node*);
  311. char *secpy(char*, char*, char*);
  312. char *seprint(char*, char*, char*, ...);
  313. #pragma varargck argpos seprint 3
  314. void shareloc(Decl*);
  315. int shiftchk(Node*);
  316. ulong sign(Decl*);
  317. Node *simplify(Node*);
  318. Szal sizeids(Decl*, long);
  319. void sizetype(Type*);
  320. Node *slicelcom(Src*, Node*, Node*);
  321. int specific(Type*);
  322. int srcconv(Fmt*);
  323. char* srcpath(char*, int);
  324. int storeconv(Fmt*);
  325. char *stprint(char*, char*, Type*);
  326. Sym *stringcat(Sym*, Sym*);
  327. char *stringpr(char*, char*, Sym*);
  328. Long strtoi(char*, int);
  329. int stypeconv(Fmt*);
  330. Node *sumark(Node*);
  331. int symcmp(Sym*, Sym*);
  332. Node *tacquire(Node*);
  333. Ok tagcast(Node*, Node*, Node*, Decl*, int, int);
  334. Node *talloc(Node*, Type*, Node*);
  335. int tcompat(Type*, Type*, int);
  336. void tcycle(Type*);
  337. Decl *tdecls(void);
  338. long tdescmap(Type*, uchar*, long);
  339. void teqclass(Type*);
  340. int tequal(Type*, Type*);
  341. void tfree(Node*);
  342. void tfreelater(Node*);
  343. void tfreenow(void);
  344. void tinit(void);
  345. int tmustzero(Type *);
  346. Type *toptype(Src*, Type*);
  347. Type *topvartype(Type *t, Decl *id, int tyok, int polyok);
  348. Type* tparent(Type*, Type*);
  349. char *tprint(char*, char*, Type*);
  350. void translate(char*, char*, char*);
  351. void trelease(Node*);
  352. int tunify(Type*, Type*, Tpair**);
  353. int tupaliased(Node*, Node*);
  354. int tupsaliased(Node*, Node*);
  355. void tupcom(Node*, Node*);
  356. void tuplcom(Node*, Node*);
  357. void tuplrcom(Node*, Node*);
  358. Decl *tuplefields(Node*);
  359. void typebuiltin(Decl*, Type*);
  360. Decl *typecheck(int);
  361. int typeconv(Fmt*);
  362. Node *typedecl(Decl *ids, Type *t);
  363. void typedecled(Node *n);
  364. Decl *typeids(Decl*, Type*);
  365. void typeinit(void);
  366. void typestart(void);
  367. Decl *undefed(Src *src, Sym *s);
  368. Desc *usedesc(Desc*);
  369. void usedty(Type*);
  370. Type *usetype(Type*);
  371. Type *validtype(Type*, Decl*);
  372. int valistype(Node*);
  373. Type *valtmap(Type*, Tpair*);
  374. void varcheck(Node *n, int isglobal);
  375. int varcom(Decl*);
  376. Node *vardecl(Decl*, Type*);
  377. void vardecled(Node *n);
  378. Node *varinit(Decl*, Node*);
  379. Decl *varlistdecl(Decl*, Node*);
  380. Decl *vars(Decl*);
  381. int vcom(Decl*);
  382. Type *verifytypes(Type*, Decl*, Decl*);
  383. void warn(Line, char*, ...);
  384. #pragma varargck argpos warn 2
  385. void yyerror(char*, ...);
  386. #pragma varargck argpos yyerror 1
  387. int yylex(void);
  388. int yyparse(void);
  389. void zcom(Node *, Node**);
  390. void zcom0(Decl *, Node**);
  391. void zcom1(Node *, Node**);