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
|
;; You should have received a copy of the GNU General Public License
;; along with Megatest. If not, see <http://www.gnu.org/licenses/>.
;; (include "vg.scm")
;; (declare (uses vg))
(use foof-loop defstruct coops)
(defstruct obj type fill-color angle)
(define (make-vg:obj)(make-vector 3))
(define-inline (vg:obj-get-type vec) (vector-ref vec 0))
(define-inline (vg:obj-get-fill-color vec) (vector-ref vec 1))
(define-inline (vg:obj-get-angle vec) (vector-ref vec 2))
(define-inline (vg:obj-set-type! vec val)(vector-set! vec 0 val))
(define-inline (vg:obj-set-fill-color! vec val)(vector-set! vec 1 val))
(define-inline (vg:obj-set-angle! vec val)(vector-set! vec 2 val))
(use simple-exceptions)
(define vgs:obj-exn (make-exception "wrong record type, expected vgs:obj." 'assert))
(define (make-vgs:obj)(let ((v (make-vector 4)))(vector-set! v 0 'vgs:obj) v))
(define-inline (vgs:obj-type vec)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-ref vec 1)(raise (vgs:obj-exn 'vgs:obj-type 'xpr))))
(define-inline (vgs:obj-fill-color vec)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-ref vec 2)(raise (vgs:obj-exn 'vgs:obj-fill-color 'xpr))))
(define-inline (vgs:obj-angle vec)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-ref vec 3)(raise (vgs:obj-exn 'vgs:obj-angle 'xpr))))
(define-inline (vgs:obj-type-set! vec val)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-set! vec 1 val)(raise (vgs:obj-exn 'type))))
(define-inline (vgs:obj-fill-color-set! vec val)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-set! vec 2 val)(raise (vgs:obj-exn 'fill-color))))
|
|
|
|
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
|
;; You should have received a copy of the GNU General Public License
;; along with Megatest. If not, see <http://www.gnu.org/licenses/>.
;; (include "vg.scm")
;; (declare (uses vg))
(import foof-loop defstruct coops)
(defstruct obj type fill-color angle)
(define (make-vg:obj)(make-vector 3))
(define-inline (vg:obj-get-type vec) (vector-ref vec 0))
(define-inline (vg:obj-get-fill-color vec) (vector-ref vec 1))
(define-inline (vg:obj-get-angle vec) (vector-ref vec 2))
(define-inline (vg:obj-set-type! vec val)(vector-set! vec 0 val))
(define-inline (vg:obj-set-fill-color! vec val)(vector-set! vec 1 val))
(define-inline (vg:obj-set-angle! vec val)(vector-set! vec 2 val))
(import simple-exceptions)
(define vgs:obj-exn (make-exception "wrong record type, expected vgs:obj." 'assert))
(define (make-vgs:obj)(let ((v (make-vector 4)))(vector-set! v 0 'vgs:obj) v))
(define-inline (vgs:obj-type vec)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-ref vec 1)(raise (vgs:obj-exn 'vgs:obj-type 'xpr))))
(define-inline (vgs:obj-fill-color vec)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-ref vec 2)(raise (vgs:obj-exn 'vgs:obj-fill-color 'xpr))))
(define-inline (vgs:obj-angle vec)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-ref vec 3)(raise (vgs:obj-exn 'vgs:obj-angle 'xpr))))
(define-inline (vgs:obj-type-set! vec val)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-set! vec 1 val)(raise (vgs:obj-exn 'type))))
(define-inline (vgs:obj-fill-color-set! vec val)(if (eq? (vector-ref vec 0) 'vgs:obj)(vector-set! vec 2 val)(raise (vgs:obj-exn 'fill-color))))
|