2
PLIB - A Suite of Portable Game Libraries
3
Copyright (C) 1998,2002 Steve Baker
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
For further information visit http://plib.sourceforge.net
21
$Id: pslError.cxx,v 1.8 2002/09/15 14:32:53 ude Exp $
27
static char _pslErrorBuffer [ 1024 ] = { '\0' } ;
30
void (*_pslErrorCB) ( pslProgram *p, int severity, const char *progname,
31
int line_no , const char *message ) = NULL ;
34
void pslSetErrorCallback ( void (*CB) ( pslProgram *, int, const char *,
42
int pslCompiler::warning ( const char *fmt, ... )
45
va_start ( argp, fmt ) ;
46
vsprintf ( _pslErrorBuffer, fmt, argp ) ;
49
if ( _pslErrorCB != NULL )
50
(*_pslErrorCB)( program, PSL_COMPILETIME_WARNING,
51
_pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ;
53
fprintf ( stderr, "PSL: \"%s\" line %3d: WARNING - %s\n",
54
_pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ;
62
int pslCompiler::error ( const char *fmt, ... )
65
va_start ( argp, fmt ) ;
66
vsprintf ( _pslErrorBuffer, fmt, argp ) ;
69
if ( _pslErrorCB != NULL )
70
(*_pslErrorCB)( program, PSL_COMPILETIME_ERROR,
71
_pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ;
73
fprintf ( stderr, "PSL: \"%s\" line %3d: *ERROR* - %s\n",
74
_pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ;
82
void pslContext::warning ( const char *fmt, ... )
85
va_start ( argp, fmt ) ;
86
vsprintf ( _pslErrorBuffer, fmt, argp ) ;
89
if ( _pslErrorCB != NULL )
90
(*_pslErrorCB)( program, PSL_RUNTIME_WARNING,
91
getProgName(), getLineNo(), _pslErrorBuffer ) ;
93
if ( getLineNo () >= 0 )
94
fprintf ( stderr, "PSL: \"%s\" Line %d: WARNING - %s\n",
95
getProgName(), getLineNo(), _pslErrorBuffer ) ;
97
fprintf ( stderr, "PSL: \"%s\": WARNING - %s\n",
98
getProgName(), _pslErrorBuffer ) ;
105
void pslContext::error ( const char *fmt, ... )
108
va_start ( argp, fmt ) ;
109
vsprintf ( _pslErrorBuffer, fmt, argp ) ;
112
if ( _pslErrorCB != NULL )
113
(*_pslErrorCB)( program, PSL_RUNTIME_ERROR,
114
getProgName(), getLineNo(), _pslErrorBuffer ) ;
116
if ( getLineNo () >= 0 )
117
fprintf ( stderr, "PSL: \"%s\" Line %d: *ERROR* - %s\n",
118
getProgName(), getLineNo(), _pslErrorBuffer ) ;
120
fprintf ( stderr, "PSL: \"%s\": *ERROR* - %s\n",
121
getProgName(), _pslErrorBuffer ) ;