diff --git a/AUTHORS b/AUTHORS index 9479ebde..d8ffac3f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,3 +8,4 @@ Paul Woolcock Evan Shaw Gavin Schulz Lukas Werling +Marco Lizza \ No newline at end of file diff --git a/project/msvc2013/wren.sln b/project/msvc2013/wren.sln new file mode 100644 index 00000000..283ba5ba --- /dev/null +++ b/project/msvc2013/wren.sln @@ -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 diff --git a/project/msvc2013/wren/wren.vcxproj b/project/msvc2013/wren/wren.vcxproj new file mode 100644 index 00000000..a264f553 --- /dev/null +++ b/project/msvc2013/wren/wren.vcxproj @@ -0,0 +1,104 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {EBF43135-4A7A-400A-8F23-DF49907025AA} + Win32Proj + wren + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ..\..\..\src;..\..\..\include + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ..\..\..\src;..\..\..\include + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project/msvc2013/wren/wren.vcxproj.filters b/project/msvc2013/wren/wren.vcxproj.filters new file mode 100644 index 00000000..571da9be --- /dev/null +++ b/project/msvc2013/wren/wren.vcxproj.filters @@ -0,0 +1,72 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/wren_common.h b/src/wren_common.h index c9debcff..747c01bb 100644 --- a/src/wren_common.h +++ b/src/wren_common.h @@ -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 diff --git a/src/wren_compiler.c b/src/wren_compiler.c index f0f9cf4f..e305598e 100644 --- a/src/wren_compiler.c +++ b/src/wren_compiler.c @@ -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); } diff --git a/src/wren_value.h b/src/wren_value.h index 9150318e..345bd647 100644 --- a/src/wren_value.h +++ b/src/wren_value.h @@ -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