Commit e259a05e authored by Mart Lubbers's avatar Mart Lubbers
Browse files

fix soome issues

parent 553b6622
test: test.icl TTY.icl TTY.dcl Clean\ System\ Files/ctty.o test: test.icl TTY.icl TTY.dcl Clean\ System\ Files/ctty.o
clm $(basename $<) -o $@ clm -dynamics -l -no-pie -I /opt/clean/lib/Dynamics $(basename $<) -o $@
Clean\ System\ Files/ctty.o: tty.c Clean\ System\ Files/ctty.o: tty.c
gcc -c $< -o "$@" gcc-5 -c $< -o "$@"
clean: clean:
$(RM) -r Clean\ System\ Files/* test $(RM) -r Clean\ System\ Files/* test
...@@ -25,4 +25,4 @@ TTYerror :: !*env -> (!String, !*env) ...@@ -25,4 +25,4 @@ TTYerror :: !*env -> (!String, !*env)
TTYopen :: !String !TTYSettings !*env -> (!Bool,!*TTY,!*env) TTYopen :: !String !TTYSettings !*env -> (!Bool,!*TTY,!*env)
TTYreadline :: !*TTY -> (!String, !*TTY) TTYreadline :: !*TTY -> (!String, !*TTY)
TTYavailable :: !*TTY -> (!Bool, !*TTY) TTYavailable :: !*TTY -> (!Bool, !*TTY)
TTYwrite :: !*TTY !String -> *TTY TTYwrite :: !String !*TTY -> *TTY
...@@ -55,9 +55,9 @@ TTYreadline _ = code { ...@@ -55,9 +55,9 @@ TTYreadline _ = code {
ccall ttyreadline "I:VSI" ccall ttyreadline "I:VSI"
} }
TTYwrite :: !*TTY !String -> *TTY TTYwrite :: !String !*TTY -> *TTY
TTYwrite _ _ = code { TTYwrite _ _ = code {
ccall ttywrite "IS:I" ccall ttywrite "SI:I"
} }
TTYavailable :: !*TTY -> (!Bool, !*TTY) TTYavailable :: !*TTY -> (!Bool, !*TTY)
......
...@@ -16,7 +16,7 @@ Start w ...@@ -16,7 +16,7 @@ Start w
# (io, w) = stdio w # (io, w) = stdio w
# (ok, tty, w) = TTYopen "/dev/ttyUSB0" zero w # (ok, tty, w) = TTYopen "/dev/ttyUSB0" zero w
| not ok = TTYerrorclose io w | not ok = TTYerrorclose io w
#! tty = TTYwrite tty "echo123\n" #! tty = TTYwrite "echo123\n" tty
#! (av, tty) = TTYavailable tty #! (av, tty) = TTYavailable tty
# io = io <<< ("Bytes available: " +++ toString av +++ "\n") # io = io <<< ("Bytes available: " +++ toString av +++ "\n")
#! (l, tty) = TTYreadline tty #! (l, tty) = TTYreadline tty
......
#include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
...@@ -203,7 +204,7 @@ void ttyreadline(int fd, CleanString *result, int *fdo) ...@@ -203,7 +204,7 @@ void ttyreadline(int fd, CleanString *result, int *fdo)
void ttyavailable(int fd, int *r, int *fdo) void ttyavailable(int fd, int *r, int *fdo)
{ {
debug("ttyavailable"); // debug("ttyavailable");
fd_set fds; fd_set fds;
struct timeval tv; struct timeval tv;
tv.tv_sec = 0; tv.tv_sec = 0;
...@@ -216,10 +217,10 @@ void ttyavailable(int fd, int *r, int *fdo) ...@@ -216,10 +217,10 @@ void ttyavailable(int fd, int *r, int *fdo)
if(*r == -1) if(*r == -1)
die("select"); die("select");
*fdo = fd; *fdo = fd;
debug("ttyavailable-done"); // debug("ttyavailable-done");
} }
int ttywrite(int fd, CleanString s) int ttywrite(CleanString s, int fd)
{ {
debug("ttywrite"); debug("ttywrite");
write(fd, CleanStringCharacters(s), CleanStringLength(s)); write(fd, CleanStringCharacters(s), CleanStringLength(s));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment