Permalink
Browse files

Modularize Export.py into scrpts/regal/...

Refresh mongoose sources from github
Resolves MS compiler warnings by casting double to float for remapping.
Regal.h refinements
Initial GLX enum support for RegalToken.h
  • Loading branch information...
1 parent acbbdbc commit f542d0b6ac16b483e86925aa4d95916e52ef078a @nigels-com nigels-com committed Aug 28, 2012
View
@@ -10,7 +10,7 @@ M_PREFIX = i686
endif
CC := $(M_PREFIX)-nacl-gcc
CXX := $(M_PREFIX)-nacl-g++
-LD := $(M_PREFIX)-nacl-ld
+LD := $(M_PREFIX)-nacl-g++ -m32
STRIP ?=
endif
View
@@ -10,7 +10,7 @@ M_PREFIX = i686
endif
CC := $(M_PREFIX)-nacl-gcc
CXX := $(M_PREFIX)-nacl-g++
-LD := $(M_PREFIX)-nacl-ld
+LD := $(M_PREFIX)-nacl-g++ -m64
STRIP ?=
endif
@@ -1,11 +1,42 @@
+/*
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
+
+*/
+
+#include <ppapi/c/pp_var.h>
#include <ppapi/c/pp_errors.h>
#include <ppapi/c/pp_module.h>
-#include <ppapi/c/pp_var.h>
+
#include <ppapi/c/ppb.h>
#include <ppapi/c/ppb_instance.h>
#include <ppapi/c/ppb_messaging.h>
#include <ppapi/c/ppb_var.h>
#include <ppapi/c/ppb_view.h>
+
#include <ppapi/c/ppp.h>
#include <ppapi/c/ppp_instance.h>
#include <ppapi/c/ppp_messaging.h>
@@ -17,6 +48,21 @@
#include "render.h"
+#include <cstdio>
+#include <cstring>
+#include <cstdarg>
+
+// Can't mix all of Regal.h with OpenGL ES 2.0 header(s)
+
+#define __REGAL_H__
+#include <GL/Regal.h>
+
+extern "C"
+{
+ extern void glLogMessageCallbackREGAL(void (*callback)(GLenum, GLsizei, const char *, GLvoid *));
+ extern void glEnable(GLenum cap);
+};
+
#define GL_LOG_ERROR_REGAL 0x9319 /* 37657 */
#define GL_LOG_WARNING_REGAL 0x931a /* 37658 */
#define GL_LOG_INFO_REGAL 0x931b /* 37659 */
@@ -33,10 +79,6 @@
#define GL_EMULATION_REGAL 0x9325 /* 37669 */
#define GL_DRIVER_REGAL 0x9326 /* 37670 */
-#include <cstdio>
-#include <cstring>
-#include <cstdarg>
-
static PPB_Messaging *ppb_messaging_interface = NULL;
static PPB_Var *ppb_var_interface = NULL;
static PPB_View *ppb_view_interface = NULL;
@@ -47,37 +89,22 @@ static PPB_KeyboardInputEvent *ppb_keyboard_interface = NULL;
static PPB_InputEvent *ppb_input_interface = NULL;
static PP_Resource opengl_context = 0;
+// Utility functions
+
PP_Instance printfInstance = 0;
-/**
- * Creates new string PP_Var from C string. The resulting object will be a
- * refcounted string object. It will be AddRef()ed for the caller. When the
- * caller is done with it, it should be Release()d.
- * @param[in] str C string to be converted to PP_Var
- * @return PP_Var containing string.
- */
-static struct PP_Var CStrToVar(const char* str) {
- if (ppb_var_interface != NULL) {
+static struct PP_Var CStrToVar(const char* str)
+{
+ if (ppb_var_interface)
return ppb_var_interface->VarFromUtf8(str, strlen(str));
- }
- return PP_MakeUndefined();
+ else
+ return PP_MakeUndefined();
}
-static void messagePrint(const char* str) {
- if (ppb_messaging_interface != NULL && printfInstance != 0) {
+static void messagePrint(const char* str)
+{
+ if (ppb_messaging_interface && printfInstance)
ppb_messaging_interface->PostMessage(printfInstance, ::CStrToVar(str));
- }
-}
-
-void messagePrintf(const char* str, ...) {
- const int bufferSize = 1024;
- char buff[bufferSize];
- buff[0] = '\0';
- va_list vl;
- va_start(vl, str);
- vsnprintf(&buff[0], bufferSize, str, vl);
- va_end(vl);
- messagePrint(buff);
}
static void myLogCallback(GLenum stream, GLsizei length, const char *message, GLvoid *context)
@@ -96,19 +123,18 @@ static void myDraw(void *user_data, int32_t result)
ppb_graphics3d_interface->SwapBuffers(opengl_context, ccb);
}
-extern "C"
-{
- extern void RegalMakeCurrent(PP_Resource ctx, struct PPB_OpenGLES2 *interface);
- extern void glLogMessageCallbackREGAL(void (*callback)(GLenum, GLsizei, const char *, GLvoid *));
- extern void glEnable(GLenum cap);
-};
+// Instance interface
-static PP_Bool Instance_DidCreate(PP_Instance instance,
- uint32_t argc,
- const char* argn[],
- const char* argv[]) {
+static PP_Bool Instance_DidCreate
+(
+ PP_Instance instance,
+ uint32_t argc,
+ const char* argn[],
+ const char* argv[]
+)
+{
printfInstance = instance;
- messagePrintf("Regal Dream Torus (GLIBC)");
+ messagePrint("Regal Dream Torus (GLIBC)");
int32_t attribs[] = { PP_GRAPHICS3DATTRIB_WIDTH, 512, PP_GRAPHICS3DATTRIB_HEIGHT, 512, PP_GRAPHICS3DATTRIB_NONE};
opengl_context = ppb_graphics3d_interface->Create(instance, opengl_context, attribs);
ppb_instance_interface->BindGraphics(instance, opengl_context);
@@ -123,112 +149,54 @@ static PP_Bool Instance_DidCreate(PP_Instance instance,
return PP_TRUE;
}
-/**
- * Called when the NaCl module is destroyed. This will always be called,
- * even if DidCreate returned failure. This routine should deallocate any data
- * associated with the instance.
- * @param[in] instance The identifier of the instance representing this NaCl
- * module.
- */
static void Instance_DidDestroy(PP_Instance instance)
{
}
-/**
- * Called when the position, the size, or the clip rect of the element in the
- * browser that corresponds to this NaCl module has changed.
- * @param[in] instance The identifier of the instance representing this NaCl
- * module.
- * @param[in] position The location on the page of this NaCl module. This is
- * relative to the top left corner of the viewport, which changes as the
- * page is scrolled.
- * @param[in] clip The visible region of the NaCl module. This is relative to
- * the top left of the plugin's coordinate system (not the page). If the
- * plugin is invisible, @a clip will be (0, 0, 0, 0).
- */
-static void Instance_DidChangeView(PP_Instance instance, PP_Resource view_resource) {
- PP_Rect rect;
- ppb_view_interface->GetRect(view_resource, &rect);
+static void Instance_DidChangeView(PP_Instance instance, PP_Resource view_resource)
+{
}
-/**
- * Notification that the given NaCl module has gained or lost focus.
- * Having focus means that keyboard events will be sent to the NaCl module
- * represented by @a instance. A NaCl module's default condition is that it
- * will not have focus.
- *
- * Note: clicks on NaCl modules will give focus only if you handle the
- * click event. You signal if you handled it by returning @a true from
- * HandleInputEvent. Otherwise the browser will bubble the event and give
- * focus to the element on the page that actually did end up consuming it.
- * If you're not getting focus, check to make sure you're returning true from
- * the mouse click in HandleInputEvent.
- * @param[in] instance The identifier of the instance representing this NaCl
- * module.
- * @param[in] has_focus Indicates whether this NaCl module gained or lost
- * event focus.
- */
static void Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus)
{
- if (has_focus) {
- messagePrintf("Gained focus");
- } else {
- messagePrintf("Lost focus");
- }
}
-/**
- * Handler that gets called after a full-frame module is instantiated based on
- * registered MIME types. This function is not called on NaCl modules. This
- * function is essentially a place-holder for the required function pointer in
- * the PPP_Instance structure.
- * @param[in] instance The identifier of the instance representing this NaCl
- * module.
- * @param[in] url_loader A PP_Resource an open PPB_URLLoader instance.
- * @return PP_FALSE.
- */
static PP_Bool Instance_HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader)
{
return PP_FALSE;
}
-// Entry points for the module.
-// Initialize needed interfaces: PPB_Core, PPB_Messaging and PPB_Var.
+// Module interface
PP_EXPORT int32_t PPP_InitializeModule(PP_Module a_module_id, PPB_GetInterface get_browser)
{
- ppb_messaging_interface = (PPB_Messaging*)(get_browser(PPB_MESSAGING_INTERFACE));
- ppb_var_interface = (PPB_Var*)(get_browser(PPB_VAR_INTERFACE));
- ppb_view_interface = (PPB_View*)(get_browser(PPB_VIEW_INTERFACE));
- ppb_graphics3d_interface = (PPB_Graphics3D*)(get_browser(PPB_GRAPHICS_3D_INTERFACE));
- ppb_instance_interface = (PPB_Instance*)(get_browser(PPB_INSTANCE_INTERFACE));
- ppb_opengl_interface = (PPB_OpenGLES2*)(get_browser(PPB_OPENGLES2_INTERFACE));
- ppb_keyboard_interface = (PPB_KeyboardInputEvent*)(get_browser(PPB_KEYBOARD_INPUT_EVENT_INTERFACE));
- ppb_input_interface = (PPB_InputEvent*)(get_browser(PPB_INPUT_EVENT_INTERFACE));
+ ppb_messaging_interface = (PPB_Messaging *) get_browser(PPB_MESSAGING_INTERFACE);
+ ppb_var_interface = (PPB_Var *) get_browser(PPB_VAR_INTERFACE);
+ ppb_view_interface = (PPB_View *) get_browser(PPB_VIEW_INTERFACE);
+ ppb_graphics3d_interface = (PPB_Graphics3D *) get_browser(PPB_GRAPHICS_3D_INTERFACE);
+ ppb_instance_interface = (PPB_Instance *) get_browser(PPB_INSTANCE_INTERFACE);
+ ppb_opengl_interface = (PPB_OpenGLES2 *) get_browser(PPB_OPENGLES2_INTERFACE);
+ ppb_keyboard_interface = (PPB_KeyboardInputEvent *) get_browser(PPB_KEYBOARD_INPUT_EVENT_INTERFACE);
+ ppb_input_interface = (PPB_InputEvent *) get_browser(PPB_INPUT_EVENT_INTERFACE);
return PP_OK;
}
-// Returns an interface pointer for the interface of the given name
+static PPP_Instance instance_interface =
+{
+ &Instance_DidCreate,
+ &Instance_DidDestroy,
+ &Instance_DidChangeView,
+ &Instance_DidChangeFocus,
+ &Instance_HandleDocumentLoad,
+};
-PP_EXPORT const void* PPP_GetInterface(const char* interface_name)
+PP_EXPORT const void *PPP_GetInterface(const char *interface_name)
{
if (!strcmp(interface_name, PPP_INSTANCE_INTERFACE))
- {
- static PPP_Instance instance_interface = {
- &Instance_DidCreate,
- &Instance_DidDestroy,
- &Instance_DidChangeView,
- &Instance_DidChangeFocus,
- &Instance_HandleDocumentLoad,
- };
return &instance_interface;
- }
-
return NULL;
}
-// Called before the plugin module is unloaded.
-
PP_EXPORT void PPP_ShutdownModule()
{
}
@@ -1,44 +1,44 @@
-{
- "program": {
- "x86-32": {"url": "lib32/runnable-ld.so"},
- "x86-64": {"url": "lib64/runnable-ld.so"}
- },
- "files": {
- "libpthread.so.11652996" : {
- "x86-32": {"url": "lib32/libpthread.so.11652996"},
- "x86-64": {"url": "lib64/libpthread.so.11652996"}
- },
- "libppapi_cpp.so" : {
- "x86-32": {"url": "lib32/libppapi.so"},
- "x86-64": {"url": "lib64/libppapi.so"}
- },
- "libstdc++.so.6" : {
- "x86-32": {"url": "lib32/libstdc++.so.6"},
- "x86-64": {"url": "lib64/libstdc++.so.6"}
- },
- "libm.so.11652996" : {
- "x86-32": {"url": "lib32/libm.so.11652996"},
- "x86-64": {"url": "lib64/libm.so.11652996"}
- },
- "libgcc_s.so.1" : {
- "x86-32": {"url": "lib32/libgcc_s.so.1"},
- "x86-64": {"url": "lib64/libgcc_s.so.1"}
- },
- "libc.so.11652996" : {
- "x86-32": {"url": "lib32/libc.so.11652996"},
- "x86-64": {"url": "lib64/libc.so.11652996"}
- },
- "libdl.so.11652996" : {
- "x86-32": {"url": "lib32/libdl.so.11652996"},
- "x86-64": {"url": "lib64/libdl.so.11652996"}
- },
- "libppapi_gles2.so" : {
- "x86-32": {"url": "lib32/libppapi_gles2.so"},
- "x86-64": {"url": "lib64/libppapi_gles2.so"}
- },
- "main.nexe" : {
- "x86-32": {"url": "dreamtorus_nacl.x86-32.nexe"},
- "x86-64": {"url": "dreamtorus_nacl.x86-64.nexe"}
- }
- }
+{
+ "program": {
+ "x86-32": {"url": "lib32/runnable-ld.so"},
+ "x86-64": {"url": "lib64/runnable-ld.so"}
+ },
+ "files": {
+ "libpthread.so.11652996" : {
+ "x86-32": {"url": "lib32/libpthread.so.11652996"},
+ "x86-64": {"url": "lib64/libpthread.so.11652996"}
+ },
+ "libppapi_cpp.so" : {
+ "x86-32": {"url": "lib32/libppapi.so"},
+ "x86-64": {"url": "lib64/libppapi.so"}
+ },
+ "libstdc++.so.6" : {
+ "x86-32": {"url": "lib32/libstdc++.so.6"},
+ "x86-64": {"url": "lib64/libstdc++.so.6"}
+ },
+ "libm.so.11652996" : {
+ "x86-32": {"url": "lib32/libm.so.11652996"},
+ "x86-64": {"url": "lib64/libm.so.11652996"}
+ },
+ "libgcc_s.so.1" : {
+ "x86-32": {"url": "lib32/libgcc_s.so.1"},
+ "x86-64": {"url": "lib64/libgcc_s.so.1"}
+ },
+ "libc.so.11652996" : {
+ "x86-32": {"url": "lib32/libc.so.11652996"},
+ "x86-64": {"url": "lib64/libc.so.11652996"}
+ },
+ "libdl.so.11652996" : {
+ "x86-32": {"url": "lib32/libdl.so.11652996"},
+ "x86-64": {"url": "lib64/libdl.so.11652996"}
+ },
+ "libppapi_gles2.so" : {
+ "x86-32": {"url": "lib32/libppapi_gles2.so"},
+ "x86-64": {"url": "lib64/libppapi_gles2.so"}
+ },
+ "main.nexe" : {
+ "x86-32": {"url": "dreamtorus_nacl.x86-32.nexe"},
+ "x86-64": {"url": "dreamtorus_nacl.x86-64.nexe"}
+ }
+ }
}
Oops, something went wrong.

0 comments on commit f542d0b

Please sign in to comment.