36 #define IS_NON_INLINABLE_BASIS(f) (strcmp(f,"chunk")==0)
37 #define UPPER(c) ((islower( c )) ? toupper( c ) : c )
38 #define TYPE(bp) (bp-Domains-Number_imports-Current_start)
40 #define OR_TAG_OFFSET 2
62 return( overhead + 1 ) ;
65 return( overhead + 2 ) ;
70 for( size=0 ; dlp != NULL ; dlp=dlp->cdr, size++ )
72 return( overhead + size ) ;
87 static char buffer[ 1024 ];
97 fprintf(stderr,
"primitive_field not implemented\n");
99 else sprintf(
buffer,
"chunk" ) ;
103 sprintf(
buffer,
"list" ) ;
106 sprintf(
buffer,
"set" ) ;
109 sprintf(
buffer,
"vector" ) ;
112 fatal(
"primitive_field: Unknown type %s\n",
i2a( dp->
ba.
type )) ;
134 (void)
printf(
"case (sub (node,%d)) of (%s x) => x;\n",
157 struct domainlist *dlp ;
159 static char buffer[ 1024 ] ;
161 for( sprintf(
buffer,
"" ) ; dlp->cdr != NULL ; dlp = dlp->cdr ) {
174 static char arg[ 1024 ] ;
176 sprintf(arg,
"update(gen_v, %d, %s %s);", index,
186 struct domainlist *dlp ;
188 static char buffer[ 1024 ] ;
191 for( sprintf(
buffer,
"") ; dlp->cdr!=NULL ; dlp=dlp->cdr, index++ ) {
202 gen_make( bp, size, args, updated_args, option_name )
205 char *args, *updated_args, *option_name ;
209 (void)
printf(
"fun make_%s%s%s (%s) =", bp->
name,
210 (strcmp(option_name,
"") == 0 ?
"" :
"_"), option_name,
212 (void)
printf(
" let val gen_v = array(%d+%d, undefined) in\n",
215 (void)
printf(
" %s\n", updated_args);
218 fprintf(stderr,
"enter_tabulated not called\n");
220 (void)
printf(
" vector gen_v end:%s;\n", bp->
name) ;
234 struct domainlist *dlp ;
243 for( dlp=dom->
co.
components ; dlp != NULL ; dlp=dlp->cdr )
258 struct domainlist *dlp ;
261 (void)
printf(
"fun %s_tag (vector or) = ", name ) ;
262 (void)
printf(
"case (sub (or,%d)) of (int x) => x;\n",
267 dlp=dlp->cdr,
offset++ ) {
268 union domain *dp = dlp->domain ;
269 static char args[ 1024 ] ;
270 static char updated_args[ 1024 ] ;
273 strcpy(updated_args,
"update(gen_v, 2, int tag);") ;
277 (void)
printf(
"val is_%s_%s = %d;\n",
279 (void)
printf(
"fun %s_%s_p or = ((%s_tag or)=is_%s_%s);\n",
308 fprintf( stderr,
"Set: too be implemented\n" ) ;
335 fprintf( stderr,
"External: too be implemented\n" ) ;
350 (void)
printf(
"type %s = chunk;\n", bp->
name ) ;
351 (void)
printf(
"val %s_undefined = (undefined:%s);\n",
353 (void)
printf(
"fun write_%s fd obj = gen_write fd obj;\n",
355 (void)
printf(
"fun read_%s fd = (gen_read fd):%s;\n",
360 switch( dp->
co.
op ) {
368 fatal(
"gen_domain: Unknown constructed %s\n",
i2a( dp->
co.
op )) ;
397 sprintf(
start,
"gen_%s_start", file ) ;
static char * gen_arg(dp)
GEN_ARG returns the constructor name of domain DP.
int gen_size(bp)
GEN_SIZE returns the size (in gen_chunks) of an object of type defined by the BP type.
static char * primitive_field(dp)
PRIMITIVE_FIELD returns the appropriate field to acces an object in BP.
void gen_external(bp)
GEN_EXTERNAL defines the acces functions for an external type BP.
#define GEN_HEADER
For simplicity, the tabulation slot is always here.
static void gen_make(bp, size, char *args, char *updated_args, char *option_name)
GEN_MAKE generates the gen_alloc call for gen_bindings BD with SIZE user members and ARGS as list of ...
static void gen_member(name, dp, offset)
GEN_MEMBER generates a member access functions for domain DP and OFFSET.
struct gen_binding * Tabulated_bp
void gen_list(bp)
GEN_LIST defines the manipulation functions for a list type BP.
void gen_or(bp)
GEN_OR generates the manipulation function for an OR_OP type BP.
void gen_and(bp)
GEN_AND generates the manipulation functions for an AND type BP.
void gen_array(bp)
GEN_ARRAY defines the manipulation functions for an array type BP.
void gencode(file)
GENCODE generates the code necessary to manipulate every internal and non-inlinable type in the Domai...
static char * gen_update_args(dlp)
GEN_UPDATE_ARGS returns a comma-separated list of constructor names for the list of domains DLP.
void gen_set(bp)
GEN_SET defines the manipulation functions for a set type BP.
static char * gen_update_arg(dp, index)
int Read_spec_mode
extern int Current_first ;
void gen_domain(bp)
GEN_DOMAIN generates the manipulation functions for a type BP.
static char * gen_args(dlp)
GEN_ARGS returns a comma-separated list of constructor names for the list of domains DLP.
struct gen_binding Domains[MAX_DOMAIN]
in build.c
char * i2a(int)
I2A (Integer TO Ascii) yields a string for a given Integer.
#define IS_INLINABLE(bp)
Different kinds of BINDING structure pointers.
#define MAX_DOMAIN
MAX_DOMAIN is the maximum number of entries in the DOMAINS table.
#define UNIT_TYPE_NAME
The UNIT_TYPE_NAME is the used to type expressions which only perform side-effects.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
A DOMAIN union describes the structure of a user type.
struct domainlist * components
struct gen_binding * constructand