@weixin
2015-04-16T16:26:12.000000Z
字数 3065
阅读 1357
compile
main.c
datatype : CRB_Interpreter
- CRB.h - typedef struct CRB_Interpreter_tag CRB_Interpreter
- crowbar.h
struct CRB_Interpreter_tag {Mem_Storage interpreter_storage;Mem_Storage execute_storage;Variable *variable;FunctionDefinition *function_list;StatementList *statement_list;int current_line_number;}
Mem_Storage
- mem.h - typedef struct Mem_Storage_tag *Mem_Storage
- storage.c
struct MEM_Storage_tag {MemoryPageList pageList;int currentPageSize;}
MemoryPageList
- storage.c - typedef MemoryPage *MemoryPageList
MemoryPage
- storage.c - typedef struct MemoryPage_tag MemoryPage
MemoryPage_tag
- storage.c
struct MemoryPage_tag {int cell_num;int use_cell_num;MemoryPageList next;Cell cell[1]}
Cell
- storge.c
typedef union {long l_dummy;double d_dummy;void *p_dummy;} Cell;
MEM_open_storage
- MEM.h
#define MEM_open_storage(page_size)\(MEM_open_storage_func(MEM_CURRENT_CONTROLLER,\__FILE__, __LINE__, page_size))
MEM_CURRENT_CONTROLLER
- MEM.h
#ifdef MEM_CONTROLLER#define MEM_CURRENT_CONTROLLER MEM_CONTROLLER#else#define MEM_CURRENT_CONTROLLER mem_default_controller#endif
if MEM_CONTROLLER is not defined, then define MEM_CURRENT_CONTROLLER to be mem_default_controller
mem_default_controller
- memory.c
MEM_Controller mem_default_controller = &st_default_controller;
MEM_Controller
- MEM.h - typedef struct MEM_Controller_tag *MEM_Controller
MEM_Controller_tag
- memory.h
struct MEM_Controller_tag {FILE *error_fp;MEM_ErrorHandler error_handler;MEM_FailMode fail_mode;Header *block_header;};
Header
- memory.h - typedef union Header_tag header
- memory.c
union Header_tag {HeaderStruct s;Align u[HEAD_ALIGN_SIZE];}
HeaderStruct
- memory.c
typedef struct {int size;char *filename;int line;Header *prev;Header *next;unsigned char mark[MARK_SIZE];} HeaderStruct;
HeaderStruct is a double linked list
Align
- memory.c
typedef union {long l_dummy;double d_dummy;void *p_dummy;} Align;
the Align has exactly the same definition with Cell above.
u[HEAD_ALIGN_SIZE]
what u is ?
- crowbar.h
struct Statement_tag {StatementType type;int line_number;union {Expression *expression_s;GlobalStatement global_s;IfStatement if_s;WhileStatement while_s;ForStatement for_s;ReturnStatement return_s;} u;};
typedef struct {CRB_ValueType type;union {CRB_Boolean boolean_value;int int_value;double double_value;CRB_String *string_value;CRB_NativePointer native_pointer;} u;} CRB_Value;
st_default_controller
- memory.c
static struct MEM_Controller_tag st_default_controller = {NULL,default_error_handler,MEM_FAIL_AND_EXIT};