ds@1952: #ifndef _INCLUDE_SOURCEPAWN_COMPILER_TRACKER_H_ ds@1952: #define _INCLUDE_SOURCEPAWN_COMPILER_TRACKER_H_ ds@1952: ds@1952: #define MEMUSE_STATIC 0 ds@1952: #define MEMUSE_DYNAMIC 1 ds@1952: ds@1952: typedef struct memuse_s { ds@1952: int type; /* MEMUSE_STATIC or MEMUSE_DYNAMIC */ ds@1952: int size; /* size of array for static (0 for dynamic) */ ds@1952: struct memuse_s *prev; /* previous block on the list */ ds@1952: } memuse_t; ds@1952: ds@1952: typedef struct memuse_list_s { ds@1952: struct memuse_list_s *prev; /* last used list */ ds@1952: int list_id; ds@1952: memuse_t *head; /* head of the current list */ ds@1952: } memuse_list_t; ds@1952: ds@1952: typedef struct funcarg_s ds@1952: { ds@1952: int tagcount; ds@1952: int tags[sTAGS_MAX]; ds@1952: int dimcount; ds@1952: cell dims[sDIMEN_MAX]; ds@1952: int ident; ds@1952: int fconst; ds@1952: int ommittable; ds@1952: } funcarg_t; ds@1952: ds@1952: typedef struct functag_s ds@1952: { ds@1952: int ret_tag; ds@1952: int type; ds@1952: int argcount; ds@1952: int ommittable; ds@1952: funcarg_t args[sARGS_MAX]; ds@1952: struct functag_s *next; ds@1952: } functag_t; ds@1952: ds@1952: typedef struct funcenum_s ds@1952: { ds@1952: int value; ds@1952: char name[sNAMEMAX+1]; ds@1952: functag_t *first; ds@1952: functag_t *last; ds@1952: struct funcenum_s *next; ds@1952: } funcenum_t; ds@1952: ds@1952: typedef struct structarg_s ds@1952: { ds@1952: int tag; ds@1952: int dimcount; ds@1952: cell dims[sDIMEN_MAX]; ds@1952: char name[sNAMEMAX+1]; ds@1952: int fconst; ds@1952: int ident; ds@1952: unsigned int offs; ds@1952: int index; ds@1952: } structarg_t; ds@1952: ds@1952: typedef struct pstruct_s ds@1952: { ds@1952: int argcount; ds@1952: char name[sNAMEMAX+1]; ds@1952: structarg_t **args; ds@1952: struct pstruct_s *next; ds@1952: } pstruct_t; ds@1952: ds@1952: /** ds@1952: * Pawn Structs ds@1952: */ ds@1952: pstruct_t *pstructs_add(const char *name); ds@1952: void pstructs_free(); ds@1952: pstruct_t *pstructs_find(const char *name); ds@1952: structarg_t *pstructs_addarg(pstruct_t *pstruct, const structarg_t *arg); ds@1952: structarg_t *pstructs_getarg(pstruct_t *pstruct, const char *member); ds@1952: ds@1952: /** ds@1952: * Function enumeration tags ds@1952: */ ds@1952: void funcenums_free(); ds@1952: funcenum_t *funcenums_add(const char *name); ds@1952: funcenum_t *funcenums_find_byval(int value); ds@1952: functag_t *functags_add(funcenum_t *en, functag_t *src); ds@1952: ds@1952: /** ds@1952: * Heap functions ds@1952: */ ds@1952: void pushheaplist(); ds@1952: memuse_list_t *popsaveheaplist(); ds@1952: void popheaplist(); ds@1952: int markheap(int type, int size); ds@1952: ds@1952: /** ds@1952: * Stack functions ds@1952: */ ds@1952: void pushstacklist(); ds@1952: void popstacklist(int codegen); ds@1952: int markstack(int type, int size); ds@1952: /** ds@1952: * Generates code to free mem usage, but does not pop the list. ds@1952: * This is used for code like dobreak()/docont()/doreturn(). ds@1952: * stop_id is the list at which to stop generating. ds@1952: */ ds@1952: void genstackfree(int stop_id); ds@1952: void genheapfree(int stop_id); ds@1952: ds@1952: /** ds@1952: * Resets a mem list by freeing everything ds@1952: */ ds@1952: void resetstacklist(); ds@1952: void resetheaplist(); ds@1952: ds@1952: extern memuse_list_t *heapusage; ds@1952: extern memuse_list_t *stackusage; ds@1952: ds@1952: #endif //_INCLUDE_SOURCEPAWN_COMPILER_TRACKER_H_