PIPS
|
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "newgen_include.h"
#include "genC.h"
Go to the source code of this file.
Macros | |
#define | GEN_HEADER 2 |
For simplicity, the tabulation slot is always here. More... | |
#define | IS_NON_INLINABLE_BASIS(f) (strcmp(f,"chunk")==0) |
#define | UPPER(c) ((islower( c )) ? toupper( c ) : c ) |
#define | TYPE(bp) (bp-Domains-Number_imports-Current_start) |
#define | OR_TAG_OFFSET 2 |
Functions | |
int | gen_size (bp) |
GEN_SIZE returns the size (in gen_chunks) of an object of type defined by the BP type. More... | |
static char * | primitive_field (dp) |
PRIMITIVE_FIELD returns the appropriate field to acces an object in BP. More... | |
static void | gen_member (name, dp, offset) |
GEN_MEMBER generates a member access functions for domain DP and OFFSET. More... | |
static char * | gen_arg (dp) |
GEN_ARG returns the constructor name of domain DP. More... | |
static char * | gen_args (dlp) |
GEN_ARGS returns a comma-separated list of constructor names for the list of domains DLP. More... | |
static char * | gen_update_arg (dp, index) |
static char * | gen_update_args (dlp) |
GEN_UPDATE_ARGS returns a comma-separated list of constructor names for the list of domains DLP. More... | |
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 arguments. More... | |
void | gen_and (bp) |
GEN_AND generates the manipulation functions for an AND type BP. More... | |
void | gen_or (bp) |
GEN_OR generates the manipulation function for an OR_OP type BP. More... | |
void | gen_list (bp) |
GEN_LIST defines the manipulation functions for a list type BP. More... | |
void | gen_set (bp) |
GEN_SET defines the manipulation functions for a set type BP. More... | |
void | gen_array (bp) |
GEN_ARRAY defines the manipulation functions for an array type BP. More... | |
void | gen_external (bp) |
GEN_EXTERNAL defines the acces functions for an external type BP. More... | |
void | gen_domain (bp) |
GEN_DOMAIN generates the manipulation functions for a type BP. More... | |
void | gencode (file) |
GENCODE generates the code necessary to manipulate every internal and non-inlinable type in the Domains table. More... | |
Variables | |
static char | start [1024] |
int | Read_spec_mode |
extern int Current_first ; More... | |
struct gen_binding * | Tabulated_bp |
#define GEN_HEADER 2 |
#define TYPE | ( | bp | ) | (bp-Domains-Number_imports-Current_start) |
void gen_and | ( | bp | ) |
GEN_AND generates the manipulation functions for an AND type BP.
Definition at line 230 of file genSML.c.
References domain::co, domain::components, gen_binding::domain, gen_args(), GEN_HEADER, gen_make(), gen_member(), gen_size(), gen_update_args(), and gen_binding::name.
Referenced by gen_domain().
|
static |
GEN_ARG returns the constructor name of domain DP.
Definition at line 141 of file genSML.c.
References domain::ar, ARRAY_DT, domain::ba, BASIS_DT, domain::constructor, fatal(), i2a(), domain::li, LIST_DT, domain::se, SET_DT, and domain::type.
Referenced by gen_args(), and gen_update_arg().
|
static |
GEN_ARGS returns a comma-separated list of constructor names for the list of domains DLP.
Definition at line 156 of file genSML.c.
References buffer, and gen_arg().
Referenced by gen_and().
void gen_array | ( | bp | ) |
GEN_ARRAY defines the manipulation functions for an array type BP.
Definition at line 314 of file genSML.c.
References domain::ar, domain::constructor, gen_binding::domain, GEN_HEADER, gen_make(), gen_update_arg(), gen_binding::name, and printf().
Referenced by gen_domain().
void gen_domain | ( | bp | ) |
GEN_DOMAIN generates the manipulation functions for a type BP.
This is manily a dispatching function.
Definition at line 342 of file genSML.c.
References AND_OP, ARRAY_DT, domain::ba, domain::co, CONSTRUCTED_DT, gen_binding::domain, EXTERNAL_DT, fatal(), gen_and(), gen_array(), gen_external(), gen_list(), gen_or(), gen_set(), i2a(), IS_EXTERNAL, LIST_DT, gen_binding::name, domain::op, OR_OP, printf(), SET_DT, and domain::type.
Referenced by gencode().
void gen_external | ( | bp | ) |
GEN_EXTERNAL defines the acces functions for an external type BP.
The TYPEDEF has to be added by the user, but should be castable to a string (char *).
Definition at line 332 of file genSML.c.
References fprintf().
Referenced by gen_domain().
void gen_list | ( | bp | ) |
GEN_LIST defines the manipulation functions for a list type BP.
Definition at line 289 of file genSML.c.
References domain::constructor, gen_binding::domain, GEN_HEADER, gen_make(), gen_update_arg(), domain::li, gen_binding::name, and printf().
Referenced by gen_domain().
|
static |
GEN_MAKE generates the gen_alloc call for gen_bindings BD with SIZE user members and ARGS as list of arguments.
Definition at line 202 of file genSML.c.
References fprintf(), GEN_HEADER, IS_TABULATED, gen_binding::name, printf(), gen_binding::size, start, and TYPE.
Referenced by gen_and(), gen_array(), gen_list(), and gen_or().
|
static |
GEN_MEMBER generates a member access functions for domain DP and OFFSET.
NAME is the domain of the defined domain.
Definition at line 122 of file genSML.c.
References domain::ba, BASIS_DT, domain::constructand, domain::constructor, gen_binding::name, offset, primitive_field(), printf(), return(), domain::type, and UNIT_TYPE_NAME.
Referenced by gen_and(), and gen_or().
void gen_or | ( | bp | ) |
GEN_OR generates the manipulation function for an OR_OP type BP.
Note that for a UNIT_TYPE_NAME, no access function is defined since the value is meaningless.
Definition at line 252 of file genSML.c.
References domain::ba, domain::co, domain::components, domain::constructor, gen_binding::domain, domain::first, GEN_HEADER, gen_make(), gen_member(), gen_update_arg(), gen_binding::name, offset, OR_TAG_OFFSET, and printf().
Referenced by gen_domain().
void gen_set | ( | bp | ) |
GEN_SET defines the manipulation functions for a set type BP.
Definition at line 305 of file genSML.c.
References fprintf().
Referenced by gen_domain().
int gen_size | ( | bp | ) |
GEN_SIZE returns the size (in gen_chunks) of an object of type defined by the BP type.
OTREACHED
Definition at line 52 of file genSML.c.
References ARRAY_DT, domain::ba, BASIS_DT, domain::co, domain::components, CONSTRUCTED_DT, gen_binding::domain, fatal(), GEN_HEADER, i2a(), LIST_DT, domain::op, OR_OP, SET_DT, gen_binding::size, and domain::type.
Referenced by gen_and().
|
static |
Definition at line 170 of file genSML.c.
References gen_arg(), and primitive_field().
Referenced by gen_array(), gen_list(), gen_or(), and gen_update_args().
|
static |
GEN_UPDATE_ARGS returns a comma-separated list of constructor names for the list of domains DLP.
Definition at line 185 of file genSML.c.
References buffer, GEN_HEADER, and gen_update_arg().
Referenced by gen_and().
void gencode | ( | file | ) |
GENCODE generates the code necessary to manipulate every internal and non-inlinable type in the Domains table.
Definition at line 392 of file genSML.c.
References Domains, gen_domain(), IS_IMPORT, IS_INLINABLE, MAX_DOMAIN, gen_binding::name, start, and Tabulated_bp.
|
static |
PRIMITIVE_FIELD returns the appropriate field to acces an object in BP.
Note how inlined types are managed (see genC.h comments).
OTREACHED
Definition at line 84 of file genSML.c.
References ARRAY_DT, domain::ba, BASIS_DT, buffer, domain::constructand, fatal(), fprintf(), i2a(), IS_EXTERNAL, IS_INLINABLE, LIST_DT, gen_binding::name, SET_DT, and domain::type.
Referenced by gen_member(), and gen_update_arg().
|
static |
Definition at line 42 of file genSML.c.
Referenced by gen_make(), and gencode().
struct gen_binding* Tabulated_bp |