1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/* $Id: $ */
/* Copyright (C) 1997 Sverre Hvammen Johansen and Terje Mjoes,
* Department of Informatics, University of Oslo.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "cim.h"
#include "simfile.h"
/******************************************************************************
RutineResume */
void
__rresume (ob, ret, mret)
__dhp ob;
int ret;
void (*mret) ();
{
__dhp sh;
if (ob == __NULL)
__rerror ("Resume: NONE-pointer");
if (ob->dt == __RESUMED)
{
__goto.ent = ret;
__goto.ment = mret;
return;
}
if (ob->sl->pp->kind != __KPRBLK && ob->sl->pp->kind != __KBLOKK)
__rerror ("Resume: Illegal object");
if (ob->dt == __TERMINATED || ob->dt == __EXECUTING)
__rerror ("Resume: Object is executing or terminated");
sh = __NULL;
while (__lb != ob->sl)
{
if (__lb == (__dhp) & __blokk0FILE)
__rerror ("Resume: Illegal object");
sh = __lb;
if (__lb->dt == __EXECUTING || __lb->pp == (__pty) __ACTS)
__lb = __lb->dl;
else
__lb = __lb->sl;
}
if (sh == __NULL || (sh->pp != (__pty) __THUNK && sh->pp != (__pty) __ACTS &&
sh->pp->kind != __KCLASS))
{ /* __lb peker p} system-hodet. */
__goto = ob->ex;
__lb = ob->dl;
ob->dl = __pb;
ob->ex.ent = ret;
ob->ex.ment = mret;
ob->dt = __RESUMED;
__pb = __lb;
}
else
{
/* Object-component, som sh peker p} */
__goto = ob->ex;
__lb = ob->dl;
if (sh->dt == __RESUMED)
{
ob->dl = sh->dl;
ob->ex = sh->ex;
sh->dl = __pb;
sh->ex.ent = ret;
sh->ex.ment = mret;
sh->dt = __DETACHED;
}
else
{
ob->dl = __pb;
ob->ex.ent = ret;
ob->ex.ment = mret;
}
ob->dt = __RESUMED;
__pb = __lb;
}
}
|