Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdint.h>
- #include <stdio.h>
- #include <string.h>
- #include "ppapi/c/pp_bool.h"
- #include "ppapi/c/pp_errors.h"
- #include "ppapi/c/pp_module.h"
- #include "ppapi/c/pp_instance.h"
- #include "ppapi/c/ppp.h"
- #include "ppapi/c/ppp_instance.h"
- typedef uint16_t vecu16_t __attribute__((vector_size(16)));
- static PP_Bool Instance_DidCreate(PP_Instance instance,
- uint32_t argc,
- const char* argn[],
- const char* argv[]) {
- printf("Instance_DidCreate\n");
- vecu16_t v1 = {1, 2, 3, 4, 16, 15, 14, 13}, v2 = {16, 15, 14, 13, 1, 2, 2, 4};
- vecu16_t result = v1>v2;
- vecu16_t m = (result & (v1-v2)) + (~result & (v2-v1));
- for (int i=0; i<sizeof(v1); ++i) {
- printf("|%i-%i|=%i\n", v1[i], v2[i], m[i]);
- }
- return PP_TRUE;
- }
- static void Instance_DidDestroy(PP_Instance instance) {
- printf("Instance_DidDestroy\n");
- }
- static void Instance_DidChangeView(PP_Instance instance, PP_Resource view) {
- printf("Instance_DidChangeView\n");
- }
- static void Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
- printf("Instance_DidChangeFocus\n");
- }
- static PP_Bool Instance_HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) {
- printf("Instance_HandleDocumentLoad\n");
- return PP_FALSE;
- }
- PP_EXPORT const void* PPP_GetInterface(const char* interface_name) {
- // Create structs for each PPP interface.
- // Assign the interface functions to the data fields.
- if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) {
- static PPP_Instance instance_interface = {
- &Instance_DidCreate,
- &Instance_DidDestroy,
- &Instance_DidChangeView,
- &Instance_DidChangeFocus,
- &Instance_HandleDocumentLoad
- };
- return &instance_interface;
- }
- // Return NULL for interfaces that you do not implement.
- return NULL;
- }
- // Define PPP_InitializeModule, the entry point of your module.
- // Retrieve the API for the browser-side (PPB) interfaces you will use.
- PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, PPB_GetInterface get_browser_interface) {
- printf("PPP_InitializeModule\n");
- return PP_OK;
- }
- PP_EXPORT void PPP_ShutdownModule() {
- printf("PPP_ShutdownModule\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement