Skip to content

Commit

Permalink
Merge branch 'main' into osnr/checkerboard-calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
osnr committed Jun 18, 2024
2 parents 6568021 + e8ef99d commit a6bdc55
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/c.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ namespace eval c {
#include <setjmp.h>

jmp_buf __onError;
Tcl_Interp* __interp;

#define __ENSURE(EXPR) if (!(EXPR)) { Tcl_SetResult(interp, "failed to convert argument from Tcl to C in: " #EXPR, NULL); longjmp(__onError, 0); }
#define __ENSURE_OK(EXPR) if ((EXPR) != TCL_OK) { longjmp(__onError, 0); }

#define FOLK_ERROR(MSG) do { Tcl_SetResult(__interp, MSG, NULL); longjmp(__onError, 0); } while (0)
#define FOLK_ENSURE(EXPR) if (!(EXPR)) { Tcl_SetResult(__interp, "assertion failed: " #EXPR, NULL); longjmp(__onError, 0); }
#define FOLK_CHECK(EXPR, MSG) if (!(EXPR)) { FOLK_ERROR(MSG); }
}
variable code [list]
variable objtypes [list]
Expand Down Expand Up @@ -457,6 +462,7 @@ namespace eval c {
Tcl_SetResult(interp, "Wrong number of arguments to $name", NULL);
return TCL_ERROR;
}
__interp = interp;
int __r = setjmp(__onError);
if (__r != 0) { return TCL_ERROR; }

Expand Down

0 comments on commit a6bdc55

Please sign in to comment.