[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 ?
> 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,
You can't include constant declarations inside a procedure.
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.
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.
> 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.
> 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?
> 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.
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.
Aaron
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/
|