void clop_straightforward_closure_clone_ex(void *internals, const clone *base, const clone *suppl, struct clone *closure) {
  clone recruit;
  clone_init(&recruit);
  
  for(clone_iterator it1 = clone_iterator_begin(suppl); !clone_iterator_end(suppl, &it1); clone_iterator_next(&it1)) {
    pred p1 = clone_iterator_deref(&it1);
    
    /* apply ops of arity 1 for supplement predicates */
    op_permut(&p1, &recruit);
    op_proj(&p1, &recruit);
    op_ident(&p1, &recruit);

    /* apply ops of arity 2:
     * the first predicate is taken from  the supplement,
     * while the second — from the supplement set and from the base set */
    for(clone_iterator it2 = clone_iterator_begin(suppl); !clone_iterator_end(suppl, &it2); clone_iterator_next(&it2)) {
      pred p2 = clone_iterator_deref(&it2);
      op_conj(&p1, &p2, &recruit);
      op6(&p1, &p2, &recruit);
      op_trans(&p1, &p2, &recruit);
    }
    for(clone_iterator it3 = clone_iterator_begin(base); !clone_iterator_end(base, &it3); clone_iterator_next(&it3)) {
      pred p3 = clone_iterator_deref(&it3);
      op_conj(&p1, &p3, &recruit);
      op6(&p1, &p3, &recruit);
      op_trans(&p1, &p3, &recruit);
    }
  }

  clone new_base;
  clone_union(base, suppl, &new_base);

  clone diff;
  clone_diff(&recruit, &new_base, &diff);
  
  if(!clone_is_empty(&diff)) {
    /* if we've found new predicates, recursively continue computation */
    clop_straightforward_closure_clone_ex(internals, &new_base, &diff, closure);
  } else {
    /* if we haven't found new predicates, the computation is finished */
    clone_copy(&new_base, closure);
  }
}
Ejemplo n.º 2
0
  op12 (0x40, ldw_ir)
  op   (0x4c, plot)
  op   (0x4d, swap)
  op   (0x4e, color)
  op   (0x4f, not)
  op16 (0x50, add_r)
  op16 (0x60, sub_r)
  op   (0x70, merge)
  op15h(0x71, and_r)
  op16 (0x80, mult_r)
  op   (0x90, sbk)
  op4  (0x91, link)
  op   (0x95, sex)
  op   (0x96, asr)
  op   (0x97, ror)
  op6  (0x98, jmp_r)
  op   (0x9e, lob)
  op   (0x9f, fmult)
  op16 (0xa0, ibt_r)
  op16 (0xb0, from_r)
  op   (0xc0, hib)
  op15h(0xc1, or_r)
  op15l(0xd0, inc_r)
  op   (0xdf, getc)
  op15l(0xe0, dec_r)
  op   (0xef, getb)
  op16 (0xf0, iwt_r)
  #undef op

  //======
  // ALT1