Mercurial > hg > qcc
comparison tinycc.h @ 554:8c020de0af57
Fix earlier options.c break-up by migrating some stuff from tcc.h to tinycc.h.
(This means i386-tinycc can once again rebuild itself without segfaulting.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 06 Mar 2008 20:53:55 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
553:4533aa54ffcf | 554:8c020de0af57 |
---|---|
1 #include "libtinycc.h" | |
2 | |
3 #include <stdint.h> | |
4 #include <stdio.h> | |
5 #include <stdlib.h> | |
6 #include <string.h> | |
7 #include <sys/types.h> | |
8 #include <sys/time.h> | |
9 #include <time.h> | |
10 | |
11 // Data type for dynamic resizeable arrays | |
12 struct dynarray { | |
13 char **data; | |
14 int len; | |
15 }; | |
16 | |
17 // All these tccg_ things can be grouped into a structure, but not until after | |
18 // they're broken out of TCCState and moved over. | |
19 | |
20 // Warning switches | |
21 | |
22 int tccg_warn_unsupported; | |
23 int tccg_warn_write_strings; | |
24 int tccg_warn_error; | |
25 int tccg_warn_implicit_function_declaration; | |
26 int tccg_warn_none; | |
27 | |
28 // C language options | |
29 | |
30 int tccg_char_is_unsigned; | |
31 int tccg_leading_underscore; | |
32 | |
33 // Don't merge identical symbols in .bss segment, error instead. | |
34 int tccg_nocommon; | |
35 | |
36 // if true, describe each room as you enter it, unless it contains a grue | |
37 int tccg_verbose; | |
38 | |
39 // Include file handling | |
40 struct dynarray tccg_include_paths; | |
41 struct dynarray tccg_library_paths; | |
42 | |
43 int tccg_output_type; | |
44 int tccg_output_format;// TCC_OUTPUT_FORMAT_xxx | |
45 int tccg_static_link; // Perform static linking? | |
46 int tccg_nostdinc; // If true, no standard headers are added. | |
47 int tccg_nostdlib; // If true, no standard libraries are added. | |
48 int tccg_rdynamic; // Export all symbols. | |
49 | |
50 unsigned long tccg_text_addr; // Address of text section. | |
51 int tccg_has_text_addr; | |
52 | |
53 FILE *tccg_outfile; // Output file for preprocessing. | |
54 | |
55 // Functions from elsewhere. | |
56 | |
57 void error(char *fmt, ...); | |
58 void *xmalloc(unsigned long size); | |
59 void dynarray_add(void ***ptab, int *nb_ptr, void *data); | |
60 void add_dynarray_path(TCCState *s, char *pathname, struct dynarray *dd); | |
61 int strstart(char *str, char *val, char **ptr); | |
62 void warning(char *fmt, ...); | |
63 int init_output_type(TCCState *s); | |
64 char *pstrcpy(char *buf, int buf_size, char *s); | |
65 int tcc_add_file_internal(TCCState *s, char *filename, int flags); | |
66 | |
67 extern char *tinycc_path; | |
68 | |
69 #ifndef offsetof | |
70 #define offsetof(type, field) ((size_t) &((type *)0)->field) | |
71 #endif | |
72 | |
73 #ifndef countof | |
74 #define countof(tab) (sizeof(tab) / sizeof((tab)[0])) | |
75 #endif | |
76 | |
77 // This token begins a word/line/file | |
78 #define TOK_FLAG_BOW 0x0001 | |
79 #define TOK_FLAG_BOL 0x0002 | |
80 #define TOK_FLAG_BOF 0x0004 | |
81 | |
82 // Add file flags (passed to tcc_add_file_internal()) | |
83 #define AFF_PRINT_ERROR 0x0001 // print error if file not found | |
84 #define AFF_PREPROCESS 0x0004 // preprocess file | |
85 | |
86 // First identifier token | |
87 #define TOK_IDENT 256 // First identifier/string token. | |
88 | |
89 // This should come from dlfcn.h but doesn't unless you claim to be written | |
90 // by the fsf, which we aren't. | |
91 #define RTLD_DEFAULT 0 | |
92 | |
93 int is_space(int ch); |