64
64
// #define DEBUGFLOW
65
65
#define theTranslator_vhdlType theTranslator->trVhdlType
66
66
67
- static QDict<QCString> g_vhdlKeyDict0 (17 ,FALSE );
68
- static QDict<QCString> g_vhdlKeyDict1 (17 ,FALSE );
69
- static QDict<QCString> g_vhdlKeyDict2 (17 ,FALSE );
70
- static QDict<QCString> g_vhdlKeyDict3 (17 ,FALSE );
71
-
72
67
static void initUCF (Entry* root,const char * type,QCString & qcs,int line,QCString & fileName,QCString & brief);
73
68
static void writeUCFLink (const MemberDef* mdef,OutputList &ol);
74
69
static void addInstance (ClassDefMutable* entity, ClassDefMutable* arch, ClassDefMutable *inst,
@@ -562,11 +557,8 @@ VhdlDocGen::~VhdlDocGen()
562
557
{
563
558
}
564
559
565
- void VhdlDocGen::init ()
566
- {
567
-
568
560
// vhdl keywords included VHDL 2008
569
- const char * g_vhdlKeyWordMap0[] =
561
+ static const std::set< std::string > g_vhdlKeyWordSet0 =
570
562
{
571
563
" abs" ," access" ," after" ," alias" ," all" ," and" ," architecture" ," array" ," assert" ," assume" ," assume_guarantee" ," attribute" ,
572
564
" begin" ," block" ," body" ," buffer" ," bus" ,
@@ -587,100 +579,57 @@ const char* g_vhdlKeyWordMap0[] =
587
579
" unaffected" ," units" ," until" ," use" ,
588
580
" variable" ," vmode" ," vprop" ," vunit" ,
589
581
" wait" ," when" ," while" ," with" ,
590
- " xor" ," xnor" ,
591
- 0
582
+ " xor" ," xnor"
592
583
};
593
584
594
585
595
586
// type
596
- const char * g_vhdlKeyWordMap1[] =
587
+ static const std::set< std::string> g_vhdlKeyWordSet1 =
597
588
{
598
589
" natural" ," unsigned" ," signed" ," string" ," boolean" , " bit" ," bit_vector" ," character" ,
599
590
" std_ulogic" ," std_ulogic_vector" ," std_logic" ," std_logic_vector" ," integer" ,
600
- " real" ," float" ," ufixed" ," sfixed" ," time" ," positive" , 0
591
+ " real" ," float" ," ufixed" ," sfixed" ," time" ," positive"
601
592
};
602
593
603
594
// logic
604
- const char * g_vhdlKeyWordMap2[] =
595
+ static const std::set< std::string > g_vhdlKeyWordSet2 =
605
596
{
606
- " abs" ," and" ," or" ," not" ," mod" , " xor" ," rem" ," xnor" ," ror" ," rol" ," sla" ,
607
- " sll" ,0
597
+ " abs" ," and" ," or" ," not" ," mod" ," xor" ," rem" ," xnor" ," ror" ," rol" ," sla" ," sll"
608
598
};
609
599
610
600
// predefined attributes
611
- const char * g_vhdlKeyWordMap3[] =
601
+ static const std::set< std::string > g_vhdlKeyWordSet3 =
612
602
{
613
- " base" ," left" ," right" ," high" ," low" ," ascending" ,
614
- " image" ," value" ," pos" ," val" ," succ" ," pred" ," leftof" ," rightof" ," left" ," right" ," high" ," low" ,
615
- " range" ," reverse_range" ," length" ," ascending" ," delayed" ," stable" ," quiet" ," transaction" ," event" ,
616
- " active" ," last_event" ," last_active" ," last_value" ," driving" ," driving_value" ," simple_name" ," instance_name" ," path_name" , 0
603
+ " base" ," left" ," right" ," high" ," low" ," ascending" ,
604
+ " image" ," value" ," pos" ," val" ," succ" ," pred" ," leftof" ," rightof" ," left" ," right" ," high" ," low" ,
605
+ " range" ," reverse_range" ," length" ," ascending" ," delayed" ," stable" ," quiet" ," transaction" ," event" ,
606
+ " active" ," last_event" ," last_active" ," last_value" ," driving" ," driving_value" ," simple_name" ," instance_name" ," path_name"
617
607
};
618
608
619
- int j=0 ;
620
- g_vhdlKeyDict0.setAutoDelete (TRUE );
621
- g_vhdlKeyDict1.setAutoDelete (TRUE );
622
- g_vhdlKeyDict2.setAutoDelete (TRUE );
623
- g_vhdlKeyDict3.setAutoDelete (TRUE );
624
-
625
- while (g_vhdlKeyWordMap0[j])
626
- {
627
- g_vhdlKeyDict0.insert (g_vhdlKeyWordMap0[j],
628
- new QCString (g_vhdlKeyWordMap0[j]));
629
- j++;
630
- }
631
-
632
- j=0 ;
633
- while (g_vhdlKeyWordMap1[j])
634
- {
635
- g_vhdlKeyDict1.insert (g_vhdlKeyWordMap1[j],
636
- new QCString (g_vhdlKeyWordMap1[j]));
637
- j++;
638
- }
639
-
640
- j=0 ;
641
- while (g_vhdlKeyWordMap2[j])
642
- {
643
- g_vhdlKeyDict2.insert (g_vhdlKeyWordMap2[j],
644
- new QCString (g_vhdlKeyWordMap2[j]));
645
- j++;
646
- }
647
-
648
- j=0 ;
649
- while (g_vhdlKeyWordMap3[j])
650
- {
651
- g_vhdlKeyDict3.insert (g_vhdlKeyWordMap3[j],
652
- new QCString (g_vhdlKeyWordMap3[j]));
653
- j++;
654
- }
655
-
656
- }// buildKeyMap
609
+ void VhdlDocGen::init ()
610
+ {
611
+ }
657
612
658
613
/* !
659
614
* returns the color of a keyword
660
615
*/
661
-
662
- QCString* VhdlDocGen::findKeyWord (const QCString& tmp)
616
+ const char * VhdlDocGen::findKeyWord (const QCString& kw)
663
617
{
664
- static QCString vhdlkeyword (" vhdlkeyword" );
665
- static QCString vhdltype (" keywordtype" );
666
- static QCString vhdllogic (" vhdllogic" );
667
- static QCString preprocessor (" keywordflow" );
668
-
669
- QCString word=tmp.lower ();
618
+ std::string word=kw.lower ().str ();
670
619
671
- if (word.isEmpty () || word. at ( 0 )== ' \0 ' ) return 0 ;
620
+ if (word.empty () ) return 0 ;
672
621
673
- if (g_vhdlKeyDict0 .find (word))
674
- return &preprocessor ;
622
+ if (g_vhdlKeyWordSet0 .find (word)!=g_vhdlKeyWordSet0. end ( ))
623
+ return " keywordflow " ;
675
624
676
- if (g_vhdlKeyDict1 .find (word))
677
- return &vhdltype ;
625
+ if (g_vhdlKeyWordSet1 .find (word)!=g_vhdlKeyWordSet1. end ( ))
626
+ return " keywordtype " ;
678
627
679
- if (g_vhdlKeyDict2 .find (word))
680
- return & vhdllogic;
628
+ if (g_vhdlKeyWordSet2 .find (word)!=g_vhdlKeyWordSet2. end ( ))
629
+ return " vhdllogic" ;
681
630
682
- if (g_vhdlKeyDict3 .find (word))
683
- return & vhdlkeyword;
631
+ if (g_vhdlKeyWordSet3 .find (word)!=g_vhdlKeyWordSet3. end ( ))
632
+ return " vhdlkeyword" ;
684
633
685
634
return 0 ;
686
635
}
@@ -1267,7 +1216,6 @@ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberD
1267
1216
QRegExp reg (" [\\ [\\ ]\\ .\\ /\\ :\\ <\\ >\\ :\\ s\\ ,\\ ;\\ '\\ +\\ -\\ *\\ |\\ &\\ =\\ (\\ )\" ]" );
1268
1217
QCString qcs = s;
1269
1218
qcs+=QCString (" " );// parsing the last sign
1270
- QCString *ss;
1271
1219
QCString find=qcs;
1272
1220
QCString temp=qcs;
1273
1221
char buf[2 ];
@@ -1284,7 +1232,7 @@ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberD
1284
1232
{
1285
1233
find=find.left (j);
1286
1234
buf[0 ]=temp[j];
1287
- ss=VhdlDocGen::findKeyWord (find);
1235
+ const char * ss=VhdlDocGen::findKeyWord (find);
1288
1236
bool k=isNumber (find); // is this a number
1289
1237
if (k)
1290
1238
{
@@ -1294,7 +1242,7 @@ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberD
1294
1242
}
1295
1243
else if (j != 0 && ss)
1296
1244
{
1297
- startFonts (find,ss-> data () ,ol);
1245
+ startFonts (find,ss,ol);
1298
1246
}
1299
1247
else
1300
1248
{
@@ -1430,11 +1378,11 @@ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList &al,const
1430
1378
nn+=" : " ;
1431
1379
1432
1380
QCString defval = arg.defval ;
1433
- QCString *str=VhdlDocGen::findKeyWord (defval);
1381
+ const char *str=VhdlDocGen::findKeyWord (defval);
1434
1382
defval+=" " ;
1435
1383
if (str)
1436
1384
{
1437
- startFonts (defval,str-> data () ,ol);
1385
+ startFonts (defval,str,ol);
1438
1386
}
1439
1387
else
1440
1388
{
@@ -1495,7 +1443,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const
1495
1443
}
1496
1444
if (!att.isEmpty ())
1497
1445
{
1498
- QCString *str=VhdlDocGen::findKeyWord (att);
1446
+ const char *str=VhdlDocGen::findKeyWord (att);
1499
1447
att+=" " ;
1500
1448
if (str)
1501
1449
VhdlDocGen::formatString (att,ol,mdef);
@@ -1509,7 +1457,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const
1509
1457
QCString w=ss.stripWhiteSpace ();// .upper();
1510
1458
startFonts (nn," vhdlchar" ,ol);
1511
1459
startFonts (" in " ," stringliteral" ,ol);
1512
- QCString *str=VhdlDocGen::findKeyWord (ss);
1460
+ const char *str=VhdlDocGen::findKeyWord (ss);
1513
1461
if (str)
1514
1462
VhdlDocGen::formatString (w,ol,mdef);
1515
1463
else
0 commit comments