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"
33 #include "sl_pp_token.h"
37 sl_pp_process_error(struct sl_pp_context
*context
,
38 const struct sl_pp_token_info
*input
,
42 unsigned int out_len
= 0;
45 for (i
= first
; i
< last
; i
++) {
49 switch (input
[i
].token
) {
50 case SL_PP_WHITESPACE
:
102 case SL_PP_ADDASSIGN
:
110 case SL_PP_DECREMENT
:
114 case SL_PP_SUBASSIGN
:
134 case SL_PP_MULASSIGN
:
142 case SL_PP_DIVASSIGN
:
150 case SL_PP_MODASSIGN
:
158 case SL_PP_LSHIFTASSIGN
:
166 case SL_PP_LESSEQUAL
:
174 case SL_PP_RSHIFTASSIGN
:
182 case SL_PP_GREATEREQUAL
:
202 case SL_PP_BITANDASSIGN
:
214 case SL_PP_BITXORASSIGN
:
226 case SL_PP_BITORASSIGN
:
242 case SL_PP_IDENTIFIER
:
243 s
= sl_pp_context_cstr(context
, input
[i
].data
.identifier
);
247 s
= sl_pp_context_cstr(context
, input
[i
].data
._uint
);
251 s
= sl_pp_context_cstr(context
, input
[i
].data
._float
);
255 buf
[0] = input
[i
].data
.other
;
261 strcpy(context
->error_msg
, "internal error");
265 while (*s
!= '\0' && out_len
< sizeof(context
->error_msg
) - 1) {
266 context
->error_msg
[out_len
++] = *s
++;
270 context
->error_msg
[out_len
] = '\0';