1 Star 0 Fork 0

Li.XiongHui/juicescript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ext.c 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
Li.XiongHui 提交于 2024-02-19 16:44 . feat(JuiceScript): add new release
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "elang.h"
#define el_printf(...) do{printf(__VA_ARGS__);}while(0)
static FILE *log_fp;
int elang_ext_print(void** vm){
elang_ext_data_type_t type;
unsigned char* data;
float fnum;
el_uint32_t len;
int ret;
// el_printf("elang_ext_print\n");
ret = elang_ext_pop_arg(&vm,&type,&data,&fnum,&len);
// el_printf(" ret: %d\n type: %d data: %p fnum: %f len: %d\n",ret,type,data,fnum,len);
switch(type){
case ELANG_EXT_DATA_STR:
if(len > 0){
el_printf("%s\n",data);
}
break;
case ELANG_EXT_DATA_NIL:
el_printf("nil\n");
break;
case ELANG_EXT_DATA_FLOAT:
el_printf("%f\n",fnum);
break;
case ELANG_EXT_DATA_LIST:
el_printf("list(%d)\n",len);
break;
}
}
int elang_ext_boot_hook(void** vm){
// printf("######################## elang_ext_boot_hook ###################\n");
// log_fp = fopen("ext_log.txt","w+");
// if(NULL == log_fp) {
// printf("open failed\n");
// return -1;
// }
elang_ext_register_func(&vm,"print",elang_ext_print);
}
int elang_ext_exit_hook(void** vm){
// fclose(log_fp);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/Li_XiongHui/juicescript.git
git@gitee.com:Li_XiongHui/juicescript.git
Li_XiongHui
juicescript
juicescript
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385