/[CvsGraph]/cvsgraph/rcsy.y
ViewVC logotype

Diff of /cvsgraph/rcsy.y

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8, Wed Oct 20 19:31:10 2004 UTC revision 1.11, Mon Jun 13 19:57:10 2005 UTC
# Line 46  Line 46 
46  static revs_t *add_revs(revs_t *s, char *t);  static revs_t *add_revs(revs_t *s, char *t);
47  static dtext_t *new_dtext(char *n, char *l, char *t);  static dtext_t *new_dtext(char *n, char *l, char *t);
48  static dtexts_t *add_dtexts(dtexts_t *s, dtext_t *t);  static dtexts_t *add_dtexts(dtexts_t *s, dtext_t *t);
49  static delta_t *new_delta(char *rev, char *date, char *author, char *state, revs_t *branches, char *next);  static phrase_t *new_phrase(phrase_type_e pt, char *t);
50    static phrases_t *add_phrases(phrases_t *s, phrase_t *t);
51    static phrases_t *merge_phrases(phrases_t *s, phrases_t *t);
52    static delta_t *new_delta(char *rev, char *date, char *author, char *state, revs_t *branches, char *next, phrases_t *phrases);
53  static deltas_t *add_deltas(deltas_t *s, delta_t *t);  static deltas_t *add_deltas(deltas_t *s, delta_t *t);
54  static rcsfile_t *new_rcsfile(char *head, char *branch, ids_t *access, tags_t *tags,  static rcsfile_t *new_rcsfile(char *head, char *branch, ids_t *access, tags_t *tags,
55                                  idrevs_t *locks, int strict, char *comment, char *expand);                                  idrevs_t *locks, int strict, char *comment, char *expand);
# Line 67  Line 70 
70          delta_t         *delta;          delta_t         *delta;
71          deltas_t        *deltas;          deltas_t        *deltas;
72          rcsfile_t       *rcsfile;          rcsfile_t       *rcsfile;
73            phrases_t       *phrases;
74            phrase_t        *phrase;
75  }  }
76    
77  %token tHEAD tBRANCH tACCESS tSYMBOLS tLOCKS tSTRICT tCOMMENT  %token tHEAD tBRANCH tACCESS tSYMBOLS tLOCKS tSTRICT tCOMMENT
78  %token tEXPAND tDATE tAUTHOR tSTATE tBRANCHES tNEXT  %token tEXPAND tDATE tAUTHOR tSTATE tBRANCHES tNEXT
79  %token tDESC tLOG tTEXT  %token tDESC tLOG tTEXT
80  %token tOWNER tGROUP tPERMISSIONS tSPECIAL tSYMLINK tHARDLINKS  %token tOWNER tGROUP tPERMISSIONS tSPECIAL tSYMLINK tHARDLINKS
81  %token tNAMESPACE tDEAD  %token tNAMESPACE tDEAD tMERGEPOINT
82    %token tDELTATYPE tCOMMITID tKOPT tFILENAME tPROPERTIES
83  %token <str> tNEWPHRASE  %token <str> tNEWPHRASE
84  %token <str> tSTRING tREV tID tSYM  %token <str> tSTRING tREV tID tSYM
85    
# Line 91  Line 97 
97  %type <delta>   delta  %type <delta>   delta
98  %type <deltas>  deltas  %type <deltas>  deltas
99  %type <rcsfile> admin  %type <rcsfile> admin
100    %type <phrases> ophrases
101    %type <phrase>  phrase
102    
103  %%  %%
104  rcsfile : admin deltas desc {  rcsfile : admin deltas desc {
# Line 167  Line 175 
175            tAUTHOR { set_author(); } idorstr ';'            tAUTHOR { set_author(); } idorstr ';'
176            tSTATE  { set_id(); } oid ';'            tSTATE  { set_id(); } oid ';'
177            tBRANCHES orevs ';'            tBRANCHES orevs ';'
178              ophrases
179            tNEXT orev ';'            tNEXT orev ';'
180            ophrases                      { $$ = new_delta($1, $3, $7, $11, $14, $17); }            ophrases                      { $$ = new_delta($1, $3, $7, $11, $14, $18, merge_phrases($16, $20)); }
181          ;          ;
182    
183  idorstr : tID                           { $$ = $1; }  idorstr : tID                           { $$ = $1; }
# Line 188  Line 197 
197            tTEXT { set_skipstr(); } tSTRING { $$ = new_dtext($1, $3, $7); }            tTEXT { set_skipstr(); } tSTRING { $$ = new_dtext($1, $3, $7); }
198          ;          ;
199    
200  ophrases: /* Empty */  ophrases: /* Empty */           { $$ = NULL; }
201          | ophrases phrase          | ophrases phrase       { $$ = add_phrases($1, $2); }
202          ;          ;
203    
204  phrase  : tNEWPHRASE { set_skip(); } ';'        {  phrase  : tNEWPHRASE { set_skip(); } ';'        {
205                  yywarning("Unrecognised `newphrase´ keyword '%s' skipped", $1);                  yywarning("Unrecognised `newphrase´ keyword '%s' skipped", $1);
206                  xfree($1);                  xfree($1);
207                    $$ = NULL;
208                  }                  }
209          | cvskw { set_skip(); } ';'     { yywarning("CVS extended keyword skipped"); }          | cvskw { set_skip(); } ';'     { $$ = NULL; /* yywarning("CVS extended keyword skipped"); */ }
210          | otherkw { set_skip(); } ';'   { yywarning("Other extended keyword"); }          | otherkw { set_skip(); } ';'   { $$ = NULL; /* yywarning("Other extended keyword"); */ }
211            | tMERGEPOINT tSTRING ';'       { $$ = new_phrase(PT_MERGEPOINT, $2); }
212          ;          ;
213    
214  cvskw   : tOWNER  cvskw   : tOWNER
# Line 210  Line 221 
221    
222  otherkw : tNAMESPACE  otherkw : tNAMESPACE
223          | tDEAD          | tDEAD
224            | tDELTATYPE
225            | tCOMMITID
226            | tKOPT
227            | tFILENAME
228            | tPROPERTIES
229          ;          ;
230    
231  ostr    : /* Empty */                   { $$ = NULL; }  ostr    : /* Empty */                   { $$ = NULL; }
# Line 434  Line 450 
450          return s;          return s;
451  }  }
452    
453  static delta_t *new_delta(char *rev, char *date, char *author, char *state, revs_t *branches, char *next)  static phrase_t *new_phrase(phrase_type_e pt, char *t)
454    {
455            phrase_t *d = xmalloc(sizeof(*d));
456            d->type = pt;
457            d->rev = make_rev(t, 1);
458            return d;
459    }
460    
461    static phrases_t *add_phrases(phrases_t *s, phrase_t *t)
462    {
463            if(!t)
464                    return s;
465            if(!s)
466                    s = xmalloc(sizeof(*s));
467            if(t)
468            {
469                    s->phrases = xrealloc(s->phrases, (s->nphrases + 1) * sizeof(s->phrases[0]));
470                    s->phrases[s->nphrases] = t;
471                    s->nphrases++;
472            }
473            return s;
474    }
475    
476    static phrases_t *merge_phrases(phrases_t *s, phrases_t *t)
477    {
478            if(!t)
479                    return s;
480            if(!s)
481                    return t;
482            s->phrases = xrealloc(s->phrases, (s->nphrases + t->nphrases) * sizeof(s->phrases[0]));
483            memcpy(&s->phrases[s->nphrases], &t->phrases[0], t->nphrases * sizeof(t->phrases[0]));
484            s->nphrases += t->nphrases;
485            /* FIXME: Free t and content; hm, who cares... */
486            return s;
487    }
488    
489    static phrase_t *find_mergepoint(phrases_t *p)
490    {
491            int i;
492    
493            if(!p)
494                    return NULL;
495    
496            for(i = 0; i < p->nphrases; i++)
497            {
498                    if(p->phrases[i]->type == PT_MERGEPOINT)
499                            return p->phrases[i];
500            }
501            return NULL;
502    }
503    
504    static delta_t *new_delta(char *rev, char *date, char *author, char *state, revs_t *branches, char *next, phrases_t *phrases)
505  {  {
506          delta_t *d = xmalloc(sizeof(*d));          delta_t *d = xmalloc(sizeof(*d));
507          d->rev = make_rev(rev, 1);          d->rev = make_rev(rev, 1);
# Line 443  Line 510 
510          d->state = state;          d->state = state;
511          d->branches = branches;          d->branches = branches;
512          d->next = make_rev(next, 1);          d->next = make_rev(next, 1);
513            d->phrases = phrases;
514            d->mergepoint = find_mergepoint(phrases);
515          return d;          return d;
516  }  }
517    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0