Add parameter module inst for native wrapper functions (#117)

And add asm code of em64/arm/mips version to call native wrapper functions;
Fix some issues of calling wrapper functions;
This commit is contained in:
wenyongh
2019-09-10 10:23:46 +08:00
committed by GitHub
parent 2294f52e3a
commit 26149021ff
58 changed files with 1287 additions and 494 deletions

View File

@ -18,6 +18,8 @@
#include "request.h"
#include "shared_utils.h"
#include "wasm_app.h"
#include "req_resp_api.h"
#include "timer_api.h"
#define TRANSACTION_TIMEOUT_MS 5000
@ -138,15 +140,15 @@ static bool register_url_handler(const char *url,
// tell app mgr to route this url to me
if (reg_type == Reg_Request)
wasm_register_resource((int32)url);
wasm_register_resource(url);
else
wasm_sub_event((int32)url);
wasm_sub_event(url);
return true;
}
bool api_register_resource_handler(const char *url,
request_handler_f request_handler)
request_handler_f request_handler)
{
return register_url_handler(url, request_handler, Reg_Request);
}
@ -242,7 +244,7 @@ void api_send_request(request_t * request, response_handler_f response_handler,
}
}
wasm_post_request((int32)buffer, size);
wasm_post_request(buffer, size);
free_req_resp_packet(buffer);
}
@ -329,7 +331,7 @@ void api_response_send(response_t *response)
if (buffer == NULL)
return;
wasm_response_send((int32)buffer, size);
wasm_response_send(buffer, size);
free_req_resp_packet(buffer);
}
@ -343,7 +345,7 @@ bool api_publish_event(const char *url, int fmt, void *payload, int payload_len)
char * buffer = pack_request(request, &size);
if (buffer == NULL)
return false;
wasm_post_request((int32)buffer, size);
wasm_post_request(buffer, size);
free_req_resp_packet(buffer);

View File

@ -17,7 +17,6 @@
#ifndef _AEE_REQUEST_H_
#define _AEE_REQUEST_H_
#include "native_interface.h"
#include "shared_utils.h"
#ifdef __cplusplus

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
#include "timer_wasm_app.h"
#include "native_interface.h"
#include <stdlib.h>
#include <string.h>
#include "timer_wasm_app.h"
#include "timer_api.h"
#if 1
#include <stdio.h>
#else

View File

@ -32,7 +32,6 @@
#ifndef _LIB_AEE_H_
#define _LIB_AEE_H_
#include "native_interface.h"
#include "shared_utils.h"
#include "attr_container.h"
#include "request.h"

View File

@ -15,7 +15,7 @@
*/
#include "connection.h"
#include "native_interface.h"
#include "connection_api.h"
/* Raw connection structure */
typedef struct _connection {
@ -44,7 +44,7 @@ connection_t *api_open_connection(const char *name,
char *args_buffer = (char *)args;
uint32 handle, args_len = attr_container_get_serialize_length(args);
handle = wasm_open_connection((int32)name, (int32)args_buffer, args_len);
handle = wasm_open_connection(name, args_buffer, args_len);
if (handle == -1)
return NULL;
@ -91,7 +91,7 @@ void api_close_connection(connection_t *c)
int api_send_on_connection(connection_t *conn, const char *data, uint32 len)
{
return wasm_send_on_connection(conn->handle, (int32)data, len);
return wasm_send_on_connection(conn->handle, data, len);
}
bool api_config_connection(connection_t *conn, attr_container_t *cfg)
@ -99,7 +99,7 @@ bool api_config_connection(connection_t *conn, attr_container_t *cfg)
char *cfg_buffer = (char *)cfg;
uint32 cfg_len = attr_container_get_serialize_length(cfg);
return wasm_config_connection(conn->handle, (int32)cfg_buffer, cfg_len);
return wasm_config_connection(conn->handle, cfg_buffer, cfg_len);
}
void on_connection_data(uint32 handle, char *buffer, uint32 len)

View File

@ -15,11 +15,11 @@
*/
#include "wgl.h"
#include "native_interface.h"
#include "bh_platform.h"
#include "gui_api.h"
#define ARGC sizeof(argv)/sizeof(uint32)
#define CALL_BTN_NATIVE_FUNC(id) wasm_btn_native_call(id, (int32)argv, ARGC)
#define CALL_BTN_NATIVE_FUNC(id) wasm_btn_native_call(id, argv, ARGC)
wgl_obj_t wgl_btn_create(wgl_obj_t par, wgl_obj_t copy)
{

View File

@ -15,12 +15,12 @@
*/
#include "wgl.h"
#include "native_interface.h"
#include "gui_api.h"
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define CALL_CB_NATIVE_FUNC(id) wasm_cb_native_call(id, (uint32)argv, ARGC)
#define CALL_CB_NATIVE_FUNC(id) wasm_cb_native_call(id, argv, ARGC)
wgl_obj_t wgl_cb_create(wgl_obj_t par, const wgl_obj_t copy)
{

View File

@ -16,12 +16,12 @@
#include "wgl.h"
#include "native_interface.h"
#include "gui_api.h"
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define CALL_LABEL_NATIVE_FUNC(id) wasm_label_native_call(id, (uint32)argv, ARGC)
#define CALL_LABEL_NATIVE_FUNC(id) wasm_label_native_call(id, argv, ARGC)
wgl_obj_t wgl_label_create(wgl_obj_t par, wgl_obj_t copy)
{

View File

@ -15,12 +15,12 @@
*/
#include "wgl.h"
#include "native_interface.h"
#include "gui_api.h"
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define CALL_LIST_NATIVE_FUNC(id) wasm_list_native_call(id, (int32)argv, ARGC)
#define CALL_LIST_NATIVE_FUNC(id) wasm_list_native_call(id, argv, ARGC)
wgl_obj_t wgl_list_create(wgl_obj_t par, const wgl_obj_t copy)

View File

@ -15,12 +15,12 @@
*/
#include "wgl.h"
#include "native_interface.h"
#include "gui_api.h"
#include <stdlib.h>
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define CALL_OBJ_NATIVE_FUNC(id) wasm_obj_native_call(id, (int32)argv, ARGC)
#define CALL_OBJ_NATIVE_FUNC(id) wasm_obj_native_call(id, argv, ARGC)
typedef struct _obj_evt_cb {
struct _obj_evt_cb *next;

View File

@ -15,7 +15,7 @@
*/
#include "sensor.h"
#include "native_interface.h"
#include "sensor_api.h"
typedef struct _sensor {
struct _sensor * next;
@ -31,7 +31,7 @@ sensor_t sensor_open(const char* name, int index,
sensor_event_handler_f sensor_event_handler,
void *user_data)
{
uint32 id = wasm_sensor_open((int32)name, index);
uint32 id = wasm_sensor_open(name, index);
if (id == -1)
return NULL;
@ -66,7 +66,7 @@ bool sensor_config_with_attr_container(sensor_t sensor, attr_container_t *cfg)
char *buffer = (char *)cfg;
int len = attr_container_get_serialize_length(cfg);
return wasm_sensor_config_with_attr_container(sensor->handle, (int32)buffer, len);
return wasm_sensor_config_with_attr_container(sensor->handle, buffer, len);
}
bool sensor_config(sensor_t sensor, int interval, int bit_cfg, int delay)