Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CleanSerial
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mart Lubbers
CleanSerial
Commits
2c920646
Commit
2c920646
authored
Apr 24, 2018
by
Mart Lubbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix device listing for windows
parent
704600d9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
14 deletions
+26
-14
.gitignore
.gitignore
+1
-0
TTY.icl
TTY.icl
+2
-2
Windows/Platform.dcl
Windows/Platform.dcl
+1
-1
Windows/Platform.icl
Windows/Platform.icl
+20
-11
tests/Makefile
tests/Makefile
+2
-0
No files found.
.gitignore
View file @
2c920646
...
...
@@ -8,3 +8,4 @@ test
*.prp
*-sapl
*-www
*.swp
TTY.icl
View file @
2c920646
implementation
module
TTY
import
StdFunc
import
StdFunc
,
StdBool
import
StdList
import
System
.
OS
import
Text
...
...
@@ -43,7 +43,7 @@ getTTYDevices :: !*World -> *(![String], !*World)
getTTYDevices
w
#
(
ds
,
w
)
=
getDevices
w
=
(
IF_WINDOWS
(
filter
(
startsWith
"COM"
)
ds
)
(
filter
(
\
s
->
startsWith
"COM"
s
&&
size
s
>
3
&&
isDigit
s
.[
3
]
)
ds
)
(
map
((+++)
"/dev/"
)
(
filter
isTTY
ds
))
,
w
)
where
...
...
Windows/Platform.dcl
View file @
2c920646
definition
module
Platform
getDevices
::
!*
World
->
!
*([
String
],
!*
World
)
getDevices
::
!*
World
->
*([
String
],
!*
World
)
Windows/Platform.icl
View file @
2c920646
implementation
module
Platform
getDevices
::
!*
World
->
!*([
String
],
!*
World
)
import
code
from
library
"CleanSerial_library"
import
System
.
_Pointer
import
System
.
_WinBase
import
StdMisc
,
StdDebug
,
StdBool
,
StdString
import
Text
getDevices
::
!*
World
->
*([
String
],
!*
World
)
getDevices
w
#
(
ph
,
w
)
=
getProcessheap
w
#
(
ptr
,
w
)
=
heapAlloc
ph
0
4096
w
#
(
ret
,
w
)
=
realQDD
0
ptr
4096
w
|
ret
==
0
=
abort
"error in QueryDosDevice"
#
res
=
derefString
ptr
#
(
ph
,
w
)
=
getProcessHeap
w
#
(
ptr
,
w
)
=
heapAlloc
ph
0
40960
w
#
(
ret
,
w
)
=
realQDD
0
ptr
40960
w
|
ret
==
0
#
(
err
,
w
)
=
getLastError
w
=
abort
(
"error in QueryDosDevice: "
+++
toString
err
)
#!
res
=
derefCharArray
ptr
ret
#
(
ok
,
w
)
=
heapFree
ph
0
ptr
w
=
split
"
\0
"
res
=
(
split
"
\0
"
res
,
w
)
realQDD
::
!
Pointer
!
Pointer
!
Int
!*
env
->
!*(
Int
,
!*
env
)
realQDD
_
_
_
_
=
=
code {
ccall
QueryDosDevice
"ppI:I:A"
realQDD
::
!
Pointer
!
Pointer
!
Int
!*
env
->
*(!
Int
,
!*
env
)
realQDD
_
_
_
_
=
code {
ccall
QueryDosDeviceA@12
"PppI:I:A"
}
tests/Makefile
View file @
2c920646
...
...
@@ -6,6 +6,8 @@ endif
all
:
listDevices
.SECONDARY
:
listDevices.prj
%
:
%.prj %.icl
cpm
$<
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment