summaryrefslogtreecommitdiff
path: root/ipl/packs/loadfuncpp/examples/runerr.cpp
blob: e572133336676f39ae62add8f534e072cb1fc0a2 (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

/* Example of a C++ extension to icon via loadfunc,
 * without garbage collection difficulties.
 * Type 'make iexample' to build.
 * Carl Sturtivant, 2007/9/25
 */

#include "loadfuncpp.h"

#include<stdio.h>

extern "C" int iexample(value argv[]) {
    safe callme(argv[1]), text(argv[2]);
	printf("Calling callme\n");
	callme();	
	printf("Callme returned\n");
	printf("Calling callme\n");
	callme();
	printf("Callme returned\n");
	//Icon::runerr(123, text);
    return FAILED;
}

extern "C" int iexample2(value argv[]) {
	//Icon::display(&Icon::level, &Icon::output);
	safe nextcall(argv[1]), rerr(argv[2]);
	nextcall();
	rerr(123, "Bye!");
	//Icon::runerr(123, "Bye!");
	return FAILED;
}