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

Builtin implementations added to package

parent 41b0451e
......@@ -3,7 +3,6 @@
---
--- @author Michael Hanus
--- @version January 2017
--- @category general
------------------------------------------------------------------------------
{-# LANGUAGE CPP #-}
......
<?xml version="1.0" standalone="no"?>
<!DOCTYPE primitives SYSTEM "http://www.informatik.uni-kiel.de/~pakcs/primitives.dtd">
<primitives>
<primitive name="prim_execCmd" arity="1">
<library>prim_ioexts</library>
<entry>prim_execCmd</entry>
</primitive>
<primitive name="prim_connectToCmd" arity="1">
<library>prim_ioexts</library>
<entry>prim_connectToCmd</entry>
</primitive>
<primitive name="prim_setAssoc" arity="2">
<library>prim_ioexts</library>
<entry>prim_setAssoc</entry>
</primitive>
<primitive name="prim_getAssoc" arity="1">
<library>prim_ioexts</library>
<entry>prim_getAssoc</entry>
</primitive>
</primitives>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Prolog implementation of builtins of module System.IOExts:
%
:- dynamic globalAssoc/2.
'System.IOExts.prim_setAssoc'(Key,Val,'Prelude.()') :-
string2Atom(Key,KeyA),
(retract(globalAssoc(KeyA,_)) -> true ; true),
assertz(globalAssoc(KeyA,Val)),
!.
'System.IOExts.prim_getAssoc'(Key,R) :-
string2Atom(Key,KeyA),
(globalAssoc(KeyA,Val) -> R='Prelude.Just'(Val) ; R='Prelude.Nothing'),
!.
% shell command execution:
'System.IOExts.prim_execCmd'(CmdString,'Prelude.(,,)'(StdIn,StdOut,StdErr)) :-
string2Atom(CmdString,Cmd),
execCommand(Cmd,StdIn,StdOut,StdErr).
% shell command execution:
'System.IOExts.prim_connectToCmd'(CmdString,
'$stream'('$inoutstream'(StdOut,StdIn))) :-
string2Atom(CmdString,Cmd),
execCommand(Cmd,StdIn,StdOut,std).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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