Skip to content

Commit

Permalink
Some restructuring and some compiler warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Mar 15, 2014
1 parent c1e2523 commit 941eea9
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 44 deletions.
6 changes: 3 additions & 3 deletions doc/docblocks.doc
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/commentcnv.h
Expand Up @@ -16,7 +16,7 @@
*/

#ifndef _COMMENTCNV_H
#define _COMMNETCNV_H
#define _COMMENTCNV_H

class BufStr;

Expand Down
2 changes: 1 addition & 1 deletion src/context.cpp
Expand Up @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions src/dot.cpp
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/fortrancode.h
Expand Up @@ -15,8 +15,10 @@
*
*/

#ifndef CODE_H
#define CODE_H
#ifndef FORTRANCODE_H
#define FORTRANCODE_H

#include "types.h"

class CodeOutputInterface;
class FileDef;
Expand All @@ -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();

Expand Down
12 changes: 6 additions & 6 deletions src/fortrancode.l
Expand Up @@ -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++;

Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/fortranscanner.h
Expand Up @@ -19,7 +19,6 @@
#define SCANNER_FORTRAN_H

#include "parserintf.h"
#include "util.h"

/** \brief Fortran language parser using state-based lexical scanning.
*
Expand All @@ -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,
Expand All @@ -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
14 changes: 7 additions & 7 deletions src/fortranscanner.l
Expand Up @@ -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++;
Expand Down Expand Up @@ -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();
Expand All @@ -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)
{
Expand Down Expand Up @@ -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);
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/index.cpp
Expand Up @@ -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;
}
Expand Down
10 changes: 0 additions & 10 deletions src/language.cpp
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion src/lodepng.cpp
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/types.h
Expand Up @@ -210,4 +210,11 @@ enum MemberType
MemberType_Service,
};

enum FortranFormat
{
FortranFormat_Unknown,
FortranFormat_Free,
FortranFormat_Fixed
};

#endif
1 change: 0 additions & 1 deletion src/util.h
Expand Up @@ -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
Expand Down

0 comments on commit 941eea9

Please sign in to comment.