Beispiel #1
0
void ContextRepairChildAssertions(Context *cx_parent, Context *cx_child)
{
  Obj		*obj;
  ObjList	*p;
  for (p = cx_child->assertions; p; p = p->next) {
    if (N("leadto") != I(p->obj, 0)) continue;
      /* For now, these are the only types of objects needing repair */
    if (DbgOn(DBGDB, DBGHYPER)) {
      fputs("REPAIRED ", Log);
      ObjPrint1(Log, p->obj, NULL, 5, 1, 0, 1, 0);
      fputs(" to ", Log);
    }
    if ((obj = ContextMapAssertion(cx_parent, cx_child, I(p->obj, 1)))) {
      ObjSetIth(p->obj, 1, obj);
      if (ObjToTsRange(obj)->cx != cx_child) {
        Stop();
      }
    }
    if ((obj = ContextMapAssertion(cx_parent, cx_child, I(p->obj, 2)))) {
      ObjSetIth(p->obj, 2, obj);
      if (ObjToTsRange(obj)->cx != cx_child) {
        Stop();
      }
    }
    if (DbgOn(DBGDB, DBGHYPER)) {
      ObjPrint1(Log, p->obj, NULL, 5, 1, 0, 1, 0);
      fputc(NEWLINE, Log);
    }
  }
}
Beispiel #2
0
Float AgeOf(Ts *ts, Obj *obj)
{
  Dur		dur;
  Obj		*born;
  TsRange	*tsr;
  if (!TsIsSpecific(ts)) return(FLOATNA);
  born = R1E(&TsNA, L(N("born"), obj, ObjWild, E));
  if (born) {
    tsr = ObjToTsRange(born);
    dur = TsMinus(ts, &tsr->startts);
    return(((Float)dur)/SECONDSPERYEARF);
  }
  /* todo: Make inferences based on occupation etc. */
  return(20.0);
}