Example #1
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);
}
Example #2
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);
}