-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
portability: global structs cant be statically initialized with external symbols #3
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
static const JSCFunctionListEntry js_math_funcs[] = { | ||
JS_CFUNC_MAGIC_DEF("min", 2, js_math_min_max, 0 ), | ||
JS_CFUNC_MAGIC_DEF("max", 2, js_math_min_max, 1 ), | ||
JS_CFUNC_SPECIAL_DEF("abs", 1, f_f, fabs ), | ||
JS_CFUNC_SPECIAL_DEF("floor", 1, f_f, floor ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry just noticed one thing that I missed last time 😓 Is there a reason floor()
and ceil()
are wrapped but not fabs()
, acos()
, etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the compiler didnt complained about those.. for some unknown reason
@@ -42193,14 +42193,29 @@ static JSValue js_math_random(JSContext *ctx, JSValueConst this_val, | |||
return __JS_NewFloat64(ctx, u.d - 1.0); | |||
} | |||
|
|||
static double qjs_ceil(double x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking closer at the QuickJS style, it looks like we should fix two inconsistencies here:
- namespace these like the other functions here, e.g.
js_math_ceil()
instead ofqjs_ceil()
- make sure the function definitions are in the same order here as they are down in
js_math_funcs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm not really. the js_* functions are javascript functions. what im wrapping here is libc functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh well. seems like js_math is also used to wrap c functions. so its a bit inconsistent. but ill follow their inconsistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the convnetion is just prefix them with js_
because the direct calls are accessed thru the f_f
and f_f_f
functions and those are the ones that handle the js context instead
No description provided.