-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <title>Libgedcom interface details</title>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Libgedcom interface details</title>
+
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-</head>
- <body text="#000000" bgcolor="#ffffff" link="#000099" vlink="#990099" alink="#000099">
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
+
+<body text="#000000" bgcolor="#ffffff" link="#000099" vlink="#990099" alink="#000099">
<h1 align="center">Libgedcom interface details</h1>
<br>
<br>
The string value is the most general used value currently, for all
those values that don't have a more specific meaning. In essence,
-the value that is returned by GEDCOM_STRING is always the same as the
-raw_value passed to the start callback, and is thus in fact redundant.<br>
+the value that is returned by <code>GEDCOM_STRING(val)</code> is always the same as the
+<code>raw_value</code> passed to the start callback, and is thus in fact redundant.<br>
<br>
The date value is used for all elements that return a date. See
<a href="#struct_date_value">here</a> for the definition.<br>
Date_value_type type;<br>
struct date date1;<br>
struct date date2;<br>
- char phrase[MAX_PHRASE_LEN
+ char phrase[MAX_PHRASE_LEN
+ 1];<br>
};</code><br>
</blockquote>
<blockquote>
- <blockquote>These are represented by 2 serial day numbers (<code>
- sdn1</code> and <code>sdn2</code>) and a <code>Date_type</code> equal
+ <blockquote>These are represented by 2 serial day numbers (<code>sdn1</code> and <code>sdn2</code>) and a <code>Date_type</code> equal
to <code>DATE_BOUNDED</code>.<br>
<br>
For example, the Gregorian date "MAR 1990" is represented by the serial
is used or defined again in the file. This relieves the application
from the burden of maintaining the mapping between cross-references and objects.<br>
<br>
- The parser checks whether all cross-references that are used are defined
-(if not, an error is produced) and whether all cross-references that are defined
-are used (if not, a warning is produced). It also checks whether the
-type of the cross-reference is the same on definition and use (if not, an
-error is produced).<br>
+ The parser checks whether all cross-references that are used are defined
+ (if not, an error is produced) and whether all cross-references that are
+defined are used (if not, a warning is produced). It also checks whether
+the type of the cross-reference is the same on definition and use (if not,
+an error is produced). The first two checks are done at the end of
+the parsing, because cross-references can be defined after their usage in
+GEDCOM.<br>
<br>
<hr width="100%" size="2">
<pre>$Id$<br>$Name$<br></pre>
<br>
- </body>
- </html>
+ </body></html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Using the GEDCOM parser library</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
-
-<body text="#000000" bgcolor="#ffffff" link="#000099" vlink="#990099" alink="#000099">
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head><body text="#000000" bgcolor="#ffffff" link="#000099" vlink="#990099" alink="#000099">
<h1 align="center">Using the GEDCOM parser library</h1>
<br>
result = <b>gedcom_parse_file</b>("myfamily.ged");</code><br>
</blockquote>
In the above piece of code, <code>my_message_handler</code> is the callback
- that will be called for errors (<code>type=ERROR</code>), warnings (<code>
- type=WARNING</code>) and messages (<code>type=MESSAGE</code>). The
+ that will be called for errors (<code>type=ERROR</code>), warnings (<code>type=WARNING</code>) and messages (<code>type=MESSAGE</code>). The
callback must have the signature as in the example. For errors, the
<code> msg</code> passed to the callback will have the format:<br>
<br>
void <b>my_header_end_cb</b> (Gedcom_ctxt self)<br>
{<br>
- printf("The header ends, context is %d\n", self); /* context
+ printf("The header ends, context is %d\n", (int)self); /* context
will print as "1" */<br>
}<br>
<br>
gedcom.h</code> (so no need to include <code>gedcom-tags.h</code> yourself).<br>
<br>
The example passes a simple integer as context, but an application could
- e.g. pass a <code>struct</code> that will contain the information for the
+ e.g. pass a <code>struct</code> (or an object in a C++ application) that will contain the information for the
header. In the end callback, the application could then e.g. do some
finalizing operations on the <code>struct</code> to put it in its database.<br>
<br>
</blockquote>
The subscription mechanism for elements is similar, only the signatures
of the callbacks differ. The signature for the start callback shows
- that the context of the parent line (e.g. the <code>struct</code> that
+ that the context of the parent line (here e.g. the <code>struct</code> that
describes the header) is passed to this start callback. The callback
-itself returns here the same context, but this can be its own context object
+itself returns here in this example the same context, but this can be its own context object
of course. The end callback is called with both the context of the
-parent and the context of itself, which will be the same in the example.
+parent and the context of itself, which in this example will be the same.
Again, the list of identifiers to use as a first argument for the
subscription function are detailed in the <a href="interface.html#Element_identifiers">
interface details</a> .<br>
raw value is just the raw string that occurs as value on the line next to
the tag (in UTF-8 encoding). The parsed value is the meaningful value
that is parsed from that raw string. The parsed tag is described in
- the section for record callbacks.<br>
+ the section for record callbacks above.<br>
<br>
The <code>Gedcom_val</code> type is meant to be an opaque type. The
only thing that needs to be known about it is that it can contain specific
<ul>
<li>The <code>Gedcom_val</code> argument of the end callback
is currently not used. It is there for future enhancements.</li>
- <li>There is also a <code>Gedcom_val</code> argument in
-the start callback for records. This argument is currently a string
-value giving the pointer in string form.</li>
+ <li>There are also two <code>Gedcom_val</code> arguments in
+the start callback for records. The first one (<code>xref</code>) contains the <code>xref_value</code> corresponding to the cross-reference (or <code>NULL</code> if there isn't one), the second one (<code>parsed_value</code>) contains the value that is parsed from the <code>raw_value</code>. See the <a href="interface.html#Record_identifiers">interface details</a>.</li>
</ul>
in various contexts. For simplicity, the example above doesn't take
this into account (the <code>parent</code> could be of different
types, depending on the context).<br>
+ <br>
+Note also that the default callback is not called when the parent context is <code>NULL</code><code></code>. This is e.g. the case if none of the "upper" tags has been subscribed upon.<br>
<hr width="100%" size="2">