Commit 21f4cf7a authored by Michael Hanus's avatar Michael Hanus
Browse files

Examples updated, REPL has now options v<n> similarly to KiCS2

parent ae739028
PAKCS: Release Notes
====================
Release notes for PAKCS Version 1.11.3 (April 25, 2014, under development)
--------------------------------------------------------------------------
Release notes for PAKCS Version 1.11.3 (May 12, 2014, under development)
------------------------------------------------------------------------
Changes to version 1.11.2:
* PAKCS parameter `--safe` added to support safe execution without
......@@ -13,6 +13,8 @@ Changes to version 1.11.2:
`tools/lib_reprecated`.
* Prelude: definition of `div` changed (to be compatible with Haskell)
and `quot`, `rem`, `divMod`, `quotRem` added.
* Prelude: encapsulated search operations (findall and more) moved
into new library `Findall`.
* Library `Distribution`: front-end parameters extended by supporting
"special" (i.e., aribrary) arguments.
* Library `Distribution` and `FlatCurry`: after calling the front end,
......
......@@ -3,6 +3,7 @@
:- module(basics,[exitCode/1, setExitCode/1, failWithExitCode/0,
noLoadMessage/0, lastload/1, plprofiling/1,
verbosity/1, setVerbosity/1, verbosityIntermediate/0,
verbosemode/1, setVerboseMode/1, quietmode/1, rtargs/1,
compileWithSharing/1,
compileWithDebug/0, compileWithFailPrint/0,
......@@ -46,7 +47,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- dynamic lastload/1, plprofiling/1, quietmode/1, verbosemode/1, rtargs/1,
:- dynamic lastload/1, plprofiling/1,
verbosity/1, quietmode/1, verbosemode/1, rtargs/1,
compileWithSharing/1,
compileWithDebug/0, compileWithFailPrint/0, hasPrintedFailure/0,
printConsFailure/1, exitCode/1,
......@@ -77,7 +79,7 @@ user:portray_message(informational,restored(_,_,_)) :- !.
user:portray_message(informational,created(_,_)) :- !.
noLoadMessage :- \+ pakcsrc(_,_), !. % no messages for initial state creation
noLoadMessage :- pakcsrc(showplload,no).
noLoadMessage :- \+ verbosityIntermediate.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -111,6 +113,14 @@ verbosemode(no). % yes if program should be executed in verbose mode
setVerboseMode(V) :-
retract(verbosemode(_)), asserta(verbosemode(V)).
verbosity(1). % verbosity level
setVerbosity(N) :-
retract(verbosity(_)), asserta(verbosity(N)).
% verbosity level >= 2 (intermdiate messages)?
verbosityIntermediate :- verbosity(N), N>1.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% writing outputs:
......
......@@ -135,6 +135,7 @@ processArgs([Arg|Args]) :-
(Arg='--quiet' ; Arg='-quiet' ; Arg='-q'),
retract(quietmode(_)),
asserta(quietmode(yes)), !,
setVerbosity(0),
processArgs(Args).
processArgs(['--safe'|Args]) :- !, % safe execution mode
retract(forbiddenModules(_)),
......@@ -430,6 +431,11 @@ processCommand("set",[]) :- !,
write('+/-warn - show parser warnings'), nl,
write('path <path> - set additional search path for loading modules'), nl,
write('printdepth <n> - set print depth to <n> (0 = unlimited)'), nl,
write('v<n> - verbosity level'), nl,
write(' 0: quiet (errors and warnings only)'), nl,
write(' 1: status messages (default)'), nl,
write(' 2: intermediate messages and commands'), nl,
write(' 3: all intermediate results'), nl,
nl,
write('Options in debug mode:'), nl,
write('+/-single - single step mode'), nl,
......@@ -471,6 +477,7 @@ processCommand("set",[]) :- !,
atom_codes(AP,SP), write('loadpath = '), write(AP), nl,
printDepth(PD), write('printdepth = '),
(PD=0 -> write(PD) ; PD1 is PD-1, write(PD1)), nl,
verbosity(VL), write('verbosity = '), write(VL), nl,
(compileWithDebug ->
(singlestep -> write('+') ; write('-')), write(single), write(' '),
(spymode -> write('+') ; write('-')), write(spy), write(' '),
......@@ -953,6 +960,10 @@ processSetOption("+printfail") :-
processSetOption("+printfail") :-
asserta(compileWithFailPrint), !,
(lastload("") -> true ; process(":r")).
processSetOption("v0") :- !, setVerbosity(0).
processSetOption("v1") :- !, setVerbosity(1).
processSetOption("v2") :- !, setVerbosity(2).
processSetOption("v3") :- !, setVerbosity(3).
processSetOption("path") :- !,
setCurryPath(''),
......@@ -1090,8 +1101,8 @@ parseProgram(Prog) :-
atom_codes(PC,CL1),
(parser_warnings(no) -> append(CL1," --nowarns",CL2)
; CL2 = CL1 ),
(quietmode(yes) -> append(CL2," --quiet",CL3)
; CL3 = CL2 ),
(verbosity(0) -> append(CL2," --quiet",CL3)
; CL3 = CL2 ),
getCurryPath(LP),
(LP=[] -> CL4 = CL3
; path2String(LP,LPS), append(LPS,[34],LPSQ),
......
......@@ -165,12 +165,13 @@ readImportedEntities(LoadPath,[Imp|Imps],ProcessedImps,
prog2PrologFile(DirProg,PrologFile),
(doesPrologTranslationExists(DirProg,PrologFile) -> true
; readProg(LoadPath,Imp,ImpProg,AbsFlatProgFile),
(pakcsrc(showplload,no) -> true
; appendAtoms(['Compiling \'',AbsFlatProgFile,'\' into \'',
PrologFile,'\'...'],CompileMsg),
writeErr(CompileMsg)),
(verbosityIntermediate
-> appendAtoms(['Compiling \'',AbsFlatProgFile,'\' into \'',
PrologFile,'\'...'],CompileMsg),
writeErr(CompileMsg)
; true),
generateProg(ImpProg,AllImpTypes,AllImpFuncs,AllImpOps,PrologFile),
(pakcsrc(showplload,no) -> true ; writeErr('done'), nlErr)
(verbosityIntermediate -> writeErr('done'), nlErr ; true)
).
doesPrologTranslationExists(DirProg,PrologFile) :-
......@@ -322,7 +323,7 @@ readInterface([Dir|Dirs],Prog,FlatInt,DirProgName) :-
(existsFile(DirProgFile)
-> readFlcFromFcy(DirProgFile,FlatInt),
DirProgName = DirProg,
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> checkForFurtherFcyProgs(Dir,Dirs,Prog)
; true)
; readInterface(Dirs,Prog,FlatInt,DirProgName)).
......@@ -343,7 +344,7 @@ readProgInLoadPath([Dir|Dirs],Prog,FlatProg,AbsFlatProgFile) :-
-> readFlcFromFcy(DirProgFile,PlainFlatProg),
AbsFlatProgFile = DirProgFile,
mergeWithPrimitiveSpecs(PlainFlatProg,DirProg,FlatProg),
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> checkForFurtherFcyProgs(Dir,Dirs,Prog) ; true)
; readProgInLoadPath(Dirs,Prog,FlatProg,AbsFlatProgFile)).
......@@ -378,12 +379,12 @@ mergeWithPrimitiveSpecs(PlainFlatProg,DirProg,FlatProg) :-
appendAtom(DirProg,'.prim_c2p',PrimXmlFile),
existsFile(PrimXmlFile),
!,
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> writeErr('>>> Reading '),
writeErr(PrimXmlFile), writeErr(' ... '),
getRunTime(RT1) ; true),
readPrimitiveXmlSpecs(PrimXmlFile,PrimSpecs),
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> getRunTime(RT2),
RT is RT2-RT1,
writeErr(RT), writeErr(' ms.'), nlErr
......
......@@ -15,7 +15,7 @@ prim_readFlatCurryFile(FileString,FlatProg) :-
readFlatProg(ProgFile,FlatProg) :-
existsFile(ProgFile), !,
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> write(user_error,'>>> Reading '),
write(user_error,ProgFile), write(user_error,' ... '),
getRunTime(RT1) ; true),
......@@ -23,7 +23,7 @@ readFlatProg(ProgFile,FlatProg) :-
readStreamContents(Stream,FcyPrologString), !,
readTerm(FcyPrologString,unchecked,Tail,Term),
skipWhiteSpace(Tail,[]),
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> getRunTime(RT2),
RT is RT2-RT1,
write(user_error,RT), write(user_error,' ms.'), nl(user_error)
......
......@@ -10,7 +10,7 @@
; use_module('libswi/prim_readshowterm').
readFlcFromFcy(FileName,FlatProg) :-
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> write(user_error,'>>> Reading '),
write(user_error,FileName), write(user_error,' ... '),
getRunTime(RT1) ; true),
......@@ -18,7 +18,7 @@ readFlcFromFcy(FileName,FlatProg) :-
readStreamContents(Stream,FcyPrologString),
readTerm(FcyPrologString,unchecked,Tail,Term),
skipWhiteSpace(Tail,[]),
(pakcsrc(showfcyload,yes)
(verbosityIntermediate
-> getRunTime(RT2),
RT is RT2-RT1,
write(user_error,RT), write(user_error,' ms.'), nl(user_error)
......
......@@ -4,6 +4,7 @@ LOGFILE=xxx$$
../bin/cleancurry -r
cat << EOM | $PAKCS -Dmoresolutions=no | tee $LOGFILE
:set +verbose
:set v0
:set printdepth 0
:l rev
append [1,2] [3,4]
......@@ -260,9 +261,11 @@ elif [ -x "${SWI}" ] ; then
diff CPTEST.swiresult $LOGFILE > $DIFF
fi
if [ "`cat $DIFF`" = "" ] ; then
echo
echo "Regression test successfully executed!"
/bin/rm -f $LOGFILE $DIFF
else
echo
echo "Differences in regression test occurred:"
cat $DIFF
/bin/rm -f $DIFF
......
This diff is collapsed.
......@@ -21,6 +21,8 @@
-- The current program can only deal with bars of type 4/4.
import Findall
------------------------ Data type declarations ----------------------------
-- The notes (C major scale, R denotes a rest)
......
import Findall
-- Geographical database (from John Lloyd's Escher report):
data County = Avon | Bedfordshire | Berkshire | Buckinghamshire |
......@@ -124,7 +126,7 @@ isin Sherbourne Dorset = success
-- list membership:
member e l = let xs,ys free in xs ++ (e:ys) =:= l
member e xs = _ ++ (e:_) =:= xs
-- Some queries and their expected results:
......
-- Some demos of monadic I/O:
import Findall
-- a simple echo:
echo = getChar >>= \c -> if ord c == (-1) then done else putChar c >> echo
......
import Findall
-- natural numbers defined by s-terms (Z=zero, S=successor):
data Nat = Z | S Nat
......
import Findall
-- Place n queens on a chessboard so that no queen can capture another queen:
-- (this solution is due to Sergio Antoy)
......
......@@ -12,6 +12,7 @@
import Assertion
import AllSolutions
import Findall(findfirst)
someValue e = findfirst (=:=e)
......
lib-trunk @ 35e0c7b4
Subproject commit f4e24f91028da657105a0f207297a34314ed74fe
Subproject commit 35e0c7b4b693825ee53079ba8ef7181e4603b93a
......@@ -38,15 +38,6 @@ dotviewcommand=dot -Tps > /tmp/dotxxx ; gv /tmp/dotxxx
# Show the results of loading pakcsrc and $HOME/.pakcsrc (values: yes | no):
verboserc=no
# Show messages relating to parsing of modules (values: yes | no):
parsermessages=yes
# Show loading of fcy files (values: yes | no):
showfcyload=no
# Show loading/compiling of Prolog files (values: yes | no):
showplload=no
# Show messages related to dynamic predicates (such as loading,
# waiting for lock files, etc), compare lib/Dynamic. Values: yes | no
dynamicmessages=yes
......
------------------------------------------------------------------------------
--- Note: This library has been renamed into FlatCurryShow.
--- Look there for further documentation.
---
--- This module is only included for backward compatibility
--- and might be deleted in future releases.
---
--- Note that the function "writeFLC" contained in previous releases
--- is no longer supported. Use Flat2Fcy.writeFCY instead
--- and change file suffix into ".fcy"!
---
--- @author Michael Hanus
--- @version December 2005
------------------------------------------------------------------------------
module FlatCurryTools(showFlatProg,showFlatType,showFlatFunc,
showCurryType,showCurryExpr,showCurryId,showCurryVar)
where
import FlatCurryShow
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment