Commit 60e89ab8 authored by Mart Lubbers's avatar Mart Lubbers

small cleanup

parent d7167ba3
Clean System Files/*.o
Clean System Files/*.abc
Clean System Files/*.tcl
Clean System Files/*.sapl
TTY
sapl
TTY.prj
|| ?module? TTY
TTY.TTYopen2_13 !_x_0 !_x_1::I !_x_2::I !_x_3::I !_x_4::I !_x_5::B !_x_6 = error "no AnyCodeExpr"
TTY.toInt_14::I !_x_0 = case _x_0 (TTY.B0 -> 0) (TTY.B50 -> 1) (TTY.B75 -> 2) (TTY.B110 -> 3) (TTY.B134 -> 4) (TTY.B150 -> 5) (TTY.B200 -> 6) (TTY.B300 -> 7) (TTY.B600 -> 8) (TTY.B1200 -> 9) (TTY.B1800 -> 10) (TTY.B2400 -> 11) (TTY.B4800 -> 12) (TTY.B9600 -> 13) (TTY.B19200 -> 14) (TTY.B38400 -> 15) (TTY.B57600 -> 16) (TTY.B115200 -> 17) (TTY.B230400 -> 18)
TTY.toInt_15::I !_x_0 = case _x_0 (TTY.BytesizeFive -> 0) (TTY.BytesizeSix -> 1) (TTY.BytesizeSeven -> 2) (TTY.BytesizeEight -> 3)
TTY.toInt_16::I !_x_0 = case _x_0 (TTY.ParityNone -> 0) (TTY.ParityEven -> 1) (TTY.ParityOdd -> 2) (TTY.ParityMark -> 3) (TTY.ParitySpace -> 4)
TTY.toInt_17::I !_x_0 = case _x_0 (TTY.StopbitsOne -> 0) (TTY.StopbitsOnePointFive -> 1) (TTY.StopbitsTwo -> 2)
TTY.TTYopen !fn_0 !ts_1 !w_2 = TTY.TTYopen2_13 fn_0 (TTY.toInt_14 (select ts_1::TTY._TTYSettings 0)) (TTY.toInt_15 (select ts_1::TTY._TTYSettings 1)) (TTY.toInt_16 (select ts_1::TTY._TTYSettings 2)) (TTY.toInt_17 (select ts_1::TTY._TTYSettings 3)) (select ts_1::TTY._TTYSettings 4) w_2
TTY.TTYclose !f_0::I !w_1 = error "no AnyCodeExpr"
TTY.TTYreadc !w_0::I = error "no AnyCodeExpr"
TTY.TTYreadline !t_0::I = error "no AnyCodeExpr"
TTY.TTYerror !w_0 = error "no AnyCodeExpr"
TTY.zero_5 = TTY._TTYSettings TTY.B9600 TTY.BytesizeEight TTY.ParityNone TTY.StopbitsOne False
TTY.Start !w_0 = let !_x_1_0 = TTY.TTYopen "/dev/ttyUSB0" TTY.zero_5 w_0 in case (StdBool.not (select _x_1_0::_Tuple3 0)) (True -> TTY.TTYerror (select _x_1_0::_Tuple3 2)) (False -> let !_x_3_0 = TTY.TTYreadline (select _x_1_0::_Tuple3 1), !_x_3_1 = TTY.TTYclose (select _x_3_0::_Tuple2 1) (select _x_1_0::_Tuple3 2) in case (StdBool.not (select _x_3_1::_Tuple2 0)) (True -> TTY.TTYerror (select _x_3_1::_Tuple2 1)) (False -> let !_x_5_0 = TTY.TTYerror (select _x_3_1::_Tuple2 1) in <{_Tuple2!1}> (select _x_3_0::_Tuple2 0) (select _x_5_0::_Tuple2 1)) )
<{TTY.TD;TTY}> _x_0::B = _predefined._Nil
<{TTY.TD;ByteSize}> _x_0::B = _predefined._Nil
<{TTY.TD;Parity}> _x_0::B = _predefined._Nil
<{TTY.TD;StopBits}> _x_0::B = _predefined._Nil
<{TTY.TD;BaudRate}> _x_0::B = _predefined._Nil
<{TTY.TD;TTYSettings}> _x_0::B = _predefined._Nil
:: TTY.ByteSize = TTY.BytesizeFive | TTY.BytesizeSix | TTY.BytesizeSeven | TTY.BytesizeEight
:: TTY.Parity = TTY.ParityNone | TTY.ParityEven | TTY.ParityOdd | TTY.ParityMark | TTY.ParitySpace
:: TTY.StopBits = TTY.StopbitsOne | TTY.StopbitsOnePointFive | TTY.StopbitsTwo
:: TTY.BaudRate = TTY.B0 | TTY.B50 | TTY.B75 | TTY.B110 | TTY.B134 | TTY.B150 | TTY.B200 | TTY.B300 | TTY.B600 | TTY.B1200 | TTY.B1800 | TTY.B2400 | TTY.B4800 | TTY.B9600 | TTY.B19200 | TTY.B38400 | TTY.B57600 | TTY.B115200 | TTY.B230400
|| Converted Records
:: TTY._TTYSettings = {TTY.baudrate, TTY.bytesize, TTY.parity, TTY.stopbits, TTY.xonxoff::B}
:: <{TTY.gEq_s;}> = {!TTY.gEq_s}
:: <{TTY.gEq_ss;}> = {!TTY.gEq_ss}
:: <{TTY.gEq_sss;}> = {!TTY.gEq_sss}
:: <{TTY.gEq_ssss;}> = {!TTY.gEq_ssss}
:: <{TTY.gEq_sssss;}> = {!TTY.gEq_sssss}
:: <{TTY.gEq_ssssss;}> = {!TTY.gEq_ssssss}
:: <{TTY.gEq_sssssss;}> = {!TTY.gEq_sssssss}
:: <{TTY.gEq_ssssssss;}> = {!TTY.gEq_ssssssss}
:: <{TTY.gEq_sssssssss;}> = {!TTY.gEq_sssssssss}
:: <{TTY.bimap_s;}> = {TTY.bimap_s}
:: <{TTY.bimap_ss;}> = {TTY.bimap_ss}
:: <{TTY.bimap_sss;}> = {TTY.bimap_sss}
......@@ -8,7 +8,6 @@ from StdClass import class zero
:: ByteSize = BytesizeFive | BytesizeSix | BytesizeSeven | BytesizeEight
:: Parity = ParityNone | ParityEven | ParityOdd | ParityMark | ParitySpace
:: StopBits = StopbitsOne | StopbitsOnePointFive | StopbitsTwo
:: BaudRate = B0 | B50 | B75 | B110 | B134 | B150 | B200 | B300 | B600 |
B1200 | B1800 | B2400 | B4800 | B9600 | B19200 | B38400 | B57600 |
B115200 | B230400
......@@ -17,7 +16,7 @@ from StdClass import class zero
baudrate :: BaudRate,
bytesize :: ByteSize,
parity :: Parity,
stopbits :: StopBits,
stop2bits :: Bool,
xonxoff :: Bool
}
......
......@@ -17,47 +17,24 @@ instance zero TTYSettings where
baudrate = B9600,
bytesize = BytesizeEight,
parity = ParityNone,
stopbits = StopbitsOne,
stop2bits = False,
xonxoff = False}
instance toInt BaudRate where
toInt B0 = 0
toInt B50 = 1
toInt B75 = 2
toInt B110 = 3
toInt B134 = 4
toInt B150 = 5
toInt B200 = 6
toInt B300 = 7
toInt B600 = 8
toInt B1200 = 9
toInt B1800 = 10
toInt B2400 = 11
toInt B4800 = 12
toInt B9600 = 13
toInt B19200 = 14
toInt B38400 = 15
toInt B57600 = 16
toInt B115200 = 17
toInt B230400 = 18
toInt b = case b of
B0 = 0; B50 = 1; B75 = 2; B110 = 3; B134 = 4; B150 = 5; B200 = 6
B300 = 7; B600 = 8; B1200 = 9; B1800 = 10; B2400 = 11; B4800 = 12
B9600 = 13; B19200 = 14; B38400 = 15; B57600 = 16; B115200 = 17
B230400 = 18
instance toInt ByteSize where
toInt BytesizeFive = 0
toInt BytesizeSix = 1
toInt BytesizeSeven = 2
toInt BytesizeEight = 3
toInt b = case b of
BytesizeFive = 0; BytesizeSix = 1; BytesizeSeven = 2; BytesizeEight = 3
instance toInt Parity where
toInt ParityNone = 0
toInt ParityEven = 1
toInt ParityOdd = 2
toInt ParityMark = 3
toInt ParitySpace = 4
instance toInt StopBits where
toInt StopbitsOne = 0
toInt StopbitsOnePointFive = 1
toInt StopbitsTwo = 2
toInt p = case p of
ParityNone = 0; ParityEven = 1; ParityOdd = 2; ParityMark = 3;
ParitySpace = 4
TTYopen :: !String !TTYSettings !*env -> (!Bool, !*TTY, !*env)
TTYopen fn ts w = TTYopen2
......@@ -65,11 +42,11 @@ TTYopen fn ts w = TTYopen2
(toInt ts.baudrate)
(toInt ts.bytesize)
(toInt ts.parity)
(toInt ts.stopbits)
ts.stop2bits
ts.xonxoff
w
where
TTYopen2 :: !String !Int !Int !Int !Int !Bool !*env -> (!Bool, !*TTY, !*env)
TTYopen2 :: !String !Int !Int !Int !Bool !Bool !*env -> (!Bool, !*TTY, !*env)
TTYopen2 _ _ _ _ _ _ _ = code {
ccall ttyopen "SIIIII:VII:A"
}
......
......@@ -60,7 +60,7 @@ void ttyopen(CleanString fn, int baudrate, int bytesize, int parity, int stopbit
}
//Stopbits
tio.c_cflag |= CSTOPB;
tio.c_cflag -= stopbits != 0 ? 0 : CSTOPB;
tio.c_cflag -= stopbits == 0 ? 0 : CSTOPB;
//Xonoff
tio.c_cflag |= IXON;
tio.c_cflag -= xonoff == 1 ? 0 : IXON;
......
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