Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add initial jsv8 module implementation

This does not work yet. Working on some things which are not included in this version (e.g., move js-inheritance code from js to c++)
  • Loading branch information...
commit c02f6fa882479ce757306fa93a40c6e547eccc0e 1 parent 5751659
@oliver---- oliver---- authored
Showing with 944 additions and 173 deletions.
  1. +4 −0 .gitignore
  2. +3 −1 CMakeLists.txt
  3. +9 −0 src/Examples/jsv8/CMakeLists.txt
  4. +32 −0 src/Examples/jsv8/class/CMakeLists.txt
  5. +28 −0 src/Examples/jsv8/class/example.cxx
  6. +39 −0 src/Examples/jsv8/class/example.h
  7. +10 −0 src/Examples/jsv8/class/example.i
  8. +35 −0 src/Examples/jsv8/class/main.cxx
  9. +17 −8 src/swig/CMakeLists.txt
  10. +59 −0 src/swig/Lib/js/v8/jsv8.swg
  11. +55 −0 src/swig/Lib/js/v8/jsv8api.swg
  12. +31 −0 src/swig/Lib/js/v8/jsv8errors.swg
  13. +14 −0 src/swig/Lib/js/v8/jsv8head.swg
  14. +10 −0 src/swig/Lib/js/v8/jsv8init.swg
  15. +19 −0 src/swig/Lib/js/v8/jsv8kw.swg
  16. +9 −0 src/swig/Lib/js/v8/jsv8macros.swg
  17. 0  src/swig/Lib/js/v8/jsv8opers.swg
  18. +97 −0 src/swig/Lib/js/v8/jsv8primtypes.swg
  19. +72 −0 src/swig/Lib/js/v8/jsv8run.swg
  20. +10 −0 src/swig/Lib/js/v8/jsv8runtime.swg
  21. +43 −0 src/swig/Lib/js/v8/jsv8typemaps.swg
  22. 0  src/swig/Lib/js/v8/jsv8userdir.swg
  23. +25 −130 src/swig/{v8 → }/jsv8.cxx
  24. +4 −2 src/swig/swigmain.cxx
  25. +4 −0 third_party/swig/CMakeLists.txt
  26. +292 −0 third_party/swig/swigwarn.swg
  27. +23 −32 third_party/v8/CMakeLists.txt
View
4 .gitignore
@@ -0,0 +1,4 @@
+build
+third_party/swig/swig
+third_party/v8/v8
+
View
4 CMakeLists.txt
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8)
project(swig-js)
+set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "")
+
# Options:
# set(TARGET_ARCHITECTURE "ia32" CACHE STRING "arm, ia32, x64, mips")
@@ -53,4 +55,4 @@ add_subdirectory(third_party)
add_subdirectory(src/swig)
-# add_subdirectory(src/draft)
+add_subdirectory(src/Examples/jsv8)
View
9 src/Examples/jsv8/CMakeLists.txt
@@ -0,0 +1,9 @@
+include_directories(${V8_DIR}/include)
+
+if(WIN32)
+ list(APPEND V8_LINK_LIBS "WINMM.LIB" ${V8_LIBS})
+else()
+ list(APPEND V8_LINK_LIBS ${V8_LIBS})
+endif()
+
+add_subdirectory(class)
View
32 src/Examples/jsv8/class/CMakeLists.txt
@@ -0,0 +1,32 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/example_wrap.cxx
+ COMMAND ${SWIG_JS_EXECUTABLE} -jsv8 -c++ -debug-top 4 -o ${CMAKE_CURRENT_BINARY_DIR}/example_wrap.cxx -outdir ${CMAKE_CURRENT_BINARY_DIR} example.i > ${CMAKE_CURRENT_BINARY_DIR}/output.txt
+ COMMENT "${SWIG_JS_EXECUTABLE} -jsv8 -c++ -debug-top 4 -o ${CMAKE_CURRENT_BINARY_DIR}/example_wrap.cxx -outdir ${CMAKE_CURRENT_BINARY_DIR} example.i > ${CMAKE_CURRENT_BINARY_DIR}/output.txt"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+add_executable(jsv8_class
+ example.cxx
+ example.h
+ main.cxx
+ ${CMAKE_CURRENT_BINARY_DIR}/example_wrap.cxx
+)
+
+add_dependencies(jsv8_class v8 swig)
+target_link_libraries(jsv8_class ${V8_LINK_LIBS})
+set_target_properties(jsv8_class PROPERTIES FOLDER "examples/v8")
+
+if (NOT EXISTS ${PROJECT_BINARY_DIR}/bin)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/bin"
+ )
+endif()
+
+get_target_property(class_exe jsv8_class LOCATION)
+add_custom_command(
+ TARGET jsv8_class
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${class_exe} ${PROJECT_BINARY_DIR}/bin
+)
View
28 src/Examples/jsv8/class/example.cxx
@@ -0,0 +1,28 @@
+/* File : example.c */
+
+#include "example.h"
+#define M_PI 3.14159265358979323846
+
+/* Move the shape to a new location */
+void Shape::move(double dx, double dy) {
+ x += dx;
+ y += dy;
+}
+
+int Shape::nshapes = 0;
+
+double Circle::area(void) {
+ return M_PI*radius*radius;
+}
+
+double Circle::perimeter(void) {
+ return 2*M_PI*radius;
+}
+
+double Square::area(void) {
+ return width*width;
+}
+
+double Square::perimeter(void) {
+ return 4*width;
+}
View
39 src/Examples/jsv8/class/example.h
@@ -0,0 +1,39 @@
+/* File : example.h */
+
+class Shape {
+public:
+ Shape() {
+ nshapes++;
+ }
+ virtual ~Shape() {
+ nshapes--;
+ };
+ double x, y;
+ void move(double dx, double dy);
+ virtual double area(void) = 0;
+ virtual double perimeter(void) = 0;
+ static int nshapes;
+};
+
+class Circle : public Shape {
+private:
+ double radius;
+public:
+ Circle(double r) : radius(r) { };
+ virtual double area(void);
+ virtual double perimeter(void);
+};
+
+class Square : public Shape {
+private:
+ double width;
+public:
+ Square(double w) : width(w) { };
+ virtual double area(void);
+ virtual double perimeter(void);
+};
+
+
+
+
+
View
10 src/Examples/jsv8/class/example.i
@@ -0,0 +1,10 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
View
35 src/Examples/jsv8/class/main.cxx
@@ -0,0 +1,35 @@
+#include <v8.h>
+
+#include <iostream>
+#include <string>
+
+extern void Init_example(void);
+
+using namespace v8;
+
+void test1() {
+ HandleScope handle_scope;
+
+ Persistent<v8::Context> context = v8::Context::New();
+ v8::Context::Scope context_scope(context);
+
+ Init_example();
+
+ // Handle<String> source = String::New("var bla = new Bla(); bla.bla(); bla.blupp(2);");
+// Handle<String> source = String::New("var circle = new Circle(2.0); log('Hallo Welt!'); log(circle.area());");
+ Handle<String> source = String::New("var circle = new Circle(2.0); circle.x = 1.2;");
+ // Compile the source code.
+ Handle<Script> script = Script::Compile(source);
+
+ // Run the script to get the result.
+ Handle<Value> result = script->Run();
+
+ context.Dispose();
+}
+
+
+int main(int argc, char* argv[]) {
+
+ test1();
+ return 0;
+}
View
25 src/swig/CMakeLists.txt
@@ -7,14 +7,23 @@ get_directory_property(SWIG_INCLUDES DIRECTORY ${SWIG_SOURCE_DIR} INCLUDE_DIRECT
include_directories(${SWIG_INCLUDES})
-add_library(swig_v8 v8/jsv8.cxx)
+add_executable(swig swigmain.cxx jsv8.cxx)
-#
-# swig.exe
-#
+target_link_libraries(swig
+ swig_cparse swig_preprocessor swig_doh swiglib swig_modules)
+
+get_target_property(SWIG_EXE swig LOCATION)
+get_filename_component(SWIG_EXE_NAME ${SWIG_EXE} NAME)
+
+add_custom_command(TARGET swig
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_EXE} ${PROJECT_BINARY_DIR}
+)
-add_executable(swig_exe swigmain.cxx)
+add_custom_command(TARGET swig
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${SWIG_SOURCE_DIR}/swig/Lib ${PROJECT_BINARY_DIR}/Lib
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Lib ${PROJECT_BINARY_DIR}/Lib
+)
-target_link_libraries(swig_exe
- swig_cparse swig_preprocessor swig_doh swiglib swig_modules
- swig_v8)
+set(SWIG_JS_EXECUTABLE ${PROJECT_BINARY_DIR}/${SWIG_EXE_NAME} CACHE INTERNAL "" FORCE)
View
59 src/swig/Lib/js/v8/jsv8.swg
@@ -0,0 +1,59 @@
+/* ------------------------------------------------------------
+ * jsv8.swg
+ *
+ * JavaScript V8 configuration module.
+ * ------------------------------------------------------------ */
+
+/* ------------------------------------------------------------
+ * Inner macros
+ * ------------------------------------------------------------ */
+%include <jsv8macros.swg>
+
+/* ------------------------------------------------------------
+ * The runtime part
+ * ------------------------------------------------------------ */
+%include <jsv8runtime.swg>
+
+/* ------------------------------------------------------------
+ * Special user directives
+ * ------------------------------------------------------------ */
+%include <jsv8userdir.swg>
+
+/* ------------------------------------------------------------
+ * Typemap specializations
+ * ------------------------------------------------------------ */
+%include <jsv8typemaps.swg>
+
+/* ------------------------------------------------------------
+ * Overloaded operator support
+ * ------------------------------------------------------------ */
+%include <jsv8opers.swg>
+
+/* ------------------------------------------------------------
+ * Warnings for jsv8 keywords
+ * ------------------------------------------------------------ */
+%include <jsv8kw.swg>
+
+/* ------------------------------------------------------------
+ * Documentation for common jsv8 methods
+ * ------------------------------------------------------------ */
+//%include <jsv8autodoc.swg>
+
+/* ------------------------------------------------------------
+ * The jsv8 initialization function
+ * ------------------------------------------------------------ */
+%include <jsv8init.swg>
+
+/* Pointers, references */
+%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] {
+ %set_output(v8_set_new_instance(args, %as_voidptr($1)));
+}
+
+%typemap(out, noblock=1) SWIGTYPE *const& {
+ %set_output(v8_set_new_instance(args, %as_voidptr(*$1)));
+}
+
+/* Return by value */
+%typemap(out, noblock=1) SWIGTYPE {
+ %set_output(v8_set_new_instance(args, %new_copy($1, $ltype)));
+}
View
55 src/swig/Lib/js/v8/jsv8api.swg
@@ -0,0 +1,55 @@
+ /* -----------------------------------------------------------------------------
+ * jsv8api.swg
+ *
+ * Defines some API methods for internal use in V8 extension.
+ *
+ * ----------------------------------------------------------------------------- */
+#define JSV8_CLASS v8::Persistent<v8::FunctionTemplate>
+
+v8::Persistent<v8::FunctionTemplate> v8_create_class_template(const char* symbol)
+{
+ v8::Local<v8::FunctionTemplate> class_templ = v8::FunctionTemplate::New();
+ class_templ->SetClassName(v8::String::NewSymbol(symbol));
+
+ v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
+ inst_templ->SetInternalFieldCount(1);
+
+ return v8::Persistent<v8::FunctionTemplate>::New(class_templ);
+}
+
+void v8_set_allocate_handler(v8::Persistent<v8::FunctionTemplate> class_templ, v8::InvocationCallback allocHandler)
+{
+ class_templ->SetCallHandler(allocHandler);
+}
+
+v8::Handle<v8::Value> v8_set_new_instance(const v8::Arguments& args, void* data) {
+ v8::HandleScope scope;
+
+ v8::Handle<v8::Object> self = args.Holder();
+ self->SetInternalField(0, v8::External::New(data));
+
+ return self;
+}
+
+void v8_add_class_method(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol, v8::InvocationCallback _func)
+{
+ v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
+ proto_templ->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func));
+}
+
+void v8_add_class_member_getters_setters(v8::Handle<v8::FunctionTemplate> class_templ, const char* varname, v8::AccessorGetter getter, v8::AccessorSetter setter) {
+ v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
+ proto_templ->SetAccessor(v8::String::New(varname), getter, setter);
+}
+
+template <class T>
+T* v8_unwrap_this_pointer (v8::Handle<v8::Object> handle) {
+ assert(!handle.IsEmpty());
+ assert(handle->InternalFieldCount() > 0);
+ v8::Local<v8::External> wrap = v8::Local<v8::External>::Cast(handle->GetInternalField(0));
+ return static_cast<T*>(wrap->Value());
+}
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8api.swg
+ * ----------------------------------------------------------------------------- */
View
31 src/swig/Lib/js/v8/jsv8errors.swg
@@ -0,0 +1,31 @@
+/* -----------------------------------------------------------------------------
+ * jsv8errors.swg
+ * ----------------------------------------------------------------------------- */
+
+// TODO: map Swig errors to v8 errors
+SWIGINTERN VALUE
+SWIG_Js_ErrorType(int SWIG_code) {
+ VALUE type;
+ switch (SWIG_code) {
+ case SWIG_MemoryError:
+ case SWIG_IOError:
+ case SWIG_RuntimeError:
+ case SWIG_IndexError:
+ case SWIG_TypeError:
+ case SWIG_DivisionByZero:
+ case SWIG_OverflowError:
+ case SWIG_SyntaxError:
+ case SWIG_ValueError:
+ case SWIG_SystemError:
+ case SWIG_AttributeError:
+ case SWIG_NullReferenceError:
+ case SWIG_UnknownError:
+ default:
+ type = v8::Undefined();
+ }
+ return type;
+}
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8errors.swg
+ * ----------------------------------------------------------------------------- */
View
14 src/swig/Lib/js/v8/jsv8head.swg
@@ -0,0 +1,14 @@
+/* -----------------------------------------------------------------------------
+ * jsv8head.swg
+ * ----------------------------------------------------------------------------- */
+
+#include <v8.h>
+#include <assert.h>
+
+#define VALUE v8::Handle<v8::Value>
+#define JSV8_UNDEFINED v8::Undefined()
+#define JSV8_VOID JSV8_UNDEFINED
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8head.swg
+ * ----------------------------------------------------------------------------- */
View
10 src/swig/Lib/js/v8/jsv8init.swg
@@ -0,0 +1,10 @@
+/* -----------------------------------------------------------------------------
+ * jsv8init.swg
+ * ----------------------------------------------------------------------------- */
+
+// swiginit.swg shall be inserted before Init_<module> function
+%insert(initbeforefunc) "swiginit.swg"
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8init.swg
+ * ----------------------------------------------------------------------------- */
View
19 src/swig/Lib/js/v8/jsv8kw.swg
@@ -0,0 +1,19 @@
+/* -----------------------------------------------------------
+ * jsv8kw.swg
+ * ------------------------------------------------------------ */
+
+#ifndef JSV8_JSKW_SWG_
+#define JSV8_JSKW_SWG_
+
+/* Warnings for javascript keywords */
+#define JSKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to 'C_" `x` "'",rename="C_%s",fullname=1) `x`
+
+//TODO: add all javascript keywords
+JSKW(function);
+JSKW(if);
+JSKW(else);
+JSKW(end);
+
+#undef JSKW
+
+#endif //JSV8_JSKW_SWG_
View
9 src/swig/Lib/js/v8/jsv8macros.swg
@@ -0,0 +1,9 @@
+/* -----------------------------------------------------------------------------
+ * jsv8macros.swg
+ * ----------------------------------------------------------------------------- */
+
+%include <typemaps/swigmacros.swg>
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8macros.swg
+ * ----------------------------------------------------------------------------- */
View
0  src/swig/Lib/js/v8/jsv8opers.swg
No changes.
View
97 src/swig/Lib/js/v8/jsv8primtypes.swg
@@ -0,0 +1,97 @@
+/* -----------------------------------------------------------------------------
+ * jsv8primtypes.swg
+ * ----------------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------
+ * Primitive Types
+ * ------------------------------------------------------------ */
+
+/* boolean */
+
+%fragment(SWIG_From_frag(bool),"header") {
+SWIGINTERNINLINE VALUE
+ SWIG_From_dec(bool)(bool value)
+{
+ return v8::Boolean::New(value);
+}
+}
+
+%fragment(SWIG_AsVal_frag(bool),"header",
+ fragment=SWIG_AsVal_frag(long)) {
+SWIGINTERN int
+SWIG_AsVal_dec(bool)(VALUE obj, bool *val)
+{
+ v8::Local<v8::Boolean> b = obj->ToBoolean();
+ int r = b.IsTrue(obj);
+ if (val) *val = r ? true : false;
+ return SWIG_OK;
+}
+}
+
+/* long */
+
+%fragment(SWIG_From_frag(long),"header") {
+ %define_as(SWIG_From_dec(long), v8::v8::Uint32::New)
+}
+
+%fragment(SWIG_AsVal_frag(long),"header",
+ fragment="SWIG_CanCastAsInteger") {
+SWIGINTERN int
+SWIG_AsVal_dec(long)(VALUE obj, long* val)
+{
+ v8::Local<v8::Uint32> num = v8::Local<v8::Uint32>::New(obj);
+ *val = num->Value();
+ return SWIG_OK;
+}
+}
+
+/* unsigned long */
+
+%fragment(SWIG_From_frag(unsigned long),"header",
+ fragment=SWIG_From_frag(long)) {
+SWIGINTERNINLINE PyObject*
+SWIG_From_dec(unsigned long)(unsigned long value)
+{
+ return (value > LONG_MAX) ?
+ v8::Uint32::New(value) : v8::Uint32::New(%numeric_cast(value,long));
+}
+}
+
+/* double */
+
+%fragment(SWIG_From_frag(double),"header") {
+ %define_as(SWIG_From_dec(double), v8::Number::New)
+}
+
+%fragment(SWIG_AsVal_frag(double),"header") {
+SWIGINTERN int
+SWIG_AsVal_dec(double)(VALUE obj, double *val)
+{
+ v8::Local<v8::Number> num = obj->ToNumber();
+ *val = num->Value();
+ return SWIG_OK;
+}
+}
+
+
+/**
+%fragment(SWIG_From_frag(int), "header") {
+SWIGINTERNINLINE v8::Handle<Value>
+SWIG_From_int(int value)
+{
+ return v8::Integer::New(value);
+}
+}
+
+%fragment(SWIG_From_frag(long), "header") {
+SWIGINTERNINLINE v8::Handle<Value>
+SWIG_From_long(long value)
+{
+ return v8::Long::New(value);
+}
+}
+*/
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8primtypes.swg
+ * ----------------------------------------------------------------------------- */
View
72 src/swig/Lib/js/v8/jsv8run.swg
@@ -0,0 +1,72 @@
+/* -----------------------------------------------------------------------------
+ * jsv8run.swg
+ *
+ * This file contains the runtime support for V8 modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION 0
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_JS_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
+#define SWIG_ConvertPtrAndOwn(obj, pptr, type, flags, own) SWIG_JS_ConvertPtrAndOwn(obj, pptr, type, flags, own)
+#define SWIG_NewPointerObj(ptr, type, flags) SWIG_JS_NewPointerObj(ptr, type, flags)
+#define SWIG_AcquirePtr(ptr, own) SWIG_JS_AcquirePtr(ptr, own)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)
+
+
+/* -----------------------------------------------------------------------------
+ * end jsv8run.swg
+ * ----------------------------------------------------------------------------- */
+
+ /* Runtime API */
+
+#define SWIG_GetModule(clientdata) SWIG_JS_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer) SWIG_JS_SetModule(clientdata, pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code) SWIG_JS_ErrorType(code)
+#define SWIG_Error(code, msg) SWIG_JS_Error(code,msg)
+#define SWIG_fail goto fail
+
+void SWIG_JS_Error(int code, const char* msg) {
+ v8::ThrowException(v8::String::New(msg));
+}
+
+swig_module_info* SWIG_JS_GetModule(void* clientdata) {
+ return 0;
+}
+
+void
+SWIG_JS_SetModule(void* clientdata, swig_module_info* module_info) {
+ return;
+}
+
+v8::Handle<v8::Value>
+SWIG_NewPointerObj(void* data, swig_type_info* typeInfo, int flags) {
+ v8::Persistent<v8::FunctionTemplate> class_templ = *(reinterpret_cast<v8::Persistent<v8::FunctionTemplate>*>(typeInfo->clientdata));
+ v8::Local<v8::Function> ctor = class_templ->GetFunction();
+ v8::Local<v8::Object> obj = ctor->New();
+ obj->SetInternalField(0, v8::External::New(data));
+
+ return obj;
+}
View
10 src/swig/Lib/js/v8/jsv8runtime.swg
@@ -0,0 +1,10 @@
+/*
+ * jsv8runtime.swg
+ */
+%runtime "swiglabels.swg" /* Common C API type-checking code */
+%runtime "swigrun.swg" /* Common C API type-checking code */
+%runtime "swigerrors.swg" /* SWIG errors */
+%runtime "jsv8head.swg" /* js includes and fixes */
+%runtime "jsv8errors.swg" /* js errors */
+%runtime "jsv8api.swg"
+%runtime "jsv8run.swg"
View
43 src/swig/Lib/js/v8/jsv8typemaps.swg
@@ -0,0 +1,43 @@
+/* -----------------------------------------------------------------------------
+ * jsv8typemaps.swg
+ * ----------------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------
+ * Typemap specializations for jsv8
+ * ------------------------------------------------------------ */
+
+ /* ------------------------------------------------------------
+ * Fragment section
+ * ------------------------------------------------------------ */
+
+/* Include fundamental fragemt definitions */
+%include <typemaps/fragments.swg>
+
+/* Look for user fragments file. */
+//%include <jsv8fragments.swg>
+
+/* jsv8 fragments for primitive types */
+%include <jsv8primtypes.swg>
+
+/* jsv8 fragments for char* strings */
+//%include <jsv8strings.swg>
+
+/* ------------------------------------------------------------
+ * Unified typemap section
+ * ------------------------------------------------------------ */
+
+/**
+ * Note: the following definitions are mandatory; used by swigtypemaps.swig.
+ */
+#define SWIG_Object v8::Handle<Value>
+#define VOID_Object v8::Undefined()
+#define SWIG_AppendOutput(result,obj) SWIG_Js_AppendOutput(result, obj)
+#define SWIG_SetConstant(name, obj) SWIG_Js_SetConstant(name, obj)
+#define SWIG_Raise(obj, type, desc) SWIG_Js_Raise(obj, type, desc)
+
+/* Include the unified typemap library */
+%include <typemaps/swigtypemaps.swg>
+
+/* -----------------------------------------------------------------------------
+ * end of jsv8typemaps.swg
+ * ----------------------------------------------------------------------------- */
View
0  src/swig/Lib/js/v8/jsv8userdir.swg
No changes.
View
155 src/swig/v8/jsv8.cxx → src/swig/jsv8.cxx
@@ -19,13 +19,12 @@ static int treduce = SWIG_cparse_template_reduce(0);
#include <ctype.h>
#include <string.h>
-#include <limits.h> /* for INT_MAX */
-
+#include <limits.h>
#include <iostream>
#include <conio.h>
static const char *usage = "\
- JavaScript Options (available with -jsv8)\n\
+ JavaScript Options (available with -js)\n\
";
int JSV8_DOH_EndsWith(String* s, String* suffix) {
@@ -47,11 +46,13 @@ int JSV8_DOH_EndsWith(String* s, String* suffix) {
#define EndsWith JSV8_DOH_EndsWith
+/**
+ * Creates a string that is used to define a class template instance.
+ */
void JSV8_GetClassTemplStr(Node* classNode, String* out) {
String* clazzName = Getattr(classNode, "name");
Printv(out, clazzName, "_class_templ", NIL);
}
-#define GetClassTemplStr JSV8_GetClassTemplStr
class JavaScriptV8: public Language {
private:
@@ -115,11 +116,11 @@ class JavaScriptV8: public Language {
* validate_identifier()
*
* Is this a valid identifier in the scripting language?
+ *
* js method names can include any combination of letters, numbers
* and underscores.
*
* --------------------------------------------------------------------- */
-
virtual int validate_identifier(String *s) {
char *c = Char(s);
while (*c) {
@@ -129,41 +130,16 @@ class JavaScriptV8: public Language {
}
return 1;
}
-
- /* ---------------------------------------------------------------------
- * validate_const_name(char *name)
- *
- * Validate constant name.
- * --------------------------------------------------------------------- */
-
- char *validate_const_name(char *name, const char *reason) {
- if (!name || name[0] == '\0')
- return name;
-
- if (isupper(name[0]))
- return name;
-
- if (islower(name[0])) {
- name[0] = (char)toupper(name[0]);
- Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number, "Wrong %s name (corrected to `%s')\n", reason, name);
- return name;
- }
-
- Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number, "Wrong %s name %s\n", reason, name);
-
- return name;
- }
-
/* ---------------------------------------------------------------------
* top()
+ *
* TODO(019): set a better name wrapper attribute, s. Java
* --------------------------------------------------------------------- */
-
virtual int top(Node *n) {
/**
- * See if any Ruby module options have been specified as options
+ * See if any module options have been specified as options
* to the %module directive.
*/
Node *swigModule = Getattr(n, "module");
@@ -563,7 +539,7 @@ class JavaScriptV8: public Language {
char* abstract_ = Char(abstract);
String* clazz_templ = NewString("");
- GetClassTemplStr(n, clazz_templ);
+ JSV8_GetClassTemplStr(n, clazz_templ);
char* define_class_templ = "v8::Persistent<v8::FunctionTemplate> %s;\n";
char* create_class_templ = "\n%s = v8_create_class_template(\"%s\");\n";
@@ -616,7 +592,7 @@ class JavaScriptV8: public Language {
String* memFuncInit = NewString("");
String* clazz_templ = NewString("");
- GetClassTemplStr(clazz, clazz_templ);
+ JSV8_GetClassTemplStr(clazz, clazz_templ);
String* wrapper_name = NewString("");
char* method_wrapper = "_wrap_%s_%s";
@@ -654,7 +630,7 @@ class JavaScriptV8: public Language {
String* ctorInit = NewString("");
String* class_templ = NewString("");
- GetClassTemplStr(clazz, class_templ);
+ JSV8_GetClassTemplStr(clazz, class_templ);
char* alloc_func_str = "_wrap_new_%s";
String* alloc_func = NewString("");
@@ -672,19 +648,6 @@ class JavaScriptV8: public Language {
return SWIG_OK;
}
- virtual int copyconstructorHandler(Node *n) {
- return Language::copyconstructorHandler(n);
- }
-
- /* ---------------------------------------------------------------------
- * destructorHandler()
- * -------------------------------------------------------------------- */
-
- virtual int destructorHandler(Node *n) {
- current = DESTRUCTOR;
- return Language::destructorHandler(n);
- }
-
/* ---------------------------------------------------------------------
* membervariableHandler()
*
@@ -715,7 +678,7 @@ class JavaScriptV8: public Language {
// TODO(011): handle read_only by adding a throwing setter function
char* v8_add_gettersetter = "v8_add_class_member_getters_setters(%s, \"%s\", %s, %s);\n";
- GetClassTemplStr(clazz, v8_class_template);
+ JSV8_GetClassTemplStr(clazz, v8_class_template);
Printf(varFuncInit, v8_add_gettersetter, v8_class_template, varName, wName_get, wName_set);
Delete(v8_class_template);
@@ -730,92 +693,24 @@ class JavaScriptV8: public Language {
return Language::membervariableHandler(n);
}
- /* -----------------------------------------------------------------------
- * staticmemberfunctionHandler()
- *
- * Wrap a static C++ function
- * ---------------------------------------------------------------------- */
-
- virtual int staticmemberfunctionHandler(Node *n) {
- return Language::staticmemberfunctionHandler(n);
- }
-
- /* ----------------------------------------------------------------------
- * memberconstantHandler()
- *
- * Create a C++ constant
- * --------------------------------------------------------------------- */
-
- virtual int memberconstantHandler(Node *n) {
- return Language::memberconstantHandler(n);
- }
-
- /* ---------------------------------------------------------------------
- * staticmembervariableHandler()
- * --------------------------------------------------------------------- */
-
- virtual int staticmembervariableHandler(Node *n) {
- return Language::staticmembervariableHandler(n);
- }
-
-
- /* ------------------------------------------------------------
- * director support
- * ------------------------------------------------------------ */
- virtual int classDirector(Node *n) {
- return Language::classDirector(n);
- }
-
- virtual int classDirectorInit(Node *n) {
- return Language::classDirectorInit(n);
- }
-
- virtual int classDirectorEnd(Node *n) {
- return Language::classDirectorEnd(n);
- }
-
- virtual int classDirectorConstructor(Node *n) {
- return Language::classDirectorConstructor(n);
- }
-
- virtual int classDirectorDefaultConstructor(Node *n) {
- return Language::classDirectorDefaultConstructor(n);
- }
-
- virtual int classDirectorMethod(Node *n, Node *parent, String *super) {
- return Language::classDirectorMethod(n, parent, super);
- }
-
- virtual int classDirectorConstructors(Node *n) {
- return Language::classDirectorConstructors(n);
- }
-
- virtual int classDirectorMethods(Node *n) {
- return Language::classDirectorMethods(n);
- }
-
- virtual int classDirectorDisown(Node *n) {
- return Language::classDirectorDisown(n);
- }
-
String *runtimeCode() {
String *s = NewString("");
String *shead = Swig_include_sys("jsv8head.swg");
+
if (!shead) {
Printf(stderr, "*** Unable to open 'jsv8head.swg'\n");
} else {
Append(s, shead);
Delete(shead);
}
- // TODO(016) implement jsv8errors.swg
- //String *serrors = Swig_include_sys("jsv8errors.swg");
- //if (!serrors) {
- // Printf(stderr, "*** Unable to open 'jsv8errors.swg'\n");
- //} else {
- // Append(s, serrors);
- // Delete(serrors);
- //}
+ String *serrors = Swig_include_sys("jsv8errors.swg");
+ if (!serrors) {
+ Printf(stderr, "*** Unable to open 'jsv8errors.swg'\n");
+ } else {
+ Append(s, serrors);
+ Delete(serrors);
+ }
String *sapi = Swig_include_sys("jsv8api.swg");
if (!sapi) {
Printf(stderr, "*** Unable to open 'jsv8api.swg'\n");
@@ -846,7 +741,7 @@ class JavaScriptV8: public Language {
virtual void main(int argc, char *argv[]) {
/* Set location of SWIG library */
- SWIG_library_directory("jsv8");
+ SWIG_library_directory("js/v8");
/* Turn on cppcast mode */
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
@@ -860,15 +755,15 @@ class JavaScriptV8: public Language {
allow_overloading();
}
-}; /* class JSV8 */
+};
/* -----------------------------------------------------------------------------
* swig_jsv8() - Instantiate module
* ----------------------------------------------------------------------------- */
-static Language *new_swig_jsv8() {
+static Language *new_swig_js_v8() {
return new JavaScriptV8();
}
-extern "C" Language *swig_jsv8(void) {
- return new_swig_jsv8();
+extern "C" Language *swig_js_v8(void) {
+ return new_swig_js_v8();
}
View
6 src/swig/swigmain.cxx
@@ -51,7 +51,8 @@ extern "C" {
Language *swig_cffi(void);
Language *swig_uffi(void);
Language *swig_r(void);
- Language *swig_jsv8(void);
+ Language *swig_js_v8(void);
+// Language *swig_js_fb(void);
}
struct swig_module {
@@ -91,7 +92,8 @@ static swig_module modules[] = {
{"-tcl8", swig_tcl, 0},
{"-uffi", swig_uffi, "Common Lisp / UFFI"},
{"-xml", swig_xml, "XML"},
- {"-jsv8", swig_jsv8, "JavaScript (V8)"},
+ {"-jsv8", swig_js_v8, "JavaScript (V8)"},
+// {"-jsfb", swig_js_fb, "JavaScript (FireBreath)"},
{NULL, NULL, NULL}
};
View
4 third_party/swig/CMakeLists.txt
@@ -32,6 +32,10 @@ if(WIN32)
)
endif()
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/swigwarn.swg ${CMAKE_CURRENT_SOURCE_DIR}/swig/Lib/swigwarn.swg
+)
+
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/swig/Source/CParse"
"${CMAKE_CURRENT_SOURCE_DIR}/swig/Source/Include"
View
292 third_party/swig/swigwarn.swg
@@ -0,0 +1,292 @@
+/* Automatically generated file containing all the swig warning codes. */
+/* Do not modify this file by hand, change 'Source/Include/swigwarn.h' */
+/* and use the command 'make Lib/swigwarn.swg' instead. */
+
+
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * swigwarn.h
+ *
+ * SWIG warning message numbers
+ * This file serves as the main registry of warning message numbers. Some of these
+ * numbers are used internally in the C/C++ source code of SWIG. However, some
+ * of the numbers are used in SWIG configuration files (swig.swg and others).
+ *
+ * The numbers are roughly organized into a few different classes by functionality.
+ *
+ * Even though symbolic constants are used in the SWIG source, this is
+ * not always the case in SWIG interface files. Do not change the
+ * numbers in this file.
+ * ----------------------------------------------------------------------------- */
+
+
+%define SWIGWARN_NONE 0 %enddef
+
+/* -- Deprecated features -- */
+
+%define SWIGWARN_DEPRECATED_EXTERN 101 %enddef
+%define SWIGWARN_DEPRECATED_VAL 102 %enddef
+%define SWIGWARN_DEPRECATED_OUT 103 %enddef
+%define SWIGWARN_DEPRECATED_DISABLEDOC 104 %enddef
+%define SWIGWARN_DEPRECATED_ENABLEDOC 105 %enddef
+%define SWIGWARN_DEPRECATED_DOCONLY 106 %enddef
+%define SWIGWARN_DEPRECATED_STYLE 107 %enddef
+%define SWIGWARN_DEPRECATED_LOCALSTYLE 108 %enddef
+%define SWIGWARN_DEPRECATED_TITLE 109 %enddef
+%define SWIGWARN_DEPRECATED_SECTION 110 %enddef
+%define SWIGWARN_DEPRECATED_SUBSECTION 111 %enddef
+%define SWIGWARN_DEPRECATED_SUBSUBSECTION 112 %enddef
+%define SWIGWARN_DEPRECATED_ADDMETHODS 113 %enddef
+%define SWIGWARN_DEPRECATED_READONLY 114 %enddef
+%define SWIGWARN_DEPRECATED_READWRITE 115 %enddef
+%define SWIGWARN_DEPRECATED_EXCEPT 116 %enddef
+%define SWIGWARN_DEPRECATED_NEW 117 %enddef
+%define SWIGWARN_DEPRECATED_EXCEPT_TM 118 %enddef
+%define SWIGWARN_DEPRECATED_IGNORE_TM 119 %enddef
+%define SWIGWARN_DEPRECATED_OPTC 120 %enddef
+%define SWIGWARN_DEPRECATED_NAME 121 %enddef
+%define SWIGWARN_DEPRECATED_NOEXTERN 122 %enddef
+%define SWIGWARN_DEPRECATED_NODEFAULT 123 %enddef
+%define SWIGWARN_DEPRECATED_TYPEMAP_LANG 124 %enddef
+%define SWIGWARN_DEPRECATED_INPUT_FILE 125 %enddef
+
+/* -- Preprocessor -- */
+
+%define SWIGWARN_PP_MISSING_FILE 201 %enddef
+%define SWIGWARN_PP_EVALUATION 202 %enddef
+%define SWIGWARN_PP_INCLUDEALL_IMPORTALL 203 %enddef
+%define SWIGWARN_PP_CPP_WARNING 204 %enddef
+%define SWIGWARN_PP_CPP_ERROR 205 %enddef
+%define SWIGWARN_PP_UNEXPECTED_TOKENS 206 %enddef
+
+/* -- C/C++ Parser -- */
+
+%define SWIGWARN_PARSE_CLASS_KEYWORD 301 %enddef
+%define SWIGWARN_PARSE_REDEFINED 302 %enddef
+%define SWIGWARN_PARSE_EXTEND_UNDEF 303 %enddef
+%define SWIGWARN_PARSE_UNSUPPORTED_VALUE 304 %enddef
+%define SWIGWARN_PARSE_BAD_VALUE 305 %enddef
+%define SWIGWARN_PARSE_PRIVATE 306 %enddef
+%define SWIGWARN_PARSE_BAD_DEFAULT 307 %enddef
+%define SWIGWARN_PARSE_NAMESPACE_ALIAS 308 %enddef
+%define SWIGWARN_PARSE_PRIVATE_INHERIT 309 %enddef
+%define SWIGWARN_PARSE_TEMPLATE_REPEAT 310 %enddef
+%define SWIGWARN_PARSE_TEMPLATE_PARTIAL 311 %enddef
+%define SWIGWARN_PARSE_UNNAMED_NESTED_CLASS 312 %enddef
+%define SWIGWARN_PARSE_UNDEFINED_EXTERN 313 %enddef
+%define SWIGWARN_PARSE_KEYWORD 314 %enddef
+%define SWIGWARN_PARSE_USING_UNDEF 315 %enddef
+%define SWIGWARN_PARSE_MODULE_REPEAT 316 %enddef
+%define SWIGWARN_PARSE_TEMPLATE_SP_UNDEF 317 %enddef
+%define SWIGWARN_PARSE_TEMPLATE_AMBIG 318 %enddef
+%define SWIGWARN_PARSE_NO_ACCESS 319 %enddef
+%define SWIGWARN_PARSE_EXPLICIT_TEMPLATE 320 %enddef
+%define SWIGWARN_PARSE_BUILTIN_NAME 321 %enddef
+%define SWIGWARN_PARSE_REDUNDANT 322 %enddef
+%define SWIGWARN_PARSE_REC_INHERITANCE 323 %enddef
+%define SWIGWARN_PARSE_NESTED_TEMPLATE 324 %enddef
+%define SWIGWARN_PARSE_NAMED_NESTED_CLASS 325 %enddef
+
+%define SWIGWARN_IGNORE_OPERATOR_NEW 350 %enddef /* new */
+%define SWIGWARN_IGNORE_OPERATOR_DELETE 351 %enddef /* delete */
+%define SWIGWARN_IGNORE_OPERATOR_PLUS 352 %enddef /* + */
+%define SWIGWARN_IGNORE_OPERATOR_MINUS 353 %enddef /* - */
+%define SWIGWARN_IGNORE_OPERATOR_MUL 354 %enddef /* * */
+%define SWIGWARN_IGNORE_OPERATOR_DIV 355 %enddef /* / */
+%define SWIGWARN_IGNORE_OPERATOR_MOD 356 %enddef /* % */
+%define SWIGWARN_IGNORE_OPERATOR_XOR 357 %enddef /* ^ */
+%define SWIGWARN_IGNORE_OPERATOR_AND 358 %enddef /* & */
+%define SWIGWARN_IGNORE_OPERATOR_OR 359 %enddef /* | */
+%define SWIGWARN_IGNORE_OPERATOR_NOT 360 %enddef /* ~ */
+%define SWIGWARN_IGNORE_OPERATOR_LNOT 361 %enddef /* ! */
+%define SWIGWARN_IGNORE_OPERATOR_EQ 362 %enddef /* = */
+%define SWIGWARN_IGNORE_OPERATOR_LT 363 %enddef /* < */
+%define SWIGWARN_IGNORE_OPERATOR_GT 364 %enddef /* > */
+%define SWIGWARN_IGNORE_OPERATOR_PLUSEQ 365 %enddef /* += */
+%define SWIGWARN_IGNORE_OPERATOR_MINUSEQ 366 %enddef /* -= */
+%define SWIGWARN_IGNORE_OPERATOR_MULEQ 367 %enddef /* *= */
+%define SWIGWARN_IGNORE_OPERATOR_DIVEQ 368 %enddef /* /= */
+%define SWIGWARN_IGNORE_OPERATOR_MODEQ 369 %enddef /* %= */
+%define SWIGWARN_IGNORE_OPERATOR_XOREQ 370 %enddef /* ^= */
+%define SWIGWARN_IGNORE_OPERATOR_ANDEQ 371 %enddef /* &= */
+%define SWIGWARN_IGNORE_OPERATOR_OREQ 372 %enddef /* |= */
+%define SWIGWARN_IGNORE_OPERATOR_LSHIFT 373 %enddef /* << */
+%define SWIGWARN_IGNORE_OPERATOR_RSHIFT 374 %enddef /* >> */
+%define SWIGWARN_IGNORE_OPERATOR_LSHIFTEQ 375 %enddef /* <<= */
+%define SWIGWARN_IGNORE_OPERATOR_RSHIFTEQ 376 %enddef /* >>= */
+%define SWIGWARN_IGNORE_OPERATOR_EQUALTO 377 %enddef /* == */
+%define SWIGWARN_IGNORE_OPERATOR_NOTEQUAL 378 %enddef /* != */
+%define SWIGWARN_IGNORE_OPERATOR_LTEQUAL 379 %enddef /* <= */
+%define SWIGWARN_IGNORE_OPERATOR_GTEQUAL 380 %enddef /* >= */
+%define SWIGWARN_IGNORE_OPERATOR_LAND 381 %enddef /* && */
+%define SWIGWARN_IGNORE_OPERATOR_LOR 382 %enddef /* || */
+%define SWIGWARN_IGNORE_OPERATOR_PLUSPLUS 383 %enddef /* ++ */
+%define SWIGWARN_IGNORE_OPERATOR_MINUSMINUS 384 %enddef /* -- */
+%define SWIGWARN_IGNORE_OPERATOR_COMMA 385 %enddef /* , */
+%define SWIGWARN_IGNORE_OPERATOR_ARROWSTAR 386 %enddef /* ->* */
+%define SWIGWARN_IGNORE_OPERATOR_ARROW 387 %enddef /* -> */
+%define SWIGWARN_IGNORE_OPERATOR_CALL 388 %enddef /* () */
+%define SWIGWARN_IGNORE_OPERATOR_INDEX 389 %enddef /* [] */
+%define SWIGWARN_IGNORE_OPERATOR_UPLUS 390 %enddef /* + */
+%define SWIGWARN_IGNORE_OPERATOR_UMINUS 391 %enddef /* - */
+%define SWIGWARN_IGNORE_OPERATOR_UMUL 392 %enddef /* * */
+%define SWIGWARN_IGNORE_OPERATOR_UAND 393 %enddef /* & */
+%define SWIGWARN_IGNORE_OPERATOR_NEWARR 394 %enddef /* new [] */
+%define SWIGWARN_IGNORE_OPERATOR_DELARR 395 %enddef /* delete [] */
+%define SWIGWARN_IGNORE_OPERATOR_REF 396 %enddef /* operator *() */
+
+/* 394-399 are reserved */
+
+/* -- Type system and typemaps -- */
+
+%define SWIGWARN_TYPE_UNDEFINED_CLASS 401 %enddef
+%define SWIGWARN_TYPE_INCOMPLETE 402 %enddef
+%define SWIGWARN_TYPE_ABSTRACT 403 %enddef
+%define SWIGWARN_TYPE_REDEFINED 404 %enddef
+
+%define SWIGWARN_TYPEMAP_SOURCETARGET 450 %enddef
+%define SWIGWARN_TYPEMAP_CHARLEAK 451 %enddef
+%define SWIGWARN_TYPEMAP_SWIGTYPE 452 %enddef
+%define SWIGWARN_TYPEMAP_APPLY_UNDEF 453 %enddef
+%define SWIGWARN_TYPEMAP_SWIGTYPELEAK 454 %enddef
+
+%define SWIGWARN_TYPEMAP_IN_UNDEF 460 %enddef
+%define SWIGWARN_TYPEMAP_OUT_UNDEF 461 %enddef
+%define SWIGWARN_TYPEMAP_VARIN_UNDEF 462 %enddef
+%define SWIGWARN_TYPEMAP_VAROUT_UNDEF 463 %enddef
+%define SWIGWARN_TYPEMAP_CONST_UNDEF 464 %enddef
+%define SWIGWARN_TYPEMAP_UNDEF 465 %enddef
+%define SWIGWARN_TYPEMAP_VAR_UNDEF 466 %enddef
+%define SWIGWARN_TYPEMAP_TYPECHECK 467 %enddef
+%define SWIGWARN_TYPEMAP_THROW 468 %enddef
+%define SWIGWARN_TYPEMAP_DIRECTORIN_UNDEF 469 %enddef
+%define SWIGWARN_TYPEMAP_THREAD_UNSAFE 470 %enddef /* mostly used in directorout typemaps */
+%define SWIGWARN_TYPEMAP_DIRECTOROUT_UNDEF 471 %enddef
+%define SWIGWARN_TYPEMAP_TYPECHECK_UNDEF 472 %enddef
+%define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR 473 %enddef
+%define SWIGWARN_TYPEMAP_OUT_OPTIMAL_IGNORED 474 %enddef
+%define SWIGWARN_TYPEMAP_OUT_OPTIMAL_MULTIPLE 475 %enddef
+
+/* -- Fragments -- */
+%define SWIGWARN_FRAGMENT_NOT_FOUND 490 %enddef
+
+/* -- General code generation -- */
+
+%define SWIGWARN_LANG_OVERLOAD_DECL 501 %enddef
+%define SWIGWARN_LANG_OVERLOAD_CONSTRUCT 502 %enddef
+%define SWIGWARN_LANG_IDENTIFIER 503 %enddef
+%define SWIGWARN_LANG_RETURN_TYPE 504 %enddef
+%define SWIGWARN_LANG_VARARGS 505 %enddef
+%define SWIGWARN_LANG_VARARGS_KEYWORD 506 %enddef
+%define SWIGWARN_LANG_NATIVE_UNIMPL 507 %enddef
+%define SWIGWARN_LANG_DEREF_SHADOW 508 %enddef
+%define SWIGWARN_LANG_OVERLOAD_SHADOW 509 %enddef
+%define SWIGWARN_LANG_FRIEND_IGNORE 510 %enddef
+%define SWIGWARN_LANG_OVERLOAD_KEYWORD 511 %enddef
+%define SWIGWARN_LANG_OVERLOAD_CONST 512 %enddef
+%define SWIGWARN_LANG_CLASS_UNNAMED 513 %enddef
+%define SWIGWARN_LANG_DIRECTOR_VDESTRUCT 514 %enddef
+%define SWIGWARN_LANG_DISCARD_CONST 515 %enddef
+%define SWIGWARN_LANG_OVERLOAD_IGNORED 516 %enddef
+%define SWIGWARN_LANG_DIRECTOR_ABSTRACT 517 %enddef
+%define SWIGWARN_LANG_PORTABILITY_FILENAME 518 %enddef
+%define SWIGWARN_LANG_TEMPLATE_METHOD_IGNORE 519 %enddef
+%define SWIGWARN_LANG_SMARTPTR_MISSING 520 %enddef
+
+/* -- Reserved (600-799) -- */
+
+/* -- Language module specific warnings (700 - 899) -- */
+
+/* Feel free to claim any number in this space that's not currently being used. Just make sure you
+ add an entry here */
+
+%define SWIGWARN_D_TYPEMAP_CTYPE_UNDEF 700 %enddef
+%define SWIGWARN_D_TYPEMAP_IMTYPE_UNDEF 701 %enddef
+%define SWIGWARN_D_TYPEMAP_DTYPE_UNDEF 702 %enddef
+%define SWIGWARN_D_MULTIPLE_INHERITANCE 703 %enddef
+%define SWIGWARN_D_TYPEMAP_CLASSMOD_UNDEF 704 %enddef
+%define SWIGWARN_D_TYPEMAP_DBODY_UNDEF 705 %enddef
+%define SWIGWARN_D_TYPEMAP_DOUT_UNDEF 706 %enddef
+%define SWIGWARN_D_TYPEMAP_DIN_UNDEF 707 %enddef
+%define SWIGWARN_D_TYPEMAP_DDIRECTORIN_UNDEF 708 %enddef
+%define SWIGWARN_D_TYPEMAP_DCONSTRUCTOR_UNDEF 709 %enddef
+%define SWIGWARN_D_EXCODE_MISSING 710 %enddef
+%define SWIGWARN_D_CANTHROW_MISSING 711 %enddef
+%define SWIGWARN_D_NO_DIRECTORCONNECT_ATTR 712 %enddef
+%define SWIGWARN_D_NAME_COLLISION 713 %enddef
+
+/* please leave 700-719 free for D */
+
+%define SWIGWARN_RUBY_WRONG_NAME 801 %enddef
+%define SWIGWARN_RUBY_MULTIPLE_INHERITANCE 802 %enddef
+
+/* please leave 800-809 free for Ruby */
+
+%define SWIGWARN_JAVA_TYPEMAP_JNI_UNDEF 810 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JTYPE_UNDEF 811 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JSTYPE_UNDEF 812 %enddef
+%define SWIGWARN_JAVA_MULTIPLE_INHERITANCE 813 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_GETCPTR_UNDEF 814 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_CLASSMOD_UNDEF 815 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JAVABODY_UNDEF 816 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JAVAOUT_UNDEF 817 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JAVAIN_UNDEF 818 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF 819 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JAVADIRECTOROUT_UNDEF 820 %enddef
+%define SWIGWARN_JAVA_COVARIANT_RET 822 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_JAVACONSTRUCT_UNDEF 823 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_DIRECTORIN_NODESC 824 %enddef
+%define SWIGWARN_JAVA_NO_DIRECTORCONNECT_ATTR 825 %enddef
+
+/* please leave 810-829 free for Java */
+
+%define SWIGWARN_CSHARP_TYPEMAP_CTYPE_UNDEF 830 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSTYPE_UNDEF 831 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF 832 %enddef
+%define SWIGWARN_CSHARP_MULTIPLE_INHERITANCE 833 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_GETCPTR_UNDEF 834 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF 835 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSBODY_UNDEF 836 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSOUT_UNDEF 837 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSIN_UNDEF 838 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF 839 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSDIRECTOROUT_UNDEF 840 %enddef
+%define SWIGWARN_CSHARP_COVARIANT_RET 842 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_CSCONSTRUCT_UNDEF 843 %enddef
+%define SWIGWARN_CSHARP_EXCODE 844 %enddef
+%define SWIGWARN_CSHARP_CANTHROW 845 %enddef
+%define SWIGWARN_CSHARP_NO_DIRECTORCONNECT_ATTR 846 %enddef
+
+
+%define SWIGWARN_MODULA3_TYPEMAP_TYPE_UNDEF 850 %enddef
+%define SWIGWARN_MODULA3_TYPEMAP_GETCPTR_UNDEF 851 %enddef
+%define SWIGWARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF 852 %enddef
+%define SWIGWARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF 853 %enddef
+%define SWIGWARN_MODULA3_TYPEMAP_MULTIPLE_RETURN 854 %enddef
+%define SWIGWARN_MODULA3_MULTIPLE_INHERITANCE 855 %enddef
+%define SWIGWARN_MODULA3_TYPECONSTRUCTOR_UNKNOWN 856 %enddef
+%define SWIGWARN_MODULA3_UNKNOWN_PRAGMA 857 %enddef
+%define SWIGWARN_MODULA3_BAD_ENUMERATION 858 %enddef
+%define SWIGWARN_MODULA3_DOUBLE_ID 859 %enddef
+%define SWIGWARN_MODULA3_BAD_IMPORT 860 %enddef
+
+/* please leave 850-869 free for Modula 3 */
+
+%define SWIGWARN_PHP_MULTIPLE_INHERITANCE 870 %enddef
+%define SWIGWARN_PHP_UNKNOWN_PRAGMA 871 %enddef
+%define SWIGWARN_PHP_PUBLIC_BASE 872 %enddef
+
+/* please leave 870-889 free for PHP */
+
+%define SWIGWARN_GO_NAME_CONFLICT 890 %enddef
+
+/* please leave 890-899 free for Go */
+
+/* -- User defined warnings (900 - 999) -- */
+
View
55 third_party/v8/CMakeLists.txt
@@ -22,29 +22,9 @@ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/v8/.svn")
endif()
-
-#
# Prepare options for v8 scons build
# ==================================
-# if(V8_SNAPSHOT)
-# set(v8_snapshot snapshot=on)
-# endif()
-
-# if(V8_OPROFILE)
-# set(v8_oprofile prof=on)
-# endif()
-
-# if(V8_GDBJIT)
- # if(NOT WIN32)
- # set(v8_gdbjit gdbjit=on)
- # endif()
-# endif()
-
-#if(OFF)
-#set(v8_parallel_jobs "-j ${parallel_jobs}")
-#endif()
-
if(NOT ${CMAKE_BUILD_TYPE} EQUAL "")
string(TOLOWER ${CMAKE_BUILD_TYPE} v8mode)
else()
@@ -53,13 +33,15 @@ endif()
if(${v8mode} STREQUAL "debug")
if(WIN32)
- set(_V8_LIB ${CMAKE_CURRENT_SOURCE_DIR}/v8/v8_g.lib)
+ list(APPEND _V8_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/v8/v8.lib)
+ set(V8_DLL ${CMAKE_CURRENT_SOURCE_DIR}/v8/v8_g.dll)
else()
message(FATAL_ERROR "Not yet implemented: what is the output of v8 build under posix?")
endif()
elseif(${v8mode} STREQUAL "release")
if(WIN32)
- set(_V8_LIB ${CMAKE_CURRENT_SOURCE_DIR}/v8/v8.lib)
+ list(APPEND _V8_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/v8/v8.lib)
+ set(V8_DLL ${CMAKE_CURRENT_SOURCE_DIR}/v8/v8.dll)
else()
message(FATAL_ERROR "Not yet implemented: what is the output of v8 build under posix?")
endif()
@@ -67,22 +49,31 @@ else()
message(FATAL_ERROR "Illegal build mode for v8: ${v8mode}")
endif()
+list(APPEND SCONS_ARGS mode=${v8mode} library=shared)
if(MSVC90)
- # HACK: default settings does not work for vc9
- set(SCONS_ARGS ${SCONS_ARGS} "env=\"PATH:%PATH%,INCLUDE:%INCLUDE%,LIB:%LIB%\"")
+ list(APPEND SCONS_ARGS env="PATH:%PATH%,INCLUDE:%INCLUDE%,LIB:%LIB%")
endif()
-
+
+if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/BUILD_V8)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/BUILD_V8 "Blaaa")
+endif()
+
add_custom_command(
- OUTPUT BUILD_V8.rule
- COMMAND ${Scons_EXECUTABLE} ${SCONS_ARGS} mode=${v8mode} verbose=on
- COMMAND ${CMAKE_COMMAND} -E touch BUILD_V8.rule
- COMMENT "Building v8 using scons: ${Scons_EXECUTABLE} ${SCONS_ARGS} mode=${v8mode} verbose=on"
+ OUTPUT ${V8_DLL}
+ COMMAND ${Scons_EXECUTABLE} ${SCONS_ARGS} verbose=on
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/v8/ChangeLog
+ #COMMENT "Building v8 using scons: ${Scons_EXECUTABLE} ${SCONS_ARGS} mode=${v8mode} verbose=on"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/v8
)
-add_custom_target(v8 DEPENDS BUILD_V8.rule)
+add_custom_target(v8 ALL DEPENDS ${V8_DLL})
set_target_properties(v8
- PROPERTIES FOLDER third_party
-)
+ PROPERTIES FOLDER third_party
+)
+
+add_custom_command(TARGET v8 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${V8_DLL} ${PROJECT_BINARY_DIR}/bin/)
+
+set (V8_LIBS ${_V8_LIBS} CACHE INTERNAL "" FORCE)
+set (V8_DIR ${CMAKE_CURRENT_SOURCE_DIR}/v8 CACHE INTERNAL "" FORCE)
Please sign in to comment.
Something went wrong with that request. Please try again.