Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Compact Framework (2.0) on Windows CE
Most of the changes here are wrapped in "#if WindowsCE". SharpLua.Interactive\SharpLua.InteractiveCF20.csproj Project file for CE/CF version of slua.exe This was used to run through the test suite. SharpLua\CFSupport.cs Provides central functionality to fix compatibility issues with CE/CF Provide dummy IReflect interface to make ProxyType happy. (I could not find a way to make this work out cleanly or efficiently. Need to revisit this stuff later.) Create (literal) dummy class in System.Runtime.Serialization so that the unnecessary 'using System.Runtime.Serialization' placed everywhere doesn't break things. ThreadLocalSlot<T> provides a surrogate for [ThreadStatic] Create extension methods to replace overloads that don't exist in CF SharpLua\Interfacing\MethodWrapper.cs Alias IReflect to Type Since CF does not support reflection emit, have Add method throw NotSupportedException SharpLua\SharpLuaCF20.csproj Project file for CE/CF version of SharpLua.dll SharpLua\Support\LuaCFSupport.cs Provides functionality to fix compatibility issues with CE/CF within the main Lua class Provides stdio methods (interestingly enough, since CE has the C library built-in, most of the surrogate functions could be deferred to stdio) SharpLua\Support\errno_h.cs (Not CE-specific) Provides errno-like behavior SharpLua\Support\stdlib_h.cs (Not CE-specific) Provide 'exit' and 'getenv' SharpLuaCF20.sln Solution file for CF20 (VS2008, because VS2012 abandons support for CF2.0) SharpLua.Interactive\Main.cs Replace calls to Environment.Exit with calls to Lua.exit Perform juggling to get full command line, including argv[0], under CE Also do FakeCurrentDirectory fudging under CE Remove calls to Application.EnableVisualStyles and SetCompatibleTextRenderingDefault, which (a) do not exist in CF, and (b) are absolutely pointless in a console application. Use alternative way to get full path and filename of assembly No LuaSourceException under CE (the new lexer/compiler are not even compiled in) SharpLua.Interactive\Properties\AssemblyInfo.cs AssemblyFileVersionAttribute does not exist in CF SharpLua\Interfacing\CheckType.cs Rework the extractValues dictionary to remove explicit use of RuntimeTypeHandle, which doesn't work under CF No such thing as AppDomain.GetAssemblies() :-( Need to add the ability to register a set of assemblies to be scanned. No support for dynamic type generation in CF SharpLua\Interfacing\Lua.cs No support for dynamic type generation in CF SharpLua\Interfacing\LuaException.cs No built-in "Source" property in Exception in CF No SerializationInfo/StreamingContext in CF SharpLua\Interfacing\LuaRegistrationHelper.cs No Enum.GetNames() or GetValues() in CF SharpLua\Interfacing\Metatables.cs Alias IReflect to Type No SEHException in CF (should this even be used anymore?) TableToArray: Use 3-arg form of Convert.ChangeType (2-arg form missing from CF) matchParameters: ParameterInfo does not have handy IsIn, IsOut, IsOptional properties in CF SharpLua\Interfacing\ObjectTranslator.cs Alias IReflect to Type loadAssembly(): Use Assembly.Load instead of Assembly.LoadWithPartialName (does not exist in CF, gives warning in FF) loadAssembly(): Assembly.Load(AssemblyName) does not exist in CF (use Assembly.LoadFrom) FindType(): Try Type.GetType() first, just in case it's an assembly-qualified class name FindType(): No such thing as AppDomain.GetAssemblies() :-( registerTable(): Not available under CF enumFromInt(): Use 3-arg form of Enum.Parse (2-arg form missing from CF) IsILua(): Always false, there's no ILuaGeneratedType in CF b/c there is no dynamic type generation push(): Don't bother with IsILua SharpLua\LASM\LasmParser.cs TryParse doesn't exist in CF SharpLua\LASM\bit.cs BitConverter.DoubleToInt64Bits does not exist in CF SharpLua\LuaCore\Libraries\liolib.cs Changes to make errno work SharpLua\LuaCore\Libraries\loadlib.cs setprogdir(): CE does not have the notion of a current directory(!) Use getenv() instead of Environment.GetEnvironmentVariable directly SharpLua\LuaCore\Libraries\loslib.cs Changes to make errno work Make os_execute half-work under CE (it doesn't work well) Fix lua_opt usage in os_date; VS2008 apparently can't infer the type argument Change an #else-#if to the cleaner #elif Use new exit() method instead of Environment.Exit (which does not exist in CF) SharpLua\LuaCore\Parser\lparser.cs Can't set the culture for a thread in CF; it's hard-coded(!) This might break the parser. SharpLua\LuaCore\VM\lapi.cs #if out SharpLua_OverrideLoad Remove explicit call to f.f.Dispose(), which is (a) marked protected in CF, and (b) implied by Close() anyway SharpLua\LuaCore\VM\lauxlib.cs errno is now a property and not a function SharpLua\LuaCore\VM\ldo.cs Change an #else-#if to the cleaner #elif Use new exit() method instead of Environment.Exit (which does not exist in CF) SharpLua\LuaCore\VM\lundump.cs LoadMem: Marhshal.SizeOf(typeof(char)) returns 2 under CF This whole mess needs to be redone anyway SharpLua\LuaCore\luaconf.cs Remove errno- replaced with errno property in errno_h.cs Remove strerror - moved to errno_h.cs Moved getenv to stdlib_h.cs Various stdio implementations now save the exception to the errno property Make stdout, stdin, and stderr work under CE frexp(): Math.Log(n, base) does not exist in CF fopen(): Add mojo to fake a current directory SharpLua\LuaCore\printf.cs IntPtr.ToString(string) overload does not exist in CF SharpLua\Properties\AssemblyInfo.cs AssemblyFileVersionAttribute does not exist in CF SharpLua\SharpLuaNet20.csproj Add errno_h.cs and stdlib_h.cs to the project
- Loading branch information