summaryrefslogtreecommitdiff
path: root/includes/compiler/CInit.h
blob: 9b1c24b42cc030eb878927ef446ba1adf3288128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef COMPILER_CINIT_H
#define COMPILER_CINIT_H

#include "compiler/common.h"

#ifdef __MWERKS__
#pragma options align=mac68k
#endif

typedef void (*ExprCB)(Type *type, ENode *expr, Boolean flag);
typedef void (*InitExprRegisterCB)(ENode *expr);
typedef void (*InsertExprCB)(ENode *expr);
// fix last arg
typedef ENode *(*RegisterObjectCB)(Type *type, Object *obj, SInt32 offset, void *);
typedef ENode *(*TempNodeCB)(Type *type, Boolean flag);

typedef struct OLinkList {
    struct OLinkList *next;
    Object *obj;
    SInt32 offset;
    SInt32 somevalue;
} OLinkList;

typedef struct PooledString {
    struct PooledString *next;
    Object *obj;
    int offset;
    char *data;
    SInt32 size;
    Boolean ispascal;
    Boolean iswide;
} PooledString;

typedef struct InitInfo {
    Object *obj;
    OLinkList *list;
    void *x8;
    SInt32 expr_offset;
    ExprCB expr_cb;
    Boolean expr_cb_called;
    Boolean x15;
    Boolean x16;
    InitExprRegisterCB init_expr_register_cb;
    Object *obj1C;
    InsertExprCB insert_expr_cb;
    RegisterObjectCB register_object_cb;
    char *buffer;
    SInt32 size;
    SInt32 bufferSize;
    struct InitInfo *next;
} InitInfo;

extern TempNodeCB cinit_tempnodefunc;
extern InitInfo *cinit_initinfo;

#ifdef __MWERKS__
#pragma options align=reset
#endif

extern void CInit_Init(void);
extern Boolean CInit_RelocInitCheck(ENode *expr, Object **objptr, CInt64 *valptr, Boolean flag);
extern void CInit_ExportConst(Object *obj);
extern Statement *CInit_ConstructClassArray(Statement *stmt, TypeClass *tclass, Object *ctor, Object *dtor, ENode *firstarg, SInt32 count);
extern ENode *CInit_AutoObject(Object *obj, Type *type, UInt32 qual);
extern void CInit_InitializeAutoData(Object *obj, InsertExprCB insert_cb, RegisterObjectCB register_cb);
extern void CInit_InitializeStaticData(Object *obj, InitExprRegisterCB cb);
extern void CInit_InitializeData(Object *obj);
extern Object *CInit_DeclareString(char *data, SInt32 size, Boolean ispascal, Boolean iswide);
extern PooledString *CInit_DeclarePooledString(char *data, SInt32 size, Boolean ispascal);
extern PooledString *CInit_DeclarePooledWString(char *data, SInt32 size);
extern void CInit_RewriteString(ENode *expr, Boolean flag);
extern void CInit_DeclarePooledStrings(void);
extern void CInit_DeclareData(Object *obj, void *data, OLinkList *list, SInt32 size);
extern void CInit_DeclareReadOnlyData(Object *obj, void *data, OLinkList *list, SInt32 size);
extern void CInit_DefineTentativeData(void);

#endif