home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / ged2ht23.zip / DATABASE.H < prev    next >
C/C++ Source or Header  |  1995-06-23  |  5KB  |  192 lines

  1. /*
  2.  * Copyright (c) 1995 Eugene W. Stark
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by Eugene W. Stark.
  16.  * 4. The name of the author may not be used to endorse or promote products
  17.  *    derived from this software without specific prior written permission.
  18.  * 5. No copying or redistribution in any form for commercial purposes is
  19.  *    permitted without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  25.  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  26.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27.  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33.  
  34. /*
  35.  * GEDCOM lineage-linked database structure definitions
  36.  */
  37.  
  38. /*
  39.  * Counts of various kinds of top-level records
  40.  */
  41.  
  42. extern int total_individuals;
  43. extern int total_families;
  44. extern int total_events;
  45. extern int total_sources;
  46. extern int total_notes;
  47. extern int total_repositories;
  48. extern int total_submitters;
  49.  
  50. /*
  51.  * Flag controlling capitalization of surnames
  52.  */
  53.  
  54. extern int capitalization;
  55.  
  56. /*
  57.  * Arrays for each access to top-level records
  58.  */
  59.  
  60. struct individual_record **all_individuals;
  61. struct family_record **all_familes;
  62.  
  63. /*
  64.  * Access to the hierarchical index tree
  65.  */
  66.  
  67. extern struct index_node *index_root;
  68. extern struct index_node *surname_head;
  69.  
  70. /*
  71.  * Parameters controlling production of index
  72.  */
  73.  
  74. extern int index_depth;
  75. extern int index_width;
  76.  
  77. /*
  78.  * Database structure definitions
  79.  */
  80.  
  81. struct individual_record {
  82.   int serial;
  83.   char *xref;
  84.   struct name_structure *personal_name;
  85.   char *title;
  86.   char sex;
  87.   char *refn;
  88.   char *rfn;
  89.   char *afn;
  90.   struct xref *fams, *lastfams;
  91.   struct xref *famc, *lastfamc;
  92.   struct xref *sources, *lastsource;
  93.   struct note_structure *notes, *lastnote;
  94.   struct event_structure *events, *lastevent;
  95.   struct individual_record *next;
  96. };
  97.  
  98. struct family_record {
  99.   char *xref;
  100.   char *refn;
  101.   struct xref *husband;
  102.   struct xref *wife;
  103.   struct xref *children, *lastchild;
  104.   struct xref *sources, *lastsource;
  105.   struct note_structure *notes, *lastnote;
  106.   struct event_structure *events, *lastevent;
  107.   struct family_record *next;
  108. };
  109.  
  110. struct source_record {
  111.   char *xref;
  112.   char *text;
  113.   struct continuation *cont;
  114. };
  115.  
  116. struct name_structure {
  117.   char *name;
  118.   int surname_start;
  119.   int surname_end;
  120.   char *surname;
  121. };
  122.  
  123. struct place_structure {
  124.   char *name;
  125.   struct note_structure *notes, *lastnote;
  126. };
  127.  
  128. struct note_structure {
  129.    char *xref;
  130.    char *text;
  131.    struct continuation *cont;
  132.    struct note_structure *next;
  133. };
  134.  
  135. struct event_structure {
  136.   struct tag *tag;
  137.   char *date;
  138.   struct place_structure *place;
  139.   struct event_structure *next;
  140. };
  141.  
  142. struct xref {
  143.   char *id;
  144.   union {
  145.     struct individual_record *individual;
  146.     struct family_record *family;
  147.     struct source_record *source;
  148.   } pointer;
  149.   struct xref *next;
  150. };
  151.  
  152. struct continuation {
  153.   char *text;
  154.   struct continuation *next;
  155. };
  156.  
  157. struct index_node {
  158.     int id;                /* UID for constructing file names */
  159.     int level;                /* Level number for output */
  160.     struct individual_record *first;    /* First individual under this index */
  161.     struct individual_record *last;    /* Last individual under this index */
  162.     struct index_node *parent;        /* Parent index node (if any) */
  163.     struct index_node *children;    /* Sub-indexes (if any) */
  164.     struct index_node *next;        /* Next index at same level */
  165.     struct index_node *prev;        /* Previous index at same level */
  166. };
  167.  
  168. /*
  169.  * Function prototypes
  170.  */
  171.  
  172. void process_records(struct node *np);
  173. void process_individual_record(struct node *np);
  174. void process_family_record(struct node *np);
  175. void process_event_record(struct node *np);
  176. void process_note_record(struct node *np);
  177. void process_submitter_record(struct node *np);
  178. void process_repository_record(struct node *np);
  179. void process_source_record(struct node *np);
  180. struct event_structure *process_event(struct node *np);
  181. struct note_structure *process_note(struct node *np);
  182. struct xref *process_xref(struct node *np);
  183. struct name_structure *process_name(struct node *np);
  184. void link_records(struct node *np);
  185. void link_individual_record(struct node *np);
  186. void link_family_record(struct node *np);
  187. void index_individuals();
  188. void index_surnames();
  189. int compare_name(struct individual_record **ipp1,
  190.          struct individual_record **ipp2);
  191.  
  192.