22#ifndef DIRECTOR_LINGO_LINGO_UTILS_H
23#define DIRECTOR_LINGO_LINGO_UTILS_H
25#define ARGNUMCHECK(n) \
27 warning("BUILDBOT: %s: expected %d argument%s, got %d", __FUNCTION__, (n), ((n) == 1 ? "" : "s"), nargs); \
28 g_lingo->dropStack(nargs); \
32#define TYPECHECK(datum,t) \
33 if ((datum).type != (t)) { \
34 warning("BUILDBOT: %s: %s arg should be of type %s, not %s", __FUNCTION__, #datum, #t, (datum).type2str()); \
38#define TYPECHECK2(datum, t1, t2) \
39 if ((datum).type != (t1) && (datum).type != (t2)) { \
40 warning("BUILDBOT: %s: %s arg should be of type %s or %s, not %s", __FUNCTION__, #datum, #t1, #t2, (datum).type2str()); \
44#define TYPECHECK3(datum, t1, t2, t3) \
45 if ((datum).type != (t1) && (datum).type != (t2) && (datum).type != (t3)) { \
46 warning("BUILDBOT: %s: %s arg should be of type %s, %s, or %s, not %s", __FUNCTION__, #datum, #t1, #t2, #t3, (datum).type2str()); \
50#define TYPECHECK4(datum, t1, t2, t3, t4) \
51 if ((datum).type != (t1) && (datum).type != (t2) && (datum).type != (t3) && (datum).type != (t4)) { \
52 warning("BUILDBOT: %s: %s arg should be of type %s, %s, %s, or %s, not %s", __FUNCTION__, #datum, #t1, #t2, #t3, #t4, (datum).type2str()); \
56#define ARRBOUNDSCHECK(idx,array) \
57 if ((idx)-1 < 0 || (idx) > (int)(array).u.farr->arr.size()) { \
58 g_lingo->lingoError("%s: index out of bounds (%d of %d)", __FUNCTION__, (idx), (array).u.farr->arr.size()); \
62#define XOBJSTUB(methname,retval) \
63 void methname(int nargs) { \
64 g_lingo->printSTUBWithArglist(#methname, nargs); \
65 g_lingo->dropStack(nargs); \
66 g_lingo->push(Datum(retval)); \
69#define XOBJSTUBV(methname) \
70 void methname(int nargs) { \
71 g_lingo->printSTUBWithArglist(#methname, nargs); \
72 g_lingo->dropStack(nargs); \
73 g_lingo->push(Datum()); \
76#define XOBJSTUBNR(methname) \
77 void methname(int nargs) { \
78 g_lingo->printSTUBWithArglist(#methname, nargs); \
79 g_lingo->dropStack(nargs); \