Re: [Bug-apl] Gnu APL Quad-Quote read coming from souce file and not the terminal

2014-09-16 Thread Juergen Sauermann

  
  
Hi Fred,
  
  I had a look at the old code and saw that for ⍞ and ⎕ testcase
  files
  are handled differently than script files.
  
  I have recreated the old behavior in SVN 475.
  
  I noticed that echo of the ⍞ input is off when GNU APL is run from
  a script.
  I have not yet considered the combination of scripting with
  interactive input, so
  I am not sure if this is OK. Or maybe such scripts should not run
  with --script (which implies
  --noCIN).
  
  /// Jürgen
  
  

On 09/15/2014 06:02 PM, Frederick H.
  Pitts wrote:


  Hello Juergen,

	1) Up until at svn 443, ⍞ references were from the terminal for shell
scripts and files processed with 'apl -f'.  Sure of that because I just
checked out that and earlier svn versions and tested.  ⍞ references
being coupled to script APL source files and not the terminal is a
relatively recent change in how Gnu APL works.

	2) The "APL2 Programming: Language Reference" and "ISO/IEC
13751:2000(E)" give no indication that ⍞ is ever connected to anything
other than a terminal.

	3) If ⍞ references in shell script and apl -f processed files have to
be satisfied by reading from the apl source file, what is the point of
directing assignments to ⍞ to the terminal?  The user is not going to be
able to respond to the prompts, at least, not from the terminal.

Regards,

Fred

On Mon, 2014-09-15 at 14:28 +0200, Juergen Sauermann wrote:

  
Hi Fred,

first of all, please note that CORE_COUNT_WANTED= has currently no
effect since I am working on that.
I fixed Parallel.cc so that it compiles, SVN 473.

Regarding ⍞ your expectation seems to be that ⍞ always reads from the
terminal
even if the input comes from a file?

This is not so in GNU APL; ⍞ reads from stdin of the process and if
that is a file then the input
is read from the file. Your example below gives (anfd should give):

eedjsa@server65:~/apl/apl-1.4/src$ ./hello.apl 
What is your name?  Hello 


This is easier to undestand if we change the line before )OFF to
something non-empty:

#!./apl --script --
⍝ --
∇hello; X
 ⍞ ← 'What is your name?  '
 X ← ⍞
 ⎕ ← 'Hello ', ( X ≠ ' ' ) / X
∇

hello
!!! this line is read by ⍞ in function hello !!!
)OFF
⍝ --

This gives:

eedjsa@server65:~/apl/apl-1.4/src$ ./hello.apl 
What is your name?  Hello !!!thislineisreadby⍞infunctionhello!!!

So far everything looks OK, at least on my machine. Of cause you could
argue
if reading from stdin was a good choice in the first place. I believe
it was because:

- you cannot assume to always have a usable terminal
- testcase files (for testing ⍞ in particular)
- CGI scripts written in APL (which communicates with APL via stdin
and stdout)

/// Jürgen


On 09/15/2014 12:17 AM, Frederick H. Pitts wrote:



  Hello Juergen,

	I cloned svn 472, configured and tried to build.  I find that if
I configure with CORE_COUNT_WANTED=argv, the following compiler error
results:

Parallel.cc: In static member function 'static void
Parallel::init_CPUs(bool)':
Parallel.cc:333:7: 'uprefs' was not declared in this scope
uprefs.requested_cc; // parallel, as per --cc option

A similar but differ error occurs if I use CORE_COUNT_WANTED=syl.

	If I configure without specifying CORE_COUNT_WANTED, the build
completes OK.  However I'm still having the problem of the ⍞ reference
not reading from the terminal.

	Something as simple as:

#!/usr/local/bin/apl --script --
⍝ --
∇hello; X
 ⍞ ← 'What is your name?  '
 X ← ⍞
 ⎕ ← 'Hello ', ( X ≠ ' ' ) / X
∇

hello

)OFF
⍝ --

demonstrates the issue.  If the above is executed as a shell script with

	./hello.apl

or the apl invocation

	apl -f hello.apl

the ⍞ reference input is not coming from the terminal.

Regards,

Fred

On Sun, 2014-09-14 at 16:27 +0200, Juergen Sauermann wrote:

  
Hi Fred,

Thanks. I see some debug outout at the end of your file:

  hello
What is your name?  
)SI not cleared at the end of ./hello.apl:
hello[2]  X ← ⍞
  ^
⋆  hello
   ^

That debug output should only occur if a testcase file is executed and
not for normal script file like your hello.apl. This should be fixed
in SVN 472.

--

Apart from that I can't really see what is wrong. The intended
behavior (and the actual behavior on
my box) is that GNU APL reads from input files as long as there are
unprocessed files and switch
to stdin after the last input file was processed.

In your case, hello.apl defines function hello and calls it on the
last line of hello.apl.
After having read the last line of hello.apl, the next input is read
from stdin:

  hello   ← from script
What is your name?  Jürgen← from stdin
Hello Jürgen

If your box behaves differently then I need more details.

/// Jürgen



On 09/13/2014 03:31 AM, Frederick

Re: [Bug-apl] Why do I hit this SYSTEM LIMIT?

2014-09-16 Thread Juergen Sauermann

  
  
Hi Peter,
  
  I have added the limit to ⎕SYL and also increased it. SVN 476.
  
  The limit is the max. number of not yet reduced Token per APL
  statement.
  It can be reached for deeply nested expressions.
  
  /// Jürgen
  
  

On 09/15/2014 08:44 PM, Peter Teeson
  wrote:


c←⍳9
 d←'c',('n',⊃⍕¨c),'←'),'⍳'),'0'),'  '),'◊'
SYSTEM LIMIT (prefix length)
  d←'c',('n',⊃⍕¨c),'←'),'⍳'),'0'),'  '),'◊'
  ^   ^
 but this is OK? 
d←((('c',('n',⊃⍕¨c),'←'),'⍳'),'0'),'  '

I don't see prefix length in ⎕SYL.

I don't understand. Sorry but my coffee must not be working….

Peter




  




Re: [Bug-apl] Gnu APL Quad-Quote read coming from souce file and not the terminal

2014-09-16 Thread Frederick H. Pitts
Hello Juergen,

As of SVN 475, I'm able to run a medium size STARTREK2 game
successfully as a shell script with the following first line

#!/usr/local/bin/apl --noColor --

I don't see any negative effect from not having -s, --script, --noCIN or
--rawCIN in the above first line and I do see that keystrokes are not
echoed to the screen if any of them are there.  Note the game uses ⍞
almost exclusively for terminal IO with extensive use of ANSI escape
sequences.

Is there any reason I should be concerned about not having -s,
--script, etc in the first line?

BTW, the CORE_COUNT_WANTED=argv configure option results in a makefile
that runs to completion but produces an apl executable that immediately
crashes upon invocation with verbiage that indicates there is a problem
with 'argv'
processing.  I will stop using CORE_COUNT_WANTED until I hear that it is
OK to use again.

Thanks,

Fred

On Tue, 2014-09-16 at 12:23 +0200, Juergen Sauermann wrote:
> Hi Fred,
> 
> I had a look at the old code and saw that for ⍞ and ⎕ testcase files
> are handled differently than script files.
> 
> I have recreated the old behavior in SVN 475.
> 
> I noticed that echo of the ⍞ input is off when GNU APL is run from a
> script.
> I have not yet considered the combination of scripting with
> interactive input, so
> I am not sure if this is OK. Or maybe such scripts should not run with
> --script (which implies
> --noCIN).
> 
> /// Jürgen
> 
> 
> On 09/15/2014 06:02 PM, Frederick H. Pitts wrote:
> 
> > Hello Juergen,
> > 
> > 1) Up until at svn 443, ⍞ references were from the terminal for shell
> > scripts and files processed with 'apl -f'.  Sure of that because I just
> > checked out that and earlier svn versions and tested.  ⍞ references
> > being coupled to script APL source files and not the terminal is a
> > relatively recent change in how Gnu APL works.
> > 
> > 2) The "APL2 Programming: Language Reference" and "ISO/IEC
> > 13751:2000(E)" give no indication that ⍞ is ever connected to anything
> > other than a terminal.
> > 
> > 3) If ⍞ references in shell script and apl -f processed files have to
> > be satisfied by reading from the apl source file, what is the point of
> > directing assignments to ⍞ to the terminal?  The user is not going to be
> > able to respond to the prompts, at least, not from the terminal.
> > 
> > Regards,
> > 
> > Fred
> > 
> > On Mon, 2014-09-15 at 14:28 +0200, Juergen Sauermann wrote:
> > > Hi Fred,
> > > 
> > > first of all, please note that CORE_COUNT_WANTED= has currently no
> > > effect since I am working on that.
> > > I fixed Parallel.cc so that it compiles, SVN 473.
> > > 
> > > Regarding ⍞ your expectation seems to be that ⍞ always reads from the
> > > terminal
> > > even if the input comes from a file?
> > > 
> > > This is not so in GNU APL; ⍞ reads from stdin of the process and if
> > > that is a file then the input
> > > is read from the file. Your example below gives (anfd should give):
> > > 
> > > eedjsa@server65:~/apl/apl-1.4/src$ ./hello.apl 
> > > What is your name?  Hello 
> > > 
> > > 
> > > This is easier to undestand if we change the line before )OFF to
> > > something non-empty:
> > > 
> > > #!./apl --script --
> > > ⍝ --
> > > ∇hello; X
> > >  ⍞ ← 'What is your name?  '
> > >  X ← ⍞
> > >  ⎕ ← 'Hello ', ( X ≠ ' ' ) / X
> > > ∇
> > > 
> > > hello
> > > !!! this line is read by ⍞ in function hello !!!
> > > )OFF
> > > ⍝ --
> > > 
> > > This gives:
> > > 
> > > eedjsa@server65:~/apl/apl-1.4/src$ ./hello.apl 
> > > What is your name?  Hello !!!thislineisreadby⍞infunctionhello!!!
> > > 
> > > So far everything looks OK, at least on my machine. Of cause you could
> > > argue
> > > if reading from stdin was a good choice in the first place. I believe
> > > it was because:
> > > 
> > > - you cannot assume to always have a usable terminal
> > > - testcase files (for testing ⍞ in particular)
> > > - CGI scripts written in APL (which communicates with APL via stdin
> > > and stdout)
> > > 
> > > /// Jürgen
> > > 
> > > 
> > > On 09/15/2014 12:17 AM, Frederick H. Pitts wrote:
> > > 
> > > > Hello Juergen,
> > > > 
> > > > I cloned svn 472, configured and tried to build.  I find that if
> > > > I configure with CORE_COUNT_WANTED=argv, the following compiler error
> > > > results:
> > > > 
> > > > Parallel.cc: In static member function 'static void
> > > > Parallel::init_CPUs(bool)':
> > > > Parallel.cc:333:7: 'uprefs' was not declared in this scope
> > > > uprefs.requested_cc; // parallel, as per --cc option
> > > > 
> > > > A similar but differ error occurs if I use CORE_COUNT_WANTED=syl.
> > > > 
> > > > If I configure without specifying CORE_COUNT_WANTED, the build
> > > > completes OK.  However I'm still having the problem of the ⍞ reference
> > > > not reading from the terminal.
> > > > 
> > > > Something as simple as:
> > > > 
> > > > #!/usr/local/bin

[Bug-apl] errors in latest SVN

2014-09-16 Thread Peter Teeson
/Volumes/Data/Development/MyProjects/GNUAPL/apl-svn/src/Parallel.cc:181:1: 
Unknown type name 'cpu_set_t'
/Volumes/Data/Development/MyProjects/GNUAPL/apl-svn/src/Parallel.cc:197:55: Use 
of undeclared identifier 'cpu_set_t'
/Volumes/Data/Development/MyProjects/GNUAPL/apl-svn/src/Parallel.cc:323:1: 
Unknown type name 'cpu_set_t'


[Bug-apl] Patch: output buffering

2014-09-16 Thread David Lamkins
Here's a minor tweak to flush cout before disabling cout buffering. This
seems like something the runtime library ought to do, but it makes a
difference on my system.


-- 
"The secret to creativity is knowing how to hide your sources."
   Albert Einstein


http://soundcloud.com/davidlamkins
http://reverbnation.com/lamkins
http://reverbnation.com/lcw
http://lamkins-guitar.com/
http://lamkins.net/
http://successful-lisp.com/
Index: src/Output.cc
===
--- src/Output.cc	(revision 476)
+++ src/Output.cc	(working copy)
@@ -194,7 +194,11 @@
 void
 Output::init(bool logit)
 {
-   if (!isatty(fileno(stdout))) cout.setf(ios::unitbuf);
+   if (!isatty(fileno(stdout)))
+  {
+cout.flush();
+cout.setf(ios::unitbuf);
+  }
 
 #if CURSES_USABLE