51 #define UNIT_TYPE_NAME "unit"
55 #define DEFLIST(type,cartype,carname)\
102 void* (*read)(FILE*,
int(*)(void)) ;
105 void* (*copy)(
void*) ;
147 #define MAX_DOMAIN 300
154 #define IS_INLINABLE(bp) ((bp)->inlined != NULL)
155 #define IS_EXTERNAL(bp) ((bp)->domain->ba.type == EXTERNAL_DT)
156 #define IS_TABULATED(bp) ((bp)->tabulated!=NULL)
157 #define IS_IMPORT(bp) ((bp)->domain->ba.type == IMPORT_DT)
158 #define IS_NORMAL(bp) \
159 (!IS_INLINABLE(bp)&&!IS_EXTERNAL(bp)&&!IS_TABULATED(bp))
170 #define NEW_BINDING 1
171 #define OLD_BINDING 2
196 #define HASH_OFFSET 2
198 #define same_string_p(s1, s2) (strcmp((s1), (s2)) == 0)
200 #define IS_UNIT_TYPE(n) ((n)==unit_domain)
201 #define IS_BOOL_TYPE(n) ((n)==bool_domain)
202 #define IS_CHAR_TYPE(n) ((n)==char_domain)
203 #define IS_INT_TYPE(n) ((n)==int_domain)
204 #define IS_FLOAT_TYPE(n) ((n)==float_domain)
205 #define IS_STRING_TYPE(n) ((n)==string_domain)
212 #define check_domain(dom) \
213 message_assert("Consistant domain number",\
214 (dom)>=0 && (dom)<MAX_DOMAIN)
216 #define check_read_spec_performed() \
217 message_assert("gen_read_spec performed prior to use", \
218 Read_spec_performed);
220 #define NEWGEN_FREED ((void*)NULL)
222 #define newgen_free(p) (*((char*)(p))='\0',free(p))
226 #define quick_domain_index(obj) \
227 (((! (obj)) || ((obj)==gen_chunk_undefined) || \
228 ((obj)->i<0) || ((obj)->i>MAX_DOMAIN)) ? \
229 newgen_domain_index(obj) : (obj)->i) \
233 extern void user(
char *, ...) ;
237 extern char *
i2a(
int);
239 extern void init(
void) ;
void const char const char const int
domain_operator
Operators for CONSTRUCTED domains.
int Number_imports
To manage imported domains:
void init(void)
INIT initializes global data structures.
gen_chunk * gen_tabulated_fake_object_hack(int)
WARNING: it is not reentrant...
#define DEFLIST(type, cartype, carname)
A list type constructor.
gen_tabulated_p gen_init_tabulated(int)
void print_domain(FILE *, union domain *)
PRINT_DOMAIN prints on the OUT stream a domain denoted by the DP pointer.
char * i2a(int)
I2A (Integer TO Ascii) yields a string for a given Integer.
struct gen_binding * new_binding()
struct gen_binding Domains[]
The implementation of tabulated domains.
struct gen_binding * Tabulated_bp
hack to walk thru tabulateds...
void gencode(string)
generate the code necessary to manipulate every internal non-inlinable type in the Domains table.
gen_chunk * gen_do_enter_tabulated(int, char *, gen_chunk *, bool)
int Current_op
Used to check, while parsing specs, that a constructed domain use only one operator type.
type_of_domain
Types of domain.
int newgen_domain_index(gen_chunk *)
DOMAIN_INDEX returns the index in the Domain table for object OBJ.
int gen_size(int)
GEN_SIZE returns the size (in gen_chunks) of an object of type defined by the BP type.
void user(char *,...)
External routines.
gen_chunk * gen_enter_tabulated(int, char *, gen_chunk *, bool)
ENTER_TABULATED_DEF enters a new definition (previous refs are allowed if ALLOW_REF) in the INDEX tab...
struct gen_binding * lookup()
void compile(void)
COMPILE reconnects the Domains table (for not compiled types – note that an inlined type is already c...
int Read_spec_mode
extern int Current_first ;
string concatenate(const char *,...)
Return the concatenation of the given strings.
void print_domains(FILE *)
PRINT_DOMAINS prints on the OUT stream the Domains table.
gen_chunk * Read_chunk
The root of the gen_chunk read with READ_CHUNK.
struct _gtp * gen_tabulated_p
actually defined in tabulated.c
set_type
Note: hash_chunk is not included in set_type.
struct inlinable * inlined
gen_tabulated_p tabulated
number of chunks to hold this data.
INLINE[] gives, for each inlinable (i.e., unboxed) type, its NAME, its initial VALUE and its printing...
A DOMAIN union describes the structure of a user type.
int(* allocated_memory)(void *)
struct gen_binding * element
struct domainlist * components
struct intlist * dimensions
struct gen_binding * constructand
void(* write)(FILE *, void *)
A gen_chunk is used to store every object.