4 * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the
5 * COPYRIGHT file at the base of the distribution.
22 #include <libsupport/export.h>
23 #include <libdthread/export.h>
30 Declaration *AllocDeclaration(SemGroup *sg, int dop, Scope *scope);
31 Declaration *AllocImportDecl(Stmt *st, Scope *scope);
32 Declaration *AllocClassDecl(Stmt *st, string_t id, Type *super, Scope *scope);
33 void FreeDeclaration(Parse *p, Declaration *d);
34 void AllocImportSemGroup(Parse *p, Stmt *st);
35 SemGroup *AllocSemGroup(sg_type_t type, Parse *p, SemGroup *par, Stmt *st);
36 void FreeSemGroup(SemGroup *sg);
37 SemGroup *DupSemGroup(SemGroup *sg, Stmt *st, SemGroup *ssg, int dupDecls);
38 int HashDecl(Declaration *d, string_t id);
39 string_t UnHashDecl(Declaration *d);
40 void HashOper(Declaration *d, string_t id);
41 string_t UnHashOper(Declaration *d);
42 void RenameDecl(Declaration *d, SemGroup *nsg);
43 int MatchDeclTypes(Declaration *sd, Declaration *rd);
44 int MatchOperatorTypes(Declaration *d, Type *ltype, Type *rtype);
45 int MatchCastTypes(Declaration *d, Type *ltype, Type *rtype);
46 Declaration *FindOperId(SemGroup *sg, string_t id, int args);
47 void RefineDeclaration(SemGroup *sg, Declaration *sd, Declaration *rd);
48 Declaration *DupDeclaration(SemGroup *sg, Declaration *sd);
49 void AdjustProcArgsNestingLevel(Declaration *d, SemGroup *fromSg);
50 void AdjustNestSize(SemGroup *sg, int size);
55 Exp *_AllocExpDebug(token_t *tok, const char *file, int line);
56 Exp *_AllocExp(token_t *tok);
57 void FreeExp(Exp *exp);
58 Exp *WrapExp(token_t *tok, Exp *oexp, int t);
59 Exp *ExpToNotExp(Exp *oexp);
60 Exp *ExpToCastExp(Exp *oexp, Type *type);
61 Exp *ExpToCompoundExp(Exp *oexp, int t); /* XXX */
62 Exp *ExpToAssExp(Exp *oexp, Declaration *d);
63 Exp *SetDupExp(SemGroup *sg, Exp *exp);
64 Exp *DupExp(SemGroup *sg, Exp *exp);
69 void lexUpdateCache(Lex *lex, int boff);
74 extern string_t String_Self;
75 extern string_t String_This;
76 extern string_t String_Super;
77 extern string_t String_Pointer;
78 extern string_t String_SelfContained;
79 extern string_t String_Preempt;
80 extern string_t String_NoPreempt;
81 extern string_t String_Immediate;
86 void SetSharedImport(struct stat *st, SemGroup *sg);
87 SemGroup *GetSharedImport(struct stat *st);
92 int ParseTypedefStmt(Parse *p, int t, Scope *scope);
97 int ParseDotIdAry(Parse *p, int t, string_t **pary, int *pcount, int *ltp);
98 string_t *DupDotIdAry(string_t *ary);
99 void FreeDotIdAry(string_t *ary);
104 Stmt *PushStmt(Parse *p, Stmt **pst, int type, int flags);
105 void *PopStmt(Parse *p, Stmt *st);
106 Stmt *DupStmt(SemGroup *sg, Stmt *par, Stmt *sst);
107 void FreeStmt(Stmt *st);
113 int InternalTypeAttach(Parse *p, int t, Declaration *d);
114 int InternalClassAttach(Parse *p, int t, Declaration *d);
115 Type *AllocType(typelist_t *list, int op);
116 Type *AllocCompoundType(SemGroup *sg);
117 Type *AllocArgsType(SemGroup *sg);
118 Type *AllocStorageType(runesize_t bytes);
119 Type *AllocUnresolvedType(SemGroup *isg, SemGroup *sg,
120 string_t *ary, int eatAry);
121 Type *AllocClassType(typelist_t *list, Type *super, SemGroup *sg,
123 Type *AllocImportType(typelist_t *list, SemGroup *sg, int visibility);
124 Type *TypeToProcType(Type *otype, Type *atype);
125 Type *TypeToPtrType(Type *otype);
126 Type *TypeToCPtrType(Type *otype);
127 Type *TypeToRefType(Type *otype);
128 /*Type *TypeToQualType(Type *otype, Type *ntype, int sqFlags, Exp *exp);*/
129 Type *TypeToAryType(Type *otype, Exp *exp, SemGroup *sg);
130 Type *TypeToVarType(Type *otype, SemGroup *sg);
131 Type *ChangeType(Type *otype, int op);
132 Type *DupType(SemGroup *sg, Type *stype);