Commit 3a007ad8 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Adapted from PAKCS 2.2.1

parent f24107fb
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="prim_doesFileExist" arity="1">
<library>prim_directory</library>
<entry>prim_doesFileExist</entry>
</primitive>
<primitive name="prim_doesDirectoryExist" arity="1">
<library>prim_directory</library>
<entry>prim_doesDirectoryExist</entry>
</primitive>
<primitive name="prim_fileSize" arity="1">
<library>prim_directory</library>
<entry>prim_fileSize</entry>
</primitive>
<primitive name="prim_getModificationTime" arity="1">
<library>prim_directory</library>
<entry>prim_getModificationTime</entry>
</primitive>
<primitive name="prim_getDirectoryContents" arity="1">
<library>prim_directory</library>
<entry>prim_getDirectoryContents</entry>
</primitive>
<primitive name="getCurrentDirectory" arity="0">
<library>prim_directory</library>
<entry>prim_getCurrentDirectory</entry>
</primitive>
<primitive name="prim_setCurrentDirectory" arity="1">
<library>prim_directory</library>
<entry>prim_setCurrentDirectory</entry>
</primitive>
<primitive name="prim_createDirectory" arity="1">
<library>prim_directory</library>
<entry>prim_createDirectory</entry>
</primitive>
<primitive name="prim_removeFile" arity="1">
<library>prim_directory</library>
<entry>prim_removeFile</entry>
</primitive>
<primitive name="prim_removeDirectory" arity="1">
<library>prim_directory</library>
<entry>prim_removeDirectory</entry>
</primitive>
<primitive name="prim_renameFile" arity="2">
<library>prim_directory</library>
<entry>prim_renameFile</entry>
</primitive>
<primitive name="prim_renameDirectory" arity="2">
<library>prim_directory</library>
<entry>prim_renameDirectory</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Definitions of builtins of module Directory:
%
'Directory.prim_doesFileExist'(FileName,Exists) :-
string2Atom(FileName,FName),
(existsFile(FName) -> Exists='Prelude.True' ; Exists='Prelude.False').
'Directory.prim_doesDirectoryExist'(DirName,Exists) :-
string2Atom(DirName,Dir),
(existsDirectory(Dir) -> Exists='Prelude.True' ; Exists='Prelude.False').
'Directory.prim_getModificationTime'(FileName,'Time.CTime'(Time)) :-
string2Atom(FileName,FName),
fileModTime(FName,Time).
'Directory.prim_fileSize'(FileName,Size) :-
string2Atom(FileName,FName),
fileSize(FName,Size).
'Directory.getCurrentDirectory'(DirName) :-
workingDirectory(Dir),
atom2String(Dir,DirName).
'Directory.prim_setCurrentDirectory'(DirName,'Prelude.()') :-
string2Atom(DirName,Dir),
setWorkingDirectory(Dir).
'Directory.prim_getDirectoryContents'(DirName,EntryNames) :-
string2Atom(DirName,Dir),
directoryFiles(Dir,Entries),
map2M(basics:atom2String,Entries,EntryNames).
'Directory.prim_createDirectory'(DirName,'Prelude.()') :-
string2Atom(DirName,DName),
makeDirectory(DName).
'Directory.prim_removeFile'(FileName,'Prelude.()') :-
string2Atom(FileName,FName),
deleteFile(FName).
'Directory.prim_removeDirectory'(DirName,'Prelude.()') :-
string2Atom(DirName,DName),
deleteDirectory(DName).
'Directory.prim_renameFile'(FileName1,FileName2,'Prelude.()') :-
string2Atom(FileName1,FName1),
string2Atom(FileName2,FName2),
renameFile(FName1,FName2).
'Directory.prim_renameDirectory'(DirName1,DirName2,'Prelude.()') :-
string2Atom(DirName1,DName1),
string2Atom(DirName2,DName2),
renameDirectory(DName1,DName2).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="curryCompiler" arity="0">
<library>prim_distribution</library>
<entry>prim_curryCompiler</entry>
</primitive>
<primitive name="curryCompilerMajorVersion" arity="0">
<library>prim_distribution</library>
<entry>prim_curryCompilerMajorVersion</entry>
</primitive>
<primitive name="curryCompilerMinorVersion" arity="0">
<library>prim_distribution</library>
<entry>prim_curryCompilerMinorVersion</entry>
</primitive>
<primitive name="curryCompilerRevisionVersion" arity="0">
<library>prim_distribution</library>
<entry>prim_curryCompilerRevisionVersion</entry>
</primitive>
<primitive name="curryRuntime" arity="0">
<library>prim_distribution</library>
<entry>prim_curryRuntime</entry>
</primitive>
<primitive name="curryRuntimeMajorVersion" arity="0">
<library>prim_distribution</library>
<entry>prim_curryRuntimeMajorVersion</entry>
</primitive>
<primitive name="curryRuntimeMinorVersion" arity="0">
<library>prim_distribution</library>
<entry>prim_curryRuntimeMinorVersion</entry>
</primitive>
<primitive name="baseVersion" arity="0">
<library>prim_distribution</library>
<entry>prim_baseVersion</entry>
</primitive>
<primitive name="installDir" arity="0">
<library>prim_distribution</library>
<entry>prim_installDir</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Definitions of builtins of module Distribution
%
'Distribution.curryCompiler'(CS) :- atom2String(pakcs,CS).
'Distribution.curryCompilerMajorVersion'(V) :- compilerMajorVersion(V).
'Distribution.curryCompilerMinorVersion'(V) :- compilerMinorVersion(V).
'Distribution.curryCompilerRevisionVersion'(V) :- compilerRevisionVersion(V).
'Distribution.curryRuntime'(PrologS) :-
prolog(Prolog), atom2String(Prolog,PrologS).
'Distribution.curryRuntimeMajorVersion'(V) :- prologMajorVersion(V).
'Distribution.curryRuntimeMinorVersion'(V) :- prologMinorVersion(V).
'Distribution.baseVersion'(BVS) :- baseVersion(BVA), atom2String(BVA,BVS).
'Distribution.installDir'(PHS) :-
installDir(PH)
-> atom2String(PH,PHS)
; raise_exception('Distribution.installDir: cannot determine installation directory!').
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="prim_Float_plus" arity="2">
<library>prim_float</library>
<entry>prim_Float_plus</entry>
</primitive>
<primitive name="prim_Float_minus" arity="2">
<library>prim_float</library>
<entry>prim_Float_minus</entry>
</primitive>
<primitive name="prim_Float_times" arity="2">
<library>prim_float</library>
<entry>prim_Float_times</entry>
</primitive>
<primitive name="prim_Float_div" arity="2">
<library>prim_float</library>
<entry>prim_Float_div</entry>
</primitive>
<primitive name="prim_i2f" arity="1">
<library>prim_float</library>
<entry>prim_i2f</entry>
</primitive>
<primitive name="prim_round" arity="1">
<library>prim_float</library>
<entry>prim_round</entry>
</primitive>
<primitive name="prim_truncate" arity="1">
<library>prim_float</library>
<entry>prim_truncate</entry>
</primitive>
<primitive name="prim_sqrt" arity="1">
<library>prim_float</library>
<entry>prim_sqrt</entry>
</primitive>
<primitive name="prim_log" arity="1">
<library>prim_float</library>
<entry>prim_log</entry>
</primitive>
<primitive name="prim_exp" arity="1">
<library>prim_float</library>
<entry>prim_exp</entry>
</primitive>
<primitive name="prim_sin" arity="1">
<library>prim_float</library>
<entry>prim_sin</entry>
</primitive>
<primitive name="prim_cos" arity="1">
<library>prim_float</library>
<entry>prim_cos</entry>
</primitive>
<primitive name="prim_tan" arity="1">
<library>prim_float</library>
<entry>prim_tan</entry>
</primitive>
<primitive name="prim_asin" arity="1">
<library>prim_float</library>
<entry>prim_asin</entry>
</primitive>
<primitive name="prim_acos" arity="1">
<library>prim_float</library>
<entry>prim_acos</entry>
</primitive>
<primitive name="prim_atan" arity="1">
<library>prim_float</library>
<entry>prim_atan</entry>
</primitive>
<primitive name="prim_sinh" arity="1">
<library>prim_float</library>
<entry>prim_sinh</entry>
</primitive>
<primitive name="prim_cosh" arity="1">
<library>prim_float</library>
<entry>prim_cosh</entry>
</primitive>
<primitive name="prim_tanh" arity="1">
<library>prim_float</library>
<entry>prim_tanh</entry>
</primitive>
<primitive name="prim_asinh" arity="1">
<library>prim_float</library>
<entry>prim_asinh</entry>
</primitive>
<primitive name="prim_acosh" arity="1">
<library>prim_float</library>
<entry>prim_acosh</entry>
</primitive>
<primitive name="prim_atanh" arity="1">
<library>prim_float</library>
<entry>prim_atanh</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implementation of library Float
'Float.prim_Float_plus'(Y,X,R) :- R is X+Y.
'Float.prim_Float_minus'(Y,X,R) :- R is X-Y.
'Float.prim_Float_times'(Y,X,R) :- R is X*Y.
'Float.prim_Float_div'(Y,X,R) :- R is X/Y.
% transform an integer into a float:
'Float.prim_i2f'(X,R) :- R is X*1.0.
% transform a float to an integer:
'Float.prim_truncate'(X,R) :- R is integer(X).
% round a float to an integer:
'Float.prim_round'(X,R) :- R is integer(round(X)).
'Float.prim_sqrt'(X,R) :- R is sqrt(X).
'Float.prim_log'(X,R) :- R is log(X).
'Float.prim_exp'(X,R) :- R is exp(X).
'Float.prim_sin'(X,R) :- R is sin(X).
'Float.prim_cos'(X,R) :- R is cos(X).
'Float.prim_tan'(X,R) :- R is tan(X).
'Float.prim_asin'(X,R) :- R is asin(X).
'Float.prim_acos'(X,R) :- R is acos(X).
'Float.prim_atan'(X,R) :- R is atan(X).
'Float.prim_sinh'(X,R) :- R is sinh(X).
'Float.prim_cosh'(X,R) :- R is cosh(X).
'Float.prim_tanh'(X,R) :- R is tanh(X).
'Float.prim_asinh'(X,R) :- R is asinh(X).
'Float.prim_acosh'(X,R) :- R is acosh(X).
'Float.prim_atanh'(X,R) :- R is atanh(X).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -116,7 +116,8 @@ external_d_C_prim_readGlobal (C_Global_Pers name) _ _ = fromIO $
case reads s of
[(val,"")] -> return val
_ -> throw (IOException $ "Persistent file `" ++ name ++
"' contains malformed contents")
"' contains malformed contents:\n" ++
s)
external_d_C_prim_writeGlobal :: Curry_Prelude.Curry a => C_Global a -> a
-> Cover -> ConstStore -> Curry_Prelude.C_IO Curry_Prelude.OP_Unit
......
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="getCPUTime" arity="0">
<library>prim_system</library>
<entry>prim_getCPUTime</entry>
</primitive>
<primitive name="getElapsedTime" arity="0">
<library>prim_system</library>
<entry>prim_getElapsedTime</entry>
</primitive>
<primitive name="getArgs" arity="0">
<library>prim_system</library>
<entry>prim_getArgs</entry>
</primitive>
<primitive name="prim_getEnviron" arity="1">
<library>prim_system</library>
<entry>prim_getEnviron</entry>
</primitive>
<primitive name="getHostname" arity="0">
<library>prim_system</library>
<entry>prim_getHostname</entry>
</primitive>
<primitive name="getPID" arity="0">
<library>prim_system</library>
<entry>prim_getPID</entry>
</primitive>
<primitive name="getProgName" arity="0">
<library>prim_system</library>
<entry>prim_getProgName</entry>
</primitive>
<primitive name="prim_system" arity="1">
<library>prim_system</library>
<entry>prim_system</entry>
</primitive>
<primitive name="prim_exitWith" arity="1">
<library>prim_system</library>
<entry>prim_exitWith</entry>
</primitive>
<primitive name="prim_sleep" arity="1">
<library>prim_system</library>
<entry>prim_sleep</entry>
</primitive>
<primitive name="isWindows" arity="0">
<library>prim_system</library>
<entry>isWindows</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Definitions of builtins of module System:
%
'System.getCPUTime'(MS) :- getRunTime(MS).
'System.getElapsedTime'(MS) :- getElapsedTime(MS).
'System.getArgs'(StringArgs) :-
(rtArgs(Args) -> true ; getProgramArgs(Args)),
map2M(basics:atom2String,Args,StringArgs).
'System.prim_getEnviron'(Var,Value) :-
string2Atom(Var,AtomVar),
(getEnv(AtomVar,AtomValue) -> atom2String(AtomValue,Value)
; Value = []). % empty string if undefined
'System.getHostname'(String) :-
getHostname(Name),
atom2String(Name,String).
'System.getPID'(Pid) :- currentPID(Pid).
'System.getProgName'(String) :-
user:currentModuleFile(Name,_),
atom2String(Name,String).
'System.prim_system'(S,Status) :-
string2Atom(S,Cmd),
shellCmd(Cmd,Status).
'System.prim_exitWith'(Code,_) :- halt(Code).
'System.prim_sleep'(S,'Prelude.()') :- sleepSeconds(S).
'System.isWindows'(Flag) :-
getEnv('COMSPEC', _) ->
% Windows systems define this environment variable...
Flag = 'Prelude.True'
; Flag = 'Prelude.False'.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="getClockTime" arity="0">
<library>prim_time</library>
<entry>prim_getClockTime</entry>
</primitive>
<primitive name="prim_toCalendarTime" arity="1">
<library>prim_time</library>
<entry>prim_toCalendarTime</entry>
</primitive>
<primitive name="prim_toUTCTime" arity="1">
<library>prim_time</library>
<entry>prim_toUTCTime</entry>
</primitive>
<primitive name="prim_toClockTime" arity="1">
<library>prim_time</library>
<entry>prim_toClockTime</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Definitions of builtins of module Time:
%
'Time.getClockTime'('Time.CTime'(CTime)) :- currentClockTime(CTime).
'Time.prim_toCalendarTime'('Time.CTime'(ClockTime),
'Time.CalendarTime'(Year,Month,Day,Hour,Min,Sec,TZ)) :-
clocktime2localtime(ClockTime,Year,Month,Day,Hour,Min,Sec,TZ).
'Time.prim_toUTCTime'('Time.CTime'(ClockTime),
'Time.CalendarTime'(Year,Month,Day,Hour,Min,Sec,0)) :-
clocktime2utctime(ClockTime,Year,Month,Day,Hour,Min,Sec).
'Time.prim_toClockTime'('Time.CalendarTime'(Year,Month,Day,Hour,Min,Sec,TZ),
'Time.CTime'(CTime)) :-
date2clocktime(Year,Month,Day,Hour,Min,Sec,TZ,CTime).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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