ff292dfff7de1d1faf6a21ac6967c7af8b280c1b
[gedcom-parse.git] / t / src / dump_gom.c
1 /* Test program for the Gedcom library.
2    Copyright (C) 2001, 2002 The Genes Development Team
3    This file is part of the Gedcom parser library.
4    Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
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 #include <string.h>
25 #include "dump_gom.h"
26 #include "output.h"
27 #include "portability.h"
28 #include "gom.h"
29 #include "gedcom.h"
30
31 char* make_prefix(int depth)
32 {
33   char* prefix = (char*)calloc(depth+1, sizeof(char));
34   memset(prefix, ' ', depth);
35   return prefix;
36 }
37
38 void dump_xref(int st, int prefix_depth, struct xref_value* xr);
39
40 void dump_user_data(int st, int prefix_depth, struct user_data* data)
41 {
42   char* prefix = make_prefix(prefix_depth);
43   if (data) {
44     output(st, "\n");
45     for (data; data; data = data->next) {
46       output(st, "%sData: \n", prefix);
47       output(st, "%s  %d, %s, %s\n", prefix,
48              data->level, str_val(data->tag), str_val(data->str_value));
49       output(st, "%s  reference: ", prefix);
50       dump_xref(st, prefix_depth + 4, data->xref_value);
51     }
52   }
53   else {
54     output(st, "%s\n", ptr_val(data));
55   }
56   free(prefix);
57 }
58
59 void dump_address(int st, int prefix_depth, struct address* addr)
60 {
61   char* prefix = make_prefix(prefix_depth);
62   if (addr) {
63     output(st, "\n");
64     output(st, "%sFull label: %s\n", prefix, str_val(addr->full_label));
65     output(st, "%sLine 1: %s\n", prefix, str_val(addr->line1));
66     output(st, "%sLine 2: %s\n", prefix, str_val(addr->line2));
67     output(st, "%sCity: %s\n", prefix, str_val(addr->city));
68     output(st, "%sState: %s\n", prefix, str_val(addr->state));
69     output(st, "%sPostal: %s\n", prefix, str_val(addr->postal));
70     output(st, "%sCountry: %s\n", prefix, str_val(addr->country));
71     output(st, "%sUser data:", prefix);
72     dump_user_data(st, prefix_depth + 2, addr->extra);
73   }
74   else {
75     output(st, "%s\n", ptr_val(addr));
76   }
77   free(prefix);
78 }
79
80 void dump_date(int st, int prefix_depth, struct date_value* dv)
81 {
82   char* prefix = make_prefix(prefix_depth);
83   if (dv) {
84     output(st, "\n");
85     output(st, "%stype: %d\n", prefix, dv->type);
86     output(st, "%sdate1:\n", prefix);
87     output(st, "%s  calendar type: %d\n", prefix, dv->date1.cal);
88     output(st, "%s  day: %s\n", prefix, str_val(dv->date1.day_str));
89     output(st, "%s  month: %s\n", prefix, str_val(dv->date1.month_str));
90     output(st, "%s  year: %s\n", prefix, str_val(dv->date1.year_str));
91     output(st, "%s  date type: %d\n", prefix, dv->date1.type);
92     output(st, "%s  sdn1: %ld\n", prefix, dv->date1.sdn1);
93     output(st, "%s  sdn2: %ld\n", prefix, dv->date1.sdn2);
94     output(st, "%sdate2:\n", prefix);
95     output(st, "%s  calendar type: %d\n", prefix, dv->date2.cal);
96     output(st, "%s  day: %s\n", prefix, str_val(dv->date2.day_str));
97     output(st, "%s  month: %s\n", prefix, str_val(dv->date2.month_str));
98     output(st, "%s  year: %s\n", prefix, str_val(dv->date2.year_str));
99     output(st, "%s  date type: %d\n", prefix, dv->date2.type);
100     output(st, "%s  sdn1: %ld\n", prefix, dv->date2.sdn1);
101     output(st, "%s  sdn2: %ld\n", prefix, dv->date2.sdn2);
102     output(st, "%sphrase: %s\n", prefix, str_val(dv->phrase));
103   }
104   else {
105     output(st, "%s\n", ptr_val(dv));
106   }
107   free(prefix);
108 }
109
110 void dump_age(int st, int prefix_depth, struct age_value* age)
111 {
112   char* prefix = make_prefix(prefix_depth);
113   if (age) {
114     output(st, "\n");
115     output(st, "%stype: %d\n", prefix, age->type);
116     output(st, "%smodifier: %d\n", prefix, age->mod);
117     output(st, "%syears: %d\n", prefix, age->years);
118     output(st, "%smonths: %d\n", prefix, age->months);
119     output(st, "%sdays: %d\n", prefix, age->days);
120     output(st, "%sphrase: %s\n", prefix, str_val(age->phrase));
121   }
122   else {
123     output(st, "%s\n", ptr_val(age));
124   }
125   free(prefix);
126 }
127
128 void dump_xref(int st, int prefix_depth, struct xref_value* xr)
129 {
130   char* prefix = make_prefix(prefix_depth);
131   if (xr) {
132     output(st, "\n");
133     output(st, "%stype: %d\n", prefix, xr->type);
134     output(st, "%sxref: %s\n", prefix, str_val(xr->string));
135     output(st, "%sobject: %s\n", prefix, ptr_val(xr->object));
136   }
137   else {
138     output(st, "%s\n", ptr_val(xr));
139   }
140   free(prefix);
141 }
142
143 void dump_xref_list(int st, int prefix_depth, struct xref_list* xr)
144 {
145   char* prefix = make_prefix(prefix_depth);
146   if (xr) {
147     output(st, "\n");
148     for (xr; xr; xr = xr->next) {
149       output(st, "%sreference: ", prefix);
150       dump_xref(st, prefix_depth + 2, xr->xref);
151       output(st, "%sUser data:", prefix);
152       dump_user_data(st, prefix_depth + 2, xr->extra);
153     }
154   }
155   else {
156     output(st, "%s\n", ptr_val(xr));
157   }
158   free(prefix);
159 }
160
161 void dump_texts(int st, int prefix_depth, struct text* t)
162 {
163   char* prefix = make_prefix(prefix_depth);
164   if (t) {
165     output(st, "\n");
166     for (t; t; t = t->next) {
167       output(st, "%sText: %s\n", prefix, str_val(t->text));
168       output(st, "%sUser data:", prefix);
169       dump_user_data(st, prefix_depth + 2, t->extra);
170     }
171   }
172   else {
173     output(st, "%s\n", ptr_val(t));
174   }
175   free(prefix);
176 }
177
178 void dump_user_ref(int st, int prefix_depth, struct user_ref_number* ref)
179 {
180   char* prefix = make_prefix(prefix_depth);
181   if (ref) {
182     output(st, "\n");
183     for (ref; ref; ref = ref->next) {
184       output(st, "%sValue: %s\n", prefix, str_val(ref->value));
185       output(st, "%sType: %s\n", prefix, str_val(ref->type));
186       output(st, "%sUser data:", prefix);
187       dump_user_data(st, prefix_depth + 2, ref->extra);
188     }
189   }
190   else {
191     output(st, "%s\n", ptr_val(ref));
192   }
193   free(prefix);
194 }
195
196 void dump_citations(int st, int prefix_depth, struct source_citation* cit);
197
198 void dump_note_sub(int st, int prefix_depth, struct note_sub* note)
199 {
200   char* prefix = make_prefix(prefix_depth);
201   if (note) {
202     output(st, "\n");
203     for (note; note; note = note->next) {
204       output(st, "%sNote: \n", prefix);
205       output(st, "%s  text: %s\n", prefix, str_val(note->text));
206       output(st, "%s  reference: ", prefix);
207       dump_xref(st, prefix_depth + 4, note->reference);
208       output(st, "%s  citations: ", prefix);
209       dump_citations(st, prefix_depth + 4, note->citation);
210       output(st, "%s  User data:", prefix);
211       dump_user_data(st, prefix_depth + 4, note->extra);
212     }
213   }
214   else {
215     output(st, "%s\n", ptr_val(note));
216   }
217   free(prefix);
218 }
219
220 void dump_mm_links(int st, int prefix_depth, struct multimedia_link* link)
221 {
222   char* prefix = make_prefix(prefix_depth);
223   if (link) {
224     output(st, "\n");
225     for (link; link; link = link->next) {
226       output(st, "%slink: \n", prefix);
227       output(st, "%s  reference: ", prefix);
228       dump_xref(st, prefix_depth + 4, link->reference);
229       output(st, "%s  Form: %s\n", prefix, str_val(link->form));
230       output(st, "%s  Title: %s\n", prefix, str_val(link->title));
231       output(st, "%s  File: %s\n", prefix, str_val(link->file));      
232       output(st, "%s  notes: ", prefix);
233       dump_note_sub(st, prefix_depth + 4, link->note);
234       output(st, "%s  User data:", prefix);
235       dump_user_data(st, prefix_depth + 4, link->extra);
236     }
237   }
238   else {
239     output(st, "%s\n", ptr_val(link));
240   }
241   free(prefix);
242 }
243
244 void dump_citations(int st, int prefix_depth, struct source_citation* cit)
245 {
246   char* prefix = make_prefix(prefix_depth);
247   if (cit) {
248     output(st, "\n");
249     for (cit; cit; cit = cit->next) {
250       output(st, "%sCitation: \n", prefix);
251       output(st, "%s  description: %s\n", prefix, str_val(cit->description));
252       output(st, "%s  reference: ", prefix);
253       dump_xref(st, prefix_depth + 4, cit->reference);
254       output(st, "%s  page: %s\n", prefix, str_val(cit->page));
255       output(st, "%s  event: %s\n", prefix, str_val(cit->event));
256       output(st, "%s  role: %s\n", prefix, str_val(cit->role));
257       output(st, "%s  Date: ", prefix);
258       dump_date(st, prefix_depth + 4, cit->date);
259       output(st, "%s  texts: ", prefix, prefix);
260       dump_texts(st, prefix_depth + 4, cit->text);
261       output(st, "%s  quality: %s\n", prefix, str_val(cit->quality));
262       output(st, "%s  multimedia links: ", prefix);
263       dump_mm_links(st, prefix_depth + 4, cit->mm_link);
264       output(st, "%s  notes: ", prefix);
265       dump_note_sub(st, prefix_depth + 4, cit->note);
266       output(st, "%s  User data:", prefix);
267       dump_user_data(st, prefix_depth + 4, cit->extra);
268     }
269   }
270   else {
271     output(st, "%s\n", ptr_val(cit));
272   }
273   free(prefix);
274 }
275
276 void dump_lds(int st, int prefix_depth, struct lds_event* lds)
277 {
278   char* prefix = make_prefix(prefix_depth);
279   if (lds) {
280     output(st, "\n");
281     for (lds; lds; lds = lds->next) {
282       output(st, "%sDate status: %s\n", prefix, str_val(lds->date_status));
283       output(st, "%sDate: ", prefix);
284       dump_date(st, prefix_depth + 2, lds->date);
285       output(st, "%sTemple code: %s\n", prefix, str_val(lds->temple_code));
286       output(st, "%sPlace living ordinance: %s\n", prefix,
287              str_val(lds->place_living_ordinance));
288       output(st, "%scitations: ", prefix);
289       dump_citations(st, prefix_depth + 2, lds->citation);
290       output(st, "%snotes: ", prefix);
291       dump_note_sub(st, prefix_depth + 2, lds->note);
292       output(st, "%sfamily: ", prefix);
293       dump_xref(st, prefix_depth + 2, lds->family);
294       output(st, "%sUser data:", prefix);
295       dump_user_data(st, prefix_depth + 2, lds->extra);
296     }
297   }
298   else {
299     output(st, "%s\n", ptr_val(lds));
300   }
301   free(prefix);
302 }
303
304 void dump_change_date(int st, int prefix_depth, struct change_date* chan)
305 {
306   char* prefix = make_prefix(prefix_depth);
307   if (chan) {
308     output(st, "\n");
309     output(st, "%sDate: ", prefix);
310     dump_date(st, prefix_depth + 2, chan->date);
311     output(st, "%sTime: %s\n", prefix, str_val(chan->time));
312     output(st, "%snotes: ", prefix);
313     dump_note_sub(st, prefix_depth + 2, chan->note);
314     output(st, "%sUser data:", prefix);
315     dump_user_data(st, prefix_depth + 2, chan->extra);
316   }
317   else {
318     output(st, "%s\n", ptr_val(chan));
319   }
320   free(prefix);
321 }
322
323 void dump_personal_name(int st, int prefix_depth, struct personal_name* name)
324 {
325   char* prefix = make_prefix(prefix_depth);
326   if (name) {
327     output(st, "\n");
328     for (name; name; name = name->next) {
329       output(st, "%sName: \n", prefix);
330       output(st, "%s  Name: %s\n", prefix, str_val(name->name));
331       output(st, "%s  Prefix: %s\n", prefix, str_val(name->prefix));
332       output(st, "%s  Given: %s\n", prefix, str_val(name->given));
333       output(st, "%s  Nickname: %s\n", prefix, str_val(name->nickname));
334       output(st, "%s  Surname prefix: %s\n", prefix,
335              str_val(name->surname_prefix));
336       output(st, "%s  Surname: %s\n", prefix, str_val(name->surname));
337       output(st, "%s  Suffix: %s\n", prefix, str_val(name->suffix));
338       output(st, "%s  citations: ", prefix);
339       dump_citations(st, prefix_depth + 4, name->citation);
340       output(st, "%s  notes: ", prefix);
341       dump_note_sub(st, prefix_depth + 4, name->note);
342       output(st, "%s  User data:", prefix);
343       dump_user_data(st, prefix_depth + 4, name->extra);
344     }
345   }
346   else {
347     output(st, "%s\n", ptr_val(name));
348   }
349   free(prefix);
350 }
351
352 void dump_pedigree(int st, int prefix_depth, struct pedigree* p)
353 {
354   char* prefix = make_prefix(prefix_depth);
355   if (p) {
356     output(st, "\n");
357     for (p; p; p = p->next) {
358       output(st, "%sPedigree: %s\n", prefix, str_val(p->pedigree));
359       output(st, "%sUser data:", prefix);
360       dump_user_data(st, prefix_depth + 2, p->extra);
361     }
362   }
363   else {
364     output(st, "%s\n", ptr_val(p));
365   }
366   free(prefix);
367 }
368
369 void dump_family_link(int st, int prefix_depth, struct family_link *link)
370 {
371   char* prefix = make_prefix(prefix_depth);
372   if (link) {
373     output(st, "\n");
374     for (link; link; link = link->next) {
375       output(st, "%sFamily:\n", prefix);
376       output(st, "%s  Family: ", prefix);
377       dump_xref(st, prefix_depth + 4, link->family);
378       output(st, "%s  pedigrees: ", prefix);
379       dump_pedigree(st, prefix_depth + 4, link->pedigree);
380       output(st, "%s  notes: ", prefix);
381       dump_note_sub(st, prefix_depth + 4, link->note);
382       output(st, "%s  User data:", prefix);
383       dump_user_data(st, prefix_depth + 4, link->extra);
384     }
385   }
386   else {
387     output(st, "%s\n", ptr_val(link));
388   }
389   free(prefix);
390 }
391
392 void dump_association(int st, int prefix_depth, struct association *assoc)
393 {
394   char* prefix = make_prefix(prefix_depth);
395   if (assoc) {
396     output(st, "\n");
397     for (assoc; assoc; assoc = assoc->next) {
398       output(st, "%sAssociation:\n", prefix);
399       output(st, "%s  To:\n", prefix);
400       dump_xref(st, prefix_depth + 4, assoc->to);
401       output(st, "%s  Type: %s\n", prefix, str_val(assoc->type));
402       output(st, "%s  Relation: %s\n", str_val(assoc->relation));
403       output(st, "%s  citations: ", prefix);
404       dump_citations(st, prefix_depth + 4, assoc->citation);
405       output(st, "%s  notes: ", prefix);
406       dump_note_sub(st, prefix_depth + 4, assoc->note);
407       output(st, "%s  User data:", prefix);
408       dump_user_data(st, prefix_depth + 4, assoc->extra);
409     }
410   }
411   else {
412     output(st, "%s\n", ptr_val(assoc));
413   }
414   free(prefix);
415 }
416
417 void dump_place(int st, int prefix_depth, struct place* place)
418 {
419   char* prefix = make_prefix(prefix_depth);
420   if (place) {
421     output(st, "\n");
422     output(st, "%svalue: %s\n", prefix, str_val(place->value));
423     output(st, "%splace_hierarchy: %s\n", prefix,
424            str_val(place->place_hierarchy));
425     output(st, "%scitations: ", prefix);
426     dump_citations(st, prefix_depth + 2, place->citation);
427     output(st, "%snotes: ", prefix);
428     dump_note_sub(st, prefix_depth + 2, place->note);
429     output(st, "%sUser data:", prefix);
430     dump_user_data(st, prefix_depth + 2, place->extra);
431   }
432   else {
433     output(st, "%s\n", ptr_val(place));
434   }
435   free(prefix);
436 }
437
438 void dump_source_events(int st, int prefix_depth, struct source_event* evt)
439 {
440   char* prefix = make_prefix(prefix_depth);
441   if (evt) {
442     output(st, "\n");
443     for (evt; evt; evt = evt->next) {
444       output(st, "%sEvent:\n", prefix);
445       output(st, "%s  Recorded events: %s\n", prefix,
446              str_val(evt->recorded_events));
447       output(st, "%s  Date period: ", prefix);
448       dump_date(st, prefix_depth + 4, evt->date_period);
449       output(st, "%s  Jurisdiction: %s\n", prefix, str_val(evt->jurisdiction));
450       output(st, "%s  User data:", prefix);
451       dump_user_data(st, prefix_depth + 4, evt->extra);
452     }
453   }
454   else {
455     output(st, "%s\n", ptr_val(evt));
456   }
457   free(prefix);
458 }
459
460 void dump_source_descriptions(int st, int prefix_depth,
461                               struct source_description* desc)
462 {
463   char* prefix = make_prefix(prefix_depth);
464   if (desc) {
465     output(st, "\n");
466     for (desc; desc; desc = desc->next) {
467       output(st, "%sSource description:\n", prefix);
468       output(st, "%s  Call number: %s\n", prefix, str_val(desc->call_number));
469       output(st, "%s  Media: %s\n", prefix, str_val(desc->media));
470       output(st, "%s  User data:", prefix);
471       dump_user_data(st, prefix_depth + 4, desc->extra);
472     }
473   }
474   else {
475     output(st, "%s\n", ptr_val(desc));
476   }
477   free(prefix);
478 }
479
480 void dump_events(int st, int prefix_depth, struct event *evt)
481 {
482   char* prefix = make_prefix(prefix_depth);
483   if (evt) {
484     output(st, "\n");
485     for (evt; evt; evt = evt->next) {
486       output(st, "%sEvent: %d (%s)\n", prefix, evt->event,
487              str_val(evt->event_name));
488       output(st, "%s  Value: %s\n", prefix, str_val(evt->val));
489       output(st, "%s  Type: %s\n", prefix, str_val(evt->type));
490       output(st, "%s  Date: ", prefix);
491       dump_date(st, prefix_depth + 4, evt->date);
492       output(st, "%s  Place: ", prefix);
493       dump_place(st, prefix_depth + 4, evt->place);
494       output(st, "%s  Address: ", prefix);
495       dump_address(st, prefix_depth + 4, evt->address);
496       output(st, "%s  Phone 1: %s\n", prefix, str_val(evt->phone[0]));
497       output(st, "%s  Phone 2: %s\n", prefix, str_val(evt->phone[1]));
498       output(st, "%s  Phone 3: %s\n", prefix, str_val(evt->phone[2]));
499       output(st, "%s  Age: ", prefix);
500       dump_age(st, prefix_depth + 4, evt->age);
501       output(st, "%s  Agency: %s\n", prefix, str_val(evt->agency));
502       output(st, "%s  Cause: %s\n", prefix, str_val(evt->cause));
503       output(st, "%s  citations: ", prefix);
504       dump_citations(st, prefix_depth + 4, evt->citation);
505       output(st, "%s  multimedia links: ", prefix);
506       dump_mm_links(st, prefix_depth + 4, evt->mm_link);
507       output(st, "%s  notes: ", prefix);
508       dump_note_sub(st, prefix_depth + 4, evt->note);
509       output(st, "%s  Age of husband: ", prefix);
510       dump_age(st, prefix_depth + 4, evt->husband_age);
511       output(st, "%s  Age of wife: ", prefix);
512       dump_age(st, prefix_depth + 4, evt->wife_age);
513       output(st, "%s  Family: ", prefix);
514       dump_xref(st, prefix_depth + 4, evt->family);
515       output(st, "%s  Adoption parent: %s\n", prefix,
516              str_val(evt->adoption_parent));
517       output(st, "%s  User data:", prefix);
518       dump_user_data(st, prefix_depth + 4, evt->extra);
519     }
520   }
521   else {
522     output(st, "%s\n", ptr_val(evt));
523   }
524   free(prefix);
525 }
526
527 void dump_header()
528 {
529   struct header* header = gom_get_header();
530   output(1, "=== HEADER ===\n");
531   output(0, "Source:\n");
532   output(0, "  ID: %s\n", str_val(header->source.id));
533   output(0, "  Name: %s\n", str_val(header->source.name));
534   output(0, "  Version: %s\n", str_val(header->source.version));
535   output(0, "  Corporation:\n");
536   output(0, "    Name: %s\n", str_val(header->source.corporation.name));
537   output(0, "    Address: ");
538   dump_address(0, 6, header->source.corporation.address);
539   output(0, "    Phone 1: %s\n", str_val(header->source.corporation.phone[0]));
540   output(0, "    Phone 2: %s\n", str_val(header->source.corporation.phone[1]));
541   output(0, "    Phone 3: %s\n", str_val(header->source.corporation.phone[2]));
542   output(0, "  Data:\n");
543   output(0, "    Name: %s\n", str_val(header->source.data.name));
544   output(0, "    Date: ");
545   dump_date(0, 6, header->source.data.date);
546   output(0, "    Copyright: %s\n", str_val(header->source.data.copyright));
547   output(0, "Destination: %s\n", str_val(header->destination));
548   output(0, "Date: ");
549   dump_date(0, 2, header->date);
550   output(0, "Time: %s\n", str_val(header->time));
551   output(0, "Submitter: ");
552   dump_xref(0, 2, header->submitter);
553   output(0, "Submission: ");
554   dump_xref(0, 2, header->submission);
555   output(0, "File name: %s\n", str_val(header->filename));
556   output(0, "Copyright: %s\n", str_val(header->copyright));
557   output(0, "Gedcom:\n");
558   output(0, "  Version: %s\n", str_val(header->gedcom.version));
559   output(0, "  Form: %s\n", str_val(header->gedcom.form));
560   output(0, "Character set:\n");
561   output(0, "  Name: %s\n", str_val(header->charset.name));
562   output(0, "  Version: %s\n", str_val(header->charset.version));
563   output(0, "Language: %s\n", str_val(header->language));
564   output(0, "Place hierarchy: %s\n", str_val(header->place_hierarchy));
565   output(0, "Note:\n");
566   output(0, "====\n");
567   output(0, "%s\n", str_val(header->note));
568   output(0, "====\n");
569   output(0, "User data:");
570   dump_user_data(0, 2, header->extra);
571 }
572
573 void dump_submission()
574 {
575   struct submission* subn = gom_get_submission();
576   if (subn) {
577     output(1, "=== SUBMISSION (%s) ===\n", str_val(subn->xrefstr));
578     output(0, "Submitter: ");
579     dump_xref(0, 2, subn->submitter);
580     output(0, "Family file: %s\n", str_val(subn->family_file));
581     output(0, "Temple code: %s\n", str_val(subn->temple_code));
582     output(0, "Nr of ancestor generations: %s\n",
583            str_val(subn->nr_of_ancestor_gens));
584     output(0, "Nr of descendant generations: %s\n",
585            str_val(subn->nr_of_descendant_gens));
586     output(0, "Ordinance process flag: %s\n",
587            str_val(subn->ordinance_process_flag));
588     output(0, "Record id: %s\n", str_val(subn->record_id));
589     output(0, "User data:");
590     dump_user_data(0, 2, subn->extra);
591   }
592 }
593
594 void dump_families()
595 {
596   struct family* fam = gom_get_first_family();
597   for (fam; fam; fam = fam->next) {
598     output(1, "=== FAMILY (%s) ===\n", str_val(fam->xrefstr));
599     output(0, "Family events: ");
600     dump_events(0, 2, fam->event);
601     output(0, "Husband: ");
602     dump_xref(0, 2, fam->husband);
603     output(0, "Wife: ");
604     dump_xref(0, 2, fam->wife);
605     output(0, "Children: ");
606     dump_xref_list(0, 2, fam->children);
607     output(0, "Number of children: %s\n", str_val(fam->nr_of_children));
608     output(0, "Submitters: ");
609     dump_xref_list(0, 2, fam->submitters);
610     output(0, "LDS spouse sealings: ");
611     dump_lds(0, 2, fam->lds_spouse_sealing);
612     output(0, "citations: ");
613     dump_citations(0, 2, fam->citation);
614     output(0, "multimedia links: ");
615     dump_mm_links(0, 2, fam->mm_link);
616     output(0, "notes: ");
617     dump_note_sub(0, 2, fam->note);
618     output(0, "user refs: ");
619     dump_user_ref(0, 2, fam->ref);
620     output(0, "Record ID: %s\n", str_val(fam->record_id));
621     output(0, "change date: ");
622     dump_change_date(0, 2, fam->change_date);
623     output(0, "User data:");
624     dump_user_data(0, 2, fam->extra);
625   }
626 }
627
628 void dump_individuals()
629 {
630   struct individual* indiv = gom_get_first_individual();
631   for (indiv; indiv; indiv = indiv->next) {
632     output(1, "=== INDIVIDUAL (%s) ===\n", str_val(indiv->xrefstr));
633     output(0, "Restriction notice: %s\n", str_val(indiv->restriction_notice));
634     output(0, "names: ");
635     dump_personal_name(0, 2, indiv->name);
636     output(0, "Sex: %s\n", str_val(indiv->sex));
637     output(0, "Individual events: ");
638     dump_events(0, 2, indiv->event);
639     output(0, "Individual attributes: ");
640     dump_events(0, 2, indiv->attribute);
641     output(0, "LDS individual ordinance: ");
642     dump_lds(0, 2, indiv->lds_individual_ordinance);
643     output(0, "Child to family links: ");
644     dump_family_link(0, 2, indiv->child_to_family);
645     output(0, "Spouse to family links: ");
646     dump_family_link(0, 2, indiv->spouse_to_family);
647     output(0, "Submitters: ");
648     dump_xref_list(0, 2, indiv->submitters);
649     output(0, "Associations: ");
650     dump_association(0, 2, indiv->association);
651     output(0, "Aliases: ");
652     dump_xref_list(0, 2, indiv->alias);
653     output(0, "Ancestor interest: ");
654     dump_xref_list(0, 2, indiv->ancestor_interest);
655     output(0, "Descendant interest: ");
656     dump_xref_list(0, 2, indiv->descendant_interest);
657     output(0, "citations: ");
658     dump_citations(0, 2, indiv->citation);
659     output(0, "multimedia links: ");
660     dump_mm_links(0, 2, indiv->mm_link);
661     output(0, "notes: ");
662     dump_note_sub(0, 2, indiv->note);
663     output(0, "Record file nr: %s\n", str_val(indiv->record_file_nr));
664     output(0, "Ancestral file nr: %s\n", str_val(indiv->ancestral_file_nr));
665     output(0, "user refs: ");
666     dump_user_ref(0, 2, indiv->ref);
667     output(0, "Record ID: %s\n", str_val(indiv->record_id));
668     output(0, "change date: ");
669     dump_change_date(0, 2, indiv->change_date);
670     output(0, "User data:");
671     dump_user_data(0, 2, indiv->extra);
672   }
673 }
674
675 void dump_multimedia()
676 {
677   struct multimedia* obj = gom_get_first_multimedia();
678   for (obj; obj; obj = obj->next) {
679     output(1, "=== MULTIMEDIA (%s) ===\n", str_val(obj->xrefstr));
680     output(0, "Form: %s\n", str_val(obj->form));
681     output(0, "Title: %s\n", str_val(obj->title));
682     output(0, "notes: ");
683     dump_note_sub(0, 2, obj->note);
684     output(0, "Data: %s\n", str_val(obj->data));
685     output(0, "Continued: ");
686     dump_xref(0, 2, obj->continued);
687     output(0, "user refs: ");
688     dump_user_ref(0, 2, obj->ref);
689     output(0, "Record ID: %s\n", str_val(obj->record_id));
690     output(0, "change date: ");
691     dump_change_date(0, 2, obj->change_date);
692     output(0, "User data:");
693     dump_user_data(0, 2, obj->extra);
694   }  
695 }
696
697 void dump_notes()
698 {
699   struct note* note = gom_get_first_note();
700   for (note; note; note = note->next) {
701     output(1, "=== NOTE (%s) ===\n", str_val(note->xrefstr));
702     output(0, "Text: %s\n", str_val(note->text));
703     output(0, "citations: ");
704     dump_citations(0, 2, note->citation);
705     output(0, "user refs: ");
706     dump_user_ref(0, 2, note->ref);
707     output(0, "Record ID: %s\n", str_val(note->record_id));
708     output(0, "change date: ");
709     dump_change_date(0, 2, note->change_date);
710     output(0, "User data:");
711     dump_user_data(0, 2, note->extra);
712   }  
713 }
714
715 void dump_repositories()
716 {
717   struct repository* repo = gom_get_first_repository();
718   for (repo; repo; repo = repo->next) {
719     output(1, "=== REPOSITORY (%s) ===\n", str_val(repo->xrefstr));
720     output(0, "Name: %s\n", str_val(repo->name));
721     output(0, "Address: ");
722     dump_address(0, 2, repo->address);
723     output(0, "Phone 1: %s\n", str_val(repo->phone[0]));
724     output(0, "Phone 2: %s\n", str_val(repo->phone[1]));
725     output(0, "Phone 3: %s\n", str_val(repo->phone[2]));
726     output(0, "notes: ");
727     dump_note_sub(0, 2, repo->note);
728     output(0, "user refs: ");
729     dump_user_ref(0, 2, repo->ref);
730     output(0, "Record ID: %s\n", str_val(repo->record_id));
731     output(0, "change date: ");
732     dump_change_date(0, 2, repo->change_date);
733     output(0, "User data:");
734     dump_user_data(0, 2, repo->extra);
735   }  
736 }
737
738 void dump_sources()
739 {
740   struct source* sour = gom_get_first_source();
741   for (sour; sour; sour = sour->next) {
742     output(1, "=== SOURCE (%s) ===\n", str_val(sour->xrefstr));
743     output(0, "Data: \n");
744     output(0, "  events: ");
745     dump_source_events(0, 4, sour->data.event);
746     output(0, "  Agency: %s\n", str_val(sour->data.agency));
747     output(0, "  notes: ");
748     dump_note_sub(0, 4, sour->data.note);
749     output(0, "Author: %s\n", str_val(sour->author));
750     output(0, "Title: %s\n", str_val(sour->title));
751     output(0, "Abbreviation: %s\n", str_val(sour->abbreviation));
752     output(0, "Publication: %s\n", str_val(sour->publication));
753     output(0, "Text: %s\n", str_val(sour->text));
754     output(0, "Repository:\n");
755     output(0, "  Link: ");
756     dump_xref(0, 4, sour->repository.link);
757     output(0, "  notes: ");
758     dump_note_sub(0, 4, sour->repository.note);
759     output(0, "  source descriptions: ");
760     dump_source_descriptions(0, 4, sour->repository.description);
761     output(0, "multimedia links: ");
762     dump_mm_links(0, 2, sour->mm_link);
763     output(0, "notes: ");
764     dump_note_sub(0, 2, sour->note);
765     output(0, "user refs: ");
766     dump_user_ref(0, 2, sour->ref);
767     output(0, "Record ID: %s\n", str_val(sour->record_id));
768     output(0, "change date: ");
769     dump_change_date(0, 2, sour->change_date);
770     output(0, "User data:");
771     dump_user_data(0, 2, sour->extra);
772   }  
773 }
774
775 void dump_submitters()
776 {
777   struct submitter* subm = gom_get_first_submitter();
778   for (subm; subm; subm = subm->next) {
779     output(1, "=== SUBMITTER (%s) ===\n", str_val(subm->xrefstr));
780     output(0, "Name: %s\n", str_val(subm->name));
781     output(0, "Address: ");
782     dump_address(0, 2, subm->address);
783     output(0, "Phone 1: %s\n", str_val(subm->phone[0]));
784     output(0, "Phone 2: %s\n", str_val(subm->phone[1]));
785     output(0, "Phone 3: %s\n", str_val(subm->phone[2]));
786     output(0, "multimedia links: ");
787     dump_mm_links(0, 2, subm->mm_link);
788     output(0, "Language 1: %s\n", str_val(subm->language[0]));
789     output(0, "Language 2: %s\n", str_val(subm->language[1]));
790     output(0, "Language 3: %s\n", str_val(subm->language[2]));
791     output(0, "Record file nr: %s\n", str_val(subm->record_file_nr));
792     output(0, "Record ID: %s\n", str_val(subm->record_id));
793     output(0, "change date: ");
794     dump_change_date(0, 2, subm->change_date);
795     output(0, "User data:");
796     dump_user_data(0, 2, subm->extra);
797   }  
798 }
799
800 void dump_user_records()
801 {
802   struct user_rec* rec = gom_get_first_user_rec();
803   for (rec; rec; rec = rec->next) {
804     output(1, "=== USER RECORD (%s) ===\n", str_val(rec->xrefstr));
805     output(0, "Tag: %s\n", rec->tag);
806     output(0, "String value: %s\n", str_val(rec->str_value));
807     output(0, "Xref value: ");
808     dump_xref(0, 2, rec->xref_value);
809     output(0, "User data:");
810     dump_user_data(0, 2, rec->extra);
811   }  
812 }
813
814 void show_data()
815 {
816   dump_header();
817   dump_submission();
818   dump_families();
819   dump_individuals();
820   dump_multimedia();
821   dump_notes();
822   dump_repositories();
823   dump_sources();
824   dump_submitters();
825   dump_user_records();
826 }