diff options
author | albert-github <albert.tests@gmail.com> | 2013-10-01 17:14:28 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2013-10-06 11:50:46 (GMT) |
commit | ac2cd570cc7f606963d7cac15d3f3e11c6e305f3 (patch) | |
tree | 1a29528b7b89f2c2e1841d0957a2da1d376cda65 /addon | |
parent | e835d4b28e1db3bdcdf3bfa718bc85445587ccd9 (diff) | |
download | Doxygen-ac2cd570cc7f606963d7cac15d3f3e11c6e305f3.zip Doxygen-ac2cd570cc7f606963d7cac15d3f3e11c6e305f3.tar.gz Doxygen-ac2cd570cc7f606963d7cac15d3f3e11c6e305f3.tar.bz2 |
This patch contains changes regarding the build system so that the *nix and Windows systems use the same information (consistency). Some use names routine names have been changed (from .l files with -P option) to reflect the file name that generated the routines, this makes it easier to create a general procedure.
A number of include / header files are files are generated from different file types (html, xml, js), due some limitations of the windows build system the generated file names had to be changed (the extension in the windows build system is only available including the '.' so e.g. the file jquery_fx.js generates now jquery_fx.js.h instead of jquery_fx_js.h)
In the windows version the creation of .cpp files from .l files has been adjusted to correct for the YY_BUF_SIZE problems.
Furthermore on windows (and also used on *nix) some commends have been replaced with python scripts so that on windows only python is need (besides flex and and bison). On *nix also perl is required for the generation using tmake.
Below a short description of the changes will be given and grouped.
Changed files
=============
- .gitignore
added some directories and file
- Doxyfile
corrected for changed file names
- Makefile.in
added realclean and some other changes (ignore error) and the moment when the Makefile is deleted (as last file).
Added entries for doxyapp and doxmlparser
Added realclean for the following files (consistency):
======================================================
- Makefile.win_make.in
- Makefile.win_nmake.in
- addon/doxmlparser/examples/metrics/Makefile.in
- addon/doxmlparser/src/Makefile.in
- addon/doxmlparser/test/Makefile.in
- addon/doxyapp/Makefile.in
- addon/doxysearch/Makefile.in
- libmd5/Makefile.in
- qtools/Makefile.in
- addon/doxyapp/doxyapp.pro.in
removed double occurence of -L../../lib
- addon/doxysearch/doxysearch.pro.in
no visible change just spacing?
- addon/doxywizard/Makefile.in
added realclean
corrected call to qmake (to get it from the right place, it is not necessarily in the path)
made some macros known in the called process
- addon/doxywizard/configdoc.cpp
automatically generated, can be removed
- addon/doxywizard/doxywizard.pro.in
corrected dependencies
corrected call to python (to get it from the right place, it is not necessarily in the path)
new items to generate version.cpp and config_doxyw.cpp
- configure
added configuration definition possibility for python
added possibility to build doxmlparser
automatically generate the lang_cfg.h file based on the available languages (translator_??.h) and not on a fixed list. This step still has to be added to the windows build process.
- doc/Makefile.in
corrected call to python (to get it from the right place, it is not necessarily in the path)
- doc/config.doc
small correction
- doc/install.doc
added python as a requirement
changed CVS to GitHub
- doc/language.doc
automatically generated file, based on other changes.
- doc/language.tpl
made XX and xx more consistent
changed description of the procedure based on changes already made configure.
- src/Makefile.in
adjusted used file names in distclean
Solved PERL usage consistent with LEX / YACC (with %%PERL%%)
automatically add translator_??>h to HEADERS
same spacing
Adjusted in the following file the names of some include files:
===============================================================
- src/cite.cpp
- src/docbookgen.cpp
- src/ftvhelp.cpp
- src/htmlgen.cpp
- src/layout.cpp
- src/searchindex.cpp
- src/xmlgen.cpp
Adjusted in the following files some routine names (..YY..) to be consistent with the file names:
=================================================================================================
- src/commentscan.l
- src/constexp.h
- src/constexp.l
- src/constexp.y
- src/fortrancode.l
- src/fortranscanner.l
- src/pyscanner.l
- src/pre.l
- src/scanner.l
- src/tclscanner.l
- src/vhdlparser.y
- src/vhdlscanner.l
- src/config.xml
small textual correction
- src/configoptions.cpp
generated output file, can be removed
- src/lang_cfg.h
Automatically generated file with selected languages (*nix). On windows a procedure has to be defined.
- src/libdoxycfg.t.in
corrected call to python (to get it from the right place, it is not necessarily in the path)
- src/libdoxygen.pro.in
adjusted include file names
removed translator_??.h files, they are added automatically
changed file name ce_lex.cpp -> constexp.cpp (generated file)
- src/libdoxygen.t.in
made LEX calls used the file name for the -P option
changed INCREASEBUF script to a python script
changed teh geneartion of some include file, now by means of a pythons script. Names of the generated include file had to be changed as well.
added possibility to generate version.cpp here as well.
Added HEADERS to dependency so non existing but later generated include files are recognized as well:
=====================================================================================================
- tmake/lib/unix/generic.t
- tmake/lib/win32-borland/generic.t
- tmake/lib/win32-g++/generic.t
- tmake/lib/win32-mingw/generic.t
- tmake/lib/win32-msvc/generic.t
- tmake/lib/win32-symantec/generic.t
- tmake/lib/win32-visage/generic.t
- tmake/lib/win32-watcom/generic.t
- winbuild/Doxygen.vcproj
made consistent wit *nix version.
Generating all possible files
removed unused /empty parts
setting for the Lex.rules and other rules files some default values
- winbuild/Doxywizard.vcproj
made consistent wit *nix version.
Generating all possible files
removed unused /empty parts
removed system dependent paths (C:\... etc) replaced then with external environment variables
- winbuild/Lex.rules
adjusted file to comply with new requirements, only user variable is -d. -i is set to read only (value can be changed in doxygen.vcproj). Handling of other arguments is all default.
generation including increasebuffer possibility
- winbuild/doxyindexer.vcproj
corrected path
- winbuild/doxysearch.vcproj
removed system dependent paths (C:\... etc) replaced then with external environment variables
- winbuild/qtools.vcproj
corrected type, wrong used directory
The following files are automatically generated (with slightly other names like index.xsd.h etc.):
==================================================================================================
- src/index_xsd.h
- src/doxygen_bst.h
- src/dynsections_js.h
- src/extsearch_js.h
- src/footer_html.h
- src/header_html.h
- src/jquery_fx_js.h
- src/jquery_p1_js.h
- src/jquery_p2_js.h
- src/jquery_p3_js.h
- src/jquery_pt_js.h
- src/jquery_ui_js.h
- src/navtree_css.h
- src/navtree_js.h
- src/resize_js.h
- src/search_css.h
- src/search_functions_php.h
- src/search_js.h
- src/search_opensearch_php.h
- src/svgpan_js.h
the following files are generated with different names:
- src/bib2xhtml.h
becomes
- src/bib2xhtml.pl/h
- src/layout_default.h
becomes
- src/layout_default.xml.h
The file:
=========
- addon/doxywizard/config.l
is replaced by:
- addon/doxywizard/config_doxyw.l
so there are in the system not 2 different config.l files. Renamed some routines from configYY -> config_doxywYY...
New files:
==========
- src/increasebuffer.py
increase YY_BUF_SIZE and YY_READ_BUF_SIZE from 16k / 8k to 256k.
- src/settings.py
create settings.h file
- src/to_c_cmd.py
create include files from different files (html, xml, js) so they can be included in the code as defaults
- src/version.py
create version.cpp file based on the configure file
- winbuild/Config.rules
rules file to convert the config.xml file into configoptions.cpp (doxygen) or configdoc.cpp (doxywizard). Seen the differences 2 rules are created within this file.
- winbuild/Gen_head.rules
rules files to generate include files from different files using to_c_cmd.py
- winbuild/Settings.rules
rules file for generating the settings.h file. It is possible to select to use CLANG and SqlLite3
- winbuild/Version.rules
rules file to be able to start version.py
The files:
==========
- version.bat
- runbison.bat
- increasebuffer.pl
are not used anymore.
I've only added the files as indicated, I didn't remove the files from the repository.
Diffstat (limited to 'addon')
-rw-r--r-- | addon/doxmlparser/examples/metrics/Makefile.in | 2 | ||||
-rw-r--r-- | addon/doxmlparser/src/Makefile.in | 2 | ||||
-rw-r--r-- | addon/doxmlparser/test/Makefile.in | 2 | ||||
-rw-r--r-- | addon/doxyapp/Makefile.in | 2 | ||||
-rw-r--r-- | addon/doxyapp/doxyapp.pro.in | 2 | ||||
-rw-r--r-- | addon/doxysearch/Makefile.in | 2 | ||||
-rw-r--r-- | addon/doxysearch/doxysearch.pro.in | 2 | ||||
-rw-r--r-- | addon/doxywizard/Makefile.in | 10 | ||||
-rw-r--r-- | addon/doxywizard/config_doxyw.l | 555 | ||||
-rw-r--r-- | addon/doxywizard/doxywizard.pro.in | 17 |
10 files changed, 587 insertions, 9 deletions
diff --git a/addon/doxmlparser/examples/metrics/Makefile.in b/addon/doxmlparser/examples/metrics/Makefile.in index 83cbc28..a3eb784 100644 --- a/addon/doxmlparser/examples/metrics/Makefile.in +++ b/addon/doxmlparser/examples/metrics/Makefile.in @@ -4,6 +4,8 @@ all clean depend: Makefile.metrics distclean: clean $(RM) -rf Makefile.metrics metrics.pro Makefile obj +realclean: distclean + tmake: $(ENV) $(PERL) $(TMAKE) metrics.pro >Makefile.metrics diff --git a/addon/doxmlparser/src/Makefile.in b/addon/doxmlparser/src/Makefile.in index 049f969..47d20c2 100644 --- a/addon/doxmlparser/src/Makefile.in +++ b/addon/doxmlparser/src/Makefile.in @@ -4,6 +4,8 @@ all clean depend: Makefile.doxmlparser distclean: clean $(RM) -rf Makefile.doxmlparser doxmlparser.pro Makefile obj +realclean: distclean + tmake: $(ENV) $(PERL) $(TMAKE) doxmlparser.pro >Makefile.doxmlparser diff --git a/addon/doxmlparser/test/Makefile.in b/addon/doxmlparser/test/Makefile.in index 1dfbd17..87b1829 100644 --- a/addon/doxmlparser/test/Makefile.in +++ b/addon/doxmlparser/test/Makefile.in @@ -4,6 +4,8 @@ all clean depend: Makefile.xmlparse distclean: clean $(RM) -rf Makefile.xmlparse xmlparse.pro Makefile obj +realclean: distclean + tmake: $(ENV) $(PERL) $(TMAKE) xmlparse.pro >Makefile.xmlparse diff --git a/addon/doxyapp/Makefile.in b/addon/doxyapp/Makefile.in index 49ddb4d..d0629d9 100644 --- a/addon/doxyapp/Makefile.in +++ b/addon/doxyapp/Makefile.in @@ -5,6 +5,8 @@ all clean depend distclean: Makefile.doxyapp distclean: clean $(RM) -rf Makefile doxyapp.pro Makefile.doxyapp +realclean: distclean + tmake: $(ENV) $(PERL) "$(TMAKE)" doxyapp.pro >Makefile.doxyapp diff --git a/addon/doxyapp/doxyapp.pro.in b/addon/doxyapp/doxyapp.pro.in index 71246f4..4a49a56 100644 --- a/addon/doxyapp/doxyapp.pro.in +++ b/addon/doxyapp/doxyapp.pro.in @@ -2,7 +2,7 @@ TEMPLATE = app.t CONFIG = console warn_on debug HEADERS = SOURCES = doxyapp.cpp -LIBS += -L../../lib -L../../lib -ldoxygen -lqtools -lmd5 -ldoxycfg -lpthread +LIBS += -L../../lib -ldoxygen -lqtools -lmd5 -ldoxycfg -lpthread -liconv DESTDIR = OBJECTS_DIR = ../../objects TARGET = ../../bin/doxyapp diff --git a/addon/doxysearch/Makefile.in b/addon/doxysearch/Makefile.in index 7daafee..f3ed662 100644 --- a/addon/doxysearch/Makefile.in +++ b/addon/doxysearch/Makefile.in @@ -7,6 +7,8 @@ distclean: clean $(RM) -rf Makefile doxysearch.pro Makefile.doxysearch $(RM) -rf Makefile doxyindexer.pro Makefile.doxyindexer +realclean: distclean + tmake: $(ENV) $(PERL) "$(TMAKE)" doxysearch.pro >Makefile.doxysearch $(ENV) $(PERL) "$(TMAKE)" doxyindexer.pro >Makefile.doxyindexer diff --git a/addon/doxysearch/doxysearch.pro.in b/addon/doxysearch/doxysearch.pro.in index fce6d82..c9654b0 100644 --- a/addon/doxysearch/doxysearch.pro.in +++ b/addon/doxysearch/doxysearch.pro.in @@ -2,7 +2,7 @@ TEMPLATE = app.t CONFIG = console warn_on debug HEADERS = SOURCES = doxysearch.cpp -LIBS += -lxapian +LIBS += -lxapian DESTDIR = OBJECTS_DIR = ../../objects TARGET = ../../bin/doxysearch.cgi diff --git a/addon/doxywizard/Makefile.in b/addon/doxywizard/Makefile.in index 727409a..152c2b7 100644 --- a/addon/doxywizard/Makefile.in +++ b/addon/doxywizard/Makefile.in @@ -10,10 +10,11 @@ # See the GNU General Public License for more details. # -QMAKE=qmake $(MKSPECS) +QMAKE=$(QTDIR)/bin/qmake $(MKSPECS) +INCBUFSIZE=$(PYTHON) ../../src/increasebuffer.py all: Makefile.doxywizard - $(MAKE) -f Makefile.doxywizard + $(MAKE) -f Makefile.doxywizard LEX=$(LEX) PYTHON=$(PYTHON) INCBUFSIZE="$(INCBUFSIZE)" Makefile.doxywizard: doxywizard.pro $(QMAKE) doxywizard.pro -o Makefile.doxywizard @@ -28,6 +29,11 @@ distclean: Makefile.doxywizard $(MAKE) -f Makefile.doxywizard distclean $(RM) Makefile.doxywizard +realclean: Makefile.doxywizard + $(RM) configdoc.cpp + $(RM) config_doxyw.cpp + $(MAKE) distclean + install: $(INSTTOOL) -d $(INSTALL)/bin $(INSTTOOL) -m 755 ../../bin/doxywizard $(INSTALL)/bin diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l new file mode 100644 index 0000000..3a26eb6 --- /dev/null +++ b/addon/doxywizard/config_doxyw.l @@ -0,0 +1,555 @@ +/****************************************************************************** + * + * $Id: config_templ.l,v 1.8 2001/01/01 10:15:16 root Exp $ + * + * Copyright (C) 1997-2013 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +%{ + +/* + * includes + */ +#include "config.h" +#include "input.h" +#include <QtCore> + +#define MAX_INCLUDE_DEPTH 10 + + +/* ----------------------------------------------------------------- + * + * static variables + */ + +struct ConfigFileState +{ + int lineNr; + FILE *file; + YY_BUFFER_STATE oldState; + YY_BUFFER_STATE newState; + QString fileName; +}; + +static const QHash<QString,Input*> *g_options; +static FILE *g_file; +static QString g_yyFileName; +static QString g_includeName; +static QVariant g_includePathList; +static QStack<ConfigFileState*> g_includeStack; +static int g_includeDepth; +static QVariant *g_arg; +static Input *g_curOption=0; +static QString g_elemStr; +static QTextCodec *g_codec = QTextCodec::codecForName("UTF-8"); +static QString g_codecName = QString::fromAscii("UTF-8"); +static int g_lastState; +static QByteArray g_tmpString; + +/* ----------------------------------------------------------------- + */ +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); + +static int yyread(char *buf,int maxSize) +{ + // no file included + if (g_includeStack.isEmpty()) + { + return fread(buf,1,maxSize,g_file); + } + else + { + return fread(buf,1,maxSize,g_includeStack.top()->file); + } +} + +void config_err(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); +} +void config_warn(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); +} + +static void substEnvVarsInStrList(QStringList &sl); +static void substEnvVarsInString(QString &s); + +static void checkEncoding() +{ + Input *option = g_options->value(QString::fromAscii("DOXYFILE_ENCODING")); + if (option && option->value().toString()!=g_codecName) + { + QTextCodec *newCodec = QTextCodec::codecForName(option->value().toString().toAscii()); + if (newCodec) + { + g_codec = newCodec; + g_codecName = option->value().toString(); + } + } +} + +static FILE *tryPath(const QString &path,const QString &fileName) +{ + QString absName=!path.isEmpty() ? path+QString::fromAscii("/")+fileName : fileName; + QFileInfo fi(absName); + if (fi.exists() && fi.isFile()) + { + FILE *f = fopen(absName.toLocal8Bit(),"r"); + if (f==NULL) + config_err("Error: could not open file %s for reading\n",absName.toLatin1().data()); + else + return f; + } + return NULL; +} + +static FILE *findFile(const QString &fileName) +{ + if (QFileInfo(fileName).isAbsolute()) // absolute path + { + return tryPath(QString(), fileName); + } + + // relative path, try with include paths in the list + QStringList sl = g_includePathList.toStringList(); + substEnvVarsInStrList(sl); + foreach (QString s, sl) + { + FILE *f = tryPath(s,fileName); + if (f) return f; + } + // try cwd if g_includePathList fails + return tryPath(QString::fromAscii("."),fileName); +} + +static void readIncludeFile(const QString &incName) +{ + if (g_includeDepth==MAX_INCLUDE_DEPTH) + { + config_err("Error: maximum include depth (%d) reached, %s is not included. Aborting...\n", + MAX_INCLUDE_DEPTH,qPrintable(incName)); + exit(1); + } + + QString inc = incName; + substEnvVarsInString(inc); + inc = inc.trimmed(); + uint incLen = inc.length(); + if (inc.at(0)==QChar::fromAscii('"') && + inc.at(incLen-1)==QChar::fromAscii('"')) // strip quotes + { + inc=inc.mid(1,incLen-2); + } + + FILE *f = findFile(inc); + if (f) // see if the include file can be found + { + // For debugging +#if SHOW_INCLUDES + for (i=0;i<includeStack.count();i++) msg(" "); + msg("@INCLUDE = %s: parsing...\n",inc.toLatin1().data()); +#endif + + // store the state of the old file + ConfigFileState *fs=new ConfigFileState; + fs->oldState=YY_CURRENT_BUFFER; + fs->fileName=g_yyFileName; + fs->file=f; + // push the state on the stack + g_includeStack.push(fs); + // set the scanner to the include file + yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); + fs->newState=YY_CURRENT_BUFFER; + g_yyFileName=inc; + g_includeDepth++; + } + else + { + config_err("Error: @INCLUDE = %s: not found!\n",inc.toLatin1().data()); + exit(1); + } +} + + +%} + +%option nounput +%option noyywrap +%option yylineno + +%x Start +%x SkipComment +%x SkipInvalid +%x GetString +%x GetStrList +%x GetQuotedString +%x GetEnvVar +%x Include + +%% + +<*>\0x0d +<Start,GetString,GetStrList,SkipInvalid>"#" { BEGIN(SkipComment); } +<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QString cmd = g_codec->toUnicode(yytext); + cmd=cmd.left(cmd.length()-1).trimmed(); + g_curOption = g_options->value(cmd); + if (g_curOption==0) // oops not known + { + config_err("Warning: ignoring unsupported tag `%s' at line %d, file %s\n", + qPrintable(cmd),yylineno,qPrintable(g_yyFileName)); + BEGIN(SkipInvalid); + } + else // known tag + { + //option->setEncoding(encoding); + g_arg = &g_curOption->value(); + switch(g_curOption->kind()) + { + case Input::StrList: + g_elemStr = QString(); + *g_arg = QStringList(); + BEGIN(GetStrList); + break; + case Input::String: + BEGIN(GetString); + break; + case Input::Int: + BEGIN(GetString); + break; + case Input::Bool: + BEGIN(GetString); + break; + case Input::Obsolete: + config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n" + "To avoid this warning please update your configuration " + "file using \"doxygen -u\"\n", qPrintable(cmd), + yylineno,qPrintable(g_yyFileName)); + BEGIN(SkipInvalid); + break; + } + } + } +<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { QString cmd=g_codec->toUnicode(yytext); + cmd=cmd.left(cmd.length()-2).trimmed(); + g_curOption = g_options->value(cmd); + if (g_curOption==0) // oops not known + { + config_err("Warning: ignoring unsupported tag `%s' at line %d, file %s\n", + yytext,yylineno,qPrintable(g_yyFileName)); + BEGIN(SkipInvalid); + } + else // known tag + { + switch(g_curOption->kind()) + { + case Input::StrList: + g_arg = &g_curOption->value(); + g_elemStr=QString(); + BEGIN(GetStrList); + break; + case Input::String: + case Input::Int: + case Input::Bool: + config_err("Warning: operator += not supported for `%s'. Ignoring line at line %d, file %s\n", + yytext,yylineno,qPrintable(g_yyFileName)); + BEGIN(SkipInvalid); + break; + case Input::Obsolete: + config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n" + "To avoid this warning please update your configuration " + "file using \"doxygen -u\"\n", + qPrintable(cmd),yylineno,qPrintable(g_yyFileName)); + BEGIN(SkipInvalid); + break; + } + } + } +<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); g_arg=&g_includePathList; *g_arg = QStringList(); g_elemStr=QString(); } + /* include a config file */ +<Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);} +<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { + readIncludeFile(g_codec->toUnicode(yytext)); + BEGIN(Start); + } +<<EOF>> { + //printf("End of include file\n"); + //printf("Include stack depth=%d\n",g_includeStack.count()); + if (g_includeStack.isEmpty()) + { + //printf("Terminating scanner!\n"); + yyterminate(); + } + else + { + ConfigFileState *fs = g_includeStack.pop(); + fclose(fs->file); + YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; + yy_switch_to_buffer( fs->oldState ); + yy_delete_buffer( oldBuf ); + g_yyFileName=fs->fileName; + delete fs; + g_includeDepth--; + } + } + +<Start>[a-z_A-Z0-9]+ { config_err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yylineno,qPrintable(g_yyFileName)); } +<GetString,SkipInvalid>\n { BEGIN(Start); } +<GetStrList>\n { + if (!g_elemStr.isEmpty()) + { + //printf("elemStr1=`%s'\n",elemStr.toLatin1().data()); + *g_arg = QVariant(g_arg->toStringList() << g_elemStr); + } + BEGIN(Start); + } +<GetStrList>[ \t]+ { + if (!g_elemStr.isEmpty()) + { + //printf("elemStr2=`%s'\n",elemStr.toLatin1().data()); + *g_arg = QVariant(g_arg->toStringList() << g_elemStr); + } + g_elemStr = QString(); + } +<GetString>[^ \"\t\r\n]+ { + *g_arg = QVariant(g_codec->toUnicode(yytext)); + checkEncoding(); + } +<GetString,GetStrList,SkipInvalid>"\"" { g_lastState=YY_START; + BEGIN(GetQuotedString); + g_tmpString=""; + } +<GetQuotedString>"\""|"\n" { + // we add a bogus space to signal that the string was quoted. This space will be stripped later on. + g_tmpString+=" "; + //printf("Quoted String = `%s'\n",tmpString.toLatin1().data()); + if (g_lastState==GetString) + { + *g_arg = g_codec->toUnicode(g_tmpString); + checkEncoding(); + } + else + { + g_elemStr+=g_codec->toUnicode(g_tmpString); + } + if (*yytext=='\n') + { + config_err("Warning: Missing end quote (\") on line %d, file %s\n",yylineno, + qPrintable(g_yyFileName)); + } + BEGIN(g_lastState); + } +<GetQuotedString>"\\\"" { + g_tmpString+='"'; + } +<GetQuotedString>. { g_tmpString+=*yytext; } +<GetStrList>[^ \#\"\t\r\n]+ { + g_elemStr+=g_codec->toUnicode(yytext); + } +<SkipComment>\n { BEGIN(Start); } +<SkipComment>\\[ \r\t]*\n { BEGIN(Start); } +<*>\\[ \r\t]*\n { } +<*>\n +<*>. + +%% + +/*@ ---------------------------------------------------------------------------- + */ + +static void substEnvVarsInString(QString &s) +{ + static QRegExp re(QString::fromAscii("\\$\\([a-z_A-Z0-9]+\\)")); + if (s.isEmpty()) return; + int p=0; + int i,l; + //printf("substEnvVarInString(%s) start\n",s.toLatin1().data()); + while ((i=re.indexIn(s,p))!=-1) + { + l = re.matchedLength(); + //printf("Found environment var s.mid(%d,%d)=`%s'\n",i+2,l-3,s.mid(i+2,l-3).toLatin1().data()); + QString env=g_codec->toUnicode(getenv(s.mid(i+2,l-3).toLatin1())); + substEnvVarsInString(env); // recursively expand variables if needed. + s = s.left(i)+env+s.right(s.length()-i-l); + p=i+env.length(); // next time start at the end of the expanded string + } + s=s.trimmed(); // to strip the bogus space that was added when an argument + // has quotes + //printf("substEnvVarInString(%s) end\n",s.toLatin1().data()); +} + +static void substEnvVarsInStrList(QStringList &sl) +{ + QStringList out; + + foreach (QString result, sl) + { + // an argument with quotes will have an extra space at the end, so wasQuoted will be TRUE. + bool wasQuoted = (result.indexOf(QChar::fromAscii(' '))!=-1) || + (result.indexOf(QChar::fromAscii('\t'))!=-1); + // here we strip the quote again + substEnvVarsInString(result); + + //printf("Result %s was quoted=%d\n",result.toLatin1().data(),wasQuoted); + + if (!wasQuoted) /* as a result of the expansion, a single string + may have expanded into a list, which we'll + add to sl. If the original string already + contained multiple elements no further + splitting is done to allow quoted items with spaces! */ + { + int l=result.length(); + int i,p=0; + // skip spaces + // search for a "word" + for (i=0;i<l;i++) + { + QChar c=0; + // skip until start of new word + while (i<l && ((c=result.at(i))==QChar::fromAscii(' ') || c==QChar::fromAscii('\t'))) i++; + p=i; // p marks the start index of the word + // skip until end of a word + while (i<l && ((c=result.at(i))!=QChar::fromAscii(' ') && + c!=QChar::fromAscii('\t') && + c!=QChar::fromAscii('"'))) i++; + if (i<l) // not at the end of the string + { + if (c==QChar::fromAscii('"')) // word within quotes + { + p=i+1; + for (i++;i<l;i++) + { + c=result.at(i); + if (c==QChar::fromAscii('"')) // end quote + { + out += result.mid(p,i-p); + p=i+1; + break; + } + else if (c==QChar::fromAscii('\\')) // skip escaped stuff + { + i++; + } + } + } + else if (c==QChar::fromAscii(' ') || c==QChar::fromAscii('\t')) // separator + { + out += result.mid(p,i-p); + p=i+1; + } + } + } + if (p!=l) // add the leftover as a string + { + out += result.right(l-p); + } + } + else // just goto the next element in the list + { + out += result; + } + } + sl = out; +} + +//-------------------------------------------------------------------------- + +bool parseConfig( + const QString &fileName, + const QHash<QString,Input *> &options + ) +{ + QHashIterator<QString, Input*> i(options); + g_file = fopen(fileName.toLocal8Bit(),"r"); + if (g_file==NULL) return false; + + // reset all values + i.toFront(); + while (i.hasNext()) + { + i.next(); + if (i.value()) + { + i.value()->reset(); + } + } + + // parse config file + g_options = &options; + g_yyFileName = fileName; + g_includeStack.clear(); + g_includeDepth = 0; + config_doxywYYrestart( config_doxywYYin ); + BEGIN( Start ); + config_doxywYYlex(); + + // update the values in the UI + i.toFront(); + while (i.hasNext()) + { + i.next(); + if (i.value()) + { + //printf("Updating: %s\n",qPrintable(i.key())); + i.value()->update(); + } + else + { + printf("Invalid option: %s\n",qPrintable(i.key())); + } + } + fclose(g_file); + return true; +} + +void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) +{ + QChar c; + bool needsEscaping=FALSE; + // convert the string back to it original encoding + //QByteArray se = codec->fromUnicode(s); + t.setCodec(codec); + const QChar *p=s.data(); + if (!s.isEmpty() && !p->isNull()) + { + while (!(c=*p++).isNull() && !needsEscaping) + { + needsEscaping = (c==QChar::fromAscii(' ') || + c==QChar::fromAscii('\n') || + c==QChar::fromAscii('\t') || + c==QChar::fromAscii('"')); + } + if (needsEscaping) + { + t << "\""; + p=s.data(); + while (!p->isNull()) + { + if (*p ==QChar::fromAscii(' ') && + *(p+1)==QChar::fromAscii('\0')) break; // skip inserted space at the end + if (*p ==QChar::fromAscii('"')) t << "\\"; // escape quotes + t << *p++; + } + t << "\""; + } + else + { + t << s; + } + } +} + diff --git a/addon/doxywizard/doxywizard.pro.in b/addon/doxywizard/doxywizard.pro.in index 4ec2b0e..01832df 100644 --- a/addon/doxywizard/doxywizard.pro.in +++ b/addon/doxywizard/doxywizard.pro.in @@ -21,14 +21,21 @@ macx-g++ { # Input HEADERS += doxywizard.h version.h expert.h config.h helplabel.h \ inputbool.h inputstring.h inputint.h inputstrlist.h wizard.h docintf.h -SOURCES += doxywizard.cpp ../../src/version.cpp expert.cpp wizard.cpp \ +SOURCES += doxywizard.cpp expert.cpp wizard.cpp \ inputbool.cpp inputstring.cpp inputint.cpp inputstrlist.cpp -LEXSOURCES += config.l RESOURCES += doxywizard.qrc +INCBUFSIZE=$(PYTHON) ../../src/increasebuffer.py win32:RC_FILE += doxywizard.rc +config.target = config_doxyw.cpp +config.commands = $(LEX) -P$*YY -t $*.l | $(INCBUFSIZE) >$*.cpp +config.depends = config_doxyw.l ../../src/increasebuffer.py configdoc.target = configdoc.cpp -configdoc.commands = python ../../src/configgen.py -wiz ../../src/config.xml > configdoc.cpp +configdoc.commands = $(PYTHON) ../../src/configgen.py -wiz ../../src/config.xml > configdoc.cpp configdoc.depends = ../../src/config.xml ../../src/configgen.py -QMAKE_EXTRA_TARGETS += configdoc -GENERATED_SOURCES += $$configdoc.target +version.target = ../../src/version.cpp +version.commands = cd ../../src;$(PYTHON) version.py +version.depends = ../../configure +QMAKE_EXTRA_TARGETS += configdoc config version +GENERATED_SOURCES += $$configdoc.target $$config.target $$version.target + |