aboutsummaryrefslogtreecommitdiff
path: root/lib/SATS/writer.sats
blob: 65a2ea95881008ccb8117f6c9e20fe5c4e4fbb47 (plain)
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
#define BUFFER_HEIGHT 23
#define BUFFER_WIDTH 80
#define N BUFFER_HEIGHT * BUFFER_WIDTH

datatype color =
  | Black 
  | Blue 
  | Green 
  | Cyan 
  | Red 
  | Magenta 
  | Brown 
  | LightGray 
  | DarkGray 
  | LightBlue 
  | LightGreen 
  | LightCyan 
  | LightRed 
  | Pink 
  | Yellow 
  | White 


typedef screenChar = @{ ascii_character = char, color_code = uint8}

vtypedef buffer = [l : agz] (@[screenChar][N] @ l | ptr l)
typedef writer  = @{position = [a:int | a >= 0 && a < N] int (a), color_code = uint8}

castfn i2u8 {n: nat} (i: int n): uint8 n

fun put_string (str : string) : void
fun clear_screen() : void