[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cray C-90 (UNICOS 8.0.3) support?
> I have been trying to get es-0.84 to compile on our Cray C-90, running
> Unicos 8.0.3 and I keep getting the following message:
>
> (vn.~/usr/build/es-0.84) make
> cc -hstdc -O -I/u/vb/gray/usr/include/readline -c closure.c -o closure.o
> cc-408 cc: ERROR File = closure.c, Line = 126
> The macro "setjmp" appears in an invalid context.
>
> The problem is in the pushhandler macro from es.h. Has anyone else had
> difficulty with this?
I believe that there's no simple workaround. I got this note from the
last person who I knew of who tried to bring es up on a Cray. (I don't
see how Cray can say they ship ANSI C while imposing these restrictions,
but I'm not in the supercomputer business.)
| From: djc@niwot.scd.ucar.EDU (Dennis Colarelli)
| To: haahr (Paul Haahr)
| Subject: Re: for better or for worse,
| Date: Fri, 30 Apr 93 15:36:26 MDT
|
| > can you tell me what the restrictions on setjmp are? i'll try to make
| > pushhandler() more portable if you can tell me what has to be done.
|
| Attached are the restrictions from the UNICOS setjmp man page. Note
| that if you want to run es on the Cray 3, CSOS has, I believe, even further
| restrictions. I'll know more when it gets here.
|
| An invocation of the setjmp macro can appear only in one of the following
| contexts:
|
| o The entire controlling expression of a selection or iteration
| statement (if, for, while, do, switch)
|
| o One operand of a relational or equality operator with the other
| operand an integral constant expression, and with the resulting
| expression being the entire controlling expression of a selection
| or iteration statement
|
| o The operand of a unary ! operator with the resulting expression
| being the entire controlling expression of a selection or
|
| o The entire expression of an expression statement (possibly cast
| to void)
The definition of pushhandler is:
#define pushhandler(hp) ( \
((hp)->rootlist = rootlist), \
((hp)->pushlist = pushlist), \
((hp)->evaldepth = evaldepth), \
((hp)->up = tophandler), \
(tophandler = (hp)), \
(setjmp((hp)->label) ? raised(exception) : NULL) \
)
which clearly violates those assumptions. On the other hand, all but
one of its uses are of the form
List *e;
Handler h;
...
if ((e = pushhandler(&h)) != NULL) {
... catching code using e ...
}
... main body ...
pophandler(&h);
and the other use has a while instead of an if and could be rewritten
to be an if inside a loop with an extra test, so macrology of the form
#define exception_handler \
{ \
Handler _localhandler;
_localhandler.rootlist = rootlist; \
_localhandler.pushlist = pushlist; \
_localhandler.evaldepth = evaldepth; \
_localhandler.up = tophandler; \
tophandler = &_localhandler; \
if (!setjmp(_localhandler.label)) {
#define catch_exception(e) \
pophandler(&_localhandler); \
} else { \
List *e = raised(exception); \
#define end_exception_handler \
} \
}
combined with rewriting all the uses as
...
exception_handler
... main body ...
catch_exception (e)
... catching code using e ...
end_exception_handler
would probably be acceptable to Cray.
Pardon me if my C code is somewhat rusty. The ever-forthcoming next
release of es may include something like this. For now, you'll have to
roll it yourself.
Paul