Replaced Windows SpiderMonkey library with a threadsafe build of version 1.6.

Fixed linking with wxWidgets.
Enabled RTTI for non-engine packages.
Fixed wxJS for Windows.
Fixed failure to load on Windows 2000 due to IsWow64Process import.
Fixed trivial warnings.

This was SVN commit r5155.
This commit is contained in:
Ykkrosh 2007-06-09 02:40:48 +00:00
parent 53bcba3368
commit ec9b5c982e
9 changed files with 38 additions and 15 deletions

View File

@ -89,10 +89,10 @@ function package_set_build_flags()
-- various platform-specific build flags
if OS == "windows" then
tinsert(package.buildflags, "no-rtti")
-- use native wchar_t type (not typedef to unsigned short)
tinsert(package.buildflags, "native-wchar_t")
else -- *nix
if options["icc"] then
tinsert(package.buildoptions, {
@ -266,6 +266,10 @@ function setup_static_lib_package (package_name, rel_source_dirs, extern_libs, e
tinsert(static_lib_names, package_name)
if OS == "windows" then
tinsert(package.buildflags, "no-rtti")
end
-- Precompiled Headers
-- rationale: we need one PCH per static lib, since one global header would
-- increase dependencies. To that end, we can either include them as
@ -473,6 +477,8 @@ function setup_main_exe ()
tinsert(package.files, source_root.."lib/sysdep/win/manifest.rc")
end
tinsert(package.buildflags, "no-rtti")
package.linkoptions = {
-- wraps main thread in a __try block(see wseh.cpp). replace with mainCRTStartup if that's undesired.
"/ENTRY:wseh_EntryPoint",
@ -546,7 +552,7 @@ function setup_atlas_package(package_name, target_type, rel_source_dirs, rel_inc
tinsert(package.defines, "_UNICODE")
-- Link to required libraries
package.links = { "winmm", "comctl32", "rpcrt4", "delayimp" }
package.links = { "winmm", "comctl32", "rpcrt4", "delayimp", "ws2_32" }
-- required to use WinMain() on Windows, otherwise will default to main()
tinsert(package.buildflags, "no-main")
@ -588,6 +594,7 @@ function setup_atlas_packages()
},{ -- include
".."
},{ -- extern_libs
"boost",
"spidermonkey",
"wxwidgets"
},{ -- extra_params

View File

@ -249,7 +249,7 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval
{
JSString* s = StringConvert::wchars_to_jsstring(cx, value.m_Items[i].GetRawString().c_str());
jsval val = STRING_TO_JSVAL(s);
JS_SetElement(cx, obj, i, &val);
JS_SetElement(cx, obj, (jsint)i, &val);
}
break;

View File

@ -291,7 +291,7 @@ static void DetectWow64()
}
BOOL isWow64Process = FALSE;
const BOOL ok = IsWow64Process(GetCurrentProcess(), &isWow64Process);
const BOOL ok = pIsWow64Process(GetCurrentProcess(), &isWow64Process);
WARN_IF_FALSE(ok);
isWow64 = (isWow64Process == TRUE);
}

View File

@ -4,6 +4,10 @@
#include "js/jsapi.h"
#ifdef _WIN32
# pragma warning(disable: 4996) // avoid complaints about deprecated localtime
#endif
#include "wx/wx.h"
#include "wxJS/common/main.h"
@ -42,7 +46,7 @@ template<> bool ScriptInterface::FromJSVal<bool>(JSContext* cx, jsval v, bool& o
{
JSBool ret;
if (! JS_ValueToBoolean(cx, v, &ret)) return false;
out = ret;
out = (ret ? true : false);
return true;
}
@ -144,7 +148,7 @@ namespace
wxPrintf(_T("wxJS %s: %s\n--------\n"), isWarning ? _T("warning") : _T("error"), logMessage.c_str());
}
JSBool LoadScript(JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval)
JSBool LoadScript(JSContext* cx, JSObject* WXUNUSED(obj), uintN WXUNUSED(argc), jsval* argv, jsval* rval)
{
if (! ( JSVAL_IS_STRING(argv[0]) && JSVAL_IS_STRING(argv[1]) ))
return JS_FALSE;
@ -159,7 +163,7 @@ namespace
jsval scriptRval;
JSBool ok = JS_EvaluateUCScript(
cx, scriptObj, JS_GetStringChars(code), JS_GetStringLength(code),
cx, scriptObj, JS_GetStringChars(code), (uintN)JS_GetStringLength(code),
JS_GetStringBytes(name), 1, &scriptRval);
if (! ok)
return JS_FALSE;
@ -234,7 +238,7 @@ void ScriptInterface_impl::LoadScript(const wxString& filename, const wxString&
wxMBConvUTF16 conv;
wxCharBuffer codeUTF16 = conv.cWC2MB(code.c_str(), code.length()+1, &codeLength);
jsval rval;
JS_EvaluateUCScript(m_cx, m_glob, reinterpret_cast<jschar*>(codeUTF16.data()), codeLength/2, filename.ToAscii(), 1, &rval);
JS_EvaluateUCScript(m_cx, m_glob, reinterpret_cast<jschar*>(codeUTF16.data()), (uintN)(codeLength/2), filename.ToAscii(), 1, &rval);
}
void ScriptInterface_impl::Register(const char* name, JSNative fptr, uintN nargs)
@ -254,7 +258,7 @@ ScriptInterface::~ScriptInterface()
void ScriptInterface::Register(const char* name, JSNative fptr, size_t nargs)
{
m->Register(name, fptr, nargs);
m->Register(name, fptr, (uintN)nargs);
}
void ScriptInterface::LoadScript(const wxString& filename, const wxString& code)

View File

@ -35,6 +35,7 @@
using namespace wxjs;
using namespace wxjs::ext;
/*
#ifdef __WXMSW__
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
@ -67,8 +68,9 @@ WXJSAPI bool wxJS_EXTInitClass(JSContext *cx, JSObject *obj)
WXJSAPI void wxJS_EXTDestroy()
{
}
*/
WXJSAPI JSObject *wxjs::ext::CreateMemoryBuffer(JSContext *cx, void *buffer, int size)
JSObject *wxjs::ext::CreateMemoryBuffer(JSContext *cx, void *buffer, int size)
{
wxMemoryBuffer *membuf = new wxMemoryBuffer(size);
membuf->AppendData(buffer, size);
@ -77,12 +79,12 @@ WXJSAPI JSObject *wxjs::ext::CreateMemoryBuffer(JSContext *cx, void *buffer, int
return obj;
}
WXJSAPI wxMemoryBuffer* wxjs::ext::GetMemoryBuffer(JSContext *cx, JSObject *obj)
wxMemoryBuffer* wxjs::ext::GetMemoryBuffer(JSContext *cx, JSObject *obj)
{
return MemoryBuffer::GetPrivate(cx, obj);
}
WXJSAPI wxMemoryBuffer* wxjs::ext::NewMemoryBuffer(void *buffer, int size)
wxMemoryBuffer* wxjs::ext::NewMemoryBuffer(void *buffer, int size)
{
wxMemoryBuffer *membuf = new wxMemoryBuffer(size);
membuf->AppendData(buffer, size);

View File

@ -43,9 +43,9 @@ namespace wxjs
{
namespace ext
{
WXJSAPI wxMemoryBuffer* NewMemoryBuffer(void *buffer, int size);
WXJSAPI JSObject *CreateMemoryBuffer(JSContext *cx, void *buffer, int size);
WXJSAPI wxMemoryBuffer* GetMemoryBuffer(JSContext *cx, JSObject *obj);
wxMemoryBuffer* NewMemoryBuffer(void *buffer, int size);
JSObject *CreateMemoryBuffer(JSContext *cx, void *buffer, int size);
wxMemoryBuffer* GetMemoryBuffer(JSContext *cx, JSObject *obj);
};
};

View File

@ -42,6 +42,7 @@
#include "init.h"
/*
#if defined( __WXMSW__)
void WXDLLEXPORT wxEntryCleanup();
extern "C"
@ -89,3 +90,4 @@ WXJSAPI void wxJS_Destroy()
{
wxjs::gui::Destroy();
}
*/

View File

@ -44,6 +44,7 @@ class wxJSIOApp : public wxAppConsole
virtual int OnRun() { return 0; }
};
/*
IMPLEMENT_APP_NO_MAIN(wxJSIOApp)
#ifdef __WXMSW__
@ -86,3 +87,4 @@ WXJSAPI void wxJS_Destroy()
{
Destroy();
}
*/

View File

@ -11,6 +11,12 @@
#define JS_THREADSAFE
#ifdef _WIN32
# pragma warning (disable: 4100) // "unreferenced formal parameter"
# pragma warning (disable: 4267 4311 4312) // conversions between ints/pointers/etc
#endif
// Precompiled headers:
#ifdef USING_PCH