| 1 |
|
| 2 |
|
| 3 |
#include "loadfuncpp.h" |
| 4 |
#include "iload.h" |
| 5 |
|
| 6 |
#define GPX 1 //enables polling for events when calling Icon from C++ |
| 7 |
|
| 8 |
namespace icall { |
| 9 |
//remove interference with icon/src/h/rt.h |
| 10 |
#undef D_Null |
| 11 |
#undef D_Integer |
| 12 |
#undef D_Lrgint |
| 13 |
#undef D_Real |
| 14 |
#undef D_File |
| 15 |
#undef D_Proc |
| 16 |
#undef D_External |
| 17 |
#undef Fs_Read |
| 18 |
#undef Fs_Write |
| 19 |
#undef F_Nqual |
| 20 |
#undef F_Var |
| 21 |
|
| 22 |
#include "xinterp.cpp" |
| 23 |
|
| 24 |
#ifdef __CYGWIN__ |
| 25 |
extern "C" { |
| 26 |
typedef int icallfunction(dptr procptr, dptr arglistptr, dptr result); |
| 27 |
}; |
| 28 |
extern icallfunction *icall2; |
| 29 |
#endif //cywgin |
| 30 |
|
| 31 |
}; |
| 32 |
|
| 33 |
#ifdef __CYGWIN__ |
| 34 |
|
| 35 |
//linking constraints make us do our own linking |
| 36 |
class linkicall { |
| 37 |
public: |
| 38 |
linkicall() { //assign our icall to a function pointer in iload.so |
| 39 |
icall::icall2 = &(icall::icall); |
| 40 |
} |
| 41 |
}; |
| 42 |
static linkicall load; |
| 43 |
|
| 44 |
#else //not cygwin |
| 45 |
//call an Icon procedure that always returns a value and never suspends |
| 46 |
value Value::call(const value& proc, const value& arglist) { |
| 47 |
value result; |
| 48 |
icall::icall( (icall::dptr)(&proc), (icall::dptr)(&arglist), (icall::dptr)(&result) ); |
| 49 |
return result; |
| 50 |
} |
| 51 |
|
| 52 |
#endif //not cywgin |
| 53 |
|
| 54 |
//succeed if graphics are present, fail otherwise |
| 55 |
extern "C" int iconx_graphics(value argv[]) { |
| 56 |
argv[0] = nullvalue; |
| 57 |
return SUCCEEDED; |
| 58 |
} |
| 59 |
|
| 60 |
//put Icon graphics keywords and functions here |
| 61 |
//plus access to the event queue for new I/O events associated with sockets |
| 62 |
|
| 63 |
|
| 64 |
|