code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
#ifndef _BT_HOST_ADAPTER_H_
#define _BT_HOST_ADAPTER_H_
typedef struct {
char *dev_name;
uint16_t conn_num_max;
}amp_bt_host_adapter_init_t;
typedef struct {
int32_t type;
char *adv_data;
char *scan_rsp_data;
int32_t interval_min;
int32_t interval_max;
int32_t channel_map;
}amp_bt_hos... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/addons/wireless/bt_host/bt_host_adapter.h | C | apache-2.0 | 1,533 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "be_inl.h"
#include "aiot_state_api.h"
#include "bt_host_adapter.h"
#include "cJSON.h"
#define MOD_STR "BT_HOST"
typedef struct {
int scan_js_c... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/addons/wireless/bt_host/module_bt_host.c | C | apache-2.0 | 12,970 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_fs.h"
#include "aos_system.h"
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "be_inl.h"
#include "cJSON.h"
#include "addons/libjs.h"
#include "startup/app_entr... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/be.c | C | apache-2.0 | 15,893 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#ifndef BONE_ENGINE_INL_H
#define BONE_ENGINE_INL_H
#include <stdint.h>
#include "duktape/duktape.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* get JSEngine context
*/
duk_context *be_get_context();
/*
* Create a global array refs in the heap stas... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/be_inl.h | C | apache-2.0 | 3,263 |
/*
* Node.js-like module loading framework for Duktape
*
* https://nodejs.org/api/modules.html
*/
#include "be_inl.h"
static void duk__push_module_object(duk_context *ctx, const char *id);
static duk_bool_t duk__get_cached_module(duk_context *ctx, const char *id)
{
duk_push_global_stash(ctx);
(void)duk... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/be_module_node.c | C | apache-2.0 | 9,306 |
#include "be_inl.h"
/*
* Create a global array refs in the heap stash.
*/
void be_ref_setup(duk_context *ctx)
{
duk_push_heap_stash(ctx);
/* Create a new array with one `0` at index `0`. */
duk_push_array(ctx);
duk_push_int(ctx, 0);
duk_put_prop_index(ctx, -2, 0);
/* Store it as "refs" in th... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/be_refs.c | C | apache-2.0 | 2,159 |
/*
* Duktape public API for Duktape 2.5.0.
*
* See the API reference for documentation on call semantics. The exposed,
* supported API is between the "BEGIN PUBLIC API" and "END PUBLIC API"
* comments. Other parts of the header are Duktape internal and related to
* e.g. platform/compiler/feature detection.... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/duktape/duktape.h | C | apache-2.0 | 74,955 |
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_task.h"
#include "amp_defines.h"
#include "aos_hal_uart.h"
#include "duktape.h"
#include "be_... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/repl.c | C | apache-2.0 | 15,761 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#ifndef __AMP_REPL_H
#define __AMP_REPL_H
#include <stdint.h>
#include "duktape/duktape.h"
#ifdef __cplusplus
extern "C" {
#endif
#define REPL_OK 0
#define REPL_ERR_NOMEM -10000
#define REPL_ERR_DENIED -10001
#define REPL_ERR_INVALID -10002
#define REP... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/repl.h | C | apache-2.0 | 1,067 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include "aos_fs.h"
#include "aos_system.h"
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "be_inl.h"
#include "cJSON.h"
#include "startup/app_entry.h"
#define MOD_STR "APPENTRY"
app_options_t app_... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/startup/app_entry.c | C | apache-2.0 | 3,332 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef __APP_ENTRY_H
#define __APP_ENTRY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
/* options object */
int object;
/* ref of globalData */
int global_data;
/* ref of onLaunch() */
int on_launch... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/startup/app_entry.h | C | apache-2.0 | 527 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include "aos_fs.h"
#include "aos_system.h"
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "be_inl.h"
#include "cJSON.h"
#include "startup/page_entry.h"
#include "render.h"
#define MOD_STR "APPENTR... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/startup/page_entry.c | C | apache-2.0 | 8,015 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef __PAGE_ENTRY_H
#define __PAGE_ENTRY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "infra_list.h"
#include "render.h"
extern void page_list_init(void);
extern void page_list_add(const char *route);
extern void page_list_du... | YifuLiu/AliOS-Things | components/amp/engine/duktape_engine/startup/page_entry.h | C | apache-2.0 | 540 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "stdint.h"
#include "stdint.h"
#include "aiot_mqtt_api.h"
#include "quickjs.h"
enum MODULE_NAME_E {
HAAS600_EC100Y = 0,
HAAS600_EC600S,
HAAS600_EC600N,
HAAS600_EC600U,
HAAS600_N58,
HAAS600_N715,
HAAS510_EC600S,
HA... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot.h | C | apache-2.0 | 5,450 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "aos/kv.h"
#include "aiot_state_api.h"
#include "aiot_sysdep_api.h"
#include "aiot_mqtt_api.h"
#include "aiot_devinfo_api.h"
#include "module_aiot... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot_activeinfo.c | C | apache-2.0 | 4,099 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aos/kv.h"
#include "aiot_sysdep_api.h"
#include "aiot_mqtt_api.h"
#include "aiot_dm_api.h"
#include "aiot_state_api.h"
#include "quickjs.h"
#include... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot_device.c | C | apache-2.0 | 33,582 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "aiot_state_api.h"
#include "aiot_sysdep_api.h"
#include "aiot_dynreg_api.h"
#include "aiot_mqtt_api.h"
#include "module_aiot.h"
#define MOD_STR "AIOT_DYNREG"
/* 位于portf... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot_dynreg.c | C | apache-2.0 | 6,357 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aos/kv.h"
#include "aiot_sysdep_api.h"
#include "aiot_mqtt_api.h"
#include "aiot_dm_api.h"
#include "aiot_subdev_api.h"
#include "aiot_state_api.h"
... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot_gateway.c | C | apache-2.0 | 38,499 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aos/kv.h"
#include "aiot_state_api.h"
#include "aiot_sysdep_api.h"
#include "aiot_mqtt_api.h"
#include "aiot_dm_api.h"
#include "aiot_subdev_api.h"
... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot_mqtt.c | C | apache-2.0 | 14,276 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "aiot_state_api.h"
#include "aiot_sysdep_api.h"
#include "aiot_ntp_api.h"
#include "aiot_mqtt_api.h"
#include "module_aiot.h"
#include "quickjs_addon_common.h"
#define MO... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/aiot/module_aiot_ntp.c | C | apache-2.0 | 6,013 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aos_fs.h"
#include "board_mgr.h"
#include "aos/vfs.h"
#include "uvoice_types.h"
#include "uvoice_event.h"
#i... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/audio/module_audioplayer.c | C | apache-2.0 | 20,847 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aos_fs.h"
#include "board_mgr.h"
#include "aos/vfs.h"
#include "uvoice_types.h"
#include "uvoice_event.h"
#inc... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/audio/module_audiorecorder.c | C | apache-2.0 | 8,134 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "BLECFGNET"
static JSClassID js_blecfgnet_class_id;
static JSValue... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/blenetcfg/module_blecfgnet.c | C | apache-2.0 | 2,503 |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "ulog/ulog.h"
#include "oss_app.h"
#define MOD_STR "MOD_OSS"
#define MAX_URL_LENGTH 256
static aos_sem_t g_oss_task_sem =... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/oss/module_oss.c | C | apache-2.0 | 5,993 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "ota_agent.h"
#include "ota_import.h"
#include "module_aiot.h"
#include "app_upgrade.h"
#include "quickjs.h"
#include "quickjs_addon... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/advanced/ota/module_appota.c | C | apache-2.0 | 20,988 |
/*!
* @file quickjs_addon_common.h
*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _AMP_QUICKJS_ADDON_COMMON_H_
#define _AMP_QUICKJS_ADDON_COMMON_H_
#include "stdint.h"
#include "stdbool.h"
#include "quickjs.h"
#ifndef countof
#define countof(x) (sizeof(x) / sizeof((x)[0]))
#endif
extern JS... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/common/quickjs_addon_common.h | C | apache-2.0 | 2,079 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
/* #define LOG_NDEBUG 0 */
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_adc.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "ADC"
static ... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/adc/module_adc.c | C | apache-2.0 | 4,412 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_dac.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "DAC"
static JSClassID js_dac_class_id;
... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/dac/module_dac.c | C | apache-2.0 | 5,577 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_gpio.h"
#include "aos_system.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/gpio/module_gpio.c | C | apache-2.0 | 9,868 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_i2c.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "I2C"
static JSClassID js_i2c_class_id;
... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/i2c/module_i2c.c | C | apache-2.0 | 8,793 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_gpio.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "IR"
static JSClassID js_ir_class_id;
typedef struct ir_module... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/ir/module_ir.c | C | apache-2.0 | 17,784 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_lcd.h"
#include "aos_system.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/lcd/module_lcd.c | C | apache-2.0 | 3,928 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_gpio.h"
#include "aos_system.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "ONEWIRE"
/*
使用方法... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/onewire/module_onewire.c | C | apache-2.0 | 14,728 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
/* #define LOG_NDEBUG 0 */
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_pwm.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "PWM"
static ... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/pwm/module_pwm.c | C | apache-2.0 | 7,114 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#define LOG_NDEBUG 0
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_rtc.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "RTC"
#define RTC_Y... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/rtc/module_rtc.c | C | apache-2.0 | 7,190 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_spi.h"
#include "aos_system.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/spi/module_spi.c | C | apache-2.0 | 7,425 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "amp_task.h"
#include "aos_hal_timer.h"
#include "aos/list.h"
#include "quickjs.h"
#include "quickjs_addon_commo... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/timer/module_timer.c | C | apache-2.0 | 11,467 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
/* #define LOG_NDEBUG 0
* generate:
* ./qjsc -c -m src/uart.js -N jslib_uart -M UART -M events -o bytecode/jslib_uart.c
* linux sim:
* ./test/qjsc -c ./test/testapp.js -M uart -M events -o ./test/app.c
* python ./test/gen_jsb.py ./test/app.c ./test/... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/uart/module_uart.c | C | apache-2.0 | 14,608 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
/* #define LOG_NDEBUG 0 */
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_hal_wdg.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "WDG"
#ifndef... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/hardware/wdg/module_wdg.c | C | apache-2.0 | 2,889 |
/*
* QuickJS C library
*
* Copyright (c) 2017-2020 Fabrice Bellard
* Copyright (c) 2017-2020 Charlie Gordon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, incl... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/libc/quickjs_libc.c | C | apache-2.0 | 116,514 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "CELLULAR"
typedef struct {
int status;... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/cellular/module_cellular.c | C | apache-2.0 | 12,256 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "amp_platform.h"
#include "aos_system.h"
#include "aos_network.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "aos_socket.h"
#i... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/http/module_http.c | C | apache-2.0 | 22,662 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "amp_task.h"
#include "aos/list.h"
#include "quickjs.h"
#include "quickjs_addon_common.h... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/module_network.c | C | apache-2.0 | 1,700 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "amp_platform.h"
#include "aos_system.h"
#include "aos_network.h"
#include "amp_memory.h"
#include "amp_defines.h"
#include "module_mqtt.h"
#i... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/mqtt/module_mqtt.c | C | apache-2.0 | 13,761 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "stdint.h"
#include "quickjs.h"
#include "aiot_mqtt_api.h"
typedef enum {
AOS_MQTT_CONNECT,
AOS_MQTT_RECONNECT,
AOS_MQTT_DISCONNECT,
AOS_MQTT_MESSAGE
} aos_mqtt_res_type_t;
/**
* @brief subdev模块内部发生值得用户关注的状态变化时, 通知用户的事件类型
*/
t... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/mqtt/module_mqtt.h | C | apache-2.0 | 2,106 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aos/kv.h"
#include "aiot_state_api.h"
#include "aiot_sysdep_api.h"
#include "aiot_mqtt_api.h"
#include "module_mqtt.h"
#define MOD_STR "MODULE_MQTT... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/mqtt/module_mqtt_client.c | C | apache-2.0 | 11,324 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "netmgr_wifi.h"
#include "amp_task.h"
#include "aos/list.h"
#include "quickjs.h"
#includ... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/netmgr/module_netmgr.c | C | apache-2.0 | 22,271 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "amp_platform.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "amp_memory.h"
#include "aos_system.h"
#include "aos_tcp.h"
#include ... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/tcp/module_tcp.c | C | apache-2.0 | 13,822 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_config.h"
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_utils.h"
#include "amp_task.h"
#include "amp_defines.h"
#include "aos_udp.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#ifndef INET_ADDRSTRLEN
#define IN... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/network/udp/module_udp.c | C | apache-2.0 | 15,773 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#ifndef __AMP_REPL_H
#define __AMP_REPL_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef JSE_HW_ADDON_GPIO
void module_gpio_register(void);
#endif
#ifdef JSE_HW_ADDON_IR
void module_ir_re... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/quickjs_addon.h | C | apache-2.0 | 2,293 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
/* #define LOG_NDEBUG 0
*/
#include <stdint.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "repl.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "MODULE_REPL"
static... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/repl/module_repl.c | C | apache-2.0 | 5,748 |
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_task.h"
#include "amp_defines.h"
#include "aos_hal_uart.h"
#include "quickjs.h"
#include "rep... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/repl/repl.c | C | apache-2.0 | 2,872 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#ifndef __AMP_REPL_H
#define __AMP_REPL_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define REPL_OK 0
#define REPL_ERR_NOMEM -10000
#define REPL_ERR_DENIED -10001
#define REPL_ERR_INVALID -10002
#define REPL_ERR_BADCMD -10003
#define R... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/repl/repl.h | C | apache-2.0 | 822 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "amp_platform.h"
#include "aos/kernel.h"
#include "aos/vfs.h"
#include "aos_fs.h"
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_sy... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/builtin/module_builtin.c | C | apache-2.0 | 2,227 |
/* aes_decrypt.c - TinyCrypt implementation of AES decryption procedure */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistribu... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/aes_decrypt.c | C | apache-2.0 | 6,348 |
/* aes_encrypt.c - TinyCrypt implementation of AES encryption procedure */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistribu... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/aes_encrypt.c | C | apache-2.0 | 6,897 |
/* cbc_mode.c - TinyCrypt implementation of CBC mode encryption & decryption */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redis... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/cbc_mode.c | C | apache-2.0 | 3,816 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "stdio.h"
#include "stdint.h"
#include "stdbool.h"
#include "string.h"
#include "crypto_adapter.h"
#include "tinycrypt/aes.h"
#include "tinycrypt/constants.h"
#include "tinycrypt/cbc_mode.h"
const uint8_t aes_iv[16] =
{
0x31, ... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/crypto_adapter.c | C | apache-2.0 | 3,313 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#ifndef _CRYPTO_ADAPTER_
#define _CRYPTO_ADAPTER_
#define ENC_KEY_SIZE 16
typedef enum{
Encrypt_mode_AES_CBC,
Encrypt_mode_AES_CCM,
}Encrypt_mode;
#endif
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/crypto_adapter.h | C | apache-2.0 | 252 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_utils.h"
//#include "be_inl.h"
#include "mbedtls/md5.h"
#include "quickjs.h"
#include "crypto_adapter.h"
#include "quickjs_addon_common.h"
#define MOD... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/module_crypto.c | C | apache-2.0 | 6,804 |
/* aes.h - TinyCrypt interface to an AES-128 implementation */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of sou... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/tinycrypt/aes.h | C | apache-2.0 | 5,330 |
/* cbc_mode.h - TinyCrypt interface to a CBC mode implementation */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions o... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/tinycrypt/cbc_mode.h | C | apache-2.0 | 6,858 |
/* constants.h - TinyCrypt interface to constants */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code m... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/tinycrypt/constants.h | C | apache-2.0 | 2,024 |
/* utils.h - TinyCrypt interface to platform-dependent run-time operations */
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistr... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/crypto/tinycrypt/utils.h | C | apache-2.0 | 3,233 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "aos/kernel.h"
#include "aos/vfs.h"
#include "aos_system.h"
#include "amp_platform.h"
#include "amp_config.h"
#include "aos_fs.h"
#include "amp_defines.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "FS"
static JSClas... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/fs/module_fs.c | C | apache-2.0 | 11,041 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_config.h"
#include "aos/kv.h"
#include "amp_defines.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#include "aos_system.h"
#define MOD_STR "KV"
#define KV_BUFFER_MAX_LEN 256
static JSClassID js_kv_class_id;
static JSValue nat... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/kv/module_kv.c | C | apache-2.0 | 3,864 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_system.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "LOG"
#define SCRIPT "JSLOG"
#define LOG_LEVEL_DEBUG "debug"
#define LOG_LEVEL_INFO "info"
#define LOG_L... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/log/module_log.c | C | apache-2.0 | 8,727 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include "amp_config.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "amp_utils.h"
#include "quickjs.h"
#include "quickjs_addon_common.h"
#define MOD_STR "SYSTEM"
extern const ch... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/system/module_system.c | C | apache-2.0 | 6,029 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include "amp_config.h"
#include "amp_defines.h"
#include "aos_system.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "amp_task.h"
#include "aos/list.h"
#include "quickjs.h"
#include "quickjs_addon_common.h... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/systimer/module_systimer.c | C | apache-2.0 | 6,293 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifdef AMP_ADVANCED_ADDON_UI
#include "aos_fs.h"
#include "aos_system.h"
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "cJSON.h"
#include "app_entry.h"
#include "quickjs_addon_c... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/app_entry.c | C | apache-2.0 | 2,624 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef __APP_ENTRY_H
#define __APP_ENTRY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
/* options object */
int object;
/* ref of globalData */
int global_data;
/* ref of onLaunch() */
int on_launch... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/app_entry.h | C | apache-2.0 | 527 |
#ifdef AMP_ADVANCED_ADDON_UI
#include "model_bind.h"
#define MODEL_BUFF_LEN 256
#define MODEL_STR_HEAD "var model = require('model'); model.setData({"
#define MODEL_STR_DELIMITER ":"
#define MODEL_STR_TAIL "});"
static model_bind_proc_t g_model_bind_proc = {0};
vm_msg_type_e g_msg_type = msg_invalid;
... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/model_bind.c | C | apache-2.0 | 8,511 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#ifdef AMP_ADVANCED_ADDON_UI
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "aos_network.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "amp_task.h"
#... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/module_ui.c | C | apache-2.0 | 2,389 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "amp_config.h"
#include "aos_system.h"
#include "aos_network.h"
#include "amp_defines.h"
#include "aos_network.h"
#include "amp_task.h"
#include "be_inl.h"
#define M... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/module_vm.c | C | apache-2.0 | 1,851 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifdef AMP_ADVANCED_ADDON_UI
#include "aos_fs.h"
#include "aos_system.h"
#include "amp_config.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "board_mgr.h"
#include "quickjs.h"
#include "cJSON.h"
#include "page_entry.h"
#include "render.h"
#inc... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/page_entry.c | C | apache-2.0 | 6,939 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef __PAGE_ENTRY_H
#define __PAGE_ENTRY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "infra_list.h"
#include "render.h"
extern void page_list_init(void);
extern void page_list_add(const char *route);
extern void page_list_du... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/utils/ui/page_entry.h | C | apache-2.0 | 540 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <aos/errno.h>
#include <aos/kernel.h>
#include "aos/init.h"
#include "board.h"
#include <k_api.h>
#include <aos/ble.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/conn.h>
#includ... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/wireless/bt_host/bt_gatts_adapter.c | C | apache-2.0 | 13,451 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <aos/ble.h>
#include <aos/errno.h>
#include <aos/kernel.h>
#include <atomic.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/conn.h>
#include <bluetooth/gatt.h>
#include <bluetooth/uuid.h>
#include <k_api.h>
#include <stdint.h>
#include <st... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/wireless/bt_host/bt_host_adapter.c | C | apache-2.0 | 8,344 |
#ifndef _BT_HOST_ADAPTER_H_
#define _BT_HOST_ADAPTER_H_
typedef struct {
char *dev_name;
uint16_t conn_num_max;
}amp_bt_host_adapter_init_t;
typedef struct {
int32_t type;
char *adv_data;
char *scan_rsp_data;
int32_t interval_min;
int32_t interval_max;
int32_t channel_map;
}amp_bt_hos... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/wireless/bt_host/bt_host_adapter.h | C | apache-2.0 | 1,533 |
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "amp_platform.h"
#include "aos_system.h"
#include "amp_defines.h"
#include "amp_task.h"
#include "aiot_state_api.h"
#include "bt_host_adapter.h"
#include "cJSON.h"
#include "quickjs.h"
#... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/addons/wireless/bt_host/module_bt_host.c | C | apache-2.0 | 18,694 |
#ifndef AOS_AMP_PORT_H
#define AOS_AMP_PORT_H
#include "aos_fenv.h"
#include "aos_jquick_mutex.h"
#include "aos_system.h"
#include "amp_memory.h"
#define printf(...) aos_printf(__VA_ARGS__)
#endif
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/aos_port/aos_amp_port.h | C | apache-2.0 | 201 |
#ifndef FENV_AOS_H
#define FENV_AOS_H
enum
{
FE_INVALID = 0x01,
#define FE_INVALID FE_INVALID
__FE_DENORM = 0x02,
FE_DIVBYZERO = 0x04,
#define FE_DIVBYZERO FE_DIVBYZERO
FE_OVERFLOW = 0x08,
#define FE_OVERFLOW FE_OVERFLOW
FE_UNDERFLOW = 0x10,
#define FE_UNDERFLOW FE_UNDERFLOW
FE_INEXAC... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/aos_port/aos_fenv.h | C | apache-2.0 | 622 |
#include <stdlib.h>
#include "aos_jquick_mutex.h"
#include "aos/kernel.h"
#include "ulog/ulog.h"
#define MOD_STR "JQUICK_MUTEX"
JQuick_Mutex jquick_mutex_create()
{
aos_mutex_t mutex;
if (0 != aos_mutex_new(&mutex)) {
return NULL;
}
return (JQuick_Mutex)mutex;
}
int jquick_mutex_lock(JQuick... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/aos_port/aos_jquick_mutex.c | C | apache-2.0 | 915 |
#ifndef __AOS_AMP_JQUICK_MUTEX_H__
#define __AOS_AMP_JQUICK_MUTEX_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef void* JQuick_Mutex;
JQuick_Mutex jquick_mutex_create();
int jquick_mutex_lock(
JQuick_Mutex m);
int jquick_mutex_unlock(
JQuick_Mutex m);
int jquick_mutex_destroy(
JQuick_M... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/aos_port/aos_jquick_mutex.h | C | apache-2.0 | 403 |
set(CMAKE_INSTALL_PREFIX ${PRODUCT_DEPLOY_DIR})
add_definitions(-D_GNU_SOURCE)
add_definitions(-DCONFIG_VERSION="2020-04-12")
#add_definitions(-DCONFIG_BIGNUM)
add_definitions(-DCONFIG_LTO)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -pipe -Wno-narrowing -funwind-tab... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/CMakeLists.txt | CMake | apache-2.0 | 1,071 |
#
# QuickJS Javascript Engine
#
# Copyright (c) 2017-2020 Fabrice Bellard
# Copyright (c) 2017-2020 Charlie Gordon
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, inclu... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/Makefile | Makefile | apache-2.0 | 12,243 |
/*
* C utilities
*
* Copyright (c) 2017 Fabrice Bellard
* Copyright (c) 2018 Charlie Gordon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without l... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/cutils.c | C | apache-2.0 | 16,925 |
/*
* C utilities
*
* Copyright (c) 2017 Fabrice Bellard
* Copyright (c) 2018 Charlie Gordon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without l... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/cutils.h | C | apache-2.0 | 7,403 |
/*
* QuickJS: Example of C module
*
* Copyright (c) 2017-2018 Fabrice Bellard
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the r... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/fib.c | C | apache-2.0 | 2,291 |
/* fib module */
export function fib(n)
{
if (n <= 0)
return 0;
else if (n == 1)
return 1;
else
return fib(n - 1) + fib(n - 2);
}
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/fib_module.js | JavaScript | apache-2.0 | 166 |
console.log("Hello World");
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/hello.js | JavaScript | apache-2.0 | 28 |
/* example of JS module */
import { fib } from "./fib_module.js";
console.log("Hello World");
console.log("fib(10)=", fib(10));
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/hello_module.js | JavaScript | apache-2.0 | 130 |
/*
* PI computation in Javascript using the QuickJS bigdecimal type
* (decimal floating point)
*/
"use strict";
/* compute PI with a precision of 'prec' digits */
function calc_pi(prec) {
const CHUD_A = 13591409m;
const CHUD_B = 545140134m;
const CHUD_C = 640320m;
const CHUD_C3 = 10939058860032000m;... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/pi_bigdecimal.js | JavaScript | apache-2.0 | 2,128 |
/*
* PI computation in Javascript using the QuickJS bigfloat type
* (binary floating point)
*/
"use strict";
/* compute PI with a precision of 'prec' bits */
function calc_pi() {
const CHUD_A = 13591409n;
const CHUD_B = 545140134n;
const CHUD_C = 640320n;
const CHUD_C3 = 10939058860032000n; /* C^3/2... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/pi_bigfloat.js | JavaScript | apache-2.0 | 1,977 |
/*
* PI computation in Javascript using the BigInt type
*/
"use strict";
/* return floor(log2(a)) for a > 0 and 0 for a = 0 */
function floor_log2(a)
{
var k_max, a1, k, i;
k_max = 0n;
while ((a >> (2n ** k_max)) != 0n) {
k_max++;
}
k = 0n;
a1 = a;
for(i = k_max - 1n; i >= 0n; i--... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/pi_bigint.js | JavaScript | apache-2.0 | 2,834 |
/*
* QuickJS: Example of C module with a class
*
* Copyright (c) 2019 Fabrice Bellard
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitati... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/point.c | C | apache-2.0 | 4,817 |
/* example of JS module importing a C module */
import { fib } from "./fib.so";
console.log("Hello World");
console.log("fib(10)=", fib(10));
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/test_fib.js | JavaScript | apache-2.0 | 144 |
/* example of JS module importing a C module */
import { Point } from "./point.so";
function assert(b, str)
{
if (b) {
return;
} else {
throw Error("assertion failed: " + str);
}
}
class ColorPoint extends Point {
constructor(x, y, color) {
super(x, y);
this.color = col... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/examples/test_point.js | JavaScript | apache-2.0 | 718 |
make qjsc
| YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/gen_qjsc.sh | Shell | apache-2.0 | 10 |
/*
* Javascript Compressor
*
* Copyright (c) 2008-2018 Fabrice Bellard
* Copyright (c) 2017-2018 Charlie Gordon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction,... | YifuLiu/AliOS-Things | components/amp/engine/quickjs_engine/quickjs/jscompress.c | C | apache-2.0 | 25,033 |