Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mart Lubbers
CleanSerial
Commits
2c920646
Commit
2c920646
authored
Apr 24, 2018
by
Mart Lubbers
Browse files
fix device listing for windows
parent
704600d9
Changes
5
Hide whitespace changes
Inline
Side-by-side
.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
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment