mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 19:01:29 +00:00
Get gmqcc/qcvm compiling on windows again. Plus work in progress support for the testsuite on windows (does not compile yet).
This commit is contained in:
parent
0be55824d4
commit
3c003bc168
9 changed files with 388 additions and 158 deletions
3
conout.c
3
conout.c
|
@ -110,7 +110,6 @@ static void win_fputs(char *str, FILE *h) {
|
||||||
int icolor;
|
int icolor;
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
int place;
|
|
||||||
|
|
||||||
/* attributes */
|
/* attributes */
|
||||||
int intense = -1;
|
int intense = -1;
|
||||||
|
@ -219,7 +218,7 @@ static int con_write(FILE *handle, const char *fmt, va_list va) {
|
||||||
data[ln] = 0;
|
data[ln] = 0;
|
||||||
vsprintf(data, fmt, va);
|
vsprintf(data, fmt, va);
|
||||||
if (GMQCC_IS_DEFINE(handle))
|
if (GMQCC_IS_DEFINE(handle))
|
||||||
ln = win_fputs(data, handle);
|
win_fputs(data, handle);
|
||||||
else
|
else
|
||||||
ln = fputs(data, handle);
|
ln = fputs(data, handle);
|
||||||
free(data);
|
free(data);
|
||||||
|
|
16
exec.c
16
exec.c
|
@ -29,22 +29,6 @@
|
||||||
|
|
||||||
#include "gmqcc.h"
|
#include "gmqcc.h"
|
||||||
|
|
||||||
/*
|
|
||||||
(prog_section_statement, code)
|
|
||||||
(prog_section_def, defs)
|
|
||||||
(prog_section_def, fields)
|
|
||||||
(prog_section_function, functions)
|
|
||||||
(char, strings)
|
|
||||||
(qcint, globals)
|
|
||||||
(qcint, entitydata)
|
|
||||||
(bool, entitypool)
|
|
||||||
(qcint, localstack)
|
|
||||||
(qc_exec_stack, stack)
|
|
||||||
(size_t, profile)
|
|
||||||
(prog_builtin, builtins)
|
|
||||||
(const char*, function_stack)
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void loaderror(const char *fmt, ...)
|
static void loaderror(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int err = errno;
|
int err = errno;
|
||||||
|
|
2
ftepp.c
2
ftepp.c
|
@ -217,7 +217,7 @@ static void ftepp_macro_delete(ftepp_t *ftepp, const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ftepp_next(ftepp_t *ftepp)
|
static GMQCC_INLINE int ftepp_next(ftepp_t *ftepp)
|
||||||
{
|
{
|
||||||
return (ftepp->token = lex_do(ftepp->lex));
|
return (ftepp->token = lex_do(ftepp->lex));
|
||||||
}
|
}
|
||||||
|
|
38
gmqcc.h
38
gmqcc.h
|
@ -39,6 +39,7 @@
|
||||||
# pragma warning(disable : 4018 ) /* signed/unsigned mismatch */
|
# pragma warning(disable : 4018 ) /* signed/unsigned mismatch */
|
||||||
# pragma warning(disable : 4996 ) /* This function or variable may be unsafe */
|
# pragma warning(disable : 4996 ) /* This function or variable may be unsafe */
|
||||||
# pragma warning(disable : 4700 ) /* uninitialized local variable used */
|
# pragma warning(disable : 4700 ) /* uninitialized local variable used */
|
||||||
|
# pragma warning(disable : 4129 ) /* unrecognized character secape sequence */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GMQCC_VERSION_MAJOR 0
|
#define GMQCC_VERSION_MAJOR 0
|
||||||
|
@ -134,11 +135,31 @@
|
||||||
# define GMQCC_NORETURN
|
# define GMQCC_NORETURN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TODO: visual studiblows work around */
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
|
#else
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
|
||||||
|
typedef __int16 int16_t;
|
||||||
|
typedef __int32 int32_t;
|
||||||
|
typedef __int64 int64_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
*windows makes these prefixed because they're C99
|
||||||
|
* TODO: utility versions that are type-safe and not
|
||||||
|
* just plain textual subsitution.
|
||||||
|
*/
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define snprintf(X, Y, Z, ...) _snprintf(X, Y, Z, __VA_ARGS__)
|
||||||
|
/* strtof doesn't exist -> strtod does though :) */
|
||||||
|
# define strtof(X, Y) (float)(strtod(X, Y))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Very roboust way at determining endianess at compile time: this handles
|
* Very roboust way at determining endianess at compile time: this handles
|
||||||
* almost every possible situation. Otherwise a runtime check has to be
|
* almost every possible situation. Otherwise a runtime check has to be
|
||||||
|
@ -263,7 +284,7 @@ uint32_t util_crc32(uint32_t crc, const char *data, size_t len);
|
||||||
/*
|
/*
|
||||||
* TODO: make these safer to use. Currently this only works on
|
* TODO: make these safer to use. Currently this only works on
|
||||||
* x86 and x86_64, some systems will likely not like this. Such
|
* x86 and x86_64, some systems will likely not like this. Such
|
||||||
* as BE systems.
|
* as BE systems. (and clean this up to use a structure ... )
|
||||||
*/
|
*/
|
||||||
#define FLT2INT(Y) *((int32_t*)&(Y))
|
#define FLT2INT(Y) *((int32_t*)&(Y))
|
||||||
#define INT2FLT(Y) *((float *)&(Y))
|
#define INT2FLT(Y) *((float *)&(Y))
|
||||||
|
@ -290,6 +311,7 @@ void _util_vec_grow(void **a, size_t i, size_t s);
|
||||||
#define vec_shrinkto(A,N) (_vec_end(A) = (N))
|
#define vec_shrinkto(A,N) (_vec_end(A) = (N))
|
||||||
#define vec_shrinkby(A,N) (_vec_end(A) -= (N))
|
#define vec_shrinkby(A,N) (_vec_end(A) -= (N))
|
||||||
|
|
||||||
|
/* vec_upload needs to be cleaned up as well to be a function */
|
||||||
#define vec_upload(X,Y,S) \
|
#define vec_upload(X,Y,S) \
|
||||||
do { \
|
do { \
|
||||||
size_t E = 0; \
|
size_t E = 0; \
|
||||||
|
@ -365,11 +387,10 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* const/var qualifiers */
|
/* const/var qualifiers */
|
||||||
#define CV_NONE 0
|
#define CV_NONE 0
|
||||||
#define CV_CONST 1
|
#define CV_CONST 1
|
||||||
#define CV_VAR -1
|
#define CV_VAR -1
|
||||||
/* magic number to help parsing */
|
#define CV_WRONG 0x8000 /* magic number to help parsing */
|
||||||
#define CV_WRONG 0x8000
|
|
||||||
|
|
||||||
extern const char *type_name [TYPE_COUNT];
|
extern const char *type_name [TYPE_COUNT];
|
||||||
extern uint16_t type_store_instr [TYPE_COUNT];
|
extern uint16_t type_store_instr [TYPE_COUNT];
|
||||||
|
@ -580,6 +601,7 @@ enum {
|
||||||
VINSTR_NRCALL
|
VINSTR_NRCALL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* TODO: cleanup this mess */
|
||||||
extern prog_section_statement *code_statements;
|
extern prog_section_statement *code_statements;
|
||||||
extern int *code_linenums;
|
extern int *code_linenums;
|
||||||
extern prog_section_def *code_defs;
|
extern prog_section_def *code_defs;
|
||||||
|
@ -589,6 +611,7 @@ extern int *code_globals;
|
||||||
extern char *code_chars;
|
extern char *code_chars;
|
||||||
extern uint16_t code_crc;
|
extern uint16_t code_crc;
|
||||||
|
|
||||||
|
/* uhh? */
|
||||||
typedef float qcfloat;
|
typedef float qcfloat;
|
||||||
typedef int32_t qcint;
|
typedef int32_t qcint;
|
||||||
|
|
||||||
|
@ -663,6 +686,7 @@ bool GMQCC_WARN vcompile_warning(lex_ctx ctx, int warntype, const char *fmt, va_
|
||||||
/*===================================================================*/
|
/*===================================================================*/
|
||||||
/*========================= assembler.c =============================*/
|
/*========================= assembler.c =============================*/
|
||||||
/*===================================================================*/
|
/*===================================================================*/
|
||||||
|
/* TODO: remove this ... */
|
||||||
static const struct {
|
static const struct {
|
||||||
const char *m; /* menomic */
|
const char *m; /* menomic */
|
||||||
const size_t o; /* operands */
|
const size_t o; /* operands */
|
||||||
|
|
32
msvc/gmqcc.sln
Normal file
32
msvc/gmqcc.sln
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
|
# Visual Studio 2010
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qcvm", "qcvm.vcxproj", "{8DC505A6-6047-4683-BA81-BC4B7A839352}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmqcc", "gmqcc.vcxproj", "{0F0B0779-1A2F-43E9-B833-18C443F7229E}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsuite", "testsuite.vcxproj", "{3F8F0021-66B8-43ED-906C-1CFE204E5673}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8DC505A6-6047-4683-BA81-BC4B7A839352}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{8DC505A6-6047-4683-BA81-BC4B7A839352}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{8DC505A6-6047-4683-BA81-BC4B7A839352}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{8DC505A6-6047-4683-BA81-BC4B7A839352}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{0F0B0779-1A2F-43E9-B833-18C443F7229E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{0F0B0779-1A2F-43E9-B833-18C443F7229E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{0F0B0779-1A2F-43E9-B833-18C443F7229E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{0F0B0779-1A2F-43E9-B833-18C443F7229E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{3F8F0021-66B8-43ED-906C-1CFE204E5673}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{3F8F0021-66B8-43ED-906C-1CFE204E5673}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{3F8F0021-66B8-43ED-906C-1CFE204E5673}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{3F8F0021-66B8-43ED-906C-1CFE204E5673}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
212
gmqcc.vcxproj → msvc/gmqcc.vcxproj
Executable file → Normal file
212
gmqcc.vcxproj → msvc/gmqcc.vcxproj
Executable file → Normal file
|
@ -1,131 +1,83 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{85C266A8-7938-4AE6-AB64-428DC32B1ACD}</ProjectGuid>
|
<ProjectGuid>{0F0B0779-1A2F-43E9-B833-18C443F7229E}</ProjectGuid>
|
||||||
<RootNamespace>gmqcc</RootNamespace>
|
<RootNamespace>gmqcc</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup />
|
||||||
<OutDir>.\</OutDir>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
</PropertyGroup>
|
<ClCompile>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<IntDir>.\</IntDir>
|
<Optimization>Disabled</Optimization>
|
||||||
</PropertyGroup>
|
</ClCompile>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<Link>
|
||||||
<TargetName>gmqcc</TargetName>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<GenerateManifest>false</GenerateManifest>
|
</Link>
|
||||||
</PropertyGroup>
|
</ItemDefinitionGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<OutDir>.</OutDir>
|
<ClCompile>
|
||||||
</PropertyGroup>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<IntDir>.</IntDir>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
</PropertyGroup>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
</ClCompile>
|
||||||
<TargetName>gmqcc</TargetName>
|
<Link>
|
||||||
<GenerateManifest>false</GenerateManifest>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</PropertyGroup>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<ClCompile>
|
</Link>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
</ItemDefinitionGroup>
|
||||||
<Optimization>Disabled</Optimization>
|
<ItemGroup>
|
||||||
<AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<ClCompile Include="..\ast.c" />
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
<ClCompile Include="..\code.c" />
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<ClCompile Include="..\conout.c" />
|
||||||
<FloatingPointModel>Fast</FloatingPointModel>
|
<ClCompile Include="..\ftepp.c" />
|
||||||
<PrecompiledHeaderFile>
|
<ClCompile Include="..\ir.c" />
|
||||||
</PrecompiledHeaderFile>
|
<ClCompile Include="..\lexer.c" />
|
||||||
<PrecompiledHeaderOutputFile>
|
<ClCompile Include="..\main.c" />
|
||||||
</PrecompiledHeaderOutputFile>
|
<ClCompile Include="..\opts.c" />
|
||||||
</ClCompile>
|
<ClCompile Include="..\parser.c" />
|
||||||
<Link>
|
<ClCompile Include="..\util.c" />
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
</ItemGroup>
|
||||||
<ManifestFile>
|
<ItemGroup>
|
||||||
</ManifestFile>
|
<ClInclude Include="..\ast.h" />
|
||||||
<ProgramDatabaseFile>$(TargetName).pdb</ProgramDatabaseFile>
|
<ClInclude Include="..\gmqcc.h" />
|
||||||
<SubSystem>Console</SubSystem>
|
<ClInclude Include="..\ir.h" />
|
||||||
</Link>
|
<ClInclude Include="..\lexer.h" />
|
||||||
</ItemDefinitionGroup>
|
</ItemGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ClCompile>
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<WarningLevel>Level3</WarningLevel>
|
</ImportGroup>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
|
||||||
<FloatingPointModel>Fast</FloatingPointModel>
|
|
||||||
<PrecompiledHeaderFile>
|
|
||||||
</PrecompiledHeaderFile>
|
|
||||||
<PrecompiledHeaderOutputFile>
|
|
||||||
</PrecompiledHeaderOutputFile>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<ManifestFile>
|
|
||||||
</ManifestFile>
|
|
||||||
<ProgramDatabaseFile>$(TargetName).pdb</ProgramDatabaseFile>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="asm.c" />
|
|
||||||
<ClCompile Include="ast.c" />
|
|
||||||
<ClCompile Include="code.c" />
|
|
||||||
<ClCompile Include="error.c" />
|
|
||||||
<ClCompile Include="exec.c" />
|
|
||||||
<ClCompile Include="ir.c" />
|
|
||||||
<ClCompile Include="lexer.c" />
|
|
||||||
<ClCompile Include="main.c" />
|
|
||||||
<ClCompile Include="parser.c" />
|
|
||||||
<ClCompile Include="util.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="ast.h" />
|
|
||||||
<ClInclude Include="execloop.h" />
|
|
||||||
<ClInclude Include="gmqcc.h" />
|
|
||||||
<ClInclude Include="ir.h" />
|
|
||||||
<ClInclude Include="lexer.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="flags.def" />
|
|
||||||
<None Include="warns.def" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
</Project>
|
87
msvc/qcvm.vcxproj
Normal file
87
msvc/qcvm.vcxproj
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{8DC505A6-6047-4683-BA81-BC4B7A839352}</ProjectGuid>
|
||||||
|
<RootNamespace>qcvm</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>false</UseOfMfc>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Full</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
|
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||||
|
<PreprocessorDefinitions>QCVM_EXECUTOR=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Full</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
|
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||||
|
<PreprocessorDefinitions>QCVM_EXECUTOR=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\conout.c" />
|
||||||
|
<ClCompile Include="..\exec.c" />
|
||||||
|
<ClCompile Include="..\util.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\gmqcc.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
73
msvc/testsuite.vcxproj
Normal file
73
msvc/testsuite.vcxproj
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{3F8F0021-66B8-43ED-906C-1CFE204E5673}</ProjectGuid>
|
||||||
|
<RootNamespace>testsuite</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\conout.c" />
|
||||||
|
<ClCompile Include="..\test.c" />
|
||||||
|
<ClCompile Include="..\util.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\gmqcc.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
83
test.c
83
test.c
|
@ -23,7 +23,6 @@
|
||||||
#include "gmqcc.h"
|
#include "gmqcc.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
|
||||||
|
|
||||||
opts_cmd_t opts;
|
opts_cmd_t opts;
|
||||||
|
|
||||||
|
@ -50,6 +49,7 @@ char *task_bins[] = {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FILE *handles[3];
|
FILE *handles[3];
|
||||||
|
@ -156,7 +156,86 @@ int task_pclose(FILE **handles) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error "There is no support for windows yet ... this is not a FTBFS bug"
|
# ifdef __MINGW32__
|
||||||
|
/* mingw32 has dirent.h */
|
||||||
|
# include <dirent.h>
|
||||||
|
# elif defined (_MSC_VER)
|
||||||
|
# define _WIN32_LEAN_AND_MEAN
|
||||||
|
# include <Windows.h>
|
||||||
|
# include <io.h>
|
||||||
|
/*
|
||||||
|
* visual studio lacks dirent.h it's a posix thing
|
||||||
|
* so we emulate it with the WinAPI.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct dirent {
|
||||||
|
long d_ino;
|
||||||
|
unsigned short d_reclen;
|
||||||
|
unsigned short d_namlen;
|
||||||
|
char d_name[FILENAME_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct _finddata_t dd_dta;
|
||||||
|
struct dirent dd_dir;
|
||||||
|
long dd_handle;
|
||||||
|
int dd_stat;
|
||||||
|
char dd_name[1];
|
||||||
|
} DIR;
|
||||||
|
|
||||||
|
DIR *opendir(const char *name) {
|
||||||
|
DIR *dir = (DIR*)mem_a(sizeof(DIR) + strlen(name));
|
||||||
|
if (!dir)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
strcpy(dir->dd_name, name);
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
int closedir(DIR *dir) {
|
||||||
|
FindClose((HANDLE)dir->dd_handle);
|
||||||
|
mem_d ((void*)dir);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct dirent *readdir(DIR *dir) {
|
||||||
|
WIN32_FIND_DATA info;
|
||||||
|
struct dirent *data;
|
||||||
|
int rets;
|
||||||
|
|
||||||
|
if (!dir->dd_handle) {
|
||||||
|
char *dirname;
|
||||||
|
if (*dir->dd_name) {
|
||||||
|
size_t n = strlen(dir->dd_name);
|
||||||
|
if ((dirname = (char*)mem_a(n + 5) /* 4 + 1 */)) {
|
||||||
|
strcpy(dirname, dir->dd_name);
|
||||||
|
strcpy(dirname + n, "\\*.*"); /* 4 + 1 */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!(dirname = util_strdup("\\*.*")))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
dir->dd_handle = (long)FindFirstFile(dirname, &info);
|
||||||
|
mem_d(dirname);
|
||||||
|
rets = !(!dir->dd_handle);
|
||||||
|
} else if (dir->dd_handle != -11) {
|
||||||
|
rets = FindNextFile ((HANDLE)dir->dd_handle, &info);
|
||||||
|
} else {
|
||||||
|
rets = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rets)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if ((data = (struct dirent*)mem_a(sizeof(struct dirent)))) {
|
||||||
|
strncpy(data->d_name, info.cFileName, FILENAME_MAX - 1);
|
||||||
|
data->d_name[FILENAME_MAX - 1] = '\0'; /* terminate */
|
||||||
|
data->d_namlen = strlen(data->d_name);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TASK_COMPILE 0
|
#define TASK_COMPILE 0
|
||||||
|
|
Loading…
Reference in a new issue