merge ssh://ssh.dcc.fc.up.pt:31064/home/vsc/yap
This commit is contained in:
		@@ -1155,15 +1155,6 @@ p_binary_is( USES_REGS1 )
 | 
				
			|||||||
          Yap_ClearExs();
 | 
					          Yap_ClearExs();
 | 
				
			||||||
    t1 = Yap_Eval(Deref(ARG3));
 | 
					    t1 = Yap_Eval(Deref(ARG3));
 | 
				
			||||||
  t2 = Yap_Eval(Deref(ARG4));
 | 
					  t2 = Yap_Eval(Deref(ARG4));
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    Atom name;
 | 
					 | 
				
			||||||
    if (IsIntTerm(t)) {
 | 
					 | 
				
			||||||
      Int i = IntOfTerm(t);
 | 
					 | 
				
			||||||
      name = Yap_NameOfBinaryOp(i);
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      name = AtomOfTerm(Deref(ARG2));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (IsIntTerm(t)) {
 | 
					  if (IsIntTerm(t)) {
 | 
				
			||||||
    Int i = IntOfTerm(t);
 | 
					    Int i = IntOfTerm(t);
 | 
				
			||||||
    bool go;
 | 
					    bool go;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2105,7 +2105,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
 | 
				
			|||||||
  CACHE_REGS
 | 
					  CACHE_REGS
 | 
				
			||||||
  int sno;
 | 
					  int sno;
 | 
				
			||||||
  BACKUP_MACHINE_REGS();
 | 
					  BACKUP_MACHINE_REGS();
 | 
				
			||||||
  const char *fl = NULL;
 | 
					   char *fl = NULL;
 | 
				
			||||||
  int lvl = push_text_stack();
 | 
					  int lvl = push_text_stack();
 | 
				
			||||||
  if (mode == YAP_BOOT_MODE) {
 | 
					  if (mode == YAP_BOOT_MODE) {
 | 
				
			||||||
    mode = YAP_CONSULT_MODE; }
 | 
					    mode = YAP_CONSULT_MODE; }
 | 
				
			||||||
@@ -2118,8 +2118,14 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
 | 
				
			|||||||
      pop_text_stack(lvl);
 | 
					      pop_text_stack(lvl);
 | 
				
			||||||
      *full = NULL;
 | 
					      *full = NULL;
 | 
				
			||||||
      return -1;
 | 
					      return -1;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      *full = pop_output_text_stack(lvl,fl);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					          pop_text_stack(lvl);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  lvl = push_text_stack();
 | 
				
			||||||
  bool consulted = (mode == YAP_CONSULT_MODE);
 | 
					  bool consulted = (mode == YAP_CONSULT_MODE);
 | 
				
			||||||
  sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
 | 
					  sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
 | 
				
			||||||
    if (sno < 0 ||
 | 
					    if (sno < 0 ||
 | 
				
			||||||
@@ -2161,11 +2167,7 @@ X_API FILE *YAP_TermToStream(Term t) {
 | 
				
			|||||||
X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
 | 
					X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
 | 
				
			||||||
  BACKUP_MACHINE_REGS();
 | 
					  BACKUP_MACHINE_REGS();
 | 
				
			||||||
  Yap_CloseStream(sno);
 | 
					  Yap_CloseStream(sno);
 | 
				
			||||||
#if __unix__
 | 
					 | 
				
			||||||
    Yap_ChDir(dirname(full));
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
  Yap_ChDir(full);
 | 
					  Yap_ChDir(full);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  if (osnop >= 0)
 | 
					  if (osnop >= 0)
 | 
				
			||||||
    Yap_AddAlias(AtomLoopStream, *osnop);
 | 
					    Yap_AddAlias(AtomLoopStream, *osnop);
 | 
				
			||||||
  Yap_end_consult();
 | 
					  Yap_end_consult();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1932,7 +1932,7 @@ fprintf(stderr, "%% \n%%  -------------------------------------\n%%\n");
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
      if (b_ptr) {
 | 
					      if (b_ptr) {
 | 
				
			||||||
        if (!max_count--) {
 | 
					        if (!max_count--) {
 | 
				
			||||||
          fprintf(stderr, "\**  .....\n");
 | 
					          fprintf(stderr, "//  .....\n");
 | 
				
			||||||
          return;
 | 
					          return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (b_ptr->cp_ap && /* tabling */
 | 
					        if (b_ptr->cp_ap && /* tabling */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										16
									
								
								C/yap-args.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								C/yap-args.c
									
									
									
									
									
								
							@@ -153,7 +153,7 @@ const char *Yap_BINDIR, *Yap_ROOTDIR, *Yap_SHAREDIR, *Yap_LIBDIR, *Yap_DLLDIR,
 | 
				
			|||||||
 * consult loop in C: used to boot the system, butt supports goal execution and recursive consulting.
 | 
					 * consult loop in C: used to boot the system, butt supports goal execution and recursive consulting.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * */
 | 
					 * */
 | 
				
			||||||
static void consult(const char *b_file USES_REGS) {
 | 
					static bool consult(const char *b_file USES_REGS) {
 | 
				
			||||||
  Term t;
 | 
					  Term t;
 | 
				
			||||||
  int c_stream, osno, oactive;
 | 
					  int c_stream, osno, oactive;
 | 
				
			||||||
  Functor functor_query = Yap_MkFunctor(Yap_LookupAtom("?-"), 1);
 | 
					  Functor functor_query = Yap_MkFunctor(Yap_LookupAtom("?-"), 1);
 | 
				
			||||||
@@ -176,7 +176,7 @@ static void consult(const char *b_file USES_REGS) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  if (!Yap_AddAlias(AtomLoopStream, c_stream)) {
 | 
					  if (!Yap_AddAlias(AtomLoopStream, c_stream)) {
 | 
				
			||||||
    pop_text_stack(lvl);
 | 
					    pop_text_stack(lvl);
 | 
				
			||||||
    return;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  do {
 | 
					  do {
 | 
				
			||||||
@@ -188,13 +188,15 @@ static void consult(const char *b_file USES_REGS) {
 | 
				
			|||||||
    Term vs = YAP_MkVarTerm(), pos = MkVarTerm();
 | 
					    Term vs = YAP_MkVarTerm(), pos = MkVarTerm();
 | 
				
			||||||
    t = YAP_ReadClauseFromStream(c_stream, vs, pos);
 | 
					    t = YAP_ReadClauseFromStream(c_stream, vs, pos);
 | 
				
			||||||
    // Yap_GetNèwSlot(t);
 | 
					    // Yap_GetNèwSlot(t);
 | 
				
			||||||
 | 
					      if (t == TermEof)
 | 
				
			||||||
 | 
						break;
 | 
				
			||||||
    if (t == 0) {
 | 
					    if (t == 0) {
 | 
				
			||||||
      fprintf(stderr, "[ SYNTAX ERROR: while parsing stream %s at line %ld ]\n",
 | 
					      fprintf(stderr, "[ SYNTAX ERROR: while parsing stream %s at line %ld ]\n",
 | 
				
			||||||
              b_file, GLOBAL_Stream[c_stream].linecount);
 | 
					              b_file, GLOBAL_Stream[c_stream].linecount);
 | 
				
			||||||
    } else if (IsVarTerm(t) || t == TermNil) {
 | 
					    } else if (IsVarTerm(t) || t == TermNil) {
 | 
				
			||||||
      fprintf(stderr, "[ line: " Int_FORMAT ": term cannot be compiled ]",
 | 
					      fprintf(stderr, "[ line: " Int_FORMAT ": term cannot be compiled ]",
 | 
				
			||||||
              GLOBAL_Stream[c_stream].linecount);
 | 
					              GLOBAL_Stream[c_stream].linecount);
 | 
				
			||||||
    } else if (IsApplTerm(t) && (FunctorOfTerm(t) == functor_query ||
 | 
					   } else if (IsApplTerm(t) && (FunctorOfTerm(t) == functor_query ||
 | 
				
			||||||
                                 FunctorOfTerm(t) == functor_command1)) {
 | 
					                                 FunctorOfTerm(t) == functor_command1)) {
 | 
				
			||||||
      t = ArgOfTerm(1, t);
 | 
					      t = ArgOfTerm(1, t);
 | 
				
			||||||
      if (IsApplTerm(t) && FunctorOfTerm(t) == functor_compile2) {
 | 
					      if (IsApplTerm(t) && FunctorOfTerm(t) == functor_compile2) {
 | 
				
			||||||
@@ -205,16 +207,17 @@ static void consult(const char *b_file USES_REGS) {
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
     YAP_CompileClause(t);
 | 
					     YAP_CompileClause(t);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  } while (true);
 | 
				
			||||||
    yap_error_descriptor_t *errd;
 | 
					    yap_error_descriptor_t *errd;
 | 
				
			||||||
    if ((errd =
 | 
					    if ((errd =
 | 
				
			||||||
	 Yap_GetException(LOCAL_ActiveError))) {
 | 
						 Yap_GetException(LOCAL_ActiveError))) {
 | 
				
			||||||
      fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile, (long int) errd->errorLine, errd->classAsText,
 | 
					      fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile, (long int) errd->errorLine, errd->classAsText,
 | 
				
			||||||
              errd->errorAsText);
 | 
					              errd->errorAsText);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } while (t != TermEof);
 | 
					 | 
				
			||||||
  BACKUP_MACHINE_REGS();
 | 
					  BACKUP_MACHINE_REGS();
 | 
				
			||||||
  YAP_EndConsult(c_stream, &osno, full);
 | 
					  YAP_EndConsult(c_stream, &osno, full);
 | 
				
			||||||
  pop_text_stack(lvl);
 | 
					  pop_text_stack(lvl);
 | 
				
			||||||
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
@@ -1038,6 +1041,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
 | 
				
			|||||||
    init_globals(yap_init);
 | 
					    init_globals(yap_init);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    start_modules();
 | 
					    start_modules();
 | 
				
			||||||
 | 
					  TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
 | 
				
			||||||
    consult(Yap_BOOTSTRAP PASS_REGS);
 | 
					    consult(Yap_BOOTSTRAP PASS_REGS);
 | 
				
			||||||
    setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
 | 
					    setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
 | 
				
			||||||
                              MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
 | 
					                              MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
 | 
				
			||||||
@@ -1052,8 +1056,8 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
 | 
				
			|||||||
                              MkAtomTerm(Yap_LookupAtom(Yap_INPUT_STARTUP)));
 | 
					                              MkAtomTerm(Yap_LookupAtom(Yap_INPUT_STARTUP)));
 | 
				
			||||||
    setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, true);
 | 
					    setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  YAP_RunGoalOnce(TermInitProlog);
 | 
					  YAP_RunGoalOnce(TermInitProlog);
 | 
				
			||||||
 | 
					 | 
				
			||||||
     if (yap_init->install && Yap_OUTPUT_STARTUP) {
 | 
					     if (yap_init->install && Yap_OUTPUT_STARTUP) {
 | 
				
			||||||
>>>>>>> ff2b867ec3c3831e10b8465e0a9e3c1a03e3d4d2
 | 
					>>>>>>> ff2b867ec3c3831e10b8465e0a9e3c1a03e3d4d2
 | 
				
			||||||
      Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP));
 | 
					      Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP));
 | 
				
			||||||
@@ -1062,7 +1066,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      YAP_RunGoalOnce(g);
 | 
					      YAP_RunGoalOnce(g);
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
  }
 | 
					
 | 
				
			||||||
    end_init(yap_init);
 | 
					    end_init(yap_init);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,6 +49,7 @@ ${CMAKE_SOURCE_DIR}/packages/gecode/3.7.2
 | 
				
			|||||||
${CMAKE_SOURCE_DIR}/packages/gecode/3.7.1
 | 
					${CMAKE_SOURCE_DIR}/packages/gecode/3.7.1
 | 
				
			||||||
${CMAKE_SOURCE_DIR}/packages/gecode/3.7.0
 | 
					${CMAKE_SOURCE_DIR}/packages/gecode/3.7.0
 | 
				
			||||||
${CMAKE_SOURCE_DIR}/packages/gecode/3.6.0
 | 
					${CMAKE_SOURCE_DIR}/packages/gecode/3.6.0
 | 
				
			||||||
 | 
					${CMAKE_SOURCE_DIR}/packages/problog
 | 
				
			||||||
${CMAKE_SOURCE_DIR}/packages/gecode/dev
 | 
					${CMAKE_SOURCE_DIR}/packages/gecode/dev
 | 
				
			||||||
${CMAKE_SOURCE_DIR}/C/traced_absmi_insts.h
 | 
					${CMAKE_SOURCE_DIR}/C/traced_absmi_insts.h
 | 
				
			||||||
${CMAKE_SOURCE_DIR}/H/globals.h
 | 
					${CMAKE_SOURCE_DIR}/H/globals.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1062,6 +1062,7 @@ X_API void init_sys(void) {
 | 
				
			|||||||
  YAP_UserCPredicate("pid", pid, 2);
 | 
					  YAP_UserCPredicate("pid", pid, 2);
 | 
				
			||||||
  YAP_UserCPredicate("kill", p_kill, 3);
 | 
					  YAP_UserCPredicate("kill", p_kill, 3);
 | 
				
			||||||
  YAP_UserCPredicate("mktemp", p_mktemp, 3);
 | 
					  YAP_UserCPredicate("mktemp", p_mktemp, 3);
 | 
				
			||||||
 | 
					  YAP_UserCPredicate("list_directory", list_directory, 3);
 | 
				
			||||||
  YAP_UserCPredicate("tmpnam", p_tmpnam, 2);
 | 
					  YAP_UserCPredicate("tmpnam", p_tmpnam, 2);
 | 
				
			||||||
  YAP_UserCPredicate("tmpdir", p_tmpdir, 2);
 | 
					  YAP_UserCPredicate("tmpdir", p_tmpdir, 2);
 | 
				
			||||||
  YAP_UserCPredicate("rename_file", rename_file, 3);
 | 
					  YAP_UserCPredicate("rename_file", rename_file, 3);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user