Unnamed Fossil Project

Check-in [142edc1744]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:* SIZE is wrapper around internal structure _SIZE_ + using ASSERT for checking input parameters at *SIZE* methods * make-size function can receives two (WIDTH HEIGHT) and fourth (width: WIDTH height: HEIGHT) parameters
Timelines: family | ancestors | descendants | both | tui
Files: files | file ages | folders
SHA1:142edc1744f01bb98b4f2ce95c5da040cfcc7724
User & Date: vasalvit 2011-11-08 05:32:56
Context
2011-11-08
15:56
* RECT is wrapper around internal structure _RECT_ + using ASSERT for checking input parameters at *RECT* methods * make-rect function can receives two (ORIGIN SIZE) and fourth (origin: ORIGIN size: SIZE) parameters check-in: 9c8d6683b7 user: vasalvit tags: tui
05:32
* SIZE is wrapper around internal structure _SIZE_ + using ASSERT for checking input parameters at *SIZE* methods * make-size function can receives two (WIDTH HEIGHT) and fourth (width: WIDTH height: HEIGHT) parameters check-in: 142edc1744 user: vasalvit tags: tui
04:50
+ POINT is wrapper aroung internal structure _POINT_ + using ASSERT for checking input parameters * make-point function can work with two parameters (X Y) and fourth (x: X y: Y) check-in: cfa2ad8a2f user: vasalvit tags: tui
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sources/libraries/tui/primitives.scm.

6
7
8
9
10
11
12


13
14
15
16
17
18
19
..
53
54
55
56
57
58
59
60
























61
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
;               03.11.2011              vasalvit
;                       First version
;               07.11.2011              vasalvit
;                       New internal structure _POINT_, all *POINT* methods
;                       are wrappers around *_POINT_* methods.
;               08.11.2011
;                       Assert's checking for *POINT* methods.


;               
(require-extension defstruct)

;       POINT
;               One point on a screen.  POINT consists of two values:
;               X (number) and Y (number).
(defstruct _point_ x y)
................................................................................
(define (alist->point l)
        (assert (pair? l))
        (make-point x: (cdr (assq 'x l)) y: (cdr (assq 'y l))))

;       SIZE
;               Represents size of rectangle on a screen.  SIZE consists of two
;               values - WIDTH (number) and HEIGHT (number).
(defstruct size width height)
























(define empty-size
        (make-size width: 0 height: 0))
(define (size-width-set! s w)
        (make-size width: w  height: (size-height s)))
(define (size-height-set! s h)
        (make-size height: h width: (size-width s)))
(define (size->alist s)
        (list (cons 'width (size-width s)) (cons 'height (size-height s))))
(define (alist->size l)

        (make-size width: (cdr (assq 'width l)) height: (cdr (assq 'height l))))

;       RECT
;               Represents rectangle on a screen.  RECT consists of two values:
;               ORIGIN (origin, POINT) and SIZE (size, SIZE).
(defstruct rect origin size)
(define empty-rect







>
>







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
;               03.11.2011              vasalvit
;                       First version
;               07.11.2011              vasalvit
;                       New internal structure _POINT_, all *POINT* methods
;                       are wrappers around *_POINT_* methods.
;               08.11.2011
;                       Assert's checking for *POINT* methods.
;                       *SIZE* methods is wrappers around internal *_SIZE_*
;                       methods.
;               
(require-extension defstruct)

;       POINT
;               One point on a screen.  POINT consists of two values:
;               X (number) and Y (number).
(defstruct _point_ x y)
................................................................................
(define (alist->point l)
        (assert (pair? l))
        (make-point x: (cdr (assq 'x l)) y: (cdr (assq 'y l))))

;       SIZE
;               Represents size of rectangle on a screen.  SIZE consists of two
;               values - WIDTH (number) and HEIGHT (number).
(defstruct _size_ width height)
(define (mksize w h)
        (assert (number? w))
        (assert (number? h))
        (make-_size_ width: w height: h))
(define size
        (case-lambda
                [(w h)
                        (mksize w h)]
                [(a b c d)
                        (assert (or
                                (and (eq? a 'width:) (eq? c 'height:))
                                (and (eq? a 'height:) (eq? c 'width:))))
                        (cond
                                [(eq? a 'width:) (mksize b d)]
                                [else            (mksize d b)])]))
(define make-size size)
(define (size? s)
        (_size_? s))
(define (size-width s)
        (assert (size? s))
        (_size_-width s))
(define (size-height s)
        (assert (size? s))
        (_size_-height s))
(define empty-size
        (make-size width: 0 height: 0))
(define (size-width-set! s w)
        (make-size width: w  height: (size-height s)))
(define (size-height-set! s h)
        (make-size height: h width: (size-width s)))
(define (size->alist s)
        (list (cons 'width (size-width s)) (cons 'height (size-height s))))
(define (alist->size l)
        (assert (pair? l))
        (make-size width: (cdr (assq 'width l)) height: (cdr (assq 'height l))))

;       RECT
;               Represents rectangle on a screen.  RECT consists of two values:
;               ORIGIN (origin, POINT) and SIZE (size, SIZE).
(defstruct rect origin size)
(define empty-rect