Commit 4eae8c87 authored by Michael Hanus 's avatar Michael Hanus

Simple primitives directly added to prelude

parent a7f86651
Subproject commit 6f795a699c23064dff64816c78eb7beddf4a5d09
Subproject commit 63c4e0008ecaf5b2a7a9be7ca3f03bcad7eacc18
......@@ -53,7 +53,9 @@
prog2ICurryFile/2, hierarchical2dirs/2,
readStreamLine/2, removeBlanks/2, skipblanks/2,
numberconst/3, readFileContents/2, readStreamContents/2,
printError/1, prologError2Atom/2]).
printError/1, prologError2Atom/2,
readChar/3, readString/3,
showTermChar/3, showTermString/3]).
:- use_module(prologbasics).
:- use_module(pakcsversion).
......@@ -1064,3 +1066,134 @@ prologTerm2Atom(T,A) :-
prefixComma(Atom,CAtom) :- appendAtom(',',Atom,CAtom).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of reading and showing single characters and strings.
% This is contained here since it is used by the primitives of the prelude
% and the library ReadShowTerm.
readChar([92,N|S],T,C) :- N>=48, N<58, !, % read decimal numeric char
readDecimalChar(0,[N|S],T,C).
readChar([92,N,39|T],T,C) :- !,
readStringChar(N,NS),
char_int(C,NS).
readChar([92,78,85,76,39|T],T,C) :- !, char_int(C,0). % '\NUL' character
readChar([92,83,79,72,39|T],T,C) :- !, char_int(C,1). % '\SOH' character
readChar([92,83,84,88,39|T],T,C) :- !, char_int(C,2). % '\STX' character
readChar([92,69,84,88,39|T],T,C) :- !, char_int(C,3). % '\ETX' character
readChar([92,69,79,84,39|T],T,C) :- !, char_int(C,4). % '\EOT' character
readChar([92,69,78,81,39|T],T,C) :- !, char_int(C,5). % '\ENQ' character
readChar([92,65,67,75,39|T],T,C) :- !, char_int(C,6). % '\ACK' character
readChar([92,97,39|T],T,C) :- !, char_int(C,7). % '\a' character
readChar([92,66,69,76,39|T],T,C) :- !, char_int(C,7). % '\BEL' character
readChar([92,98,39|T],T,C) :- !, char_int(C,8). % '\b' character
readChar([92,66,83,39|T],T,C) :- !, char_int(C,8). % '\BS' character
readChar([92,116,39|T],T,C) :- !, char_int(C,9). % '\t' character
readChar([92,72,84,39|T],T,C) :- !, char_int(C,9). % '\HT' character
readChar([92,110,39|T],T,C) :- !, char_int(C,10). % '\n' character
readChar([92,76,70,39|T],T,C) :- !, char_int(C,10). % '\LF' character
readChar([92,118,39|T],T,C) :- !, char_int(C,11). % '\v' character
readChar([92,86,84,39|T],T,C) :- !, char_int(C,11). % '\VT' character
readChar([92,102,39|T],T,C) :- !, char_int(C,12). % '\f' character
readChar([92,70,70,39|T],T,C) :- !, char_int(C,12). % '\FF' character
readChar([92,114,39|T],T,C) :- !, char_int(C,13). % '\r' character
readChar([92,67,82,39|T],T,C) :- !, char_int(C,13). % '\CR' character
readChar([92,83,79,39|T],T,C) :- !, char_int(C,14). % '\SO' character
readChar([92,83,73,39|T],T,C) :- !, char_int(C,15). % '\SI' character
readChar([92,68,76,69,39|T],T,C) :- !, char_int(C,16). % '\DLE' character
readChar([92,68,67,49,39|T],T,C) :- !, char_int(C,17). % '\DC1' character
readChar([92,68,67,50,39|T],T,C) :- !, char_int(C,18). % '\DC2' character
readChar([92,68,67,51,39|T],T,C) :- !, char_int(C,19). % '\DC3' character
readChar([92,68,67,52,39|T],T,C) :- !, char_int(C,20). % '\DC4' character
readChar([92,78,65,75,39|T],T,C) :- !, char_int(C,21). % '\NAK' character
readChar([92,83,89,78,39|T],T,C) :- !, char_int(C,22). % '\SYN' character
readChar([92,69,84,66,39|T],T,C) :- !, char_int(C,23). % '\ETB' character
readChar([92,67,65,78,39|T],T,C) :- !, char_int(C,24). % '\CAN' character
readChar([92,69,77,39|T],T,C) :- !, char_int(C,25). % '\EM' character
readChar([92,83,85,66,39|T],T,C) :- !, char_int(C,26). % '\SUB' character
readChar([92,69,83,67,39|T],T,C) :- !, char_int(C,27). % '\ESC' character
readChar([92,70,83,39|T],T,C) :- !, char_int(C,28). % '\FS' character
readChar([92,71,83,39|T],T,C) :- !, char_int(C,29). % '\GS' character
readChar([92,82,83,39|T],T,C) :- !, char_int(C,30). % '\RS' character
readChar([92,85,83,39|T],T,C) :- !, char_int(C,31). % '\US' character
readChar([92,83,80,39|T],T,C) :- !, char_int(C,32). % '\SP' character
readChar([92,68,69,76,39|T],T,C) :- !, char_int(C,127). % '\DEL' character
readChar([N,39|T],T,C) :- char_int(C,N).
readDecimalChar(N,[39|T],T,C) :- !, char_int(C,N).
readDecimalChar(N,[M|S],T,C) :- M>=48, M<58, !,
NM is 10*N+M-48,
readDecimalChar(NM,S,T,C).
readString([34|T],T,[]) :- !.
readString([92|Ns],T,Str) :- !, readStringEscape(Ns,T,Str).
readString([N|Ns],T,[C|Str]) :-
char_int(C,N),
readString(Ns,T,Str).
readStringEscape([N|Ns],T,Str) :- N>=48, N<58, !,
V is N-48, readDecimalCharInString(V,Ns,T,Str).
readStringEscape([69,83,67|Ns],T,[C|Str]) :- !, % '\ESC' character
char_int(C,27),
readString(Ns,T,Str).
readStringEscape([68,69,76|Ns],T,[C|Str]) :- !, % '\DEL' character
char_int(C,127),
readString(Ns,T,Str).
readStringEscape([N|Ns],T,[C|Str]) :- !,
readStringChar(N,NS),
char_int(C,NS),
readString(Ns,T,Str).
% read a character with decimal number representation, e.g., '\243'
readDecimalCharInString(V,[N|Ns],T,Str) :- N>=48, N<58, !,
V1 is V*10+N-48,
readDecimalCharInString(V1,Ns,T,Str).
readDecimalCharInString(V,Ns,T,[C|Str]) :-
char_int(C,V),
readString(Ns,T,Str).
readStringChar(97,7) :- !.
readStringChar(98,8) :- !.
readStringChar(116,9) :- !.
readStringChar(110,10) :- !.
readStringChar(118,11) :- !.
readStringChar(102,12) :- !.
readStringChar(114,13) :- !.
readStringChar(34,34) :- !.
readStringChar(39,39) :- !.
readStringChar(92,92) :- !.
readStringChar(N,N) :-
writeErr('INTERNAL ERROR: unknown character string "'),
put_code(user_error,92), put_code(user_error,N),
writeErr('" in readStringChar'), nlErr.
% The show functions use difference lists.
showTermChar( 7,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,97]). % \a
showTermChar( 8,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,98]). % \b
showTermChar( 9,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,116]). % \t
showTermChar(10,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,110]). % \n
showTermChar(11,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,118]). % \v
showTermChar(12,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,102]). % \f
showTermChar(13,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,114]). % \r
showTermChar(34,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,34]). % 34="
showTermChar(92,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,92]). % 92=\
showTermChar(N,[C1,C2,C3|E],E) :- N<32, !,
N1 is (N//10)+48, N2 is (N mod 10)+48,
cp_string([C1,C2,C3],[92,N1,N2]).
showTermChar(N,E,F) :- N>126, !,
num2rdigits(N,RDs), rev(RDs,Ds),
cp_string(DS,[92|Ds]),
append(DS,F,E).
showTermChar(N,[C|E],E) :- char_int(C,N).
num2rdigits(N,[D]) :- N<10, !, D is N+48.
num2rdigits(N,[D|Ds]) :- D is (N mod 10)+48, N1 is N//10, num2rdigits(N1,Ds).
showTermString([],[Quot|E],E) :- char_int(Quot,34).
showTermString([C|T],S,E) :-
char_int(C,N),
showTermChar(N,S,ST),
showTermString(T,ST,E).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -254,7 +254,7 @@ generateProgOnFile('Prog'(Mod,Imports,MainTypes,MainFuncs,MainOps),
map1M(compiler:writeDynamicInfoClause,DynPreds),
nl,
write('%%%%% Number of shared variables: '),
numberOfShares(SC), write(SC), nl,
numberOfShares(SC), write(SC), nl, nl,
(PrimPlFile = '' -> true
; (verbosityIntermediate
-> writeErr('Adding code of Prolog file: '), writeLnErr(PrimPlFile)
......
......@@ -5,8 +5,6 @@
:- module(prim_readshowterm,
[prim_showQTerm/2, prim_showTerm/2, show_term/4,
prim_readNatLiteral/2, prim_readFloatLiteral/2,
prim_readCharLiteral/2, prim_readStringLiteral/2,
prim_readsQTerm/2, prim_readsUnqualifiedTerm/3, readTerm/4,
skipWhiteSpace/2, isShowableArg/1]).
......@@ -44,7 +42,7 @@ show_term(C,_,[Apo|S],E) :- % 39='''
char_int(C,N),
(N=39 -> char_int(BS,92), S=[BS,C|SE] % '
; (N=34 -> S=[C|SE] % "
; show_termchar(N,S,SE))),
; showTermChar(N,S,SE))),
SE = [Apo|E].
show_term('Prelude.()',_,[Op,Cl|E],E) :- !, char_int(Op,40), char_int(Cl,41).
show_term('VAR',_,S,E) :-
......@@ -97,30 +95,9 @@ showNumber(N,S,E) :-
show_termstring([],[Quot|E],E) :- char_int(Quot,34).
show_termstring([C|T],S,E) :-
char_int(C,N),
show_termchar(N,S,ST),
showTermChar(N,S,ST),
show_termstring(T,ST,E).
show_termchar( 7,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,97]). % \a
show_termchar( 8,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,98]). % \b
show_termchar( 9,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,116]). % \t
show_termchar(10,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,110]). % \n
show_termchar(11,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,118]). % \v
show_termchar(12,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,102]). % \f
show_termchar(13,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,114]). % \r
show_termchar(34,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,34]). % 34="
show_termchar(92,[C1,C2|E],E) :- !, cp_string([C1,C2],[92,92]). % 92=\
show_termchar(N,[C1,C2,C3|E],E) :- N<32, !,
N1 is (N//10)+48, N2 is (N mod 10)+48,
cp_string([C1,C2,C3],[92,N1,N2]).
show_termchar(N,E,F) :- N>126, !,
num2rdigits(N,RDs), rev(RDs,Ds),
cp_string(DS,[92|Ds]),
append(DS,F,E).
show_termchar(N,[C|E],E) :- char_int(C,N).
num2rdigits(N,[D]) :- N<10, !, D is N+48.
num2rdigits(N,[D|Ds]) :- D is (N mod 10)+48, N1 is N//10, num2rdigits(N1,Ds).
show_termlist(L,Q,SH,E) :- nonvar(L), L=[H|T], !,
show_term(H,Q,SH,SHE),
char_int(Colon,58), % 58=':'
......@@ -187,25 +164,11 @@ diffList([H|T],[H|DT],DTE) :- diffList(T,DT,DTE).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conversion of string representations of nat literals into Curry terms:
prim_readNatLiteral([CC|String],['Prelude.(,)'(Num,TailString)]) :-
char_int(CC,C), C>47, C<58,
natconst(NumStr,String,TailString),
number_codes(Num,[C|NumStr]), !.
prim_readNatLiteral(_,[]). % parse error
natconst([C|Cs]) --> [CC],
{ char_int(CC,C), C>47, C<58 }, !,
natconst(Cs).
natconst([]) --> skipblanks.
% conversion of string representations of float literals into Curry terms:
prim_readFloatLiteral([CC|String],['Prelude.(,)'(Num,TailString)]) :-
char_int(CC,C), C>47, C<58,
floatconst(NumStr,String,TailString),
number_codes(Num,[C|NumStr]), !.
prim_readFloatLiteral(_,[]). % parse error
floatconst([C|Cs]) --> [CC],
{ char_int(CC,C), C>47, C<58 }, !,
floatconst(Cs).
......@@ -224,22 +187,6 @@ intconst(Cs) --> ( [CC], {char_int(CC,45)}, natconst(NCs), {Cs=[45|NCs]}
; natconst(Cs)
).
% conversion of string representations of char literals into Curry terms:
% TODO: avoid char_int conversion
prim_readCharLiteral(String,['Prelude.(,)'(Char,TailString)]) :-
map2M(basics:char_int,String,[C|PrologString]),
C=39, readChar(PrologString,Tail,Char),
map2M(basics:char_int,TailString,Tail), !.
prim_readCharLiteral(_,[]). % parse error
% conversion of string representations of string literals into Curry terms:
% TODO: avoid char_int conversion
prim_readStringLiteral(String,['Prelude.(,)'(Result,TailString)]) :-
map2M(basics:char_int,String,[C|PrologString]),
C=34, readString(PrologString,Tail,Result),
map2M(basics:char_int,TailString,Tail), !.
prim_readStringLiteral(_,[]). % parse error
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conversion of standard prefix string representations of Curry terms
% into Curry terms:
......@@ -429,101 +376,6 @@ readTermArgs(S,Q,T,[Arg|Args]) :-
readTermS(S,Q,SA1,Arg), skipWhiteSpace(SA1,SA2),
readTermArgs(SA2,Q,T,Args).
readChar([92,N|S],T,C) :- N>=48, N<58, !, % read decimal numeric char
readDecimalChar(0,[N|S],T,C).
readChar([92,N,39|T],T,C) :- !,
readStringChar(N,NS),
char_int(C,NS).
readChar([92,78,85,76,39|T],T,C) :- !, char_int(C,0). % '\NUL' character
readChar([92,83,79,72,39|T],T,C) :- !, char_int(C,1). % '\SOH' character
readChar([92,83,84,88,39|T],T,C) :- !, char_int(C,2). % '\STX' character
readChar([92,69,84,88,39|T],T,C) :- !, char_int(C,3). % '\ETX' character
readChar([92,69,79,84,39|T],T,C) :- !, char_int(C,4). % '\EOT' character
readChar([92,69,78,81,39|T],T,C) :- !, char_int(C,5). % '\ENQ' character
readChar([92,65,67,75,39|T],T,C) :- !, char_int(C,6). % '\ACK' character
readChar([92,97,39|T],T,C) :- !, char_int(C,7). % '\a' character
readChar([92,66,69,76,39|T],T,C) :- !, char_int(C,7). % '\BEL' character
readChar([92,98,39|T],T,C) :- !, char_int(C,8). % '\b' character
readChar([92,66,83,39|T],T,C) :- !, char_int(C,8). % '\BS' character
readChar([92,116,39|T],T,C) :- !, char_int(C,9). % '\t' character
readChar([92,72,84,39|T],T,C) :- !, char_int(C,9). % '\HT' character
readChar([92,110,39|T],T,C) :- !, char_int(C,10). % '\n' character
readChar([92,76,70,39|T],T,C) :- !, char_int(C,10). % '\LF' character
readChar([92,118,39|T],T,C) :- !, char_int(C,11). % '\v' character
readChar([92,86,84,39|T],T,C) :- !, char_int(C,11). % '\VT' character
readChar([92,102,39|T],T,C) :- !, char_int(C,12). % '\f' character
readChar([92,70,70,39|T],T,C) :- !, char_int(C,12). % '\FF' character
readChar([92,114,39|T],T,C) :- !, char_int(C,13). % '\r' character
readChar([92,67,82,39|T],T,C) :- !, char_int(C,13). % '\CR' character
readChar([92,83,79,39|T],T,C) :- !, char_int(C,14). % '\SO' character
readChar([92,83,73,39|T],T,C) :- !, char_int(C,15). % '\SI' character
readChar([92,68,76,69,39|T],T,C) :- !, char_int(C,16). % '\DLE' character
readChar([92,68,67,49,39|T],T,C) :- !, char_int(C,17). % '\DC1' character
readChar([92,68,67,50,39|T],T,C) :- !, char_int(C,18). % '\DC2' character
readChar([92,68,67,51,39|T],T,C) :- !, char_int(C,19). % '\DC3' character
readChar([92,68,67,52,39|T],T,C) :- !, char_int(C,20). % '\DC4' character
readChar([92,78,65,75,39|T],T,C) :- !, char_int(C,21). % '\NAK' character
readChar([92,83,89,78,39|T],T,C) :- !, char_int(C,22). % '\SYN' character
readChar([92,69,84,66,39|T],T,C) :- !, char_int(C,23). % '\ETB' character
readChar([92,67,65,78,39|T],T,C) :- !, char_int(C,24). % '\CAN' character
readChar([92,69,77,39|T],T,C) :- !, char_int(C,25). % '\EM' character
readChar([92,83,85,66,39|T],T,C) :- !, char_int(C,26). % '\SUB' character
readChar([92,69,83,67,39|T],T,C) :- !, char_int(C,27). % '\ESC' character
readChar([92,70,83,39|T],T,C) :- !, char_int(C,28). % '\FS' character
readChar([92,71,83,39|T],T,C) :- !, char_int(C,29). % '\GS' character
readChar([92,82,83,39|T],T,C) :- !, char_int(C,30). % '\RS' character
readChar([92,85,83,39|T],T,C) :- !, char_int(C,31). % '\US' character
readChar([92,83,80,39|T],T,C) :- !, char_int(C,32). % '\SP' character
readChar([92,68,69,76,39|T],T,C) :- !, char_int(C,127). % '\DEL' character
readChar([N,39|T],T,C) :- char_int(C,N).
readDecimalChar(N,[39|T],T,C) :- !, char_int(C,N).
readDecimalChar(N,[M|S],T,C) :- M>=48, M<58, !,
NM is 10*N+M-48,
readDecimalChar(NM,S,T,C).
readString([34|T],T,[]) :- !.
readString([92|Ns],T,Str) :- !, readStringEscape(Ns,T,Str).
readString([N|Ns],T,[C|Str]) :-
char_int(C,N),
readString(Ns,T,Str).
readStringEscape([N|Ns],T,Str) :- N>=48, N<58, !,
V is N-48, readDecimalCharInString(V,Ns,T,Str).
readStringEscape([69,83,67|Ns],T,[C|Str]) :- !, % '\ESC' character
char_int(C,27),
readString(Ns,T,Str).
readStringEscape([68,69,76|Ns],T,[C|Str]) :- !, % '\DEL' character
char_int(C,127),
readString(Ns,T,Str).
readStringEscape([N|Ns],T,[C|Str]) :- !,
readStringChar(N,NS),
char_int(C,NS),
readString(Ns,T,Str).
% read a character with decimal number representation, e.g., '\243'
readDecimalCharInString(V,[N|Ns],T,Str) :- N>=48, N<58, !,
V1 is V*10+N-48,
readDecimalCharInString(V1,Ns,T,Str).
readDecimalCharInString(V,Ns,T,[C|Str]) :-
char_int(C,V),
readString(Ns,T,Str).
readStringChar(97,7) :- !.
readStringChar(98,8) :- !.
readStringChar(116,9) :- !.
readStringChar(110,10) :- !.
readStringChar(118,11) :- !.
readStringChar(102,12) :- !.
readStringChar(114,13) :- !.
readStringChar(34,34) :- !.
readStringChar(39,39) :- !.
readStringChar(92,92) :- !.
readStringChar(N,N) :-
writeErr('INTERNAL ERROR: unknown character string "'),
put_code(user_error,92), put_code(user_error,N),
writeErr('" in readStringChar'), nlErr.
readQVarOpId([C|Cs],T,[C|Str]) :-
isOpIdChar(C) -> readOpId(Cs,T,Str) ; readModOrVar(Cs,T,Str).
......
......@@ -99,46 +99,6 @@ prim_letrec(X,XE,'Prelude.True',E0,E) :- var(XE), !, X=XE, E0=E.
prim_letrec(X,XE,'Prelude.True',E0,E) :- create_mutable(XE,MX), X=share(MX), E0=E.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of comparsion of primitive data:
%
prim_eqBasic(Y,X,R) :- X==Y -> R='Prelude.True' ; R='Prelude.False'.
prim_leqNumber(Y,X,R) :- X=<Y -> R='Prelude.True' ; R='Prelude.False'.
prim_leqChar(Y,X,R) :-
char_int(X,VX), char_int(Y,VY),
VX=<VY -> R='Prelude.True' ; R='Prelude.False'.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of arithmetic functions:
%
prim_Int_plus(Y,X,R) :- R is X+Y.
prim_Int_minus(Y,X,R) :- R is X-Y.
prim_Int_times(Y,X,R) :- R is X*Y.
prim_Int_div(Y,X,R) :- R is div(X,Y).
prim_Int_mod(Y,X,R) :- isMod(R,X,Y).
prim_Int_quot(Y,X,R) :- R is X // Y.
prim_Int_rem(Y,X,R) :- isRem(R,X,Y).
prim_negateFloat(X,R) :- R is -X.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of conversion functions for characters:
%
prim_ord(C,N) :- char_int(C,N).
prim_chr(N,C) :- N>=0, N<1114112, !, char_int(C,N).
prim_chr(_,_) :- raise_exception('chr: argument out of range').
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of I/O actions:
%
......@@ -170,21 +130,6 @@ prim_return(V,partcall(1,prim_returnWorld,[V]),E,E).
prim_returnWorld(A,_,'$io'(A),E,E).
prim_putChar(C,'Prelude.()') :-
char_int(C,N), put_code(N),
%flush_output. % this is problematic for Sicstus4 (substantial delay)
(N=10 -> flush_output ; true).
prim_getChar(C) :- get_code(N), char_int(C,N).
prim_readFile(A,_) :-
map2M(basics:char_int,A,As),
isURL(As), !,
append("readFile """,As,E1),
append(E1,""": URLs no longer supported in readFile!",E2),
atom_codes(EMsg,E2),
raise_exception(EMsg).
prim_readFile(A,Result) :-
string2Atom(A,FName),
fileOpenOptions(Options),
......@@ -193,10 +138,6 @@ prim_readFile(A,Result) :-
-> makeShare('Prelude.prim_readFileContents'(Stream),Result)
; Result = 'Prelude.prim_readFileContents'(Stream)).
isURL(S) :- append("http://",_,S), !.
isURL(S) :- append("ftp://",_,S), !.
?- block prim_readFileContents(?,?,-,?).
prim_readFileContents(Stream,Result,E0,E) :-
atEndOfStream(Stream), !,
......
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