[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jan 11 15:06:18 2000 
Subject:Re: POP Bug or Lamer Ignornace? 
From:Lee 
Volume-ID:1000111.01 

Aaron Sloman See text for reply address wrote:
> 
> [To reply replace "Aaron.Sloman.XX" with "A.Sloman"]
> 
> Lee <L.Goddard@sussex.ac.uk> writes:
> 
> > Date: Mon, 10 Jan 2000 09:32:35 +0000
> >
> > Hi all
> >
> > I've got a little POP program that includes the following line:
> >
> >       vars debug = false;
> 
> Is that supposed to be pop_debugging ?

No idea.... probably should have, thanks for the tip!
 
> >       constant c = getline('Departure: ');
> >       constant d = getline('Destination or enter Q to quit: ');
> >
> > Is this for some reason invalid?
> 
> It could be valid pop-11 but it may not behave as you expect,

That's the truth!
 
> You can't include constant declarations inside a procedure.

Understood.
 
> If you try to compile them directly outside a procedure (why?), by
> compiling a whole file or a marked range then you may find that the
> first call of "getline" reads in the second line, because getline
> calls readline and readline reads from the current input stream
> (i.e. from proglist), which may be the file currently being
> compiled.

Understood, but n/app.
 
> Inside ved, readline is re-defined to overcome this, but because
> the default version of readline caused problems for emacs users
> running pop-11 from an emacs window, we produced an alternative
> version of readline, defined in
> 
>     http://www.cs.bham.ac.uk/research/poplog/lib/emacsreadline.p
> 
> This is the definition:
> 
> define emacsreadline() -> list;
>         lvars item, list,
>                 procedure rep = incharitem(charin);             ;;; item repeater
> 
>         dlocal popnewline = true, popprompt = pop_readline_prompt;
> 
>         ;;; Make a list items to next newline
>         [% until (rep() ->> item) == newline do item enduntil %] -> list;
> 
> enddefine;
> 
> Then you can do this:
> 
> emacsreadline -> readline;
> 
> before you compile getline.

I shall try the above, thanks.
 
> > On loading the program into
> > VED for Win32,
> 
> What do you mean by loading the program into Ved? If you read
> a file into ved you should not get any such error. You must have
> tried running the program.

% Winpop11.exe +startup
Setpop
: load temp.p


 
> > I get a strange response:
> 
> I suspect that what you actually have in your procedure is different
> from what you posted in your email message, since what you had in
> your message should not produce this output:
> 
> >
> >       Departure:
> >       ;;; DECLARING VARIABLE debug
> >       ;;; DECLARING VARIABLE d
> >
> 
> > The next output the program intends to make
> 
> You need to be more precise about how exactly you produce this
> output. What exactly is the printing instruction?

Ah.
 
> > includes some
> > strangeness too:
> >
> >       Calculating route from  [constant d =
> >       getline('Destination or enter Q to quit: ');] to
> >       <undef c>.
> >
> > I hope you can see what's happening there: but could you
> > please let me know why it happens?  Changing the datatype from
> > from constant to vars produces a different MISHAP: ste.
> 
> You have posted a very incomplete fragment of information.
> 
> It is impossible to see from all this what code you were running,
> how you ran it, what output you were expecting, etc.

I thought that might be the case.  My hope was to establish whether
there was a known issue, or I if I was making an obvious mistake
that I was overlooking due to tiredness.
 
> My guess is that the first call of getline read in the second
> line, made a list of the conents, assigned it to the variable c,
> and then later you were trying to print out the value of c.
> 
> But that would not account for the <undef c>
> 
> > Hardcoding the same vars/constants allows the script to run
> > without mishaps.
> 
> What do you mean by "hardcoding"? Pop-11 as far as I know makes no
> difference between hard and soft or any other kind of coding.

Sorry, scriptor speak: replacing the user-input from getline with
a declaration, as if the input had been given.

Perhpas this will help to clarify, or to bore you totally:

In a text.p file:
	vars a;
	getline('Text...')->a;

	run winpop11.exe +startup
	Setpop
	: Load text.p
	Text...
	:

No pause for input.

I'm now confused, and looking to install Linux.

Thanks for your time, though.
Lee