Some additional configuration.
[gedcom-parse.git] / doc / doxygen / index.doc
1 /* Documentation file
2    Copyright (C) 2001,2002,2003 The Genes Development Team
3    This file is part of the Gedcom parser library.
4    Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2003.
5
6    The Gedcom parser library is free software; you can redistribute it
7    and/or modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The Gedcom parser library is distributed in the hope that it will be
12    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the Gedcom parser library; if not, write to the
18    Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA.  */
20
21 /* $Id$ */
22 /* $Name$ */
23
24 /*! \mainpage The Gedcom Parser Library
25
26   The Gedcom Parser Library is a C library that provides an API to applications
27   to parse and process arbitrary genealogy files in the standard GEDCOM format.
28   It supports
29   <a href="http://www.gendex.com/gedcom55/55gctoc.htm">release 5.5</a> of the
30   GEDCOM standard.
31
32   The following links provide a manual to the Gedcom parser library:
33
34    - \ref callback
35    - \ref gom
36
37   \section libraries_headers Libraries and headers
38   
39   The Gedcom Parser Library provides two interfaces.  On the one hand, it can
40   be used as a callback-based parser (comparable to the SAX interface of XML);
41   on the other hand, the parser can be used to convert the GEDCOM file into an
42   object model (comparable to the DOM interface of XML).  It comes with:
43
44    - a library (\c libgedcom.so), to be linked in the application program,
45      which implements the callback parser
46    - a header file (\c gedcom.h), to be used in the sources of the application
47      program
48    - a header file (\c gedcom-tags.h) that is also installed, but that is
49      automatically included via \c gedcom.h
50
51   Additionally, if you want to use the C object model, the following should be
52   used (note that \c libgedcom.so is also needed in this case, because the
53   object model uses the callback parser internally):
54
55    - a library (\c libgedcom_gom.so), to be linked in the application program,
56      which implements the C object model
57    - a header file (\c gom.h), to be used in the source of the application
58      program
59
60   There is a separate script and an M4 macro (for autoconf) to help with
61   library and compilation flags, see the \ref devel "development support".
62
63   \section utf8 Converting character sets
64
65   All strings passed by the GEDCOM parser to the application are in UTF-8
66   encoding.  Typically, an application needs to convert this to something
67   else to be able to display it.
68
69   The most common case is that the output character set is controlled by the
70   locale mechanism (i.e. via the LANG, LC_ALL or LC_CTYPE environment
71   variables), which also controls the gettext mechanism in the application.  
72
73   With gedcom-parse comes a library implementing help functions for UTF-8
74   encoding (see the <a href=utf8tools.html>documentation</a> for this library).
75 */
76
77 /*! \defgroup callback Callback Interface */
78
79 /*! \defgroup maingedcom Main functions of the parser
80     \ingroup callback
81
82   The very simplest call of the Gedcom callback parser is simply the following
83   piece of code (include of the \c gedcom.h header is assumed, as everywhere
84   in this manual):
85
86   \code
87   int result;
88   ...
89   gedcom_init();
90   ...
91   result = gedcom_parse_file("myfamily.ged");
92   \endcode
93
94   Although this will not provide much information, one thing it does is parse
95   the entire file and return the result.
96
97   The next sections will refine this
98   piece of code to be able to have meaningful errors and the actual data that
99   is in the file.
100 */
101
102 /*! \defgroup error Error handling
103     \ingroup callback
104
105   The library can be used in several different circumstances, both
106   terminal-based as GUI-based.  Therefore, it leaves the actual display of the
107   error message up to the application.
108
109   For this, the application needs to register a callback before parsing the
110   GEDCOM file, which will be called by the library on errors, warnings and
111   messages.
112
113   A typical piece of code would be (gom_parse_file() would be called in case
114   the C object model is used):
115
116   \code
117   void my_message_handler(Gedcom_msg_type type, char* msg)
118   {
119     ...
120   }
121   ...
122   gedcom_set_message_handler(my_message_handler);
123   ...
124   result = gedcom_parse_file("myfamily.ged");
125   \endcode
126
127   With this in place, the resulting code will show errors and warnings produced
128   by the parser, e.g. on the terminal if a simple \c printf is used in the
129   message handler.
130 */
131
132 /*! \defgroup cb_mech Data callback mechanism
133     \ingroup callback
134     
135   The most important use of the parser is of course to get the data out of
136   the GEDCOM file.  This section focuses on the callback mechanism (see
137   \ref gom "here" for the C object model).  In fact, the mechanism involves
138   two levels.
139
140   The primary level is that each of the sections in a GEDCOM file is notified
141   to the application code via a "start element" callback and an "end element"
142   callback (much like in a SAX interface for XML), i.e. when a line containing
143   a certain tag is parsed, the "start element" callback is called for that tag
144   , and when all its subordinate lines with their tags have been processed,
145   the "end element" callback is called for the original tag.  Since GEDCOM is
146   hierarchical, this results in properly nested calls to appropriate "start
147   element" and "end element" callbacks (note: see
148   \ref compat "compatibility handling").
149
150   However, it would be typical for a genealogy program to support only a
151   subset of the GEDCOM standard, certainly a program that is still under
152   development.  Moreover, under GEDCOM it is allowed for an application to
153   define its own tags, which will typically not  be supported by another
154   application.  Still, in that case, data preservation is important; it would
155   hardly be accepted that information that is not understood by a certain
156   program is just removed.
157
158   Therefore, the second level of callbacks involves a "default callback".  An
159   application needs to subscribe to callbacks for tags it does support, and
160   need to provide a "default callback" which will be called for tags it
161   doesn't support.  The application can then choose to just store the
162   information that comes via the default callback in plain textual format.  
163 */
164
165 /*! \defgroup start_end Start and end callbacks
166     \ingroup cb_mech
167
168   The following simple example gets some information from the header record
169   of a GEDCOM file.
170
171   \code
172     Gedcom_ctxt my_header_start_cb (Gedcom_rec rec,
173                                     int level,
174                                     Gedcom_val xref,
175                                     char *tag,
176                                     char *raw_value,
177                                     int parsed_tag,
178                                     Gedcom_val parsed_value)
179     {
180       printf("The header starts\n");
181       return (Gedcom_ctxt)1;
182     }
183
184     void my_header_end_cb (Gedcom_rec rec, Gedcom_ctxt self)
185     {
186       printf("The header ends, context is %d\n", (int)self);
187     }
188
189     ...
190     gedcom_subscribe_to_record(REC_HEAD, my_header_start_cb, my_header_end_cb);
191     ...
192     result = gedcom_parse_file("myfamily.ged");
193   \endcode
194
195   Using the gedcom_subscribe_to_record() function, the application requests
196   to use the specified callbacks as start and end callback (type
197   \ref Gedcom_rec_start_cb and \ref Gedcom_rec_end_cb).
198
199   Such a callback
200   can return a context value of type \ref Gedcom_ctxt.  This type is meant to
201   be opaque; in fact, it's a void pointer, so you can pass anything via it.
202   This context value will be passed to the callbacks of the direct
203   child elements, and to the end callback.
204
205   The example passes a simple integer as context, but an application could e.g.
206   pass a \c struct (or an object in a C++ application) that will contain the
207   information for the record.  In the end callback, the application could then
208   e.g. do some finalizing operations on the \c struct to put it in its
209   database.
210
211   From the name of the function it becomes clear that this function is
212   specific to complete records.  For the separate elements in records there
213   is another function, which we'll see shortly.  Note that the callbacks need
214   to have the signatures as shown in the example.
215
216   We will now retrieve the SOUR field (the name of the program that wrote the
217   file) from the header:
218   \code
219     Gedcom_ctxt my_header_source_start_cb(Gedcom_elt  elt,
220                                           Gedcom_ctxt parent,
221                                           int         level,
222                                           char*       tag,
223                                           char*       raw_value,
224                                           int         parsed_tag,
225                                           Gedcom_val  parsed_value)
226     {
227       char *source = GEDCOM_STRING(parsed_value);
228       printf("This file was written by %s\n", source);
229       return parent;
230     }
231
232     ...
233     gedcom_subscribe_to_element(ELT_HEAD_SOUR,
234                                 my_header_source_start_cb,
235                                 NULL);
236     ...
237     result = gedcom_parse_file("myfamily.ged");
238   \endcode
239
240   The subscription mechanism for elements is similar, only the signatures of
241   the callbacks differ.  The signature for the start callback shows that the
242   context of the parent line (here e.g. the \c struct that describes the
243   header) is passed to this start callback.
244
245   The callback itself returns here in this example the same context, but this
246   can be its own context object of course.  The end callback is called with
247   both the context of the parent and the context of itself, which in this
248   example will be the same.
249 */
250
251 /*! \defgroup defcb Default callbacks
252     \ingroup cb_mech
253
254   An application doesn't always implement the entire GEDCOM spec, and
255   application-specific tags may have been added by other applications.  To
256   preserve this extra data anyway, a default callback can be registered by
257   the application, as in the following example:
258
259   \code
260     void my_default_cb (Gedcom_elt elt, Gedcom_ctxt parent, int level,
261                         char* tag, char* raw_value, int parsed_tag)
262     {
263       ...
264     }
265
266     ...
267     gedcom_set_default_callback(my_default_cb);
268     ...
269     result = gedcom_parse_file("myfamily.ged");
270   \endcode
271
272   This callback has a similar signature as the previous ones, but it doesn't
273   contain a parsed value.  However, it does contain the parent context, that
274   was returned by the application for the most specific containing tag that
275   the application supported.
276
277   Suppose e.g. that this callback is called for some tags in the header that
278   are specific to some other application, then our application could make
279   sure that the parent context contains the struct or object that represents
280   the header, and use the default callback here to add the level, tag and
281   raw_value as plain text in a member of that struct or object, thus
282   preserving the information.
283
284   The application can then write this out when the data is saved again in a
285   GEDCOM file.  To make it more specific, consider the following example:
286
287   \code
288     struct header {
289       char* source;
290       ...
291       char* extra_text;
292     };
293
294     Gedcom_ctxt my_header_start_cb(Gedcom_rec rec, int level, Gedcom_val xref,
295                                    char* tag, char *raw_value,
296                                    int parsed_tag, Gedcom_val parsed_value)
297     {
298       struct header head = my_make_header_struct();
299       return (Gedcom_ctxt)head;
300     }
301
302     void my_default_cb(Gedcom_elt elt, Gedcom_ctxt parent, int level,
303                        char* tag, char* raw_value, int parsed_tag)
304     {
305       struct header head = (struct header)parent;
306       my_header_add_to_extra_text(head, level, tag, raw_value);
307     }
308
309     gedcom_set_default_callback(my_default_cb);
310     gedcom_subscribe_to_record(REC_HEAD, my_header_start, NULL);
311     ...
312     result = gedcom_parse_file(filename);
313   \endcode
314
315   Note that the default callback will be called for any tag that isn't
316   specifically subscribed upon by the application, and can thus be called in
317   various contexts.  For simplicity, the example above doesn't take this into
318   account (the parent could be of different types, depending on the context).
319
320   Note also that the default callback is not called when the parent context is
321   \c NULL.  This is e.g. the case if none of the "upper" tags has been
322   subscribed upon.
323 */
324
325 /*! \defgroup parsed Parsed values
326     \ingroup callback
327
328   The \c Gedcom_val type is meant to be an opaque type.  The only thing that
329   needs to be known about it is that it can contains specific data types, which
330   have to be retrieved from it using pre-defined macros.
331
332   Currently, the specific \c Gedcom_val types are (with \c val of type
333   \c Gedcom_val):
334   
335   <table border="1" width="100%">
336     <tr>
337       <td>&nbsp;</td>
338       <td><b>type checker</b></td>
339       <td><b>cast function</b></td>
340     </tr>
341     <tr>
342       <td>null value</td>
343       <td><code>GEDCOM_IS_NULL(val)</code></td>
344       <td>N/A</td>
345     </tr>
346     <tr>
347       <td>string</td>
348       <td><code>GEDCOM_IS_STRING(val)</code></td>
349       <td><code>char* str = GEDCOM_STRING(val);</code></td>
350     </tr>
351     <tr>
352       <td>date</td>
353       <td><code>GEDCOM_IS_DATE(val)</code></td>
354       <td><code>struct date_value dv = GEDCOM_DATE(val);</code></td>
355     </tr>
356     <tr>
357       <td>age</td>
358       <td><code>GEDCOM_IS_AGE(val)</code></td>
359       <td><code>struct age_value age = GEDCOM_AGE(val);</code></td>
360     </tr>
361     <tr>
362       <td>xref pointer</td>
363       <td><code>GEDCOM_IS_XREF_PTR(val)</code></td>
364       <td><code>struct xref_value *xr = GEDCOM_XREF_PTR(val);</code></td>
365     </tr>
366   </table>
367
368   The type checker returns a true or a false value according to the type of
369   the value, but this is in principle only necessary in the rare circumstances
370   that two types are possible, or where an optional value can be provided.
371   In most cases, the type is fixed for a specific tag.
372
373   The exact type per tag can be found in the
374   <a href="interface.html">interface details</a>.
375
376   The null value is used for when the GEDCOM spec doesn't allow a value, or
377   when an optional value is allowed but none is given.
378  
379   The string value is the most general used value currently, for all those
380   values that don't have a more specific meaning.  In essence, the value that
381   is returned by \c GEDCOM_STRING(val) is always the same as the \c raw_value
382   passed to the start callback, and is thus in fact redundant.
383
384   For the other data types, there is a specific section giving details.
385 */
386
387 /*! \defgroup parsed_date Date values
388     \ingroup parsed
389
390   The Gedcom_val contains a struct date_value if it denotes a date.  The
391   struct date is a part of the struct date_value.
392 */
393
394 /*! \defgroup parsed_age Age values
395     \ingroup parsed
396
397   The Gedcom_val contains a struct age_value if it denotes an age.
398 */
399
400 /*! \defgroup parsed_xref Cross-reference values
401     \ingroup parsed
402
403   The Gedcom_val contains a pointer to a struct xref_value if it denotes a
404   cross-reference (note: not the struct itself, but a pointer to it !)
405   
406   The parser checks whether all cross-references that are used are defined
407   (if not, an error is produced) and whether all cross-references that are
408   defined are used (if not, a warning is produced).  It also checks whether
409   the type of the cross-reference is the same on definition and use (if
410   not, an error is produced).
411
412   The first two checks are done at the end of
413   the parsing, because cross-references can be defined after their usage
414   in GEDCOM.
415
416   A cross-reference key must be a string of maximum 22 characters, of the
417   following format:
418
419    - an at sign ('@')
420    - followed by an alphanumeric character (A-Z, a-z, 0-9 or underscore)
421    - followed by zero or more characters, which can be any character
422      except an at sign
423    - terminated by an at sign ('@')
424
425   An example would thus be: <code>"@This is an xref_val@"</code>.
426 */
427
428 /*! \defgroup compat Compatibility mode
429     \ingroup callback
430
431   Applications are not necessarily true to the GEDCOM spec (or use a different
432   version than 5.5).  The intention is that the library is resilient to this,
433   and goes in compatibility mode for files written by specific programs
434   (detected via the \c HEAD.SOUR tag).
435
436   Currently, there is (some) compatibility for:
437     - ftree
438     - Lifelines (3.0.2)
439     - Personal Ancestral File (PAF), version 2, 4 and 5
440     - Family Origins
441     - EasyTree
442 */
443
444 /*! \defgroup write Support for writing GEDCOM files
445     \ingroup callback
446
447   The Gedcom parser library also contains functions to writing GEDCOM files.
448   Similar as for the parsing itself, there are two interfaces: an interface
449   which is very basic, and requires you to call a function for each line in
450   the GEDCOM file, and an interface which just dumps the Gedcom object model
451   to a file in one shot (if you use the Gedcom object model).
452
453   Again, this section focuses on the basic interface, the Gedcom object model
454   interface is described \ref gom "here".
455
456   Writing a GEDCOM file involves the following steps:
457
458    - first set the encoding options as you want them using
459      gedcom_write_set_encoding() and gedcom_write_set_line_terminator()\n\n
460      By default a file is written in the same encoding as the last read file
461      was in, and the terminator is set to the appropriate one on the current
462      platform.
463      
464    - open the file using gedcom_write_open()
465    
466    - write the date using gedcom_write_record_str(), ...\n\n
467      The principle is that every line in the GEDCOM file to write corresponds
468      to a call of one of these functions, except that \c CONT/CONC lines can
469      be automatically taken care of.\n\n
470      Note that the result GEDCOM file should conform to the GEDCOM standard.
471      Several checks are built in already, and more will follow, to force this.
472      There is no compatibility mode for writing GEDCOM file (and probably never
473      will be).\n\n
474      All these functions expect their input in UTF-8 encoding.  If this is
475      not the case, errors will be returned.  Note that for examples of using
476      these functions, you can look at the sources of the Gedcom object model
477      (e.g. the function \c write_header in \c gom/header.c).
478
479    - close the file using gedcom_write_close()
480 */
481
482 /*! \defgroup debug Debugging
483     \ingroup callback
484
485   The library can generate various debugging output, not only from itself, but
486   also the debugging output generated by the yacc parser.  By default, no
487   debugging output is generated, but this can be changed.
488 */
489
490 /*! \defgroup devel Development support
491   \section configure Macro for configure.in
492
493   There is a macro available for use in configure.in for applications that
494   are using autoconf to configure their sources.  The following macro checks
495   whether the Gedcom parser library is available and whether its version is
496   high enough:
497   \code
498     AM_PATH_GEDCOM_PARSER([min_version,[action_if_found,[action_if_not_found,[modules]]]])
499   \endcode
500
501   All the arguments are optional and default to 0.  E.g. to check for version
502   1.34.2, you would put in configure.in the following statement:
503   \code
504     AM_PATH_GEDCOM_PARSER(1.34.2)
505   \endcode
506
507   Note that version numbers now contains three parts (since version 0.20.0:
508   this is also the first version in which this macro is available).
509
510   The macro also sets the variables GEDCOM_CFLAGS and GEDCOM_LIBS for use in
511   Makefiles.  Typically, this would be done as follows in a Makefile.am:
512   \code
513     bin_programs   = myprg
514     myprg_SOURCES  = myprg.c foo.c bar.c
515     INCLUDES       = @GEDCOM_CFLAGS@
516     LDADD          = @GEDCOM_LIBS@
517   \endcode
518
519   If your program uses some extra modules, they can be passed as fourth
520   argument in the macro, so that the CFLAGS and LIBS are correctly filled in.
521   Currently, the only available module is gom (the Gedcom object model).  For
522   example:
523   \code
524     AM_PATH_GEDCOM_PARSER(0.21.2, , ,gom)
525   \endcode
526
527   To be able to use this macro in the sources of your application, you have
528   three options:
529
530    - Put the file \c m4/gedcom.m4 in your autoconf data directory (i.e. the
531      path given by <code>'aclocal --print-ac-dir'</code>, usually
532      <code>/usr/share/aclocal)</code>.  You can
533      do this automatically by going into the m4 subdirectory and typing
534      <code>'make install-m4'</code>.
535
536    - If you're using autoconf, but not automake, copy the contents of
537      \c m4/gedcom.m4 in the \c aclocal.m4 file in your sources.
538
539    - If you're using automake, copy the contents of \c m4/gedcom.m4 in the
540      \c acinclude.m4 file in your sources.
541
542   \section flags Compilation and linking flags
543
544   Similar to other libraries, the GEDCOM parse library installs a script
545   \c gedcom-config to help with compilation and linking flags for programs
546   that don't use autoconf/automake.
547
548   To get compilation flags for your program, use (depending on whether you
549   only use the callback parser, or also the GEDCOM object model):
550   \code
551     gedcom-config --cflags
552     gedcom-config --cflags gom
553   \endcode
554
555   Similarly, to get linking flags, use one of the following:
556   \code
557     gedcom-config --libs
558     gedcom-config --libs gom
559   \endcode
560  */
561
562 /*! \defgroup gom Gedcom Object Model in C */
563
564 /*! \defgroup gommain Main functions of the object model
565     \ingroup gom
566
567   Programs using the Gedcom object model in C should use the following
568   (inclusion of
569   both the \c gedcom.h and \c gom.h headers is required; contrast this with
570   the example given for the \ref maingedcom "callback parser"):
571
572   \code
573   int result;
574   ...
575   gedcom_init();
576   ...
577   result = gom_parse_file("myfamily.ged");
578   \endcode
579
580   In the Gedcom object model, all the data is immediately available after
581   calling gom_parse_file().  For this, an entire model based on C structs
582   is used.  These structs are documented
583   <a href=gomxref.html>here</a>, and follow the GEDCOM syntax quite closely.
584   Each of the records in a GEDCOM file is modelled by a separate struct, and
585   some common sub-structures have their own struct definition.
586
587   The next sections describe the functions to be used to get at these structs.
588 */
589
590 /*! \defgroup gomget Retrieving information in the object model
591   \ingroup gom
592
593   \section gomget_basic Basic retrieval
594
595   The functions documented in this section allow to retrieve the objects
596   from the object model:
597
598    - First, there are two functions to get the header record and the submission
599      record (there can be only one of them in a GEDCOM file):
600      \code
601        struct header*      gom_get_header();
602        struct submission*  gom_get_submission();
603      \endcode
604
605    - Further, for each of the other records, there are two functions, one to
606      get the first of such records, and one to get a record via its
607      cross-reference tag in the GEDCOM file:
608      \code
609        struct XXX*   gom_get_first_XXX();
610        struct XXX*   gom_get_XXX_by_xref(const char* xref);
611      \endcode
612
613      The XXX stands for one of the following: family, individual, multimedia,
614      note, repository, source, submitter, user_rec.
615
616      Note that the structs are documented <a href=gomxref.html>here</a>.
617
618   \section gomget_obj_list Object lists
619
620   All records of a certain type are linked together in a linked list.  The
621   above functions only give access to the first record of each linked list.
622   The others can be accessed by traversing the linked list via the \c next
623   member of the structs.  This means that e.g. the following piece of code will
624   traverse the linked list of family records:
625   \code
626     struct family* fam;
627
628     for (fam = gom_get_first_family() ; fam ; fam = fam->next) {
629       ...
630     }
631   \endcode
632
633   The \c next member of the last element in the list is guaranteed to have the
634   \c NULL value.
635
636   Actually, the linked list is a doubly-linked list: each record also has a
637   \c previous member.  But for implementation reasons the behaviour of this
638   \c previous member on the edges of the linked list will not be guaranteed,
639   i.e. it can be circular or terminated with \c NULL, no assumptions can be
640   made in the application code.
641
642   This linked-list model applies also to all sub-structures of the main record
643   structs, i.e. each struct that has a \c next and \c previous member follows
644   the above conventions.  This means that the following piece of code
645   traverses all children of a family (see the details of the different
646   structs <a href=gomxref.html>here</a>):
647   \code
648     struct family* fam = ...;
649
650     struct xref_list* xrl;
651     for (xrl = fam->children ; xrl ; xrl = xrl->next) {
652       ...
653     } 
654   \endcode
655
656   Note that all character strings in the object model are encoded in UTF-8
657   (<a href=encoding.html>Why UTF-8?</a>), but see \ref gom_mod_string "further"
658   for how to
659   convert these automatically.
660
661   All structs and sub-structures are documented <a href=gomxref.html>here</a>.
662
663   \section gomget_user User data
664
665   Each of the structs has an extra member called \c extra (of type struct
666   user_data*).  This gathers all non-standard GEDCOM tags within the scope of
667   the struct in a flat linked list, no matter what the internal structure of
668   the non-standard tags is.  Each element of the linked list has:
669     - a level: the level number in the GEDCOM file
670     - a tag: the tag given in the GEDCOM file
671     - a value: the value, which can be a string value or a cross-reference
672       value (one of the two will be non-NULL)
673
674   This way, none of the information in the GEDCOM file is lost, even the
675   non-standard information.
676 */
677
678 /*! \defgroup gom_modify Modifying the object model
679    \ingroup gom
680 */
681
682 /*! \defgroup gom_mod_string Manipulating strings
683    \ingroup gom_modify
684
685   There are some functions available to retrieve and change strings in the
686   Gedcom object model, depending on whether you use UTF-8 strings in your
687   application or locale-defined strings.
688
689   The functions gom_get_string() and gom_set_string() retrieve and set the
690   string in UTF-8 encoding.  The first one is in fact superfluous, because it
691   just returns the data pointer, but it is there for symmetry with the
692   functions given below for the locale-defined input and output.
693
694   Examples of use of these functions would be, e.g. for retrieving and setting
695   the system ID in the header:
696   \code
697     struct header* head = gom_get_header();
698     char* oldvalue = gom_get_string(head->source.id);
699     char* newvalue = "My_Gedcom_Tool";
700
701     if (gom_set_string(&head->source.id, newvalue)) {
702       printf("Modified system id from %s to %s\n", oldvalue, newvalue);
703     }
704   \endcode
705
706   Next to these functions, the functions gom_get_string_for_locale() and
707   gom_set_string_for_locale() retrieve and set the string in the format defined
708   by the current locale.
709
710   The use of these functions is the same as the previous ones, but e.g. in
711   the "en_US" locale the string will be returned by the first function in
712   the ISO-8859-1 encoding.  Conversion to and from UTF-8 for the object model
713   is done on the fly.
714 */
715
716 /*! \defgroup gom_add_rec Adding and deleting records
717    \ingroup gom_modify
718
719   For each of the record types, there are two functions to add and delete
720   records:
721   \code
722     struct XXX*   gom_new_XXX(const char* xref);
723     int           gom_delete_XXX(struct XXX* obj);
724   \endcode
725
726   The XXX stands for one of the following: family, individual, multimedia,
727   note, repository, source, submitter, user_rec.
728
729   For submission records, the gom_delete_submission() function has no
730   parameters, because there can be only one submission record.
731
732   When creating new records, the application is responsible for making sure
733   that the mandatory fields (according to the GEDCOM spec) are filled in
734   afterwards.  In a later release, there will be checks in gom_write_file()
735   to missing information.
736
737   Note that records cannot be deleted if there are still referenced (see
738   gom_add_xref()): the delete function will return an error then.
739
740   All structs and sub-structures are documented <a href=gomxref.html>here</a>.
741 */
742
743 /*! \defgroup gom_add_xref Adding, deleting and moving cross-references
744    \ingroup gom_modify
745 */
746
747 /*! \defgroup gom_add_sub Adding, deleting and moving substructures
748    \ingroup gom_modify
749
750   For struct members that are just a single value, the following functions
751   are available:
752   \code
753     struct XXX*   gom_set_new_XXX(struct XXX** data);
754     int           gom_delete_XXX(struct XXX** data);
755   \endcode
756
757   This is the case for XXX equal to address, change_date or place.  The first
758   function creates a new substructure and assigns it to \c data.  The fields
759   in the substructure still need to be filled in by the application.  The
760   second function deletes the value from \c data.
761
762   Note that for change_date structs there is the gom_update_timestamp()
763   short-cut function, which updates the time and date directly.
764
765   For struct members that are a list (as described
766   \ref gomget_obj_list "here"), the following functions are available:
767   \code
768     struct XXX*   gom_add_new_XXX(struct XXX** data);
769     int           gom_remove_XXX(struct XXX** data, struct XXX* obj);
770     int           gom_move_XXX(Gom_direction dir, struct XXX** data, struct XXX* obj);
771   \endcode
772
773   This is the case for all XXX sub-structs that have a \c next and \c previous
774   member.
775
776   The first function creates a new substructure and adds it to the end of the
777   \c data list.  The second function deletes the object from the \c data list
778   if present (if not present, an error is generated and 1 is returned).
779
780   The third function moves the given \c obj up or down the \c data list,
781   depending on the \c dir parameter, similar to gom_move_xref().
782
783   All structs and sub-structures are documented <a href=gomxref.html>here</a>.
784 */
785
786 /*! \defgroup gom_write Writing the object model to file
787    \ingroup gom
788
789   Writing the current object model to a file is simply done using
790   gom_write_file().  The customization functions given \ref write "here" can
791   be used before gom_write_file() to control some settings.
792
793   Before you write the file, you can update the timestamp in the header using
794   the function gom_header_update_timestamp().
795
796   Typically, this function would be used as follows, to set the current time
797   in the timestamp:
798   \code
799     int result;
800     result = gom_header_update_timestamp(time(NULL));
801   \endcode
802 */
803
804 /*! \defgroup gom_struct Structure definitions
805    \ingroup gom
806
807   All structs and sub-structures are documented <a href=gomxref.html>here</a>.
808 */