New MSVC project files with custom build rules to support automatic lexer/parser generation.

The include changes might break other buildsystem, I'll fix that when I am back on Linux.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@983 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-01-09 21:13:58 +00:00
parent 6118395dfc
commit 711af01772
10 changed files with 384 additions and 61 deletions

View File

@ -17,7 +17,7 @@
#include "lib/framework/resly.h"
/* Get the Yacc definitions */
#include "lib/framework/resource_parser.h"
#include "resource_parser.tab.h"
void res_error(const char *pMessage,...);
@ -131,3 +131,4 @@ int res_wrap(void)
return 1;
}

View File

@ -20,7 +20,7 @@
#include "lib/framework/strresly.h"
/* Get the Yacc definitions */
#include "lib/framework/strres_parser.h"
#include "strres_parser.tab.h"
void strres_error(const char *pMessage,...);
@ -123,3 +123,4 @@ int strres_wrap(void)
return 1;
}

View File

@ -8,7 +8,7 @@
#include "lib/gamelib/parser.h"
/* Get the Yacc definitions */
#include "lib/gamelib/audp_parser.h"
#include "audp_parser.tab.h"
/* Maximum length for any TEXT value */
#define YYLMAX 255

View File

@ -19,7 +19,7 @@
#include "lib/script/chat_processing.h"
/* Get the Yacc definitions */
#include "lib/script/chat_parser.h"
#include "chat_parser.tab.h"
/* Maximum length for any TEXT value */
#ifndef YYLMAX
@ -180,3 +180,4 @@ int chat_wrap(void)
return 1;
}

View File

@ -11,7 +11,7 @@
#include "lib/script/script.h"
/* Get the Yacc definitions */
#include "lib/script/script_parser.h"
#include "script_parser.tab.h"
/* Maximum length for any TEXT value */
#ifndef YYLMAX

View File

@ -14,7 +14,7 @@
#include "codeprint.h"
#include "script.h"
#include "lib/script/script_parser.h"
#include "script_parser.tab.h"
/* number of values in each stack chunk */
#define INIT_SIZE 30 //15
@ -1250,3 +1250,4 @@ void stackReset(void)

View File

@ -13,7 +13,7 @@
#include "src/scriptvals.h"
/* Get the Yacc definitions */
#include "src/scriptvals_parser.h"
#include "scriptvals_parser.tab.h"
/* Maximum length for any TEXT value */
#ifndef YYLMAX
@ -158,3 +158,4 @@ int scrv_wrap(void)
return 1;
}

246
win32/FlexBison.rules Normal file
View File

@ -0,0 +1,246 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* FlexBison.rules
*
* Copyright 2006(c) Microsoft Corporation. All rights reserved.
*
-->
<VisualStudioToolFile
Name="Flex and Bison Tools"
Version="8.00"
>
<Rules>
<CustomBuildRule
Name="FlexGenerator"
DisplayName="Flex Generator"
CommandLine="flex.exe [AllOptions] [AdditionalOptions] [Inputs]"
Outputs="$(InputName).lex.c"
FileExtensions="*.l"
ExecutionDescription="Generating lexical analyser..."
>
<Properties>
<BooleanProperty
Name="BackingUpInfo"
DisplayName="Generate backing-up information"
Category="Debug information"
Description="Generates the file &apos;lex.backup&apos; that contains a list of scanner states which require backing up and the input characters on which they do so."
Switch="-b"
/>
<BooleanProperty
Name="DebuggerOn"
DisplayName="Run in debug mode"
Category="Debug information"
Description="Turn on debug mode in generated scanner"
Switch="-d"
/>
<BooleanProperty
Name="GenFast"
DisplayName="Generate fast large scanner"
PropertyPageName="Performance"
Description="Generate fast, large scanner"
Switch="-f"
/>
<BooleanProperty
Name="CaseInsensitive"
DisplayName="Case insensitive scanner"
Description="The case of letters given in the flex input patterns will be ignored, and tokens in the input will be matched regardless of case"
Switch="-i"
/>
<BooleanProperty
Name="CompatibilityOn"
DisplayName="Maximum compatibility with lex"
Description="Turns on maximum compatibility with the original AT&amp;T lex implementation. Note that this does not mean full compatibility."
Switch="-l"
/>
<BooleanProperty
Name="PerformanceReport"
DisplayName="Generate performance report"
PropertyPageName="Performance"
Description="Generates a performance report to stderr. The report consists of comments regarding features of the flex input file which will cause a serious loss of performance in the resulting scanner."
Switch="-p"
/>
<BooleanProperty
Name="SuppressDefault"
DisplayName="Suppress the default rule"
Description="Causes the default rule (that unmatched scanner input is echoed to stdout) to be suppressed. If the scanner encounters input that does not match any of its rules, it aborts with an error."
Switch="-s"
/>
<BooleanProperty
Name="SuppressWarnings"
DisplayName="Suppress warning messages"
Description="Suppress warning messages."
Switch="-w"
/>
<BooleanProperty
Name="BatchScanner"
DisplayName="Generate Batch Scanner"
PropertyPageName="Performance"
Description="Instructs flex to generate a batch scanner. In general, you use &apos;-B&apos; when you are certain that your scanner will never be used interactively, and you want to squeeze a little more performance out of it."
Switch="-B"
/>
<BooleanProperty
Name="FastScanner"
DisplayName="Use fast scanner table representation"
PropertyPageName="Performance"
Description="Specifies that the fast scanner table representation should be used (and stdio bypassed). This representation is about as fast as the full table representation &apos;(-f)&apos;, and for some sets of patterns will be considerably smaller (and for others, larger)."
Switch="-F"
/>
<BooleanProperty
Name="InteractiveScanner"
DisplayName="Generate an interactive scanner"
PropertyPageName="Performance"
Description="Instructs flex to generate an interactive scanner. An interactive scanner is one that only looks ahead to decide what token has been matched if it absolutely must."
Switch="-I"
/>
<BooleanProperty
Name="NoGenLineDirectives"
DisplayName="Don&apos;t generate #line directives"
Category="Debug information"
Description="Instructs flex not to generate &apos;#line&apos; directives. Without this option, flex peppers the generated scanner with #line directives so error messages in the actions will be correctly located with respect to either the original flex input file."
Switch="-L"
/>
<BooleanProperty
Name="TraceMode"
DisplayName="Trace mode"
Category="Debug information"
Description="Makes flex run in trace mode. It will generate a lot of messages to stderr concerning the form of the input and the resultant non-deterministic and deterministic finite automata."
Switch="-T"
/>
<StringProperty
Name="OutputFile"
DisplayName="Output File"
Description="The output file containing the implementation of the analyser"
Switch="-o[value]"
DefaultValue="$(InputName).lex.c"
/>
<StringProperty
Name="ScannerPrefix"
DisplayName="Scanner Prefix"
Description="Specify scanner prefix other than yy"
Switch="-P[value]"
DefaultValue="$(InputName)"
/>
<EnumProperty
Name="TableCompression"
DisplayName="Table Compression"
PropertyPageName="Performance"
Description="Controls the degree of table compression and, more generally, trade-offs between small scanners and fast scanners."
>
<Values>
<EnumValue
Value="0"
Switch="-Cem"
DisplayName="Equivalence classes and meta-equivalence classes (slowest &amp; smallest)"
/>
<EnumValue
Value="1"
Switch="-Cm"
DisplayName="Meta-equivalence classes"
/>
<EnumValue
Value="2"
Switch="-Ce"
DisplayName="Equivalence classes"
/>
<EnumValue
Value="3"
Switch="-C"
DisplayName="Compress scanner tables"
/>
<EnumValue
Value="4"
Switch="-Cfe"
DisplayName="Full scanner tables and equivalence classes"
/>
<EnumValue
Value="5"
Switch="-CFe"
DisplayName="Alternate fast scanner representation and equivalence classes"
/>
<EnumValue
Value="6"
Switch="-Cf"
DisplayName="Full scanner tables"
/>
<EnumValue
Value="7"
Switch="-CF"
DisplayName="Alternate fast scanner representation"
/>
<EnumValue
Value="8"
Switch="-Cfa"
DisplayName="Align data in full scanner tables (fastest &amp; largest)"
/>
<EnumValue
Value="9"
Switch="-CFa"
DisplayName="Align data in the alternate fast scanner representation (fastest &amp; largest)"
/>
</Values>
</EnumProperty>
<StringProperty
Name="SkeletonFile"
DisplayName="Use custom skeleton"
Description="Overrides the default skeleton file from which flex constructs its scanners"
Switch="-S[value]"
/>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="BisonParser"
DisplayName="Bison Parser"
CommandLine="bison.exe [AllOptions] [AdditionalOptions] [Inputs]"
Outputs="$(InputName).tab.c"
FileExtensions="*.y"
ExecutionDescription="Generating parser based on grammar..."
>
<Properties>
<StringProperty
Name="FilePrefix"
DisplayName="File Prefix"
Description="Specify a prefix to use for all Bison output file names"
Switch="-b [value]"
DefaultValue="$(InputName)"
/>
<BooleanProperty
Name="Defines"
DisplayName="Use defines"
Description="Write an extra output file containing macro definitions for the token type names defined in the grammar and the semantic value type YYSTYPE, as well as a few extern variable declarations"
Switch="-d"
/>
<BooleanProperty
Name="NoGenLineDirectives"
DisplayName="Don&apos;t generate &apos;#line&apos; directives"
Description="Don&apos;t put any #line preprocessor commands in the parser file. Ordinarily Bison puts them in the parser file so that the C compiler and debuggers will associate errors with your source file, the grammar file."
Switch="-l"
/>
<StringProperty
Name="OutputFile"
DisplayName="Output file name"
Description="Specify the name outfile for the parser file"
Switch="-o [value]"
/>
<StringProperty
Name="RenameExternalSymbols"
DisplayName="Rename External Symbols"
Description="Rename the external symbols used in the parser so that they start with prefix instead of `yy&apos;."
Switch="-p [value]"
DefaultValue="$(InputName)"
/>
<BooleanProperty
Name="DebuggerOn"
DisplayName="Compile debugging facilities"
Description="Output a definition of the macro YYDEBUG into the parser file, so that the debugging facilities are compiled"
Switch="-t"
/>
<BooleanProperty
Name="Verbose"
DisplayName="Output parser states"
Description="Write an extra output file containing verbose descriptions of the parser states and what is done for each type of look-ahead token in that state"
Switch="-v"
/>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>

View File

@ -1,7 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Warzone", "Warzone.vcproj", "{BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}"
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Warzone2100", "Warzone2100.vcproj", "{BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,4 +16,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
EndGlobal

View File

@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Warzone"
Name="Warzone2100"
ProjectGUID="{BDDCCB7B-F4F7-4768-A1C3-AE20E9F5FDFC}"
RootNamespace="Warzone"
RootNamespace="Warzone2100"
Keyword="Win32Proj"
>
<Platforms>
@ -13,6 +13,9 @@
/>
</Platforms>
<ToolFiles>
<ToolFile
RelativePath=".\FlexBison.rules"
/>
</ToolFiles>
<Configurations>
<Configuration
@ -25,9 +28,16 @@
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="FlexGenerator"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="BisonParser"
Defines="true"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
@ -40,8 +50,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;__WARZONE_SRC__&quot;;&quot;__DEVPKG__\include&quot;;&quot;__PLATFORM_SDK__\Include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;YY_NO_UNISTD_H;VERSION=\&quot;9.9.9\&quot;"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;D:\Dokumente und Einstellungen\Admin\Desktop\Warzone2100&quot;;&quot;D:\Programme\DevPkg\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;YY_NO_UNISTD_H;VERSION=\&quot;TRUNK\&quot;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -49,7 +59,6 @@
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@ -62,12 +71,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDLmain.lib SDL_net.lib jpeg6b.lib png13.lib ogg.lib vorbis.lib vorbisfile.lib mad.lib OpenAL32.lib OpenGL32.lib GLU32.lib physfs.lib shfolder.lib"
AdditionalDependencies="SDL.lib SDLmain.lib SDL_net.lib jpeg.lib png.lib zlib.lib ogg.lib vorbis.lib vorbisfile.lib mad.lib physfs.lib OpenAL32.lib OpenGL32.lib GLU32.lib shfolder.lib"
OutputFile="$(OutDir)\$(ProjectName)-Dbg.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;__DEVPKG__\lib&quot;;&quot;__PLATFORM_SDK__\Lib&quot;"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames="msvcrt.lib,libcmt.lib"
AdditionalLibraryDirectories="&quot;D:\Programme\DevPkg\lib&quot;"
IgnoreDefaultLibraryNames="msvcrt.lib libcmt.lib"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
@ -108,9 +116,15 @@
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="FlexGenerator"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="BisonParser"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
@ -122,16 +136,13 @@
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
AdditionalIncludeDirectories="&quot;__WARZONE_SRC__&quot;;&quot;__DEVPKG__\include&quot;;&quot;__PLATFORM_SDK__\Include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;YY_NO_UNISTD_H;VERSION=\&quot;9.9.9\&quot;"
StringPooling="true"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;D:\Dokumente und Einstellungen\Admin\Desktop\Warzone2100&quot;;&quot;D:\Programme\DevPkg\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;YY_NO_UNISTD_H;VERSION=\&quot;TRUNK\&quot;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
CompileAs="1"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@ -144,16 +155,14 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDLmain.lib SDL_net.lib jpeg6b.lib ogg.lib vorbis.lib vorbisfile.lib png13.lib mad.lib OpenAL32.lib OpenGL32.lib GLU32.lib physfs.lib shfolder.lib"
AdditionalDependencies="SDL.lib SDLmain.lib SDL_net.lib jpeg.lib png.lib zlib.lib ogg.lib vorbis.lib vorbisfile.lib mad.lib physfs.lib OpenAL32.lib OpenGL32.lib GLU32.lib shfolder.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;__DEVPKG__\lib&quot;;&quot;__PLATFORM_SDK__\Lib&quot;"
IgnoreAllDefaultLibraries="false"
AdditionalLibraryDirectories="&quot;D:\Programme\DevPkg\lib&quot;"
IgnoreDefaultLibraryNames="libcmt.lib"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
SetChecksum="true"
TargetMachine="1"
/>
<Tool
@ -247,11 +256,11 @@
>
</File>
<File
RelativePath="..\lib\gamelib\audp_lexer.c"
RelativePath=".\audp_lexer.lex.c"
>
</File>
<File
RelativePath="..\lib\gamelib\audp_parser.c"
RelativePath=".\audp_parser.tab.c"
>
</File>
<File
@ -299,11 +308,11 @@
>
</File>
<File
RelativePath="..\lib\script\chat_lexer.c"
RelativePath=".\chat_lexer.lex.c"
>
</File>
<File
RelativePath="..\lib\script\chat_parser.c"
RelativePath=".\chat_parser.tab.c"
>
</File>
<File
@ -559,7 +568,7 @@
>
</File>
<File
RelativePath="..\src\level_lexer.c"
RelativePath=".\level_lexer.lex.c"
>
</File>
<File
@ -829,11 +838,11 @@
>
</File>
<File
RelativePath="..\lib\framework\resource_lexer.c"
RelativePath=".\resource_lexer.lex.c"
>
</File>
<File
RelativePath="..\lib\framework\resource_parser.c"
RelativePath=".\resource_parser.tab.c"
>
</File>
<File
@ -857,11 +866,11 @@
>
</File>
<File
RelativePath="..\lib\script\script_lexer.c"
RelativePath=".\script_lexer.lex.c"
>
</File>
<File
RelativePath="..\lib\script\script_parser.c"
RelativePath=".\script_parser.tab.c"
>
</File>
<File
@ -893,11 +902,11 @@
>
</File>
<File
RelativePath="..\src\scriptvals_lexer.c"
RelativePath=".\scriptvals_lexer.lex.c"
>
</File>
<File
RelativePath="..\src\scriptvals_parser.c"
RelativePath=".\scriptvals_parser.tab.c"
>
</File>
<File
@ -933,11 +942,11 @@
>
</File>
<File
RelativePath="..\lib\framework\strres_lexer.c"
RelativePath=".\strres_lexer.lex.c"
>
</File>
<File
RelativePath="..\lib\framework\strres_parser.c"
RelativePath=".\strres_parser.tab.c"
>
</File>
<File
@ -1075,7 +1084,7 @@
>
</File>
<File
RelativePath="..\lib\gamelib\audp_parser.h"
RelativePath=".\audp_parser.tab.h"
>
</File>
<File
@ -1139,7 +1148,7 @@
>
</File>
<File
RelativePath="..\lib\script\chat_parser.h"
RelativePath=".\chat_parser.tab.h"
>
</File>
<File
@ -1194,6 +1203,14 @@
RelativePath="..\src\csnap.h"
>
</File>
<File
RelativePath="..\lib\framework\cursors.h"
>
</File>
<File
RelativePath="..\lib\framework\cursors16.h"
>
</File>
<File
RelativePath="..\src\data.h"
>
@ -1674,12 +1691,16 @@
RelativePath="..\lib\ivis_common\pietypes.h"
>
</File>
<File
RelativePath="..\lib\framework\platform.h"
>
</File>
<File
RelativePath="..\src\player.h"
>
</File>
<File
RelativePath="..\src\playlist.h"
RelativePath="..\lib\sound\playlist.h"
>
</File>
<File
@ -1739,7 +1760,7 @@
>
</File>
<File
RelativePath="..\lib\framework\resource_parser.h"
RelativePath=".\resource_parser.tab.h"
>
</File>
<File
@ -1763,7 +1784,7 @@
>
</File>
<File
RelativePath="..\lib\script\script_parser.h"
RelativePath=".\script_parser.tab.h"
>
</File>
<File
@ -1795,7 +1816,7 @@
>
</File>
<File
RelativePath="..\src\scriptvals_parser.h"
RelativePath=".\scriptvals_parser.tab.h"
>
</File>
<File
@ -1839,7 +1860,7 @@
>
</File>
<File
RelativePath="..\lib\framework\strres_parser.h"
RelativePath=".\strres_parser.tab.h"
>
</File>
<File
@ -1906,10 +1927,6 @@
RelativePath="..\lib\framework\types.h"
>
</File>
<File
RelativePath="..\lib\ivis_opengl\vid.h"
>
</File>
<File
RelativePath="..\src\visibility.h"
>
@ -1938,10 +1955,6 @@
RelativePath="..\lib\widget\widgint.h"
>
</File>
<File
RelativePath="..\lib\framework\win32fixes.h"
>
</File>
<File
RelativePath="..\src\winmain.h"
>
@ -1950,6 +1963,10 @@
RelativePath="..\src\wrappers.h"
>
</File>
<File
RelativePath="..\lib\framework\wzglobal.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
@ -1957,7 +1974,63 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="warzone2100.rc"
RelativePath="..\win32\warzone2100.rc"
>
</File>
</Filter>
<Filter
Name="FlexBison"
>
<File
RelativePath="..\lib\gamelib\audp_lexer.l"
>
</File>
<File
RelativePath="..\lib\gamelib\audp_parser.y"
>
</File>
<File
RelativePath="..\lib\script\chat_lexer.l"
>
</File>
<File
RelativePath="..\lib\script\chat_parser.y"
>
</File>
<File
RelativePath="..\src\level_lexer.l"
>
</File>
<File
RelativePath="..\lib\framework\resource_lexer.l"
>
</File>
<File
RelativePath="..\lib\framework\resource_parser.y"
>
</File>
<File
RelativePath="..\lib\script\script_lexer.l"
>
</File>
<File
RelativePath="..\lib\script\script_parser.y"
>
</File>
<File
RelativePath="..\src\scriptvals_lexer.l"
>
</File>
<File
RelativePath="..\src\scriptvals_parser.y"
>
</File>
<File
RelativePath="..\lib\framework\strres_lexer.l"
>
</File>
<File
RelativePath="..\lib\framework\strres_parser.y"
>
</File>
</Filter>