Subversion Repositories Kolibri OS

Rev

Rev 6613 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6613 Rev 7597
Line 1... Line 1...
1
MODULE HW_con;
1
MODULE HW_con;
-
 
2
 
-
 
3
IMPORT Out, In, Console, DateTime;
Line 2... Line -...
2
 
-
 
Line 3... Line 4...
3
IMPORT Out, In, Console, DateTime, ConsoleLib;
4
 
4
 
5
 
5
PROCEDURE OutInt2(n: INTEGER);
6
PROCEDURE OutInt2(n: INTEGER);
6
BEGIN
7
BEGIN
7
  ASSERT((0 <= n) & (n <= 99));
8
    ASSERT((0 <= n) & (n <= 99));
8
  IF n < 10 THEN
9
    IF n < 10 THEN
9
    Out.Char("0")
10
        Out.Char("0")
10
  END;
11
    END;
Line -... Line 12...
-
 
12
    Out.Int(n, 0)
11
  Out.Int(n, 0)
13
END OutInt2;        
-
 
14
 
12
END OutInt2;
15
 
-
 
16
PROCEDURE OutMonth(n: INTEGER);
13
 
17
VAR
-
 
18
    str: ARRAY 4 OF CHAR;
14
PROCEDURE OutMonth(n: INTEGER);
19
 
15
VAR str: ARRAY 4 OF CHAR;
20
BEGIN       
16
BEGIN
21
 
17
  CASE n OF
22
    CASE n OF
18
  | 1: str := "jan"
23
    | 1: str := "jan"
Line 26... Line 31...
26
  | 9: str := "sep"
31
    | 9: str := "sep"
27
  |10: str := "oct"
32
    |10: str := "oct"
28
  |11: str := "nov"
33
    |11: str := "nov"
29
  |12: str := "dec"
34
    |12: str := "dec"
30
  END;
35
    END;     
-
 
36
 
31
  Out.String(str)
37
    Out.String(str)
32
END OutMonth;
38
END OutMonth; 
Line -... Line 39...
-
 
39
 
33
 
40
 
-
 
41
PROCEDURE main;
34
PROCEDURE main;
42
VAR
-
 
43
    Year, Month, Day, Hour, Min, Sec, Msec: INTEGER;
35
VAR Year, Month, Day, Hour, Min, Sec: INTEGER;
44
 
36
BEGIN
-
 
37
  ConsoleLib.open(-1, -1, -1, -1, "Hello!");
45
BEGIN
38
  Out.String("Hello, world!"); Out.Ln;
46
    Out.String("Hello, world!"); Out.Ln;
39
  Console.SetColor(Console.Yellow, Console.Blue);
47
    Console.SetColor(Console.White, Console.Red);
40
  DateTime.Now(Year, Month, Day, Hour, Min, Sec);
48
    DateTime.Now(Year, Month, Day, Hour, Min, Sec, Msec);
41
  Out.Int(Year, 0); Out.Char("-");
49
    Out.Int(Year, 0); Out.Char("-");
42
  OutMonth(Month);  Out.Char("-");
50
    OutMonth(Month);  Out.Char("-");
43
  OutInt2(Day);     Out.Char(" ");
51
    OutInt2(Day);     Out.Char(" ");
44
  OutInt2(Hour);    Out.Char(":");
52
    OutInt2(Hour);    Out.Char(":");
45
  OutInt2(Min);     Out.Char(":");
53
    OutInt2(Min);     Out.Char(":");
46
  OutInt2(Sec);
-
 
47
  In.Ln;
-
 
48
  ConsoleLib.exit(TRUE)
54
    OutInt2(Sec)
Line -... Line 55...
-
 
55
END main;         
49
END main;
56
 
-
 
57
 
50
 
58
BEGIN
-
 
59
    Console.open;
-
 
60
    main;
51
BEGIN
61
    In.Ln;
52
  main
62
    Console.exit(TRUE)