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