Ejemplo n.º 1
0
void 
lia_affiche_avl_simple(lia_avl_t racine, FILE * file)
{
	if (racine) {
		lia_affiche_avl_simple(racine->fg, file);
		print_type_info(racine->info);
		lia_affiche_avl_simple(racine->fd, file);
	}
}
Ejemplo n.º 2
0
static void print_variant_info(struct variant_info *vi)
{
	if(!vi)
	{
		printf("vi:<NULL>\n");
		return ;
	}
	printf("vi_name:%s global:%d ", vi->vi_name, vi->global);
	print_type_info(vi->type_info);
	if(vi->global)
	{
		printf("addr:%s\n", vi->vi_addr_p);
	}
	else
		printf("addr:%d\n", vi->vi_addr);
}
Ejemplo n.º 3
0
int main(int argc, char **argv)
{
	struct type_info *type;
	char *bi[] = {"int", "short", "char", "void *"};
	char *bi2[] = {"struct hello", "struct ok", "struct hello", "struct hello *", "struct you", "struct f**k",
		"struct muni", "struct fuck_you_foreya"};
	int i = 0;
	struct func_info *fi;
	struct variant_info *vi;
	char *types[] = {"int", "struct hello", "struct pointrt", "struct he", "int * *"};
	char  *names[] = {"k", "j", "f**k", "you", "doc"};
	char *param_list[] = {"char * hua , int hello", "void", "", "void * hello", "void * type , struct hello * * f**k , int k"};
	char *name;
	struct HashTable *func_table;

	type_init();

	for(i = 0; i < sizeof(bi) / sizeof(char*); i ++)
	{
		type = get_type(bi[i]);
		printf("full_name:%s, name:%s, level:%d, len:%d, is_struct:%d\n", 
			bi[i], type->ti_name, type->pointer_level, type->len, type->is_struct);
	}
	for(i = 0; i < sizeof(bi2)/ sizeof(char*); i ++)
	{
		type = create_type_info(bi2[i], i + 1);
	}
	for(i = 0; i < sizeof(bi2) / sizeof(char*); i ++)
	{
		type = get_type(bi2[i]);
		printf("Full name:%s, name %s, level %d, len %d, is_struct %d, ref %d\n", 
			bi2[i], type->si->name, type->pointer_level, type->len, type->is_struct, type->ref);
	}
	/*测试函数信息*/
	function_init();
	func_table = create_func_table();
	printf("--------------function------------------------\n");
	for(i = 0; i < sizeof(types) / sizeof(char*); i ++)
	{
		fi = create_func_info(types[i], names[i], param_list[i]);
		printf("%d\n", insert_func_table(func_table, fi));
	}
	for(i = 0; i < sizeof(types) / sizeof(char*); i ++)
	{
		fi = get_func_from_table(func_table, names[i]);
		printf("Full-name:%s, param_num:%d, name:%s\n", names[i], fi->param_info->param_num, fi->fi_name);
		print_type_info(fi->ret_info);
		print_param_info(fi->param_info);
	}
	printf("---------------------------------------------\n");
	for(i = 0; i < sizeof(types) / sizeof(char*); i ++)
	{
		vi = create_variant_info(types[i], names[i]);
		if(vi->type_info->is_struct)
			name = vi->type_info->si->name;
		else
			name = vi->type_info->ti_name;
		printf("full-name:%s, type_name:%s, real_name:%s, ref:%d\n", names[i], name, vi->vi_name, vi->type_info->ref);
	}

	return 0;
}
Ejemplo n.º 4
0
int print_typedef(struct type_def *def, long long offset, char *data)
{
	struct type_info *tinfo = def->type;
	return print_type_info(tinfo, offset, data);
}
Ejemplo n.º 5
0
int main(int argc, char **argv)
{
    ucs_config_print_flags_t print_flags;
    unsigned print_opts;
    char *tl_name;
    int c;

    print_opts  = 0;
    print_flags = 0;
    tl_name     = NULL;
    while ((c = getopt(argc, argv, "fahvcydbst:")) != -1) {
        switch (c) {
        case 'f':
            print_flags |= UCS_CONFIG_PRINT_CONFIG | UCS_CONFIG_PRINT_HEADER | UCS_CONFIG_PRINT_DOC;
            break;
        case 'a':
            print_flags |= UCS_CONFIG_PRINT_HIDDEN;
            break;
        case 'c':
            print_flags |= UCS_CONFIG_PRINT_CONFIG;
            break;
        case 'v':
            print_opts |= PRINT_VERSION;
            break;
        case 'd':
            print_opts |= PRINT_DEVICES;
            break;
        case 'b':
            print_opts |= PRINT_BUILD_CONFIG;
            break;
        case 'y':
            print_opts |= PRINT_TYPES;
            break;
        case 's':
            print_opts |= PRINT_SYS_INFO;
            break;
        case 't':
            tl_name = optarg;
            break;
        case 'h':
        default:
            usage();
            return -1;
        }
    }

    if ((print_opts == 0) && (print_flags == 0)) {
        usage();
        return -2;
    }

    if (print_opts & PRINT_VERSION) {
        print_version();
    }

    if (print_opts & PRINT_SYS_INFO) {
        print_sys_info();
    }

    if (print_opts & PRINT_BUILD_CONFIG) {
        print_build_config();
    }

    if (print_opts & PRINT_TYPES) {
        print_type_info(tl_name);
    }

    if (print_flags & UCS_CONFIG_PRINT_CONFIG) {
        ucs_global_opts_print(stdout, "global configuration", print_flags);
        print_ucp_config(print_flags);
        print_uct_config(print_flags, tl_name);
    }

    if (print_opts & PRINT_DEVICES) {
        print_uct_info(print_opts, print_flags, tl_name);
    }
    return 0;
}