File: codeobj.h

package info (click to toggle)
64tass 1.60.3243-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,432 kB
  • sloc: ansic: 48,995; xml: 647; asm: 333; makefile: 250
file content (76 lines) | stat: -rw-r--r-- 2,206 bytes parent folder | download
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
/*
    $Id: codeobj.h 3235 2025-05-04 15:37:02Z soci $

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

*/
#ifndef CODEOBJ_H
#define CODEOBJ_H
#include "obj.h"
#include "values.h"
#include "stdbool.h"

extern struct Type *const CODE_OBJ;

typedef enum Code_types {
    D_DINT = -4,
    D_LINT = -3,
    D_SINT = -2,
    D_CHAR = -1,
    D_NONE = 0,
    D_BYTE = 1,
    D_WORD = 2,
    D_LONG = 3,
    D_DWORD = 4
} Code_types;

typedef struct Code {
    Obj v;
    address_t size;
    address_t addr;
    ival_t offs;
    uint8_t pass;
    uint8_t apass;
    signed char dtype;
    Obj *typ;
    struct Memblocks *memblocks;
    address_t memaddr;
    size_t membp;
    struct Namespace *names;
    uval_t required;
    uval_t conflicts;
} Code;

#define Code(a) OBJ_CAST(Code, a)

extern void codeobj_init(void);
extern void codeobj_names(void);

static inline MUST_CHECK Code *new_code(void) {
    return Code(val_alloc(CODE_OBJ));
}

struct Error;

extern MUST_CHECK Obj *get_code_value(const Code *, linepos_t);
extern MUST_CHECK struct Error *code_uaddress(Obj *, uval_t *, uval_t *, linepos_t);
extern MUST_CHECK Obj *int_from_code(const Code *, linepos_t);
extern MUST_CHECK Obj *float_from_code(const Code *, linepos_t);
extern MUST_CHECK Obj *bits_from_code(const Code *, linepos_t);
extern MUST_CHECK Obj *bytes_from_code(const Code *, linepos_t);
extern MUST_CHECK Obj *tuple_from_code(Code *, struct Type *, linepos_t);
extern MUST_CHECK Obj *code_remove_address(Code *, bool);
extern int code_opcode(Code *);
#endif