| 1 | /* ifiction.h declarations for the babel ifiction API |
| 2 | * (c) 2006 By L. Ross Raszewski |
| 3 | * |
| 4 | * This code is freely usable for all purposes. |
| 5 | * |
| 6 | * This work is licensed under the Creative Commons Attribution 4.0 License. |
| 7 | * To view a copy of this license, visit |
| 8 | * https://creativecommons.org/licenses/by/4.0/ or send a letter to |
| 9 | * Creative Commons, |
| 10 | * PO Box 1866, |
| 11 | * Mountain View, CA 94042, USA. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef IFICTION_H |
| 16 | #define IFICTION_H |
| 17 | |
| 18 | #include "treaty.h" |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | /* Babel's notion of an XML tag */ |
| 24 | struct XMLTag |
| 25 | { |
| 26 | int32 beginl; /* Beginning line number */ |
| 27 | char tag[256]; /* name of the tag */ |
| 28 | char fulltag[256]; /* Full text of the opening tag */ |
| 29 | char *begin; /* Points to the beginning of the tag's content */ |
| 30 | char *end; /* Points to the end of the tag's content. |
| 31 | setting *end=0 will turn begin into a string |
| 32 | containing the tag's content (But if you do this, you |
| 33 | should restore the original value of *end before |
| 34 | allowing control to return to the ifiction parser) */ |
| 35 | char occurences[256]; /* Tables used internally to find missing required tags */ |
| 36 | char rocurrences[256]; |
| 37 | struct XMLTag *next; /* The tag's parent */ |
| 38 | |
| 39 | }; |
| 40 | |
| 41 | typedef void (*IFCloseTag)(struct XMLTag *, void *); |
| 42 | typedef void (*IFErrorHandler)(char *, void *); |
| 43 | |
| 44 | |
| 45 | void ifiction_parse(char *md, IFCloseTag close_tag, void *close_ctx, IFErrorHandler error_handler, void *error_ctx); |
| 46 | int32 ifiction_get_IFID(char *metadata, char *output, int32 output_extent); |
| 47 | char *ifiction_get_tag(char *md, char *p, char *t, char *from); |
| 48 | int32 find_uuid_ifid_marker(void *sf, int32 extent, char *output, int32 output_extent); |
| 49 | |
| 50 | #ifdef __cplusplus |
| 51 | } |
| 52 | #endif |
| 53 | |
| 54 | #endif |