lib/TextIO-struct.ss
#lang scheme/base

(require (planet chongkai/sml/ml-package)
         scheme/match
         (planet chongkai/sml/ml-primitives)
         (planet chongkai/sml/lib/Substring-struct))

(provide TextIO-struct)

(define-package TextIO-struct
  (openIn
   closeIn
   input
   inputAll
   input1
   inputN
   inputLine
   endOfStream
   lookahead
   ;scanStream ;leave for StreamIO
   stdIn
   openOut
   openAppend
   closeOut
   output
   output1
   outputSubstr
   flushOut
   stdOut
   stdErr
   print)
  
  (define outputSubstr
    (match-lambda
      ((vector strm ss)
       (output (vector strm
                       ((let ()
                          (open-package Substring-struct)
                          string)
                        ss))))))
  
  (define*-values (openIn
                   closeIn
                   input
                   inputAll
                   input1
                   inputN
                   inputLine
                   endOfStream
                   lookahead
                   stdIn
                   openOut
                   openAppend
                   closeOut
                   output
                   output1
                   flushOut
                   stdOut
                   stdErr
                   print)
    (values openIn
            closeIn
            input
            inputAll
            input1
            inputN
            inputLine
            endOfStream
            lookahead
            stdIn
            openOut
            openAppend
            closeOut
            output
            output1
            flushOut
            stdOut
            stdErr
            print)))