48
48
49
49
%{
50
50
51
+ #include <map>
52
+
51
53
#include <stdio.h>
52
54
#include <stdlib.h>
53
55
#include <assert.h>
@@ -202,7 +204,7 @@ struct fortranscannerYY_state
202
204
//! Accumulated modifiers of current statement, eg variable declaration.
203
205
SymbolModifiers currentModifiers;
204
206
//! Holds program scope->symbol name->symbol modifiers.
205
- QMap <Entry*,QMap<QCString ,SymbolModifiers> > modifiers;
207
+ std::map <Entry*,std::map<std::string ,SymbolModifiers> > modifiers;
206
208
int anonCount = 0 ;
207
209
};
208
210
@@ -712,7 +714,7 @@ private {
712
714
}
713
715
{ID} {
714
716
QCString name = yytext;
715
- yyextra->modifiers[yyextra->current_root][name.lower()] |= yyextra->currentModifiers;
717
+ yyextra->modifiers[yyextra->current_root][name.lower().str() ] |= yyextra->currentModifiers;
716
718
yyextra->current->section = Entry::FUNCTION_SEC;
717
719
yyextra->current->name = name;
718
720
yyextra->current->fileName = yyextra->fileName;
@@ -872,7 +874,7 @@ private {
872
874
QCString name=yytext;
873
875
name = name.lower();
874
876
/* remember attributes for the symbol */
875
- yyextra->modifiers[yyextra->current_root][name.lower()] |= yyextra->currentModifiers;
877
+ yyextra->modifiers[yyextra->current_root][name.lower().str() ] |= yyextra->currentModifiers;
876
878
yyextra->argName= name;
877
879
878
880
yyextra->vtype= V_IGNORE;
@@ -913,12 +915,12 @@ private {
913
915
// save, it may be function return type
914
916
if (parameter)
915
917
{
916
- yyextra->modifiers[yyextra->current_root][name.lower()].type = yyextra->argType;
918
+ yyextra->modifiers[yyextra->current_root][name.lower().str() ].type = yyextra->argType;
917
919
}
918
920
else
919
921
{
920
922
if ((yyextra->current_root->name.lower() == yyextra->argName.lower()) ||
921
- (yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower()].returnName.lower() == yyextra->argName.lower()))
923
+ (yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower().str() ].returnName.lower() == yyextra->argName.lower()))
922
924
{
923
925
int strt = yyextra->current_root->type.find("function");
924
926
QCString lft;
@@ -956,11 +958,11 @@ private {
956
958
yyextra->current_root->type += " " + yyextra->argType.stripWhiteSpace();
957
959
}
958
960
yyextra->current_root->type = yyextra->current_root->type.stripWhiteSpace();
959
- yyextra->modifiers[yyextra->current_root][name.lower()].type = yyextra->current_root->type;
961
+ yyextra->modifiers[yyextra->current_root][name.lower().str() ].type = yyextra->current_root->type;
960
962
}
961
963
else
962
964
{
963
- yyextra->modifiers[yyextra->current_root][name.lower()].type = yyextra->argType;
965
+ yyextra->modifiers[yyextra->current_root][name.lower().str() ].type = yyextra->argType;
964
966
}
965
967
}
966
968
// any accumulated doc for argument should be emptied,
@@ -974,7 +976,7 @@ private {
974
976
QCString name(yyextra->argName);
975
977
QCString attr("dimension");
976
978
attr += yytext;
977
- yyextra->modifiers[yyextra->current_root][name.lower()] |= attr;
979
+ yyextra->modifiers[yyextra->current_root][name.lower().str() ] |= attr;
978
980
}
979
981
<Variable>{COMMA} { //printf("COMMA: %d<=..<=%d\n", yyextra->colNr-(int)yyleng, yyextra->colNr);
980
982
// locate !< comment
@@ -1148,7 +1150,7 @@ private {
1148
1150
<Subprog>{BS} { /* ignore white space */ }
1149
1151
<Subprog>{ID} { yyextra->current->name = yytext;
1150
1152
//cout << "1a==========> got " << yyextra->current->type << " " << yytext << " " << yyextra->lineNr << endl;
1151
- yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower()].returnName = yyextra->current->name.lower();
1153
+ yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower().str() ].returnName = yyextra->current->name.lower();
1152
1154
1153
1155
if (yyextra->ifType == IF_ABSTRACT || yyextra->ifType == IF_SPECIFIC)
1154
1156
{
@@ -1197,7 +1199,7 @@ private {
1197
1199
QCString result= yytext;
1198
1200
result= result.right(result.length()-result.find("(")-1);
1199
1201
result= result.stripWhiteSpace();
1200
- yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower()].returnName = result;
1202
+ yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower().str() ].returnName = result;
1201
1203
}
1202
1204
//cout << "=====> got result " << result << endl;
1203
1205
}
@@ -2019,7 +2021,7 @@ static Argument *findArgument(Entry* subprog, QCString name, bool byTypeName = F
2019
2021
2020
2022
2021
2023
/*! Apply yyextra->modifiers stored in \a mdfs to the \a typeName string. */
2022
- static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs)
2024
+ static QCString applyModifiers(QCString typeName, const SymbolModifiers& mdfs)
2023
2025
{
2024
2026
if (!mdfs.dimension.isNull())
2025
2027
{
@@ -2136,14 +2138,14 @@ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs)
2136
2138
}
2137
2139
2138
2140
/*! Apply yyextra->modifiers stored in \a mdfs to the \a arg argument. */
2139
- static void applyModifiers(Argument *arg, SymbolModifiers& mdfs)
2141
+ static void applyModifiers(Argument *arg, const SymbolModifiers& mdfs)
2140
2142
{
2141
2143
QCString tmp = arg->type;
2142
2144
arg->type = applyModifiers(tmp, mdfs);
2143
2145
}
2144
2146
2145
2147
/*! Apply yyextra->modifiers stored in \a mdfs to the \a ent entry. */
2146
- static void applyModifiers(Entry *ent, SymbolModifiers& mdfs)
2148
+ static void applyModifiers(Entry *ent, const SymbolModifiers& mdfs)
2147
2149
{
2148
2150
QCString tmp = ent->type;
2149
2151
ent->type = applyModifiers(tmp, mdfs);
@@ -2164,8 +2166,7 @@ static void startScope(yyscan_t yyscanner,Entry *scope)
2164
2166
//cout<<"start scope: "<<scope->name<<endl;
2165
2167
yyextra->current_root= scope; /* start substructure */
2166
2168
2167
- QMap<QCString,SymbolModifiers> mdfMap;
2168
- yyextra->modifiers.insert(scope, mdfMap);
2169
+ yyextra->modifiers.insert(std::make_pair(scope, std::map<std::string,SymbolModifiers>()));
2169
2170
}
2170
2171
2171
2172
/*! Ends scope in fortran program: may update subprogram arguments or module variable attributes.
@@ -2196,32 +2197,32 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot)
2196
2197
}
2197
2198
2198
2199
// update variables or subprogram arguments with yyextra->modifiers
2199
- QMap<QCString ,SymbolModifiers>& mdfsMap = yyextra->modifiers[scope];
2200
+ std::map<std::string ,SymbolModifiers>& mdfsMap = yyextra->modifiers[scope];
2200
2201
2201
2202
if (scope->section == Entry::FUNCTION_SEC)
2202
2203
{
2203
2204
// iterate all symbol yyextra->modifiers of the scope
2204
- for (QMap<QCString,SymbolModifiers>::Iterator it=mdfsMap.begin(); it!=mdfsMap.end(); it++)
2205
+ for (const auto &kv : mdfsMap)
2205
2206
{
2206
2207
//cout<<it.key()<<": "<<it.data()<<endl;
2207
- Argument *arg = findArgument(scope, it.key() );
2208
+ Argument *arg = findArgument(scope, kv.first );
2208
2209
2209
2210
if (arg)
2210
2211
{
2211
- applyModifiers(arg, it.data() );
2212
+ applyModifiers(arg, kv.second );
2212
2213
}
2213
2214
}
2214
2215
2215
2216
// find return type for function
2216
2217
//cout<<"RETURN NAME "<<yyextra->modifiers[yyextra->current_root][scope->name.lower()].returnName<<endl;
2217
- QCString returnName = yyextra->modifiers[yyextra->current_root][scope->name.lower()].returnName.lower();
2218
- if (yyextra->modifiers[scope].contains (returnName))
2218
+ QCString returnName = yyextra->modifiers[yyextra->current_root][scope->name.lower().str() ].returnName.lower();
2219
+ if (yyextra->modifiers[scope].find (returnName.str())!=yyextra->modifiers[scope].end())
2219
2220
{
2220
- scope->type = yyextra->modifiers[scope][returnName].type; // returning type works
2221
- applyModifiers(scope, yyextra->modifiers[scope][returnName]); // returning array works
2221
+ scope->type = yyextra->modifiers[scope][returnName.str() ].type; // returning type works
2222
+ applyModifiers(scope, yyextra->modifiers[scope][returnName.str() ]); // returning array works
2222
2223
}
2223
2224
2224
- }
2225
+ }
2225
2226
if (scope->section == Entry::CLASS_SEC)
2226
2227
{ // was INTERFACE_SEC
2227
2228
if (scope->parent()->section == Entry::FUNCTION_SEC)
@@ -2249,7 +2250,7 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot)
2249
2250
if ((count == 1) && found)
2250
2251
{
2251
2252
// clear all yyextra->modifiers of the scope
2252
- yyextra->modifiers.remove (scope);
2253
+ yyextra->modifiers.erase (scope);
2253
2254
scope->parent()->removeSubEntry(scope);
2254
2255
scope = 0;
2255
2256
return TRUE;
@@ -2265,13 +2266,13 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot)
2265
2266
continue;
2266
2267
2267
2268
//cout<<ce->name<<", "<<mdfsMap.contains(ce->name.lower())<<mdfsMap.count()<<endl;
2268
- if (mdfsMap.contains (ce->name.lower()))
2269
- applyModifiers(ce.get(), mdfsMap[ce->name.lower()]);
2269
+ if (mdfsMap.find (ce->name.lower().str())!=mdfsMap.end( ))
2270
+ applyModifiers(ce.get(), mdfsMap[ce->name.lower().str() ]);
2270
2271
}
2271
2272
}
2272
2273
2273
2274
// clear all yyextra->modifiers of the scope
2274
- yyextra->modifiers.remove (scope);
2275
+ yyextra->modifiers.erase (scope);
2275
2276
2276
2277
return TRUE;
2277
2278
}
@@ -2522,7 +2523,7 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b
2522
2523
loc_doc.stripWhiteSpace();
2523
2524
2524
2525
// direction as defined with the declaration of the parameter
2525
- int dir1 = yyextra->modifiers[yyextra->current_root][yyextra->argName.lower()].direction;
2526
+ int dir1 = yyextra->modifiers[yyextra->current_root][yyextra->argName.lower().str() ].direction;
2526
2527
// in description [in] is specified
2527
2528
if (loc_doc.lower().find(directionParam[SymbolModifiers::IN]) == 0)
2528
2529
{
0 commit comments