Changeset 36202 in project


Ignore:
Timestamp:
08/12/18 01:22:07 (16 months ago)
Author:
Kon Lovett
Message:

track work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/mailbox/trunk/chicken-primitive-object-inlines.scm

    r36012 r36202  
    774774; Port layout:
    775775;
    776 ; 0       FP (special - FILE *)
    777 ; 1       input/output (bool)
    778 ; 2       class (vector, see Port-class)
    779 ; 3       name (string)
    780 ; 4       row (fixnum)
    781 ; 5       col (fixnum)
    782 ; 6       EOF (bool)
    783 ; 7       type (symbol)
    784 ; 8       closed (bool)
    785 ; 9       data
    786 ; 10-15  reserved, port class specific
     776; 0:  FP (special - FILE *)
     777; 1:  direction (fixnum)
     778; 2:  class (vector of procedures, see Port-class)
     779; 3:  name (string)
     780; 4:  row (fixnum)
     781; 5:  col (fixnum)
     782; 6:  EOF (bool)
     783; 7:  type ('stream | 'custom | 'string | 'socket)
     784; 8:  closed (fixnum)
     785; 9:  data
     786; 10-15: reserved, port class specific
    787787
    788788(define-inline (%port-filep port) (%peek-unsigned-integer port 0))
    789 (define-inline (%port-input-mode? port) (%wordblock-ref port 1))
     789;(define-inline (%port-input-mode? port) (%wordblock-ref port 1))
    790790(define-inline (%port-class port) (%wordblock-ref port 2))
    791791(define-inline (%port-name port) (%wordblock-ref port 3))
     
    794794(define-inline (%port-eof? port) (%wordblock-ref port 6))
    795795(define-inline (%port-type port) (%wordblock-ref port 7))
    796 (define-inline (%port-closed? port) (%wordblock-ref port 8))
     796;(define-inline (%port-closed? port) (%wordblock-ref port 8))
    797797(define-inline (%port-data port) (%wordblock-ref port 9))
    798798
    799 (define-inline (%input-port? x) (and (%port? x) (%port-input-mode? x)))
    800 (define-inline (%output-port? x) (and (%port? x) (not (%port-input-mode? x))))
     799;(define-inline (%input-port? x) (and (%port? x) (%port-input-mode? x)))
     800;(define-inline (%output-port? x) (and (%port? x) (not (%port-input-mode? x))))
    801801
    802802(define-inline (%port-filep-set! port fp) (%poke-integer port 0 fp))
    803 (define-inline (%port-input-mode-set! port f) (%wordblock-set!/immediate port 1 f))
     803;(define-inline (%port-input-mode-set! port f) (%wordblock-set!/immediate port 1 f))
    804804(define-inline (%port-class-set! port v) (%wordblock-set!/mutate port 2 v))
    805805(define-inline (%port-name-set! port s) (%wordblock-set!/mutate port 3 s))
     
    808808(define-inline (%port-eof-set! port f) (%wordblock-set!/immediate port 6 f))
    809809(define-inline (%port-type-set! port s) (%wordblock-set!/mutate port 7 s))
    810 (define-inline (%port-closed-set! port f) (%wordblock-set!/immediate port 8 f))
     810;(define-inline (%port-closed-set! port f) (%wordblock-set!/immediate port 8 f))
    811811(define-inline (%port-data-set! port x) (%wordblock-set!/mutate port 9 x))
    812812
     813#;
    813814(define-inline (%make-port i/o class name type)
    814815  ; port is 16 slots + a block-header word
     
    833834; 7       (read-string! PORT COUNT STRING START) -> COUNT'
    834835; 8       (read-line PORT LIMIT) -> STRING | EOF
    835 
    836 (define-inline (%make-port-class rc pc wc ws cl fl cr rs rl)
     836; 9:  (read-buffered PORT) -> STRING
     837
     838(define-inline (%make-port-class rc pc wc ws cl fl cr rs rl rb)
    837839  (let ((class (%make-vector 9 #f)))
    838840    (%vector-set! class 0 rc)
     
    845847    (%vector-set! class 7 rs)
    846848    (%vector-set! class 8 rl)
     849    (%vector-set! class 9 rb)
    847850    class ) )
    848851
     
    856859(define-inline (%port-class-read-string-ref c) (%vector-ref c 7))
    857860(define-inline (%port-class-read-line-ref c) (%vector-ref c 8))
     861(define-inline (%port-class-read-buffered-ref c) (%vector-ref c 9))
    858862
    859863(define-inline (%port-class-read-char c p) ((%port-class-read-char-ref c) p) )
     
    866870(define-inline (%port-class-read-string! c p n d s) ((%port-class-read-string-ref c) p n d s))
    867871(define-inline (%port-class-read-line c p l) ((%port-class-read-line-ref c) p l))
     872;(define-inline (%port-class-read-buffered c p l) ((%port-class-read-buffered-ref c) p l))
    868873
    869874(define-inline (%port-read-char p) ((%port-class-read-char-ref (%port-class p)) p) )
     
    876881(define-inline (%port-read-string! p n d s) ((%port-class-read-string-ref (%port-class p)) p n d s))
    877882(define-inline (%port-read-line p l) ((%port-class-read-line-ref (%port-class p)) p l))
     883;(define-inline (%port-read-buffered p l) ((%port-class-read-buffered-ref (%port-class p)) p l))
    878884
    879885;; Closure (wordblock)
Note: See TracChangeset for help on using the changeset viewer.