From: Peter Verthez Date: Sun, 9 Dec 2001 09:30:42 +0000 (+0000) Subject: Checked in external.h as gedcom.h (forgot to check in before...) X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=378e28008bafd5b6a1a73bb3c37761fc08520b10;p=gedcom-parse.git Checked in external.h as gedcom.h (forgot to check in before...) --- diff --git a/gedcom.h b/gedcom.h new file mode 100644 index 0000000..afaec3b --- /dev/null +++ b/gedcom.h @@ -0,0 +1,100 @@ +#ifndef __EXTERNAL_H +#define __EXTERNAL_H + +#include + +typedef enum _REC { + REC_HEAD, + REC_FAM, + REC_INDI, + REC_OBJE, + REC_NOTE, + REC_REPO, + REC_SOUR, + REC_SUBN, + REC_SUBM, + REC_USER, + LAST_REC +} Gedcom_rec; + +typedef enum _ELT { + ELT_HEAD_SOUR, + ELT_HEAD_SOUR_VERS, + ELT_HEAD_SOUR_NAME, + ELT_HEAD_SOUR_CORP, + ELT_HEAD_SOUR_DATA, + ELT_HEAD_SOUR_DATA_DATE, + ELT_HEAD_SOUR_DATA_COPR, + ELT_HEAD_DEST, + ELT_HEAD_DATE, + ELT_HEAD_DATE_TIME, + ELT_HEAD_SUBM, + ELT_HEAD_SUBN, + ELT_HEAD_FILE, + ELT_HEAD_COPR, + ELT_HEAD_GEDC, + ELT_HEAD_GEDC_VERS, + ELT_HEAD_GEDC_FORM, + ELT_HEAD_CHAR, + ELT_HEAD_CHAR_VERS, + ELT_HEAD_LANG, + ELT_HEAD_PLAC, + ELT_HEAD_PLAC_FORM, + ELT_HEAD_NOTE, + ELT_USER, + LAST_ELT +} Gedcom_elt; + +typedef enum _MECH { + IMMED_FAIL, + DEFER_FAIL, + IGNORE_ERRORS +} Gedcom_err_mech; + +typedef enum _MSG { + ERROR, + WARNING, + MESSAGE +} Gedcom_msg_type; + +typedef void* Gedcom_ctxt; +typedef void* Gedcom_val; + +typedef void + (*Gedcom_msg_handler) + (Gedcom_msg_type type, char *msg); + +typedef Gedcom_ctxt + (*Gedcom_rec_start_cb) + (int level, char *xref, char *tag); +typedef void + (*Gedcom_rec_end_cb) + (Gedcom_ctxt self); + +typedef Gedcom_ctxt + (*Gedcom_elt_start_cb) + (Gedcom_ctxt parent, + int level, char *tag, char *raw_value, Gedcom_val parsed_value); +typedef void + (*Gedcom_elt_end_cb) + (Gedcom_ctxt parent, Gedcom_ctxt self, Gedcom_val parsed_value); + +typedef void + (*Gedcom_def_cb) + (Gedcom_ctxt parent, int level, char *tag, char *raw_value); + +int gedcom_parse_file(char* file_name); +void gedcom_set_debug_level(int level, FILE* trace_output); +void gedcom_set_error_handling(Gedcom_err_mech mechanism); +void gedcom_set_compat_handling(int enable_compat); +void gedcom_set_message_handler(Gedcom_msg_handler func); +void gedcom_set_default_callback(Gedcom_def_cb func); + +void gedcom_subscribe_to_record(Gedcom_rec rec, + Gedcom_rec_start_cb cb_start, + Gedcom_rec_end_cb cb_end); +void gedcom_subscribe_to_element(Gedcom_elt elt, + Gedcom_elt_start_cb cb_start, + Gedcom_elt_end_cb cb_end); + +#endif /* __EXTERNAL_H */ diff --git a/gedcom_lex_common.c b/gedcom_lex_common.c index 5ea80d1..5d734c4 100644 --- a/gedcom_lex_common.c +++ b/gedcom_lex_common.c @@ -12,11 +12,11 @@ #ifndef IN_LEX -#include "external.h" #include "gedcom_internal.h" -#include "gedcom.tab.h" #include "multilex.h" #include "encoding.h" +#include "gedcom.h" +#include "gedcom.tab.h" #define YY_NO_UNPUT diff --git a/interface.h b/interface.h index f6f4102..db1a048 100644 --- a/interface.h +++ b/interface.h @@ -13,7 +13,7 @@ #ifndef __INTERFACE_H #define __INTERFACE_H -#include "external.h" +#include "gedcom.h" Gedcom_ctxt start_record(Gedcom_rec rec, int level, char *xref, char *tag); void end_record(Gedcom_rec rec, Gedcom_ctxt self); diff --git a/message.c b/message.c index 49c9c7d..6d44530 100644 --- a/message.c +++ b/message.c @@ -11,7 +11,7 @@ /* $Name$ */ #include "gedcom_internal.h" -#include "external.h" +#include "gedcom.h" #define INITIAL_BUF_SIZE 256 char *mess_buffer = NULL; diff --git a/standalone.c b/standalone.c index 0f9ba79..e29e67e 100644 --- a/standalone.c +++ b/standalone.c @@ -13,7 +13,7 @@ #include #include #include -#include "external.h" +#include "gedcom.h" void show_help () {