int prolog_code_call(CTXTdeclc Cell term, int value) { Psc psc; if (isconstr(term)) { int disp; char *addr; psc = get_str_psc(term); addr = (char *)(clref_val(term)); for (disp = 1; disp <= (int)get_arity(psc); ++disp) { bld_copy(reg+disp, cell((CPtr)(addr)+disp)); } bld_int(reg+get_arity(psc)+1, value); } else bld_int(reg+1, value); return TRUE; }
Psc synint_proc(CTXTdeclc Psc psc, int intcode) { if (pflags[intcode+INT_HANDLERS_FLAGS_START]==(Cell)0) { /* default hard handler */ default_inthandler(CTXTc intcode); psc = 0; } else { /* call Prolog handler */ switch (intcode) { case MYSIG_UNDEF: /* 0 */ SYS_MUTEX_LOCK( MUTEX_LOAD_UNDEF ) ; case MYSIG_KEYB: /* 1 */ case MYSIG_SPY: /* 3 */ case MYSIG_TRACE: /* 4 */ case THREADSIG_CANCEL: /* f */ case MYSIG_CLAUSE: /* 16 */ if (psc) bld_cs(reg+1, build_call(CTXTc psc)); psc = (Psc)pflags[intcode+INT_HANDLERS_FLAGS_START]; bld_int(reg+2, asynint_code); pcreg = get_ep(psc); break; case MYSIG_ATTV: /* 8 */ /* the old call must be built first */ if (psc) bld_cs(reg+2, build_call(CTXTc psc)); psc = (Psc)pflags[intcode+INT_HANDLERS_FLAGS_START]; /* * Pass the interrupt chain to reg 1. The interrupt chain * will be reset to 0 in build_interrupt_chain()). */ bld_copy(reg + 1, build_interrupt_chain(CTXT)); /* bld_int(reg + 3, intcode); */ /* Not really needed */ pcreg = get_ep(psc); break; default: xsb_abort("Unknown intcode in synint_proc()"); } /* switch */ } return psc; }