summaryrefslogtreecommitdiff
path: root/tools/Scanner/Protocol.lean
blob: 6c9a838872739785108c02cb98ecf9c8dfe94657 (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
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
70
71
72
73
74
75
76
77
78
79
namespace WaylandScanner

structure Description where
  summary : Option String
  body : Option String
  deriving Repr

def Description.ofSummary (s : String) : Description :=
  { summary := s
    body := .none }

structure EnumEntryDesc where
  name : String
  value : Int
  description : Option Description
  since : Nat
  deprecatedSince : Option Nat
  deriving Repr

structure EnumDesc where
  name : String
  description : Option Description
  since : Nat
  bitfield : Bool
  entries: Array EnumEntryDesc
  deriving Repr

inductive ArgumentType where
| int
| uInt
| fixed
| string
| array
| fd
| newID
| object
deriving Repr

structure ArgumentDesc where
  name : String
  type : ArgumentType
  description : Option Description
  interface : Option String
  enum : Option String
  allowNull : Bool
  deriving Repr

inductive MessageType where
| normal
| destructor
deriving Repr

structure MessageDesc where
  name : String
  opcode : Nat
  description : Option Description
  type : MessageType
  since : Nat
  deprecatedSince : Option Nat
  arguments : Array ArgumentDesc
  deriving Repr

structure InterfaceDesc where
  name : String
  version : Nat
  description : Option Description
  enums : Array EnumDesc
  requests : Array MessageDesc
  events : Array MessageDesc
  deriving Repr

structure ProtocolDesc where
  name : String
  copyright : Option String
  description : Option Description
  interfaces : Array InterfaceDesc
  deriving Repr

end WaylandScanner