fincsys_cpp.c
来自「FinC编译器源代码」· C语言 代码 · 共 1,930 行 · 第 1/5 页
C
1,930 行
FinCData* finc_node_take_data (FinCNode* self);
void finc_node_set_data (FinCNode* self, FinCData* p_data);
void finc_node_set_func (FinCNode* self, String* p_name);
void finc_node_set_type (FinCNode* self, FinCType* p_type);
void finc_node_set_identifier (FinCNode* self, String* p_identifier);
# 10 "../include/finc/fincsys.h" 2
# 1 "../include/finc/finclang.h" 1
# 1 "../include/tiny/stack.h" 1
typedef struct _Stack Stack;
struct _Stack
{
Object parent;
List* stack;
};
Stack* stack_new();
void stack_destroy(Object* self);
ADT stack_pop(Stack* self);
void stack_push(Stack* self, ADT item);
ADT stack_take(Stack* self);
int stack_get_size(Stack* self);
Bool stack_is_empty(Stack* self);
# 8 "../include/finc/finclang.h" 2
# 1 "../include/tiny/library.h" 1
# 9 "../include/finc/finclang.h" 2
# 1 "../include/finc/finctoken.h" 1
# 1 "D:/Bernard/DDE/mingw/include/ctype.h" 1 3
# 36 "D:/Bernard/DDE/mingw/include/ctype.h" 3
# 1 "D:/Bernard/DDE/mingw/include/stddef.h" 1 3
# 1 "D:/Bernard/DDE/mingw/lib/gcc-lib/mingw32/3.2.3/include/stddef.h" 1 3
# 7 "D:/Bernard/DDE/mingw/include/stddef.h" 2 3
# 37 "D:/Bernard/DDE/mingw/include/ctype.h" 2 3
# 62 "D:/Bernard/DDE/mingw/include/ctype.h" 3
__attribute__((dllimport)) int __attribute__((__cdecl__)) isalnum(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isalpha(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iscntrl(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isdigit(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isgraph(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) islower(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isprint(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) ispunct(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isspace(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isupper(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isxdigit(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) _isctype (int, int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) tolower(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) toupper(int);
# 92 "D:/Bernard/DDE/mingw/include/ctype.h" 3
__attribute__((dllimport)) int __attribute__((__cdecl__)) _tolower(int);
__attribute__((dllimport)) int __attribute__((__cdecl__)) _toupper(int);
# 120 "D:/Bernard/DDE/mingw/include/ctype.h" 3
__attribute__((dllimport)) unsigned short _ctype[];
__attribute__((dllimport)) unsigned short* _pctype;
# 187 "D:/Bernard/DDE/mingw/include/ctype.h" 3
typedef wchar_t wctype_t;
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswalnum(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswalpha(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswascii(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswcntrl(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswctype(wint_t, wctype_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) is_wctype(wint_t, wctype_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswdigit(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswgraph(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswlower(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswprint(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswpunct(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswspace(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswupper(wint_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) iswxdigit(wint_t);
__attribute__((dllimport)) wchar_t __attribute__((__cdecl__)) towlower(wchar_t);
__attribute__((dllimport)) wchar_t __attribute__((__cdecl__)) towupper(wchar_t);
__attribute__((dllimport)) int __attribute__((__cdecl__)) isleadbyte (int);
# 231 "D:/Bernard/DDE/mingw/include/ctype.h" 3
int __attribute__((__cdecl__)) __isascii (int);
int __attribute__((__cdecl__)) __toascii (int);
int __attribute__((__cdecl__)) __iscsymf (int);
int __attribute__((__cdecl__)) __iscsym (int);
# 245 "D:/Bernard/DDE/mingw/include/ctype.h" 3
int __attribute__((__cdecl__)) isascii (int);
int __attribute__((__cdecl__)) toascii (int);
int __attribute__((__cdecl__)) iscsymf (int);
int __attribute__((__cdecl__)) iscsym (int);
# 5 "../include/finc/finctoken.h" 2
# 13 "../include/finc/finctoken.h"
enum _FinCTokenType
{
FinCTokenType_Left_Paren ,
FinCTokenType_Right_Paren ,
FinCTokenType_Left_Curly ,
FinCTokenType_Right_Curly ,
FinCTokenType_Left_Brace ,
FinCTokenType_Right_Brace ,
FinCTokenType_Comma ,
FinCTokenType_Colon ,
FinCTokenType_Scope ,
FinCTokenType_Semicolon ,
FinCTokenType_Dot ,
FinCTokenType_Question ,
FinCTokenType_Not ,
FinCTokenType_Not_Eqs,
FinCTokenType_Mul ,
FinCTokenType_Add ,
FinCTokenType_Inc,
FinCTokenType_Sub ,
FinCTokenType_Dec,
FinCTokenType_Div ,
FinCTokenType_Mod ,
FinCTokenType_Assign ,
FinCTokenType_Eq,
FinCTokenType_GT ,
FinCTokenType_Greater_Eqs,
FinCTokenType_LT ,
FinCTokenType_Less_Eqs,
FinCTokenType_Logic_And,
FinCTokenType_Logic_Or,
FinCTokenType_And,
FinCTokenType_Or,
FinCTokenType_XOR,
FinCTokenType_Bitwise,
FinCTokenType_SHL,
FinCTokenType_SHR,
FinCTokenType_Char,
FinCTokenType_String,
FinCTokenType_Short,
FinCTokenType_Int,
FinCTokenType_Float,
FinCTokenType_Long,
FinCTokenType_Type_Void,
FinCTokenType_Type_Int,
FinCTokenType_Type_Char,
FinCTokenType_Type_Short,
FinCTokenType_Type_Float,
FinCTokenType_Type_Bool,
FinCTokenType_Type_Pointer,
FinCTokenType_Type_String,
FinCTokenType_Static,
FinCTokenType_Unsigned,
FinCTokenType_Struct,
FinCTokenType_False,
FinCTokenType_True,
FinCTokenType_Null,
FinCTokenType_For,
FinCTokenType_While,
FinCTokenType_If,
FinCTokenType_Else,
FinCTokenType_Return,
FinCTokenType_Break,
FinCTokenType_Continue,
FinCTokenType_Import,
FinCTokenType_Package,
FinCTokenType_Addrof,
FinCTokenType_Valueof,
FinCTokenType_Identifier,
FinCTokenType_Eof,
FinCTokenType_Bad
};
typedef enum _FinCTokenType FinCTokenType;
typedef struct _FinCTokenEnv FinCTokenEnv;
struct _FinCTokenEnv
{
Object parent;
Bool eof;
Bool replay;
int line;
int position;
FinCTokenType current_token;
String* line_str;
String* last_str;
char last_char;
long last_double;
float last_float;
long last_long;
unsigned char* (*read_line)(const char* arg);
const char* arg;
};
FinCTokenEnv* finc_token_new();
void finc_token_destroy(Object* self);
FinCTokenType finc_token_token(FinCTokenEnv* self);
String* finc_token_get_token(FinCTokenEnv* self);
# 13 "../include/finc/finclang.h" 2
typedef struct _FinCLangEnv FinCLangEnv;
struct _FinCLangEnv
{
Object parent;
FinCNode* tree_root;
List* list_pkg;
unsigned int nb_error;
};
extern FinCLangEnv* g_finc_lang_env;
extern int g_lang_nberr;
FinCLangEnv* finc_lang_new ();
void finc_lang_destroy(Object* self);
void finc_lang_error_line (FinCTokenEnv* lex, char* msg);
Bool finc_lang_check_type (FinCLangEnv* self, String* p_type);
void finc_lang_proc_import(FinCLangEnv* self, FinCNode* p_node);
void finc_lang_proc_struct(FinCLangEnv* self, FinCNode* p_node);
void finc_lang_proc_func (FinCLangEnv* self, FinCNode* p_node );
# 11 "../include/finc/fincsys.h" 2
typedef struct _FinCSys FinCSys;
struct _FinCSys
{
Object parent;
FinCLangEnv* env;
};
FinCSys* finc_sys_new();
void finc_sys_destroy(Object* self);
void finc_sys_init (FinCSys* self);
# 2 "fincsys.c" 2
# 1 "../include/finc/finccontext.h" 1
# 1 "../include/tiny/hash.h" 1
typedef unsigned int (*HashFunc) (void* key);
typedef struct _HashTable HashTable;
HashTable* hash_table_new (HashFunc hash_func, EqualFunc key_equal_func);
void hash_table_destroy (Object* hash_table);
void* hash_table_find (HashTable* hash_table, void* key);
void hash_table_insert (HashTable* hash_table, void* key, void* value);
Bool hash_table_remove (HashTable* hash_table, void* key);
void hash_table_foreach(HashTable* hash_table, UserFunc user_func, void* data);
unsigned int hash_table_get_size (HashTable* hash_table);
unsigned int direct_hash (void* v);
# 9 "../include/finc/finccontext.h" 2
# 1 "../include/finc/fincdebug.h" 1
# 12 "../include/finc/finccontext.h" 2
# 1 "../include/finc/fincvar.h" 1
# 13 "../include/finc/fincvar.h"
typedef struct _FinCVar FinCVar;
struct _FinCVar
{
Object parent;
String* name;
FinCData* data;
};
FinCVar* finc_var_new (String* p_name, FinCData* p_data);
FinCVar* finc_var_new_copy (String* p_name, FinCData* p_data);
void finc_var_destroy (Object* self);
# 14 "../include/finc/finccontext.h" 2
# 1 "../include/finc/fincstruct.h" 1
# 14 "../include/finc/fincstruct.h"
typedef struct _FinCStruct FinCStruct;
struct _FinCStruct
{
Object parent;
String* name;
HashTable* hash_field;
int size;
int next_index;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?