IMPORT EM;
+ CONST
+ ERRTOOLARGE = 64; (* stack size of process too large *)
+ ERRTOOMANY = 65; (* too many nested traps + handlers *)
+ ERRNORESULT = 66; (* no RETURN from function procedure *)
+ ERRCARDOVFL = 67; (* CARDINAL overflow *)
+
TYPE TrapHandler = EM.TrapHandler;
PROCEDURE InstallTrapHandler(t: TrapHandler): TrapHandler;
{ M2_TOOLARGE, "stack size of process too large"},
{ M2_TOOMANY, "too many nested traps + handlers"},
{ M2_NORESULT, "no RETURN from procedure function"},
+ { M2_UOVFL, "cardinal overflow"},
{ -1, 0}
};
#include <m2_traps.h>
+/* Runtime handling of "value" conformant arrays.
+ The routine that accepts the conformant array parameter first calls
+ the routine new_stackptr. This routine computes a new stack pointer
+ for the calling routine and returns it. The new space on the stack is
+ large enough to store the array.
+ Then, it calls copy_array to do the copying.
+*/
+
struct descr {
char *addr;
int low;
_new_stackptr(pdescr, a)
register struct descr *pdescr;
{
+ /* The parameter "a" is not used and not supplied.
+ It's address is the old stack-pointer.
+ */
unsigned int size = (((pdescr->highminlow + 1) * pdescr->size +
(EM_WSIZE - 1)) & ~(EM_WSIZE - 1));
}
_copy_array(p, a)
- register char *p;
+ register int *p;
{
- register char *q;
+ register int *q;
register unsigned int sz;
char dummy;
ppdescr--;
- sz = (((*ppdescr)->highminlow + 1) * (*ppdescr)->size +
- (EM_WSIZE -1)) & ~ (EM_WSIZE - 1);
+ sz = (((*ppdescr)->highminlow + 1) * (*ppdescr)->size) / EM_WSIZE;
if ((char *) &a - (char *) &dummy > 0) {
- (*ppdescr)->addr = q = (char *) &a;
+ (*ppdescr)->addr = (char *) (q = &a);
}
- else (*ppdescr)->addr = q = (char *) &a - sz;
+ else (*ppdescr)->addr = (char *) (q = &a - sz);
while (sz--) *q++ = *p++;
}