Blitz: Fix compile time errors
This commit is contained in:
+75
-5
@@ -9,6 +9,10 @@
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="RelWithDebInfo|Win32">
|
||||
<Configuration>RelWithDebInfo</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
@@ -23,10 +27,17 @@
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -37,6 +48,10 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
@@ -46,15 +61,22 @@
|
||||
<OutDir>..\#Build\$(ProjectName)\$(Configuration)-$(PlatformTarget)\</OutDir>
|
||||
<IntDir>..\#Intermediate\$(ProjectName)\$(Configuration)-$(PlatformTarget)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(DXSDK_DIR)Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
<LibraryPath>$(DXSDK_DIR)Lib\x86\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
|
||||
<IncludePath>C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>..\#Build\$(ProjectName)\$(Configuration)-$(PlatformTarget)\</OutDir>
|
||||
<IntDir>..\#Intermediate\$(ProjectName)\$(Configuration)-$(PlatformTarget)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(DXSDK_DIR)Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
<LibraryPath>$(DXSDK_DIR)Lib\x86\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
|
||||
<IncludePath>C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">
|
||||
<OutDir>..\#Build\$(ProjectName)\$(Configuration)-$(PlatformTarget)\</OutDir>
|
||||
<IntDir>..\#Intermediate\$(ProjectName)\$(Configuration)-$(PlatformTarget)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@@ -90,6 +112,54 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ControlFlowGuard>false</ControlFlowGuard>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
|
||||
<Optimization>Full</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<MultiProcessorCompilation>false</MultiProcessorCompilation>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Release\blitz.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x1409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release\blitz.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
|
||||
+19
-20
@@ -19,7 +19,7 @@ vector<UserFunc> userFuncs;
|
||||
|
||||
static HMODULE linkerHMOD, runtimeHMOD;
|
||||
|
||||
static Type *typeof(int c) {
|
||||
static Type *bbtypeof(int c) {
|
||||
switch (c) {
|
||||
case '%':return Type::int_type;
|
||||
case '#':return Type::float_type;
|
||||
@@ -31,7 +31,7 @@ static Type *typeof(int c) {
|
||||
static int curr;
|
||||
static string text;
|
||||
|
||||
static int next(istream &in) {
|
||||
static int bbnext(istream &in) {
|
||||
|
||||
text = "";
|
||||
|
||||
@@ -82,16 +82,16 @@ static const char *linkRuntime() {
|
||||
keyWords.push_back(s);
|
||||
|
||||
//global!
|
||||
int start = 0, end, k;
|
||||
size_t start = 0, end, k;
|
||||
Type *t = Type::void_type;
|
||||
if (!isalpha(s[0])) { start = 1; t = typeof(s[0]); }
|
||||
if (!isalpha(s[0])) { start = 1; t = bbtypeof(s[0]); }
|
||||
for (k = 1; k < s.size(); ++k, end = k) {
|
||||
if (!isalnum(s[k]) && s[k] != '_') break;
|
||||
}
|
||||
DeclSeq *params = new DeclSeq();
|
||||
string n = s.substr(start, end - start);
|
||||
while (k < s.size()) {
|
||||
Type *t = typeof(s[k++]);
|
||||
Type *t = bbtypeof(s[k++]);
|
||||
int from = k;
|
||||
for (; isalnum(s[k]) || s[k] == '_'; ++k) {}
|
||||
string str = s.substr(from, k - from);
|
||||
@@ -109,7 +109,7 @@ static const char *linkRuntime() {
|
||||
int n = atoi(s.substr(from, k - from));
|
||||
defType = new ConstType(n);
|
||||
} else {
|
||||
float n = atof(s.substr(from, k - from));
|
||||
float n = (float)atof(s.substr(from, k - from));
|
||||
defType = new ConstType(n);
|
||||
}
|
||||
}
|
||||
@@ -134,21 +134,20 @@ static const char *loadUserLib(const string &userlib) {
|
||||
string lib = "";
|
||||
ifstream in(t.c_str());
|
||||
|
||||
next(in);
|
||||
bbnext(in);
|
||||
while (curr) {
|
||||
|
||||
if (curr == '.') {
|
||||
|
||||
if (next(in) != -1) return "expecting identifier after '.'";
|
||||
if (bbnext(in) != -1) return "expecting identifier after '.'";
|
||||
|
||||
if (text == "lib") {
|
||||
if (next(in) != -2) return "expecting string after lib directive";
|
||||
if (bbnext(in) != -2) return "expecting string after lib directive";
|
||||
lib = text;
|
||||
|
||||
} else {
|
||||
return "unknown decl directive";
|
||||
}
|
||||
next(in);
|
||||
bbnext(in);
|
||||
|
||||
} else if (curr == -1) {
|
||||
|
||||
@@ -161,31 +160,31 @@ static const char *loadUserLib(const string &userlib) {
|
||||
_ulibkws.insert(lower_id);
|
||||
|
||||
Type *ty = 0;
|
||||
switch (next(in)) {
|
||||
switch (bbnext(in)) {
|
||||
case '%':ty = Type::int_type; break;
|
||||
case '#':ty = Type::float_type; break;
|
||||
case '$':ty = Type::string_type; break;
|
||||
}
|
||||
if (ty) next(in);
|
||||
if (ty) bbnext(in);
|
||||
else ty = Type::void_type;
|
||||
|
||||
DeclSeq *params = new DeclSeq();
|
||||
|
||||
if (curr != '(') return "expecting '(' after function identifier";
|
||||
next(in);
|
||||
bbnext(in);
|
||||
if (curr != ')') {
|
||||
for (;;) {
|
||||
if (curr != -1) break;
|
||||
string arg = text;
|
||||
|
||||
Type *ty = 0;
|
||||
switch (next(in)) {
|
||||
switch (bbnext(in)) {
|
||||
case '%':ty = Type::int_type; break;
|
||||
case '#':ty = Type::float_type; break;
|
||||
case '$':ty = Type::string_type; break;
|
||||
case '*':ty = Type::null_type; break;
|
||||
}
|
||||
if (ty) next(in);
|
||||
if (ty) bbnext(in);
|
||||
else ty = Type::int_type;
|
||||
|
||||
ConstType *defType = 0;
|
||||
@@ -193,7 +192,7 @@ static const char *loadUserLib(const string &userlib) {
|
||||
Decl *d = params->insertDecl(arg, ty, DECL_PARAM, defType);
|
||||
|
||||
if (curr != ',') break;
|
||||
next(in);
|
||||
bbnext(in);
|
||||
}
|
||||
}
|
||||
if (curr != ')') return "expecting ')' after function decl";
|
||||
@@ -204,11 +203,11 @@ static const char *loadUserLib(const string &userlib) {
|
||||
|
||||
runtimeEnviron->funcDecls->insertDecl(lower_id, fn, DECL_FUNC);
|
||||
|
||||
if (next(in) == ':') { //real name?
|
||||
next(in);
|
||||
if (bbnext(in) == ':') { //real name?
|
||||
bbnext(in);
|
||||
if (curr != -1 && curr != -2) return "expecting identifier or string after alias";
|
||||
id = text;
|
||||
next(in);
|
||||
bbnext(in);
|
||||
}
|
||||
|
||||
userFuncs.push_back(UserFunc(lower_id, id, lib));
|
||||
|
||||
Reference in New Issue
Block a user