home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / FTREE0.3.LHA / ftree / src / RCS / parse.y,v < prev    next >
Encoding:
Text File  |  1994-04-27  |  15.9 KB  |  901 lines

  1. head    1.7;
  2. access;
  3. symbols
  4.     stage1:1.7;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.7
  10. date    94.03.10.21.28.26;    author peteric;    state Exp;
  11. branches;
  12. next    1.6;
  13.  
  14. 1.6
  15. date    94.03.07.12.55.17;    author peteric;    state Exp;
  16. branches;
  17. next    1.5;
  18.  
  19. 1.5
  20. date    94.03.01.23.26.51;    author peteric;    state Exp;
  21. branches;
  22. next    1.4;
  23.  
  24. 1.4
  25. date    94.02.27.19.36.12;    author peteric;    state Exp;
  26. branches;
  27. next    1.3;
  28.  
  29. 1.3
  30. date    94.02.13.16.44.05;    author peteric;    state Exp;
  31. branches;
  32. next    1.2;
  33.  
  34. 1.2
  35. date    94.02.12.20.00.22;    author peteric;    state Exp;
  36. branches;
  37. next    1.1;
  38.  
  39. 1.1
  40. date    94.02.12.19.52.42;    author peteric;    state Exp;
  41. branches;
  42. next    ;
  43.  
  44.  
  45. desc
  46. @bison parser for ftree database files.
  47. @
  48.  
  49.  
  50. 1.7
  51. log
  52. @Multiple pages working!
  53. @
  54. text
  55. @/*************************************************************************
  56.  *
  57.  *     $Name$
  58.  *
  59.  *    $Author: peteric $
  60.  *
  61.  *    $Date: 1994/03/07 12:55:17 $
  62.  *
  63.  *    $Revision: 1.6 $
  64.  *
  65.  *    Purpose:    Parser for ftree database files.
  66.  *            
  67.  *    $Log: parse.y,v $
  68.  * Revision 1.6  1994/03/07  12:55:17  peteric
  69.  * Passed on as first Version.
  70.  *
  71.  * Revision 1.5  1994/03/01  23:26:51  peteric
  72.  * made ticklen number specified in inches.
  73.  *
  74.  * Revision 1.4  1994/02/27  19:36:12  peteric
  75.  * changed error reporting functions. Mods to add_child to
  76.  * create doubly linked list. added new marriage code & options.
  77.  *
  78.  * Revision 1.3  1994/02/13  16:44:05  peteric
  79.  * Added new notitlebox & titlebox options to modify the title
  80.  * behaviour.
  81.  *
  82.  * Revision 1.2  1994/02/12  20:00:22  peteric
  83.  * added in comments etc.
  84.  *
  85.  *    
  86.  *
  87.  *************************************************************************/
  88.  
  89. %union
  90. {
  91.     long int inum;
  92.     char *txt;
  93.     float fnum;
  94. }
  95.  
  96. %{
  97.  
  98. #include <string.h>
  99. #include <stdlib.h>
  100. #include "ftree.h"
  101.  
  102. static id_t current_wife_id;
  103. static id_t current_husband_id;
  104. static person_t *current_child, *first_child;
  105. static date_t current_date, marriage_date;
  106. static person_t current_person;
  107. static enum mstate_t marriage_state;
  108. static enum mhint_t marriage_hint;
  109. static void parsedate(int month, int day, int year);
  110. static marriage_t *previous_marriage;
  111. static char *marriage_chart;
  112.  
  113. %}
  114.  
  115. %token PERSON ID STRING MONTH INT NUM BORNON DIEDON
  116. %token OCCUPATION MARRIED WIFE HUSBAND MARRIAGE QMARK
  117. %token OPENBRA CLOSEBRA COMMA DASH SLASH CHILDREN
  118. %token SEX MALE FEMALE LIVING DEAD FIRSTNAME FAMILY
  119. %token VSPACE OUTPUTFILE POINTSIZE IDENT FONT 
  120. %token SYMBOL DATE PERSON TITLE PAGESIZE TICKLEN 
  121. %token ORIENTATION LANDSCAPE PORTRAIT OPTION ROOT
  122. %token DIVORCED SEPARATED BAPTISED TITLEBOX NOTITLEBOX
  123. %token LEFT RIGHT BAD THEN HSPACE MULTIPAGE CHARTREF
  124. %token WIDOWED
  125. %start file
  126.  
  127. %type <inum> INT MONTH month day year ID
  128. %type <txt> STRING
  129. %type <fnum> NUM
  130.  
  131. %%
  132. file        :    stmt_l
  133.         |    blank
  134.  
  135. stmt_l        :    stmt
  136.         |    stmt_l stmt
  137.  
  138.  
  139. stmt        :    stmtperson
  140.         |    stmtmarriage
  141.         |    stmtoption
  142.  
  143. blank        :    
  144.  
  145. stmtperson    :    PERSON
  146.             {
  147.                 current_person.living = L_UNKNOWN;
  148.                 current_person.sex = S_UNKNOWN;
  149.                 clear_date(¤t_person.born);
  150.                 clear_date(¤t_person.bapt);
  151.                 clear_date(¤t_person.died);
  152.                 current_person.occupation[0] = '\0';
  153.                 current_person.id = 0;
  154.                 current_person.firstname[0] = '\0';
  155.                 current_person.family[0] = '\0';
  156.             }
  157.             id OPENBRA persdetails CLOSEBRA
  158.             {
  159.                 makeperson(¤t_person);
  160.             }
  161.         |    error CLOSEBRA
  162.             {
  163.                 errmsg("badly formed person construct\n");
  164.             }
  165.  
  166. id        :    ID
  167.             {
  168.                 current_person.id = $1;
  169.             }
  170.         |    blank
  171.             {
  172.                 current_person.id = NOID;
  173.             }
  174.         |    error
  175.             {
  176.                 errmsg("expected ID code\n");
  177.             }
  178.  
  179.  
  180. persdetails    :    blank
  181.         |    persdetail_l
  182.  
  183. persdetail_l     :    persdetail
  184.         |    persdetail_l comma persdetail
  185.             
  186. persdetail    :    BORNON date
  187.             {
  188.                 if (current_person.born.known)
  189.                     warnmsg("born specified more than once\n");
  190.                 current_person.born = current_date;
  191.                 current_date.known = 0;
  192.             }
  193.         |    LIVING
  194.             {
  195.                 if (current_person.living != L_UNKNOWN)
  196.                     warnmsg("living specified more than once\n");
  197.                 current_person.living = L_LIVING;
  198.             }
  199.         |    DEAD
  200.             {
  201.                 if (current_person.living != L_UNKNOWN)
  202.                     warnmsg("dead or diedon already specified\n");
  203.                 current_person.living = L_DEAD;
  204.             }
  205.         |    BAPTISED date
  206.             {
  207.                 if (current_person.living != L_UNKNOWN)
  208.                     warnmsg("living specified more than once\n");
  209.                 current_person.bapt = current_date;
  210.                 current_date.known = 0;
  211.             }
  212.         |    DIEDON date
  213.             {
  214.                 if (current_person.living != L_UNKNOWN)
  215.                     warnmsg("living specified more than once\n");
  216.                 current_person.died = current_date;
  217.                 current_date.known = 0;
  218.                 current_person.living = L_DEAD;
  219.             }
  220.         |    SEX FEMALE
  221.             {
  222.                 if (current_person.sex != S_UNKNOWN)
  223.                     warnmsg("sex already specified\n");
  224.                 current_person.sex = S_FEMALE;
  225.             }
  226.         |    SEX MALE
  227.             {
  228.                 if (current_person.sex != S_UNKNOWN)
  229.                     warnmsg("sex already specified\n");
  230.                 current_person.sex = S_MALE;
  231.             }
  232.         |    OCCUPATION STRING
  233.             {
  234.                 if (current_person.occupation[0] != '\0')
  235.                     warnmsg("occupation already specified\n");
  236.                 strcpy(current_person.occupation, $2);
  237.             }
  238.         |    FIRSTNAME STRING
  239.             {
  240.                 if (current_person.firstname[0] != '\0')
  241.                     errmsg("first name '%s' already specified\n", $2);
  242.                 if (strlen($2) > NAMELEN)
  243.                 {
  244.                     warnmsg("first name '%s' too long; name truncated to %d characters\n", $2, NAMELEN);
  245.                     strncpy(current_person.firstname, $2, NAMELEN);
  246.                     current_person.firstname[NAMELEN-1] = '\0';
  247.                 }
  248.                 else
  249.                     strcpy(current_person.firstname, $2);
  250.             }
  251.         |    FAMILY STRING
  252.             {
  253.                 if (current_person.family[0] != '\0')
  254.                     errmsg("family name '%s' already specified\n", $2);
  255.                 if (strlen($2) > NAMELEN)
  256.                 {
  257.                     warnmsg("family name '%s' too long; name truncated to %d characters\n", $2, NAMELEN);
  258.                     strncpy(current_person.family, $2, NAMELEN);
  259.                     current_person.family[NAMELEN-1] = '\0';
  260.                 }
  261.                 else
  262.                     strcpy(current_person.family, $2);
  263.             }
  264.         |    error CLOSEBRA
  265.             {
  266.                 warnmsg("unexpected word in person details list\n");
  267.             }
  268.  
  269. stmtoption    :    OPTION OPENBRA optdetails CLOSEBRA
  270.  
  271. optdetails    :    blank
  272.         |    optdetail_l
  273.  
  274. optdetail_l     :    optdetail
  275.         |    optdetail_l comma optdetail
  276.             
  277. optdetail    :    VSPACE NUM
  278.             {
  279.                 glob_opts->vspace = (int)($2 * INCH);
  280.             }
  281.         |    HSPACE NUM
  282.             {
  283.                 glob_opts->tree_gap = (int)($2 * INCH);
  284.             }
  285.         |    ROOT ID
  286.             {
  287.                 glob_opts->startperson = $2;
  288.             }
  289.         |    OUTPUTFILE STRING
  290.             {
  291.                 char *s = (char*)malloc(strlen($2)+1);
  292.                 strcpy(s, $2);
  293.                 glob_opts->outputfile = s;
  294.             }
  295.         |    NOTITLEBOX
  296.             {
  297.                 glob_opts->titlegreylevel = 1.0;
  298.             }
  299.         |    MULTIPAGE
  300.             {
  301.                 glob_opts->multipage = TRUE;
  302.             }
  303.         |    TITLEBOX NUM
  304.             {
  305.                 glob_opts->titlegreylevel = $2;
  306.             }
  307.         |    IDENT POINTSIZE NUM
  308.             {
  309.                 glob_opts->identfont.size = $3;
  310.             }
  311.         |    IDENT FONT STRING
  312.             {
  313.                 char *s = (char*)malloc(strlen($3)+1);
  314.                 strcpy(s, $3);
  315.                 glob_opts->titlefont.font = s;
  316.             }
  317.         |    SYMBOL POINTSIZE NUM
  318.             {
  319.                 glob_opts->symfont.size = $3;
  320.             }
  321.         |    SYMBOL FONT STRING
  322.             {
  323.                 char *s = (char*)malloc(strlen($3)+1);
  324.                 strcpy(s, $3);
  325.                 glob_opts->symfont.font = s;
  326.             }
  327.         |    DATE POINTSIZE NUM
  328.             {
  329.                 glob_opts->datefont.size = $3;
  330.             }
  331.         |    DATE FONT STRING
  332.             {
  333.                 char *s = (char*)malloc(strlen($3)+1);
  334.                 strcpy(s, $3);
  335.                 glob_opts->datefont.font = s;
  336.             }
  337.         |    PERSON POINTSIZE NUM
  338.             {
  339.                 glob_opts->personfont.size = $3;
  340.             }
  341.         |    PERSON FONT STRING
  342.             {
  343.                 char *s = (char*)malloc(strlen($3)+1);
  344.                 strcpy(s, $3);
  345.                 glob_opts->personfont.font = s;
  346.             }
  347.         |    TITLE STRING
  348.             {
  349.                 char *s = (char*)malloc(strlen($2)+1);
  350.                 strcpy(s, $2);
  351.                 glob_opts->titlestr = s;
  352.             }
  353.         |    TITLE POINTSIZE NUM
  354.             {
  355.                 glob_opts->titlefont.size = $3;
  356.             }
  357.         |    TITLE FONT STRING
  358.             {
  359.                 char *s = (char*)malloc(strlen($3)+1);
  360.                 strcpy(s, $3);
  361.                 glob_opts->titlefont.font = s;
  362.             }
  363.         |    PAGESIZE STRING
  364.             {
  365.                 char *s = (char*)malloc(strlen($2)+1);
  366.                 strcpy(s, $2);
  367.                 glob_opts->papertype = s;
  368.             }
  369.         |    TICKLEN NUM
  370.             {
  371.                 glob_opts->ticklen = $2 * INCH;
  372.             }
  373.         |    ORIENTATION LANDSCAPE
  374.             {
  375.                 glob_opts->landscape = TRUE;
  376.             }
  377.         |    ORIENTATION PORTRAIT
  378.             {
  379.                 glob_opts->landscape = FALSE;
  380.             }
  381.         |    error CLOSEBRA
  382.             {
  383.                 errmsg("unexpected word in options list!\n");
  384.             }
  385.  
  386.  
  387. stmtmarriage    :    MARRIAGE
  388.             {
  389.                 previous_marriage = NULL;
  390.             }
  391.             marriage_def more_marriages
  392.  
  393. more_marriages    :    blank
  394.         |    comma more_marriage_l
  395.  
  396. more_marriage_l    :    THEN marriage_def
  397.         |    more_marriage_l comma THEN marriage_def 
  398.  
  399.  
  400. marriage_def    :    OPENBRA
  401.             {
  402.                 current_child = first_child = NULL;
  403.                 current_husband_id = NOID;
  404.                 current_wife_id = NOID;
  405.                 clear_date(¤t_date);
  406.                 clear_date(&marriage_date);
  407.                 marriage_chart = NULL;
  408.                 marriage_state = M_MARRIED;
  409.                 marriage_hint = H_CENTERED;
  410.             }
  411.             marriage_l CLOSEBRA
  412.             {
  413.                 if (verbose && !marriage_date.known)
  414.                     warnmsg("marriage date not specified\n");
  415.  
  416.                 if (current_wife_id == NOID || current_husband_id == NOID)
  417.                     errmsg("cannot construct a marriage unless both people are identified.\n");
  418.                 else
  419.                     previous_marriage = makemarriage(previous_marriage, current_husband_id, current_wife_id,
  420.                         marriage_date, marriage_state, marriage_hint,
  421.                         first_child, current_child);
  422.             }
  423.  
  424. marriage_l     :    marrdetail
  425.         |    marriage_l comma marrdetail
  426.             
  427. marrdetail    :    MARRIED date 
  428.             {
  429.                 marriage_date = current_date;
  430.             }
  431.         |    DIVORCED
  432.             {
  433.                 marriage_state = M_DIVORCED;
  434.             }
  435.         |    SEPARATED
  436.             {
  437.                 marriage_state = M_SEPARATED;
  438.             }
  439.         |    WIDOWED
  440.             {
  441.                 marriage_state = M_WIDOWED;
  442.             }
  443.         |    CHARTREF STRING
  444.             {
  445.                 char *s = (char*)malloc(strlen($2)+1);
  446.                 strcpy(s, $2);
  447.                 marriage_chart = s;
  448.             }
  449.         |    LEFT
  450.             {
  451.                 marriage_hint = H_LEFT;
  452.             }
  453.         |    RIGHT
  454.             {
  455.                 marriage_hint = H_RIGHT;
  456.             }
  457.         |    WIFE ID
  458.             {
  459.                 current_wife_id = $2;
  460.             }
  461.         |    HUSBAND ID
  462.             {
  463.                 current_husband_id = $2;
  464.             }
  465.         |    CHILDREN child_l
  466.         |    error CLOSEBRA
  467.             {
  468.                 errmsg("unexpected marriage keyword.\n");
  469.             }
  470.  
  471.  
  472. child_l        :    child
  473.         |    child_l comma child
  474.     
  475. child        :    ID
  476.             {
  477.                 add_child($1);
  478.             }
  479.  
  480. date        :    day dsep month dsep year
  481.             {
  482.                 parsedate($3,$1,$5);
  483.             }
  484.  
  485. day        :    INT
  486.             {
  487.                 $$ = $1;
  488.             }
  489.         |    QMARK
  490.             {
  491.                 $$ = -1;
  492.             }
  493.         |    error
  494.             {
  495.                 errmsg("expected day number or ? in date\n");
  496.             }
  497.  
  498. month        :    MONTH
  499.             {
  500.                 $$ = $1;
  501.             }
  502.         |    QMARK
  503.             {
  504.                 $$ = -1;
  505.             }
  506.         |    error
  507.             {
  508.                 errmsg("expected name of month or ? in date\n");
  509.             }
  510.  
  511. year        :    INT
  512.             {
  513.                 $$ = $1;
  514.             }
  515.         |    QMARK
  516.             {
  517.                 $$ = -1;
  518.             }
  519.         |    error
  520.             {
  521.                 errmsg("expected year number or ? in date\n");
  522.             }
  523.  
  524. dsep        :    DASH
  525.         |    SLASH
  526.         |    blank
  527.  
  528. comma        :    COMMA
  529.         |    blank
  530.  
  531. %%
  532.  
  533. static void parsedate(int month, int day, int year)
  534. {
  535.     current_date.dvalid = (day != -1);
  536.     current_date.mvalid = (month != -1);
  537.     current_date.yvalid = (year != -1);
  538.     current_date.known = (current_date.dvalid || current_date.mvalid || current_date.yvalid);
  539.     
  540.     if (year < 100)
  541.         year += 1900;
  542.     
  543.     current_date.year = year;
  544.     current_date.month = month;
  545.     current_date.day = day;
  546.  
  547.     dbprintf(("parsedate: %s d: %d  m: %d  y: %d\n", current_date.known ? "known":"unknown", current_date.year,
  548.                 current_date.month, current_date.day));
  549. }
  550.  
  551. void clear_date(date_t *date)
  552. {
  553.     date->known = 0;
  554.     date->yvalid = 0;
  555.     date->dvalid = 0;
  556.     date->mvalid = 0;
  557. }
  558.  
  559. void add_child(id_t id)
  560. {
  561.     person_t *q;
  562.  
  563.     q = findperson(id);
  564.     if (q)
  565.     {
  566.         if (first_child == NULL)
  567.         {
  568.             dbprintf(("add_child(%lx): first child\n", id));
  569.             first_child = q;
  570.             q->lastchild = NULL;
  571.         }
  572.         else
  573.         {
  574.             dbprintf(("add_child(%lx): next child\n", id));
  575.             current_child->nextchild = q;
  576.             q->lastchild = current_child;
  577.         }
  578.         q->nextchild = NULL;
  579.         current_child = q;
  580.     }
  581.     else
  582.     {
  583.         fprintf(stderr,"ftree: child '%lx' is not listed.\n", id);
  584.     }
  585. }
  586. @
  587.  
  588.  
  589. 1.6
  590. log
  591. @Passed on as first Version.
  592. @
  593. text
  594. @d7 1
  595. a7 1
  596.  *    $Date: 1994/03/01 23:26:51 $
  597. d9 1
  598. a9 1
  599.  *    $Revision: 1.5 $
  600. d14 3
  601. d57 1
  602. d68 3
  603. a70 2
  604. %token DIVORCED SEPERATED BAPTISED TITLEBOX NOTITLEBOX
  605. %token LEFT RIGHT BAD THEN
  606. d227 4
  607. d245 4
  608. d353 1
  609. d381 9
  610. a389 1
  611.         |    SEPERATED
  612. d391 3
  613. a393 1
  614.                 marriage_state = M_SEPERATED;
  615. @
  616.  
  617.  
  618. 1.5
  619. log
  620. @made ticklen number specified in inches.
  621. @
  622. text
  623. @d7 1
  624. a7 1
  625.  *    $Date: 1994/02/27 19:36:12 $
  626. d9 1
  627. a9 1
  628.  *    $Revision: 1.4 $
  629. d14 3
  630. d327 1
  631. a327 1
  632.         |    THEN more_marriage_l
  633. d329 2
  634. a330 2
  635. more_marriage_l    :    marriage_def
  636.         |    more_marriage_l comma marriage_def 
  637. d351 1
  638. a351 1
  639.                     makemarriage(previous_marriage, current_husband_id, current_wife_id,
  640. @
  641.  
  642.  
  643. 1.4
  644. log
  645. @changed error reporting functions. Mods to add_child to
  646. create doubly linked list. added new marriage code & options.
  647. @
  648. text
  649. @d7 1
  650. a7 1
  651.  *    $Date: 1994/02/13 16:44:05 $
  652. d9 1
  653. a9 1
  654.  *    $Revision: 1.3 $
  655. d14 4
  656. d301 1
  657. a301 1
  658.                 glob_opts->ticklen = $2;
  659. @
  660.  
  661.  
  662. 1.3
  663. log
  664. @Added new notitlebox & titlebox options to modify the title
  665. behaviour.
  666. @
  667. text
  668. @d7 1
  669. a7 1
  670.  *    $Date: 1994/02/12 20:00:22 $
  671. d9 1
  672. a9 1
  673.  *    $Revision: 1.2 $
  674. d14 4
  675. d27 1
  676. a27 1
  677.     int inum;
  678. d33 3
  679. d38 9
  680. a46 1
  681. extern void *malloc();
  682. a47 9
  683. char current_wife[128];
  684. char current_husband[128];
  685. person_t *current_child, *first_child;
  686. date_t current_date, marriage_date;
  687. person_t current_person;
  688. enum mstate_t marriage_state;
  689.  
  690. void parsedate(int month, int day, int year);
  691. void add_child(char *str);
  692. d55 1
  693. a55 1
  694. %token PERSON POINTSIZE FONT TITLE FONT PAGESIZE TICKLEN 
  695. d58 1
  696. d61 2
  697. a62 2
  698. %type <inum> INT MONTH month day year
  699. %type <txt> STRING ID
  700. d87 1
  701. a87 1
  702.                 current_person.id[0] = '\0';
  703. d97 1
  704. a97 1
  705.                 yyerror("badly formed person construct");
  706. d102 1
  707. a102 3
  708.                 strcpy(current_person.id, $1);
  709.                 if (findperson(current_person.id) != NULL)
  710.                     yyerror("duplicate id code; ID's must be unique");
  711. d106 1
  712. a106 1
  713.                 strcpy(current_person.id, "(blank)");
  714. d110 1
  715. a110 1
  716.                 yyerror("expected ID code");
  717. d123 1
  718. a123 1
  719.                     yyerror("born specified more than once");
  720. d130 1
  721. a130 1
  722.                     yyerror("living specified more than once");
  723. d136 1
  724. a136 1
  725.                     yyerror("dead or diedon already specified");
  726. d142 1
  727. a142 1
  728.                     yyerror("living specified more than once");
  729. d149 1
  730. a149 1
  731.                     yyerror("living specified more than once");
  732. d157 1
  733. a157 1
  734.                     yyerror("sex already specified");
  735. d163 1
  736. a163 1
  737.                     yyerror("sex already specified");
  738. d169 1
  739. a169 1
  740.                     yyerror("occupation already specified");
  741. d175 9
  742. a183 2
  743.                     yyerror("first name already specified");
  744.                 strcpy(current_person.firstname, $2);
  745. d188 9
  746. a196 2
  747.                     yyerror("family name already specified");
  748.                 strcpy(current_person.family, $2);
  749. d198 1
  750. a198 1
  751.         |    error
  752. d200 1
  753. a200 1
  754.                 yyerror("unexpected symbol person details list!");
  755. a203 2
  756.             {
  757.             }
  758. d213 1
  759. a213 1
  760.                 glob_opts->vspace = $2 * INCH;
  761. d217 1
  762. a217 3
  763.                 char *s = (char*)malloc(strlen($2)+1);
  764.                 strcpy(s, $2);
  765.                 glob_opts->startperson = s;
  766. d235 1
  767. a235 1
  768.                 glob_opts->ident.size = $3;
  769. d241 1
  770. a241 1
  771.                 glob_opts->title.font = s;
  772. d243 20
  773. d265 1
  774. a265 1
  775.                 glob_opts->person.size = $3;
  776. d271 1
  777. a271 1
  778.                 glob_opts->title.font = s;
  779. d281 1
  780. a281 1
  781.                 glob_opts->title.size = $3;
  782. d287 1
  783. a287 1
  784.                 glob_opts->title.font = s;
  785. d307 1
  786. a307 1
  787.         |    error
  788. d309 1
  789. a309 1
  790.                 yyerror("unexpected symbol options list!");
  791. d315 13
  792. d329 2
  793. a330 2
  794.                 current_husband[0] = '\0';
  795.                 current_wife[0] = '\0';
  796. d334 1
  797. d336 1
  798. a336 1
  799.             OPENBRA marriage_l CLOSEBRA
  800. d338 5
  801. a342 2
  802.                 if (current_wife[0] == '\0' || current_husband[0] == '\0')
  803.                     yyerror("cannot construct a marriage unless both people are identified.");
  804. d344 3
  805. a346 1
  806.                     makemarriage(current_husband, current_wife, marriage_date, marriage_state, first_child, current_child);
  807. d364 8
  808. d374 1
  809. a374 1
  810.                 strcpy(current_wife, $2);
  811. d378 1
  812. a378 1
  813.                 strcpy(current_husband, $2);
  814. d381 1
  815. a381 1
  816.         |    error
  817. d383 1
  818. a383 1
  819.                 yyerror("unexpected marriage keyword");
  820. d392 1
  821. a392 1
  822.                 add_child((char*)$1);
  823. d394 1
  824. a394 6
  825. /* 
  826.         |    error
  827.             {
  828.                 yyerror("children list must contain of the ID's of children!");
  829.             }
  830. */
  831. d410 1
  832. a410 1
  833.                 yyerror("expected day number or ? in date");
  834. d423 1
  835. a423 1
  836.                 yyerror("expected name of month or ? in date");
  837. d436 1
  838. a436 1
  839.                 yyerror("expected year number or ? in date");
  840. d448 1
  841. a448 1
  842. void parsedate(int month, int day, int year)
  843. a465 1
  844.  
  845. d474 1
  846. a474 1
  847. void add_child(char *str)
  848. d476 1
  849. a476 1
  850.     person_t *p, *q;
  851. d478 1
  852. a478 1
  853.     q = findperson(str);
  854. d483 1
  855. a483 1
  856.             dbprintf(("add_child(%s): first child\n", str));
  857. d485 1
  858. d489 3
  859. a491 3
  860.             dbprintf(("add_child(%s): next child\n", str));
  861.             p = current_child;
  862.             p->nextchild = q;
  863. d498 1
  864. a498 1
  865.         fprintf(stderr,"ftree: child '%s' is not listed.\n", str);
  866. @
  867.  
  868.  
  869. 1.2
  870. log
  871. @added in comments etc.
  872. @
  873. text
  874. @d5 1
  875. a5 1
  876.  *    $Author$
  877. d7 1
  878. a7 1
  879.  *    $Date$
  880. d9 1
  881. a9 1
  882.  *    $Revision$
  883. d13 4
  884. a16 1
  885.  *    $Log$
  886. d51 1
  887. a51 2
  888. %token DIVORCED SEPERATED BAPTISED 
  889.  
  890. d209 8
  891. @
  892.  
  893.  
  894. 1.1
  895. log
  896. @Initial revision
  897. @
  898. text
  899. @d1 17
  900. @
  901.