Beispiel #1
0
static void YAPCatchError() {
  if (LOCAL_CommittedError != nullptr &&
      LOCAL_CommittedError->errorNo != YAP_NO_ERROR) {
    // Yap_PopTermFromDB(info->errorTerm);
    // throw  throw YAPError(  );
    Term es[2];
    es[0] = TermError;
    es[1] = MkErrorTerm(LOCAL_CommittedError);
    Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
    YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
    // Yap_PopTermFromDB(info->errorTerm);
    // throw  throw YAPError( SOURCE(), );
  } else if (LOCAL_ActiveError != nullptr &&
             LOCAL_ActiveError->errorNo != YAP_NO_ERROR) {
    // Yap_PopTermFromDB(info->errorTerm);
    // throw  throw YAPError(  );
    Term es[2];
    es[0] = TermError;
    es[1] = MkErrorTerm(LOCAL_ActiveError);
    Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
    YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
    // Yap_PopTermFromDB(info->errorTerm);
    // throw  throw YAPError( SOURCE(), );
  }
}
Beispiel #2
0
int main(int argc, char **argv)
#endif
{
  int BootMode;
  int i;
  YAP_init_args init_args;
  BootMode = init_standard_system(argc, argv, &init_args);
  if (BootMode == YAP_BOOT_ERROR) {
    fprintf(stderr, "[ FATAL ERROR: could not find saved state ]\n");
    exit(1);
  }
  /* Begin preprocessor code */
  if (BootMode != YAP_BOOT_FROM_SAVED_STACKS) {
    // process the definitions
    for (i = 0; i < init_args.def_c; ++i) {
      YAP_Term t_args[2], t_goal;
      t_args[0] = YAP_MkAtomTerm(YAP_LookupAtom(init_args.def_var[i]));
      t_args[1] = YAP_MkAtomTerm(YAP_LookupAtom(init_args.def_value[i]));
      t_goal = YAP_MkApplTerm(YAP_MkFunctor(YAP_LookupAtom("ypp_define"), 2), 2,
                              t_args);
      YAP_RunGoalOnce(t_goal);
    }
  }

  YAP_Reset(YAP_FULL_RESET);
  /* End preprocessor code */

  exec_top_level(BootMode, &init_args);

  return (0);
}
Beispiel #3
0
int
main (int argc, char **argv)
#endif
{
  int BootMode;
  YAP_init_args init_args;
  int i;

#if DEBUG_LOCKS
  char buf[1024];
  sprintf(buf, "/tmp/yap%d", getpid());
  debugf= fopen(buf, "w");
  if (!debugf) fprintf(stderr,"ERROR %s\n", strerror(errno));
  setvbuf( debugf,NULL, _IOLBF, 1024);
#endif
  BootMode = init_standard_system(argc, argv, &init_args);
  if (BootMode == YAP_BOOT_ERROR) {
    fprintf(stderr,"[ FATAL ERROR: could not find saved state ]\n");
    exit(1);
  }
  /* Begin preprocessor code */
  if (BootMode != YAP_BOOT_FROM_SAVED_STACKS) {
    // process the definitions
    for(i=0;i<init_args.def_c;++i) {
      YAP_Term t_args[2],t_goal;
      t_args[0] = YAP_MkAtomTerm(YAP_LookupAtom(init_args.def_var[i]));
      t_args[1] = YAP_MkAtomTerm(YAP_LookupAtom(init_args.def_value[i])); 
      t_goal  = YAP_MkApplTerm(YAP_MkFunctor(YAP_LookupAtom("ypp_define"),2), 2, t_args); 
      YAP_RunGoalOnce(t_goal);
    }
    
  }
  YAP_Reset( YAP_FULL_RESET );
  /* End preprocessor code */

  exec_top_level(BootMode, &init_args);

  return(0);
}
Beispiel #4
0
static void
do_top_goal (YAP_Term Goal)
{
  YAP_RunGoalOnce(Goal);
}