コード例 #1
0
ファイル: Derivedtype.c プロジェクト: norman0612/NSBL_gcDev
int print_e_attr(EdgeType* e) {
    if( e == NULL )
        die(-1, "print_e_attr: NULL pointer.\n");
    GList* klist = g_hash_table_get_keys(e->attributes);
    int l = g_list_length(klist);
    int n = 0;
    printf("<Edge> : Id = %ld \n", e->id);
    printf("vstart");
    if(e->start!=NULL) {
        printf("[");
        print_v(e->start);
        printf("]");
    }
    else
        printf("[NULL]");

    printf("-->vend");

    if(e->end!=NULL) {
        printf("[");
        print_v(e->end);
        printf("]");
    }
    else
        printf("[NULL]");
    printf("\nEdge Attributes:--------------\n");
    for(n; n<l; n++) {
        void* key = g_list_nth_data(klist, n);
        Attribute* value = g_hash_table_lookup(e->attributes, key);
        output_attr( (char *) key, value, stdout);
    }
    printf("------------------------------\n");
    g_list_free(klist);
    return 0;
}
コード例 #2
0
ファイル: check-attr.c プロジェクト: nulltoken/git
static void check_attr(const char *prefix, int cnt,
                       struct git_attr_check *check, const char *file)
{
    char *full_path =
        prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
    if (check != NULL) {
        if (git_check_attr(full_path, cnt, check))
            die("git_check_attr died");
        output_attr(cnt, check, file);
    } else {
        if (git_all_attrs(full_path, &cnt, &check))
            die("git_all_attrs died");
        output_attr(cnt, check, file);
        free(check);
    }
    free(full_path);
}
コード例 #3
0
ファイル: Derivedtype.c プロジェクト: norman0612/NSBL_gcDev
int print_v_attr(VertexType* v) {
    if( v == NULL )
        die(-1, "print_v_attr: NULL pointer.\n");
    GList* klist = g_hash_table_get_keys(v->attributes);
    int l = g_list_length(klist);
    int n = 0;
    printf("\nVertex Attributes:------------\n");
    printf("<Vertex> : Id = %ld\n", v->id);
    for(n; n<l; n++) {
        void* key = g_list_nth_data(klist, n);
        Attribute* value = g_hash_table_lookup(v->attributes, key);
        output_attr( (char *) key, value, stdout);
    }
    printf("------------------------------\n");
    g_list_free(klist);
    return 0;
}
コード例 #4
0
ファイル: check-attr.c プロジェクト: KarthikNayak/git
static void check_attr(const char *prefix,
		       struct attr_check *check,
		       int collect_all,
		       const char *file)
{
	char *full_path =
		prefix_path(prefix, prefix ? strlen(prefix) : 0, file);

	if (collect_all) {
		git_all_attrs(full_path, check);
	} else {
		if (git_check_attr(full_path, check))
			die("git_check_attr died");
	}
	output_attr(check, file);

	free(full_path);
}