public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Peter Lane <peter@peterlane.info>
To: kawa@sourceware.org
Subject: read in script vs compiled
Date: Thu, 09 Mar 2017 23:19:00 -0000	[thread overview]
Message-ID: <37bfb557-9645-4ae3-7e3c-7c217b664d38@peterlane.info> (raw)

Hi,

I may be misunderstanding something here about how the jvm uses terminal 
input, and how that interacts with Kawa.

I am trying to get some user input from the terminal in a script, but I 
receive Null pointer errors with Kawa.  On a little investigation, Kawa 
does not seem to like input entered from the terminal, but is ok with 
input from a redirected file or when compiled to a class file and run 
with java, or in the REPL.  (I'm using bash under ubuntu.)

(If I display the current input port I get: #<input-port /dev/stdin>  
which looks right.)

This happens with the simplest file, e.g. a file "read.scm" containing 
simply:  (read)

If I compile to a .class file and run it through Java, read works:

$ kawa --main -C read.scm
$ java -cp .:/home/peter/Software/kawa-2.3/lib/kawa.jar read
1

But I get an exception if I use kawa to run the .class file, or if I run 
the .scm file as a script:

$ kawa read.scm
1
java.lang.NullPointerException
     at gnu.expr.Compilation.getFileName(Compilation.java:2641)
     at gnu.lists.PairWithPosition.<init>(PairWithPosition.java:74)
     at kawa.lang.Translator.pushPositionOf(Translator.java:1317)
     at kawa.lang.Translator.scanForm(Translator.java:1501)
     at gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:115)
     at gnu.expr.Language.parse(Language.java:776)
     at gnu.expr.Language.parse(Language.java:770)
     at gnu.kawa.io.JLineInPort.parse(JLineInPort.java:93)
     at 
org.jline.reader.impl.LineReaderImpl.acceptLine(LineReaderImpl.java:2493)
     at 
org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:518)
     at gnu.kawa.io.JLineInPort.fill(JLineInPort.java:163)
     at gnu.kawa.io.InPort.read(InPort.java:445)
     at gnu.kawa.io.TtyInPort.read(TtyInPort.java:227)
     at gnu.kawa.lispexpr.LispReader.readObject(LispReader.java:482)
     at gnu.kawa.lispexpr.LispReader.readObject(LispReader.java:466)
     at kawa.lib.ports.read(ports.scm:367)
     at kawa.lib.ports.read(ports.scm:363)
     at read.run(read.scm:3)
     at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:293)
     at gnu.expr.CompiledModule.evalModule(CompiledModule.java:42)
     at gnu.expr.CompiledModule.evalModule(CompiledModule.java:60)
     at kawa.Shell.runFile(Shell.java:565)
     at kawa.Shell.runFileOrClass(Shell.java:468)
     at kawa.repl.processArgs(repl.java:700)
     at kawa.repl.main(repl.java:820)

--
Peter Lane
http://peterlane.info/scheme.html

             reply	other threads:[~2017-03-09 23:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 23:19 Peter Lane [this message]
2017-03-09 23:48 ` Per Bothner
2017-03-10  5:51   ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37bfb557-9645-4ae3-7e3c-7c217b664d38@peterlane.info \
    --to=peter@peterlane.info \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).