4 * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the
5 * COPYRIGHT file at the base of the distribution.
9 * Headers needed to build this library
11 #include <sys/types.h>
29 * librune has no link dependencies on libgen or libruntime
31 #define LIBGEN_NOPROTOS
32 #define LIBRUNTIME_NOPROTOS
34 #include <libruntime/export.h>
35 #include <libgen/export.h>
41 Declaration *AllocDeclaration(SemGroup *sg, int dop, Scope *scope);
42 Declaration *AllocImportDecl(Stmt *st, Scope *scope);
43 Declaration *AllocClassDecl(Stmt *st, runeid_t id, Type *super, Scope *scope);
44 void FreeDeclaration(Parse *p, Declaration *d);
45 void AllocImportSemGroup(Parse *p, Stmt *st);
46 SemGroup *AllocSemGroup(sg_type_t type, Parse *p, SemGroup *par, Stmt *st);
47 void FreeSemGroup(SemGroup *sg);
48 SemGroup *DupSemGroup(SemGroup *sg, Stmt *st, SemGroup *ssg, int dupDecls);
49 int HashDecl(Declaration *d, runeid_t id);
50 runeid_t UnHashDecl(Declaration *d);
51 void HashOper(Declaration *d, runeid_t id);
52 runeid_t UnHashOper(Declaration *d);
53 void RenameDecl(Declaration *d, SemGroup *nsg);
54 int MatchDeclTypes(Declaration *sd, Declaration *rd);
55 int MatchOperatorTypes(Declaration *d, Type *ltype, Type *rtype);
56 int MatchCastTypes(Declaration *d, Type *ltype, Type *rtype);
57 Declaration *FindOperId(SemGroup *sg, runeid_t id, int args);
58 void RefineDeclaration(SemGroup *sg, Declaration *sd, Declaration *rd);
59 Declaration *DupDeclaration(SemGroup *sg, Declaration *sd);
60 void AdjustProcArgsNestingLevel(Declaration *d, SemGroup *fromSg);
61 void AdjustNestSize(SemGroup *sg, int size);
66 Exp *_AllocExpDebug(token_t *tok, const char *file, int line);
67 Exp *_AllocExp(token_t *tok);
68 void FreeExp(Exp *exp);
69 Exp *WrapExp(token_t *tok, Exp *oexp, int t);
70 Exp *ExpToNotExp(Exp *oexp);
71 Exp *ExpToCastExp(Exp *oexp, Type *type);
72 Exp *ExpToCompoundExp(Exp *oexp, int t);
73 Exp *ExpToBracketedExp(Exp *oexp, int t);
74 Exp *ExpToAssExp(Exp *oexp, Declaration *d);
75 Exp *SetDupExp(SemGroup *sg, Exp *exp);
76 Exp *DupExp(SemGroup *sg, Exp *exp);
81 void lexUpdateCache(Lex *lex, int boff);
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, runeid_t **pary, int *pcount, int *ltp);
98 runeid_t *DupDotIdAry(runeid_t *ary);
99 void FreeDotIdAry(runeid_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(urunesize_t bytes);
119 Type *AllocUnresolvedType(SemGroup *isg, SemGroup *sg,
120 runeid_t *ary, int eatAry);
121 Type *AllocClassType(typelist_t *list, Type *super, SemGroup *sg,
122 int sqflags, int visibility);
123 Type *AllocImportType(typelist_t *list, SemGroup *sg, int visibility);
124 Type *TypeToVisibilityType(Type *otype, int visibility);
125 Type *TypeToProcType(Type *otype, Type *atype, int adjret);
126 Type *TypeToRawPtrType(Type *otype);
127 Type *TypeToRefType(Type *otype);
128 /*Type* TypeToQualType(Type *otype, Type *ntype, Exp *exp, int sf, int vis);*/
129 Type *TypeAdjustQList(Type *type, Type *adjtype);
130 Type *TypeFixupInheritedFlags(Type *type, int rqflags);
131 Type *TypeToAryType(Type *otype, Exp *exp, SemGroup *sg);
132 Type *TypeToVarType(Type *otype, SemGroup *sg);
133 Type *ChangeType(Type *otype, int op);
134 Type *DupType(SemGroup *sg, Type *stype);