Skip to content

Commit ea3f1d1

Browse files
committed
termios
1 parent e59acf3 commit ea3f1d1

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

packages/termios/termios-ffi.ss

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2+
;;作者:evilbinary on 2017-12-06 23:06:57.
3+
;;邮箱:rootdebug@163.com
4+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5+
(library (termios termios )
6+
(export cfgetospeed
7+
cfgetispeed
8+
cfsetospeed
9+
cfsetispeed
10+
tcgetattr
11+
tcsetattr
12+
tcsendbreak
13+
tcdrain
14+
tcflush
15+
tcflow)
16+
17+
(import (scheme) (utils libutil) (cffi cffi) )
18+
19+
(define lib-name
20+
(case (machine-type)
21+
((arm32le) "libtermios.so")
22+
((a6nt i3nt ta6nt ti3nt) "libtermios.dll")
23+
((a6osx i3osx ta6osx ti3osx) "libtermios.so")
24+
((a6le i3le ta6le ti3le) "libtermios.so")))
25+
(define lib (load-librarys lib-name ))
26+
27+
;;speed_t cfgetospeed(struct termios* __termios_p)
28+
(def-function cfgetospeed
29+
"cfgetospeed" (void*) int)
30+
31+
;;speed_t cfgetispeed(struct termios* __termios_p)
32+
(def-function cfgetispeed
33+
"cfgetispeed" (void*) int)
34+
35+
;;int cfsetospeed(struct termios* __termios_p ,speed_t __speed)
36+
(def-function cfsetospeed
37+
"cfsetospeed" (void* int) int)
38+
39+
;;int cfsetispeed(struct termios* __termios_p ,speed_t __speed)
40+
(def-function cfsetispeed
41+
"cfsetispeed" (void* int) int)
42+
43+
;;int tcgetattr(int __fd ,struct termios* __termios_p)
44+
(def-function tcgetattr
45+
"tcgetattr" (int void*) int)
46+
47+
;;int tcsetattr(int __fd ,int __optional_actions ,struct termios* __termios_p)
48+
(def-function tcsetattr
49+
"tcsetattr" (int int void*) int)
50+
51+
;;int tcsendbreak(int __fd ,int __duration)
52+
(def-function tcsendbreak
53+
"tcsendbreak" (int int) int)
54+
55+
;;int tcdrain(int __fd)
56+
(def-function tcdrain
57+
"tcdrain" (int) int)
58+
59+
;;int tcflush(int __fd ,int __queue_selector)
60+
(def-function tcflush
61+
"tcflush" (int int) int)
62+
63+
;;int tcflow(int __fd ,int __action)
64+
(def-function tcflow
65+
"tcflow" (int int) int)
66+
67+
68+
)

0 commit comments

Comments
 (0)