1 /************************************************************************* 2 * * 3 * YAP Prolog * 4 * * 5 * Yap Prolog was developed at NCCUP - Universidade do Porto * 6 * * 7 * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * 8 * * 9 ************************************************************************** 10 * * 11 * File: corout.c * 12 * Last rev: * 13 * mods: * 14 * comments: Co-routining from within YAP * 15 * * 16 *************************************************************************/ 17 #ifdef SCCS 18 static char SccsId[]="%W% %G%"; 19 #endif 20 21 typedef struct sus_record_struct { 22 Functor f; 23 Term NR; /* next record for same variable */ 24 Term SG; /* actual suspended goal */ 25 Term NS; /* other suspended goals */ 26 } sus_record; 27 28 typedef struct sus_tag_struct { 29 Term ActiveSus; /* if unbound suspension active, if bound terminated */ 30 CELL sus_id; 31 Term TimeStamp; /* actual suspended goal */ 32 Term SG; /* list of suspended goals */ 33 } sus_tag; 34 35 #ifdef COROUTINING 36 /*********** tags for suspension variables */ 37 #define AbsSuspendedVar(sustag_ptr) AbsAppl(((CELL *)(sustag_ptr))) 38 #define RepSuspendedVar(val) ((sus_tag *)RepAppl(val)) 39 #endif 40 41