summaryrefslogtreecommitdiff
path: root/ipl/packs/loadfuncpp/iloadgpx.cpp
blob: fa774f0db5e6f65e83856daf430318b7bf2bca6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64


#include "loadfuncpp.h"
#include "iload.h"

#define GPX 1	//enables polling for events when calling Icon from C++

namespace icall {
//remove interference with icon/src/h/rt.h
#undef D_Null
#undef D_Integer
#undef D_Lrgint
#undef D_Real
#undef D_File
#undef D_Proc
#undef D_External
#undef Fs_Read
#undef Fs_Write
#undef F_Nqual
#undef F_Var

#include "xinterp.cpp"

#ifdef __CYGWIN__
extern "C" {
	typedef int icallfunction(dptr procptr, dptr arglistptr, dptr result);
};
	extern icallfunction *icall2;
#endif //cywgin

};

#ifdef __CYGWIN__

//linking constraints make us do our own linking
class linkicall {
  public:
	linkicall() {	//assign our icall to a function pointer in iload.so
		icall::icall2 = &(icall::icall);
	}
};
static linkicall load;

#else //not cygwin
//call an Icon procedure that always returns a value and never suspends
value Value::call(const value& proc, const value& arglist) {
	value result;
	icall::icall( (icall::dptr)(&proc), (icall::dptr)(&arglist), (icall::dptr)(&result) );
	return result; 
}

#endif //not cywgin

//succeed if graphics are present, fail otherwise
extern "C" int iconx_graphics(value argv[]) {
	argv[0] = nullvalue;
	return SUCCEEDED;
}

//put Icon graphics keywords and functions here
//plus access to the event queue for new I/O events associated with sockets