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 **************************************************************************/
28 #include "sl_pp_public.h"
29 #include "sl_pp_context.h"
30 #include "sl_pp_dict.h"
33 #define ADD_NAME_STR(CTX, NAME, STR)\
35 (CTX)->dict.NAME = sl_pp_context_add_unique_str((CTX), (STR));\
36 if ((CTX)->dict.NAME == -1) {\
41 #define ADD_NAME(CTX, NAME) ADD_NAME_STR(CTX, NAME, #NAME)
45 sl_pp_dict_init(struct sl_pp_context
*context
)
47 ADD_NAME(context
, all
);
49 ADD_NAME(context
, require
);
50 ADD_NAME(context
, enable
);
51 ADD_NAME(context
, warn
);
52 ADD_NAME(context
, disable
);
54 ADD_NAME(context
, defined
);
56 ADD_NAME_STR(context
, ___LINE__
, "__LINE__");
57 ADD_NAME_STR(context
, ___FILE__
, "__FILE__");
58 ADD_NAME_STR(context
, ___VERSION__
, "__VERSION__");
60 ADD_NAME(context
, optimize
);
61 ADD_NAME(context
, debug
);
63 ADD_NAME(context
, off
);
64 ADD_NAME(context
, on
);
66 ADD_NAME(context
, define
);
67 ADD_NAME(context
, elif
);
68 ADD_NAME_STR(context
, _else
, "else");
69 ADD_NAME(context
, endif
);
70 ADD_NAME(context
, error
);
71 ADD_NAME(context
, extension
);
72 ADD_NAME_STR(context
, _if
, "if");
73 ADD_NAME(context
, ifdef
);
74 ADD_NAME(context
, ifndef
);
75 ADD_NAME(context
, line
);
76 ADD_NAME(context
, pragma
);
77 ADD_NAME(context
, undef
);
79 ADD_NAME(context
, version
);
81 ADD_NAME_STR(context
, _0
, "0");
82 ADD_NAME_STR(context
, _1
, "1");