modules stuff fixes (yes, again).
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@975 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
		
							
								
								
									
										26
									
								
								C/cdmgr.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								C/cdmgr.c
									
									
									
									
									
								
							@@ -1737,7 +1737,7 @@ p_number_of_clauses(void)
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  }
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(RepPredProp(pe)->PRWLock);
 | 
			
		||||
  ncl = RepPredProp(pe)->cs.p_code.NOfClauses;
 | 
			
		||||
  READ_UNLOCK(RepPredProp(pe)->PRWLock);
 | 
			
		||||
@@ -1767,7 +1767,7 @@ p_in_use(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  out = static_in_use(pe,TRUE);
 | 
			
		||||
  READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
@@ -1834,7 +1834,7 @@ p_is_multifile(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return(FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  out = (pe->PredFlags & MultiFileFlag);
 | 
			
		||||
  READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
@@ -1861,7 +1861,7 @@ p_is_log_updatable(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  out = (pe->PredFlags & LogUpdatePredFlag);
 | 
			
		||||
  READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
@@ -1888,7 +1888,7 @@ p_is_source(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  out = (pe->PredFlags & SourcePredFlag);
 | 
			
		||||
  READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
@@ -1915,7 +1915,7 @@ p_is_dynamic(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  out = (pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag));
 | 
			
		||||
  READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
@@ -1942,7 +1942,7 @@ p_pred_exists(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  if (pe->PredFlags & HiddenPredFlag)
 | 
			
		||||
    return(FALSE);
 | 
			
		||||
@@ -1983,7 +1983,7 @@ p_set_pred_module(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  WRITE_LOCK(pe->PRWLock);
 | 
			
		||||
  {
 | 
			
		||||
    SMALLUNSGN mod = Yap_LookupModule(Deref(ARG2));
 | 
			
		||||
@@ -2041,18 +2041,18 @@ p_undefined(void)
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  READ_LOCK(pe->PRWLock);
 | 
			
		||||
  if (pe->PredFlags & (CPredFlag|UserCPredFlag|TestPredFlag|AsmPredFlag|DynamicPredFlag|LogUpdatePredFlag)) {
 | 
			
		||||
    READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
    return(FALSE);
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  }
 | 
			
		||||
  if (pe->OpcodeOfPred == UNDEF_OPCODE) {
 | 
			
		||||
    READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
    return (TRUE);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
  READ_UNLOCK(pe->PRWLock);
 | 
			
		||||
  return (FALSE);
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -2088,7 +2088,7 @@ p_kill_dynamic(void)
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
    return (TRUE);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  WRITE_LOCK(pe->PRWLock);
 | 
			
		||||
  if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
 | 
			
		||||
    WRITE_UNLOCK(pe->PRWLock);
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
:- module(terms, [
 | 
			
		||||
	term_hash/2,
 | 
			
		||||
	term_hash/4,
 | 
			
		||||
	term_variablesb/2,
 | 
			
		||||
	term_variables/2,
 | 
			
		||||
	variant/2,
 | 
			
		||||
	subsumes/2,
 | 
			
		||||
	subsumes_chk/2,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								pl/boot.yap
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								pl/boot.yap
									
									
									
									
									
								
							@@ -833,28 +833,28 @@ break :- get_value('$break',BL), NBL is BL+1,
 | 
			
		||||
'$csult'(V, _) :- var(V), !,
 | 
			
		||||
	'$do_error'(instantiation_error,consult(V)).
 | 
			
		||||
'$csult'([], _).
 | 
			
		||||
'$csult'([-F|L], M) :- !, '$reconsult'(M:F), '$csult'(L, M).
 | 
			
		||||
'$csult'([F|L], M) :- '$consult'(M:F), '$csult'(L, M).
 | 
			
		||||
'$csult'([-F|L], M) :- !, '$reconsult'(F, M), '$csult'(L, M).
 | 
			
		||||
'$csult'([F|L], M) :- '$consult'(F, M), '$csult'(L, M).
 | 
			
		||||
 | 
			
		||||
'$consult'(V) :- var(V), !,
 | 
			
		||||
'$consult'(V, _) :- var(V), !,
 | 
			
		||||
	'$do_error'(instantiation_error,consult(V)).
 | 
			
		||||
'$consult'([]) :- !.
 | 
			
		||||
'$consult'([F|Fs]) :- !,
 | 
			
		||||
	'$consult'(F),
 | 
			
		||||
	'$consult'(Fs).
 | 
			
		||||
'$consult'(M:X) :- atom(M), !,
 | 
			
		||||
        '$current_module'(M0),
 | 
			
		||||
        '$change_module'(M),
 | 
			
		||||
        '$consult'(X),
 | 
			
		||||
        '$change_module'(M0).
 | 
			
		||||
'$consult'(X) :-
 | 
			
		||||
'$consult'([], _) :- !.
 | 
			
		||||
'$consult'([F|Fs], M) :- !,
 | 
			
		||||
	'$consult'(F, M),
 | 
			
		||||
	'$consult'(Fs, M).
 | 
			
		||||
'$consult'(M:X, _) :- !,
 | 
			
		||||
	( atom(M) ->
 | 
			
		||||
	    '$consult'(X, M)
 | 
			
		||||
	;
 | 
			
		||||
	    '$do_error'(type_error(atom,M),[M:X])
 | 
			
		||||
	).
 | 
			
		||||
'$consult'(X, OldModule) :-
 | 
			
		||||
	'$find_in_path'(X,Y,consult(X)),
 | 
			
		||||
	'$open'(Y,'$csult',Stream,0), !,
 | 
			
		||||
	'$current_module'(OldModule),
 | 
			
		||||
        '$consult'(X,OldModule,Stream),
 | 
			
		||||
	'$close'(Stream).
 | 
			
		||||
'$consult'(X) :-
 | 
			
		||||
	'$do_error'(permission_error(input,stream,X),consult(X)).
 | 
			
		||||
'$consult'(X, _) :-
 | 
			
		||||
	'$do_error'(permission_error(input,stream,X),[X]).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
'$consult'(_,Module,Stream) :-
 | 
			
		||||
@@ -865,6 +865,7 @@ break :- get_value('$break',BL), NBL is BL+1,
 | 
			
		||||
	!,
 | 
			
		||||
	'$reconsult'(F,Module,Stream).
 | 
			
		||||
'$consult'(F,Mod,Stream) :-
 | 
			
		||||
	'$current_module'(OldModule, Mod),
 | 
			
		||||
	'$getcwd'(OldD),
 | 
			
		||||
	get_value('$consulting_file',OldF),
 | 
			
		||||
	'$set_consulting_file'(Stream),
 | 
			
		||||
@@ -886,6 +887,7 @@ break :- get_value('$break',BL), NBL is BL+1,
 | 
			
		||||
	'$add_multifile_clauses'(File),
 | 
			
		||||
	set_value('$consulting',Old),
 | 
			
		||||
	set_value('$consulting_file',OldF),
 | 
			
		||||
	'$current_module'(NewMod,OldModule),
 | 
			
		||||
	'$cd'(OldD),
 | 
			
		||||
	( LC == 0 -> prompt(_,'   |: ') ; true),
 | 
			
		||||
	H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
 | 
			
		||||
@@ -896,7 +898,7 @@ break :- get_value('$break',BL), NBL is BL+1,
 | 
			
		||||
	     true
 | 
			
		||||
	  )
 | 
			
		||||
	;
 | 
			
		||||
	    '$print_message'(informational, loaded(consulted, File, Mod, T, H))
 | 
			
		||||
	    '$print_message'(informational, loaded(consulted, File, NewMod, T, H))
 | 
			
		||||
	),
 | 
			
		||||
	'$exec_initialisation_goals',
 | 
			
		||||
	!.
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,8 @@ compile(P) :-
 | 
			
		||||
        '$change_module'(M0).
 | 
			
		||||
'$compile'(A) :-
 | 
			
		||||
	'$compile_mode'(Old,0),
 | 
			
		||||
	'$reconsult'(A),
 | 
			
		||||
        '$current_module'(M0),
 | 
			
		||||
	'$reconsult'(A, M0),
 | 
			
		||||
	'$compile_mode'(_,Old).
 | 
			
		||||
 | 
			
		||||
consult(Fs) :-
 | 
			
		||||
@@ -75,32 +76,36 @@ reconsult(Fs) :-
 | 
			
		||||
	'$has_yap_or', fail,
 | 
			
		||||
	'$do_error'(context_error(reconsult(Fs),clause),query).
 | 
			
		||||
reconsult(Fs) :-
 | 
			
		||||
	'$reconsult'(Fs).
 | 
			
		||||
 | 
			
		||||
'$reconsult'(V) :- var(V), !,
 | 
			
		||||
	'$do_error'(instantiation_error,reconsult(V)).
 | 
			
		||||
'$reconsult'([]) :- !.
 | 
			
		||||
'$reconsult'(M:X) :- atom(M), !,
 | 
			
		||||
        '$current_module'(M0),
 | 
			
		||||
        '$change_module'(M),
 | 
			
		||||
        '$reconsult'(X),
 | 
			
		||||
        '$change_module'(M0).
 | 
			
		||||
'$reconsult'([F|Fs]) :- !,
 | 
			
		||||
	'$reconsult'(F),
 | 
			
		||||
	'$reconsult'(Fs).
 | 
			
		||||
'$reconsult'(X) :-
 | 
			
		||||
	'$reconsult'(Fs, M0).
 | 
			
		||||
 | 
			
		||||
'$reconsult'(V, _) :- var(V), !,
 | 
			
		||||
	'$do_error'(instantiation_error,reconsult(V)).
 | 
			
		||||
'$reconsult'([], _) :- !.
 | 
			
		||||
'$reconsult'(M:X, _) :-
 | 
			
		||||
	(
 | 
			
		||||
	  atom(M)
 | 
			
		||||
	->
 | 
			
		||||
	  '$reconsult'(X, M)
 | 
			
		||||
	  ;
 | 
			
		||||
	  '$do_error'(type_error(atom,M),reconsult(M:X))
 | 
			
		||||
	).
 | 
			
		||||
'$reconsult'([F|Fs], M) :- !,
 | 
			
		||||
	'$reconsult'(F, M),
 | 
			
		||||
	'$reconsult'(Fs, M).
 | 
			
		||||
'$reconsult'(X, M) :-
 | 
			
		||||
	'$find_in_path'(X,Y,reconsult(X)),
 | 
			
		||||
	'$open'(Y,'$csult',Stream,0), !,
 | 
			
		||||
        '$current_module'(M),
 | 
			
		||||
	'$reconsult'(X,M,Stream),
 | 
			
		||||
	'$close'(Stream).
 | 
			
		||||
'$reconsult'(X) :-
 | 
			
		||||
	'$do_error'(permission_error(input,stream,X),reconsult(X)).
 | 
			
		||||
'$reconsult'(X, M) :-
 | 
			
		||||
	'$do_error'(permission_error(input,stream,X),reconsult(M:X)).
 | 
			
		||||
 | 
			
		||||
'$reconsult'(F,M,Stream) :-
 | 
			
		||||
	'$record_loaded'(Stream, M),
 | 
			
		||||
	fail.
 | 
			
		||||
'$reconsult'(F, OldModule, Stream) :-
 | 
			
		||||
'$reconsult'(F, ContextModule, Stream) :-
 | 
			
		||||
	'$current_module'(OldModule,ContextModule),
 | 
			
		||||
	'$getcwd'(OldD),
 | 
			
		||||
	get_value('$consulting_file',OldF),
 | 
			
		||||
	'$set_consulting_file'(Stream),
 | 
			
		||||
 
 | 
			
		||||
@@ -83,9 +83,9 @@
 | 
			
		||||
'$exec_directive'(compile(F), _, M) :-
 | 
			
		||||
	'$compile'(M:F).
 | 
			
		||||
'$exec_directive'(reconsult(Fs), _, M) :-
 | 
			
		||||
	'$reconsult'(M:Fs).
 | 
			
		||||
	'$reconsult'(Fs, M).
 | 
			
		||||
'$exec_directive'(consult(Fs), _, M) :-
 | 
			
		||||
	'$consult'(M:Fs).
 | 
			
		||||
	'$consult'(Fs, M).
 | 
			
		||||
'$exec_directive'(use_module(Fs), _, M) :-
 | 
			
		||||
	'$use_module'(M:Fs).
 | 
			
		||||
'$exec_directive'(use_module(Fs,I), _, M) :-
 | 
			
		||||
 
 | 
			
		||||
@@ -212,7 +212,7 @@ print_message(Level, Mss) :-
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
'$beautify_hidden_goal'('$loop',_,prolog,ClNo,Gs,I,NGs) :- !,
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
'$beautify_hidden_goal'('$consult',1,prolog,ClNo,Gs,I,NGs) :- !,
 | 
			
		||||
'$beautify_hidden_goal'('$consult',3,prolog,ClNo,Gs,I,NGs) :- !,
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
'$beautify_hidden_goal'('$reconsult',_,prolog,ClNo,Gs,I,NGs) :- !,
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
@@ -224,7 +224,7 @@ print_message(Level, Mss) :-
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
'$beautify_hidden_goal'('$recorded_with_key',3,prolog,ClNo,Gs,I,[cl(recorded,3,prolog,ClNo)|NGs]) :- !,
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
'$beautify_hidden_goal'('$consult',2,prolog,ClNo,Gs,I,[cl(consult,1,prolog,ClNo)|NGs]) :- !,
 | 
			
		||||
'$beautify_hidden_goal'('$consult',3,prolog,ClNo,Gs,I,[cl(consult,1,prolog,ClNo)|NGs]) :- !,
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
'$beautify_hidden_goal'('$findall_with_common_vars',_,prolog,ClNo,Gs,I,[cl(findall,4,prolog,ClNo)|NGs]) :- !,
 | 
			
		||||
	'$preprocess_stack'(Gs, I, NGs).
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ system_mode(verbose,off) :- set_value('$verbose',off).
 | 
			
		||||
 | 
			
		||||
% :- yap_flag(gc_trace,verbose).
 | 
			
		||||
 | 
			
		||||
:- initialization(system_mode(verbose,on)).
 | 
			
		||||
:- initialization((system_mode(verbose,on),module(user))).
 | 
			
		||||
 | 
			
		||||
:- module(user).
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -774,10 +774,6 @@ version(T) :-
 | 
			
		||||
'$assert_version'(T) :- recordz('$version',T,_), fail.
 | 
			
		||||
'$assert_version'(_).
 | 
			
		||||
 | 
			
		||||
term_hash(X,Y) :-
 | 
			
		||||
	term_hash(X,-1,16'1000000,Y).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
'$set_toplevel_hook'(_) :- 
 | 
			
		||||
	recorded('$toplevel_hooks',_,R),
 | 
			
		||||
	erase(R),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user