FolkComputer / folk

🎁 Physical computing system.
https://folk.computer
Apache License 2.0
100 stars 4 forks source link

region convex-hull in C #111

Closed tobyshooters closed 11 months ago

tobyshooters commented 1 year ago

The C-FFI output for reference:

int arr_objc;
Tcl_Obj ** arr_objv;
__ENSURE_OK(Tcl_ListObjGetElements(interp, objv[1 + 0], & arr_objc, & arr_objv));

int arr[arr_objc][2];
{
  for (int i = 0; i < arr_objc; i++) {

    int arr_i_objc;
    Tcl_Obj ** arr_i_objv;
    __ENSURE_OK(Tcl_ListObjGetElements(interp, arr_objv[i], & arr_i_objc, & arr_i_objv));

    int arr_i[arr_i_objc];
    {
      for (int i = 0; i < arr_i_objc; i++) {
        int arr_i_i;
        __ENSURE_OK(Tcl_GetIntFromObj(interp, arr_i_objv[i], & arr_i_i));
        arr_i[i] = arr_i_i;
      }
    }

    memcpy(arr[i], arr_i, sizeof(arr_i));
  }
}
osnr commented 12 months ago

@l3gacyb3ta @cwervo @nmichaud any interest in testing this? I will too but it's clearly slipped my mind so far

l3gacyb3ta commented 12 months ago

Will do later today!