/[CvsGraph]/cvsgraph/confl.l
ViewVC logotype

Annotate of /cvsgraph/confl.l

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


Revision 1.6 - (show annotations)
Sat Mar 10 02:54:39 2001 UTC (16 years, 9 months ago) by bertho
Branch: MAIN
CVS Tags: REL_1_1_1, REL_1_1_3, REL_1_1_2
Changes since 1.5: +8 -0 lines
- Fixed path problems. Cvsroot and module will always have a
  trailing '/' if they are not empty so that simple files
  can be addressed directly from the commandline. This also
  eases expansions.
- Implemented new features:
	* revisions can have custom text
	* background colors of boxes working
	* boxes can have shadow (looks nice)
	* imagemaps generate diff areas between revisions
- Several new config parameters to support above functionality.
1 /*
2 * CvsGraph graphical representation generator of brances and revisions
3 * of a file in cvs/rcs.
4 *
5 * Copyright (C) 2001 B. Stultiens
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 %x STR
23
24 %{
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <ctype.h>
29
30 #include "utils.h"
31 #include "readconf.h"
32 #include "y.tab.h"
33
34 static void reset_str(void);
35 static void add_str(const char *s, int l);
36 static char *get_str(void);
37
38 int line_number;
39
40 #define YY_NO_UNPUT 1
41
42 %}
43
44 %%
45 branch_bgcolor return tBRANCH_BGCOLOR;
46 branch_bspace return tBRANCH_BSPACE;
47 branch_color return tBRANCH_COLOR;
48 branch_font return tBRANCH_FONT;
49 branch_lspace return tBRANCH_LSPACE;
50 branch_rspace return tBRANCH_RSPACE;
51 branch_tspace return tBRANCH_TSPACE;
52 branch_connect return tBRANCH_CONNECT;
53 branch_margin return tBRANCH_MARGIN;
54 box_shadow return tBOX_SHADOW;
55 color_bg return tCOLOR_BG;
56 cvsmodule return tCVSMODULE;
57 cvsroot return tCVSROOT;
58 date_format return tDATE_FORMAT;
59 rev_color return tREV_COLOR;
60 rev_bgcolor return tREV_BGCOLOR;
61 rev_font return tREV_FONT;
62 rev_separator return tREV_SEPARATOR;
63 rev_minline return tREV_MINLINE;
64 rev_maxline return tREV_MAXLINE;
65 rev_lspace return tREV_LSPACE;
66 rev_rspace return tREV_RSPACE;
67 rev_tspace return tREV_TSPACE;
68 rev_bspace return tREV_BSPACE;
69 rev_text return tREV_TEXT;
70 rev_text_color return tREV_TEXT_COLOR;
71 rev_text_font return tREV_TEXT_FONT;
72 tag_color return tTAG_COLOR;
73 tag_font return tTAG_FONT;
74 title return tTITLE;
75 title_x return tTITLE_X;
76 title_y return tTITLE_Y;
77 title_font return tTITLE_FONT;
78 title_align return tTITLE_ALIGN;
79 title_color return tTITLE_COLOR;
80 margin_top return tMARGIN_TOP;
81 margin_bottom return tMARGIN_BOTTOM;
82 margin_left return tMARGIN_LEFT;
83 margin_right return tMARGIN_RIGHT;
84 image_type return tIMAGE_TYPE;
85 image_quality return tIMAGE_QUALITY;
86 map_name return tMAP_NAME;
87 map_branch_href return tMAP_BRANCH_HREF;
88 map_branch_alt return tMAP_BRANCH_ALT;
89 map_rev_href return tMAP_REV_HREF;
90 map_rev_alt return tMAP_REV_ALT;
91 map_diff_href return tMAP_DIFF_HREF;
92 map_diff_alt return tMAP_DIFF_ALT;
93
94 jpeg yylval.num = IMAGE_JPEG; return tNUMBER;
95 png yylval.num = IMAGE_PNG; return tNUMBER;
96 gif yylval.num = IMAGE_GIF; return tNUMBER;
97
98 true yylval.num = 1; return tNUMBER;
99 false yylval.num = 0; return tNUMBER;
100
101 left yylval.num = 0; return tNUMBER;
102 center yylval.num = 1; return tNUMBER;
103 right yylval.num = 2; return tNUMBER;
104
105 tiny yylval.num = 0; return tNUMBER;
106 small yylval.num = 1; return tNUMBER;
107 medium yylval.num = 2; return tNUMBER;
108 large yylval.num = 3; return tNUMBER;
109 giant yylval.num = 4; return tNUMBER;
110
111 [a-zA-Z_][a-zA-Z0-9_]* yylval.str = xstrdup(yytext); return tUNKNOWN;
112
113 [+-]?0[0-7]* yylval.num = strtol(yytext, NULL, 8); return tNUMBER;
114 [+-]?[1-9][0-9]* yylval.num = strtol(yytext, NULL, 10); return tNUMBER;
115 [+-]?0[xX][0-9a-fA-F]+ yylval.num = strtol(yytext, NULL, 16); return tNUMBER;
116 [+-]?0[xX] yyerror("Invalid hex number");
117
118 = return *yytext;
119 ; return *yytext;
120
121 \" reset_str(); BEGIN(STR);
122 <STR>[^\\\"\n]* add_str(yytext, yyleng);
123 <STR>\\[abfnrtv] {
124 char ch;
125 switch(yytext[1])
126 {
127 case 'a': ch = '\a'; break;
128 case 'b': ch = '\b'; break;
129 case 'f': ch = '\f'; break;
130 case 'n': ch = '\n'; break;
131 case 'r': ch = '\r'; break;
132 case 't': ch = '\t'; break;
133 case 'v': ch = '\v'; break;
134 }
135 add_str(&ch, 1);
136 }
137 <STR>\\[012][0-7]{0,2} { char ch = strtol(yytext+1, NULL, 8); add_str(&ch, 1); }
138 <STR>\\[xX][a-fA-F0-9]{2} { char ch = strtol(yytext+1, NULL, 8); add_str(&ch, 1); }
139 <STR>\\[xX][a-fA-F0-9] yyerror("Invalid hex escape");
140 <STR>\\. add_str(yytext+1, 1);
141 <STR>\n yyerror("Newline in string");
142 <STR>\" yylval.str = get_str(); BEGIN(INITIAL); return tSTRING;
143
144 [ \t\f\v\r\b]+ ; /* Ignore whitespace */
145 #[^\n]* ; /* Ignore comments */
146
147 \n line_number++;
148 . yyerror("Unknown char/unmatched text '%c' (0x%02x)", isprint(*yytext) ? *yytext : ' ', *yytext);
149
150 %%
151
152 int yywrap(void)
153 {
154 return 1;
155 }
156
157 #define STRALLOCSIZE 128
158 static char *str;
159 static int nstr;
160 static int nastr;
161
162 static void reset_str(void)
163 {
164 nstr = 0;
165 }
166
167 static void add_str(const char *s, int l)
168 {
169 if(nstr + l + 1 > nastr)
170 {
171 str = xrealloc(str, nastr+STRALLOCSIZE);
172 nastr += STRALLOCSIZE;
173 }
174 memcpy(str+nstr, s, l);
175 nstr += l;
176 }
177
178 static char *get_str(void)
179 {
180 str[nstr] = '\0';
181 return xstrdup(str);
182 }
183

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0