diff options
| author | grischka <grischka> | 2009-05-11 18:45:56 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2009-05-11 18:45:56 +0200 |
| commit | 0a35f9d66e15e7daadc329e7fc34b2fe5a8cbce1 (patch) | |
| tree | fbf633decbb5cf0ddd23dfcfeff523fa63d588b2 /tcc.h | |
| parent | f9181416f604c1c0715fc538316948a9f957a3c3 (diff) | |
| download | tinycc-0a35f9d66e15e7daadc329e7fc34b2fe5a8cbce1.tar.gz tinycc-0a35f9d66e15e7daadc329e7fc34b2fe5a8cbce1.tar.bz2 | |
move static prototypes to libtcc.c
Diffstat (limited to 'tcc.h')
| -rw-r--r-- | tcc.h | 190 |
1 files changed, 44 insertions, 146 deletions
@@ -341,6 +341,29 @@ typedef struct CachedInclude { #define CACHED_INCLUDES_HASH_SIZE 512 +#ifdef CONFIG_TCC_ASM +typedef struct ExprValue { + uint32_t v; + Sym *sym; +} ExprValue; + +#define MAX_ASM_OPERANDS 30 +typedef struct ASMOperand { + int id; /* GCC 3 optionnal identifier (0 if number only supported */ + char *constraint; + char asm_str[16]; /* computed asm string for operand */ + SValue *vt; /* C value of the expression */ + int ref_index; /* if >= 0, gives reference to a output constraint */ + int input_index; /* if >= 0, gives reference to an input constraint */ + int priority; /* priority, used to assign registers */ + int reg; /* if >= 0, register number used for this operand */ + int is_llong; /* true if double register value */ + int is_memory; /* true if memory operand */ + int is_rw; /* for '+' modifier */ +} ASMOperand; + +#endif + struct TCCState { int output_type; @@ -700,155 +723,24 @@ extern long double strtold (const char *__nptr, char **__endptr); #define PATHCMP strcmp #endif -static char *pstrcpy(char *buf, int buf_size, const char *s); -static char *pstrcat(char *buf, int buf_size, const char *s); -static char *tcc_basename(const char *name); -static char *tcc_fileextension (const char *p); - -static void next(void); -static void next_nomacro(void); -static void next_nomacro_spc(void); -static void parse_expr_type(CType *type); -static void expr_type(CType *type); -static void unary_type(CType *type); -static void block(int *bsym, int *csym, int *case_sym, int *def_sym, - int case_reg, int is_expr); -static int expr_const(void); -static void expr_eq(void); -static void gexpr(void); -static void gen_inline_functions(void); -static void decl(int l); -static void decl_initializer(CType *type, Section *sec, unsigned long c, - int first, int size_only); -static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, - int has_init, int v, int scope); -int gv(int rc); -void gv2(int rc1, int rc2); -void move_reg(int r, int s); -void save_regs(int n); -void save_reg(int r); -void vpop(void); -void vswap(void); -void vdup(void); -int get_reg(int rc); -int get_reg_ex(int rc,int rc2); - -struct macro_level { - struct macro_level *prev; - int *p; -}; - -static void macro_subst(TokenString *tok_str, Sym **nested_list, - const int *macro_str, struct macro_level **can_read_stream); -void gen_op(int op); -void force_charshort_cast(int t); -static void gen_cast(CType *type); -void vstore(void); -static Sym *sym_find(int v); -static Sym *sym_push(int v, CType *type, int r, int c); - -/* type handling */ -static int type_size(CType *type, int *a); -static inline CType *pointed_type(CType *type); -static int pointed_size(CType *type); -static int lvalue_type(int t); -static int parse_btype(CType *type, AttributeDef *ad); -static void type_decl(CType *type, AttributeDef *ad, int *v, int td); -static int compare_types(CType *type1, CType *type2, int unqualified); -static int is_compatible_types(CType *type1, CType *type2); -static int is_compatible_parameter_types(CType *type1, CType *type2); - -int ieee_finite(double d); void error(const char *fmt, ...); -void vpushi(int v); -void vpushll(long long v); -void vrott(int n); -void vnrott(int n); -void lexpand_nr(void); -static void vpush_global_sym(CType *type, int v); -void vset(CType *type, int r, int v); -void type_to_str(char *buf, int buf_size, - CType *type, const char *varstr); -char *get_tok_str(int v, CValue *cv); -static Sym *get_sym_ref(CType *type, Section *sec, - unsigned long offset, unsigned long size); -static Sym *external_global_sym(int v, CType *type, int r); - -/* section generation */ -static void section_realloc(Section *sec, unsigned long new_size); -static void *section_ptr_add(Section *sec, unsigned long size); -static void put_extern_sym(Sym *sym, Section *section, - unsigned long value, unsigned long size); -static void greloc(Section *s, Sym *sym, unsigned long addr, int type); -static int put_elf_str(Section *s, const char *sym); -static int put_elf_sym(Section *s, - unsigned long value, unsigned long size, - int info, int other, int shndx, const char *name); -static int add_elf_sym(Section *s, unsigned long value, unsigned long size, - int info, int other, int sh_num, const char *name); -static void put_elf_reloc(Section *symtab, Section *s, unsigned long offset, - int type, int symbol); -static void put_stabs(const char *str, int type, int other, int desc, - unsigned long value); -static void put_stabs_r(const char *str, int type, int other, int desc, - unsigned long value, Section *sec, int sym_index); -static void put_stabn(int type, int other, int desc, int value); -static void put_stabd(int type, int other, int desc); -static int tcc_add_dll(TCCState *s, const char *filename, int flags); - -#define AFF_PRINT_ERROR 0x0001 /* print error if file not found */ -#define AFF_REFERENCED_DLL 0x0002 /* load a referenced dll from another dll */ -#define AFF_PREPROCESS 0x0004 /* preprocess file */ -static int tcc_add_file_internal(TCCState *s, const char *filename, int flags); - -/* tcccoff.c */ -int tcc_output_coff(TCCState *s1, FILE *f); +void warning(const char *fmt, ...); +void tcc_set_lib_path_w32(TCCState *s); +int tcc_set_flag(TCCState *s, const char *flag_name, int value); +void tcc_print_stats(TCCState *s, int64_t total_time); -/* tccpe.c */ -void *resolve_sym(TCCState *s1, const char *sym, int type); -int pe_load_def_file(struct TCCState *s1, int fd); -int pe_test_res_file(void *v, int size); -int pe_load_res_file(struct TCCState *s1, int fd); -void pe_add_runtime(struct TCCState *s1); -void pe_guess_outfile(char *objfilename, int output_type); -int pe_output_file(struct TCCState *s1, const char *filename); +static void tcc_free(void *ptr); +static void *tcc_malloc(unsigned long size); +static void *tcc_mallocz(unsigned long size); +static void *tcc_realloc(void *ptr, unsigned long size); +static char *tcc_strdup(const char *str); -/* tccasm.c */ - -#ifdef CONFIG_TCC_ASM - -typedef struct ExprValue { - uint32_t v; - Sym *sym; -} ExprValue; - -#define MAX_ASM_OPERANDS 30 - -typedef struct ASMOperand { - int id; /* GCC 3 optionnal identifier (0 if number only supported */ - char *constraint; - char asm_str[16]; /* computed asm string for operand */ - SValue *vt; /* C value of the expression */ - int ref_index; /* if >= 0, gives reference to a output constraint */ - int input_index; /* if >= 0, gives reference to an input constraint */ - int priority; /* priority, used to assign registers */ - int reg; /* if >= 0, register number used for this operand */ - int is_llong; /* true if double register value */ - int is_memory; /* true if memory operand */ - int is_rw; /* for '+' modifier */ -} ASMOperand; - -static void asm_expr(TCCState *s1, ExprValue *pe); -static int asm_int_expr(TCCState *s1); -static int find_constraint(ASMOperand *operands, int nb_operands, - const char *name, const char **pp); - -static int tcc_assemble(TCCState *s1, int do_preprocess); - -#endif - -static void asm_instr(void); -static void asm_global_instr(void); +static char *tcc_basename(const char *name); +static char *tcc_fileextension (const char *name); +static char *pstrcpy(char *buf, int buf_size, const char *s); +static char *pstrcat(char *buf, int buf_size, const char *s); +static void dynarray_add(void ***ptab, int *nb_ptr, void *data); +static void dynarray_reset(void *pp, int *n); #ifdef CONFIG_TCC_BACKTRACE extern int num_callers; @@ -863,3 +755,9 @@ static inline int is_float(int t) return bt == VT_LDOUBLE || bt == VT_DOUBLE || bt == VT_FLOAT; } +/* space exlcuding newline */ +static inline int is_space(int ch) +{ + return ch == ' ' || ch == '\t' || ch == '\v' || ch == '\f' || ch == '\r'; +} + |
