Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quasar-wayland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
quasar-wayland
Commits
b7df69ef
Commit
b7df69ef
authored
3 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Import Core in TH module
parent
0cfbc34a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Quasar/Wayland/Core.hs
+2
-0
2 additions, 0 deletions
src/Quasar/Wayland/Core.hs
src/Quasar/Wayland/TH.hs
+15
-17
15 additions, 17 deletions
src/Quasar/Wayland/TH.hs
with
17 additions
and
17 deletions
src/Quasar/Wayland/Core.hs
+
2
−
0
View file @
b7df69ef
module
Quasar.Wayland.Core
(
ObjectId
,
Opcode
,
ProtocolState
,
ClientProtocolState
,
initialClientProtocolState
,
...
...
This diff is collapsed.
Click to expand it.
src/Quasar/Wayland/TH.hs
+
15
−
17
View file @
b7df69ef
...
...
@@ -9,7 +9,7 @@ import Data.ByteString qualified as BS
import
Language.Haskell.TH
import
Language.Haskell.TH.Lib
import
Language.Haskell.TH.Syntax
(
addDependentFile
)
--
import Quasar.Wayland.Core
import
Quasar.Wayland.Core
...
...
@@ -24,61 +24,59 @@ generateWaylandProcol protocolFile = do
pure
[]
type
Opcode
=
Word16
data
Protocol
=
Protocol
{
interfaces
::
[
Interface
]}
data
ProtocolSpec
=
ProtocolSpec
{
interfaces
::
[
InterfaceSpec
]}
deriving
stock
(
Show
)
data
Interface
=
Interface
{
data
Interface
Spec
=
Interface
Spec
{
name
::
String
,
requests
::
[
Request
],
events
::
[
Event
]
requests
::
[
Request
Spec
],
events
::
[
Event
Spec
]
}
deriving
stock
(
Show
)
data
Request
=
Request
{
data
Request
Spec
=
Request
Spec
{
name
::
String
,
opcode
::
Opcode
}
deriving
stock
(
Show
)
data
Event
=
Event
{
data
Event
Spec
=
Event
Spec
{
name
::
String
,
opcode
::
Opcode
}
deriving
stock
(
Show
)
parseProtocol
::
MonadFail
m
=>
BS
.
ByteString
->
m
Protocol
parseProtocol
::
MonadFail
m
=>
BS
.
ByteString
->
m
Protocol
Spec
parseProtocol
xml
=
do
(
Just
element
)
<-
pure
$
parseXMLDoc
xml
interfaces
<-
mapM
parseInterface
$
findChildren
(
blank_name
{
qName
=
"interface"
})
element
pure
Protocol
{
pure
Protocol
Spec
{
interfaces
}
parseInterface
::
MonadFail
m
=>
Element
->
m
Interface
parseInterface
::
MonadFail
m
=>
Element
->
m
Interface
Spec
parseInterface
element
=
do
name
<-
getAttr
"name"
element
requests
<-
mapM
parseRequest
$
zip
[
0
..
]
$
findChildren
(
qname
"request"
)
element
events
<-
mapM
parseEvent
$
zip
[
0
..
]
$
findChildren
(
qname
"events"
)
element
pure
Interface
{
pure
Interface
Spec
{
name
,
requests
,
events
}
parseRequest
::
MonadFail
m
=>
(
Opcode
,
Element
)
->
m
Request
parseRequest
::
MonadFail
m
=>
(
Opcode
,
Element
)
->
m
Request
Spec
parseRequest
(
opcode
,
element
)
=
do
name
<-
getAttr
"name"
element
pure
Request
{
pure
Request
Spec
{
name
,
opcode
}
parseEvent
::
MonadFail
m
=>
(
Opcode
,
Element
)
->
m
Event
parseEvent
::
MonadFail
m
=>
(
Opcode
,
Element
)
->
m
Event
Spec
parseEvent
(
opcode
,
element
)
=
do
name
<-
getAttr
"name"
element
pure
Event
{
pure
Event
Spec
{
name
,
opcode
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment