6 * Copyright (C) 2003 why the lucky stiff
13 syck_hdlr_add_node( SyckParser
*p
, SyckNode
*n
)
19 n
->id
= (p
->handler
)( p
, n
);
23 if ( n
->anchor
== NULL
)
31 syck_hdlr_add_anchor( SyckParser
*p
, char *a
, SyckNode
*n
)
33 SyckNode
*ntmp
= NULL
;
36 if ( p
->bad_anchors
!= NULL
)
39 if ( st_lookup( p
->bad_anchors
, (st_data_t
)a
, (void *)&bad
) )
41 if ( n
->kind
!= syck_str_kind
)
48 if ( p
->anchors
== NULL
)
50 p
->anchors
= st_init_strtable();
52 if ( st_lookup( p
->anchors
, (st_data_t
)a
, (void *)&ntmp
) )
54 if ( ntmp
!= (void *)1 )
56 syck_free_node( ntmp
);
59 st_insert( p
->anchors
, (st_data_t
)a
, (st_data_t
)n
);
64 syck_hdlr_remove_anchor( SyckParser
*p
, char *a
)
68 if ( p
->anchors
== NULL
)
70 p
->anchors
= st_init_strtable();
72 if ( st_delete( p
->anchors
, (void *)&atmp
, (void *)&ntmp
) )
74 if ( ntmp
!= (void *)1 )
76 syck_free_node( ntmp
);
79 st_insert( p
->anchors
, (st_data_t
)a
, (st_data_t
)1 );
83 syck_hdlr_get_anchor( SyckParser
*p
, char *a
)
87 if ( p
->anchors
!= NULL
)
89 if ( st_lookup( p
->anchors
, (st_data_t
)a
, (void *)&n
) )
98 if ( p
->bad_anchors
== NULL
)
100 p
->bad_anchors
= st_init_strtable();
102 if ( ! st_lookup( p
->bad_anchors
, (st_data_t
)a
, (void *)&n
) )
104 n
= (p
->bad_anchor_handler
)( p
, a
);
105 st_insert( p
->bad_anchors
, (st_data_t
)a
, (st_data_t
)n
);
113 n
= (p
->bad_anchor_handler
)( p
, a
);
129 syck_add_transfer( char *uri
, SyckNode
*n
, int taguri
)
131 if ( n
->type_id
!= NULL
)
133 S_FREE( n
->type_id
);
142 n
->type_id
= syck_type_id_to_uri( uri
);
147 syck_xprivate( const char *type_id
, int type_len
)
149 char *uri
= S_ALLOC_N( char, type_len
+ 14 );
151 strcat( uri
, "x-private:" );
152 strncat( uri
, type_id
, type_len
);
157 syck_taguri( const char *domain
, const char *type_id
, int type_len
)
159 char *uri
= S_ALLOC_N( char, strlen( domain
) + type_len
+ 14 );
161 strcat( uri
, "tag:" );
162 strcat( uri
, domain
);
164 strncat( uri
, type_id
, type_len
);
169 syck_try_implicit( SyckNode
*n
)