Ejemplo n.º 1
0
void test__type_duplicate__all_registered(void** state)
{
    type_register(_test__type_duplicate1_t, NULL, NULL, NULL, NULL);
    type_register(_test__type_duplicate2_t, NULL, NULL, NULL, NULL);
    assert_true(_type_duplicate(sizeof(_test__type_duplicate1_t), "_test__type_duplicate1_t",
                sizeof(_test__type_duplicate2_t), "_test__type_duplicate2_t") == false);
}
void test__hash_multiset_insert_varg__user_define_equal(void** state)
{
    hash_multiset_t* pt_hash_multiset = NULL;
    hash_multiset_iterator_t it_iter;
    _test__hash_multiset_insert_varg__user_define_t elem;
    int i = 0;

    type_register(_test__hash_multiset_insert_varg__user_define_t, NULL, NULL, NULL, NULL);

    pt_hash_multiset = _create_hash_multiset("_test__hash_multiset_insert_varg__user_define_t");
    hash_multiset_init(pt_hash_multiset);

    for(i = 0; i < 10; ++i)
    {
        elem.n_elem = i;
        _hash_multiset_insert(pt_hash_multiset, &elem);
    }

    elem.n_elem = 8;
    it_iter = _hash_multiset_insert(pt_hash_multiset, &elem);
    assert_true(((_test__hash_multiset_insert_varg__user_define_t*)_hash_multiset_iterator_get_pointer(it_iter))->n_elem == 8);
    assert_true(hash_multiset_size(pt_hash_multiset) == 11);

    hash_multiset_destroy(pt_hash_multiset);
}
void test__hash_multiset_equal_range__hash_multiset_equal_range_varg__user_define_equal(void** state)
{
    hash_multiset_t* pt_hash_multiset = NULL;
    range_t r_range;
    _test__hash_multiset_equal_range__hash_multiset_equal_range_varg__user_define_t elem;
    int i = 0;

    type_register(_test__hash_multiset_equal_range__hash_multiset_equal_range_varg__user_define_t, NULL, NULL, NULL, NULL);

    pt_hash_multiset = _create_hash_multiset("_test__hash_multiset_equal_range__hash_multiset_equal_range_varg__user_define_t");
    hash_multiset_init(pt_hash_multiset);

    for(i = 0; i < 10; ++i)
    {
        elem.n_elem = i;
        hash_multiset_insert(pt_hash_multiset, &elem);
    }

    elem.n_elem = 8;
    r_range = _hash_multiset_equal_range(pt_hash_multiset, &elem);
    assert_true(((_test__hash_multiset_equal_range__hash_multiset_equal_range_varg__user_define_t*)iterator_get_pointer(r_range.it_begin))->n_elem == 8);
    assert_true(((_test__hash_multiset_equal_range__hash_multiset_equal_range_varg__user_define_t*)iterator_get_pointer(r_range.it_end))->n_elem == 9);

    hash_multiset_destroy(pt_hash_multiset);
}
Ejemplo n.º 4
0
Archivo: ast.c Proyecto: deglingo/los
/* ast_init:
 */
void ast_init ( void )
{
  static gboolean done = FALSE;
  TypeInfo type_info[] = {
    { AST_TYPE_NODE,           0,             "Node" },
    { AST_TYPE_LIST,           AST_TYPE_NODE, "List" },
    { AST_TYPE_IDENT,          AST_TYPE_NODE, "Ident" },
    { AST_TYPE_DECL,           AST_TYPE_NODE, "Decl" },
    { AST_TYPE_NAMESPACE_DECL, AST_TYPE_DECL, "NamespaceDecl" },
    { AST_TYPE_CLASS_DECL,     AST_TYPE_DECL, "ClassDecl" },
    { AST_TYPE_FUNC_DECL,      AST_TYPE_DECL, "FuncDecl" },
    { 0, },
  };
  TypeInfo *info;
  if (done)
    return;
  done = TRUE;
  ident_cache = g_hash_table_new(g_str_hash, g_str_equal);
  /* types */
  type_nodes = g_ptr_array_new();
  g_ptr_array_add(type_nodes, NULL);
  for (info = type_info; info->type; info++)
    {
      type_register(info);
    }
}
 extended_type_info_typeid() :
     typeid_system::extended_type_info_typeid_0(
         boost::serialization::guid< T >()
     )
 {
     type_register(typeid(T));
     key_register();
 }
Ejemplo n.º 6
0
void test__create_vector__registed_type(void** state)
{
    typedef struct _tag__create_vector__registed_type{int n_elem;}_create_vector__registed_type_t;
    vector_t* pvec = NULL;
    type_register(_create_vector__registed_type_t, NULL, NULL, NULL, NULL);
    pvec = _create_vector("_create_vector__registed_type_t");
    assert_true(pvec != NULL);
    vector_destroy(pvec);
}
void test__create_hash_multiset__user_define(void** state)
{
    hash_multiset_t* pt_hash_multiset = NULL;

    type_register(_test__create_hash_multiset__user_define_t, NULL, NULL, NULL, NULL);
    pt_hash_multiset = _create_hash_multiset("_test__create_hash_multiset__user_define_t");
    assert_true(pt_hash_multiset != NULL);

    hash_multiset_destroy(pt_hash_multiset);
}
Ejemplo n.º 8
0
void test__type_init__all(void** state)
{
    typedef struct _tag_test_type_init {
        int a;
    } _test_type_init_t;
    type_register(_test_type_init_t, NULL, NULL, NULL, NULL);
    assert_true(_gt_typeregister._t_isinit == true);
    test__type_register_c_builtin__all(state);
    test__type_register_cstl_builtin__all(state);
}
Ejemplo n.º 9
0
void test__type_get_varg_value__invalid_c_builtin(void** state)
{
    _typeinfo_t t_info;
    _test__type_get_varg_value_t t_result;
    _test__type_get_varg_value_t t_input;
    type_register(_test__type_get_varg_value_t, NULL, NULL, NULL, NULL);
    _test__get_type(&t_info, "_test__type_get_varg_value_t");
    t_info._t_style = _TYPE_C_BUILTIN;
    expect_assert_failure(_test__type_get_varg_value__stub(&t_result, &t_info, &t_input));
}
Ejemplo n.º 10
0
void test__create_hash_multiset_auxiliary__user_define(void** state)
{
    hash_multiset_t* pt_hash_multiset = NULL;

    type_register(_test__create_hash_multiset_auxiliary__user_define_t, NULL, NULL, NULL, NULL);

    pt_hash_multiset = malloc(sizeof(hash_multiset_t));
    assert_true(_create_hash_multiset_auxiliary(pt_hash_multiset, "_test__create_hash_multiset_auxiliary__user_define_t"));
    assert_true(pt_hash_multiset != NULL);

    hash_multiset_destroy(pt_hash_multiset);
}
Ejemplo n.º 11
0
void test__create_avl_tree_auxiliary__user_define(void** state)
{
    _avl_tree_t* pt_avl_tree = NULL;

    type_register(_test__create_avl_tree_auxiliary__user_define_t, NULL, NULL, NULL, NULL);

    pt_avl_tree = malloc(sizeof(_avl_tree_t));
    assert_true(_create_avl_tree_auxiliary(pt_avl_tree, "_test__create_avl_tree_auxiliary__user_define_t"));
    assert_true(_avl_tree_is_created(pt_avl_tree));

    _avl_tree_destroy(pt_avl_tree);
}
Ejemplo n.º 12
0
int main(int argc, char* argv[])
{
    deque_t* pdeq_coll = NULL;
    person_t t_person;

    type_register(person_t, NULL, NULL, NULL, NULL);
    pdeq_coll = create_deque(person_t);
    if(pdeq_coll == NULL)
    {
        return -1;
    }

    deque_init(pdeq_coll);

    memset(t_person.s_firstname, '\0', 21);
    memset(t_person.s_lastname, '\0', 21);
    strcpy(t_person.s_firstname, "Jonh");
    strcpy(t_person.s_lastname, "right");
    deque_push_back(pdeq_coll, &t_person);
    memset(t_person.s_firstname, '\0', 21);
    memset(t_person.s_lastname, '\0', 21);
    strcpy(t_person.s_firstname, "Bill");
    strcpy(t_person.s_lastname, "killer");
    deque_push_back(pdeq_coll, &t_person);
    memset(t_person.s_firstname, '\0', 21);
    memset(t_person.s_lastname, '\0', 21);
    strcpy(t_person.s_firstname, "Jonh");
    strcpy(t_person.s_lastname, "sound");
    deque_push_back(pdeq_coll, &t_person);
    memset(t_person.s_firstname, '\0', 21);
    memset(t_person.s_lastname, '\0', 21);
    strcpy(t_person.s_firstname, "Bin");
    strcpy(t_person.s_lastname, "lee");
    deque_push_back(pdeq_coll, &t_person);
    memset(t_person.s_firstname, '\0', 21);
    memset(t_person.s_lastname, '\0', 21);
    strcpy(t_person.s_firstname, "Lee");
    strcpy(t_person.s_lastname, "bird");
    deque_push_back(pdeq_coll, &t_person);

    algo_for_each(deque_begin(pdeq_coll), deque_end(pdeq_coll), _print);
    printf("\n");

    algo_sort_if(deque_begin(pdeq_coll), deque_end(pdeq_coll), _person_sort_criterion);

    algo_for_each(deque_begin(pdeq_coll), deque_end(pdeq_coll), _print);
    printf("\n");

    deque_destroy(pdeq_coll);

    return 0;
}
Ejemplo n.º 13
0
static void aarch64_cpu_register(struct uc_struct *uc, const ARMCPUInfo *info)
{
    TypeInfo type_info = { 0 };
    type_info.parent = TYPE_AARCH64_CPU;
    type_info.instance_size = sizeof(ARMCPU);
    type_info.instance_init = info->initfn;
    type_info.class_size = sizeof(ARMCPUClass);
    type_info.class_init = info->class_init;

    type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name);
    type_register(uc, &type_info);
    g_free((void *)type_info.name);
}
Ejemplo n.º 14
0
Type line_get_type()
{
	static Type type = TYPE_INVALID;
	if(TYPE_INVALID == type) {
		type = type_register(TYPE_SHAPE,
							 "Line",
							 sizeof(LineClass),
							 (ClassInitFunc) line_class_init,
							 sizeof(Line),
							 TYPE_FLAGS_NONE);
	}

	return type;
}
Ejemplo n.º 15
0
void test__create_vector_auxiliary__registed_type(void** state)
{
    typedef struct _tag_create_vector_auxiliary__registed_type{int n_elem;}_create_vector_auxiliary__registed_type_t;
    vector_t* pvec = (vector_t*)malloc(sizeof(vector_t));
    assert_true(pvec != NULL);
    type_register(_create_vector_auxiliary__registed_type_t, NULL, NULL, NULL, NULL);
    assert_true(_create_vector_auxiliary(pvec, "_create_vector_auxiliary__registed_type_t"));
    assert_true(pvec->_pby_endofstorage == NULL);
    assert_true(pvec->_pby_finish == NULL);
    assert_true(pvec->_pby_start == NULL);
    assert_true(pvec->_t_typeinfo._pt_type != NULL);
    assert_true(pvec->_t_typeinfo._t_style == _TYPE_USER_DEFINE);
    assert_true(strcmp(pvec->_t_typeinfo._s_typename, "_create_vector_auxiliary__registed_type_t") == 0);

    vector_destroy(pvec);
}
Ejemplo n.º 16
0
static void aspeed_soc_register_types(void)
{
    int i;

    type_register_static(&aspeed_soc_type_info);
    for (i = 0; i < ARRAY_SIZE(aspeed_socs); ++i) {
        TypeInfo ti = {
            .name       = aspeed_socs[i].name,
            .parent     = TYPE_ASPEED_SOC,
            .class_init = aspeed_soc_class_init,
            .class_data = (void *) &aspeed_socs[i],
        };
        type_register(&ti);
    }
}

type_init(aspeed_soc_register_types)
Ejemplo n.º 17
0
static void pca954x_register_types(void)
{
    int i;

    type_register_static(&pca954x_info);
    for (i = 0; i < ARRAY_SIZE(known_devices); i++) {
        TypeInfo t = {
            .name = known_devices[i].name,
            .parent = TYPE_PCA954X,
            .class_init = pca954x_class_init,
            .class_data = &known_devices[i]
        };
        type_register(&t);
    }
}

type_init(pca954x_register_types)
Ejemplo n.º 18
0
Archivo: vl.c Proyecto: RKX1209/unicorn
void qemu_register_machine(struct uc_struct *uc, QEMUMachine *m, const char *type_machine,
                           void (*init)(struct uc_struct *uc, ObjectClass *oc, void *data))
{
    char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL);
    TypeInfo ti = {
        .name       = name,
        .parent     = type_machine,
        .class_init = init,
        .class_data = (void *)m,
    };

    if (init == NULL)
        ti.class_init = machine_class_init;

    type_register(uc, &ti);
    g_free(name);
}
Ejemplo n.º 19
0
static void aspeed_machine_types(void)
{
    int i;

    type_register_static(&aspeed_machine_type);
    for (i = 0; i < ARRAY_SIZE(aspeed_boards); ++i) {
        TypeInfo ti = {
            .name       = aspeed_boards[i].name,
            .parent     = TYPE_ASPEED_MACHINE,
            .class_init = aspeed_machine_class_init,
            .class_data = (void *)&aspeed_boards[i],
        };
        type_register(&ti);
    }
}

type_init(aspeed_machine_types)
Ejemplo n.º 20
0
static void m25p80_register_types(void)
{
    int i;

    type_register_static(&m25p80_info);
    for (i = 0; i < ARRAY_SIZE(known_devices); ++i) {
        TypeInfo ti = {
            .name       = known_devices[i].part_name,
            .parent     = TYPE_M25P80,
            .class_init = m25p80_class_init,
            .class_data = (void *)&known_devices[i],
        };
        type_register(&ti);
    }
}

type_init(m25p80_register_types)
Ejemplo n.º 21
0
void test__rb_tree_iterator_get_pointer__user_define(void** state)
{
    _rb_tree_t* pt_rb_tree = NULL;
    _rb_tree_iterator_t it_iter;
    _test__rb_tree_iterator_get_pointer__user_define_t elem;

    type_register(_test__rb_tree_iterator_get_pointer__user_define_t, NULL, NULL, NULL, NULL);
    pt_rb_tree = _create_rb_tree("_test__rb_tree_iterator_get_pointer__user_define_t");
    _rb_tree_init(pt_rb_tree, NULL);
    elem.elem = 100;
    _rb_tree_insert_unique(pt_rb_tree, &elem);

    it_iter = _rb_tree_begin(pt_rb_tree);
    assert_true(((_test__rb_tree_iterator_get_pointer__user_define_t*)_rb_tree_iterator_get_pointer(it_iter))->elem == 100);

    _rb_tree_destroy(pt_rb_tree);
}
Ejemplo n.º 22
0
static void run_writer(pid_t peer)
{
    qeo_factory_t *factory;
    qeocore_type_t *type;
    qeocore_writer_t *writer;
    qeocore_data_t *data, *seqdata;
    byte_array_t array;
    int status, i;

    /* initialize */
    assert(NULL != (factory = qeocore_factory_new(QEO_IDENTITY_DEFAULT)));
    init_factory(factory);
    assert(NULL != (type = type_register(factory)));
    assert(NULL != (writer = qeocore_writer_open(factory, type, NULL,
                                                 QEOCORE_EFLAG_STATE_DATA | QEOCORE_EFLAG_ENABLE,
                                                 NULL, NULL)));
    log_pid("writer initialized");
    assert(NULL != (data = qeocore_writer_data_new(writer)));
    assert(QEO_OK == qeocore_data_set_member(data, _size_id, &_test_size));
    /* init sequence */
    DDS_SEQ_INIT(array);
    assert(NULL != (DDS_SEQ_DATA(array) = malloc(_test_size * sizeof(char))));
    DDS_SEQ_LENGTH(array) = DDS_SEQ_MAXIMUM(array) = _test_size;
    for (i = 0; i < _test_size; i++) {
        DDS_SEQ_ITEM(array, i) = i & 0xff;
    }
    assert(QEO_OK == qeocore_data_get_member(data, _buf_id, &seqdata));
    assert(QEO_OK == qeocore_data_sequence_set(seqdata, (const qeo_sequence_t *)&array, 0));
    assert(QEO_OK == qeocore_data_set_member(data, _buf_id, &seqdata));
    /* write */
    assert(QEO_OK == qeocore_writer_write(writer, data));
    log_pid("writer wrote data");
    assert(peer == waitpid(peer, &status, 0));
    assert(0 == status);
    log_pid("writer done");
    /* clean up */
    free(DDS_SEQ_DATA(array));
    qeocore_data_free(seqdata);
    qeocore_data_free(data);
    qeocore_writer_close(writer);
    qeocore_type_free(type);
    qeocore_factory_close(factory);
}
Ejemplo n.º 23
0
void test__hash_multiset_count__hash_multiset_count_varg__user_define_0(void** state)
{
    hash_multiset_t* pt_hash_multiset = NULL;
    _test__hash_multiset_count__hash_multiset_count_varg__user_define_t elem;
    int i = 0;

    type_register(_test__hash_multiset_count__hash_multiset_count_varg__user_define_t, NULL, NULL, NULL, NULL);

    pt_hash_multiset = _create_hash_multiset("_test__hash_multiset_count__hash_multiset_count_varg__user_define_t");
    hash_multiset_init(pt_hash_multiset);

    for(i = 0; i < 10; ++i)
    {
        elem.n_elem = i;
        hash_multiset_insert(pt_hash_multiset, &elem);
    }

    elem.n_elem = 88;
    assert_true(_hash_multiset_count(pt_hash_multiset, &elem) == 0);

    hash_multiset_destroy(pt_hash_multiset);
}
Ejemplo n.º 24
0
static void run_reader(void)
{
    qeo_factory_t *factory;
    qeocore_type_t *type;
    qeocore_reader_t *reader;
    qeocore_reader_listener_t listener = { .on_data = my_on_data_available };

    sem_init(&_sync, 0, 0);
    assert(NULL != (factory = qeocore_factory_new(QEO_IDENTITY_DEFAULT)));
    init_factory(factory);
    assert(NULL != (type = type_register(factory)));
    assert(NULL != (reader = qeocore_reader_open(factory, type, NULL,
                                                 QEOCORE_EFLAG_STATE_DATA | QEOCORE_EFLAG_ENABLE,
                                                 &listener, NULL)));
    log_pid("reader initialized");
    sem_wait(&_sync); /* wait for sample */
    log_pid("reader done");
    sem_destroy(&_sync);
    qeocore_reader_close(reader);
    qeocore_type_free(type);
    qeocore_factory_close(factory);
}
Ejemplo n.º 25
0
static void mips_register_cpudef_type(const struct mips_def_t *def)
{
    char *typename = mips_cpu_type_name(def->name);
    TypeInfo ti = {
        .name = typename,
        .parent = TYPE_MIPS_CPU,
        .class_init = mips_cpu_cpudef_class_init,
        .class_data = (void *)def,
    };

    type_register(&ti);
    g_free(typename);
}

static void mips_cpu_register_types(void)
{
    int i;

    type_register_static(&mips_cpu_type_info);
    for (i = 0; i < mips_defs_number; i++) {
        mips_register_cpudef_type(&mips_defs[i]);
    }
}
Ejemplo n.º 26
0
 extended_type_info_typeid() :
     typeid_system::extended_type_info_typeid_0(get_key())
 {
     type_register(typeid(T));
     key_register();
 }
Ejemplo n.º 27
0
Archivo: asm.c Proyecto: cheuk-fung/C--
static void get_pos(struct Syntree_node *sn, int dir)
{
#ifdef NGDEBUG
    assert(sn->nkind == K_EXPR);
#endif
    switch (sn->se.expr) {
        case K_CHAR:
            sprintf(postmp, "$%d", sn->info.c);
            break;
        case K_STR:
            sprintf(postmp, "$.str%d", sn->info.strno);
            break;
        case K_INT:
            sprintf(postmp, "$%d", sn->info.val);
            break;
        case K_DOUBLE:
            sprintf(postmp, ".dbl%d", sn->info.dblno);
            break;
            /* TODO */
        case K_SYM:
            {
                int offset = sn->info.symbol->offset;
                if (offset == -1) {
                    sprintf(eptmp, "%s", sn->info.symbol->name);
                } else if (offset < curr_func_env->param_size) {
                    get_ebp(offset);
                } else {
                    get_esp(offset + curr_func_env->tmp_size + curr_func_env->call_size - curr_func_env->param_size);
                }
                if (dir == TO || sn->ntype.kind == T_DOUBLE) {
                    sprintf(postmp, "%s", eptmp);
                } else {
                    fprintf(fasm, "\t%s\t%s, %s\n", mov_action(sn->ntype.kind), eptmp, type_register(sn->ntype.kind));
                    sprintf(postmp, "%s", type_register(sn->ntype.kind));
                }
                break;
            }
        case K_PTR:
            {
                int ptrcnt = 0;
                struct Syntree_node *tmp;
                for (tmp = sn; tmp->se.expr == K_PTR; tmp = tmp->child[0]) {
                    ptrcnt++;
                }
                get_pos(tmp, TO);
                if (tmp->nkind == K_EXPR && tmp->se.expr == K_SYM && tmp->info.symbol->offset == -1) {
                    fprintf(fasm, "\tleal\t%s, %%edx\n", postmp);
                } else {
                    fprintf(fasm, "\tmovl\t%s, %%edx\n", postmp);
                }
                int i;
                for (i = 1; i < ptrcnt; i++) {
                    fprintf(fasm, "\tmovl\t(%%edx), %%edx\n");
                }
                if (dir == TO) {
                    sprintf(postmp, "(%%edx)");
                } else {
                    fprintf(fasm, "\tmovl\t(%%edx), %%edx\n");
                    sprintf(postmp, "%%edx");
                }
                break;
            }
        case K_ARY:
            {
                int arycnt = 0, arysize[16];
                struct Arysize_entry *ae;
                for (ae = sn->info.symbol->arysize_list; ae; ae = ae->next) {
                    arysize[arycnt++] = ae->size;
                }

                int aryoffset = 1;
                struct Syntree_node *tmp;
                fprintf(fasm, "\tsarl\t$31, %%edx\n");
                for (tmp = sn; tmp->se.expr != K_SYM; tmp = tmp->child[0]) {
                    asm_translate(tmp->child[1]);
                    get_pos(tmp->child[1], TO);
                    if (aryoffset != 1) {
                        fprintf(fasm, "\tmovl\t%s, %%eax\n", postmp);
                        fprintf(fasm, "\timull\t$%d, %%eax\n", aryoffset);
                        fprintf(fasm, "\taddl\t%%eax, %%edx\n");
                    } else {
                        fprintf(fasm, "\taddl\t%s, %%edx\n", postmp);
                    }
                    aryoffset = arysize[--arycnt];
                }

                int offset = sn->info.symbol->offset;
                if (offset == -1) {
                    sprintf(eptmp, "%s(,%%edx,%zd)", sn->info.symbol->name, sn->info.symbol->size);
                } else if (offset < curr_func_env->param_size) {
                    sprintf(eptmp, "-%zd(%%ebp,%%edx,%zd)", offset + 8, sn->info.symbol->size);
                } else {
                    sprintf(eptmp, "%zd(%%esp,%%edx,%zd)", offset + curr_func_env->tmp_size + curr_func_env->call_size - curr_func_env->param_size, sn->info.symbol->size);
                }

                if (dir == TO || sn->ntype.kind == T_DOUBLE) {
                    sprintf(postmp, "%s", eptmp);
                } else {
                    fprintf(fasm, "\t%s\t%s, %s\n", mov_action(sn->ntype.kind), eptmp, type_register(sn->ntype.kind));
                    sprintf(postmp, "%s", type_register(sn->ntype.kind));
                }
                break;
            }
        case K_DOT:
            {
                int offset = sn->child[0]->info.symbol->offset;
                if (offset == -1) {
                    sprintf(eptmp, "%s+%zd", sn->child[0]->info.symbol->name, sn->child[1]->info.symbol->offset);
                } else if (offset < curr_func_env->param_size) {
                    get_ebp(offset + sn->child[1]->info.symbol->offset);
                } else {
                    get_esp(offset + curr_func_env->tmp_size + curr_func_env->call_size - curr_func_env->param_size + sn->child[1]->info.symbol->offset);
                }
                if (dir == TO || sn->ntype.kind == T_DOUBLE) {
                    sprintf(postmp, "%s", eptmp);
                } else {
                    fprintf(fasm, "\t%s\t%s, %s\n", mov_action(sn->ntype.kind), eptmp, type_register(sn->ntype.kind));
                    sprintf(postmp, "%s", type_register(sn->ntype.kind));
                }
                break;
            }
        case K_CALL:
        case K_OPR:
            {
                get_esp(sn->tmppos);
                if (dir == TO || sn->ntype.kind == T_DOUBLE) {
                    sprintf(postmp, "%s", eptmp);
                } else if (sn->ntype.kind != T_DOUBLE) {
                    fprintf(fasm, "\t%s\t%s, %s\n", mov_action(sn->ntype.kind), eptmp, type_register(sn->ntype.kind));
                    sprintf(postmp, "%s", type_register(sn->ntype.kind));
                }
            }
            break;
    }
}
 extended_type_info_typeid() :
     detail::extended_type_info_typeid_0()
 {
     type_register(typeid(T));
 }
Ejemplo n.º 29
0
TypeImpl *type_register_static(const TypeInfo *info)
{
    return type_register(info);
}
Ejemplo n.º 30
0
    return 0;
}

static void type_class_interface_init(TypeImpl *ti, InterfaceImpl *iface)
{
    TypeInfo info = {
        .instance_size = sizeof(Interface),
        .parent = iface->parent,
        .class_size = sizeof(InterfaceClass),
        .class_init = iface->interface_initfn,
        .abstract = true,
    };
    char *name = g_strdup_printf("<%s::%s>", ti->name, iface->parent);

    info.name = name;
    iface->type = type_register(&info);
    g_free(name);
}

static void type_initialize(TypeImpl *ti)
{
    size_t class_size = sizeof(ObjectClass);
    int i;

    if (ti->class) {
        return;
    }

    ti->class_size = type_class_get_size(ti);
    ti->instance_size = type_object_get_size(ti);