#ifndef BDB_H 
#define BDB_H 
/*---------- headerfile for src/bdb.ddl ----------*/
/* alignment is 4 */

/*---------- structures ----------*/
struct address {  /* size 36 */
    unsigned long    rva;
    unsigned long    pa;
    unsigned short   size;
    int     flags;
    unsigned long    dataType;
    int     dataSize;
    unsigned long    dataConst;
    unsigned long    structure;
    unsigned long    comment;
};

struct section {  /* size 44 */
    char    name[32];
    unsigned long    rva;
    unsigned long    size;
    int     flags;
};

struct xref {  /* size 16 */
    unsigned long    id;
    unsigned long    from_rva;
    unsigned long    to_rva;
    int     type;
};

struct xref_from_rva {  /* size 8 */
    unsigned long    from_rva;
    unsigned long    to_rva;
};

struct xref_to_rva {  /* size 8 */
    unsigned long    to_rva;
    unsigned long    from_rva;
};

struct code {  /* size 60 */
    unsigned long    rva;
    char    mnemonic[16];
    long    dest;
    long    src;
    long    aux;
    int     mnemType;
    int     destType;
    int     srcType;
    int     auxType;
    unsigned long    destConst;
    unsigned long    srcConst;
    unsigned long    auxConst;
};

struct code_dest {  /* size 8 */
    long    dest;
    unsigned long    rva;
};

struct code_src {  /* size 8 */
    long    src;
    unsigned long    rva;
};

struct code_mnemonic {  /* size 20 */
    char    mnemonic[16];
    unsigned long    rva;
};

struct addr_exp {  /* size 28 */
    int     id;
    int     scale;
    int     index;
    int     base;
    long    disp;
    int     flags;
    long    name;
};

struct code_effect {  /* size 16 */
    unsigned long    id;
    unsigned long    rva;
    int     reg;
    int     change;
};

struct code_effect_rvaid {  /* size 8 */
    unsigned long    rva;
    unsigned long    id;
};

struct int_code {  /* size 108 */
    unsigned long    id;
    unsigned long    rva;
    int     size;
    char    lvalue[32];
    char    rvalue[64];
};

struct fin_code {  /* size 268 */
    unsigned long    id;
    unsigned long    rva;
    int     size;
    char    line[256];
};

struct export_addr {  /* size 4 */
    unsigned long    rva;
};

struct import_addr {  /* size 12 */
    int     library;
    int     type;
    unsigned long    rva;
};

struct import_library {  /* size 8 */
    int     library;
    unsigned long    rva;
};

struct lib {  /* size 76 */
    int     id;
    char    name[64];
    int     ver_hi;
    int     ver_lo;
};

struct string {  /* size 264 */
    unsigned long    rva;
    int     length;
    char    text[256];
};

struct name {  /* size 72 */
    unsigned long    rva;
    int     type;
    char    name[64];
};

struct comment {  /* size 264 */
    unsigned long    id;
    int     type;
    char    text[256];
};

struct function {  /* size 20 */
    unsigned long    id;
    unsigned long    rva;
    unsigned short   size;
    unsigned long    ret_type;
    unsigned long    comment;
};

struct func_param {  /* size 56 */
    unsigned long    id;
    unsigned long    func;
    unsigned long    type;
    int     size;
    int     addr_exp;
    int     flags;
    char    name[32];
};

struct func_param_funcid {  /* size 8 */
    unsigned long    func;
    unsigned long    id;
};

struct func_local {  /* size 56 */
    unsigned long    id;
    unsigned long    func;
    unsigned long    type;
    int     size;
    int     addr_exp;
    int     flags;
    char    name[32];
};

struct func_local_funcid {  /* size 8 */
    unsigned long    func;
    unsigned long    id;
};

struct func_effect {  /* size 16 */
    unsigned long    id;
    unsigned long    func;
    int     reg;
    int     change;
};

struct func_effect_funcid {  /* size 8 */
    unsigned long    func;
    unsigned long    id;
};

struct f_inline {  /* size 74 */
    unsigned long    id;
    char    name[64];
    unsigned long    rva;
    unsigned short   size;
};

struct structure {  /* size 38 */
    unsigned long    id;
    char    name[32];
    unsigned short   size;
};

struct struct_member {  /* size 52 */
    unsigned long    id;
    unsigned long    type;
    int     size;
    unsigned long    structure;
    int     order;
    char    name[32];
};

struct struct_member_structid {  /* size 8 */
    unsigned long    structure;
    unsigned long    id;
};

struct data_type {  /* size 44 */
    unsigned long    id;
    int     size;
    int     flags;
    char    name[32];
};

struct constant {  /* size 40 */
    unsigned long    id;
    char    name[32];
    long    value;
};

struct bc_macro {  /* size 2088 */
    unsigned long    id;
    int     type;
    char    name[32];
    char    macro[2048];
};

/*---------- record names ----------*/
#define ADDRESS 1000L
#define SECTION 2000L
#define XREF 3000L
#define CODE 4000L
#define ADDR_EXP 5000L
#define CODE_EFFECT 6000L
#define INT_CODE 7000L
#define FIN_CODE 8000L
#define EXPORT_ADDR 9000L
#define IMPORT_ADDR 10000L
#define LIB 11000L
#define STRING 12000L
#define NAME 13000L
#define COMMENT 14000L
#define FUNCTION 15000L
#define FUNC_PARAM 16000L
#define FUNC_LOCAL 17000L
#define FUNC_EFFECT 18000L
#define F_INLINE 19000L
#define STRUCTURE 20000L
#define STRUCT_MEMBER 21000L
#define DATA_TYPE 22000L
#define CONSTANT 23000L
#define BC_MACRO 24000L

/*---------- field names ----------*/
#define ADDRESS_RVA 1001L
#define PA 1002L
#define ADDRESS_SIZE 1003L
#define ADDRESS_FLAGS 1004L
#define DATATYPE 1005L
#define DATASIZE 1006L
#define DATACONST 1007L
#define ADDRESS_STRUCTURE 1008L
#define ADDRESS_COMMENT 1009L
#define SECTION_NAME 2001L
#define SECTION_RVA 2002L
#define SECTION_SIZE 2003L
#define SECTION_FLAGS 2004L
#define XREF_ID 3001L
#define FROM_RVA 3002L
#define TO_RVA 3003L
#define XREF_TYPE 3004L
#define CODE_RVA 4001L
#define MNEMONIC 4002L
#define DEST 4003L
#define SRC 4004L
#define AUX 4005L
#define MNEMTYPE 4006L
#define DESTTYPE 4007L
#define SRCTYPE 4008L
#define AUXTYPE 4009L
#define DESTCONST 4010L
#define SRCCONST 4011L
#define AUXCONST 4012L
#define ADDR_EXP_ID 5001L
#define SCALE 5002L
#define INDEX 5003L
#define BASE 5004L
#define DISP 5005L
#define ADDR_EXP_FLAGS 5006L
#define ADDR_EXP_NAME 5007L
#define CODE_EFFECT_ID 6001L
#define CODE_EFFECT_RVA 6002L
#define CODE_EFFECT_REG 6003L
#define CODE_EFFECT_CHANGE 6004L
#define INT_CODE_ID 7001L
#define INT_CODE_RVA 7002L
#define INT_CODE_SIZE 7003L
#define LVALUE 7004L
#define RVALUE 7005L
#define FIN_CODE_ID 8001L
#define FIN_CODE_RVA 8002L
#define FIN_CODE_SIZE 8003L
#define LINE 8004L
#define EXPORT_ADDR_RVA 9001L
#define LIBRARY 10001L
#define IMPORT_ADDR_TYPE 10002L
#define IMPORT_ADDR_RVA 10003L
#define LIB_ID 11001L
#define LIB_NAME 11002L
#define VER_HI 11003L
#define VER_LO 11004L
#define STRING_RVA 12001L
#define LENGTH 12002L
#define STRING_TEXT 12003L
#define NAME_RVA 13001L
#define NAME_TYPE 13002L
#define NAME_NAME 13003L
#define COMMENT_ID 14001L
#define COMMENT_TYPE 14002L
#define COMMENT_TEXT 14003L
#define FUNCTION_ID 15001L
#define FUNCTION_RVA 15002L
#define FUNCTION_SIZE 15003L
#define RET_TYPE 15004L
#define FUNCTION_COMMENT 15005L
#define FUNC_PARAM_ID 16001L
#define FUNC_PARAM_FUNC 16002L
#define FUNC_PARAM_TYPE 16003L
#define FUNC_PARAM_SIZE 16004L
#define FUNC_PARAM_ADDR_EXP 16005L
#define FUNC_PARAM_FLAGS 16006L
#define FUNC_PARAM_NAME 16007L
#define FUNC_LOCAL_ID 17001L
#define FUNC_LOCAL_FUNC 17002L
#define FUNC_LOCAL_TYPE 17003L
#define FUNC_LOCAL_SIZE 17004L
#define FUNC_LOCAL_ADDR_EXP 17005L
#define FUNC_LOCAL_FLAGS 17006L
#define FUNC_LOCAL_NAME 17007L
#define FUNC_EFFECT_ID 18001L
#define FUNC_EFFECT_FUNC 18002L
#define FUNC_EFFECT_REG 18003L
#define FUNC_EFFECT_CHANGE 18004L
#define F_INLINE_ID 19001L
#define F_INLINE_NAME 19002L
#define F_INLINE_RVA 19003L
#define F_INLINE_SIZE 19004L
#define STRUCTURE_ID 20001L
#define STRUCTURE_NAME 20002L
#define STRUCTURE_SIZE 20003L
#define STRUCT_MEMBER_ID 21001L
#define STRUCT_MEMBER_TYPE 21002L
#define STRUCT_MEMBER_SIZE 21003L
#define STRUCT_MEMBER_STRUCTURE 21004L
#define ORDER 21005L
#define STRUCT_MEMBER_NAME 21006L
#define DATA_TYPE_ID 22001L
#define DATA_TYPE_SIZE 22002L
#define DATA_TYPE_FLAGS 22003L
#define DATA_TYPE_NAME 22004L
#define CONSTANT_ID 23001L
#define CONSTANT_NAME 23002L
#define VALUE 23003L
#define BC_MACRO_ID 24001L
#define BC_MACRO_TYPE 24002L
#define BC_MACRO_NAME 24003L
#define MACRO 24004L

/*---------- key names ----------*/
#define XREF_FROM_RVA 7
#define XREF_TO_RVA 8
#define CODE_DEST 10
#define CODE_SRC 11
#define CODE_MNEMONIC 12
#define CODE_EFFECT_RVAID 15
#define IMPORT_LIBRARY 22
#define FUNC_PARAM_FUNCID 32
#define FUNC_LOCAL_FUNCID 34
#define FUNC_EFFECT_FUNCID 36
#define STRUCT_MEMBER_STRUCTID 41

/*---------- sequence names ----------*/

/*---------- integer constants ----------*/
#endif 
