From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65520 invoked by alias); 9 Mar 2017 23:19:48 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 65509 invoked by uid 89); 9 Mar 2017 23:19:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=BAYES_40,KAM_INFOUSMEBIZ autolearn=no version=3.3.2 spammy=H*M:info, H*UA:45.2.0, H*u:45.2.0, H*Ad:U*peter X-HELO: butterfly.ash.relay.mailchannels.net Received: from butterfly.ash.relay.mailchannels.net (HELO butterfly.ash.relay.mailchannels.net) (23.83.222.27) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Mar 2017 23:19:46 +0000 X-Sender-Id: hostpapa|x-authuser|peter@peterlane.info Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B8EBB203686 for ; Thu, 9 Mar 2017 23:19:41 +0000 (UTC) Received: from hp114.hostpapa.com (unknown [100.96.135.39]) by relay.mailchannels.net (Postfix) with ESMTPA id 01DF6200262 for ; Thu, 9 Mar 2017 23:19:40 +0000 (UTC) X-Sender-Id: hostpapa|x-authuser|peter@peterlane.info Received: from hp114.hostpapa.com (hp114.hostpapa.com [172.20.63.14]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.7.32); Thu, 09 Mar 2017 23:19:41 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: hostpapa|x-authuser|peter@peterlane.info X-MailChannels-Auth-Id: hostpapa X-Troubled-Quick: 3b70408e7b42cb5f_1489101581269_214912462 X-MC-Loop-Signature: 1489101581269:1657521039 X-MC-Ingress-Time: 1489101581269 Received: from host86-190-156-102.range86-190.btcentralplus.com ([86.190.156.102]:34064 helo=[192.168.1.64]) by hp114.hostpapa.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1cm7LN-002z9a-Mj for kawa@sourceware.org; Thu, 09 Mar 2017 23:19:38 +0000 To: kawa@sourceware.org From: Peter Lane Subject: read in script vs compiled Message-ID: <37bfb557-9645-4ae3-7e3c-7c217b664d38@peterlane.info> Date: Thu, 09 Mar 2017 23:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=0.6 X-AuthUser: peter@peterlane.info X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00063.txt.bz2 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: # 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.(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