4 * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the
5 * COPYRIGHT file at the base of the distribution.
8 typedef struct Context *runctx_p;
9 typedef struct SaveObjCtx *saveobj_p;
21 #include "constructors.h"
26 void LexDebugLine(token_t *tok);
31 Declaration *FindDeclId(SemGroup *db, string_t id, int *eno);
32 Declaration *FindDeclIdLevel(SemGroup *db, string_t id, int level, int *eno);
33 Declaration *FindDeclByIndex(SemGroup *sg, int index);
34 void DeclPrintError(Declaration *d, int type);
35 Declaration *FindDeclPath(LexRef *lexRef, SemGroup *osg, SemGroup *sg,
36 Type *nomatch, string_t *ary, int mask,
37 int *visibility, int level, int *eno);
38 void *FindDLLSymbol(SemGroup *osg, SemGroup *sg, string_t id);
43 void ExpPrintError(Exp *exp, int type);
48 Lex *LexOpen(const char *path, token_t *tok);
49 void LexClose(Lex **plex);
50 int LexRedactToken(token_t *tok, int bytes);
51 int LexPeekToken(token_t *tok);
52 int LexToken(token_t *tok);
53 int LexSkipToken(token_t *tok, int type);
54 int LexStripQuotes(token_t *tok, token_t *tmp);
55 int LexError(token_t *tok, int err);
56 void LexPrintError(token_t *tok);
57 void LexPrintRef(LexRef *lr, int type);
58 void LexInitRef(LexRef *lr, token_t *tok);
59 void LexDupRef(LexRef *s, LexRef *d);
60 void LexDoneRef(LexRef *lr);
61 const char *LexErrStr(token_t *tok);
66 void LibDInit(st_func_t stFunction, ex_func_t exFunction);
71 int ParseOpen(Stmt *st, Parse **pp, void **dll);
72 void ParseDone(Parse *p);
73 void ParseClose(Parse **pp);
74 void AddImportPath(const char *path, int flags);
75 void PrefixImportPaths(const char *basePath);
80 int ParseModule(Parse *p, Stmt *st, int t);
81 int ParseStmt(Parse *p, int t, Stmt **pst);
82 int ParseDeclarationStmt(Parse *p, int t, int idRequired, Stmt **pst,
83 int dop, Scope *scope);
88 int ParseScopeQual(Parse *p, int t, Scope *scope);
89 int ParseStorageQual(Parse *p, int t, int *pmask);
90 int ParseDeclaration(Parse *p, int t, Declaration **pd, int idRequired,
91 int dop, Scope *scope);
92 int ParseDeclarationList(Parse *p, int t, int scopeFlags,
93 int idRequired, int dop);
94 int ParseType(Parse *p, int t, Type **ptype, int sqflags);
95 int ParseDeclType(Parse *p, int t, Type **ptype, SemGroup **psg,
96 int scopeFlags, int rqflags, string_t *id,
102 int ParseExp(Parse *p, int t, Exp **pexp);
103 int ParseParenthesizedExp(Parse *p, int t, Exp **pexp, int docomp);
104 int ParseNotExp(Parse *p, int t, Exp **pexp);
109 void ResolveProject(Parse *p, Stmt *st);
110 Type *resolveType(Type *type);
115 Stmt *BuildRootImportStmt(const char *path);
116 void StmtPrintError(Stmt *st, int type);
121 string_t StrTableEscapeQuotedString(const char *str, int len, int term);
122 string_t StrTableAlloc(const char *str, int len, int special);
123 string_t StrTableToken(token_t *tok);
124 string_t StrTableInt(int v);
125 string_t StrTableDup(string_t str);
126 int StrTableSpecial(string_t id);
127 int StrTableLen(string_t id);
128 int StrCmpToken(string_t id, token_t *tok);
129 void ReplaceStrTable(string_t *pstr, string_t id);
130 void RelStrTable(string_t *pstr);
131 const char *StripPathId(const char *path, int *len);
132 int SimpleIntToken(token_t *tok, int *rv);
137 int SymKeywordFind(const char *ptr, int len, int t);
142 char *TypeToStr(Type *type, char **pstr);
143 int SameType(Type *t1, Type *t2, int sqFlags2);
144 int SimilarType(Type *t1, Type *t2);
145 int SimilarSemGroup(SemGroup *s1, SemGroup *s2);
146 int MatchType(Type *super, Type *type);
147 void InternalRegisterType(const char *str, Type *type);
148 Type *InternalRegisteredTypeLookup(string_t id);
149 void initType(Type *type, List *list, int op);
150 void initQualType(Type *type, List *list, int op, int sqflags);
151 void initPtrType(Type *type, Type *ptrto, int sqflags);
153 extern Type DynamicRValueType;
154 extern Type DynamicLValueType;
155 extern Type NumericType;
156 extern Type IntegerType;
157 extern Type VoidType;
158 extern Type BoolType;
159 extern Type Int8Type;
160 extern Type UInt8Type;
161 extern Type Int16Type;
162 extern Type UInt16Type;
163 extern Type Int32Type;
164 extern Type UInt32Type;
165 extern Type Int64Type;
166 extern Type UInt64Type;
167 extern Type Float32Type;
168 extern Type Float64Type;
169 extern Type Float128Type;
170 extern Type CCharType;
172 extern Type CharPtrType;
173 extern Type CharPtrPtrType;
174 extern Type VoidPtrType;
175 extern Type VoidRefType;
176 extern Type CVoidPtrType;
177 extern Type LVoidPtrType;
178 extern Type PointerType; /* generic pointer placeholder */
179 extern Type IntPtrType; /* not int * ... intptr_t */
180 extern Type UIntPtrType; /* not int * ... intptr_t */