mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Merge branch 'msvc-project-and-compatibility' of git://github.com/MarcoLizza/wren into MarcoLizza-msvc-project-and-compatibility
This commit is contained in:
1
AUTHORS
1
AUTHORS
@ -8,3 +8,4 @@ Paul Woolcock <paul@woolcock.us>
|
||||
Evan Shaw <edsrzf@gmail.com>
|
||||
Gavin Schulz <gavin.schulz@gmail.com>
|
||||
Lukas Werling <lukas.werling@gmail.com>
|
||||
Marco Lizza <marco.lizza@gmail.com>
|
||||
22
project/msvc2013/wren.sln
Normal file
22
project/msvc2013/wren.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren", "wren/wren.vcxproj", "{EBF43135-4A7A-400A-8F23-DF49907025AA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EBF43135-4A7A-400A-8F23-DF49907025AA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EBF43135-4A7A-400A-8F23-DF49907025AA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EBF43135-4A7A-400A-8F23-DF49907025AA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EBF43135-4A7A-400A-8F23-DF49907025AA}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
104
project/msvc2013/wren/wren.vcxproj
Normal file
104
project/msvc2013/wren/wren.vcxproj
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>{EBF43135-4A7A-400A-8F23-DF49907025AA}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>wren</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<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 Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\main.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_compiler.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_core.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_debug.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_io.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_utils.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_value.c" />
|
||||
<ClCompile Include="..\..\..\src\wren_vm.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\include\wren.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_common.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_compiler.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_core.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_debug.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_io.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_utils.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_value.h" />
|
||||
<ClInclude Include="..\..\..\src\wren_vm.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
72
project/msvc2013/wren/wren.vcxproj.filters
Normal file
72
project/msvc2013/wren/wren.vcxproj.filters
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_compiler.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_core.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_debug.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_utils.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_value.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\wren_vm.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\include\wren.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_compiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_core.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_debug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_io.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_value.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\wren_vm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -29,7 +29,12 @@
|
||||
//
|
||||
// Defaults to on.
|
||||
#ifndef WREN_COMPUTED_GOTO
|
||||
#define WREN_COMPUTED_GOTO 1
|
||||
#ifdef _MSC_VER
|
||||
// No computed gotos in Visual Studio.
|
||||
#define WREN_COMPUTED_GOTO 0
|
||||
#else
|
||||
#define WREN_COMPUTED_GOTO 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If true, loads the "IO" class in the standard library.
|
||||
@ -127,4 +132,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
// The Microsoft compiler does not sport the "inline" modifier when
|
||||
// compiling in plain-C
|
||||
#if defined( _MSC_VER ) && !defined(__cplusplus)
|
||||
#define inline _inline
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -594,7 +594,7 @@ static void readUnicodeEscape(Parser* parser)
|
||||
break;
|
||||
}
|
||||
|
||||
char digit = readHexDigit(parser);
|
||||
int digit = readHexDigit(parser);
|
||||
if (digit == -1)
|
||||
{
|
||||
lexError(parser, "Invalid Unicode escape sequence.");
|
||||
@ -2576,7 +2576,10 @@ void statement(Compiler* compiler)
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(compiler, TOKEN_FOR)) return forStatement(compiler);
|
||||
if (match(compiler, TOKEN_FOR)) {
|
||||
forStatement(compiler);
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(compiler, TOKEN_IF))
|
||||
{
|
||||
@ -2629,7 +2632,10 @@ void statement(Compiler* compiler)
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(compiler, TOKEN_WHILE)) return whileStatement(compiler);
|
||||
if (match(compiler, TOKEN_WHILE)) {
|
||||
whileStatement(compiler);
|
||||
return;
|
||||
}
|
||||
|
||||
// Expression statement.
|
||||
expression(compiler);
|
||||
@ -2798,8 +2804,14 @@ static void variableDefinition(Compiler* compiler)
|
||||
// like the non-curly body of an if or while.
|
||||
void definition(Compiler* compiler)
|
||||
{
|
||||
if (match(compiler, TOKEN_CLASS)) return classDefinition(compiler);
|
||||
if (match(compiler, TOKEN_VAR)) return variableDefinition(compiler);
|
||||
if (match(compiler, TOKEN_CLASS)) {
|
||||
classDefinition(compiler);
|
||||
return;
|
||||
}
|
||||
if (match(compiler, TOKEN_VAR)) {
|
||||
variableDefinition(compiler);
|
||||
return;
|
||||
}
|
||||
|
||||
block(compiler);
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ typedef struct
|
||||
Obj obj;
|
||||
// Does not include the null terminator.
|
||||
int length;
|
||||
char value[];
|
||||
char value[0];
|
||||
} ObjString;
|
||||
|
||||
// The dynamically allocated data structure for a variable that has been used
|
||||
@ -260,7 +260,7 @@ typedef struct
|
||||
ObjFn* fn;
|
||||
|
||||
// The upvalues this function has closed over.
|
||||
Upvalue* upvalues[];
|
||||
Upvalue* upvalues[0];
|
||||
} ObjClosure;
|
||||
|
||||
typedef enum
|
||||
@ -323,7 +323,7 @@ struct sObjClass
|
||||
typedef struct
|
||||
{
|
||||
Obj obj;
|
||||
Value fields[];
|
||||
Value fields[0];
|
||||
} ObjInstance;
|
||||
|
||||
typedef struct
|
||||
|
||||
Reference in New Issue
Block a user