Advertisement
sbalko74

Untitled

May 4th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. #include "ppapi/c/pp_bool.h"
  6. #include "ppapi/c/pp_errors.h"
  7. #include "ppapi/c/pp_module.h"
  8. #include "ppapi/c/pp_instance.h"
  9.  
  10. #include "ppapi/c/ppp.h"
  11. #include "ppapi/c/ppp_instance.h"
  12.  
  13. typedef uint16_t vecu16_t __attribute__((vector_size(16)));
  14.  
  15. static PP_Bool Instance_DidCreate(PP_Instance instance,
  16. uint32_t argc,
  17. const char* argn[],
  18. const char* argv[]) {
  19.  
  20. printf("Instance_DidCreate\n");
  21.  
  22. vecu16_t v1 = {1, 2, 3, 4, 16, 15, 14, 13}, v2 = {16, 15, 14, 13, 1, 2, 2, 4};
  23.  
  24. vecu16_t result = v1>v2;
  25. vecu16_t m = (result & (v1-v2)) + (~result & (v2-v1));
  26.  
  27. for (int i=0; i<sizeof(v1); ++i) {
  28. printf("|%i-%i|=%i\n", v1[i], v2[i], m[i]);
  29. }
  30.  
  31. return PP_TRUE;
  32. }
  33.  
  34. static void Instance_DidDestroy(PP_Instance instance) {
  35. printf("Instance_DidDestroy\n");
  36. }
  37.  
  38. static void Instance_DidChangeView(PP_Instance instance, PP_Resource view) {
  39. printf("Instance_DidChangeView\n");
  40. }
  41.  
  42. static void Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
  43. printf("Instance_DidChangeFocus\n");
  44. }
  45.  
  46. static PP_Bool Instance_HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) {
  47. printf("Instance_HandleDocumentLoad\n");
  48. return PP_FALSE;
  49. }
  50.  
  51. PP_EXPORT const void* PPP_GetInterface(const char* interface_name) {
  52. // Create structs for each PPP interface.
  53. // Assign the interface functions to the data fields.
  54. if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) {
  55. static PPP_Instance instance_interface = {
  56. &Instance_DidCreate,
  57. &Instance_DidDestroy,
  58. &Instance_DidChangeView,
  59. &Instance_DidChangeFocus,
  60. &Instance_HandleDocumentLoad
  61. };
  62. return &instance_interface;
  63. }
  64.  
  65. // Return NULL for interfaces that you do not implement.
  66. return NULL;
  67. }
  68.  
  69. // Define PPP_InitializeModule, the entry point of your module.
  70. // Retrieve the API for the browser-side (PPB) interfaces you will use.
  71. PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, PPB_GetInterface get_browser_interface) {
  72. printf("PPP_InitializeModule\n");
  73.  
  74. return PP_OK;
  75. }
  76.  
  77. PP_EXPORT void PPP_ShutdownModule() {
  78. printf("PPP_ShutdownModule\n");
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement