Added missing file.
[tinycc/k1w1.git] / tccsym.h
blob66064778ccef2406c456bbb0231f2e9566744efc
1 /*
2 * Symbol handling for TCC
3 *
4 * Copyright (c) 2001-2004 Fabrice Bellard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef __TCCSYM_H__
21 #define __TCCSYM_H__
23 Sym *__sym_malloc(void);
25 static inline Sym *sym_malloc(void)
27 Sym *sym;
28 sym = sym_free_first;
29 if (!sym)
30 sym = __sym_malloc();
31 sym_free_first = sym->next;
32 return sym;
34 static inline void sym_free(Sym *sym)
36 sym->next = sym_free_first;
37 sym_free_first = sym;
40 /* structure lookup */
41 static inline Sym *struct_find(int v)
43 v -= TOK_IDENT;
44 if ((unsigned)v >= (unsigned)(tok_ident - TOK_IDENT))
45 return NULL;
46 return table_ident[v]->sym_struct;
49 /* find an identifier */
50 static inline Sym *sym_find(int v)
52 v -= TOK_IDENT;
53 if ((unsigned)v >= (unsigned)(tok_ident - TOK_IDENT))
54 return NULL;
55 return table_ident[v]->sym_identifier;
58 Sym *sym_push(int v, CType *type, int r, int c);
59 Sym *sym_push2(Sym **ps, int v, int t, long c);
60 Sym *sym_find2(Sym *s, int v);
61 Sym *global_identifier_push(int v, int t, int c);
62 Sym *sym_push(int v, CType *type, int r, int c);
63 void sym_pop(Sym **ptop, Sym *b);
64 void *resolve_sym(TCCState *s1, const char *symbol);
66 #ifdef CONFIG_TCC_STATIC
68 #define RTLD_LAZY 0x001
69 #define RTLD_NOW 0x002
70 #define RTLD_GLOBAL 0x100
71 #define RTLD_DEFAULT NULL
73 /* dummy function for profiling */
74 void *dlopen(const char *filename, int flag);
75 void dlclose(void *p);
76 const char *dlerror(void);
78 #elif defined(_WIN32)
79 #define dlclose FreeLibrary
81 #else
82 #include <dlfcn.h>
83 #endif
85 #endif /* __TCCSYM_H__ */