~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to tools/gsoap/win32-2.7/src/.svn/text-base/error2.c.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
error2.c
4
 
 
5
 
Error handling.
6
 
 
7
 
gSOAP XML Web services tools
8
 
Copyright (C) 2004, Robert van Engelen, Genivia, Inc. All Rights Reserved.
9
 
 
10
 
--------------------------------------------------------------------------------
11
 
gSOAP public license.
12
 
 
13
 
The contents of this file are subject to the gSOAP Public License Version 1.3
14
 
(the "License"); you may not use this file except in compliance with the
15
 
License. You may obtain a copy of the License at
16
 
http://www.cs.fsu.edu/~engelen/soaplicense.html
17
 
Software distributed under the License is distributed on an "AS IS" basis,
18
 
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19
 
for the specific language governing rights and limitations under the License.
20
 
 
21
 
The Initial Developer of the Original Code is Robert A. van Engelen.
22
 
Copyright (C) 2000-2004 Robert A. van Engelen, Genivia inc. All Rights Reserved.
23
 
--------------------------------------------------------------------------------
24
 
GPL license.
25
 
 
26
 
This program is free software; you can redistribute it and/or modify it under
27
 
the terms of the GNU General Public License as published by the Free Software
28
 
Foundation; either version 2 of the License, or (at your option) any later
29
 
version.
30
 
 
31
 
This program is distributed in the hope that it will be useful, but WITHOUT ANY
32
 
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
33
 
PARTICULAR PURPOSE. See the GNU General Public License for more details.
34
 
 
35
 
You should have received a copy of the GNU General Public License along with
36
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
37
 
Place, Suite 330, Boston, MA 02111-1307 USA
38
 
 
39
 
Author contact information:
40
 
engelen@genivia.com / engelen@acm.org
41
 
--------------------------------------------------------------------------------
42
 
*/
43
 
 
44
 
#include "soapcpp2.h"
45
 
#include "soapcpp2_yacc.h"
46
 
 
47
 
#define MAXERR 10
48
 
 
49
 
extern char yytext[];   /* lexeme found by the lexical analyzer */
50
 
 
51
 
static int lexerrno = 0;
52
 
static int synerrno = 0;
53
 
static int semerrno = 0;
54
 
static int semwarno = 0;
55
 
 
56
 
char errbuf[1024];      /* to hold error messages */
57
 
 
58
 
/*
59
 
yyerror - called by parser from an error production with nonterminal `error'
60
 
*/
61
 
yyerror(char *s)
62
 
{       fprintf(stderr, "%s(%d): %s\n", filename, yylineno, s);
63
 
}
64
 
 
65
 
/*
66
 
lexerror - called by lexical analyzer upon failure to recognize a token
67
 
*/
68
 
lexerror(const char *s)
69
 
{       fprintf(stderr, "%s(%d): %s: %s\n", filename, yylineno, s, yytext);
70
 
        if (lexerrno++ >= MAXERR)
71
 
                execerror("too many syntactic errors, bailing out");
72
 
}
73
 
 
74
 
/*
75
 
synerror - called by a semantic action in the yacc grammar
76
 
*/
77
 
synerror(const char *s)
78
 
{       fprintf(stderr, "%s(%d): Syntax error: %s\n", filename, yylineno-1, s);
79
 
        if (synerrno++ >= MAXERR)
80
 
                execerror("too many syntactic errors, bailing out");
81
 
}
82
 
 
83
 
/*
84
 
semerror - report semantic error from static checking
85
 
*/
86
 
semerror(const char *s)
87
 
{       fprintf(stderr, "\n%s(%d): **ERROR**: %s\n\n", filename, yylineno, s);
88
 
        if (semerrno++ >= MAXERR)
89
 
                execerror("too many semantic errors, bailing out");
90
 
}
91
 
 
92
 
/*
93
 
semwarn - report semantic warning from static checking
94
 
*/
95
 
semwarn(const char *s)
96
 
{       fprintf(stderr, "\n**WARNING**: %s (detected at line %d in %s)\n\n", s, yylineno, filename);
97
 
        semwarno++;
98
 
}
99
 
 
100
 
/*
101
 
compliancewarn - report compliance warning
102
 
*/
103
 
compliancewarn(const char *s)
104
 
{       fprintf(stderr, "Compliance warning: %s\n", s);
105
 
}
106
 
 
107
 
/*
108
 
typerror - report type error (a semantic error)
109
 
*/
110
 
typerror(const char *s)
111
 
{       fprintf(stderr, "%s(%d): Type error: %s\n", filename, yylineno, s);
112
 
        if (semerrno++ >= MAXERR)
113
 
                execerror("too many semantic errors, bailing out");
114
 
}
115
 
 
116
 
/*
117
 
execerror - print error message and terminate execution
118
 
*/
119
 
execerror(const char *s)
120
 
{       fprintf(stderr, "Critical error: %s\n", s);
121
 
        exit(1);
122
 
}
123
 
 
124
 
/*
125
 
progerror - called when check(expr) failed, i.e. upon programming error
126
 
*/
127
 
progerror(const char *s, const char *f, int l)
128
 
{       fprintf(stderr, "Program failure: %s in file %s line %d\n", s, f, l);
129
 
        exit(1);
130
 
}
131
 
 
132
 
/*
133
 
errstat - show error statistics
134
 
*/
135
 
int errstat()
136
 
{       if (!lexerrno && !synerrno && !semerrno)
137
 
        {       fprintf(stderr, "\nCompilation successful ");
138
 
                if (semwarno)
139
 
                        fprintf(stderr, "(%d warning%s)\n\n", semwarno, semwarno>1?"s":"");
140
 
                else
141
 
                        fprintf(stderr, "\n\n");
142
 
                return 0;
143
 
        }
144
 
        fprintf(stderr, "\nThere were errors:\n");
145
 
        if (lexerrno)
146
 
                fprintf(stderr, "%d lexical error%s\n", lexerrno, lexerrno>1?"s":"");
147
 
        if (synerrno)
148
 
                fprintf(stderr, "%d syntax error%s\n", synerrno, synerrno>1?"s":"");
149
 
        if (semerrno)
150
 
                fprintf(stderr, "%d semantic error%s\n", semerrno, semerrno>1?"s":"");
151
 
        if (semwarno)
152
 
                fprintf(stderr, "%d warning%s\n", semwarno, semwarno>1?"s":"");
153
 
        fprintf(stderr, "\n");
154
 
        return -1;
155
 
}