From: WonYoung Choi Date: Wed, 16 Dec 2015 03:32:39 +0000 (+0900) Subject: Remove examples of node-xwalk X-Git-Tag: submit/tizen/20151218.005349^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f7bad620870480541041a41a1ff1692094bdd12;p=platform%2Fframework%2Fnative%2Fjsnative.git Remove examples of node-xwalk Change-Id: I2a819a3b88616eaec6d2df25712285149dfdd374 --- diff --git a/modules/node-xwalk/examples/echo/Makefile b/modules/node-xwalk/examples/echo/Makefile deleted file mode 100644 index 5e8f3a8..0000000 --- a/modules/node-xwalk/examples/echo/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CC=gcc -CFLAGS=-fPIC -I../../src -LDFLAGS=--shared - -TARGET=libecho.so -SRCS=echo_extension.c - -$(TARGET): $(SRCS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ - -clean: - rm -f $(TARGET) \ No newline at end of file diff --git a/modules/node-xwalk/examples/echo/echo.js b/modules/node-xwalk/examples/echo/echo.js deleted file mode 100644 index f3f2c5b..0000000 --- a/modules/node-xwalk/examples/echo/echo.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node - -// Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var xwalk = require('node-xwalk'); -var echo = xwalk.require('echo'); - -echo.echo("Hello Async!!", function(msg) { - console.log("Async callback: " + msg); -}); - -var ret = echo.syncEcho("Hello Sync!!"); -console.log("Sync return: " + ret); - diff --git a/modules/node-xwalk/examples/echo/echo_extension.c b/modules/node-xwalk/examples/echo/echo_extension.c deleted file mode 100644 index 78b7986..0000000 --- a/modules/node-xwalk/examples/echo/echo_extension.c +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2013 Intel Corporation. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#if defined(__cplusplus) -#error "This file is written in C to make sure the C API works as intended." -#endif - -#include -#include -#include "xwalk/extensions/public/XW_Extension.h" -#include "xwalk/extensions/public/XW_Extension_SyncMessage.h" - -XW_Extension g_extension = 0; -const XW_CoreInterface* g_core = NULL; -const XW_MessagingInterface* g_messaging = NULL; -const XW_Internal_SyncMessagingInterface* g_sync_messaging = NULL; - -void instance_created(XW_Instance instance) { - printf("Instance %d created!\n", instance); -} - -void instance_destroyed(XW_Instance instance) { - printf("Instance %d destroyed!\n", instance); -} - -void handle_message(XW_Instance instance, const char* message) { - g_messaging->PostMessage(instance, message); -} - -void handle_sync_message(XW_Instance instance, const char* message) { - g_sync_messaging->SetSyncReply(instance, message); -} - -void shutdown(XW_Extension extension) { - printf("Shutdown\n"); -} - -int32_t XW_Initialize(XW_Extension extension, XW_GetInterface get_interface) { - static const char* kAPI = - "var echoListener = null;" - "extension.setMessageListener(function(msg) {" - " if (echoListener instanceof Function) {" - " echoListener(msg);" - " };" - "});" - "exports.echo = function(msg, callback) {" - " echoListener = callback;" - " extension.postMessage(msg);" - "};" - "exports.syncEcho = function(msg) {" - " return extension.internal.sendSyncMessage(msg);" - "};"; - - g_extension = extension; - g_core = get_interface(XW_CORE_INTERFACE); - g_core->SetExtensionName(extension, "echo"); - g_core->SetJavaScriptAPI(extension, kAPI); - g_core->RegisterInstanceCallbacks( - extension, instance_created, instance_destroyed); - g_core->RegisterShutdownCallback(extension, shutdown); - - g_messaging = get_interface(XW_MESSAGING_INTERFACE); - g_messaging->Register(extension, handle_message); - - g_sync_messaging = get_interface(XW_INTERNAL_SYNC_MESSAGING_INTERFACE); - g_sync_messaging->Register(extension, handle_sync_message); - - return XW_OK; -} diff --git a/modules/node-xwalk/examples/echo/libecho.so b/modules/node-xwalk/examples/echo/libecho.so deleted file mode 100755 index f0737f5..0000000 Binary files a/modules/node-xwalk/examples/echo/libecho.so and /dev/null differ diff --git a/modules/node-xwalk/examples/echo_binary/Makefile b/modules/node-xwalk/examples/echo_binary/Makefile deleted file mode 100644 index 1f3fe17..0000000 --- a/modules/node-xwalk/examples/echo_binary/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CC=gcc -CFLAGS=-fPIC -I../../src -LDFLAGS=--shared - -TARGET=libecho2.so -SRCS=echo_extension_messaging_2.c - -$(TARGET): $(SRCS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ - -clean: - rm -f $(TARGET) \ No newline at end of file diff --git a/modules/node-xwalk/examples/echo_binary/echo2.js b/modules/node-xwalk/examples/echo_binary/echo2.js deleted file mode 100644 index 2eabd64..0000000 --- a/modules/node-xwalk/examples/echo_binary/echo2.js +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env node - -// Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var xwalk = require('node-xwalk'); -var echo2 = xwalk.require('echo2'); - -// Test async messaging -echo2.echo("Hello Async!!", function(msg) { - console.log(msg); - // Test async messaging with ArrayBuffer - var dataLength = 32; - var buffer = new ArrayBuffer(dataLength + 4); - var uint32View = new Uint32Array(buffer, 0, 1); - uint32View[0] = dataLength; - var uint8View = new Uint8Array(buffer, 4, dataLength); - for (var i=0; i < dataLength; i++) { - uint8View[i] = i; - } - echo2.echoBinary(buffer, function(msg) { - if (!(msg instanceof ArrayBuffer)) - throw "message is not binary."; - var retUint32View = new Uint32Array(msg, 0, 1); - var retLength = retUint32View[0]; - if (retLength != dataLength) - throw "message length doesn't match."; - var retUint8View = new Uint8Array(msg, 4, retLength); - console.log(retUint8View); - }); -}); - diff --git a/modules/node-xwalk/examples/echo_binary/echo_extension_messaging_2.c b/modules/node-xwalk/examples/echo_binary/echo_extension_messaging_2.c deleted file mode 100644 index d19cb72..0000000 --- a/modules/node-xwalk/examples/echo_binary/echo_extension_messaging_2.c +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2015 Intel Corporation. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#if defined(__cplusplus) -#error "This file is written in C to make sure the C API works as intended." -#endif - -#include -#include -#include "xwalk/extensions/public/XW_Extension.h" -#include "xwalk/extensions/public/XW_Extension_Message_2.h" - -XW_Extension g_extension = 0; -const XW_CoreInterface* g_core = NULL; -const XW_MessagingInterface2* g_messaging_2 = NULL; - -void instance_created(XW_Instance instance) { - printf("Instance %d created!\n", instance); -} - -void instance_destroyed(XW_Instance instance) { - printf("Instance %d destroyed!\n", instance); -} - -void handle_message(XW_Instance instance, const char* message) { - g_messaging_2->PostMessage(instance, message); -} - -void handle_binary_message( - XW_Instance instance, const char* message, const size_t size) { - g_messaging_2->PostBinaryMessage(instance, message, size); -} - -void shutdown(XW_Extension extension) { - printf("Shutdown\n"); -} - -int32_t XW_Initialize(XW_Extension extension, XW_GetInterface get_interface) { - static const char* kAPI = - "var echoListener = null;" - "var echoBinaryListener = null;" - "extension.setMessageListener(function(msg) {" - " if (echoListener instanceof Function) {" - " if (msg instanceof ArrayBuffer) {" - " echoBinaryListener(msg);" - " } else {" - " echoListener(msg);" - " }" - " }" - "});" - "exports.echo = function(msg, callback) {" - " echoListener = callback;" - " extension.postMessage(msg);" - "};" - "exports.echoBinary = function(msg, callback) {" - " echoBinaryListener = callback;" - " extension.postMessage(msg);" - "};"; - - g_extension = extension; - g_core = get_interface(XW_CORE_INTERFACE); - if (g_core == NULL) - return XW_ERROR; - g_core->SetExtensionName(extension, "echo2"); - g_core->SetJavaScriptAPI(extension, kAPI); - g_core->RegisterInstanceCallbacks( - extension, instance_created, instance_destroyed); - g_core->RegisterShutdownCallback(extension, shutdown); - - g_messaging_2 = get_interface(XW_MESSAGING_INTERFACE_2); - if (g_messaging_2 == NULL) - return XW_ERROR; - g_messaging_2->Register(extension, handle_message); - g_messaging_2->RegisterBinaryMesssageCallback( - extension, handle_binary_message); - - return XW_OK; -} diff --git a/modules/node-xwalk/examples/echo_binary/libecho2.so b/modules/node-xwalk/examples/echo_binary/libecho2.so deleted file mode 100755 index abe17dd..0000000 Binary files a/modules/node-xwalk/examples/echo_binary/libecho2.so and /dev/null differ