Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Posix/posix-tty.sml
ViewVC logotype

Diff of /sml/branches/primop-branch/src/system/Basis/Implementation/Posix/posix-tty.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1372, Mon Sep 15 22:16:26 2003 UTC revision 1471, Mon Mar 29 22:45:55 2004 UTC
# Line 31  Line 31 
31    
32      structure I =      structure I =
33        struct        struct
34          datatype flags = F of word          local structure BF = BitFlagsFn ()
35            in
36          fun fromWord w = F w              open BF
37          fun toWord (F w) = w          end
38    
39          fun flags ms = F(List.foldl (fn (F m,acc) => m ++ acc) 0w0 ms)          val brkint = fromWord (w_osval "BRKINT")
40          fun anySet (F m, F m') = (m & m') <> 0w0          val icrnl  = fromWord (w_osval "ICRNL")
41          fun allSet (F m, F m') = (m & m') = m          val ignbrk = fromWord (w_osval "IGNBRK")
42            val igncr  = fromWord (w_osval "IGNCR")
43          val brkint = F (w_osval "BRKINT")          val ignpar = fromWord (w_osval "IGNPAR")
44          val icrnl  = F (w_osval "ICRNL")          val inlcr  = fromWord (w_osval "INLCR")
45          val ignbrk = F (w_osval "IGNBRK")          val inpck  = fromWord (w_osval "INPCK")
46          val igncr  = F (w_osval "IGNCR")          val istrip = fromWord (w_osval "ISTRIP")
47          val ignpar = F (w_osval "IGNPAR")          val ixoff  = fromWord (w_osval "IXOFF")
48          val inlcr  = F (w_osval "INLCR")          val ixon   = fromWord (w_osval "IXON")
49          val inpck  = F (w_osval "INPCK")          val parmrk = fromWord (w_osval "PARMRK")
         val istrip = F (w_osval "ISTRIP")  
         val ixoff  = F (w_osval "IXOFF")  
         val ixon   = F (w_osval "IXON")  
         val parmrk = F (w_osval "PARMRK")  
50        end        end
51    
52      structure O =      structure O =
53        struct        struct
54          datatype flags = F of word          local structure BF = BitFlagsFn ()
55            in
56          fun fromWord w = F w              open BF
57          fun toWord (F w) = w          end
   
         fun flags ms = F(List.foldl (fn (F m,acc) => m ++ acc) 0w0 ms)  
         fun anySet (F m, F m') = (m & m') <> 0w0  
         fun allSet (F m, F m') = (m & m') = m  
58    
59          val opost = F (w_osval "OPOST")          val opost = fromWord (w_osval "OPOST")
60        end        end
61    
62      structure C =      structure C =
63        struct        struct
64          datatype flags = F of word          local structure BF = BitFlagsFn ()
65            in
66          fun fromWord w = F w              open BF
67          fun toWord (F w) = w          end
68    
69          fun flags ms = F(List.foldl (fn (F m,acc) => m ++ acc) 0w0 ms)          val clocal = fromWord (w_osval "CLOCAL")
70          fun anySet (F m, F m') = (m & m') <> 0w0          val cread  = fromWord (w_osval "CREAD")
71          fun allSet (F m, F m') = (m & m') = m          val csize  = fromWord (w_osval "CSIZE")
72            val cs5    = fromWord (w_osval "CS5")
73          val clocal = F (w_osval "CLOCAL")          val cs6    = fromWord (w_osval "CS6")
74          val cread  = F (w_osval "CREAD")          val cs7    = fromWord (w_osval "CS7")
75          val csize  = F (w_osval "CSIZE")          val cs8    = fromWord (w_osval "CS8")
76          val cs5    = F (w_osval "CS5")          val cstopb = fromWord (w_osval "CSTOPB")
77          val cs6    = F (w_osval "CS6")          val hupcl  = fromWord (w_osval "HUPCL")
78          val cs7    = F (w_osval "CS7")          val parenb = fromWord (w_osval "PARENB")
79          val cs8    = F (w_osval "CS8")          val parodd = fromWord (w_osval "PARODD")
         val cstopb = F (w_osval "CSTOPB")  
         val hupcl  = F (w_osval "HUPCL")  
         val parenb = F (w_osval "PARENB")  
         val parodd = F (w_osval "PARODD")  
80        end        end
81    
82      structure L =      structure L =
83        struct        struct
84          datatype flags = F of word          local structure BF = BitFlagsFn ()
85            in
86          fun fromWord w = F w              open BF
87          fun toWord (F w) = w          end
88    
89          fun flags ms = F(List.foldl (fn (F m,acc) => m ++ acc) 0w0 ms)          val echo   = fromWord (w_osval "ECHO")
90          fun anySet (F m, F m') = (m & m') <> 0w0          val echoe  = fromWord (w_osval "ECHOE")
91          fun allSet (F m, F m') = (m & m') = m          val echok  = fromWord (w_osval "ECHOK")
92            val echonl = fromWord (w_osval "ECHONL")
93          val echo   = F (w_osval "ECHO")          val icanon = fromWord (w_osval "ICANON")
94          val echoe  = F (w_osval "ECHOE")          val iexten = fromWord (w_osval "IEXTEN")
95          val echok  = F (w_osval "ECHOK")          val isig   = fromWord (w_osval "ISIG")
96          val echonl = F (w_osval "ECHONL")          val noflsh = fromWord (w_osval "NOFLSH")
97          val icanon = F (w_osval "ICANON")          val tostop = fromWord (w_osval "TOSTOP")
         val iexten = F (w_osval "IEXTEN")  
         val isig   = F (w_osval "ISIG")  
         val noflsh = F (w_osval "NOFLSH")  
         val tostop = F (w_osval "TOSTOP")  
98        end        end
99    
100      structure V =      structure V =
# Line 251  Line 235 
235            val (ifs,ofs,cfs,lfs,cc,isp,osp) = tcgetattr (FS.intOf fd)            val (ifs,ofs,cfs,lfs,cc,isp,osp) = tcgetattr (FS.intOf fd)
236            in            in
237              TIOS {              TIOS {
238                iflag = I.F ifs,                iflag = I.fromWord ifs,
239                oflag = O.F ofs,                oflag = O.fromWord ofs,
240                cflag = C.F cfs,                cflag = C.fromWord cfs,
241                lflag = L.F lfs,                lflag = L.fromWord lfs,
242                cc = V.CC cc,                cc = V.CC cc,
243                ispeed = B isp,                ispeed = B isp,
244                ospeed = B osp                ospeed = B osp
# Line 263  Line 247 
247    
248      val tcsetattr : int * s_int * termio_rep -> unit = cfun "tcsetattr"      val tcsetattr : int * s_int * termio_rep -> unit = cfun "tcsetattr"
249      fun setattr (fd, TC.SA sa, TIOS tios) = let      fun setattr (fd, TC.SA sa, TIOS tios) = let
250            val (I.F iflag) = #iflag tios            val iflag = I.toWord (#iflag tios)
251            val (O.F oflag) = #oflag tios            val oflag = O.toWord (#oflag tios)
252            val (C.F cflag) = #cflag tios            val cflag = C.toWord (#cflag tios)
253            val (L.F lflag) = #lflag tios            val lflag = L.toWord (#lflag tios)
254            val (V.CC cc) = #cc tios            val (V.CC cc) = #cc tios
255            val (B ispeed) = #ispeed tios            val (B ispeed) = #ispeed tios
256            val (B ospeed) = #ospeed tios            val (B ospeed) = #ospeed tios

Legend:
Removed from v.1372  
changed lines
  Added in v.1471

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0