1 /*****************************************************************************/
5 /* Subroutines for the emulation features */
9 /* (C) 2000-2008 Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
44 /*****************************************************************************/
46 /*****************************************************************************/
50 /* Names of the features */
51 static const char* FeatureKeys[FEAT_COUNT] = {
53 "labels_without_colons",
57 "dollar_in_identifiers",
58 "leading_dot_in_identifiers",
68 /*****************************************************************************/
70 /*****************************************************************************/
74 feature_t FindFeature (const StrBuf* Key)
75 /* Find the feature in a table and return the corresponding enum value. If the
76 * feature is invalid, return FEAT_UNKNOWN.
81 /* This is not time critical, so do a linear search */
82 for (F = (feature_t) 0; F < FEAT_COUNT; ++F) {
83 if (SB_CompareStr (Key, FeatureKeys[F]) == 0) {
84 /* Found, index is enum value */
95 feature_t SetFeature (const StrBuf* Key)
96 /* Find the feature and set the corresponding flag if the feature is known.
97 * In any case, return the feature found. An invalid Key will return
101 /* Map the string to an enum value */
102 feature_t Feature = FindFeature (Key);
106 case FEAT_DOLLAR_IS_PC: DollarIsPC = 1; break;
107 case FEAT_LABELS_WITHOUT_COLONS: NoColonLabels = 1; break;
108 case FEAT_LOOSE_STRING_TERM: LooseStringTerm = 1; break;
109 case FEAT_LOOSE_CHAR_TERM: LooseCharTerm = 1; break;
110 case FEAT_AT_IN_IDENTIFIERS: AtInIdents = 1; break;
111 case FEAT_DOLLAR_IN_IDENTIFIERS: DollarInIdents = 1; break;
112 case FEAT_LEADING_DOT_IN_IDENTIFIERS: LeadingDotInIdents= 1; break;
113 case FEAT_ORG_PER_SEG: OrgPerSeg = 1; break;
114 case FEAT_PC_ASSIGNMENT: PCAssignment = 1; break;
115 case FEAT_MISSING_CHAR_TERM: MissingCharTerm = 1; break;
116 case FEAT_UBIQUITOUS_IDENTS: UbiquitousIdents = 1; break;
117 case FEAT_C_COMMENTS: CComments = 1; break;
118 default: /* Keep gcc silent */ break;
121 /* Return the value found */