home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-13 | 48.5 KB | 1,701 lines |
- Newsgroups: comp.sources.misc
- From: murf@oakhill.sps.mot.com (Steve Murphy)
- Subject: v27i077: gcom - GEDCOM genealogical database merge utility, v1, Part06/07
- Message-ID: <1992Jan13.145700.25679@sparky.imd.sterling.com>
- X-Md4-Signature: dc8d6a06252960ad4a90ab5c0e1c049d
- Date: Mon, 13 Jan 1992 14:57:00 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: murf@oakhill.sps.mot.com (Steve Murphy)
- Posting-number: Volume 27, Issue 77
- Archive-name: gcom/part06
- Environment: SunOS
-
- ---- Cut Here and unpack ----
- #!/bin/sh
- # This is part 06 of gcom
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= gedcom.b.tab.c ==============
- echo "x - extracting gedcom.b.tab.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > gedcom.b.tab.c &&
- X
- X/* A Bison parser, made from gedcom.b */
- X
- X#define DIV 258
- X#define LEV0 259
- X#define LEV1 260
- X#define LEV2 261
- X#define LEV3 262
- X#define ADDR 263
- X#define BAPL 264
- X#define CHAR 265
- X#define COMM 266
- X#define CONT 267
- X#define DATE 268
- X#define DEST 269
- X#define ENDL 270
- X#define FILE9 271
- X#define FLAG 272
- X#define NAME 273
- X#define NOTE 274
- X#define PHON 275
- X#define PLAC 276
- X#define QUAL 277
- X#define REL 278
- X#define SEX 279
- X#define SOUR 280
- X#define TEMP 281
- X#define TITL 282
- X#define REF 283
- X#define BIC 284
- X#define NUMB 285
- X#define REFN 286
- X#define SLGC 287
- X#define SLGS 288
- X#define BIRT 289
- X#define BURI 290
- X#define CHIL 291
- X#define CHR 292
- X#define DEAT 293
- X#define FAM 294
- X#define FAMC 295
- X#define FAMS 296
- X#define HEAD 297
- X#define HUSB 298
- X#define INDI 299
- X#define MARR 300
- X#define STAL 301
- X#define TRLR 302
- X#define WIFE 303
- X#define SUBM 304
- X
- X#line 1 "gedcom.b"
- X
- X#ifndef LINT
- Xstatic char rcs_gedcom_id[] = "$Id: gedcom.b,v 1.2 1992/01/03 17:49:44 murf Exp $";
- X#endif
- X/* # Copyright (C) 1992 Steven Michael Murphy
- X#
- X#
- X# This file is part of gcom, the GEDCOM file merging utility for UNIX,
- X#
- X#
- X# gcom is free software; you can redistribute it and/or modify
- X# it under the terms of the GNU General Public License as published by
- X# the Free Software Foundation; either version 2, or (at your option)
- X# any later version.
- X#
- X# gcom is distributed in the hope that it will be useful,
- X# but WITHOUT ANY WARRANTY; without even the implied warranty of
- X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X# GNU General Public License for more details.
- X#
- X# You should have received a copy of the GNU General Public License
- X# along with gcom; see the file COPYING. If not, write to
- X# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- X*/
- X
- X#include <stdio.h>
- X#include "gedcom.h"
- Xint lineno;
- Xstruct individ curr_ind;
- Xstruct family curr_fam;
- Xstruct gedfile *curr_file;
- Xstruct submitter curr_submitter;
- Xstruct gheader curr_head;
- Xstruct submitt{char *submitter; char *rel;};
- Xint strcmp();
- Xstatic char rcs_stuff[] = "$Id: gedcom.b,v 1.2 1992/01/03 17:49:44 murf Exp $";
- X
- X#line 40 "gedcom.b"
- Xtypedef union
- X{ int num;
- X char *str;
- X struct datplace *datplace;
- X struct ordinance *ordinance;
- X struct notelist *notelist;
- X struct individ *individ;
- X struct family *family;
- X struct gheader *header;
- X struct submitt *submit;
- X struct child *child;
- X struct submitt *submitt;
- X struct comment *comment;
- X struct stake *stake;
- X struct address *address;
- X} YYSTYPE;
- X
- X#ifndef YYLTYPE
- Xtypedef
- X struct yyltype
- X {
- X int timestamp;
- X int first_line;
- X int first_column;
- X int last_line;
- X int last_column;
- X char *text;
- X }
- X yyltype;
- X
- X#define YYLTYPE yyltype
- X#endif
- X
- X#include <stdio.h>
- X
- X#ifndef __STDC__
- X#define const
- X#endif
- X
- X
- X
- X#define YYFINAL 150
- X#define YYFLAG -32768
- X#define YYNTBASE 50
- X
- X#define YYTRANSLATE(x) ((unsigned)(x) <= 304 ? yytranslate[x] : 92)
- X
- Xstatic const char yytranslate[] = { 0,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
- X 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- X 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- X 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- X 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- X 46, 47, 48, 49
- X};
- X
- Xstatic const short yyprhs[] = { 0,
- X 0, 5, 6, 11, 13, 16, 19, 22, 25, 28,
- X 31, 32, 38, 41, 45, 47, 49, 51, 53, 55,
- X 58, 60, 63, 67, 70, 72, 74, 78, 82, 88,
- X 94, 96, 99, 101, 103, 104, 110, 113, 117, 119,
- X 121, 123, 125, 127, 129, 131, 133, 135, 137, 139,
- X 141, 144, 147, 149, 151, 153, 156, 159, 162, 167,
- X 172, 175, 178, 181, 184, 186, 188, 191, 194, 197,
- X 200, 202, 205, 208, 211, 214, 217, 219, 222, 224,
- X 226, 229, 232, 237, 239, 242, 243, 249, 252, 256,
- X 259, 262, 264, 266, 268, 270, 272, 274, 276, 279,
- X 284, 287, 290, 292
- X};
- X
- Xstatic const short yyrhs[] = { 51,
- X 55, 63, 91, 0, 0, 4, 42, 52, 53, 0,
- X 54, 0, 53, 54, 0, 5, 25, 0, 5, 14,
- X 0, 5, 13, 0, 5, 10, 0, 5, 16, 0,
- X 0, 4, 28, 56, 49, 57, 0, 5, 58, 0,
- X 57, 5, 58, 0, 18, 0, 20, 0, 61, 0,
- X 59, 0, 62, 0, 8, 60, 0, 8, 0, 6,
- X 12, 0, 60, 6, 12, 0, 11, 60, 0, 11,
- X 0, 46, 0, 46, 6, 18, 0, 46, 6, 30,
- X 0, 46, 6, 18, 6, 30, 0, 46, 6, 30,
- X 6, 18, 0, 64, 0, 63, 64, 0, 65, 0,
- X 84, 0, 0, 4, 28, 44, 66, 67, 0, 5,
- X 68, 0, 67, 5, 68, 0, 18, 0, 27, 0,
- X 24, 0, 31, 0, 69, 0, 71, 0, 72, 0,
- X 73, 0, 74, 0, 79, 0, 80, 0, 17, 0,
- X 41, 28, 0, 40, 28, 0, 82, 0, 14, 0,
- X 83, 0, 34, 70, 0, 6, 13, 0, 6, 21,
- X 0, 6, 13, 6, 21, 0, 6, 21, 6, 13,
- X 0, 37, 70, 0, 38, 70, 0, 35, 70, 0,
- X 9, 75, 0, 9, 0, 76, 0, 75, 76, 0,
- X 6, 13, 0, 6, 26, 0, 6, 22, 0, 78,
- X 0, 77, 78, 0, 7, 13, 0, 7, 26, 0,
- X 7, 22, 0, 15, 75, 0, 15, 0, 32, 75,
- X 0, 32, 0, 32, 0, 32, 77, 0, 49, 28,
- X 0, 49, 28, 6, 23, 0, 19, 0, 19, 60,
- X 0, 0, 4, 28, 85, 39, 86, 0, 5, 87,
- X 0, 86, 5, 87, 0, 43, 28, 0, 48, 28,
- X 0, 88, 0, 89, 0, 90, 0, 3, 0, 14,
- X 0, 17, 0, 82, 0, 36, 28, 0, 36, 28,
- X 6, 81, 0, 45, 70, 0, 33, 75, 0, 33,
- X 0, 4, 47, 0
- X};
- X
- X#if YYDEBUG != 0
- Xstatic const short yyrline[] = { 0,
- X 115, 117, 117, 119, 120, 122, 123, 124, 125, 126,
- X 128, 128, 131, 132, 134, 135, 136, 137, 138, 140,
- X 151, 155, 156, 159, 161, 163, 164, 165, 166, 169,
- X 173, 174, 176, 177, 179, 180, 182, 183, 185, 186,
- X 187, 190, 191, 192, 193, 194, 195, 196, 197, 198,
- X 199, 200, 201, 202, 203, 216, 218, 219, 220, 221,
- X 223, 225, 227, 229, 230, 232, 233, 236, 237, 238,
- X 240, 241, 244, 245, 246, 248, 249, 251, 252, 254,
- X 255, 257, 258, 260, 262, 273, 273, 276, 277, 279,
- X 280, 281, 282, 283, 284, 285, 286, 287, 290, 291,
- X 293, 295, 296, 298
- X};
- X
- Xstatic const char * const yytname[] = { "$",
- X"error","$illegal.","DIV","LEV0","LEV1","LEV2","LEV3","ADDR","BAPL","CHAR",
- X"COMM","CONT","DATE","DEST","ENDL","FILE9","FLAG","NAME","NOTE","PHON",
- X"PLAC","QUAL","REL","SEX","SOUR","TEMP","TITL","REF","BIC","NUMB",
- X"REFN","SLGC","SLGS","BIRT","BURI","CHIL","CHR","DEAT","FAM","FAMC",
- X"FAMS","HEAD","HUSB","INDI","MARR","STAL","TRLR","WIFE","SUBM","file",
- X"header","@1","head_rec_list","headrec","submitter","@2","subm_list","submrec","address","ext_list",
- X"comment","stake","record_list","record","individual_rec","@3","indiv_stuff_list","indivrec","birth","datplacitem2",
- X"christen","death","buried","bap","tempitem","t_item","tempitem3","t_item3","endow","c2pseal",
- X"c2pseal3","submitter2","note","fam_rec","@4","fam_stuff_list","famrec","child","marriage","seal2spou",
- X"trailer",""
- X};
- X#endif
- X
- Xstatic const short yyr1[] = { 0,
- X 50, 52, 51, 53, 53, 54, 54, 54, 54, 54,
- X 56, 55, 57, 57, 58, 58, 58, 58, 58, 59,
- X 59, 60, 60, 61, 61, 62, 62, 62, 62, 62,
- X 63, 63, 64, 64, 66, 65, 67, 67, 68, 68,
- X 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- X 68, 68, 68, 68, 68, 69, 70, 70, 70, 70,
- X 71, 72, 73, 74, 74, 75, 75, 76, 76, 76,
- X 77, 77, 78, 78, 78, 79, 79, 80, 80, 81,
- X 81, 82, 82, 83, 83, 85, 84, 86, 86, 87,
- X 87, 87, 87, 87, 87, 87, 87, 87, 88, 88,
- X 89, 90, 90, 91
- X};
- X
- Xstatic const short yyr2[] = { 0,
- X 4, 0, 4, 1, 2, 2, 2, 2, 2, 2,
- X 0, 5, 2, 3, 1, 1, 1, 1, 1, 2,
- X 1, 2, 3, 2, 1, 1, 3, 3, 5, 5,
- X 1, 2, 1, 1, 0, 5, 2, 3, 1, 1,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- X 2, 2, 1, 1, 1, 2, 2, 2, 4, 4,
- X 2, 2, 2, 2, 1, 1, 2, 2, 2, 2,
- X 1, 2, 2, 2, 2, 2, 1, 2, 1, 1,
- X 2, 2, 4, 1, 2, 0, 5, 2, 3, 2,
- X 2, 1, 1, 1, 1, 1, 1, 1, 2, 4,
- X 2, 2, 1, 2
- X};
- X
- Xstatic const short yydefact[] = { 0,
- X 0, 0, 2, 0, 0, 0, 11, 0, 0, 31,
- X 33, 34, 0, 3, 4, 0, 86, 0, 32, 1,
- X 9, 8, 7, 10, 6, 5, 0, 35, 0, 104,
- X 0, 12, 0, 0, 21, 25, 15, 16, 26, 13,
- X 18, 17, 19, 0, 0, 36, 0, 87, 0, 20,
- X 24, 0, 14, 65, 54, 77, 50, 39, 84, 41,
- X 40, 42, 79, 0, 0, 0, 0, 0, 0, 0,
- X 37, 43, 44, 45, 46, 47, 48, 49, 53, 55,
- X 0, 95, 96, 97, 103, 0, 0, 0, 0, 98,
- X 88, 92, 93, 94, 0, 22, 0, 27, 28, 0,
- X 64, 66, 76, 85, 78, 0, 56, 63, 61, 62,
- X 52, 51, 82, 38, 102, 99, 90, 101, 91, 89,
- X 23, 0, 0, 68, 70, 69, 67, 57, 58, 0,
- X 0, 29, 30, 0, 0, 83, 80, 100, 59, 60,
- X 0, 81, 71, 73, 75, 74, 72, 0, 0, 0
- X};
- X
- Xstatic const short yydefgoto[] = { 148,
- X 2, 6, 14, 15, 5, 16, 32, 40, 41, 50,
- X 42, 43, 9, 10, 11, 33, 46, 71, 72, 107,
- X 73, 74, 75, 76, 101, 102, 142, 143, 77, 78,
- X 138, 79, 80, 12, 29, 48, 91, 92, 93, 94,
- X 20
- X};
- X
- Xstatic const short yypact[] = { 4,
- X -31, 10,-32768, 2, 20, 33,-32768, 12, 40,-32768,
- X-32768,-32768, 47, 33,-32768, 19, 25, -26,-32768,-32768,
- X-32768,-32768,-32768,-32768,-32768,-32768, 49,-32768, 31,-32768,
- X 5, 66, 68, 70, 71, 71,-32768,-32768, 73,-32768,
- X-32768,-32768,-32768, 5, 18, 75, -2, 76, 72, 77,
- X 77, -11,-32768, 79,-32768, 79,-32768,-32768, 71,-32768,
- X-32768,-32768, 79, 80, 80, 80, 80, 54, 59, 60,
- X-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- X 18,-32768,-32768,-32768, 79, 61, 62, 80, 63,-32768,
- X-32768,-32768,-32768,-32768, -2,-32768, 81, 86, 88, -4,
- X 79,-32768, 79, 77, 79, 7,-32768,-32768,-32768,-32768,
- X-32768,-32768, 89,-32768, 79, 90,-32768,-32768,-32768,-32768,
- X-32768, 67, 82,-32768,-32768,-32768,-32768, 92, 93, 78,
- X 74,-32768,-32768, 83, 94,-32768, 95,-32768,-32768,-32768,
- X 52, 95,-32768,-32768,-32768,-32768,-32768, 103, 105,-32768
- X};
- X
- Xstatic const short yypgoto[] = {-32768,
- X-32768,-32768,-32768, 96,-32768,-32768,-32768, 64,-32768, -30,
- X-32768,-32768,-32768, 100,-32768,-32768,-32768, 30,-32768, -62,
- X-32768,-32768,-32768,-32768, -46, -39,-32768, -29,-32768,-32768,
- X-32768, -47,-32768,-32768,-32768,-32768, 17,-32768,-32768,-32768,
- X-32768
- X};
- X
- X
- X#define YYLAST 113
- X
- X
- Xstatic const short yytable[] = { 90,
- X 82, 17, 108, 109, 110, 51, 98, 1, 124, 103,
- X 3, 83, 35, 4, 84, 36, 105, 125, 99, 128,
- X 30, 126, 37, 8, 38, 118, 54, 129, 104, 7,
- X 85, 55, 56, 86, 57, 58, 59, 13, 115, 17,
- X 87, 60, 88, 18, 61, 89, 70, 90, 62, 63,
- X 39, 64, 65, 31, 66, 67, 21, 68, 69, 22,
- X 23, 127, 24, 127, 144, 127, 70, 27, 28, 34,
- X 44, 25, 45, 145, 47, 127, 49, 146, 52, 81,
- X 95, 111, 97, 96, 100, 106, 112, 113, 116, 117,
- X 119, 122, 121, 123, 130, 131, 132, 134, 135, 133,
- X 136, 141, 149, 139, 150, 137, 140, 53, 19, 26,
- X 114, 120, 147
- X};
- X
- Xstatic const short yycheck[] = { 47,
- X 3, 28, 65, 66, 67, 36, 18, 4, 13, 56,
- X 42, 14, 8, 4, 17, 11, 63, 22, 30, 13,
- X 47, 26, 18, 4, 20, 88, 9, 21, 59, 28,
- X 33, 14, 15, 36, 17, 18, 19, 5, 85, 28,
- X 43, 24, 45, 4, 27, 48, 49, 95, 31, 32,
- X 46, 34, 35, 5, 37, 38, 10, 40, 41, 13,
- X 14, 101, 16, 103, 13, 105, 49, 49, 44, 39,
- X 5, 25, 5, 22, 5, 115, 6, 26, 6, 5,
- X 5, 28, 6, 12, 6, 6, 28, 28, 28, 28,
- X 28, 6, 12, 6, 6, 6, 30, 6, 6, 18,
- X 23, 7, 0, 21, 0, 32, 13, 44, 9, 14,
- X 81, 95, 142
- X};
- X/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
- X#line 3 "bison.simple"
- X
- X/* Skeleton output parser for bison,
- X Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
- X
- X This program is free software; you can redistribute it and/or modify
- X it under the terms of the GNU General Public License as published by
- X the Free Software Foundation; either version 1, or (at your option)
- X any later version.
- X
- X This program is distributed in the hope that it will be useful,
- X but WITHOUT ANY WARRANTY; without even the implied warranty of
- X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X GNU General Public License for more details.
- X
- X You should have received a copy of the GNU General Public License
- X along with this program; if not, write to the Free Software
- X Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
- X
- X
- X#ifndef alloca
- X#ifdef __GNUC__
- X#define alloca __builtin_alloca
- X#else /* Not GNU C. */
- X#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
- X#include <alloca.h>
- X#else /* Not sparc */
- X#ifdef MSDOS
- X#include <malloc.h>
- X#endif /* MSDOS */
- X#endif /* Not sparc. */
- X#endif /* Not GNU C. */
- X#endif /* alloca not defined. */
- X
- X/* This is the parser code that is written into each bison parser
- X when the %semantic_parser declaration is not specified in the grammar.
- X It was written by Richard Stallman by simplifying the hairy parser
- X used when %semantic_parser is specified. */
- X
- X/* Note: there must be only one dollar sign in this file.
- X It is replaced by the list of actions, each action
- X as one case of the switch. */
- X
- X#define yyerrok (yyerrstatus = 0)
- X#define yyclearin (yychar = YYEMPTY)
- X#define YYEMPTY -2
- X#define YYEOF 0
- X#define YYACCEPT return(0)
- X#define YYABORT return(1)
- X#define YYERROR goto yyerrlab1
- X/* Like YYERROR except do call yyerror.
- X This remains here temporarily to ease the
- X transition to the new meaning of YYERROR, for GCC.
- X Once GCC version 2 has supplanted version 1, this can go. */
- X#define YYFAIL goto yyerrlab
- X#define YYRECOVERING() (!!yyerrstatus)
- X#define YYBACKUP(token, value) \
- Xdo \
- X if (yychar == YYEMPTY && yylen == 1) \
- X { yychar = (token), yylval = (value); \
- X yychar1 = YYTRANSLATE (yychar); \
- X YYPOPSTACK; \
- X goto yybackup; \
- X } \
- X else \
- X { yyerror ("syntax error: cannot back up"); YYERROR; } \
- Xwhile (0)
- X
- X#define YYTERROR 1
- X#define YYERRCODE 256
- X
- X#ifndef YYPURE
- X#define YYLEX yylex()
- X#endif
- X
- X#ifdef YYPURE
- X#ifdef YYLSP_NEEDED
- X#define YYLEX yylex(&yylval, &yylloc)
- X#else
- X#define YYLEX yylex(&yylval)
- X#endif
- X#endif
- X
- X/* If nonreentrant, generate the variables here */
- X
- X#ifndef YYPURE
- X
- Xint yychar; /* the lookahead symbol */
- XYYSTYPE yylval; /* the semantic value of the */
- X /* lookahead symbol */
- X
- X#ifdef YYLSP_NEEDED
- XYYLTYPE yylloc; /* location data for the lookahead */
- X /* symbol */
- X#endif
- X
- Xint yynerrs; /* number of parse errors so far */
- X#endif /* not YYPURE */
- X
- X#if YYDEBUG != 0
- Xint yydebug; /* nonzero means print parse trace */
- X/* Since this is uninitialized, it does not stop multiple parsers
- X from coexisting. */
- X#endif
- X
- X/* YYINITDEPTH indicates the initial size of the parser's stacks */
- X
- X#ifndef YYINITDEPTH
- X#define YYINITDEPTH 200
- X#endif
- X
- X/* YYMAXDEPTH is the maximum size the stacks can grow to
- X (effective only if the built-in stack extension method is used). */
- X
- X#if YYMAXDEPTH == 0
- X#undef YYMAXDEPTH
- X#endif
- X
- X#ifndef YYMAXDEPTH
- X#define YYMAXDEPTH 10000
- X#endif
- X
- X#ifndef __cplusplus
- X
- X/* This is the most reliable way to avoid incompatibilities
- X in available built-in functions on various systems. */
- Xstatic void
- X__yy_bcopy (from, to, count)
- X char *from;
- X char *to;
- X int count;
- X{
- X register char *f = from;
- X register char *t = to;
- X register int i = count;
- X
- X while (i-- > 0)
- X *t++ = *f++;
- X}
- X
- X#else /* __cplusplus */
- X
- X/* This is the most reliable way to avoid incompatibilities
- X in available built-in functions on various systems. */
- Xstatic void
- X__yy_bcopy (char *from, char *to, int count)
- X{
- X register char *f = from;
- X register char *t = to;
- X register int i = count;
- X
- X while (i-- > 0)
- X *t++ = *f++;
- X}
- X
- X#endif
- X
- X#line 160 "bison.simple"
- Xint
- Xyyparse()
- X{
- X register int yystate;
- X register int yyn;
- X register short *yyssp;
- X register YYSTYPE *yyvsp;
- X int yyerrstatus; /* number of tokens to shift before error messages enabled */
- X int yychar1; /* lookahead token as an internal (translated) token number */
- X
- X short yyssa[YYINITDEPTH]; /* the state stack */
- X YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
- X
- X short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- X YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
- X
- X#ifdef YYLSP_NEEDED
- X YYLTYPE *yyls = yylsa;
- X YYLTYPE *yylsp;
- X YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- X
- X#define YYPOPSTACK (yyvsp--, yysp--, yylsp--)
- X#else
- X#define YYPOPSTACK (yyvsp--, yysp--)
- X#endif
- X
- X int yystacksize = YYINITDEPTH;
- X
- X#ifdef YYPURE
- X int yychar;
- X YYSTYPE yylval;
- X int yynerrs;
- X#ifdef YYLSP_NEEDED
- X YYLTYPE yylloc;
- X#endif
- X#endif
- X
- X YYSTYPE yyval; /* the variable used to return */
- X /* semantic values from the action */
- X /* routines */
- X
- X int yylen;
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Starting parse\n");
- X#endif
- X
- X yystate = 0;
- X yyerrstatus = 0;
- X yynerrs = 0;
- X yychar = YYEMPTY; /* Cause a token to be read. */
- X
- X /* Initialize stack pointers.
- X Waste one element of value and location stack
- X so that they stay on the same level as the state stack. */
- X
- X yyssp = yyss - 1;
- X yyvsp = yyvs;
- X#ifdef YYLSP_NEEDED
- X yylsp = yyls;
- X#endif
- X
- X/* Push a new state, which is found in yystate . */
- X/* In all cases, when you get here, the value and location stacks
- X have just been pushed. so pushing a state here evens the stacks. */
- Xyynewstate:
- X
- X *++yyssp = yystate;
- X
- X if (yyssp >= yyss + yystacksize - 1)
- X {
- X /* Give user a chance to reallocate the stack */
- X /* Use copies of these so that the &'s don't force the real ones into memory. */
- X YYSTYPE *yyvs1 = yyvs;
- X short *yyss1 = yyss;
- X#ifdef YYLSP_NEEDED
- X YYLTYPE *yyls1 = yyls;
- X#endif
- X
- X /* Get the current used size of the three stacks, in elements. */
- X int size = yyssp - yyss + 1;
- X
- X#ifdef yyoverflow
- X /* Each stack pointer address is followed by the size of
- X the data in use in that stack, in bytes. */
- X yyoverflow("parser stack overflow",
- X &yyss1, size * sizeof (*yyssp),
- X &yyvs1, size * sizeof (*yyvsp),
- X#ifdef YYLSP_NEEDED
- X &yyls1, size * sizeof (*yylsp),
- X#endif
- X &yystacksize);
- X
- X yyss = yyss1; yyvs = yyvs1;
- X#ifdef YYLSP_NEEDED
- X yyls = yyls1;
- X#endif
- X#else /* no yyoverflow */
- X /* Extend the stack our own way. */
- X if (yystacksize >= YYMAXDEPTH)
- X {
- X yyerror("parser stack overflow");
- X return 2;
- X }
- X yystacksize *= 2;
- X if (yystacksize > YYMAXDEPTH)
- X yystacksize = YYMAXDEPTH;
- X yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
- X __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
- X yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
- X __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
- X#ifdef YYLSP_NEEDED
- X yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
- X __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
- X#endif
- X#endif /* no yyoverflow */
- X
- X yyssp = yyss + size - 1;
- X yyvsp = yyvs + size - 1;
- X#ifdef YYLSP_NEEDED
- X yylsp = yyls + size - 1;
- X#endif
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Stack size increased to %d\n", yystacksize);
- X#endif
- X
- X if (yyssp >= yyss + yystacksize - 1)
- X YYABORT;
- X }
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Entering state %d\n", yystate);
- X#endif
- X
- X yybackup:
- X
- X/* Do appropriate processing given the current state. */
- X/* Read a lookahead token if we need one and don't already have one. */
- X/* yyresume: */
- X
- X /* First try to decide what to do without reference to lookahead token. */
- X
- X yyn = yypact[yystate];
- X if (yyn == YYFLAG)
- X goto yydefault;
- X
- X /* Not known => get a lookahead token if don't already have one. */
- X
- X /* yychar is either YYEMPTY or YYEOF
- X or a valid token in external form. */
- X
- X if (yychar == YYEMPTY)
- X {
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Reading a token: ");
- X#endif
- X yychar = YYLEX;
- X }
- X
- X /* Convert token to internal form (in yychar1) for indexing tables with */
- X
- X if (yychar <= 0) /* This means end of input. */
- X {
- X yychar1 = 0;
- X yychar = YYEOF; /* Don't call YYLEX any more */
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Now at end of input.\n");
- X#endif
- X }
- X else
- X {
- X yychar1 = YYTRANSLATE(yychar);
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
- X#endif
- X }
- X
- X yyn += yychar1;
- X if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- X goto yydefault;
- X
- X yyn = yytable[yyn];
- X
- X /* yyn is what to do for this token type in this state.
- X Negative => reduce, -yyn is rule number.
- X Positive => shift, yyn is new state.
- X New state is final state => don't bother to shift,
- X just return success.
- X 0, or most negative number => error. */
- X
- X if (yyn < 0)
- X {
- X if (yyn == YYFLAG)
- X goto yyerrlab;
- X yyn = -yyn;
- X goto yyreduce;
- X }
- X else if (yyn == 0)
- X goto yyerrlab;
- X
- X if (yyn == YYFINAL)
- X YYACCEPT;
- X
- X /* Shift the lookahead token. */
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
- X#endif
- X
- X /* Discard the token being shifted unless it is eof. */
- X if (yychar != YYEOF)
- X yychar = YYEMPTY;
- X
- X *++yyvsp = yylval;
- X#ifdef YYLSP_NEEDED
- X *++yylsp = yylloc;
- X#endif
- X
- X /* count tokens shifted since error; after three, turn off error status. */
- X if (yyerrstatus) yyerrstatus--;
- X
- X yystate = yyn;
- X goto yynewstate;
- X
- X/* Do the default action for the current state. */
- Xyydefault:
- X
- X yyn = yydefact[yystate];
- X if (yyn == 0)
- X goto yyerrlab;
- X
- X/* Do a reduction. yyn is the number of a rule to reduce with. */
- Xyyreduce:
- X yylen = yyr2[yyn];
- X yyval = yyvsp[1-yylen]; /* implement default value of the action */
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X {
- X int i;
- X
- X fprintf (stderr, "Reducing via rule %d (line %d), ",
- X yyn, yyrline[yyn]);
- X
- X /* Print the symboles being reduced, and their result. */
- X for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- X fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- X fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- X }
- X#endif
- X
- X
- X switch (yyn) {
- X
- Xcase 2:
- X#line 117 "gedcom.b"
- X{ clear_head(); ;
- X break;}
- Xcase 3:
- X#line 117 "gedcom.b"
- X{curr_file->header = &curr_head; ;
- X break;}
- Xcase 6:
- X#line 122 "gedcom.b"
- X{curr_head.source = yyvsp[0].str; ;
- X break;}
- Xcase 7:
- X#line 123 "gedcom.b"
- X{ curr_head.dest = yyvsp[0].str; ;
- X break;}
- Xcase 8:
- X#line 124 "gedcom.b"
- X{ curr_head.date = yyvsp[0].str; ;
- X break;}
- Xcase 9:
- X#line 125 "gedcom.b"
- X{ curr_head.charset = yyvsp[0].str; ;
- X break;}
- Xcase 10:
- X#line 126 "gedcom.b"
- X{curr_head.file = yyvsp[0].str; ;
- X break;}
- Xcase 11:
- X#line 128 "gedcom.b"
- X{clear_submitter();;
- X break;}
- Xcase 12:
- X#line 129 "gedcom.b"
- X{set_subm(curr_file,yyvsp[-3].str,&curr_submitter); ;
- X break;}
- Xcase 13:
- X#line 131 "gedcom.b"
- X{;
- X break;}
- Xcase 14:
- X#line 132 "gedcom.b"
- X{;
- X break;}
- Xcase 15:
- X#line 134 "gedcom.b"
- X{ curr_submitter.name = yyvsp[0].str; ;
- X break;}
- Xcase 16:
- X#line 135 "gedcom.b"
- X{ curr_submitter.phone = yyvsp[0].str;;
- X break;}
- Xcase 17:
- X#line 136 "gedcom.b"
- X{ curr_submitter.comments = yyvsp[0].comment;;
- X break;}
- Xcase 18:
- X#line 137 "gedcom.b"
- X{ curr_submitter.addr = yyvsp[0].address;;
- X break;}
- Xcase 19:
- X#line 138 "gedcom.b"
- X{ curr_submitter.stake = yyvsp[0].stake;;
- X break;}
- Xcase 20:
- X#line 140 "gedcom.b"
- X{ int i;
- X yyval.address = Calloc(struct address);
- X yyval.address->addr[0] = yyvsp[-1].str;
- X for(i=0; i< yyvsp[0].comment->lines; i++)
- X {
- X yyval.address->addr[i+1] = yyvsp[0].comment->line[i];
- X }
- X yyval.address->num = yyvsp[0].comment->lines+1;
- X free(yyvsp[0].comment->line);
- X free(yyvsp[0].comment);
- X ;
- X break;}
- Xcase 21:
- X#line 151 "gedcom.b"
- X{ yyval.address = Calloc(struct address);
- X yyval.address->addr[0] = yyvsp[0].str;
- X yyval.address->num = 1;;
- X break;}
- Xcase 22:
- X#line 155 "gedcom.b"
- X{ yyval.comment=Calloc(struct comment);yyval.comment->line=(char **)malloc(sizeof(char *)); yyval.comment->line[0] = yyvsp[0].str; yyval.comment->lines=1;;
- X break;}
- Xcase 23:
- X#line 156 "gedcom.b"
- X{yyval.comment=yyvsp[-2].comment; yyval.comment->line = (char **)realloc(yyval.comment->line,sizeof(char *) * (yyval.comment->lines+1));
- X yyval.comment->line[yyval.comment->lines++] = yyvsp[0].str; ;
- X break;}
- Xcase 24:
- X#line 159 "gedcom.b"
- X{int i; yyval.comment=Calloc(struct comment);yyval.comment->line=(char **)malloc(sizeof(char *) * (yyvsp[0].comment->lines+1));yyval.comment->line[0]=yyvsp[-1].str;
- X for(i=0;i<yyvsp[0].comment->lines;i++){yyval.comment->line[i+1]=yyvsp[0].comment->line[i]; }yyval.comment->lines = yyvsp[0].comment->lines+1; ;
- X break;}
- Xcase 25:
- X#line 161 "gedcom.b"
- X{yyval.comment=Calloc(struct comment);yyval.comment->line = (char **)malloc(sizeof(char *)); yyval.comment->line[0] = yyvsp[0].str;yyval.comment->lines =1;;
- X break;}
- Xcase 26:
- X#line 163 "gedcom.b"
- X{ yyval.stake=Calloc(struct stake);;
- X break;}
- Xcase 27:
- X#line 164 "gedcom.b"
- X{yyval.stake=Calloc(struct stake);yyval.stake->name=yyvsp[0].str; ;
- X break;}
- Xcase 28:
- X#line 165 "gedcom.b"
- X{yyval.stake=Calloc(struct stake);yyval.stake->num=yyvsp[0].str; ;
- X break;}
- Xcase 29:
- X#line 166 "gedcom.b"
- X{yyval.stake=Calloc(struct stake);
- X yyval.stake->name = yyvsp[-2].str;
- X yyval.stake->num = yyvsp[0].str;;
- X break;}
- Xcase 30:
- X#line 169 "gedcom.b"
- X{yyval.stake=Calloc(struct stake);
- X yyval.stake->name = yyvsp[0].str;
- X yyval.stake->num = yyvsp[-2].str;;
- X break;}
- Xcase 31:
- X#line 173 "gedcom.b"
- X{ ;
- X break;}
- Xcase 32:
- X#line 174 "gedcom.b"
- X{ ;
- X break;}
- Xcase 33:
- X#line 176 "gedcom.b"
- X{ ;
- X break;}
- Xcase 34:
- X#line 177 "gedcom.b"
- X{ ;
- X break;}
- Xcase 35:
- X#line 179 "gedcom.b"
- X{clear_indi(); ;
- X break;}
- Xcase 36:
- X#line 180 "gedcom.b"
- X{set_ind(curr_file,yyvsp[-3].str,&curr_ind); ;
- X break;}
- Xcase 37:
- X#line 182 "gedcom.b"
- X{ ;
- X break;}
- Xcase 38:
- X#line 183 "gedcom.b"
- X{ ;
- X break;}
- Xcase 39:
- X#line 185 "gedcom.b"
- X{ curr_ind.name = yyvsp[0].str; ;
- X break;}
- Xcase 40:
- X#line 186 "gedcom.b"
- X{ curr_ind.title = yyvsp[0].str;;
- X break;}
- Xcase 41:
- X#line 187 "gedcom.b"
- X{ curr_ind.sex = (yyvsp[0].str[0]? yyvsp[0].str[0]:(yyvsp[0].str[1]? yyvsp[0].str[1]: 'x'));
- X if( curr_ind.sex != 'M' && curr_ind.sex != 'F' )
- X fprintf(stderr,"Sex (%c) indecipherable line %d\n", curr_ind.sex,lineno);;
- X break;}
- Xcase 42:
- X#line 190 "gedcom.b"
- X{ curr_ind.givenref = yyvsp[0].str;;
- X break;}
- Xcase 43:
- X#line 191 "gedcom.b"
- X{ curr_ind.birth = yyvsp[0].datplace;;
- X break;}
- Xcase 44:
- X#line 192 "gedcom.b"
- X{ curr_ind.christen = yyvsp[0].datplace;;
- X break;}
- Xcase 45:
- X#line 193 "gedcom.b"
- X{ curr_ind.death = yyvsp[0].datplace;;
- X break;}
- Xcase 46:
- X#line 194 "gedcom.b"
- X{ curr_ind.burial = yyvsp[0].datplace;;
- X break;}
- Xcase 47:
- X#line 195 "gedcom.b"
- X{ curr_ind.baptism = yyvsp[0].ordinance;;
- X break;}
- Xcase 48:
- X#line 196 "gedcom.b"
- X{ curr_ind.endow = yyvsp[0].ordinance;;
- X break;}
- Xcase 49:
- X#line 197 "gedcom.b"
- X{ curr_ind.child_to_parent = yyvsp[0].ordinance;;
- X break;}
- Xcase 50:
- X#line 198 "gedcom.b"
- X{ curr_ind.flag = yyvsp[0].str;;
- X break;}
- Xcase 51:
- X#line 199 "gedcom.b"
- X{ add_spouse(&curr_ind,yyvsp[0].str); ;
- X break;}
- Xcase 52:
- X#line 200 "gedcom.b"
- X{ curr_ind.famc = yyvsp[0].str;;
- X break;}
- Xcase 53:
- X#line 201 "gedcom.b"
- X{ curr_ind.submitter = yyvsp[0].submitt->submitter;curr_ind.submitter_rel = yyvsp[0].submitt->rel;;
- X break;}
- Xcase 54:
- X#line 202 "gedcom.b"
- X{ curr_ind.destination_flag = yyvsp[0].str;;
- X break;}
- Xcase 55:
- X#line 203 "gedcom.b"
- X{ if(curr_ind.notes){
- X /* merge notes */
- X curr_ind.notes->notes++; /* increment the num of notes */
- X curr_ind.notes->note = (struct comment *)realloc(curr_ind.notes->note,sizeof(struct comment)*curr_ind.notes->notes);
- X curr_ind.notes->note[curr_ind.notes->notes-1].lines = yyvsp[0].notelist->note[0].lines;
- X curr_ind.notes->note[curr_ind.notes->notes-1].line = yyvsp[0].notelist->note[0].line;
- X yyvsp[0].notelist->note[0].line = 0;
- X free(yyvsp[0].notelist->note[0]);
- X free(yyvsp[0].notelist);
- X } else {
- X /* stick in */
- X curr_ind.notes = yyvsp[0].notelist;
- X };
- X break;}
- Xcase 56:
- X#line 216 "gedcom.b"
- X{ yyval.datplace = yyvsp[0].datplace; ;
- X break;}
- Xcase 57:
- X#line 218 "gedcom.b"
- X{yyval.datplace = Calloc(struct datplace); yyval.datplace->date = yyvsp[0].str; ;
- X break;}
- Xcase 58:
- X#line 219 "gedcom.b"
- X{yyval.datplace = Calloc(struct datplace); yyval.datplace->place = yyvsp[0].str; ;
- X break;}
- Xcase 59:
- X#line 220 "gedcom.b"
- X{yyval.datplace = Calloc(struct datplace); yyval.datplace->place = yyvsp[0].str;yyval.datplace->date = yyvsp[-2].str; ;
- X break;}
- Xcase 60:
- X#line 221 "gedcom.b"
- X{yyval.datplace = Calloc(struct datplace); yyval.datplace->place = yyvsp[-2].str;yyval.datplace->date = yyvsp[0].str; ;
- X break;}
- Xcase 61:
- X#line 223 "gedcom.b"
- X{yyval.datplace=yyvsp[0].datplace; ;
- X break;}
- Xcase 62:
- X#line 225 "gedcom.b"
- X{yyval.datplace=yyvsp[0].datplace; ;
- X break;}
- Xcase 63:
- X#line 227 "gedcom.b"
- X{yyval.datplace=yyvsp[0].datplace; ;
- X break;}
- Xcase 64:
- X#line 229 "gedcom.b"
- X{ yyval.ordinance=yyvsp[0].ordinance; yyval.ordinance->val = yyvsp[-1].str;;
- X break;}
- Xcase 65:
- X#line 230 "gedcom.b"
- X{ yyval.ordinance= Calloc(struct ordinance); yyval.ordinance->val = yyvsp[0].str;;
- X break;}
- Xcase 66:
- X#line 232 "gedcom.b"
- X{yyval.ordinance=yyvsp[0].ordinance; ;
- X break;}
- Xcase 67:
- X#line 233 "gedcom.b"
- X{ yyval.ordinance =yyvsp[-1].ordinance;
- X copytempitem(yyval.ordinance,yyvsp[0].ordinance);;
- X break;}
- Xcase 68:
- X#line 236 "gedcom.b"
- X{ yyval.ordinance = Calloc(struct ordinance); yyval.ordinance->date=yyvsp[0].str;;
- X break;}
- Xcase 69:
- X#line 237 "gedcom.b"
- X{ yyval.ordinance = Calloc(struct ordinance); strcpy(yyval.ordinance->temp,yyvsp[0].str);;
- X break;}
- Xcase 70:
- X#line 238 "gedcom.b"
- X{ yyval.ordinance = Calloc(struct ordinance); yyval.ordinance->qual=yyvsp[0].str;;
- X break;}
- Xcase 71:
- X#line 240 "gedcom.b"
- X{yyval.ordinance=yyvsp[0].ordinance; ;
- X break;}
- Xcase 72:
- X#line 241 "gedcom.b"
- X{yyval.ordinance =yyvsp[-1].ordinance;
- X copytempitem(yyval.ordinance,yyvsp[0].ordinance); ;
- X break;}
- Xcase 73:
- X#line 244 "gedcom.b"
- X{ yyval.ordinance = Calloc(struct ordinance); yyval.ordinance->date=yyvsp[0].str; ;
- X break;}
- Xcase 74:
- X#line 245 "gedcom.b"
- X{ yyval.ordinance = Calloc(struct ordinance); strcpy(yyval.ordinance->temp,yyvsp[0].str); ;
- X break;}
- Xcase 75:
- X#line 246 "gedcom.b"
- X{ yyval.ordinance = Calloc(struct ordinance); yyval.ordinance->qual=yyvsp[0].str; ;
- X break;}
- Xcase 76:
- X#line 248 "gedcom.b"
- X{ yyval.ordinance=yyvsp[0].ordinance; yyval.ordinance->val = yyvsp[-1].str; ;
- X break;}
- Xcase 77:
- X#line 249 "gedcom.b"
- X{yyval.ordinance= Calloc(struct ordinance); yyval.ordinance->val = yyvsp[0].str; ;
- X break;}
- Xcase 78:
- X#line 251 "gedcom.b"
- X{ yyval.ordinance=yyvsp[0].ordinance;yyval.ordinance->val = yyvsp[-1].str; ;
- X break;}
- Xcase 79:
- X#line 252 "gedcom.b"
- X{yyval.ordinance= Calloc(struct ordinance); yyval.ordinance->val = yyvsp[0].str;;
- X break;}
- Xcase 80:
- X#line 254 "gedcom.b"
- X{ yyval.ordinance=Calloc(struct ordinance); yyval.ordinance->val = yyvsp[0].str;;
- X break;}
- Xcase 81:
- X#line 255 "gedcom.b"
- X{yyval.ordinance=yyvsp[0].ordinance; yyval.ordinance->val = yyvsp[-1].str; ;
- X break;}
- Xcase 82:
- X#line 257 "gedcom.b"
- X{yyval.submitt=Calloc(struct submitt); yyval.submitt->submitter = yyvsp[0].str; ;
- X break;}
- Xcase 83:
- X#line 258 "gedcom.b"
- X{yyval.submitt=Calloc(struct submitt); yyval.submitt->submitter = yyvsp[-2].str; yyval.submitt->rel = yyvsp[0].str; ;
- X break;}
- Xcase 84:
- X#line 260 "gedcom.b"
- X{ yyval.notelist=Calloc(struct notelist); yyval.notelist->note=Calloc(struct comment); yyval.notelist->note[0].lines=1;
- X yyval.notelist->note[0].line = Calloc(char *); yyval.notelist->note[0].line[0] = yyvsp[0].str; yyval.notelist->notes=1;yyval.notelist->note[0].lines = 1;;
- X break;}
- Xcase 85:
- X#line 262 "gedcom.b"
- X{int i;
- X yyval.notelist=Calloc(struct notelist);
- X yyval.notelist->note=yyvsp[0].comment;
- X yyval.notelist->note[0].line = (char **)realloc(yyval.notelist->note[0].line,sizeof(char *)*(yyvsp[0].comment->lines+1));
- X yyval.notelist->notes=1;
- X for(i=yyvsp[0].comment->lines; i; i--)
- X {yyvsp[0].comment->line[i]=yyvsp[0].comment->line[i-1];}
- X yyvsp[0].comment->line[0] = yyvsp[-1].str;yyvsp[0].comment->lines++;;
- X break;}
- Xcase 86:
- X#line 273 "gedcom.b"
- X{clear_fam();;
- X break;}
- Xcase 87:
- X#line 274 "gedcom.b"
- X{set_fam(curr_file,yyvsp[-3].str,&curr_fam);;
- X break;}
- Xcase 88:
- X#line 276 "gedcom.b"
- X{ ;
- X break;}
- Xcase 89:
- X#line 277 "gedcom.b"
- X{ ;
- X break;}
- Xcase 90:
- X#line 279 "gedcom.b"
- X{curr_fam.husb = yyvsp[0].str; ;
- X break;}
- Xcase 91:
- X#line 280 "gedcom.b"
- X{curr_fam.wife = yyvsp[0].str; ;
- X break;}
- Xcase 92:
- X#line 281 "gedcom.b"
- X{ add_child(&curr_fam, yyvsp[0].child); ;
- X break;}
- Xcase 93:
- X#line 282 "gedcom.b"
- X{curr_fam.marriage = yyvsp[0].datplace; ;
- X break;}
- Xcase 94:
- X#line 283 "gedcom.b"
- X{curr_fam.sealspouse = yyvsp[0].ordinance; ;
- X break;}
- Xcase 95:
- X#line 284 "gedcom.b"
- X{curr_fam.divorce = 1; ;
- X break;}
- Xcase 96:
- X#line 285 "gedcom.b"
- X{ curr_fam.dest = yyvsp[0].str;;
- X break;}
- Xcase 97:
- X#line 286 "gedcom.b"
- X{ curr_fam.flag = yyvsp[0].str;;
- X break;}
- Xcase 98:
- X#line 287 "gedcom.b"
- X{ curr_fam.submitter = yyvsp[0].submitt->submitter;
- X curr_fam.submitter_rel = yyvsp[0].submitt->rel;;
- X break;}
- Xcase 99:
- X#line 290 "gedcom.b"
- X{ yyval.child=Calloc(struct child);yyval.child->ref=yyvsp[0].str;;
- X break;}
- Xcase 100:
- X#line 291 "gedcom.b"
- X{yyval.child=Calloc(struct child);yyval.child->ref = yyvsp[-2].str; yyval.child->slgc =yyvsp[0].ordinance; ;
- X break;}
- Xcase 101:
- X#line 293 "gedcom.b"
- X{yyval.datplace=yyvsp[0].datplace; ;
- X break;}
- Xcase 102:
- X#line 295 "gedcom.b"
- X{yyval.ordinance=yyvsp[0].ordinance; yyval.ordinance->val = yyvsp[-1].str;;
- X break;}
- Xcase 103:
- X#line 296 "gedcom.b"
- X{yyval.ordinance= Calloc(struct ordinance); yyval.ordinance->val = yyvsp[0].str; ;
- X break;}
- Xcase 104:
- X#line 298 "gedcom.b"
- X{;
- X break;}
- X}
- X /* the action file gets copied in in place of this dollarsign */
- X#line 423 "bison.simple"
- X
- X yyvsp -= yylen;
- X yyssp -= yylen;
- X#ifdef YYLSP_NEEDED
- X yylsp -= yylen;
- X#endif
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X {
- X short *ssp1 = yyss - 1;
- X fprintf (stderr, "state stack now");
- X while (ssp1 != yyssp)
- X fprintf (stderr, " %d", *++ssp1);
- X fprintf (stderr, "\n");
- X }
- X#endif
- X
- X *++yyvsp = yyval;
- X
- X#ifdef YYLSP_NEEDED
- X yylsp++;
- X if (yylen == 0)
- X {
- X yylsp->first_line = yylloc.first_line;
- X yylsp->first_column = yylloc.first_column;
- X yylsp->last_line = (yylsp-1)->last_line;
- X yylsp->last_column = (yylsp-1)->last_column;
- X yylsp->text = 0;
- X }
- X else
- X {
- X yylsp->last_line = (yylsp+yylen-1)->last_line;
- X yylsp->last_column = (yylsp+yylen-1)->last_column;
- X }
- X#endif
- X
- X /* Now "shift" the result of the reduction.
- X Determine what state that goes to,
- X based on the state we popped back to
- X and the rule number reduced by. */
- X
- X yyn = yyr1[yyn];
- X
- X yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- X if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- X yystate = yytable[yystate];
- X else
- X yystate = yydefgoto[yyn - YYNTBASE];
- X
- X goto yynewstate;
- X
- Xyyerrlab: /* here on detecting error */
- X
- X if (! yyerrstatus)
- X /* If not already recovering from an error, report this error. */
- X {
- X ++yynerrs;
- X
- X#ifdef YYERROR_VERBOSE
- X yyn = yypact[yystate];
- X
- X if (yyn > YYFLAG && yyn < YYLAST)
- X {
- X int size = 0;
- X char *msg;
- X int x, count;
- X
- X count = 0;
- X for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
- X if (yycheck[x + yyn] == x)
- X size += strlen(yytname[x]) + 15, count++;
- X msg = (char *) xmalloc(size + 15);
- X strcpy(msg, "parse error");
- X
- X if (count < 5)
- X {
- X count = 0;
- X for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
- X if (yycheck[x + yyn] == x)
- X {
- X strcat(msg, count == 0 ? ", expecting `" : " or `");
- X strcat(msg, yytname[x]);
- X strcat(msg, "'");
- X count++;
- X }
- X }
- X yyerror(msg);
- X free(msg);
- X }
- X else
- X#endif /* YYERROR_VERBOSE */
- X yyerror("parse error");
- X }
- X
- Xyyerrlab1: /* here on error raised explicitly by an action */
- X
- X if (yyerrstatus == 3)
- X {
- X /* if just tried and failed to reuse lookahead token after an error, discard it. */
- X
- X /* return failure if at end of input */
- X if (yychar == YYEOF)
- X YYABORT;
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
- X#endif
- X
- X yychar = YYEMPTY;
- X }
- X
- X /* Else will try to reuse lookahead token
- X after shifting the error token. */
- X
- X yyerrstatus = 3; /* Each real token shifted decrements this */
- X
- X goto yyerrhandle;
- X
- Xyyerrdefault: /* current state does not do anything special for the error token. */
- X
- X#if 0
- X /* This is wrong; only states that explicitly want error tokens
- X should shift them. */
- X yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- X if (yyn) goto yydefault;
- X#endif
- X
- Xyyerrpop: /* pop the current state because it cannot handle the error token */
- X
- X if (yyssp == yyss) YYABORT;
- X yyvsp--;
- X yystate = *--yyssp;
- X#ifdef YYLSP_NEEDED
- X yylsp--;
- X#endif
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X {
- X short *ssp1 = yyss - 1;
- X fprintf (stderr, "Error: state stack now");
- X while (ssp1 != yyssp)
- X fprintf (stderr, " %d", *++ssp1);
- X fprintf (stderr, "\n");
- X }
- X#endif
- X
- Xyyerrhandle:
- X
- X yyn = yypact[yystate];
- X if (yyn == YYFLAG)
- X goto yyerrdefault;
- X
- X yyn += YYTERROR;
- X if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- X goto yyerrdefault;
- X
- X yyn = yytable[yyn];
- X if (yyn < 0)
- X {
- X if (yyn == YYFLAG)
- X goto yyerrpop;
- X yyn = -yyn;
- X goto yyreduce;
- X }
- X else if (yyn == 0)
- X goto yyerrpop;
- X
- X if (yyn == YYFINAL)
- X YYACCEPT;
- X
- X#if YYDEBUG != 0
- X if (yydebug)
- X fprintf(stderr, "Shifting error token, ");
- X#endif
- X
- X *++yyvsp = yylval;
- X#ifdef YYLSP_NEEDED
- X *++yylsp = yylloc;
- X#endif
- X
- X yystate = yyn;
- X goto yynewstate;
- X}
- X#line 300 "gedcom.b"
- X
- Xvoid copytempitem(a,b)
- Xstruct ordinance *a,*b;
- X{
- X if( b->val )
- X a->val = b->val;
- X if(b->date)
- X a->date = b->date;
- X if(b->temp[0] )
- X strcpy(a->temp,b->temp);
- X if(b->qual)
- X a->qual = b->qual;
- X free(b);
- X}
- X
- Xvoid clear_indi()
- X{
- X curr_ind.name = 0;
- X curr_ind.title = 0;
- X curr_ind.sex = 0;
- X curr_ind.givenref = 0;
- X curr_ind.birth = 0;
- X curr_ind.christen = 0;
- X curr_ind.death = 0;
- X curr_ind.burial = 0;
- X curr_ind.baptism = 0;
- X curr_ind.endow = 0;
- X curr_ind.child_to_parent = 0;
- X curr_ind.flag = 0;
- X curr_ind.fams = 0;
- X curr_ind.famc = 0;
- X curr_ind.submitter = 0;
- X curr_ind.submitter_rel = 0;
- X curr_ind.destination_flag = 0;
- X curr_ind.notes = 0;
- X}
- X
- Xstatic int add_ind(ged,ip)
- Xstruct gedfile *ged;
- Xstruct individ *ip;
- X{
- X struct indivlist *x=ged->indlist;
- X if( !ged->indlist )
- X x = ged->indlist = Calloc(struct indivlist);
- X if( !x->allocd )
- X {
- X x->allocd += 20;
- X x->ind = Callocs(struct individ *,20);
- X }
- X if( x->num == x->allocd )
- X {
- X x->allocd += 20;
- X x->ind = (struct individ **)realloc(x->ind,x->allocd*sizeof(struct individ *));
- X }
- X ip->index = x->num;
- X x->ind[x->num++] = ip;
- X return ip->index;
- X}
- X
- Xstruct individ *set_ind(ged,ref,curr_in)
- Xstruct gedfile *ged;
- Xchar *ref;
- Xstruct individ *curr_in;
- X{
- X struct individ *ind;
- X
- X if( !ged->indiv )
- X {
- X ged->indiv = st_init_table(strcmp,st_strhash);
- X }
- X ind = Calloc(struct individ);
- X *ind = *curr_in;
- X st_insert(ged->indiv,ref,(char *)ind);
- X ind->ref = ref;
- X add_ind(ged,ind);
- X return ind;
- X}
- X
- Xvoid clear_fam()
- X{
- X curr_fam.husb = 0;
- X curr_fam.wife = 0;
- X curr_fam.kids = 0;
- X curr_fam.marriage = 0;
- X curr_fam.sealspouse = 0;
- X curr_fam.divorce = 0;
- X curr_fam.dest = 0;
- X curr_fam.flag = 0;
- X curr_fam.submitter = 0;
- X curr_fam.submitter_rel = 0;
- X}
- Xstruct family *set_fam(ged,ref,curr_fa)
- Xchar *ref;
- Xstruct gedfile *ged;
- Xstruct family *curr_fa;
- X{
- X struct family *fam;
- X
- X if( !ged->families )
- X {
- X ged->families = st_init_table(strcmp,st_strhash);
- X }
- X fam = Calloc(struct family);
- X *fam = *curr_fa;
- X st_insert(ged->families,ref,(char *)fam);
- X fam->ref = ref;
- X add_fam(ged,fam);
- X return fam;
- X}
- X
- Xstatic int add_fam(ged,fp)
- Xstruct family *fp;
- Xstruct gedfile *ged;
- X{
- X struct famlylist *x=ged->famlist;
- X if( !ged->famlist )
- X x = ged->famlist = Calloc(struct famlylist);
- X if( !x->allocd )
- X {
- X x->allocd += 20;
- X x->fam = Callocs(struct family *,20);
- X }
- X if( x->num == x->allocd )
- X {
- X x->allocd += 20;
- X x->fam = (struct family **)realloc(x->fam,x->allocd*sizeof(struct family *));
- X }
- X fp->index = x->num;
- X x->fam[x->num++] = fp;
- X return fp->index;
- X}
- X
- Xvoid clear_head() /* blow nose? */
- X{
- X curr_head.source = 0;
- X curr_head.dest = 0;
- X curr_head.date = 0;
- X curr_head.file = 0;
- X curr_head.charset = 0;
- X}
- X
- Xvoid add_submitter(ged,ip)
- Xstruct submitter *ip;
- Xstruct gedfile *ged;
- X{
- X struct submitlist *x=ged->submitlist;
- X if( !ged->submitlist )
- X x = ged->submitlist = Calloc(struct submitlist);
- X if( !x->allocd )
- X {
- X x->allocd += 20;
- X x->subm = Callocs(struct submitter *,20);
- X }
- X if( x->num == x->allocd )
- X {
- X x->allocd += 20;
- X x->subm = (struct submitter **)realloc(x->subm,x->allocd*sizeof(struct submitter *));
- X }
- X ip->index = x->num;
- X x->subm[x->num++] = ip;
- X}
- Xvoid set_subm(ged,ref,curr_submitte)
- Xchar *ref;
- Xstruct gedfile *ged;
- Xstruct submitter *curr_submitte;
- X{
- X struct submitter *ind;
- X
- X if( !ged->submits )
- X {
- X ged->submits = st_init_table(strcmp,st_strhash);
- X }
- X ind = Calloc(struct submitter);
- X *ind = *curr_submitte;
- X st_insert(ged->submits,ref,(char *)ind);
- X add_submitter(ged,ind);
- X}
- X
- Xvoid clear_submitter()
- X{
- X curr_submitter.name = 0;
- X curr_submitter.addr = 0;
- X curr_submitter.phone = 0;
- X curr_submitter.stake = 0;
- X curr_submitter.comments = 0;
- X curr_submitter.index = 0;
- X}
- X
- Xvoid clear_gedfile()
- X{
- X curr_file->header = 0;
- X curr_file->submission = 0;
- X curr_file->indiv = 0;
- X curr_file->families = 0;
- X curr_file->submits = 0;
- X curr_file->indlist = 0;
- X curr_file->famlist = 0;
- X curr_file->submitlist = 0;
- X}
- X
- X
- Xvoid yyerror(s)
- Xchar *s;
- X{
- X extern int lineno;
- X fprintf(stderr,"Parse error in line %d\n",lineno);
- X}
- X
- Xadd_spouse(ind,ref)
- Xstruct individ *ind;
- Xchar *ref;
- X{
- X if( !ind->fams)
- X {
- X ind->fams = Calloc(struct famlist);
- X ind->fams->family_refs = (char **)malloc(sizeof(char *));
- X ind->fams->family_refs[ind->fams->num++] = ref;
- X }
- X else
- X {
- X ind->fams->family_refs = (char **)
- X realloc(ind->fams->family_refs,
- X sizeof(char *)*(ind->fams->num+1));
- X ind->fams->family_refs[ind->fams->num++] = ref;
- X }
- X}
- X
- Xadd_child(fam,chil)
- Xstruct family *fam;
- Xstruct child *chil;
- X{
- X if(!fam->kids)
- X {
- X fam->kids=Calloc(struct child_list);
- X fam->kids->kid=Calloc(struct child);
- X fam->kids->kid[0] = *chil;
- X fam->kids->kids=1;
- X }
- X else
- X {
- X fam->kids->kid=(struct child *)realloc(fam->kids->kid,
- X sizeof(struct child)*(fam->kids->kids+1));
- X fam->kids->kid[fam->kids->kids++] = *chil;
- X }
- X}
- SHAR_EOF
- $TOUCH -am 0103115092 gedcom.b.tab.c &&
- chmod 0664 gedcom.b.tab.c ||
- echo "restore of gedcom.b.tab.c failed"
- set `wc -c gedcom.b.tab.c`;Wc_c=$1
- if test "$Wc_c" != "46972"; then
- echo original size 46972, current size $Wc_c
- fi
- echo "End of part 6, continue with part 7"
- exit 0
-
- exit 0 # Just in case...
-