Skip to content
Browse files

Added OpenAL and started on ALUT. Also some minor format cleanup.

  • Loading branch information...
1 parent 37e03dc commit 5cf53ebd7a535a030581bcb16f92eca87854a4f8 @Qard committed Mar 29, 2010
Showing with 51,747 additions and 5 deletions.
  1. +3 −3 Makefile
  2. +1 −1 Makefile.Linux
  3. +1 −1 README.mkd
  4. +126 −0 bindings/ALUT/alut.h
  5. +582 −0 bindings/ALUT/bind.cpp
  6. +37 −0 bindings/ALUT/bind.h
  7. +241 −0 bindings/ALUT/bind.json
  8. +275 −0 bindings/ALUT/bind.py
  9. +5 −0 bindings/ALUT/glutInit.template
  10. +57 −0 bindings/ALUT/glutTimerFunc.template
  11. +107 −0 bindings/ALUT/make_json.py
  12. +1,142 −0 bindings/GLU/bind.cpp
  13. +28 −0 bindings/GLU/bind.h
  14. +246 −0 bindings/GLU/bind.py
  15. +303 −0 bindings/GLU/glu.h
  16. +3,329 −0 bindings/GLUT/bind.cpp
  17. +39 −0 bindings/GLUT/bind.h
  18. +311 −0 bindings/GLUT/bind.py
  19. +635 −0 bindings/GLUT/glut.h
  20. +5 −0 bindings/GLUT/glutInit.template
  21. +57 −0 bindings/GLUT/glutTimerFunc.template
  22. +724 −0 bindings/OpenAL/al.h
  23. +624 −0 bindings/OpenAL/bind.cpp
  24. +34 −0 bindings/OpenAL/bind.h
  25. +1,030 −0 bindings/OpenAL/bind.json
  26. +275 −0 bindings/OpenAL/bind.py
  27. +107 −0 bindings/OpenAL/make_json.py
  28. +12,148 −0 bindings/OpenGL/bind.cpp
  29. +20 −0 bindings/OpenGL/bind.h
  30. +10,171 −0 bindings/OpenGL/bind.json
  31. +205 −0 bindings/OpenGL/bind.py
  32. +3,034 −0 bindings/OpenGL/gl.h
  33. +107 −0 bindings/OpenGL/make_json.py
  34. +3,962 −0 bindings/OpenGLES/bind.cpp
  35. +20 −0 bindings/OpenGLES/bind.h
  36. +2,895 −0 bindings/OpenGLES/bind.json
  37. +306 −0 bindings/OpenGLES/bind.py
  38. +621 −0 bindings/OpenGLES/gl2.h
  39. +67 −0 bindings/OpenGLES/gles_desktop_shim.h
  40. +1,559 −0 bindings/OpenGLES/glescustom.cpp
  41. +52 −0 bindings/OpenGLES/glew_desktop_shim.h
  42. +107 −0 bindings/OpenGLES/make_json.py
  43. +25 −0 external/v8/.gitignore
  44. +35 −0 external/v8/.svn/all-wcprops
  45. +6 −0 external/v8/.svn/dir-prop-base
  46. +216 −0 external/v8/.svn/entries
  47. +5 −0 external/v8/.svn/prop-base/AUTHORS.svn-base
  48. +5 −0 external/v8/.svn/prop-base/ChangeLog.svn-base
  49. +5 −0 external/v8/.svn/prop-base/LICENSE.svn-base
  50. +9 −0 external/v8/.svn/prop-base/SConstruct.svn-base
  51. +25 −0 external/v8/.svn/text-base/.gitignore.svn-base
  52. +21 −0 external/v8/.svn/text-base/AUTHORS.svn-base
  53. +1,350 −0 external/v8/.svn/text-base/ChangeLog.svn-base
  54. +55 −0 external/v8/.svn/text-base/LICENSE.svn-base
  55. +991 −0 external/v8/.svn/text-base/SConstruct.svn-base
  56. +21 −0 external/v8/AUTHORS
  57. +1,350 −0 external/v8/ChangeLog
  58. +55 −0 external/v8/LICENSE
  59. +991 −0 external/v8/SConstruct
  60. +89 −0 external/v8/benchmarks/.svn/all-wcprops
  61. +504 −0 external/v8/benchmarks/.svn/entries
  62. +5 −0 external/v8/benchmarks/.svn/prop-base/README.txt.svn-base
  63. +5 −0 external/v8/benchmarks/.svn/prop-base/base.js.svn-base
  64. +5 −0 external/v8/benchmarks/.svn/prop-base/crypto.js.svn-base
  65. +5 −0 external/v8/benchmarks/.svn/prop-base/deltablue.js.svn-base
  66. +5 −0 external/v8/benchmarks/.svn/prop-base/earley-boyer.js.svn-base
  67. +5 −0 external/v8/benchmarks/.svn/prop-base/raytrace.js.svn-base
  68. +5 −0 external/v8/benchmarks/.svn/prop-base/revisions.html.svn-base
  69. +5 −0 external/v8/benchmarks/.svn/prop-base/richards.js.svn-base
  70. +9 −0 external/v8/benchmarks/.svn/prop-base/run.html.svn-base
  71. +5 −0 external/v8/benchmarks/.svn/prop-base/run.js.svn-base
  72. +5 −0 external/v8/benchmarks/.svn/prop-base/style.css.svn-base
  73. +5 −0 external/v8/benchmarks/.svn/prop-base/v8-logo.png.svn-base
  74. +63 −0 external/v8/benchmarks/.svn/text-base/README.txt.svn-base
  75. +264 −0 external/v8/benchmarks/.svn/text-base/base.js.svn-base
Sorry, we could not display the entire diff because too many files (2,497) changed.
View
6 Makefile
@@ -2,10 +2,10 @@
include Makefile.$(firstword $(subst _, ,$(shell uname -s)))
CC = g++
-CFLAGS := $(CFLAGS) -m32 -Wall -Iv8/include
-PROG = v8-gl
+CFLAGS := $(CFLAGS) -m32 -Wall -Iexternal/v8/include
+PROG = jsgame
-SRCS = main.cpp imageloader.cpp utils.cpp v8-gl.cpp glbindings/glbind.cpp glesbindings/glesbind.cpp glubindings/glubind.cpp glutbindings/glutbind.cpp
+SRCS = main.cpp imageloader.cpp utils.cpp jsgame.cpp bindings/OpenGL/bind.cpp bindings/OpenGLES/bind.cpp bindings/GLU/bind.cpp bindings/GLUT/bind.cpp bindings/OpenAL/bind.cpp bindings/ALUT/bind.cpp
all: $(PROG)
View
2 Makefile.Linux
@@ -1 +1 @@
-LIBS = v8/libv8.a -lpthread -lglut -lGLU -lGL
+LIBS = external/v8/libv8.a -lpthread -lglut -lGLU -lGL -lopenal -lalut
View
2 README.mkd
@@ -39,7 +39,7 @@ Since there are no releases yet, you can clone the repo from github
Then [checkout](http://code.google.com/p/v8/source/checkout) V8 source
$ cd v8-gl
- $ svn co http://v8.googlecode.com/svn/trunk/ v8
+ $ svn co -r 3123 http://v8.googlecode.com/svn/trunk/ v8
Build V8
View
126 bindings/ALUT/alut.h
@@ -0,0 +1,126 @@
+#if !defined(AL_ALUT_H)
+#define AL_ALUT_H
+
+#if defined(_MSC_VER)
+#include <alc.h>
+#include <al.h>
+#elif defined(__APPLE__)
+#include <OpenAL/alc.h>
+#include <OpenAL/al.h>
+#else
+#include <AL/al.h>
+#include <AL/alc.h>
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#if defined(_WIN32) && !defined(_XBOX)
+ #if defined (ALUT_BUILD_LIBRARY)
+ #define ALUT_API __declspec(dllexport)
+ #else
+ #define ALUT_API __declspec(dllimport)
+ #endif
+#else
+ #if defined(ALUT_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
+ #define ALUT_API __attribute__((visibility("default")))
+ #else
+ #define ALUT_API extern
+ #endif
+#endif
+
+#if defined(_WIN32)
+ #define ALUT_APIENTRY __cdecl
+#else
+ #define ALUT_APIENTRY
+#endif
+
+#if defined(__MWERKS_)
+ #pragma export on
+#endif
+
+/* Flag deprecated functions if possible (VisualC++ .NET and GCC >= 3.1.1). */
+#if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(MIDL_PASS)
+#define ALUT_ATTRIBUTE_DEPRECATED __declspec(deprecated)
+#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 1))))
+#define ALUT_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
+#else
+#define ALUT_ATTRIBUTE_DEPRECATED
+#endif
+
+#define ALUT_API_MAJOR_VERSION 1
+#define ALUT_API_MINOR_VERSION 1
+
+#define ALUT_ERROR_NO_ERROR 0
+#define ALUT_ERROR_OUT_OF_MEMORY 0x200
+#define ALUT_ERROR_INVALID_ENUM 0x201
+#define ALUT_ERROR_INVALID_VALUE 0x202
+#define ALUT_ERROR_INVALID_OPERATION 0x203
+#define ALUT_ERROR_NO_CURRENT_CONTEXT 0x204
+#define ALUT_ERROR_AL_ERROR_ON_ENTRY 0x205
+#define ALUT_ERROR_ALC_ERROR_ON_ENTRY 0x206
+#define ALUT_ERROR_OPEN_DEVICE 0x207
+#define ALUT_ERROR_CLOSE_DEVICE 0x208
+#define ALUT_ERROR_CREATE_CONTEXT 0x209
+#define ALUT_ERROR_MAKE_CONTEXT_CURRENT 0x20A
+#define ALUT_ERROR_DESTROY_CONTEXT 0x20B
+#define ALUT_ERROR_GEN_BUFFERS 0x20C
+#define ALUT_ERROR_BUFFER_DATA 0x20D
+#define ALUT_ERROR_IO_ERROR 0x20E
+#define ALUT_ERROR_UNSUPPORTED_FILE_TYPE 0x20F
+#define ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE 0x210
+#define ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA 0x211
+
+#define ALUT_WAVEFORM_SINE 0x100
+#define ALUT_WAVEFORM_SQUARE 0x101
+#define ALUT_WAVEFORM_SAWTOOTH 0x102
+#define ALUT_WAVEFORM_WHITENOISE 0x103
+#define ALUT_WAVEFORM_IMPULSE 0x104
+
+#define ALUT_LOADER_BUFFER 0x300
+#define ALUT_LOADER_MEMORY 0x301
+
+ALUT_API ALboolean ALUT_APIENTRY alutInit (int *argcp, char **argv);
+ALUT_API ALboolean ALUT_APIENTRY alutInitWithoutContext (int *argcp, char **argv);
+ALUT_API ALboolean ALUT_APIENTRY alutExit (void);
+
+ALUT_API ALenum ALUT_APIENTRY alutGetError (void);
+ALUT_API const char *ALUT_APIENTRY alutGetErrorString (ALenum error);
+
+ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFile (const char *fileName);
+ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFileImage (const ALvoid *data, ALsizei length);
+ALUT_API ALuint ALUT_APIENTRY alutCreateBufferHelloWorld (void);
+ALUT_API ALuint ALUT_APIENTRY alutCreateBufferWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration);
+
+ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFile (const char *fileName, ALenum *format, ALsizei *size, ALfloat *frequency);
+ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFileImage (const ALvoid *data, ALsizei length, ALenum *format, ALsizei *size, ALfloat *frequency);
+ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryHelloWorld (ALenum *format, ALsizei *size, ALfloat *frequency);
+ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum *format, ALsizei *size, ALfloat *freq);
+
+ALUT_API const char *ALUT_APIENTRY alutGetMIMETypes (ALenum loader);
+
+ALUT_API ALint ALUT_APIENTRY alutGetMajorVersion (void);
+ALUT_API ALint ALUT_APIENTRY alutGetMinorVersion (void);
+
+ALUT_API ALboolean ALUT_APIENTRY alutSleep (ALfloat duration);
+
+/* Nasty Compatibility stuff, WARNING: THESE FUNCTIONS ARE STRONGLY DEPRECATED */
+#if defined(__APPLE__)
+ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutLoadWAVFile (ALbyte *fileName, ALenum *format, void **data, ALsizei *size, ALsizei *frequency);
+ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutLoadWAVMemory (ALbyte *buffer, ALenum *format, void **data, ALsizei *size, ALsizei *frequency);
+#else
+ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutLoadWAVFile (ALbyte *fileName, ALenum *format, void **data, ALsizei *size, ALsizei *frequency, ALboolean *loop);
+ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutLoadWAVMemory (ALbyte *buffer, ALenum *format, void **data, ALsizei *size, ALsizei *frequency, ALboolean *loop);
+#endif
+ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutUnloadWAV (ALenum format, ALvoid *data, ALsizei size, ALsizei frequency);
+
+#if defined(__MWERKS_)
+ #pragma export off
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
View
582 bindings/ALUT/bind.cpp
@@ -0,0 +1,582 @@
+#include "bind.h"
+
+Persistent<Context> AlutFactory::alut_persistent_context;
+
+Handle<Value> GetALUT_API(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_API);
+}
+
+Handle<Value> GetALUT_APIENTRY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_APIENTRY);
+}
+
+Handle<Value> GetALUT_ATTRIBUTE_DEPRECATED(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ATTRIBUTE_DEPRECATED);
+}
+
+Handle<Value> GetALUT_API_MAJOR_VERSION(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_API_MAJOR_VERSION);
+}
+
+Handle<Value> GetALUT_API_MINOR_VERSION(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_API_MINOR_VERSION);
+}
+
+Handle<Value> GetALUT_ERROR_NO_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_NO_ERROR);
+}
+
+Handle<Value> GetALUT_ERROR_OUT_OF_MEMORY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_OUT_OF_MEMORY);
+}
+
+Handle<Value> GetALUT_ERROR_INVALID_ENUM(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_INVALID_ENUM);
+}
+
+Handle<Value> GetALUT_ERROR_INVALID_VALUE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_INVALID_VALUE);
+}
+
+Handle<Value> GetALUT_ERROR_INVALID_OPERATION(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_INVALID_OPERATION);
+}
+
+Handle<Value> GetALUT_ERROR_NO_CURRENT_CONTEXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_NO_CURRENT_CONTEXT);
+}
+
+Handle<Value> GetALUT_ERROR_AL_ERROR_ON_ENTRY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_AL_ERROR_ON_ENTRY);
+}
+
+Handle<Value> GetALUT_ERROR_ALC_ERROR_ON_ENTRY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_ALC_ERROR_ON_ENTRY);
+}
+
+Handle<Value> GetALUT_ERROR_OPEN_DEVICE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_OPEN_DEVICE);
+}
+
+Handle<Value> GetALUT_ERROR_CLOSE_DEVICE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_CLOSE_DEVICE);
+}
+
+Handle<Value> GetALUT_ERROR_CREATE_CONTEXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_CREATE_CONTEXT);
+}
+
+Handle<Value> GetALUT_ERROR_MAKE_CONTEXT_CURRENT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_MAKE_CONTEXT_CURRENT);
+}
+
+Handle<Value> GetALUT_ERROR_DESTROY_CONTEXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_DESTROY_CONTEXT);
+}
+
+Handle<Value> GetALUT_ERROR_GEN_BUFFERS(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_GEN_BUFFERS);
+}
+
+Handle<Value> GetALUT_ERROR_BUFFER_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_BUFFER_DATA);
+}
+
+Handle<Value> GetALUT_ERROR_IO_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_IO_ERROR);
+}
+
+Handle<Value> GetALUT_ERROR_UNSUPPORTED_FILE_TYPE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_UNSUPPORTED_FILE_TYPE);
+}
+
+Handle<Value> GetALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE);
+}
+
+Handle<Value> GetALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA);
+}
+
+Handle<Value> GetALUT_WAVEFORM_SINE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_WAVEFORM_SINE);
+}
+
+Handle<Value> GetALUT_WAVEFORM_SQUARE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_WAVEFORM_SQUARE);
+}
+
+Handle<Value> GetALUT_WAVEFORM_SAWTOOTH(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_WAVEFORM_SAWTOOTH);
+}
+
+Handle<Value> GetALUT_WAVEFORM_WHITENOISE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_WAVEFORM_WHITENOISE);
+}
+
+Handle<Value> GetALUT_WAVEFORM_IMPULSE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_WAVEFORM_IMPULSE);
+}
+
+Handle<Value> GetALUT_LOADER_BUFFER(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_LOADER_BUFFER);
+}
+
+Handle<Value> GetALUT_LOADER_MEMORY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(ALUT_LOADER_MEMORY);
+}
+
+Handle<Value> ALUTInitCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 2)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ String::Utf8Value value1(args[1]);
+ char* arg1 = *value1;
+
+ //make call
+ alutInit((int*)arg0, (char**)arg1);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTInitWithoutContextCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 2)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ String::Utf8Value value1(args[1]);
+ char* arg1 = *value1;
+
+ //make call
+ alutInitWithoutContext((int*)arg0, (char**)arg1);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTExitCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 0)
+ return v8::Undefined();
+
+ //get arguments
+
+ //make call
+ alutExit();
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTGetErrorCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 0)
+ return v8::Undefined();
+
+ //get arguments
+
+ //make call
+ alutGetError();
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTGetErrorStringCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 1)
+ return v8::Undefined();
+
+ //get arguments
+ int arg0 = args[0]->IntegerValue();
+
+ //make call
+ alutGetErrorString((ALenum)arg0);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTCreateBufferFromFileCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 1)
+ return v8::Undefined();
+
+ //get arguments
+ String::Utf8Value value0(args[0]);
+ char* arg0 = *value0;
+
+ //make call
+ alutCreateBufferFromFile((const char*)arg0);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTCreateBufferFromFileImageCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 2)
+ return v8::Undefined();
+
+ //get arguments
+ String::Utf8Value value0(args[0]);
+ char* key0 = *value0;
+ void* arg0 = font_[key0];
+
+ //make call
+ alutCreateBufferFromFileImage((const ALvoid*)arg0, (ALsizei)arg1);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTCreateBufferHelloWorldCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 0)
+ return v8::Undefined();
+
+ //get arguments
+
+ //make call
+ alutCreateBufferHelloWorld();
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTCreateBufferWaveformCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 4)
+ return v8::Undefined();
+
+ //get arguments
+ int arg0 = args[0]->IntegerValue();
+ double arg1 = args[1]->NumberValue();
+ double arg2 = args[2]->NumberValue();
+ double arg3 = args[3]->NumberValue();
+
+ //make call
+ alutCreateBufferWaveform((ALenum)arg0, (ALfloat)arg1, (ALfloat)arg2, (ALfloat)arg3);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadMemoryFromFileCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 4)
+ return v8::Undefined();
+
+ //get arguments
+ String::Utf8Value value0(args[0]);
+ char* arg0 = *value0;
+ Handle<Array> arg1 = Array::Cast(args[1]);
+ Handle<Array> arg2 = Array::Cast(args[2]);
+ Handle<Array> arg3 = Array::Cast(args[3]);
+
+ //make call
+ alutLoadMemoryFromFile((const char*)arg0, (ALenum*)arg1, (ALsizei*)arg2, (ALfloat*)arg3);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadMemoryFromFileImageCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 5)
+ return v8::Undefined();
+
+ //get arguments
+ String::Utf8Value value0(args[0]);
+ char* key0 = *value0;
+ void* arg0 = font_[key0];
+ Handle<Array> arg2 = Array::Cast(args[2]);
+ Handle<Array> arg3 = Array::Cast(args[3]);
+ Handle<Array> arg4 = Array::Cast(args[4]);
+
+ //make call
+ alutLoadMemoryFromFileImage((const ALvoid*)arg0, (ALsizei)arg1, (ALenum*)arg2, (ALsizei*)arg3, (ALfloat*)arg4);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadMemoryHelloWorldCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 3)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ Handle<Array> arg1 = Array::Cast(args[1]);
+ Handle<Array> arg2 = Array::Cast(args[2]);
+
+ //make call
+ alutLoadMemoryHelloWorld((ALenum*)arg0, (ALsizei*)arg1, (ALfloat*)arg2);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadMemoryWaveformCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 7)
+ return v8::Undefined();
+
+ //get arguments
+ int arg0 = args[0]->IntegerValue();
+ double arg1 = args[1]->NumberValue();
+ double arg2 = args[2]->NumberValue();
+ double arg3 = args[3]->NumberValue();
+ Handle<Array> arg4 = Array::Cast(args[4]);
+ Handle<Array> arg5 = Array::Cast(args[5]);
+ Handle<Array> arg6 = Array::Cast(args[6]);
+
+ //make call
+ alutLoadMemoryWaveform((ALenum)arg0, (ALfloat)arg1, (ALfloat)arg2, (ALfloat)arg3, (ALenum*)arg4, (ALsizei*)arg5, (ALfloat*)arg6);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTGetMIMETypesCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 1)
+ return v8::Undefined();
+
+ //get arguments
+ int arg0 = args[0]->IntegerValue();
+
+ //make call
+ alutGetMIMETypes((ALenum)arg0);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTGetMajorVersionCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 0)
+ return v8::Undefined();
+
+ //get arguments
+
+ //make call
+ alutGetMajorVersion();
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTGetMinorVersionCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 0)
+ return v8::Undefined();
+
+ //get arguments
+
+ //make call
+ alutGetMinorVersion();
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTSleepCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 1)
+ return v8::Undefined();
+
+ //get arguments
+ double arg0 = args[0]->NumberValue();
+
+ //make call
+ alutSleep((ALfloat)arg0);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadWAVFileCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 5)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ Handle<Array> arg1 = Array::Cast(args[1]);
+ String::Utf8Value value2(args[2]);
+ char* key2 = *value2;
+ void* arg2 = font_[key2];
+ Handle<Array> arg3 = Array::Cast(args[3]);
+ Handle<Array> arg4 = Array::Cast(args[4]);
+
+ //make call
+ alutLoadWAVFile((ALbyte*)arg0, (ALenum*)arg1, (void**)arg2, (ALsizei*)arg3, (ALsizei*)arg4);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadWAVMemoryCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 5)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ Handle<Array> arg1 = Array::Cast(args[1]);
+ String::Utf8Value value2(args[2]);
+ char* key2 = *value2;
+ void* arg2 = font_[key2];
+ Handle<Array> arg3 = Array::Cast(args[3]);
+ Handle<Array> arg4 = Array::Cast(args[4]);
+
+ //make call
+ alutLoadWAVMemory((ALbyte*)arg0, (ALenum*)arg1, (void**)arg2, (ALsizei*)arg3, (ALsizei*)arg4);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadWAVFileCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 6)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ Handle<Array> arg1 = Array::Cast(args[1]);
+ String::Utf8Value value2(args[2]);
+ char* key2 = *value2;
+ void* arg2 = font_[key2];
+ Handle<Array> arg3 = Array::Cast(args[3]);
+ Handle<Array> arg4 = Array::Cast(args[4]);
+ Handle<Array> arg5 = Array::Cast(args[5]);
+
+ //make call
+ alutLoadWAVFile((ALbyte*)arg0, (ALenum*)arg1, (void**)arg2, (ALsizei*)arg3, (ALsizei*)arg4, (ALboolean*)arg5);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTLoadWAVMemoryCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 6)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arg0 = Array::Cast(args[0]);
+ Handle<Array> arg1 = Array::Cast(args[1]);
+ String::Utf8Value value2(args[2]);
+ char* key2 = *value2;
+ void* arg2 = font_[key2];
+ Handle<Array> arg3 = Array::Cast(args[3]);
+ Handle<Array> arg4 = Array::Cast(args[4]);
+ Handle<Array> arg5 = Array::Cast(args[5]);
+
+ //make call
+ alutLoadWAVMemory((ALbyte*)arg0, (ALenum*)arg1, (void**)arg2, (ALsizei*)arg3, (ALsizei*)arg4, (ALboolean*)arg5);
+
+ return v8::Undefined();
+}
+
+Handle<Value> ALUTUnloadWAVCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 4)
+ return v8::Undefined();
+
+ //get arguments
+ int arg0 = args[0]->IntegerValue();
+ String::Utf8Value value1(args[1]);
+ char* key1 = *value1;
+ void* arg1 = font_[key1];
+
+ //make call
+ alutUnloadWAV((ALenum)arg0, (ALvoid*)arg1, (ALsizei)arg2, (ALsizei)arg3);
+
+ return v8::Undefined();
+}
+
+Handle<ObjectTemplate> AlutFactory::createAlut(int* pargc, char** argv) {
+ HandleScope handle_scope;
+ Handle<ObjectTemplate> Alut = ObjectTemplate::New();
+
+ Alut->SetInternalFieldCount(1);
+
+ Alut->SetAccessor(String::NewSymbol("API"), GetALUT_API);
+ Alut->SetAccessor(String::NewSymbol("APIENTRY"), GetALUT_APIENTRY);
+ Alut->SetAccessor(String::NewSymbol("ATTRIBUTE_DEPRECATED"), GetALUT_ATTRIBUTE_DEPRECATED);
+ Alut->SetAccessor(String::NewSymbol("API_MAJOR_VERSION"), GetALUT_API_MAJOR_VERSION);
+ Alut->SetAccessor(String::NewSymbol("API_MINOR_VERSION"), GetALUT_API_MINOR_VERSION);
+ Alut->SetAccessor(String::NewSymbol("ERROR_NO_ERROR"), GetALUT_ERROR_NO_ERROR);
+ Alut->SetAccessor(String::NewSymbol("ERROR_OUT_OF_MEMORY"), GetALUT_ERROR_OUT_OF_MEMORY);
+ Alut->SetAccessor(String::NewSymbol("ERROR_INVALID_ENUM"), GetALUT_ERROR_INVALID_ENUM);
+ Alut->SetAccessor(String::NewSymbol("ERROR_INVALID_VALUE"), GetALUT_ERROR_INVALID_VALUE);
+ Alut->SetAccessor(String::NewSymbol("ERROR_INVALID_OPERATION"), GetALUT_ERROR_INVALID_OPERATION);
+ Alut->SetAccessor(String::NewSymbol("ERROR_NO_CURRENT_CONTEXT"), GetALUT_ERROR_NO_CURRENT_CONTEXT);
+ Alut->SetAccessor(String::NewSymbol("ERROR_AL_ERROR_ON_ENTRY"), GetALUT_ERROR_AL_ERROR_ON_ENTRY);
+ Alut->SetAccessor(String::NewSymbol("ERROR_ALC_ERROR_ON_ENTRY"), GetALUT_ERROR_ALC_ERROR_ON_ENTRY);
+ Alut->SetAccessor(String::NewSymbol("ERROR_OPEN_DEVICE"), GetALUT_ERROR_OPEN_DEVICE);
+ Alut->SetAccessor(String::NewSymbol("ERROR_CLOSE_DEVICE"), GetALUT_ERROR_CLOSE_DEVICE);
+ Alut->SetAccessor(String::NewSymbol("ERROR_CREATE_CONTEXT"), GetALUT_ERROR_CREATE_CONTEXT);
+ Alut->SetAccessor(String::NewSymbol("ERROR_MAKE_CONTEXT_CURRENT"), GetALUT_ERROR_MAKE_CONTEXT_CURRENT);
+ Alut->SetAccessor(String::NewSymbol("ERROR_DESTROY_CONTEXT"), GetALUT_ERROR_DESTROY_CONTEXT);
+ Alut->SetAccessor(String::NewSymbol("ERROR_GEN_BUFFERS"), GetALUT_ERROR_GEN_BUFFERS);
+ Alut->SetAccessor(String::NewSymbol("ERROR_BUFFER_DATA"), GetALUT_ERROR_BUFFER_DATA);
+ Alut->SetAccessor(String::NewSymbol("ERROR_IO_ERROR"), GetALUT_ERROR_IO_ERROR);
+ Alut->SetAccessor(String::NewSymbol("ERROR_UNSUPPORTED_FILE_TYPE"), GetALUT_ERROR_UNSUPPORTED_FILE_TYPE);
+ Alut->SetAccessor(String::NewSymbol("ERROR_UNSUPPORTED_FILE_SUBTYPE"), GetALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE);
+ Alut->SetAccessor(String::NewSymbol("ERROR_CORRUPT_OR_TRUNCATED_DATA"), GetALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA);
+ Alut->SetAccessor(String::NewSymbol("WAVEFORM_SINE"), GetALUT_WAVEFORM_SINE);
+ Alut->SetAccessor(String::NewSymbol("WAVEFORM_SQUARE"), GetALUT_WAVEFORM_SQUARE);
+ Alut->SetAccessor(String::NewSymbol("WAVEFORM_SAWTOOTH"), GetALUT_WAVEFORM_SAWTOOTH);
+ Alut->SetAccessor(String::NewSymbol("WAVEFORM_WHITENOISE"), GetALUT_WAVEFORM_WHITENOISE);
+ Alut->SetAccessor(String::NewSymbol("WAVEFORM_IMPULSE"), GetALUT_WAVEFORM_IMPULSE);
+ Alut->SetAccessor(String::NewSymbol("LOADER_BUFFER"), GetALUT_LOADER_BUFFER);
+ Alut->SetAccessor(String::NewSymbol("LOADER_MEMORY"), GetALUT_LOADER_MEMORY);
+
+ Alut->Set(String::NewSymbol("init"), FunctionTemplate::New(ALUTInitCallback));
+ Alut->Set(String::NewSymbol("initWithoutContext"), FunctionTemplate::New(ALUTInitWithoutContextCallback));
+ Alut->Set(String::NewSymbol("exit"), FunctionTemplate::New(ALUTExitCallback));
+ Alut->Set(String::NewSymbol("getError"), FunctionTemplate::New(ALUTGetErrorCallback));
+ Alut->Set(String::NewSymbol("getErrorString"), FunctionTemplate::New(ALUTGetErrorStringCallback));
+ Alut->Set(String::NewSymbol("createBufferFromFile"), FunctionTemplate::New(ALUTCreateBufferFromFileCallback));
+ Alut->Set(String::NewSymbol("createBufferFromFileImage"), FunctionTemplate::New(ALUTCreateBufferFromFileImageCallback));
+ Alut->Set(String::NewSymbol("createBufferHelloWorld"), FunctionTemplate::New(ALUTCreateBufferHelloWorldCallback));
+ Alut->Set(String::NewSymbol("createBufferWaveform"), FunctionTemplate::New(ALUTCreateBufferWaveformCallback));
+ Alut->Set(String::NewSymbol("loadMemoryFromFile"), FunctionTemplate::New(ALUTLoadMemoryFromFileCallback));
+ Alut->Set(String::NewSymbol("loadMemoryFromFileImage"), FunctionTemplate::New(ALUTLoadMemoryFromFileImageCallback));
+ Alut->Set(String::NewSymbol("loadMemoryHelloWorld"), FunctionTemplate::New(ALUTLoadMemoryHelloWorldCallback));
+ Alut->Set(String::NewSymbol("loadMemoryWaveform"), FunctionTemplate::New(ALUTLoadMemoryWaveformCallback));
+ Alut->Set(String::NewSymbol("getMIMETypes"), FunctionTemplate::New(ALUTGetMIMETypesCallback));
+ Alut->Set(String::NewSymbol("getMajorVersion"), FunctionTemplate::New(ALUTGetMajorVersionCallback));
+ Alut->Set(String::NewSymbol("getMinorVersion"), FunctionTemplate::New(ALUTGetMinorVersionCallback));
+ Alut->Set(String::NewSymbol("sleep"), FunctionTemplate::New(ALUTSleepCallback));
+ Alut->Set(String::NewSymbol("loadWAVFile"), FunctionTemplate::New(ALUTLoadWAVFileCallback));
+ Alut->Set(String::NewSymbol("loadWAVMemory"), FunctionTemplate::New(ALUTLoadWAVMemoryCallback));
+ Alut->Set(String::NewSymbol("loadWAVFile"), FunctionTemplate::New(ALUTLoadWAVFileCallback));
+ Alut->Set(String::NewSymbol("loadWAVMemory"), FunctionTemplate::New(ALUTLoadWAVMemoryCallback));
+ Alut->Set(String::NewSymbol("unloadWAV"), FunctionTemplate::New(ALUTUnloadWAVCallback));
+
+ // Again, return the result through the current handle scope.
+ return handle_scope.Close(Alut);
+}
View
37 bindings/ALUT/bind.h
@@ -0,0 +1,37 @@
+/*
+ * glutbind.h
+ *
+ * Created on: Jun 15, 2009
+ * Author: nicolas
+ */
+
+#ifndef ALUTBIND_H_
+#define ALUTBIND_H_
+
+#include <v8-debug.h>
+
+#if defined(_MSC_VER)
+#include <alc.h>
+#include <al.h>
+#include <alut.h>
+#elif defined(__APPLE__)
+#include <OpenAL/alc.h>
+#include <OpenAL/al.h>
+#include <OpenAL/alut.h>
+#else
+#include <AL/alc.h>
+#include <AL/al.h>
+#include <AL/alut.h>
+#endif
+
+#include <stdio.h>
+using namespace std;
+using namespace v8;
+
+class AlutFactory {
+public:
+ static Handle<ObjectTemplate> createAlut(int* pargc, char** argv);
+ static Persistent<Context> alut_persistent_context;
+};
+
+#endif /* GLUTBIND_H_ */
View
241 bindings/ALUT/bind.json
@@ -0,0 +1,241 @@
+[
+ {
+ "type": "c",
+ "name": "ALUT_API",
+ "value": "__declspec(dllexport)"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_APIENTRY",
+ "value": "__cdecl"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ATTRIBUTE_DEPRECATED",
+ "value": "__declspec(deprecated)"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_API_MAJOR_VERSION",
+ "value": "1"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_API_MINOR_VERSION",
+ "value": "1"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_NO_ERROR",
+ "value": "0"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_OUT_OF_MEMORY",
+ "value": "0x200"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_INVALID_ENUM",
+ "value": "0x201"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_INVALID_VALUE",
+ "value": "0x202"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_INVALID_OPERATION",
+ "value": "0x203"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_NO_CURRENT_CONTEXT",
+ "value": "0x204"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_AL_ERROR_ON_ENTRY",
+ "value": "0x205"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_ALC_ERROR_ON_ENTRY",
+ "value": "0x206"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_OPEN_DEVICE",
+ "value": "0x207"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_CLOSE_DEVICE",
+ "value": "0x208"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_CREATE_CONTEXT",
+ "value": "0x209"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_MAKE_CONTEXT_CURRENT",
+ "value": "0x20A"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_DESTROY_CONTEXT",
+ "value": "0x20B"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_GEN_BUFFERS",
+ "value": "0x20C"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_BUFFER_DATA",
+ "value": "0x20D"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_IO_ERROR",
+ "value": "0x20E"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_UNSUPPORTED_FILE_TYPE",
+ "value": "0x20F"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE",
+ "value": "0x210"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA",
+ "value": "0x211"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_WAVEFORM_SINE",
+ "value": "0x100"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_WAVEFORM_SQUARE",
+ "value": "0x101"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_WAVEFORM_SAWTOOTH",
+ "value": "0x102"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_WAVEFORM_WHITENOISE",
+ "value": "0x103"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_WAVEFORM_IMPULSE",
+ "value": "0x104"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_LOADER_BUFFER",
+ "value": "0x300"
+ },
+ {
+ "type": "c",
+ "name": "ALUT_LOADER_MEMORY",
+ "value": "0x301"
+ },
+ {
+ "return_type": "ALboolean",
+ "type": "f",
+ "name": "alutInit",
+ "parameters": [
+ "int*",
+ "char**"
+ ]
+ },
+ {
+ "return_type": "ALboolean",
+ "type": "f",
+ "name": "alutInitWithoutContext",
+ "parameters": [
+ "int*",
+ "char**"
+ ]
+ },
+ {
+ "return_type": "ALboolean",
+ "type": "f",
+ "name": "alutExit",
+ "parameters": []
+ },
+ {
+ "return_type": "ALenum",
+ "type": "f",
+ "name": "alutGetError",
+ "parameters": []
+ },
+ {
+ "return_type": "ALuint",
+ "type": "f",
+ "name": "alutCreateBufferFromFile",
+ "parameters": [
+ "const char*"
+ ]
+ },
+ {
+ "return_type": "ALuint",
+ "type": "f",
+ "name": "alutCreateBufferFromFileImage",
+ "parameters": [
+ "const ALvoid*",
+ "ALsizei"
+ ]
+ },
+ {
+ "return_type": "ALuint",
+ "type": "f",
+ "name": "alutCreateBufferHelloWorld",
+ "parameters": []
+ },
+ {
+ "return_type": "ALuint",
+ "type": "f",
+ "name": "alutCreateBufferWaveform",
+ "parameters": [
+ "ALenum",
+ "ALfloat",
+ "ALfloat",
+ "ALfloat"
+ ]
+ },
+ {
+ "return_type": "ALint",
+ "type": "f",
+ "name": "alutGetMajorVersion",
+ "parameters": []
+ },
+ {
+ "return_type": "ALint",
+ "type": "f",
+ "name": "alutGetMinorVersion",
+ "parameters": []
+ },
+ {
+ "return_type": "ALboolean",
+ "type": "f",
+ "name": "alutSleep",
+ "parameters": [
+ "ALfloat"
+ ]
+ }
+]
View
275 bindings/ALUT/bind.py
@@ -0,0 +1,275 @@
+import sys
+import re
+import sys, os
+
+MIXED = "Alut"
+UPPER = MIXED.upper()
+LOWER = MIXED.lower()
+
+PATH = os.path.dirname(sys.argv[0])
+HEAD = PATH+'/'+LOWER+'.h'
+BIND = PATH+'/bind.cpp'
+
+def main():
+ constants = []
+ functions = []
+
+ constant = re.compile(".+define[\s]+"+UPPER+"_([^\s]+).*")
+ function = re.compile("[\s]*"+UPPER+"_API[\s]+([^\s]+).*"+UPPER+"_APIENTRY[\s]+"+LOWER+"([A-Za-z0-9]+)[\s]*\((.*)\);")
+
+ text_out = []
+
+ fin = open(HEAD, 'r')
+ for l in fin:
+ mat = re.match(constant, l)
+ if mat and not mat.group(1) in constants:
+ name = mat.group(1)
+ constants.append(name)
+ text_out.append(make_constant(UPPER, name))
+
+ else:
+ mat = re.match(function, l)
+ if mat:
+ prefix = LOWER
+ return_val = mat.group(1)
+ name = mat.group(2)
+ params = mat.group(3)
+ functions.append(name)
+ has_lambda, count, params_list = get_param_list(params)
+ if has_lambda is True and count == 1:
+ text_out.append(make_function_with_callback(prefix, name, params_list, return_val))
+ else:
+ text_out.append(make_function(prefix, name, params_list, count, return_val))
+
+ fin.close()
+ fout = open(BIND, 'w')
+ fout.write("""#include "bind.h"
+
+Persistent<Context> """+MIXED+"""Factory::"""+LOWER+"""_persistent_context;
+""" + '\n'.join(text_out) + make_main_function(constants, functions))
+
+ fout.close()
+
+def make_main_function(constants, functions):
+ text_out_begin = """
+
+Handle<ObjectTemplate> """+MIXED+"""Factory::create"""+MIXED+"""(int* pargc, char** argv) {
+ HandleScope handle_scope;
+ Handle<ObjectTemplate> """+MIXED+""" = ObjectTemplate::New();
+
+ """+MIXED+"""->SetInternalFieldCount(1);
+
+"""
+
+ text_out_end = """
+
+ // Again, return the result through the current handle scope.
+ return handle_scope.Close("""+MIXED+""");
+}
+"""
+ cts = [bind_accessor(MIXED, name) for name in constants]
+ fts = [bind_function(MIXED, name) for name in functions]
+
+ return text_out_begin + '\n'.join(cts) + '\n\n' + '\n'.join(fts) + text_out_end
+
+
+def make_constant(prefix, name):
+ return_val = "return Uint32::New("+UPPER+"_"+ name +");"
+
+ text_out = """
+Handle<Value> Get"""+UPPER+"""_%%(Local<String> property,
+ const AccessorInfo &info) {
+ ##
+}"""
+ return multiple_replace({
+ '%%': name,
+ '##': return_val
+ }, text_out)
+
+
+
+def make_function(prefix, name, params_list, count, return_val):
+ text_out = """
+Handle<Value> """+UPPER+"""<name>Callback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < <len_params>)
+ return v8::Undefined();
+
+ //get arguments
+<args>
+ //make call
+ <call>
+
+ return v8::Undefined();
+}"""
+ return multiple_replace({
+ '<name>': name,
+ '<len_params>': str(count),
+ '<args>': make_args(params_list, count),
+ '<call>': make_call(prefix + name, params_list, count)
+ }, text_out)
+
+
+def make_function_with_callback(prefix, name, params_list, return_val):
+
+ text_out = """
+Persistent<Function> persistent<name>;
+
+<prototype> {
+ //define handle scope
+ HandleScope scope;
+
+ Handle<Value> valueArr[<nformalparams>];
+ <formalparamassignment>
+
+ TryCatch try_catch;
+ Handle<Value> result = persistent<name>->Call("""+MIXED+"""Factory::"""+LOWER+"""_persistent_context->Global(), <nformalparams>, valueArr);
+ if (result.IsEmpty()) {
+ String::Utf8Value error(try_catch.Exception());
+ fprintf(stderr, "Exception in <name>: %s\\n", *error);
+ }
+}
+
+Handle<Value> """+UPPER+"""<name>Callback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 1 || !args[0]->IsFunction())
+ return v8::Undefined();
+
+ //get arguments
+ //delete previous assigned function
+ persistent<name>.Dispose();
+ Handle<Function> value0 = Handle<Function>::Cast(args[0]);
+ persistent<name> = Persistent<Function>::New(value0);
+
+ //make call
+ """+LOWER+"""<name>((<signature>) func<name>);
+
+ return v8::Undefined();
+}"""
+ nformalparams, prototype = make_prototype(name, params_list[0])
+ signature = params_list[0].replace('func', '')
+ formalparamassignment = formal_param_assignment(signature)
+
+ return multiple_replace({
+ '<name>': name,
+ '<nformalparams>': str(nformalparams),
+ '<prototype>': prototype,
+ '<formalparamassignment>': formalparamassignment,
+ '<signature>': signature
+ }, text_out)
+
+def make_prototype(name, signature):
+ print 'prev ' + signature
+ signature = signature.replace('(*func)', 'func' + name)
+ ht = signature.split('(')
+ hd, tail = ht[0], ht[1].replace(')', '')
+ ans = [get_type(''.join(val), False) + ' arg' + str(i) for i, val in enumerate(tail.split(',')) if val.find('void') == -1]
+ #.strip().split(' ')[:-1]
+ print 'end ' + hd + ' ( ' + ','.join(ans) + ')'
+ return len(ans), hd + ' ( ' + ','.join(ans) + ')'
+
+def formal_param_assignment(signature):
+ print "signature"
+ print signature
+ pat = re.compile('[\s]*[a-zA-Z0-9\*]+[\s]*\(\*[\s]*\)\((.*)\)')
+ pars = re.match(pat, signature)
+ if pars:
+ pars = pars.group(1).split(',')
+ ans = []
+ for i, val in enumerate(pars):
+ if val.find('int') != -1 or val.find('unsigned char') != -1:
+ ans.append(" valueArr[" + str(i) + "] = Integer::New(arg" + str(i) + ");")
+ elif val.find('float') != -1 or val.find('double') != -1:
+ ans.append(" valueArr[" + str(i) + "] = Number::New(arg" + str(i) + ");")
+ elif val.find('char*') != -1:
+ ans.append(" valueArr[" + str(i) + "] = String::New(arg" + str(i) + ");")
+ return '\n'.join(ans)
+ else:
+ return ''
+
+def get_param_list(params):
+ params_list = []
+ params_aux = params.split(',')
+ passed = False
+ for par in params_aux:
+ if passed and params_list[-1].count('(') != params_list[-1].count(')'):
+ params_list[-1] += ',' + par
+ else:
+ params_list.append(par)
+ passed = True
+
+ aux = len(params_list)
+ if aux == 1 and params_list[0].find('func') == -1 and len(params_list[0].strip().split(' ')) == 1:
+ nb = 0
+ else:
+ nb = aux
+ return ' '.join(params_list).find('func') != -1, nb, params_list
+
+
+def make_args(params_list, count):
+ ans = []
+ for i in range(count):
+ el = params_list[i]
+ type = get_type(el)
+
+ #is function
+ if type.find('(*') != -1:
+ ans.append(" Handle<Function> value" + str(i) + " = Handle<Function>::Cast(args[" + str(i) + "]);\n void* arg" + str(i) + " = *value" + str(i) + ";\n")
+ #print "function " + type
+ #is string
+ elif type.find('char*') != -1:
+ ans.append(" String::Utf8Value value"+ str(i) +"(args["+ str(i) +"]);\n char* arg" + str(i) + " = *value"+ str(i) +";\n")
+ #print "string " + type
+ #is void*
+ elif type.find('void*') != -1:
+ ans.append(" String::Utf8Value value"+ str(i) +"(args["+ str(i) +"]);\n char* key" + str(i) + " = *value"+ str(i) +";\n void* arg" + str(i) + " = font_[key"+ str(i) +"];\n")
+ #print "void " + type
+ #is array
+ elif type.find('*') != -1:
+ ans.append(" Handle<Array> arg" + str(i) + " = Array::Cast(args[" + str(i) + "]);\n")
+ #print "array " + type
+ #is unsigned integer
+ elif type.find('unsigned int') != -1:
+ ans.append(" unsigned int arg" + str(i) + " = args["+ str(i) +"]->Uint32Value();\n")
+ #print "unsigned int " + type
+ #is integer
+ elif type.find('int') != -1 or type.find('enum') != -1:
+ ans.append(" int arg" + str(i) + " = args["+ str(i) +"]->IntegerValue();\n")
+ #print "integer " + type
+ #is double, float
+ elif type.find('double') != -1 or type.find('float') != -1:
+ ans.append(" double arg" + str(i) + " = args["+ str(i) +"]->NumberValue();\n")
+ #print "double " + type
+ else:
+ print "don't know what this is "
+ print type
+
+ return ''.join(ans)
+
+def make_call(name, params_list, nb):
+ return name + "(" + ", ".join([get_type(params_list[i]) + "arg" + str(i) for i in range(nb)]) + ");"
+
+def bind_accessor(prefix, name):
+ return " " + prefix + "->SetAccessor(String::NewSymbol(\"" + name + "\"), Get"+UPPER+"_" + name + ");"
+
+def bind_function(prefix, name):
+ return " " + prefix + "->Set(String::NewSymbol(\"" + name[0].lower() + name[1:] + "\"), FunctionTemplate::New(" + UPPER + name + "Callback));"
+
+def get_type(t, parens=True):
+ if t.find('(*') != -1 or t.find('func') != -1:
+ ans = t.replace('func', '')
+ else:
+ ans = ' '.join(t.strip().split(' ')[:-1]) + '*' * (t.strip().split(' ')[-1].count('*'))
+ return '(' + ans + ')' if parens else ans
+
+def multiple_replace(dict, text):
+ """ Replace in 'text' all occurences of any key in the given
+ dictionary by its corresponding value. Returns the new tring."""
+
+ # Create a regular expression from the dictionary keys
+ regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))
+
+ # For each match, look-up corresponding value in dictionary
+ return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)
+
+main()
View
5 bindings/ALUT/glutInit.template
@@ -0,0 +1,5 @@
+
+Handle<Value> GLUTInitCallback(const Arguments& args) {
+ glutInit(( int* ) pargc_, ( char** ) argv_);
+ return v8::Undefined();
+}
View
57 bindings/ALUT/glutTimerFunc.template
@@ -0,0 +1,57 @@
+
+typedef struct {
+ int value;
+ Persistent<Function> timerFunc;
+} timerData;
+
+timerData * persistentTimers[50] = { NULL };
+
+void callbackTimerFunc(int value) {
+ timerData * elem = persistentTimers[value];
+ if(elem != NULL) {
+ //define handle scope
+ HandleScope scope;
+ Handle<Value> args[1];
+ args[0] = Integer::New(elem->value);
+ Persistent<Function> timer = elem->timerFunc;
+ timer->Call(GlutFactory::glut_persistent_context->Global(), 1, args);
+
+ timer.Dispose();
+ delete elem;
+ persistentTimers[value] = NULL;
+ }
+}
+
+Handle<Value> GLUTTimerFuncCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 3) return v8::Undefined();
+ //get arguments
+ unsigned int millisec = args[0]->Uint32Value();
+ int timerId = args[2]->IntegerValue();
+
+ //find an empty timer spot and place the function there.
+ int i = 0;
+ bool found = false;
+ for(; i < 50; i++) {
+ if(persistentTimers[i] == NULL) {
+ //get the function
+ Handle<Function> value = Handle<Function>::Cast(args[1]);
+ Persistent<Function> persistentValue = Persistent<Function>::New(value);
+ //assign callback and value values.
+ timerData * structElem = new timerData;
+ structElem->value = timerId;
+ structElem->timerFunc = persistentValue;
+ persistentTimers[i] = structElem;
+ found = true;
+ break;
+ }
+ }
+
+ //TODO add dynamic resize for persistent Timers
+ if(!found) return v8::Undefined();
+
+ //make call
+ //Don't pass the actual *value*, but an id to our persistent Function
+ glutTimerFunc(( unsigned int ) millisec, ( void (* )( int )) callbackTimerFunc, ( int ) i);
+ return v8::Undefined();
+}
View
107 bindings/ALUT/make_json.py
@@ -0,0 +1,107 @@
+import re
+import json
+
+FILE_HEAD = '/home/stephen/Desktop/Documents/Personal/jsgame/bindings/ALUT/alut.h'
+FILE_JSON = '/home/stephen/Desktop/Documents/Personal/jsgame/bindings/ALUT/bind.json'
+
+#constant and function patterns
+constant_pattern = """
+ .+define[\s]+ #define C/C++ keyword
+
+ (?P<name>ALUT_[^\s]+) #Constant name
+
+ [\s]+
+
+ (?P<value>[^\s]+) #Constant value
+
+ [\s]*
+"""
+
+function_pattern = """
+ [\s]*ALUT_API[\s]+ #extern declaration
+
+ (?P<return_type>[^\s]+) #Function return type
+
+ [\s]*ALUT_APIENTRY[\s]+
+
+ (?P<name>alut[A-Za-z0-9]+) #Function name
+
+ [\s]*
+
+ \((?P<parameters>.*)\); #Function parameters
+"""
+#precompile regexps
+constant = re.compile(constant_pattern, re.VERBOSE)
+function = re.compile(function_pattern, re.VERBOSE)
+
+def main():
+ json_out = []
+ constants = []
+ #open input file
+ with open(FILE_HEAD, 'r') as fin:
+ #line accumulator. Function definitions
+ #can be spread into multiple lines
+ l = ''
+ #get function/constant prototype
+ for cont in fin:
+ l += cont.replace('\n', '')
+ if not balanced(l):
+ continue
+ #is constant declaration
+ mat = re.match(constant, l)
+ if mat and not mat.group('name') in constants:
+ constants.append(mat.group('name'))
+ json_out.append(make_constant(mat))
+ else:
+ #is function declaration
+ mat = re.match(function, l)
+ if mat:
+ json_out.append(make_function(mat))
+
+ l = '' #empty line accumulator
+
+ #dump as JSON
+ with open(FILE_JSON, 'w') as fout:
+ fout.write(json.dumps(json_out, indent=4))
+
+def make_constant(match):
+ """Returns a Constant JSON Object"""
+
+ return {
+ 'type': 'c', #c for constant, f for function
+ 'name': match.group('name'),
+ 'value': match.group('value') #is this necessary?
+ }
+
+def make_function(match):
+ """Returns a Function JSON Object"""
+
+ return {
+ 'type': 'f', #f for function
+ 'name': match.group('name'),
+ 'return_type': match.group('return_type'),
+ 'parameters': get_parameters(match.group('parameters'))
+ }
+
+def get_parameters(params):
+ """Returns an ordered list of parameter types"""
+
+ params_list = []
+ params_aux = params.split(',')
+ passed = False
+ for par in params_aux:
+ if passed and not balanced(params_list[-1]):
+ params_list[-1] += ',' + par
+ else:
+ #magic
+ param = ' '.join(par.strip().split(' ')[:-1]) + ('*' * (par.count('*') + par.count('[')))
+ if param.strip() != '': params_list.append(param)
+ passed = True
+
+ return params_list
+
+
+def balanced(l):
+ return l.count('(') == l.count(')')
+
+if __name__ == '__main__': main()
View
1,142 bindings/GLU/bind.cpp
@@ -0,0 +1,1142 @@
+#include "bind.h"
+
+Handle<Value> GetGLU_EXT_object_space_tess(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_EXT_object_space_tess);
+}
+
+Handle<Value> GetGLU_EXT_nurbs_tessellator(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_EXT_nurbs_tessellator);
+}
+
+Handle<Value> GetGLU_FALSE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_FALSE);
+}
+
+Handle<Value> GetGLU_TRUE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TRUE);
+}
+
+Handle<Value> GetGLU_VERSION_1_1(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_VERSION_1_1);
+}
+
+Handle<Value> GetGLU_VERSION_1_2(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_VERSION_1_2);
+}
+
+Handle<Value> GetGLU_VERSION_1_3(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_VERSION_1_3);
+}
+
+Handle<Value> GetGLU_VERSION(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_VERSION);
+}
+
+Handle<Value> GetGLU_EXTENSIONS(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_EXTENSIONS);
+}
+
+Handle<Value> GetGLU_INVALID_ENUM(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_INVALID_ENUM);
+}
+
+Handle<Value> GetGLU_INVALID_VALUE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_INVALID_VALUE);
+}
+
+Handle<Value> GetGLU_OUT_OF_MEMORY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OUT_OF_MEMORY);
+}
+
+Handle<Value> GetGLU_INCOMPATIBLE_GL_VERSION(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_INCOMPATIBLE_GL_VERSION);
+}
+
+Handle<Value> GetGLU_INVALID_OPERATION(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_INVALID_OPERATION);
+}
+
+Handle<Value> GetGLU_OUTLINE_POLYGON(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OUTLINE_POLYGON);
+}
+
+Handle<Value> GetGLU_OUTLINE_PATCH(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OUTLINE_PATCH);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR);
+}
+
+Handle<Value> GetGLU_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_ERROR);
+}
+
+Handle<Value> GetGLU_NURBS_BEGIN(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_BEGIN);
+}
+
+Handle<Value> GetGLU_NURBS_BEGIN_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_BEGIN_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_VERTEX(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_VERTEX);
+}
+
+Handle<Value> GetGLU_NURBS_VERTEX_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_VERTEX_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_NORMAL(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_NORMAL);
+}
+
+Handle<Value> GetGLU_NURBS_NORMAL_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_NORMAL_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_COLOR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_COLOR);
+}
+
+Handle<Value> GetGLU_NURBS_COLOR_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_COLOR_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_TEXTURE_COORD(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_TEXTURE_COORD);
+}
+
+Handle<Value> GetGLU_NURBS_TEX_COORD_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_TEX_COORD_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_END(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_END);
+}
+
+Handle<Value> GetGLU_NURBS_END_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_END_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_BEGIN_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_BEGIN_DATA);
+}
+
+Handle<Value> GetGLU_NURBS_BEGIN_DATA_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_BEGIN_DATA_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_VERTEX_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_VERTEX_DATA);
+}
+
+Handle<Value> GetGLU_NURBS_VERTEX_DATA_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_VERTEX_DATA_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_NORMAL_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_NORMAL_DATA);
+}
+
+Handle<Value> GetGLU_NURBS_NORMAL_DATA_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_NORMAL_DATA_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_COLOR_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_COLOR_DATA);
+}
+
+Handle<Value> GetGLU_NURBS_COLOR_DATA_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_COLOR_DATA_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_TEXTURE_COORD_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_TEXTURE_COORD_DATA);
+}
+
+Handle<Value> GetGLU_NURBS_TEX_COORD_DATA_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_TEX_COORD_DATA_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_END_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_END_DATA);
+}
+
+Handle<Value> GetGLU_NURBS_END_DATA_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_END_DATA_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR1(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR1);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR2(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR2);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR3(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR3);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR4(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR4);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR5(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR5);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR6(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR6);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR7(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR7);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR8(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR8);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR9(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR9);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR10(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR10);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR11(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR11);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR12(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR12);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR13(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR13);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR14(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR14);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR15(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR15);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR16(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR16);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR17(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR17);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR18(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR18);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR19(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR19);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR20(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR20);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR21(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR21);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR22(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR22);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR23(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR23);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR24(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR24);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR25(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR25);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR26(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR26);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR27(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR27);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR28(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR28);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR29(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR29);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR30(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR30);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR31(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR31);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR32(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR32);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR33(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR33);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR34(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR34);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR35(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR35);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR36(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR36);
+}
+
+Handle<Value> GetGLU_NURBS_ERROR37(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_ERROR37);
+}
+
+Handle<Value> GetGLU_AUTO_LOAD_MATRIX(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_AUTO_LOAD_MATRIX);
+}
+
+Handle<Value> GetGLU_CULLING(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_CULLING);
+}
+
+Handle<Value> GetGLU_SAMPLING_TOLERANCE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_SAMPLING_TOLERANCE);
+}
+
+Handle<Value> GetGLU_DISPLAY_MODE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_DISPLAY_MODE);
+}
+
+Handle<Value> GetGLU_PARAMETRIC_TOLERANCE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_PARAMETRIC_TOLERANCE);
+}
+
+Handle<Value> GetGLU_SAMPLING_METHOD(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_SAMPLING_METHOD);
+}
+
+Handle<Value> GetGLU_U_STEP(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_U_STEP);
+}
+
+Handle<Value> GetGLU_V_STEP(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_V_STEP);
+}
+
+Handle<Value> GetGLU_NURBS_MODE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_MODE);
+}
+
+Handle<Value> GetGLU_NURBS_MODE_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_MODE_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_TESSELLATOR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_TESSELLATOR);
+}
+
+Handle<Value> GetGLU_NURBS_TESSELLATOR_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_TESSELLATOR_EXT);
+}
+
+Handle<Value> GetGLU_NURBS_RENDERER(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_RENDERER);
+}
+
+Handle<Value> GetGLU_NURBS_RENDERER_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NURBS_RENDERER_EXT);
+}
+
+Handle<Value> GetGLU_OBJECT_PARAMETRIC_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OBJECT_PARAMETRIC_ERROR);
+}
+
+Handle<Value> GetGLU_OBJECT_PARAMETRIC_ERROR_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OBJECT_PARAMETRIC_ERROR_EXT);
+}
+
+Handle<Value> GetGLU_OBJECT_PATH_LENGTH(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OBJECT_PATH_LENGTH);
+}
+
+Handle<Value> GetGLU_OBJECT_PATH_LENGTH_EXT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OBJECT_PATH_LENGTH_EXT);
+}
+
+Handle<Value> GetGLU_PATH_LENGTH(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_PATH_LENGTH);
+}
+
+Handle<Value> GetGLU_PARAMETRIC_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_PARAMETRIC_ERROR);
+}
+
+Handle<Value> GetGLU_DOMAIN_DISTANCE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_DOMAIN_DISTANCE);
+}
+
+Handle<Value> GetGLU_MAP1_TRIM_2(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_MAP1_TRIM_2);
+}
+
+Handle<Value> GetGLU_MAP1_TRIM_3(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_MAP1_TRIM_3);
+}
+
+Handle<Value> GetGLU_POINT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_POINT);
+}
+
+Handle<Value> GetGLU_LINE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_LINE);
+}
+
+Handle<Value> GetGLU_FILL(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_FILL);
+}
+
+Handle<Value> GetGLU_SILHOUETTE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_SILHOUETTE);
+}
+
+Handle<Value> GetGLU_SMOOTH(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_SMOOTH);
+}
+
+Handle<Value> GetGLU_FLAT(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_FLAT);
+}
+
+Handle<Value> GetGLU_NONE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_NONE);
+}
+
+Handle<Value> GetGLU_OUTSIDE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_OUTSIDE);
+}
+
+Handle<Value> GetGLU_INSIDE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_INSIDE);
+}
+
+Handle<Value> GetGLU_TESS_BEGIN(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_BEGIN);
+}
+
+Handle<Value> GetGLU_BEGIN(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_BEGIN);
+}
+
+Handle<Value> GetGLU_TESS_VERTEX(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_VERTEX);
+}
+
+Handle<Value> GetGLU_VERTEX(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_VERTEX);
+}
+
+Handle<Value> GetGLU_TESS_END(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_END);
+}
+
+Handle<Value> GetGLU_END(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_END);
+}
+
+Handle<Value> GetGLU_TESS_ERROR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR);
+}
+
+Handle<Value> GetGLU_TESS_EDGE_FLAG(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_EDGE_FLAG);
+}
+
+Handle<Value> GetGLU_EDGE_FLAG(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_EDGE_FLAG);
+}
+
+Handle<Value> GetGLU_TESS_COMBINE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_COMBINE);
+}
+
+Handle<Value> GetGLU_TESS_BEGIN_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_BEGIN_DATA);
+}
+
+Handle<Value> GetGLU_TESS_VERTEX_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_VERTEX_DATA);
+}
+
+Handle<Value> GetGLU_TESS_END_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_END_DATA);
+}
+
+Handle<Value> GetGLU_TESS_ERROR_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR_DATA);
+}
+
+Handle<Value> GetGLU_TESS_EDGE_FLAG_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_EDGE_FLAG_DATA);
+}
+
+Handle<Value> GetGLU_TESS_COMBINE_DATA(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_COMBINE_DATA);
+}
+
+Handle<Value> GetGLU_CW(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_CW);
+}
+
+Handle<Value> GetGLU_CCW(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_CCW);
+}
+
+Handle<Value> GetGLU_INTERIOR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_INTERIOR);
+}
+
+Handle<Value> GetGLU_EXTERIOR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_EXTERIOR);
+}
+
+Handle<Value> GetGLU_UNKNOWN(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_UNKNOWN);
+}
+
+Handle<Value> GetGLU_TESS_WINDING_RULE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_WINDING_RULE);
+}
+
+Handle<Value> GetGLU_TESS_BOUNDARY_ONLY(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_BOUNDARY_ONLY);
+}
+
+Handle<Value> GetGLU_TESS_TOLERANCE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_TOLERANCE);
+}
+
+Handle<Value> GetGLU_TESS_ERROR1(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR1);
+}
+
+Handle<Value> GetGLU_TESS_ERROR2(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR2);
+}
+
+Handle<Value> GetGLU_TESS_ERROR3(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR3);
+}
+
+Handle<Value> GetGLU_TESS_ERROR4(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR4);
+}
+
+Handle<Value> GetGLU_TESS_ERROR5(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR5);
+}
+
+Handle<Value> GetGLU_TESS_ERROR6(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR6);
+}
+
+Handle<Value> GetGLU_TESS_ERROR7(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR7);
+}
+
+Handle<Value> GetGLU_TESS_ERROR8(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_ERROR8);
+}
+
+Handle<Value> GetGLU_TESS_MISSING_BEGIN_POLYGON(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_MISSING_BEGIN_POLYGON);
+}
+
+Handle<Value> GetGLU_TESS_MISSING_BEGIN_CONTOUR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_MISSING_BEGIN_CONTOUR);
+}
+
+Handle<Value> GetGLU_TESS_MISSING_END_POLYGON(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_MISSING_END_POLYGON);
+}
+
+Handle<Value> GetGLU_TESS_MISSING_END_CONTOUR(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_MISSING_END_CONTOUR);
+}
+
+Handle<Value> GetGLU_TESS_COORD_TOO_LARGE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_COORD_TOO_LARGE);
+}
+
+Handle<Value> GetGLU_TESS_NEED_COMBINE_CALLBACK(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_NEED_COMBINE_CALLBACK);
+}
+
+Handle<Value> GetGLU_TESS_WINDING_ODD(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_WINDING_ODD);
+}
+
+Handle<Value> GetGLU_TESS_WINDING_NONZERO(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_WINDING_NONZERO);
+}
+
+Handle<Value> GetGLU_TESS_WINDING_POSITIVE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_WINDING_POSITIVE);
+}
+
+Handle<Value> GetGLU_TESS_WINDING_NEGATIVE(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_WINDING_NEGATIVE);
+}
+
+Handle<Value> GetGLU_TESS_WINDING_ABS_GEQ_TWO(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_WINDING_ABS_GEQ_TWO);
+}
+
+Handle<Value> GetGLU_TESS_MAX_COORD(Local<String> property,
+ const AccessorInfo &info) {
+ return Uint32::New(GLU_TESS_MAX_COORD);
+ //return GLU_TESS_MAX_COORD;
+}
+
+Handle<Value> GLUCheckExtensionCallback(const Arguments& args) {
+ //if less that nbr of formal parameters then do nothing
+ if (args.Length() < 2)
+ return v8::Undefined();
+
+ //get arguments
+ Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
+ GLubyte* arg0 = new GLubyte [arrHandle0->Length()];
+
+ for (unsigned j = 0; j < arrHandle0->Length(); j++) {
+ Handle<Value> arg(arrHandle0->Get(Integer::New(j)));
+ GLubyte aux = ( GLubyte )arg->Uint32Value();
+ arg0[j] = aux;
+ }
+
+ Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
+ GLubyte* arg1 = new GLubyte [arrHandle1->Length()];
+
+ for (unsigned j = 0; j < arrHandle1->Length(); j++) {
+ Handle<Value> arg(arrHandle1->Get(Integer::New(j)));
+ GLubyte aux = ( GLubyte )arg->Uint32Value();
+ arg1[j] = aux;
+ }