int icolor;
int state;
- int place;
/* attributes */
int intense = -1;
data[ln] = 0;
vsprintf(data, fmt, va);
if (GMQCC_IS_DEFINE(handle))
- ln = win_fputs(data, handle);
+ win_fputs(data, handle);
else
ln = fputs(data, handle);
free(data);
#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, ...)
{
int err = errno;
}
}
-static inline int ftepp_next(ftepp_t *ftepp)
+static GMQCC_INLINE int ftepp_next(ftepp_t *ftepp)
{
return (ftepp->token = lex_do(ftepp->lex));
}
# pragma warning(disable : 4018 ) /* signed/unsigned mismatch */
# pragma warning(disable : 4996 ) /* This function or variable may be unsafe */
# pragma warning(disable : 4700 ) /* uninitialized local variable used */
+# pragma warning(disable : 4129 ) /* unrecognized character secape sequence */
#endif
#define GMQCC_VERSION_MAJOR 0
# define GMQCC_NORETURN
#endif
-/* TODO: visual studiblows work around */
#ifndef _MSC_VER
# 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
+
+/*
+ *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
* almost every possible situation. Otherwise a runtime check has to be
/*
* TODO: make these safer to use. Currently this only works on
* 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 INT2FLT(Y) *((float *)&(Y))
#define vec_shrinkto(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) \
do { \
size_t E = 0; \
};
/* const/var qualifiers */
-#define CV_NONE 0
-#define CV_CONST 1
-#define CV_VAR -1
-/* magic number to help parsing */
-#define CV_WRONG 0x8000
+#define CV_NONE 0
+#define CV_CONST 1
+#define CV_VAR -1
+#define CV_WRONG 0x8000 /* magic number to help parsing */
extern const char *type_name [TYPE_COUNT];
extern uint16_t type_store_instr [TYPE_COUNT];
VINSTR_NRCALL
};
+/* TODO: cleanup this mess */
extern prog_section_statement *code_statements;
extern int *code_linenums;
extern prog_section_def *code_defs;
extern char *code_chars;
extern uint16_t code_crc;
+/* uhh? */
typedef float qcfloat;
typedef int32_t qcint;
/*===================================================================*/
/*========================= assembler.c =============================*/
/*===================================================================*/
+/* TODO: remove this ... */
static const struct {
const char *m; /* menomic */
const size_t o; /* operands */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectGuid>{85C266A8-7938-4AE6-AB64-428DC32B1ACD}</ProjectGuid>\r
- <RootNamespace>gmqcc</RootNamespace>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <UseDebugLibraries>true</UseDebugLibraries>\r
- <CharacterSet>NotSet</CharacterSet>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <UseDebugLibraries>false</UseDebugLibraries>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <CharacterSet>NotSet</CharacterSet>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <OutDir>.\</OutDir>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <IntDir>.\</IntDir>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <TargetName>gmqcc</TargetName>\r
- <GenerateManifest>false</GenerateManifest>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <OutDir>.</OutDir>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <IntDir>.</IntDir>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <TargetName>gmqcc</TargetName>\r
- <GenerateManifest>false</GenerateManifest>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <WarningLevel>Level3</WarningLevel>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <ExceptionHandling>false</ExceptionHandling>\r
- <BufferSecurityCheck>false</BufferSecurityCheck>\r
- <FloatingPointModel>Fast</FloatingPointModel>\r
- <PrecompiledHeaderFile>\r
- </PrecompiledHeaderFile>\r
- <PrecompiledHeaderOutputFile>\r
- </PrecompiledHeaderOutputFile>\r
- </ClCompile>\r
- <Link>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <ManifestFile>\r
- </ManifestFile>\r
- <ProgramDatabaseFile>$(TargetName).pdb</ProgramDatabaseFile>\r
- <SubSystem>Console</SubSystem>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <WarningLevel>Level3</WarningLevel>\r
- <Optimization>MaxSpeed</Optimization>\r
- <FunctionLevelLinking>true</FunctionLevelLinking>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <ExceptionHandling>false</ExceptionHandling>\r
- <BufferSecurityCheck>false</BufferSecurityCheck>\r
- <FloatingPointModel>Fast</FloatingPointModel>\r
- <PrecompiledHeaderFile>\r
- </PrecompiledHeaderFile>\r
- <PrecompiledHeaderOutputFile>\r
- </PrecompiledHeaderOutputFile>\r
- </ClCompile>\r
- <Link>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
- <OptimizeReferences>true</OptimizeReferences>\r
- <ManifestFile>\r
- </ManifestFile>\r
- <ProgramDatabaseFile>$(TargetName).pdb</ProgramDatabaseFile>\r
- <SubSystem>Console</SubSystem>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClCompile Include="asm.c" />\r
- <ClCompile Include="ast.c" />\r
- <ClCompile Include="code.c" />\r
- <ClCompile Include="error.c" />\r
- <ClCompile Include="exec.c" />\r
- <ClCompile Include="ir.c" />\r
- <ClCompile Include="lexer.c" />\r
- <ClCompile Include="main.c" />\r
- <ClCompile Include="parser.c" />\r
- <ClCompile Include="util.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="ast.h" />\r
- <ClInclude Include="execloop.h" />\r
- <ClInclude Include="gmqcc.h" />\r
- <ClInclude Include="ir.h" />\r
- <ClInclude Include="lexer.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <None Include="flags.def" />\r
- <None Include="warns.def" />\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
--- /dev/null
+
+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
--- /dev/null
+<?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>{0F0B0779-1A2F-43E9-B833-18C443F7229E}</ProjectGuid>
+ <RootNamespace>gmqcc</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="..\ast.c" />
+ <ClCompile Include="..\code.c" />
+ <ClCompile Include="..\conout.c" />
+ <ClCompile Include="..\ftepp.c" />
+ <ClCompile Include="..\ir.c" />
+ <ClCompile Include="..\lexer.c" />
+ <ClCompile Include="..\main.c" />
+ <ClCompile Include="..\opts.c" />
+ <ClCompile Include="..\parser.c" />
+ <ClCompile Include="..\util.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\ast.h" />
+ <ClInclude Include="..\gmqcc.h" />
+ <ClInclude Include="..\ir.h" />
+ <ClInclude Include="..\lexer.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?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>
\ No newline at end of file
--- /dev/null
+<?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>
\ No newline at end of file
#include "gmqcc.h"
#include <sys/types.h>
#include <sys/stat.h>
-#include <dirent.h>
opts_cmd_t opts;
#ifndef _WIN32
#include <sys/types.h>
#include <sys/wait.h>
+#include <dirent.h>
#include <unistd.h>
typedef struct {
FILE *handles[3];
return status;
}
#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
#define TASK_COMPILE 0