Cleanup
This commit is contained in:
+16
-18
@@ -74,24 +74,22 @@ void js_init() {
|
|||||||
float alang_eval(char *data);
|
float alang_eval(char *data);
|
||||||
|
|
||||||
float js_eval(const char *js) {
|
float js_eval(const char *js) {
|
||||||
|
// return alang_eval(js);
|
||||||
return alang_eval(js);
|
if (js_runtime == NULL) {
|
||||||
|
js_init();
|
||||||
// if (js_runtime == NULL) {
|
}
|
||||||
// js_init();
|
JSValue ret = JS_Eval(js_ctx, js, strlen(js), "iron", JS_EVAL_TYPE_GLOBAL);
|
||||||
// }
|
if (JS_IsException(ret)) {
|
||||||
// JSValue ret = JS_Eval(js_ctx, js, strlen(js), "iron", JS_EVAL_TYPE_GLOBAL);
|
js_std_dump_error(js_ctx);
|
||||||
// if (JS_IsException(ret)) {
|
JS_ResetUncatchableError(js_ctx);
|
||||||
// js_std_dump_error(js_ctx);
|
}
|
||||||
// JS_ResetUncatchableError(js_ctx);
|
double d;
|
||||||
// }
|
JS_ToFloat64(js_ctx, &d, ret);
|
||||||
// double d;
|
JS_RunGC(js_runtime);
|
||||||
// JS_ToFloat64(js_ctx, &d, ret);
|
if (d != d) { // nan
|
||||||
// JS_RunGC(js_runtime);
|
d = 0.0;
|
||||||
// if (d != d) { // nan
|
}
|
||||||
// d = 0.0;
|
return d;
|
||||||
// }
|
|
||||||
// return d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSValue js_call_result;
|
JSValue js_call_result;
|
||||||
|
|||||||
Reference in New Issue
Block a user