jerryscript-project / jerryscript

Ultra-lightweight JavaScript engine for the Internet of Things.
https://jerryscript.net
Apache License 2.0
6.96k stars 673 forks source link

jerryx_arg_ignore fail #5137

Closed spuggy0919 closed 13 hours ago

spuggy0919 commented 7 months ago

JERRYX_UNUSED(call_info_p); int16_t x=1; int16_t y=2; uint8_t bitmap;// *WARNNING* need to check BUFFERSIZE char buf[32];// WARNNING* need to check BUFFERSIZE int16_t w=3; int16_t h=4; uint16_t color=1; uint16_t bg=0;

const jerryx_arg_t mapping[] ={
    jerryx_arg_int16(&x, JERRYX_ARG_CEIL, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
    jerryx_arg_int16(&y, JERRYX_ARG_CEIL, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
    jerryx_arg_ignore(), // TODO process bitmap pointer later
    jerryx_arg_int16(&w, JERRYX_ARG_CEIL, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
    jerryx_arg_int16(&h, JERRYX_ARG_CEIL, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
    jerryx_arg_uint16(&color, JERRYX_ARG_CEIL, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
    jerryx_arg_uint16(&bg, JERRYX_ARG_CEIL, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_NO_COERCE, JERRYX_ARG_OPTIONAL),
};
jerry_value_t rv = jerryx_arg_transform_args(args_p, 7, mapping, 2);
if (jerry_value_is_exception(rv)){
    WSDEBUG_TPRINTF("[sd1306] drawBitmap mapping Error argc(%d) %x\n",args_cnt,rv);
    WSDEBUG_TPRINTF("[sd1306] x%d y%d w%d h%d color%d bg%d \n",x,y,w,h,color,bg);

    return rv;
}

Temporary solution to mapping 2items then mapping last 4 items separately.

root cause the jerryx_arg_transform_ignore did not use (void) js_arg_iter_p; / unused / to skip one args_p item.

LaszloLango commented 13 hours ago

Cannot reproduce. Please provide a better bug report, if you'd like this to fix.