Changeset 14317 in project


Ignore:
Timestamp:
04/20/09 18:32:54 (11 years ago)
Author:
Alex Shinn
Message:

stty for chicken 4

Location:
release/4/stty
Files:
1 added
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/stty/trunk/stty.scm

    r9985 r14317  
    11;;;; stty.scm -- stty-like interface to termios
    22;;
    3 ;; Copyright (c) 2007 Alex Shinn.  All rights reserved.
     3;; Copyright (c) 2007-2009 Alex Shinn.  All rights reserved.
    44;; BSD-style license: http://synthcode.com/license.txt
    55
     
    6262;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    6363
    64 (declare
    65  (export stty with-stty
    66          get-terminal-attributes set-terminal-attributes!
    67          make-term-attrs free-term-attrs
    68          term-attrs-iflag term-attrs-iflag-set!
    69          term-attrs-oflag term-attrs-oflag-set!
    70          term-attrs-cflag term-attrs-cflag-set!
    71          term-attrs-lflag term-attrs-lflag-set!
    72          term-attrs-cc term-attrs-cc-set!
    73          term-attrs-ispeed term-attrs-ispeed-set!
    74          term-attrs-ospeed term-attrs-ospeed-set!
    75          TCSANOW TCSADRAIN TCSAFLUSH))
    76 
    77 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    78 
    79 (use srfi-69 posix)
     64(require-library srfi-69 foreigners)
     65
     66(module stty
     67 (stty with-stty
     68  get-terminal-attributes set-terminal-attributes!
     69  make-term-attrs free-term-attrs
     70  term-attrs-iflag term-attrs-iflag-set!
     71  term-attrs-oflag term-attrs-oflag-set!
     72  term-attrs-cflag term-attrs-cflag-set!
     73  term-attrs-lflag term-attrs-lflag-set!
     74  term-attrs-cc term-attrs-cc-set!
     75  term-attrs-ispeed term-attrs-ispeed-set!
     76  term-attrs-ospeed term-attrs-ospeed-set!
     77  TCSANOW TCSADRAIN TCSAFLUSH)
     78
     79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     80
     81(import scheme chicken extras posix srfi-69 foreign foreigners)
    8082
    8183(declare (foreign-declare "#include <termios.h>\n"))
    8284(declare (foreign-declare "typedef struct termios struct_termios;\n"))
    8385
    84 (define-foreign-record (term-attrs struct_termios)
     86(define-foreign-record-type (term-attrs struct_termios)
    8587  (constructor: make-term-attrs)
    8688  (destructor: free-term-attrs)
    87   (rename: (lambda (str) (string-append "term-attrs-" (substring str 13))))
    88   (unsigned-long c_iflag)
    89   (unsigned-long c_oflag)
    90   (unsigned-long c_cflag)
    91   (unsigned-long c_lflag)
    92   (unsigned-char c_cc 20)
    93   (unsigned-long c_ispeed)
    94   (unsigned-long c_ospeed)
     89  (unsigned-long c_iflag term-attrs-iflag term-attrs-iflag-set!)
     90  (unsigned-long c_oflag term-attrs-oflag term-attrs-oflag-set!)
     91  (unsigned-long c_cflag term-attrs-cflag term-attrs-cflag-set!)
     92  (unsigned-long c_lflag term-attrs-lflag term-attrs-lflag-set!)
     93  (unsigned-char (c_cc 22) term-attrs-cc term-attrs-cc-set!)
     94  (unsigned-long c_ispeed term-attrs-ispeed term-attrs-ispeed-set!)
     95  (unsigned-long c_ospeed term-attrs-ospeed term-attrs-ospeed-set!)
    9596  )
    9697
     
    444445          (free-term-attrs orig-attrs)))))
    445446
     447)
  • release/4/stty/trunk/stty.setup

    r9985 r14317  
    1 (define has-exports? (string>=? (chicken-version) "2.310"))
    21
    3 (compile -shared -O2
    4   ,@(if has-exports? '(-check-imports -emit-exports stty.exports) '())
    5   stty.scm)
     2(compile -shared -O2 -j stty stty.scm)
     3(compile -shared -O2 stty.import.scm)
    64
    75(install-extension 'stty
    8   '("stty.so")
    9   `((version "0.1.1")
    10     ,@(if has-exports? `((exports "stty.exports")) '())
    11     ))
     6  '("stty.so" "stty.import.so")
     7  '((version "0.2.0")))
Note: See TracChangeset for help on using the changeset viewer.