File: test02.dats

package info (click to toggle)
ats2-lang 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 40,064 kB
  • sloc: ansic: 389,637; makefile: 7,123; lisp: 812; sh: 657; php: 573; python: 387; perl: 365
file content (69 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download | duplicates (4)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(*
** Author: Hongwei Xi
** Authoremail: gmhwxiATgmailDOTcom
** Start time: September, 2013
*)

(* ****** ****** *)

extern
fun{}
draw_row
(
  pul: point, c1: color, c2: color, n: intGte(0)
) : void // end of [draw_row]

(* ****** ****** *)

implement
{}(*tmp*)
draw_row
  (pul, c1, c2, n) = let
//
fun loop
(
  pul: point
, clr1: color, clr2: color
, n: intGte(0)
) : void =
  if n > 0 then let
    val () = mydraw_new_path ()
    val (
    ) = mydraw_rectangle (pul, 1.0, 1.0)
    val () = mydraw_fill_set_rgb (clr1.r(), clr1.g(), clr1.b())
    val () = mydraw_fill ()
    val () = mydraw_close_path ()
  in
    loop (point_hshift (pul, 1.0), clr2, clr1, pred(n))
  end else () // end of [if]
//
in
  loop (pul, c1, c2, n)
end // end of [draw_row]

(* ****** ****** *)

extern
fun{} draw_mrow
(
  pul: point, c1: color, c2: color, m: intGte(0), n: intGte(0)
) : void // end of [draw_mrow]

(* ****** ****** *)

implement{
} draw_mrow
  (pul, c1, c2, m, n) = let
in
//
if m > 0 then let
  val () = draw_row (pul, c1, c2, n)
in
  draw_mrow (point_vshift (pul, 1.0), c2, c1, pred(m), n)
end else () // end of [if]
//
end // end of [draw_mrow]

(* ****** ****** *)

(* end of [test02.dats] *)