From 941eea998d6b9608b8fc586069ef90e805d771f5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 15 Mar 2014 16:50:07 +0100 Subject: [PATCH] Some restructuring and some compiler warning fixes --- doc/docblocks.doc | 6 +++--- src/commentcnv.h | 2 +- src/context.cpp | 2 +- src/dot.cpp | 8 ++++++-- src/fortrancode.h | 8 +++++--- src/fortrancode.l | 12 ++++++------ src/fortranscanner.h | 16 ++++++++-------- src/fortranscanner.l | 14 +++++++------- src/index.cpp | 2 +- src/language.cpp | 10 ---------- src/lodepng.cpp | 2 +- src/types.h | 7 +++++++ src/util.h | 1 - 13 files changed, 46 insertions(+), 44 deletions(-) diff --git a/doc/docblocks.doc b/doc/docblocks.doc index 2cfff9a9555..6ef6bf06421 100644 --- a/doc/docblocks.doc +++ b/doc/docblocks.doc @@ -460,10 +460,10 @@ settings where overruled. When using doxygen for Fortran code you should set \ref cfg_optimize_for_fortran "OPTIMIZE_FOR_FORTRAN" to \c YES. -The parser tries to guess wheter the source code is fixed format Fortran or -free format Fortran code. This is not always correct, in the later case +The parser tries to guess if the source code is fixed format Fortran or +free format Fortran code. This may not always be correct. If not one should use \ref cfg_extension_mapping "EXTENSION_MAPPING" to correct this. -By setteing `EXTENSION_MAPPING = f=FortranFixed f90=FortranFree` files with +By setting `EXTENSION_MAPPING = f=FortranFixed f90=FortranFree` files with extension \c f90 are interpreted as fixed format Fortran code and files with extension \c f are interpreted as free format Fortran code. diff --git a/src/commentcnv.h b/src/commentcnv.h index 90206dff9f7..6255a734074 100644 --- a/src/commentcnv.h +++ b/src/commentcnv.h @@ -16,7 +16,7 @@ */ #ifndef _COMMENTCNV_H -#define _COMMNETCNV_H +#define _COMMENTCNV_H class BufStr; diff --git a/src/context.cpp b/src/context.cpp index 0597493baee..9c99453b9a7 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -4045,7 +4045,7 @@ class ClassInheritanceContext::Private : public GenericNodeListContext bool b; if (cd->getLanguage()==SrcLangExt_VHDL) { - if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) + if ((VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS) { continue; } diff --git a/src/dot.cpp b/src/dot.cpp index ea41685a654..a1540afb3ad 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -2462,8 +2462,12 @@ void DotGfxHierarchyTable::addClassList(ClassSDict *cl) for (cli.toLast();(cd=cli.current());--cli) { //printf("Trying %s subClasses=%d\n",cd->name().data(),cd->subClasses()->count()); - if (cd->getLanguage()==SrcLangExt_VHDL && !(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) - continue; + if (cd->getLanguage()==SrcLangExt_VHDL && + (VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS + ) + { + continue; + } if (!hasVisibleRoot(cd->baseClasses()) && cd->isVisibleInHierarchy() ) // root node in the forest diff --git a/src/fortrancode.h b/src/fortrancode.h index 2beea698ff9..b64ede7ec42 100644 --- a/src/fortrancode.h +++ b/src/fortrancode.h @@ -15,8 +15,10 @@ * */ -#ifndef CODE_H -#define CODE_H +#ifndef FORTRANCODE_H +#define FORTRANCODE_H + +#include "types.h" class CodeOutputInterface; class FileDef; @@ -28,7 +30,7 @@ void parseFortranCode(CodeOutputInterface &,const char *,const QCString &, bool ,const char *,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool showLineNumbers,Definition *searchCtx, - bool collectRefs, FortranKind codeType); + bool collectRefs, FortranFormat format); void resetFortranCodeParserState(); void codeFreeScanner(); diff --git a/src/fortrancode.l b/src/fortrancode.l index 8640f15f6ca..c31080bdfd4 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -154,14 +154,14 @@ static int bracketCount = 0; // simplified way to know if this is fixed form // duplicate in fortranscanner.l -static bool recognizeFixedForm(const char* contents, FortranKind codeType) +static bool recognizeFixedForm(const char* contents, FortranFormat format) { int column=0; bool skipLine=FALSE; - if (codeType == FORTRAN_FIXED) return TRUE; - if (codeType == FORTRAN_FREE) return FALSE; - for (int i=0;;i++) + if (format == FortranFormat_Fixed) return TRUE; + if (format == FortranFormat_Free) return FALSE; + for (int i=0;;i++) { column++; @@ -1110,7 +1110,7 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri bool exBlock, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool,Definition *searchCtx, - bool collectXRefs, FortranKind codeType) + bool collectXRefs, FortranFormat format) { //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd); @@ -1124,7 +1124,7 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri g_code = &od; g_inputString = s; g_inputPosition = 0; - g_isFixedForm = recognizeFixedForm((const char*)s,codeType); + g_isFixedForm = recognizeFixedForm((const char*)s,format); g_currentFontClass = 0; g_needsTermination = FALSE; g_searchCtx = searchCtx; diff --git a/src/fortranscanner.h b/src/fortranscanner.h index ec0d3128ce6..92a8669123a 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -19,7 +19,6 @@ #define SCANNER_FORTRAN_H #include "parserintf.h" -#include "util.h" /** \brief Fortran language parser using state-based lexical scanning. * @@ -28,10 +27,10 @@ class FortranLanguageScanner : public ParserInterface { public: - FortranLanguageScanner(void) { codeType = FORTRAN_UNKNOWN;} - virtual ~FortranLanguageScanner(void) {} + FortranLanguageScanner(FortranFormat format=FortranFormat_Unknown) : m_format(format) { } + virtual ~FortranLanguageScanner() {} void startTranslationUnit(const char *) {} - void finishTranslationUnit(void) {} + void finishTranslationUnit() {} void parseInput(const char *fileName, const char *fileBuf, Entry *root, @@ -53,22 +52,23 @@ class FortranLanguageScanner : public ParserInterface Definition *searchCtx=0, bool collectXRefs=TRUE ); - void resetCodeParserState(void); + void resetCodeParserState(); void parsePrototype(const char *text); - FortranKind codeType; + private: + FortranFormat m_format; }; class FortranLanguageScannerFree : public FortranLanguageScanner { public: - FortranLanguageScannerFree(void) { codeType = FORTRAN_FREE; } + FortranLanguageScannerFree() : FortranLanguageScanner(FortranFormat_Free) { } }; class FortranLanguageScannerFixed : public FortranLanguageScanner { public: - FortranLanguageScannerFixed(void) { codeType = FORTRAN_FIXED; } + FortranLanguageScannerFixed() : FortranLanguageScanner(FortranFormat_Fixed) { } }; #endif diff --git a/src/fortranscanner.l b/src/fortranscanner.l index e083b2d5eb4..f6616ada46e 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -1313,13 +1313,13 @@ void truncatePrepass(int index) // simplified way to know if this is fixed form // duplicate in fortrancode.l -static bool recognizeFixedForm(const char* contents, FortranKind codeType) +static bool recognizeFixedForm(const char* contents, FortranFormat format) { int column=0; bool skipLine=FALSE; - if (codeType == FORTRAN_FIXED) return TRUE; - if (codeType == FORTRAN_FREE) return FALSE; + if (format == FortranFormat_Fixed) return TRUE; + if (format == FortranFormat_Free) return FALSE; for(int i=0;;i++) { column++; @@ -2246,7 +2246,7 @@ level--; #endif -static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, FortranKind codeType) +static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, FortranFormat format) { char *tmpBuf = NULL; initParser(); @@ -2266,7 +2266,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra inputFile.setName(fileName); if (inputFile.open(IO_ReadOnly)) { - isFixedForm = recognizeFixedForm(fileBuf,codeType); + isFixedForm = recognizeFixedForm(fileBuf,format); if (isFixedForm) { @@ -2345,7 +2345,7 @@ void FortranLanguageScanner::parseInput(const char *fileName, printlex(yy_flex_debug, TRUE, __FILE__, fileName); - ::parseMain(fileName,fileBuf,root,this->codeType); + ::parseMain(fileName,fileBuf,root,m_format); printlex(yy_flex_debug, FALSE, __FILE__, fileName); } @@ -2368,7 +2368,7 @@ void FortranLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, { ::parseFortranCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef, - showLineNumbers,searchCtx,collectXRefs,this->codeType); + showLineNumbers,searchCtx,collectXRefs,m_format); } bool FortranLanguageScanner::needsPreprocessing(const QCString &extension) diff --git a/src/index.cpp b/src/index.cpp index 2fdd0deba33..9bbc4a4c47c 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -811,7 +811,7 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FT bool b; if (cd->getLanguage()==SrcLangExt_VHDL) { - if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) + if ((VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS) { continue; } diff --git a/src/language.cpp b/src/language.cpp index c7a2b12d69f..3b57de1cba7 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -156,16 +156,6 @@ Translator *theTranslator=0; -static const char obsoleteMsg[] = - "---------\n" - "ERROR: The selected language is no longer supported!\n" - "If you want doxygen to produce output in this language \n" - "you are kindly requested to help bringing the documentation \n" - "up to date. Please read the development section of the manual \n" - "for more information or contact Petr Prikryl (Prikryl@skil.cz).\n" - "Thanks in advance!\n" - "---------\n"; - bool setTranslator(const char *langName) { if (L_EQUAL("english")) diff --git a/src/lodepng.cpp b/src/lodepng.cpp index df8378e420f..b237d5a9065 100644 --- a/src/lodepng.cpp +++ b/src/lodepng.cpp @@ -1146,10 +1146,10 @@ static unsigned encodeLZ77_brute(uivector* out, const unsigned char* in, size_t } #endif +/* static const unsigned HASH_NUM_VALUES = 65536; static const unsigned HASH_NUM_CHARACTERS = 6; static const unsigned HASH_SHIFT = 2; -/* Good and fast values: HASH_NUM_VALUES=65536, HASH_NUM_CHARACTERS=6, HASH_SHIFT=2 making HASH_NUM_CHARACTERS larger (like 8), makes the file size larger but is a bit faster making HASH_NUM_CHARACTERS smaller (like 3), makes the file size smaller but is slower diff --git a/src/types.h b/src/types.h index a05a72d16c6..688d664ba98 100644 --- a/src/types.h +++ b/src/types.h @@ -210,4 +210,11 @@ enum MemberType MemberType_Service, }; +enum FortranFormat +{ + FortranFormat_Unknown, + FortranFormat_Free, + FortranFormat_Fixed +}; + #endif diff --git a/src/util.h b/src/util.h index 5f9a8730c58..c131dd074a3 100644 --- a/src/util.h +++ b/src/util.h @@ -414,7 +414,6 @@ QCString externalRef(const QCString &relPath,const QCString &ref,bool href); int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos); const char *writeUtf8Char(FTextStream &t,const char *s); -enum FortranKind { FORTRAN_UNKNOWN = 0, FORTRAN_FREE, FORTRAN_FIXED}; /** Data associated with a HSV colored image. */ struct ColoredImgDataItem