scheme / scsh

A Unix shell embedded in scheme
Other
386 stars 36 forks source link

make-char-port-filter undefined #18

Closed michael-heerdegen closed 10 years ago

michael-heerdegen commented 10 years ago

Hello,

as far as I understand the code, make-char-port-filter and make-string-port-filter should be bound to procedures in a scsh session. But these vars are unbound here. Using up to date scsh from here.

Is this a bug, or did I miss something?

Thanks, Michael.

michael-heerdegen commented 10 years ago

BTW,

,load "/home/micha/software/scsh/scheme/port-collect.scm"

outputs

assertion-violation: undefined variable [global]
                     deprecated-proc
                     scsh-user

for me.

michael-heerdegen commented 10 years ago

BTW2, there is this example in the info manual:

      (run (| (delatex)
              (begin ((char-filter char-downcase))) ; tr A-Z a-z
              (spell)
              (sort)
              (uniq))
           (< scsh.tex)
           (> spell-errors.txt))

I don't get this work even when I use what is intended inside the (begin ...) form. I always get errors like

not an open channel [posix_dup2]

I tried this in an interactive session:

(run (| (cat /home/micha/some-file)
      (begin (let lp ()
           (let ((c (read-char)))
             (if (not (eof-object? c))
             (begin (write-char c)
                (lp))))))))

and get

assertion-violation: argument of wrong type [channel-maybe-read]

{closed-channel "standard input" 0}

                 #{byte-vector 9 9 9 9 40 108 ---}
                 0
                 4096
                 #t

Still learning scsh - any hint what's wrong?

Thanks, Michael.

roderyc commented 10 years ago

FYI, I do see your issues, and I'll most likely have time to address them this weekend.

roderyc commented 10 years ago

I did some investigation into this last night. make-char-port-filter being missing was simply an oversight on my part. I neglected to add it and related functions to the scsh exports. A commit to fix that will be in shortly.

It seems the other errors you've run into are a bug with the (begin ...) process form. It only shows itself in output / input redirections, including pipes. The fix doesn't seem straight forward because of some technicalities with s48; it'll take some investigation.

BTW, your attempt to ,load didn't work because that file requires certain imports that aren't in the default package. See the file scsh-packages.scm for examples of how loading these libraries is set up.

roderyc commented 10 years ago

This is fixed now by 9e6392b1e4129f10ba3880377f211576de222fe3 and a8371bc000a2861fe0b6c380aa4789133062d9ab

michael-heerdegen commented 10 years ago

Roderic Morris notifications@github.com writes:

This is fixed now by 9e6392b and a8371bc

Yip, everything works well now for me, including (begin ...).

Many Thanks!