… | |
… | |
67 | |
67 | |
68 | /* Write a complete buffer to file. Returns 0 on success, and an |
68 | /* Write a complete buffer to file. Returns 0 on success, and an |
69 | error code on failure. */ |
69 | error code on failure. */ |
70 | extern int psiconv_buffer_fwrite_all(const psiconv_buffer buf, FILE *f); |
70 | extern int psiconv_buffer_fwrite_all(const psiconv_buffer buf, FILE *f); |
71 | |
71 | |
72 | /* Concatenate two buffers. References are updated too. Buffer extra is |
72 | /* Concatenate two buffers: the second buffer is appended to the first. |
73 | untouched after this and must still be freed if you want to get rid |
73 | References are updated too. Buffer extra is untouched after this and must |
74 | of it. */ |
74 | still be freed if you want to get rid of it. */ |
75 | extern int psiconv_buffer_concat(psiconv_buffer buf, |
75 | extern int psiconv_buffer_concat(psiconv_buffer buf, |
76 | const psiconv_buffer extra); |
76 | const psiconv_buffer extra); |
77 | |
77 | |
78 | /* Add a target to the reference list. This does not really change the |
78 | /* Add a target to the reference list. This does not really change the |
79 | buffer data in any way. The id needs to be unique. The target is |
79 | buffer data in any way. The id needs to be unique. The target is |
… | |
… | |
81 | extern int psiconv_buffer_add_target(psiconv_buffer buf, int id); |
81 | extern int psiconv_buffer_add_target(psiconv_buffer buf, int id); |
82 | |
82 | |
83 | /* Add a reference to a target to the reference list. The id does not |
83 | /* Add a reference to a target to the reference list. The id does not |
84 | need to be defined already, though it must be by the time you call |
84 | need to be defined already, though it must be by the time you call |
85 | psiconv_buffer_resolve. The reference is added to the current end |
85 | psiconv_buffer_resolve. The reference is added to the current end |
86 | of the buffer, and space is allocated for it. */ |
86 | of the buffer, and space is allocated for it. References are always |
|
|
87 | longs (psiconv_u32). */ |
87 | extern int psiconv_buffer_add_reference(psiconv_buffer buf,int id); |
88 | extern int psiconv_buffer_add_reference(psiconv_buffer buf,int id); |
88 | |
89 | |
89 | /* Resolve all references and empty the reference list. */ |
90 | /* Resolve all references and empty the reference list. */ |
90 | extern int psiconv_buffer_resolve(psiconv_buffer buf); |
91 | extern int psiconv_buffer_resolve(psiconv_buffer buf); |
91 | |
92 | |
92 | /* Get a unique reference id */ |
93 | /* Get a unique reference id */ |
93 | extern psiconv_u32 psiconv_buffer_unique_id(void); |
94 | extern psiconv_u32 psiconv_buffer_unique_id(void); |
94 | |
95 | |
|
|
96 | /* Extract part of a buffer and put it into a new buffer. Note that |
|
|
97 | references and targets are not copied; you will have to resolve them |
|
|
98 | beforehand (but as this function is meant for reading buffers, they |
|
|
99 | will usually not be used). */ |
|
|
100 | extern int psiconv_buffer_subbuffer(psiconv_buffer *buf, |
|
|
101 | const psiconv_buffer org, |
|
|
102 | psiconv_u32 offset, psiconv_u32 length); |
|
|
103 | |
|
|
104 | |
|
|
105 | |
95 | |
106 | |
96 | #ifdef __cplusplus |
107 | #ifdef __cplusplus |
97 | } |
108 | } |
98 | #endif /* __cplusplus */ |
109 | #endif /* __cplusplus */ |
99 | |
110 | |