Re: Box command in Inform (longish)


23 Mar 95 18:25:48

Bob Newell (bnewell@delphi.com) wrote:

> I saw another posting about someone having trouble with the "box"
> command. I too am not successful using it, and I've mostly ruled out
> version problems, since I get identical errors on all Inform versions to
> which I have access (PC/386, PC).
>
> Can someone who has made this work (and it obviously does work in some
> sccircumstances, based on Curses display) post a working example? I think
> that would help everyone.

I know I'm replying to an oldish post, and that someone else might
already have said this; usenet news has been somewhat erratic where
I am lately ...

Anyway, I do have a short example that uses 'box' which does compile
if I define a COMPILE_WITHOUT_ERRORS constant, but will fail if I
don't. Considering the way the program looks, it seems like an error
in the compiler to me.

The way I understand the 'box' instruction, it inserts Inform code to
call the function Box__Routine(), which isn't in the library, but is
defined automagically in any program that uses 'box'.

It looks like there are certain circumstances when inserting this
Box__Routine() causes a syntax error.

Torbj|rn Andersson

--- Cut here ---

! The following program was compiled using Unix Inform 5.4 (v1405/a) which
! is the most recent version I know of. If others can verify the behaviour,
! I guess it is a bug in the Inform compiler.

Switches xdv5s;

Constant Story "BOXING";
Constant HEADLINE "^The Noble Art of Bug Reporting^";

Constant COMPILE_WITHOUT_ERRORS;

Include "Parser";
Include "VerbLib";

#IFDEF COMPILE_WITHOUT_ERRORS;
[ Foo;
box "Hello World";
];
#ENDIF;

Object Start_Room "Forest Path"
with number 0,
description "The path winds through the forest.",
each_turn [;
self.number = self.number + 1;

if (self hasnt general) {
if (self.number == 1)
"^Nothing much happens. But you are sure something will happen \
pretty soon now.";

if (self.number == 2)
"^Any minute now. No self-respecting adventure could consist of \
only one room where nothing happens, after all.";
} else {
if (self.number < 3)
"^Although nothing very exciting happened before, you just can't \
shake the feeling that something of earth-shattering importance \
WILL happen any minute now.";
}

if (self.number == 3) {
self.number = 0;
print "^A small bug crawls across the path.^";

if (self hasnt general) {
print "^(I guess it wasn't all that exciting, after all)^";
give self general;
box "Even a cup of yummy coffee won't improve"
"things when you see ~page 1 of 12~ on the"
"first bug report form."
""
" -- Dave Lebling";
}
}
],
has light;

[ Initialise;
location = Start_Room;
print "^^^^^It's a bird! It's a plane! It's ...^^";
];

Include "Grammar";

end;