Lines Matching full:np
80 struct node *np; in new_node() local
82 np = calloc(1, sizeof *np); in new_node()
83 np->cont = sbuf_new_auto(); in new_node()
84 sbuf_clear(np->cont); in new_node()
85 np->key = sbuf_new_auto(); in new_node()
86 sbuf_clear(np->key); in new_node()
87 LIST_INIT(&np->children); in new_node()
88 return (np); in new_node()
102 struct node *np; in StartElement() local
112 np = new_node(); in StartElement()
115 np->id = strdup(attr[i+1]); in StartElement()
117 np->ref = strdup(attr[i+1]); in StartElement()
119 np->name = strdup(name); in StartElement()
120 sbuf_cat(np->key, name); in StartElement()
121 sbuf_cat(np->key, "::"); in StartElement()
122 np->parent = mt->cur; in StartElement()
123 LIST_INSERT_HEAD(&mt->cur->children, np, siblings); in StartElement()
124 mt->cur = np; in StartElement()
131 struct node *np; in EndElement() local
139 LIST_FOREACH(np, &mt->cur->children, siblings) { in EndElement()
140 if (strcmp(np->name, "name")) in EndElement()
142 sbuf_cat(mt->cur->key, sbuf_data(np->cont)); in EndElement()
208 print_node(struct node *np) in print_node() argument
210 printf("\"%s\" -- \"%s\" -- \"%s\"", np->name, sbuf_data(np->cont), sbuf_data(np->key)); in print_node()
211 if (np->id) in print_node()
212 printf(" id=\"%s\"", np->id); in print_node()
213 if (np->ref) in print_node()
214 printf(" ref=\"%s\"", np->ref); in print_node()
219 print_tree(struct node *np, int n) in print_tree() argument
223 indent(n); printf("%s id=%s ref=%s\n", np->name, np->id, np->ref); in print_tree()
224 LIST_FOREACH(np1, &np->children, siblings) in print_tree()
229 sort_node(struct node *np) in sort_node() argument
234 LIST_FOREACH(np1, &np->children, siblings) in sort_node()
237 np1 = LIST_FIRST(&np->children); in sort_node()