File: runme.m

package info (click to toggle)
swig1.3 1.3.40-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,512 kB
  • ctags: 14,780
  • sloc: cpp: 41,436; ansic: 31,416; python: 9,313; java: 7,332; makefile: 5,264; cs: 5,231; yacc: 4,995; sh: 4,646; ruby: 3,774; perl: 3,638; lisp: 1,993; php: 1,736; tcl: 1,266; ml: 708
file content (24 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# file: runme.m

example 

a = 37
b = 42

# Now call our C function with a bunch of callbacks

printf("Trying some C callback functions\n");
printf("    a        = %i\n", a);
printf("    b        = %i\n", b);
printf("    ADD(a,b) = %i\n", example.do_op(a,b,example.ADD));
printf("    SUB(a,b) = %i\n", example.do_op(a,b,example.SUB));
printf("    MUL(a,b) = %i\n", example.do_op(a,b,example.MUL));

printf("Here is what the C callback function objects look like in Octave\n");
example.ADD
example.SUB
example.MUL

printf("Call the functions directly...\n");
printf("    add(a,b) = %i\n", example.add(a,b));
printf("    sub(a,b) = %i\n", example.sub(a,b));