aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/edje/src/bin/epp/cpperror.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/edje/src/bin/epp/cpperror.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/edje/src/bin/epp/cpperror.c')
-rw-r--r--libraries/edje/src/bin/epp/cpperror.c147
1 files changed, 147 insertions, 0 deletions
diff --git a/libraries/edje/src/bin/epp/cpperror.c b/libraries/edje/src/bin/epp/cpperror.c
new file mode 100644
index 0000000..f4cd5eb
--- /dev/null
+++ b/libraries/edje/src/bin/epp/cpperror.c
@@ -0,0 +1,147 @@
1/* Default error handlers for CPP Library.
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <stdio.h>
31#include <stdlib.h>
32
33#include "cpplib.h"
34
35/* Print the file names and line numbers of the #include
36 * commands which led to the current file. */
37
38void
39cpp_print_containing_files(cpp_reader * pfile)
40{
41 cpp_buffer *ip;
42 int first = 1;
43
44 /* If stack of files hasn't changed since we last printed
45 * this info, don't repeat it. */
46 if (pfile->input_stack_listing_current)
47 return;
48
49 ip = cpp_file_buffer(pfile);
50
51 /* Give up if we don't find a source file. */
52 if (!ip)
53 return;
54
55 /* Find the other, outer source files. */
56 while ((ip = CPP_PREV_BUFFER(ip)), ip != CPP_NULL_BUFFER(pfile))
57 {
58 long line, col;
59
60 cpp_buf_line_and_col(ip, &line, &col);
61 if (ip->fname)
62 {
63 if (first)
64 {
65 first = 0;
66 fprintf(stderr, "In file included");
67 }
68 else
69 fprintf(stderr, ",\n ");
70 }
71 }
72 if (!first)
73 fprintf(stderr, ":\n");
74
75 /* Record we have printed the status as of this time. */
76 pfile->input_stack_listing_current = 1;
77}
78
79void
80cpp_file_line_for_message(cpp_reader * pfile __UNUSED__, const char *filename,
81 int line, int column)
82{
83 if (column > 0)
84 {
85 fprintf(stderr, "%s:%d:%d: ", filename, line, column);
86 }
87 else
88 {
89 fprintf(stderr, "%s:%d: ", filename, line);
90 }
91}
92
93/* IS_ERROR is 1 for error, 0 for warning */
94void
95cpp_message_v(cpp_reader * pfile, int is_error, const char *msg, va_list args)
96{
97 if (is_error)
98 pfile->errors++;
99 else
100 fprintf(stderr, "warning: ");
101 vfprintf(stderr, msg, args);
102 fprintf(stderr, "\n");
103}
104
105void
106cpp_message(cpp_reader * pfile, int is_error, const char *msg, ...)
107{
108 va_list args;
109
110 va_start(args, msg);
111
112 cpp_message_v(pfile, is_error, msg, args);
113
114 va_end(args);
115}
116
117static void
118cpp_fatal_v(const char *msg, va_list args)
119{
120 fprintf(stderr, "%s: ", progname);
121 vfprintf(stderr, msg, args);
122 fprintf(stderr, "\n");
123 exit(FATAL_EXIT_CODE);
124}
125
126void
127cpp_fatal(const char *msg, ...)
128{
129 va_list args;
130
131 va_start(args, msg);
132
133 cpp_fatal_v(msg, args);
134
135 va_end(args);
136}
137
138void
139cpp_pfatal_with_name(cpp_reader * pfile, const char *name)
140{
141 cpp_perror_with_name(pfile, name);
142#ifdef VMS
143 exit(vaxc$errno);
144#else
145 exit(FATAL_EXIT_CODE);
146#endif
147}