/[CvsGraph]/cvsgraph/utils.c
ViewVC logotype

Annotate of /cvsgraph/utils.c

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


Revision 1.3 - (show annotations)
Sun Mar 4 01:38:23 2001 UTC (16 years, 7 months ago) by bertho
Branch: MAIN
CVS Tags: REL_1_1_2, REL_1_1_1, REL_1_1_0, REL_1_1_3
Changes since 1.2: +29 -6 lines
File MIME type: text/plain
Major update of the code.
- Complete new method of getting the revision structure by directly
  reading the rcs/cvs file. This should also speed things a bit
  because no external program needs to be called anymore.
  This also means that "remote-graphs" are no longer a possible
  extension of the program. But, who cares.
- Implemented branch-kerning to save place. The images are now
  much smaller in width, dependent on the settings of the exterior
  margins.
- Fixed disjoint braches by reading the structure direct from the
  rcs/cvs file. The revision/branch structure is no longer determined
  from the revision numbers, but solely from the rcs/cvs file structure.
- Fixed display of branches with no revisions attached to them. These
  only have a tag describing the new branch.
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 #include <stdio.h>
23 #include <stdlib.h>
24 #include <stdarg.h>
25 #include <string.h>
26
27 #include "utils.h"
28 #include "readconf.h"
29
30 const char *input_file;
31 int quiet; /* Set if warnings should be suppressed */
32
33 void *xmalloc(size_t s)
34 {
35 void *p = malloc(s);
36 if(!p)
37 {
38 printf("Out of memory");
39 exit(1);
40 }
41 memset(p, 0, s);
42 return p;
43 }
44
45 void *xrealloc(void *a, size_t s)
46 {
47 void *p;
48 if(!a)
49 return malloc(s);
50 p = realloc(a, s);
51 if(!p)
52 {
53 printf("Out of memory");
54 exit(1);
55 }
56 return p;
57 }
58
59 char *xstrdup(const char *s)
60 {
61 char *c;
62 if(!s)
63 s = "";
64 c = xmalloc(strlen(s)+1);
65 strcpy(c, s);
66 return c;
67 }
68
69 void xfree(void *p)
70 {
71 if(p)
72 free(p);
73 }
74
75 static int do_msg(const char *type, const char *fmt, va_list va)
76 {
77 if(type)
78 fprintf(stderr, "%s: %d: %s: ", input_file, line_number, type);
79 else
80 fprintf(stderr, "%s: %d: ", input_file, line_number);
81 vfprintf(stderr, fmt, va);
82 fprintf(stderr, "\n");
83 return 0;
84 }
85
86 int yyerror(const char *fmt, ...)
87 {
88 va_list va;
89 va_start(va, fmt);
90 do_msg(NULL, fmt, va);
91 va_end(va);
92 exit(2);
93 return 0;
94 }
95
96 int yywarning(const char *fmt, ...)
97 {
98 va_list va;
99 if(!quiet)
100 {
101 va_start(va, fmt);
102 do_msg("warning", fmt, va);
103 va_end(va);
104 }
105 return 0;
106 }
107
108 int rcserror(const char *fmt, ...)
109 {
110 va_list va;
111 va_start(va, fmt);
112 do_msg(NULL, fmt, va);
113 va_end(va);
114 exit(2);
115 return 0;
116 }

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0