diff options
| author | redbrain <redbrain@crules.org> | 2010-07-10 03:01:25 +0100 |
|---|---|---|
| committer | redbrain <redbrain@crules.org> | 2010-07-10 03:01:25 +0100 |
| commit | dd727ba95e2b21723c1c50f1365c8cdaf7877db2 (patch) | |
| tree | 64a159f5dc2b3e5a6f8ff07b28fb694c8fa49b96 /libgpython/include/gpython | |
| parent | 5e8789d3b0d7f0c6b290f3fd0ef1d27faaf6bf8b (diff) | |
| download | gcc-dd727ba95e2b21723c1c50f1365c8cdaf7877db2.tar.gz | |
more boilerplate
Diffstat (limited to 'libgpython/include/gpython')
| -rw-r--r-- | libgpython/include/gpython/gpython.h | 21 | ||||
| -rw-r--r-- | libgpython/include/gpython/vectors.h | 9 |
2 files changed, 27 insertions, 3 deletions
diff --git a/libgpython/include/gpython/gpython.h b/libgpython/include/gpython/gpython.h index b9aa3661da0..db2a29a9bb2 100644 --- a/libgpython/include/gpython/gpython.h +++ b/libgpython/include/gpython/gpython.h @@ -54,12 +54,19 @@ typedef struct gpy_rr_object_state_t { void * self; } gpy_rr_object_state_t ; +#define Gpy_Object_State_Init( x ) \ + x = gpy_malloc( sizeof(gpy_rr_object_state_t) ); \ + x->obj_t_ident = NULL; \ + x->ref_count = 0; \ + x->self = NULL; + typedef gpy_rr_object_state_t * gpy_object_state_t; +#define NULL_OBJ_STATE NULL typedef gpy_object_state_t (*binary_op)( gpy_object_state_t, gpy_object_state_t ); -enum GPY_LIT_T { TYPE_INTEGER, TYPE_STRING }; +enum GPY_LIT_T { TYPE_INTEGER, TYPE_STRING, TYPE_NONE }; typedef struct gpy_rr_literal_t { enum GPY_LIT_T type; @@ -70,6 +77,11 @@ typedef struct gpy_rr_literal_t { } literal ; } gpy_literal_t ; +#define Gpy_Lit_Init( x ) \ + x = gpy_malloc( sizeof(gpy_literal_t) ); \ + x->type = TYPE_NONE; \ + x->literal.integer = 0; + typedef struct gpy_number_prot_t { bool init; @@ -94,7 +106,7 @@ typedef struct gpy_number_prot_t typedef struct gpy_type_obj_def_t { char * identifier; size_t builtin_type_size; - void * (*init_hook)( gpy_object_state_t ); + void * (*init_hook)( gpy_literal_t * ); void (*destroy_hook)( void * ); void (*print_hook)( void * , FILE * , bool ); const struct gpy_number_prot_t * binary_protocol; @@ -115,6 +127,11 @@ extern void * gpy_calloc( size_t , size_t ); free( x ); \ x = NULL; +#ifdef HAVE_STRDUP +# define gpy_strdup( x ) \ + strdup( x ) +#endif + #ifdef DEBUG extern void __gpy_debug__( const char *, unsigned , diff --git a/libgpython/include/gpython/vectors.h b/libgpython/include/gpython/vectors.h index be4e329e653..ff29e9dac7f 100644 --- a/libgpython/include/gpython/vectors.h +++ b/libgpython/include/gpython/vectors.h @@ -40,10 +40,17 @@ extern gpy_hashval_t gpy_dd_hash_string( const char * ); extern gpy_hash_entry_t * gpy_dd_hash_lookup_table( gpy_hash_tab_t *, gpy_hashval_t ); -extern void ** gpy_dd_hash_insert( gpy_hashval_t, void *, gpy_hash_tab_t * ); +extern void ** gpy_dd_hash_insert( const gpy_hashval_t , void * const , + gpy_hash_tab_t * const ); extern void gpy_dd_hash_grow_table( gpy_hash_tab_t * ); extern void gpy_dd_hash_init_table( gpy_hash_tab_t ** ); +extern void gpy_vec_init( gpy_vector_t * const ); + +extern void gpy_vec_push( gpy_vector_t * const, void * const ); + +extern void * gpy_vev_pop( gpy_vector_t * const ); + #endif //__GCC_VECTORS_H__ |
