1 // *****************************************************************************
2 // *****************************************************************************
3 // Copyright 2012 - 2017, Cadence Design Systems
4 //
5 // This  file  is  part  of  the  Cadence  LEF/DEF  Open   Source
6 // Distribution,  Product Version 5.8.
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 //    you may not use this file except in compliance with the License.
10 //    You may obtain a copy of the License at
11 //
12 //        http://www.apache.org/licenses/LICENSE-2.0
13 //
14 //    Unless required by applicable law or agreed to in writing, software
15 //    distributed under the License is distributed on an "AS IS" BASIS,
16 //    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 //    implied. See the License for the specific language governing
18 //    permissions and limitations under the License.
19 //
20 // For updates, support, or to become part of the LEF/DEF Community,
21 // check www.openeda.org for details.
22 //
23 //  $Author: arakhman $
24 //  $Revision: #11 $
25 //  $Date: 2013/04/23 $
26 //  $State:  $
27 // *****************************************************************************
28 // *****************************************************************************
29 
30 #ifndef lefrSettings_h
31 #define lefrSettings_h
32 
33 #include <cstring>
34 #include <string>
35 #include <map>
36 #include <set>
37 
38 #include "lefrReader.hpp"
39 
40 BEGIN_LEFDEF_PARSER_NAMESPACE
41 
42 struct lefCompareCStrings
43 {
operator ()lefCompareCStrings44     bool operator()(const char* lhs, const char* rhs) const {
45         return std::strcmp(lhs, rhs) < 0;
46     }
47 };
48 
49 typedef std::map<const char*, int, lefCompareCStrings>  lefKeywordMap;
50 typedef std::map<int, int>                              MsgsDisableMap;
51 
52 typedef std::set<std::string>               StringSet;
53 
54 class lefrProps {
55 public:
56     lefiPropType  lefrCompProp;
57     lefiPropType  lefrLayerProp;
58     lefiPropType  lefrLibProp;
59     lefiPropType  lefrMacroProp;
60     lefiPropType  lefrNondefProp;
61     lefiPropType  lefrPinProp;
62     lefiPropType  lefrViaProp;
63     lefiPropType  lefrViaRuleProp;
64 };
65 
66 class lefrSettings {
67 public:
68                     lefrSettings();
69 
70     void            init_symbol_table();
71     static void     reset();
72     void            addLef58Type(const char *lef58Type,
73                                  const char **layerType);
74 
75     std::string     getLayerLef58Types(const char *type) const;
76 
77     void            disableMsg(int msgId);
78     void            enableMsg(int msgId);
79     void            enableAllMsgs();
80     int             suppresMsg(int msgId);
81 
82     static std::string     getToken(const std::string   &input,
83                                     int                 &startIdx);
84 
85     lefKeywordMap       Keyword_set;
86 
87     char CommentChar;
88     double VersionNum;
89     int DisPropStrProcess;
90     int CaseSensitive;
91     int CaseSensitiveSet;
92     int DeltaNumberLines;
93     int AntennaInoutWarnings;
94     int AntennaInputWarnings;
95     int AntennaOutputWarnings;
96     int ArrayWarnings;
97     int CaseSensitiveWarnings;
98     int CorrectionTableWarnings;
99     int DielectricWarnings;
100     int EdgeRateScaleFactorWarnings;
101     int EdgeRateThreshold1Warnings;
102     int EdgeRateThreshold2Warnings;
103     int IRDropWarnings;
104     int InoutAntennaWarnings;
105     int InputAntennaWarnings;
106     LEFI_LINE_NUMBER_FUNCTION LineNumberFunction;
107     int LayerWarnings;
108     int MacroWarnings;
109     int MaxStackViaWarnings;
110     int MinFeatureWarnings;
111     int NoWireExtensionWarnings;
112     int NoiseMarginWarnings;
113     int NoiseTableWarnings;
114     int NonDefaultWarnings;
115     int OutputAntennaWarnings;
116     int PinWarnings;
117     LEFI_READ_FUNCTION ReadFunction;
118     int ReadEncrypted;
119     int RegisterUnused;
120     int RelaxMode;
121     int ShiftCase;
122     int SiteWarnings;
123     int SpacingWarnings;
124     int TimingWarnings;
125     int UnitsWarnings;
126     int UseMinSpacingWarnings;
127     int ViaRuleWarnings;
128     int ViaWarnings;
129     int LogFileAppend;
130     int TotalMsgLimit;
131     lefiUserData UserData;
132 
133     StringSet Lef58TypePairs;
134 
135     LEFI_MALLOC_FUNCTION MallocFunction;
136     LEFI_REALLOC_FUNCTION ReallocFunction;
137     LEFI_FREE_FUNCTION FreeFunction;
138     LEFI_LOG_FUNCTION ErrorLogFunction;
139     LEFI_LOG_FUNCTION SetLogFunction;
140     LEFI_WARNING_LOG_FUNCTION WarningLogFunction;
141 
142     int MsgLimit[MAX_LEF_MSGS];
143 
144     MsgsDisableMap msgsDisableMap;
145     int  dAllMsgs;
146 
147     lefrProps lefProps;
148 };
149 
150 extern lefrSettings* lefSettings;
151 
152 END_LEFDEF_PARSER_NAMESPACE
153 
154 #endif
155