| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef alu_H |
| 7 |
#define alu_H |
| 8 |
|
| 9 |
|
| 10 |
#include "config.h" |
| 11 |
|
| 12 |
|
| 13 |
struct op; |
| 14 |
struct dynabuf; |
| 15 |
struct type { |
| 16 |
const char *name; |
| 17 |
boolean (*is_defined)(const struct object *self); |
| 18 |
boolean (*differs)(const struct object *self, const struct object *other); |
| 19 |
boolean (*assign)(struct object *self, const struct object *new_value, boolean accept_change); |
| 20 |
void (*monadic_op)(struct object *self, const struct op *op); |
| 21 |
void (*dyadic_op)(struct object *self, const struct op *op, struct object *other); |
| 22 |
void (*fix_result)(struct object *self); |
| 23 |
void (*print)(const struct object *self, struct dynabuf *db); |
| 24 |
int (*length)(const struct object *self); |
| 25 |
void (*at)(const struct object *self, struct object *target, int index); |
| 26 |
}; |
| 27 |
extern struct type type_number; |
| 28 |
extern struct type type_list; |
| 29 |
extern struct type type_string; |
| 30 |
|
| 31 |
struct expression { |
| 32 |
struct object result; |
| 33 |
boolean is_empty; |
| 34 |
int open_parentheses; |
| 35 |
boolean is_parenthesized; |
| 36 |
|
| 37 |
}; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#define NO_FORCE_BIT 0 // (just to make source more readable) |
| 44 |
#define NUMBER_FORCES_8 (1u << 0) // value usage forces 8-bit usage |
| 45 |
#define NUMBER_FORCES_16 (1u << 1) // value usage forces 16-bit usage |
| 46 |
#define NUMBER_FORCES_24 (1u << 2) // value usage forces 24-bit usage |
| 47 |
#define NUMBER_FORCEBITS (NUMBER_FORCES_8 | NUMBER_FORCES_16 | NUMBER_FORCES_24) |
| 48 |
#define NUMBER_FITS_BYTE (1u << 3) // value is guaranteed to fit in one byte |
| 49 |
#define NUMBER_EVER_UNDEFINED (1u << 4) // value once was related to |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
extern void string_prepare_string(struct object *self, int len); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
extern void ALU_any_int(intval_t *target); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
extern void ALU_defined_int(struct number *intresult); |
| 81 |
|
| 82 |
|
| 83 |
extern void ALU_addrmode_int(struct expression *expression, int paren); |
| 84 |
|
| 85 |
|
| 86 |
extern void ALU_any_result(struct object *result); |
| 87 |
|
| 88 |
|
| 89 |
#endif |