Exemple #1
0
/**
 * @brief Display parameter info
 *
 * @param name - If this is NULL, display param info
 *               for all acfg apis
 *
 * @return
 */
int display_params(char *name)
{
    int idx = -1 ;

    if(name)
    {
        idx =  get_tbl_idx(name) ;
        print_param_info(idx);
    }
    else
    {
        idx = 0 ;
        while( fntbl[idx].apiname != NULL )
        {
            print_param_info(idx);
            idx++;
        }
    }

    return 0;
}
Exemple #2
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;
}