Subversion Repositories Kolibri OS

Rev

Rev 6613 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6613 Rev 7597
1
(*
1
(*
2
    Copyright 2016 Anton Krotov
2
    Copyright 2016, 2018 Anton Krotov
3
 
3
 
4
    This program is free software: you can redistribute it and/or modify
4
    This program is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU Lesser General Public License as published by
5
    it under the terms of the GNU Lesser General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
7
    (at your option) any later version.
8
 
8
 
9
    This program is distributed in the hope that it will be useful,
9
    This program is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU Lesser General Public License for more details.
12
    GNU Lesser General Public License for more details.
13
 
13
 
14
    You should have received a copy of the GNU Lesser General Public License
14
    You should have received a copy of the GNU Lesser General Public License
15
    along with this program.  If not, see .
15
    along with this program.  If not, see .
16
*)
16
*)
17
 
17
 
18
MODULE Console;
18
MODULE Console;
19
 
19
 
-
 
20
IMPORT ConsoleLib, In, Out;
20
IMPORT ConsoleLib;
21
 
21
 
22
 
22
CONST
23
CONST
23
 
24
 
24
  Black* = 0;     Blue* = 1;          Green* = 2;       Cyan* = 3;
25
    Black* = 0;      Blue* = 1;           Green* = 2;        Cyan* = 3;
25
  Red* = 4;       Magenta* = 5;       Brown* = 6;       LightGray* = 7;
26
    Red* = 4;        Magenta* = 5;        Brown* = 6;        LightGray* = 7;
26
  DarkGray* = 8;  LightBlue* = 9;     LightGreen* = 10; LightCyan* = 11;
27
    DarkGray* = 8;   LightBlue* = 9;      LightGreen* = 10;  LightCyan* = 11;
27
  LightRed* = 12; LightMagenta* = 13; Yellow* = 14;     White* = 15;
28
    LightRed* = 12;  LightMagenta* = 13;  Yellow* = 14;      White* = 15;
-
 
29
 
28
 
30
 
29
PROCEDURE SetCursor*(X, Y: INTEGER);
31
PROCEDURE SetCursor* (X, Y: INTEGER);
30
BEGIN
32
BEGIN
31
  ConsoleLib.set_cursor_pos(X, Y)
33
    ConsoleLib.set_cursor_pos(X, Y)
32
END SetCursor;
34
END SetCursor;
-
 
35
 
33
 
36
 
34
PROCEDURE GetCursor*(VAR X, Y: INTEGER);
37
PROCEDURE GetCursor* (VAR X, Y: INTEGER);
35
BEGIN
38
BEGIN
36
  ConsoleLib.get_cursor_pos(X, Y)
39
    ConsoleLib.get_cursor_pos(X, Y)
37
END GetCursor;
40
END GetCursor;
-
 
41
 
38
 
42
 
39
PROCEDURE Cls*;
43
PROCEDURE Cls*;
40
BEGIN
44
BEGIN
41
  ConsoleLib.cls
45
    ConsoleLib.cls
42
END Cls;
46
END Cls;
-
 
47
 
43
 
48
 
-
 
49
PROCEDURE SetColor* (FColor, BColor: INTEGER);
44
PROCEDURE SetColor*(FColor, BColor: INTEGER);
50
VAR
-
 
51
    res: INTEGER;
45
VAR res: INTEGER;
52
 
46
BEGIN
53
BEGIN
47
  IF (FColor IN {0..15}) & (BColor IN {0..15}) THEN
54
    IF (FColor IN {0..15}) & (BColor IN {0..15}) THEN
48
    res := ConsoleLib.set_flags(LSL(BColor, 4) + FColor)
55
        res := ConsoleLib.set_flags(LSL(BColor, 4) + FColor)
49
  END
56
    END
50
END SetColor;
57
END SetColor;
-
 
58
 
51
 
59
 
-
 
60
PROCEDURE GetCursorX* (): INTEGER;
52
PROCEDURE GetCursorX*(): INTEGER;
61
VAR
-
 
62
    x, y: INTEGER;
53
VAR x, y: INTEGER;
63
 
54
BEGIN
64
BEGIN
55
  ConsoleLib.get_cursor_pos(x, y)
65
    ConsoleLib.get_cursor_pos(x, y)
56
  RETURN x
66
    RETURN x
57
END GetCursorX;
67
END GetCursorX;
-
 
68
 
58
 
69
 
-
 
70
PROCEDURE GetCursorY* (): INTEGER;
59
PROCEDURE GetCursorY*(): INTEGER;
71
VAR
-
 
72
    x, y: INTEGER;
60
VAR x, y: INTEGER;
73
 
61
BEGIN
74
BEGIN
62
  ConsoleLib.get_cursor_pos(x, y)
75
    ConsoleLib.get_cursor_pos(x, y)
63
  RETURN y
76
    RETURN y
64
END GetCursorY;
77
END GetCursorY;
-
 
78
 
-
 
79
 
-
 
80
PROCEDURE open*;
-
 
81
BEGIN
-
 
82
    ConsoleLib.open(-1, -1, -1, -1, "");
-
 
83
    In.Open;
-
 
84
    Out.Open
-
 
85
END open;
-
 
86
 
-
 
87
 
-
 
88
PROCEDURE exit* (bCloseWindow: BOOLEAN);
-
 
89
BEGIN
-
 
90
    ConsoleLib.exit(bCloseWindow)
-
 
91
END exit;
-
 
92
 
65
 
93
 
66
END Console.
94
END Console.