diff --git a/Source/Bind/ES/ESGenerator.cs b/Source/Bind/ES/ESGenerator.cs index 783e85e7..423ae978 100644 --- a/Source/Bind/ES/ESGenerator.cs +++ b/Source/Bind/ES/ESGenerator.cs @@ -19,7 +19,7 @@ namespace Bind.ES dirName = nsName; glTypemap = "GL2/gl.tm"; - csTypemap = "csharp.tm"; + csTypemap = Settings.LanguageTypeMapFile; enumSpec = dirName + "/signatures.xml"; enumSpecExt = String.Empty; diff --git a/Source/Bind/GL2/GL4Generator.cs b/Source/Bind/GL2/GL4Generator.cs index 99dde84b..6323f8e3 100644 --- a/Source/Bind/GL2/GL4Generator.cs +++ b/Source/Bind/GL2/GL4Generator.cs @@ -38,7 +38,7 @@ namespace Bind.GL2 : base(name, dirname) { glTypemap = "GL2/gl.tm"; - csTypemap = "csharp.tm"; + csTypemap = Settings.LanguageTypeMapFile; enumSpec = "GL2/signatures.xml"; enumSpecExt = String.Empty; diff --git a/Source/Bind/GL2/Generator.cs b/Source/Bind/GL2/Generator.cs index 950baee7..e2dd7402 100644 --- a/Source/Bind/GL2/Generator.cs +++ b/Source/Bind/GL2/Generator.cs @@ -23,7 +23,7 @@ namespace Bind.GL2 #region Fields protected static string glTypemap = "GL2/gl.tm"; - protected static string csTypemap = "csharp.tm"; + protected static string csTypemap = Settings.LanguageTypeMapFile; protected static string enumSpec = "GL2/enum.spec"; protected static string enumSpecExt = "GL2/enumext.spec"; protected static string glSpec = "GL2/gl.spec"; diff --git a/Source/Bind/Generator.Bind.csproj b/Source/Bind/Generator.Bind.csproj index ca274a27..51cece03 100644 --- a/Source/Bind/Generator.Bind.csproj +++ b/Source/Bind/Generator.Bind.csproj @@ -189,6 +189,7 @@ OpenTK.snk + diff --git a/Source/Bind/Main.cs b/Source/Bind/Main.cs index bf89fc4f..a5685f0f 100644 --- a/Source/Bind/Main.cs +++ b/Source/Bind/Main.cs @@ -91,6 +91,7 @@ namespace Bind Settings.Language = GeneratorLanguage.Cpp; Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputNamespace = "OpenTK"; + // Settings.DefaultLanguageTypeMapFile = "cpp.tm"; // Todo: create this file! Settings.EnumsNamespace = ""; Settings.NamespaceSeparator = "::"; } @@ -99,6 +100,7 @@ namespace Bind Settings.Language = GeneratorLanguage.Java; Settings.DefaultOutputPath = "gl"; Settings.DefaultOutputNamespace = "com.opentk"; + Settings.DefaultLanguageTypeMapFile = "java.tm"; Settings.EnumsNamespace = ""; Settings.NamespaceSeparator = "."; } diff --git a/Source/Bind/Settings.cs b/Source/Bind/Settings.cs index 0d7afd3a..9a37ddb8 100644 --- a/Source/Bind/Settings.cs +++ b/Source/Bind/Settings.cs @@ -20,8 +20,10 @@ namespace Bind public static string DefaultDocFile = "ToInlineDocs.xslt"; public static string DefaultLicenseFile = "License.txt"; public static string DefaultOverridesFile = "GL2/gloverrides.xml"; + public static string DefaultLanguageTypeMapFile = "csharp.tm"; - static string inputPath, outputPath, outputNamespace, docPath, docFile, licenseFile, overridesFile; + static string inputPath, outputPath, outputNamespace, docPath, docFile, licenseFile, overridesFile, + languageTypeMapFile; public static string InputPath { get { return inputPath ?? DefaultInputPath; } set { inputPath = value; } } public static string OutputPath { get { return outputPath ?? DefaultOutputPath; } set { outputPath = value; } } public static string OutputNamespace { get { return outputNamespace ?? DefaultOutputNamespace; } set { outputNamespace = value; } } @@ -29,6 +31,7 @@ namespace Bind public static string DocFile { get { return docFile ?? DefaultDocFile; } set { docFile = value; } } public static string LicenseFile { get { return licenseFile ?? DefaultLicenseFile; } set { licenseFile = value; } } public static string OverridesFile { get { return overridesFile ?? DefaultOverridesFile; } set { overridesFile = value; } } + public static string LanguageTypeMapFile { get { return languageTypeMapFile ?? DefaultLanguageTypeMapFile; } set { languageTypeMapFile = value; } } public static string GLClass = "GL"; // Needed by Glu for the AuxEnumsClass. Can be set through -gl:"xxx". public static string OutputClass = "GL"; // The real output class. Can be set through -class:"xxx". diff --git a/Source/Bind/Specifications/java.tm b/Source/Bind/Specifications/java.tm new file mode 100644 index 00000000..0abe2c3f --- /dev/null +++ b/Source/Bind/Specifications/java.tm @@ -0,0 +1,146 @@ +# Normal types. +GLsizei, int +GLsizeiptr, com.sun.jna.ptr.IntByReference +GLintptr, com.sun.jna.ptr.IntByReference +# GLenum, int +GLboolean, boolean # bool # int +GLbitfield, int +# GLvoid*, com.sun.jna.ptr.IntByReference +# GLvoid, Void #Object +GLchar, char +GLbyte, byte +GLubyte, byte +GLshort, short +GLushort, short +GLint, int +GLuint, int +GLfloat, float +GLclampf, float +GLdouble, double +GLclampd, double +GLstring, String + +PixelInternalFormat, PixelInternalFormat + +# ARB and NV types. +GLsizeiptrARB, com.sun.jna.ptr.IntByReference +GLintptrARB, com.sun.jna.ptr.IntByReference +GLhandleARB, int +GLhalfARB, Half +GLhalfNV, Half +GLcharARB, char + +# 64 bit types (introduced in 2.1) +GLint64EXT, long +GLuint64EXT, long +GLint64, long +GLuint64, long + +# ARB_sync (introduced in 3.2) +sync, com.sun.jna.ptr.IntByReference +GLsync, com.sun.jna.ptr.IntByReference + +# Wgl types. +PROC, com.sun.jna.ptr.IntByReference +LPCSTR, String +COLORREF, int +BOOL, boolean +DWORD, int +FLOAT, float +HANDLE, com.sun.jna.ptr.IntByReference +HDC, com.sun.jna.ptr.IntByReference +HGLRC, com.sun.jna.ptr.IntByReference +HPBUFFERARB, com.sun.jna.ptr.IntByReference #HPBUFFERARB +HPBUFFEREXT, com.sun.jna.ptr.IntByReference #HPBUFFEREXT +INT32, int +INT64, long +LPVOID, void* +#String, const char * +UINT, int +USHORT, short +VOID, void +VoidPointer, void* +float, float +int, int +#void, * +GLDEBUGPROCARB, DebugProcArb +GLDEBUGPROCAMD , DebugProcAmd +GLvdpauSurfaceNV, com.sun.jna.ptr.IntByReference + +# Glu types. +Float64 double +Float64Pointer com.sun.jna.ptr.DoubleByReference +Float32 float +Float32Pointer com.sun.jna.ptr.SingleByReference + +# Glx types. +Void void +Bool boolean +int64_t long +int32_t int + +Display com.sun.jna.ptr.IntByReference +Window com.sun.jna.ptr.IntByReference +Pixmap com.sun.jna.ptr.IntByReference +Colormap com.sun.jna.ptr.IntByReference + +GLXWindow com.sun.jna.ptr.IntByReference +GLXContext com.sun.jna.ptr.IntByReference +GLXDrawable com.sun.jna.ptr.IntByReference +GLXPixmap com.sun.jna.ptr.IntByReference +__GLXextFuncPtr com.sun.jna.ptr.IntByReference + +VLServer com.sun.jna.ptr.IntByReference +VLPath com.sun.jna.ptr.IntByReference +VLNode com.sun.jna.ptr.IntByReference + + +# OpenGL|ES types. +GLclampx, int +GLfixed, int +GLeglImageOES, com.sun.jna.ptr.IntByReference + + +# OpenCL types. +_cl_context, com.sun.jna.ptr.IntByReference +_cl_event, com.sun.jna.ptr.IntByReference +cl_command_queue, com.sun.jna.ptr.IntByReference +cl_context, com.sun.jna.ptr.IntByReference +cl_device_id, com.sun.jna.ptr.IntByReference +cl_event, com.sun.jna.ptr.IntByReference +cl_kernel, com.sun.jna.ptr.IntByReference +cl_mem, com.sun.jna.ptr.IntByReference +cl_platform_id, com.sun.jna.ptr.IntByReference +cl_program, com.sun.jna.ptr.IntByReference +cl_sampler, com.sun.jna.ptr.IntByReference +size_t, com.sun.jna.NativeLong + +cl_bool, boolean +cl_int, int +cl_uint, uint +uchar, byte + +cl_addressing_mode, AddressingMode +cl_command_queue_info, CommandQueueInfo +cl_command_queue_properties, CommandQueueProperties +cl_context_info, ContextInfo +cl_context_properties, com.sun.jna.ptr.IntByReference # ContextProperties +cl_device_info, DeviceInfo +cl_device_type, DeviceType +cl_event_info, EventInfo +cl_filter_mode, FilterMode +cl_image_format, ImageFormat +cl_image_info, ImageInfo +cl_kernel_group_info, KernelGroupInfo +cl_kernel_info, KernelInfo +cl_kernel_work_group_info, KernelWorkGroupInfo +cl_map_flags, MapFlags +cl_mem_info, MemInfo +cl_mem_flags, MemFlags +cl_mem_object_type, MemObjectType +cl_platform_info, PlatformInfo +cl_profiling_info, ProfilingInfo +cl_program_build_info, ProgramBuildInfo +cl_program_info, ProgramInfo +cl_sampler_info, SamplerInfo +cl_work_group_info, WorkGroupInfo