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 **************************************************************************/
29 #include "sl_pp_process.h"
33 sl_pp_process_error(struct sl_pp_context
*context
,
34 const struct sl_pp_token_info
*input
,
38 unsigned int out_len
= 0;
41 for (i
= first
; i
< last
; i
++) {
45 switch (input
[i
].token
) {
46 case SL_PP_WHITESPACE
:
106 case SL_PP_DECREMENT
:
110 case SL_PP_SUBASSIGN
:
130 case SL_PP_MULASSIGN
:
138 case SL_PP_DIVASSIGN
:
146 case SL_PP_MODASSIGN
:
154 case SL_PP_LSHIFTASSIGN
:
162 case SL_PP_LESSEQUAL
:
170 case SL_PP_RSHIFTASSIGN
:
178 case SL_PP_GREATEREQUAL
:
198 case SL_PP_BITANDASSIGN
:
210 case SL_PP_BITXORASSIGN
:
222 case SL_PP_BITORASSIGN
:
238 case SL_PP_IDENTIFIER
:
239 s
= sl_pp_context_cstr(context
, input
[i
].data
.identifier
);
243 s
= sl_pp_context_cstr(context
, input
[i
].data
.number
);
247 buf
[0] = input
[i
].data
.other
;
253 strcpy(context
->error_msg
, "internal error");
257 while (*s
!= '\0' && out_len
< sizeof(context
->error_msg
) - 1) {
258 context
->error_msg
[out_len
++] = *s
++;
262 context
->error_msg
[out_len
] = '\0';