1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 #include "sl_pp_context.h"
31 #include "sl_pp_process.h"
32 #include "sl_pp_public.h"
36 sl_pp_process_error(struct sl_pp_context
*context
,
37 const struct sl_pp_token_info
*input
,
41 unsigned int out_len
= 0;
44 for (i
= first
; i
< last
; i
++) {
48 switch (input
[i
].token
) {
49 case SL_PP_WHITESPACE
:
101 case SL_PP_ADDASSIGN
:
109 case SL_PP_DECREMENT
:
113 case SL_PP_SUBASSIGN
:
133 case SL_PP_MULASSIGN
:
141 case SL_PP_DIVASSIGN
:
149 case SL_PP_MODASSIGN
:
157 case SL_PP_LSHIFTASSIGN
:
165 case SL_PP_LESSEQUAL
:
173 case SL_PP_RSHIFTASSIGN
:
181 case SL_PP_GREATEREQUAL
:
201 case SL_PP_BITANDASSIGN
:
213 case SL_PP_BITXORASSIGN
:
225 case SL_PP_BITORASSIGN
:
241 case SL_PP_IDENTIFIER
:
242 s
= sl_pp_context_cstr(context
, input
[i
].data
.identifier
);
246 s
= sl_pp_context_cstr(context
, input
[i
].data
._uint
);
250 s
= sl_pp_context_cstr(context
, input
[i
].data
._float
);
254 buf
[0] = input
[i
].data
.other
;
260 strcpy(context
->error_msg
, "internal error");
264 while (*s
!= '\0' && out_len
< sizeof(context
->error_msg
) - 1) {
265 context
->error_msg
[out_len
++] = *s
++;
269 context
->error_msg
[out_len
] = '\0';