Debian Codegraph @

ipl/packs/loadfuncpp/doc/isexternal.cpp

raw
1
2
3 /* Example of a C++ extension to icon via loadfunc,
4 * without garbage collection difficulties.
5 * Type 'make iexample' to build.
6 * Carl Sturtivant, 2008/3/16
7 */
8
9
10 #include "loadfuncpp.h"
11 using namespace Icon;
12
13 class myval: public external {
14 public:
15 virtual value name() { return "my external"; }
16 };
17
18 extern "C" int myext(value argv[]) {
19 argv[0] = new myval();
20 return SUCCEEDED;
21 }
22
23 extern "C" int ismine(value argv[]) {
24 if( argv[1].isExternal("my external") )
25 argv[0] = "Yes!";
26 else
27 argv[0] = "No!";
28 return SUCCEEDED;
29 }
30
31