1 ;; This file illustrates the proxy C++ interface generated
4 (load-library 'example "class_proxy.so")
5 (declare (uses example))
6 (declare (uses tinyclos))
8 ;; ----- Object creation -----
10 (display "Creating some objects:\n")
11 (define c (make <Circle> 10.0))
12 (display " Created circle ")
15 (define s (make <Square> 10.0))
16 (display " Created square ")
20 ;; ----- Access a static member -----
22 (display "\nA total of ")
23 (display (Shape-nshapes))
24 (display " shapes were created\n")
26 ;; ----- Member data access -----
28 ;; Set the location of the object
33 (slot-set! s 'x -10.0)
36 (display "\nHere is their current position:\n")
37 (display " Circle = (")
38 (display (slot-ref c 'x))
40 (display (slot-ref c 'y))
42 (display " Square = (")
43 (display (slot-ref s 'x))
45 (display (slot-ref s 'y))
48 ;; ----- Call some methods -----
50 (display "\nHere are some properties of the shapes:\n")
59 (display " perimeter = ")
60 (display (perimeter o))
65 (display "\nGuess I'll clean up now\n")
67 ;; Note: Invoke the virtual destructors by forcing garbage collection
72 (display (Shape-nshapes))
73 (display " shapes remain\n")