Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Vítor Santos Costa 2011-10-22 10:22:44 +01:00
commit 11252cd061
12 changed files with 1227 additions and 888 deletions

View File

@ -1608,7 +1608,7 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
#elif SIZEOF_INT_P==8
{
int n = 1024*1024;
while (n) {
while (n--) {
/* progress 1 MB */
WorkSpaceTop += 512*1024;
if (ExtendWorkSpace(s, MAP_FIXED)) {

View File

@ -1530,6 +1530,7 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
SetHeapRegs(FALSE PASS_REGS);
if (from_trail) {
LOCAL_TrailTop += size0;
CurrentTrailTop = (tr_fr_ptr)(LOCAL_TrailTop-MinTrailGap);
}
if (LOCAL_LDiff) {
MoveLocalAndTrail( PASS_REGS1 );
@ -1717,6 +1718,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
AdjustScannerStacks(tksp, vep PASS_REGS);
}
LOCAL_TrailTop += size;
CurrentTrailTop = (tr_fr_ptr)(LOCAL_TrailTop-MinTrailGap);
YAPLeaveCriticalSection();
}
#endif

View File

@ -29,6 +29,7 @@ static char SccsId[] = "%W% %G%";
#include "alloc.h"
#include "clause.h"
#include "Foreign.h"
#include "SWI-Prolog.h"
#ifdef LOW_LEVEL_TRACER
#include "tracer.h"

View File

@ -39,10 +39,10 @@ OBJECTS= complete.o console.o edit.o history.o menu.o
LIBS=-lgdi32 -lcomdlg32
all: plterm.dll
all: ../../plterm.dll
plterm.dll: libplterm.a
$(CC) $(CFLAGS) -shared -o plterm.dll \
../../plterm.dll: libplterm.a
$(CC) $(CFLAGS) -shared -o ../../plterm.dll \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--whole-archive libplterm.a \
@ -53,8 +53,7 @@ libplterm.a: $(OBJECTS) $(SOURCES) $(HEADERS)
$(AR) rc libplterm.a $(OBJECTS)
$(RANLIB) libplterm.a
install: plterm.dll
$(INSTALL_PROGRAM) plterm.dll $(DESTDIR)$(LIBDIR)
install:
clean:
rm -f *.o *~ *.dll

View File

@ -402,7 +402,7 @@ PLCONS_OBJECTS = \
pl-ntconsole.o \
pl-ntmain.o
all: parms.h startup.yss
all: parms.h startup.yss @ENABLE_WINCONSOLE@ pl-yap@EXEC_SUFFIX@
Makefile: $(srcdir)/Makefile.in
@ -718,9 +718,11 @@ yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@
plyap: pl-yap@EXEC_SUFFIX@
pl-yap@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@ LGPL/swi_console/plterm.dll
pl-yap: pl-yap@EXEC_SUFFIX@
pl-yap@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@
(cd LGPL/swi_console; $(MAKE))
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o pl-yap $(PLCONS_OBJECTS) LGPL/swi_console/plterm.dll @YAPLIB@ $(LIBS) @MPI_LIBS@
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o pl-yap $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) @MPI_LIBS@
libYap.a: $(LIB_OBJECTS)
-rm -f libYap.a
@ -781,13 +783,15 @@ install_unix: startup.yss libYap.a
@ENABLE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE) install)
install_win32: startup.yss
install_win32: startup.yss @ENABLE_WINCONSOLE@ pl-yap@EXEC_SUFFIX@
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(LIBDIR)
mkdir -p $(DESTDIR)$(YAPLIBDIR)
mkdir -p $(DESTDIR)$(INCLUDEDIR)
$(INSTALL_PROGRAM) -m 755 yap.exe $(DESTDIR)$(BINDIR)/yap.exe
$(INSTALL_PROGRAM) -m 755 yap.dll $(DESTDIR)$(BINDIR)/yap.dll
@ENABLE_WINCONSOLE@ $(INSTALL_PROGRAM) -m 755 pl-yap.exe $(DESTDIR)$(BINDIR)/pl-yap.exe
@ENABLE_WINCONSOLE@ $(INSTALL_PROGRAM) -m 755 plterm.dll $(DESTDIR)$(BINDIR)/plterm.dll
$(INSTALL_PROGRAM) -m 755 @YAPLIB@ $(DESTDIR)$(YAPLIBDIR)/@YAPLIB@
$(INSTALL_PROGRAM) -m 755 startup.yss $(DESTDIR)$(YAPLIBDIR)/startup.yss
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
@ -906,12 +910,12 @@ libWYap.a: yap.dll
--dllname yap.dll \
--output-lib libWYap.a
yap.dll: libYap.a
$(CC) $(CFLAGS) -shared -o yap.dll \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--whole-archive libYap.a \
-Wl,--no-whole-archive $(LIBS) $(LDFLAGS)
# yap.dll: libYap.a
# $(CC) $(CFLAGS) -shared -o yap.dll \
# -Wl,--export-all-symbols \
# -Wl,--enable-auto-import \
# -Wl,--whole-archive libYap.a \
# -Wl,--no-whole-archive $(LIBS) $(LDFLAGS)
install_info:
$(MAKE) info; \

View File

@ -5900,6 +5900,19 @@ asserted before being defined.
Declares predicate @var{P} or list of predicates [@var{P1},...,@var{Pn}]
as a dynamic predicate following either @code{logical} or
@code{immediate} semantics.
@item compile_predicates(:@var{ListOfNameArity})
@findex compile_predicates/1
@snindex compile_predicates/1
@cnindex compile_predicates/1
Compile a list of specified dynamic predicates (see @code{dynamic/1} and
@code{assert/1} into normal static predicates. This call tells the
Prolog environment the definition will not change anymore and further
calls to @code{assert/1} or @code{retract/1} on the named predicates
raise a permission error. This predicate is designed to deal with parts
of the program that is generated at runtime but does not change during
the remainder of the program execution.
@menu

File diff suppressed because it is too large Load Diff

View File

@ -150,9 +150,15 @@ write_term_to_stream(const int fd,const YAP_Term term) {
RESET_BUFFER;
YAP_Write( term, p2c_putc,3); // 3=canonical
write(fd,(void*)&BUFFER_LEN,sizeof(size_t));// write size of term
write(fd,(void*)BUFFER_PTR,BUFFER_LEN); // write term
YAP_Write( term, p2c_putc, 3); // 3=canonical
if (write(fd,(void*)&BUFFER_LEN,sizeof(size_t)) < 0) {// write size of term
YAP_Error(0,0,"Prolog2Term: IO error in write term size.\n");
return -1;
}
if (write(fd,(void*)BUFFER_PTR,BUFFER_LEN) < 0) { // write term
YAP_Error(0,0,"Prolog2Term: IO error in write.\n");
return -1;
}
return BUFFER_LEN;
}
/*
@ -170,7 +176,9 @@ read_term_from_stream(const int fd) {
#endif
if ( size> BUFFER_SIZE)
expand_buffer(size-BUFFER_SIZE);
read(fd,BUFFER_PTR,size); // read term from stream
if (!read(fd,BUFFER_PTR,size)) {
YAP_Error(0,0,"Prolog2Term: IO error in read.\n");
}; // read term from stream
return YAP_ReadBuffer( BUFFER_PTR , NULL);
}
/*********************************************************************************************
@ -224,7 +232,7 @@ string2term(char *const ptr,const size_t *size) {
BUFFER_POS=0;
t = YAP_ReadBuffer( BUFFER_PTR , NULL );
if ( t==FALSE ) {
write_msg(__FUNCTION__,__FILE__,__LINE__,"FAILED string2term>>>>size:%d %d %s\n",BUFFER_SIZE,strlen(BUFFER_PTR),LOCAL_ErrorMessage);
write_msg(__FUNCTION__,__FILE__,__LINE__,"FAILED string2term>>>>size:%d %d %s\n",BUFFER_SIZE,strlen(BUFFER_PTR),NULL);
exit(1);
}

View File

@ -35,14 +35,14 @@ gen_defs(Inp,Out) :-
NPos is Pos+1,
nb_setval(atom_counter, NPos),
number_codes(Pos, Val),
append(["#define ATOM_",Atom," (",Val,"*2+1)"], Out).
append(["#define ATOM_",Atom," ((atom_t)(",Val,"*2+1))"], Out).
gen_defs(Inp,Out) :-
split(Inp," ",["F",Functor,Arity]), !,
nb_getval(functor_counter, Pos),
NPos is Pos+1,
nb_setval(functor_counter, NPos),
number_codes(Pos, Val),
append(["#define FUNCTOR_",Functor,Arity," (",Val,"*4+2)"], Out).
append(["#define FUNCTOR_",Functor,Arity," ((functor_t)(",Val,"*4+2))"], Out).
gen_init(Inp,Out) :-

View File

@ -50,6 +50,8 @@ Section "Base system (required)"
SetOutPath $INSTDIR\bin
File c:\Yap\bin\yap.exe
File c:\Yap\bin\yap.dll
File c:\Yap\bin\pl-yap.exe
File c:\Yap\bin\plterm.dll
SetOutPath $INSTDIR\bin
; SYSTEM STUFF
@ -89,9 +91,14 @@ Section "Start Menu shortcuts"
CreateDirectory "$SMPROGRAMS\${GRP}"
CreateShortCut "$SMPROGRAMS\${GRP}\Prolog.lnk" \
"$INSTDIR\bin\yap.exe" \
"--win_app" \
"" \
"$INSTDIR\bin\yap.exe" \
0
CreateShortCut "$SMPROGRAMS\${GRP}\PLYap.lnk" \
"$INSTDIR\bin\pl-yap.exe" \
"" \
"$INSTDIR\bin\pl-yap.exe" \
0
SetOutPath $INSTDIR
CreateShortCut "$SMPROGRAMS\${GRP}\Readme.lnk" \
"$INSTDIR\doc\Yap\README.TXT" "" \

273
misc/yap64.nsi Executable file
View File

@ -0,0 +1,273 @@
; YAP install-script (from SWI-Prolog)
!define TEMP1 $R0 ; Temp variable
!define EXT $3 ; Filename extension for Prolog sources
!define CWD $4 ; Working directory for startmenu shortcut
!define GRP $5 ; Startmenu group
!define SHCTX $6 ; Shell context (current/all)
!define ARCH $7 ; Architecture (x86, ia64 or amd64)
!define REGKEY SOFTWARE\YAP\Prolog64
RequestExecutionLevel admin
SetCompressor bzip2
MiscButtonText "<back" "next>" "abort" "finished"
; Preload files that are needed by the installer itself
ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "options.ini"
InstallDir $PROGRAMFILES64\Yap64
InstallDirRegKey HKLM ${REGKEY} "home"
ComponentText "This will install YAP64 on your computer."
DirText "This program will install YAP64 on your computer.\
Choose a directory"
LicenseData c:\Yap64\share\doc\Yap\Artistic
LicenseText "YAP64 is governed by the Artistic License,\
but includes code under the GPL and LGPL."
InstType "Typical (all except debug symbols)" # 1
InstType "Minimal (no graphics)" # 2
InstType "Full" # 3
Page license
Page directory
Page custom SetCustom "" ": Installation options"
Page instfiles
Section "Base system (required)"
SectionIn RO # do not allow to delete this
; make sure we use 64 bits registry
SetRegView 64
Delete $INSTDIR\bin\*.pdb
SetOutPath $INSTDIR\bin
File c:\Yap64\bin\yap.exe
File c:\Yap64\bin\yap.dll
File c:\Yap64\bin\pl-yap.exe
File c:\Yap64\bin\plterm.dll
SetOutPath $INSTDIR\bin
; SYSTEM STUFF
File c:\Yap64\lib\Yap\*.dll
SetOutPath $INSTDIR\lib
SetOutPath $INSTDIR\lib
; SYSTEM STUFF
File c:\Yap64\lib\Yap\startup.yss
SetOutPath $INSTDIR\share
; SYSTEM STUFF
File /r c:\Yap64\share\Yap\*
SetOutPath $INSTDIR\doc\Yap
File c:\Yap64\share\doc\Yap\yap.html
File c:\Yap64\share\doc\Yap\yap.pdf
File c:\Yap64\share\doc\Yap\Artistic
File c:\Yap64\share\doc\Yap\README.TXT
File c:\Yap64\share\doc\Yap\COPYING.TXT
WriteRegStr HKLM ${REGKEY} "home" "$INSTDIR"
WriteRegStr HKLM ${REGKEY} "startup" "$INSTDIR\lib\startup.yss"
WriteRegStr HKLM ${REGKEY} "library" "$INSTDIR\share"
; Write uninstaller
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YAP64" "DisplayName" "YAP64 (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YAP64" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteUninstaller "uninstall.exe"
SectionEnd
Section "Start Menu shortcuts"
SectionIn 1 2 3
SetOutPath ${CWD}
CreateDirectory "$SMPROGRAMS\${GRP}"
CreateShortCut "$SMPROGRAMS\${GRP}\Prolog.lnk" \
"$INSTDIR\bin\yap.exe" \
"" \
"$INSTDIR\bin\yap.exe" \
0
CreateShortCut "$SMPROGRAMS\${GRP}\PLYap.lnk" \
"$INSTDIR\bin\pl-yap.exe" \
"" \
"$INSTDIR\bin\pl-yap.exe" \
0
SetOutPath $INSTDIR
CreateShortCut "$SMPROGRAMS\${GRP}\Readme.lnk" \
"$INSTDIR\doc\Yap\README.TXT" "" \
"$INSTDIR\doc\Yap\README.TXT" 0 \
"SW_SHOWNORMAL" "" "View readme"
CreateShortCut "$SMPROGRAMS\${GRP}\Manual Html.lnk" \
"$INSTDIR\doc\Yap\yap.html" "" \
"$INSTDIR\doc\Yap\yap.html" 0 \
"SW_SHOWNORMAL" "" "View readme"
CreateShortCut "$SMPROGRAMS\${GRP}\Manual PDF.lnk" \
"$INSTDIR\doc\Yap\yap.pdf" "" \
"$INSTDIR\doc\Yap\yap.pdf" 0 \
"SW_SHOWNORMAL" "" "View readme"
CreateShortCut "$SMPROGRAMS\${GRP}\Uninstall.lnk" \
"$INSTDIR\uninstall.exe" \
"" \
"$INSTDIR\uninstall.exe" \
0
WriteRegStr HKLM ${REGKEY} group ${GRP}
WriteRegStr HKLM ${REGKEY} cwd ${CWD}
WriteRegStr HKLM ${REGKEY} context ${SHCTX}
SectionEnd
################################################################
# The uninstaller
################################################################
UninstallText "This will uninstall YAP.64 Hit Uninstall to continue."
Section "Uninstall"
ReadRegStr ${EXT} HKLM Software\YAP\Prolog64 fileExtension
ReadRegStr ${GRP} HKLM Software\YAP\Prolog64 group
ReadRegStr ${SHCTX} HKLM Software\YAP\Prolog64 context
StrCmp ${SHCTX} "all" 0 +2
SetShellVarContext all
MessageBox MB_YESNO "Delete the following components?$\r$\n \
Install dir: $INSTDIR$\r$\n \
Extension: ${EXT}$\r$\n \
Program Group ${GRP}" \
IDNO Done
StrCmp ".${EXT}" "" NoExt
ReadRegStr $1 HKCR .${EXT} ""
StrCmp $1 "PrologFile" 0 NoOwn ; only do this if we own it
ReadRegStr $1 HKCR .${EXT} "backup_val"
StrCmp $1 "" 0 RestoreBackup ; if backup == "" then delete the whole key
DeleteRegKey HKCR .${EXT}
Goto NoOwn
RestoreBackup:
WriteRegStr HKCR .${EXT} "" $1
DeleteRegValue HKCR .${EXT} "backup_val"
NoOwn:
NoExt:
StrCmp "${GRP}" "" NoGrp
MessageBox MB_OK "Deleting $SMPROGRAMS\${GRP}"
RMDir /r "$SMPROGRAMS\${GRP}"
NoGrp:
IfFileExists "$INSTDIR\bin\yap.exe" 0 NoDir
RMDir /r "$INSTDIR"
goto Done
NoDir:
MessageBox MB_OK "Folder $INSTDIR doesn't seem to contain Prolog"
Done:
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YAP64"
DeleteRegKey HKLM ${REGKEY}
SectionEnd
################################################################
# FUNCTIONS
################################################################
Function .onInit
;Extract InstallOptions files
;$PLUGINSDIR will automatically be removed when the installer closes
InitPluginsDir
File /oname=$PLUGINSDIR\options.ini "options.ini"
FunctionEnd
################################################################
# Handle customisation; Settings are maintained in
#
# HKLM ${REGKEY}
#
# Using the following mapping:
#
# ${EXT} fileExtension
################################################################
Function SetCustom
# Basic system info
Call UserInfo
# Filename extension
ReadRegStr ${EXT} HKLM ${REGKEY} fileExtension
StrCmp ${EXT} "" 0 HasExt
StrCpy ${EXT} "pl"
HasExt:
WriteINIStr $PLUGINSDIR\options.ini "Field 4" "State" ${EXT}
# Startmenu program group
ReadRegStr ${GRP} HKLM ${REGKEY} group
StrCmp ${GRP} "" 0 HasGroup
StrCpy ${GRP} "YAP64"
HasGroup:
WriteINIStr $PLUGINSDIR\options.ini "Field 6" "State" ${GRP}
# Start the dialog
Push ${TEMP1}
InstallOptions::dialog "$PLUGINSDIR\options.ini"
Pop ${TEMP1}
Pop ${TEMP1}
# Get the results
ReadINIStr ${EXT} $PLUGINSDIR\options.ini "Field 4" "State"
ReadINIStr ${GRP} $PLUGINSDIR\options.ini "Field 6" "State"
FunctionEnd
Function UserInfo
ClearErrors
UserInfo::GetName
IfErrors Win9x
Pop $0
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" 0 +4
SetShellVarContext all
StrCpy ${SHCTX} "all"
Goto done
StrCmp $1 "Power" 0 +3
StrCpy ${SHCTX} "all"
Goto done
StrCmp $1 "User" 0 +3
StrCpy ${SHCTX} "current"
Goto done
StrCmp $1 "Guest" 0 +3
StrCpy ${SHCTX} "current"
Goto done
StrCpy ${SHCTX} "current" # Unkown accounttype
Goto done
Win9x:
StrCpy ${SHCTX} "current"
Goto end
done:
StrCmp ${SHCTX} "all" 0 +2
SetShellVarContext all
end:
FunctionEnd
Function .onInstSuccess
MessageBox MB_YESNO "Installation complete. View readme?" IDNO NoReadme
ExecShell "open" "$INSTDIR\doc\README.TXT"
NoReadme:
FunctionEnd
Function .onInstFailed
MessageBox MB_OK "Installation failed.$\r$\n\
If you cannot resolve the issue or it is a bug in the$\r$\n\
installer, please contact yap-users@sf.net"
FunctionEnd
outfile "yap64-6.3.0-installer.exe"

View File

@ -1019,3 +1019,35 @@ current_key(A,K) :-
;
Pred = Na
).
compile_predicates(Ps) :-
'$current_module'(Mod),
'$compile_predicates'(Ps, Mod, compile_predicates(Ps)).
'$compile_predicates'(V, _, Call) :-
var(V), !,
'$do_error'(instantiation_error,Call).
'$compile_predicates'(M:Ps, _, Call) :-
'$compile_predicates'(Ps, M, Call).
'$compile_predicates'([], _, _).
'$compile_predicates'(P.Ps, M, Call) :-
'$compile_predicate'(P, M, Call).
'$compile_predicates'(Ps, M, Call).
'$compile_predicate'(P, M, Call) :-
var(P), !,
'$do_error'(instantiation_error,Call).
'$compile_predicate'(M:P, _, Call) :-
'$compile_predicate'(P, M, Call).
'$compile_predicate'(Na/Ar, Mod, _Call) :-
functor(G, Na, Ar),
findall((G.B),clause(Mod:G,B),Cls),
abolish(Mod:Na,Ar),
'$add_all'(Cls, Mod).
'$add_all'([], _).
'$add_all'((G.B).Cls, Mod) :-
assert_static(Mod:(G:-B)),
'$add_all'(Cls, Mod).