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