small fixes:
This commit is contained in:
parent
0036e3632e
commit
db7047249c
@ -2771,12 +2771,11 @@ void Yap_InitAtomPreds(void) {
|
||||
Yap_InitCPred("atomics_to_string", 3, atomics_to_string3, 0);
|
||||
Yap_InitCPred("get_string_code", 3, get_string_code3, 0);
|
||||
|
||||
Yap_InitCPred("downcase_text_to_atom", 2, downcase_text_to_atom, 0);
|
||||
Yap_InitCPred("downcase_atom", 2, downcase_text_to_atom, 0);
|
||||
Yap_InitCPred("upcase_text_to_atom", 2, upcase_text_to_atom, 0);
|
||||
Yap_InitCPred("upcase_atom", 2, upcase_text_to_atom, 0);
|
||||
Yap_InitCPred("text_to_string", 2, downcase_text_to_string, 0);
|
||||
Yap_InitCPred("text_to_atom", 2, downcase_text_to_string, 0);
|
||||
|
||||
Yap_InitCPred("downcase_text_to_atom", 2, downcase_text_to_atom, 0);
|
||||
Yap_InitCPred("upcase_text_to_atom", 2, upcase_text_to_atom, 0);
|
||||
Yap_InitCPred("downcase_text_to_string", 2, downcase_text_to_string, 0);
|
||||
Yap_InitCPred("upcase_text_to_string", 2, upcase_text_to_string, 0);
|
||||
Yap_InitCPred("downcase_text_to_codes", 2, downcase_text_to_codes, 0);
|
||||
|
35
C/globals.c
35
C/globals.c
@ -329,15 +329,16 @@ CELL *Yap_GetFromArena(Term *arenap, UInt cells, UInt arity) {
|
||||
}
|
||||
}
|
||||
|
||||
static void CloseArena(cell_space_t *region, Term *oldArenaP,
|
||||
static Term CloseArena(cell_space_t *region, Term arena,
|
||||
UInt old_size USES_REGS) {
|
||||
UInt new_size;
|
||||
|
||||
if (HR == region->oH)
|
||||
return;
|
||||
new_size = old_size - (HR - RepAppl(*oldArenaP));
|
||||
*oldArenaP = CreateNewArena(HR, new_size);
|
||||
return 0;
|
||||
new_size = old_size - (HR - RepAppl(arena));
|
||||
arena = CreateNewArena(HR, new_size);
|
||||
exit_cell_space( region );
|
||||
return arena;
|
||||
}
|
||||
|
||||
static inline void clean_dirty_tr(tr_fr_ptr TR0 USES_REGS) {
|
||||
@ -670,12 +671,12 @@ static Term CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars,
|
||||
Hi PASS_REGS)) < 0) {
|
||||
goto error_handler;
|
||||
}
|
||||
CloseArena(&cspace, newarena, old_size PASS_REGS);
|
||||
*newarena = CloseArena(&cspace, arena, old_size PASS_REGS);
|
||||
return Hi[0];
|
||||
}
|
||||
#endif
|
||||
if (share && VarOfTerm(t) > ArenaPt(arena)) {
|
||||
CloseArena(&cspace, newarena, old_size PASS_REGS);
|
||||
*newarena = CloseArena(&cspace, arena, old_size PASS_REGS);
|
||||
return t;
|
||||
}
|
||||
tn = MkVarTerm();
|
||||
@ -683,7 +684,7 @@ static Term CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars,
|
||||
res = -1;
|
||||
goto error_handler;
|
||||
}
|
||||
CloseArena(&cspace, newarena, old_size PASS_REGS);
|
||||
*newarena = CloseArena(&cspace, arena, old_size PASS_REGS);
|
||||
return tn;
|
||||
} else if (IsAtomOrIntTerm(t)) {
|
||||
return t;
|
||||
@ -705,7 +706,7 @@ static Term CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars,
|
||||
Hi PASS_REGS)) < 0) {
|
||||
goto error_handler;
|
||||
}
|
||||
CloseArena(&cspace, newarena, old_size PASS_REGS);
|
||||
*newarena = CloseArena(&cspace, arena, old_size PASS_REGS);
|
||||
return tf;
|
||||
} else {
|
||||
Functor f;
|
||||
@ -726,7 +727,7 @@ static Term CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars,
|
||||
if (IsExtensionFunctor(f)) {
|
||||
switch ((CELL) f) {
|
||||
case (CELL) FunctorDBRef:
|
||||
CloseArena(&cspace, newarena, old_size PASS_REGS);
|
||||
*newarena = CloseArena(&cspace, arena, old_size PASS_REGS);
|
||||
return t;
|
||||
case (CELL) FunctorLongInt:
|
||||
if (HR > ASP - (MIN_ARENA_SIZE + 3)) {
|
||||
@ -785,7 +786,7 @@ static Term CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars,
|
||||
goto error_handler;
|
||||
}
|
||||
}
|
||||
CloseArena(&cspace, newarena, old_size PASS_REGS);
|
||||
*newarena = CloseArena(&cspace, arena, old_size PASS_REGS);
|
||||
return tf;
|
||||
}
|
||||
error_handler:
|
||||
@ -858,7 +859,7 @@ restart:
|
||||
HB0[i] = init;
|
||||
}
|
||||
}
|
||||
CloseArena(&cells, newarena, ArenaSz(arena) PASS_REGS);
|
||||
*newarena = CloseArena(&cells, arena, ArenaSz(arena) PASS_REGS);
|
||||
return tf;
|
||||
}
|
||||
|
||||
@ -1683,7 +1684,7 @@ static Int p_nb_queue_enqueue(USES_REGS1) {
|
||||
RESET_VARIABLE(HR);
|
||||
qd[QUEUE_TAIL] = (CELL)HR;
|
||||
HR++;
|
||||
CloseArena(&cspace, qd + QUEUE_ARENA, old_sz PASS_REGS);
|
||||
qd[QUEUE_ARENA] = CloseArena(&cspace, qd[ QUEUE_ARENA ], old_sz PASS_REGS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1707,7 +1708,7 @@ static Int p_nb_queue_dequeue(USES_REGS1) {
|
||||
/* garbage collection ? */
|
||||
enter_cell_space(&cspace);
|
||||
qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsz - 1);
|
||||
CloseArena(&cspace, &arena, old_sz PASS_REGS);
|
||||
qd[QUEUE_ARENA] = CloseArena(&cspace, arena, old_sz PASS_REGS);
|
||||
return Yap_unify(out, ARG2);
|
||||
}
|
||||
|
||||
@ -1957,7 +1958,7 @@ restart:
|
||||
old_sz = ArenaSz(arena);
|
||||
HR = HB = ArenaPt(arena);
|
||||
qd[HEAP_MAX] = Global_MkIntegerTerm(hmsize);
|
||||
CloseArena(&cspace, qd + HEAP_ARENA, old_sz PASS_REGS);
|
||||
qd[HEAP_ARENA] = CloseArena(&cspace, arena, old_sz PASS_REGS);
|
||||
goto restart;
|
||||
}
|
||||
arena = qd[HEAP_ARENA];
|
||||
@ -2005,7 +2006,7 @@ restart:
|
||||
pt[2 * hsize + 1] = to;
|
||||
PushHeap(pt, hsize);
|
||||
qd[HEAP_SIZE] = Global_MkIntegerTerm(hsize + 1);
|
||||
CloseArena(&cspace, qd + HEAP_ARENA, old_sz PASS_REGS);
|
||||
qd[HEAP_ARENA] = CloseArena(&cspace, qd[ HEAP_ARENA ], old_sz PASS_REGS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2362,7 +2363,7 @@ cell_space_t cspace;
|
||||
pt = qd + HEAP_START;
|
||||
PushBeam(pt, pt + 2 * hmsize, hsize, key, to);
|
||||
qd[HEAP_SIZE] = Global_MkIntegerTerm(hsize + 1);
|
||||
CloseArena(&cspace, qd + HEAP_ARENA, old_sz PASS_REGS);
|
||||
qd[HEAP_ARENA] = CloseArena(&cspace, qd[ HEAP_ARENA ], old_sz PASS_REGS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2385,7 +2386,7 @@ static Int p_nb_beam_del(USES_REGS1) {
|
||||
/* garbage collection ? */
|
||||
enter_cell_space(&cspace);
|
||||
qd[HEAP_SIZE] = Global_MkIntegerTerm(qsz - 1);
|
||||
CloseArena(&cspace, &arena, old_sz PASS_REGS);
|
||||
qd[ HEAP_ARENA] = CloseArena(&cspace, arena, old_sz PASS_REGS);
|
||||
tk = qd[HEAP_START];
|
||||
tv = DelBeamMin(qd + HEAP_START,
|
||||
qd + (HEAP_START + 2 * IntegerOfTerm(qd[HEAP_MAX])), qsz);
|
||||
|
@ -680,8 +680,12 @@ ${GMP_LIBRARIES}
|
||||
${READLINE_LIBRARIES}
|
||||
${ANDROID_LIBRARIES}
|
||||
${WINDLLS}
|
||||
${PYTHON_LIBRARIES}
|
||||
)
|
||||
if (PYTHON_LIBRARIES)
|
||||
target_link_libraries(libYap
|
||||
${PYTHON_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(libYap
|
||||
PROPERTIES OUTPUT_NAME Yap
|
||||
@ -862,6 +866,7 @@ include(UseJava)
|
||||
#
|
||||
#macro_optional_find_package(JNI ON)
|
||||
# JNI_INCLUDE_DIRS = the include dirs to use
|
||||
|
||||
# JNI_LIBRARIES = the libraries to use
|
||||
# JNI_FOUND = TRUE if JNI headers and libraries were found.
|
||||
# JAVA_AWT_LIBRARY = the path to the jawt library
|
||||
|
@ -15,8 +15,8 @@ if ( WIN32 OR ANDROID)
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_YAP_NOT_INSTALLED_=1;HAVE_CONFIG_H=1;_GNU_SOURCE;YAP_KERNEL=1" )
|
||||
else()
|
||||
add_library(YAP++ ${CXX_SOURCES} )
|
||||
if (WITH_PYTHON)
|
||||
target_link_libraries(YAP++ Py4YAP )
|
||||
if (WITH_PYTHON AND PYTHON_LIBRARIES)
|
||||
target_link_libraries(YAP++ ${PYTHON_LIBRARIES} )
|
||||
endif()
|
||||
target_link_libraries(YAP++ ${CMAKE_DL_LIBS} libYap)
|
||||
|
||||
|
@ -69,20 +69,34 @@ lists:append([H|T], L, [H|R]) :-
|
||||
lists:append(T, L, R).
|
||||
|
||||
|
||||
:- set_prolog_flag(source, true). % :- no_source.
|
||||
|
||||
% lists:delete(List, Elem, Residue)
|
||||
% is true when List is a list, in which Elem may or may not occur, and
|
||||
% Residue is a copy of List with all elements identical to Elem lists:deleted.
|
||||
|
||||
/** @pred delete(+ _List_, ? _Element_, ? _Residue_)
|
||||
|
||||
:- set_prolog_flag(source, false). % disable source.
|
||||
True when _List_ is a list, in which _Element_ may or may not
|
||||
occur, and _Residue_ is a copy of _List_ with all elements
|
||||
identical to _Element_ deleted.
|
||||
|
||||
*/
|
||||
lists:delete([], _, []).
|
||||
lists:delete([Head|List], Elem, Residue) :-
|
||||
( Head \= Elem
|
||||
->
|
||||
lists:delete(List, Elem, Residue)
|
||||
;
|
||||
Residue = [Head|MoreResidue],
|
||||
lists:delete(List, Elem, MoreResidue)
|
||||
).
|
||||
|
||||
|
||||
|
||||
|
||||
% length of a list.
|
||||
|
||||
:- set_prolog_flag(source, false). % disable source.
|
||||
|
||||
/** @pred length(? _L_,? _S_)
|
||||
|
||||
|
||||
|
@ -254,6 +254,8 @@ compose_message(style_check(What,FILE,Line,Clause), Level)-->
|
||||
main_message(style_check(What,FILE,Line,Clause) , Level, LC ).
|
||||
compose_message(yes, _Level) --> !,
|
||||
[ 'yes'- [] ].
|
||||
compose_message(false, _Level) --> !,
|
||||
[ 'no'- [] ].
|
||||
compose_message(Throw, _Level) -->
|
||||
!,
|
||||
[ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ].
|
||||
|
Reference in New Issue
Block a user