:- module(flocksIO,[]).  %% converted djd
:- style_check(-singleton). % added djd
%% :- module('flocksIO', []).

:- op(500, yfx, and).
:- op(400, yfx, or).

'flocksIO.getFlock.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'flocksIO':'flocksIO.getFlock.p2.0'(A,B)).
'~flocksIO.getFlock.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'flocksIO':'~flocksIO.getFlock.p2.0'(A,B)).
'flocksIO.getFlock.p2.0'(A, B) :-
        'flocksIO.readFlock.p2'(A, B).
'~flocksIO.getFlock.p2.0'(A, B) :-
        '~flocksIO.readFlock.p2'(A, B).
'flocksIO.putFlock.p2'(A, B) :-
        user:goedel_freeze(ground([A,B]), 'flocksIO':'flocksIO.putFlock.p2.0'(A,B)).
'~flocksIO.putFlock.p2'(A, B) :-
        user:goedel_freeze(ground([A,B]), 'flocksIO':'~flocksIO.putFlock.p2.0'(A,B)).
'flocksIO.putFlock.p2.0'(A, B) :-
        'flocksIO.writeFlock.p2'(A, B).
'~flocksIO.putFlock.p2.0'(A, B) :-
        '~flocksIO.writeFlock.p2'(A, B).
/*
Subject:	Supporting routines for FlocksIO module
Author:		Jiwei Wang
Date:		2 Dec. 1992

-----------------------------------------------------------------------------*/


%% '$$module'('@(#)FlocksIO.sup 1.3 last updated 93/09/02 16:47:07 by jiwei').
module(flocksIO_sup).   %% converted djd

%------------------------------------------------------------------------------

'flocksIO.writeFlock.p2'(Stream, Flock) :-
   'iO':translate_stream(Stream, PrologStream),
   writeq(PrologStream, Flock),
   write(PrologStream, '.'),
   nl(PrologStream).

'~flocksIO.writeFlock.p2'(Stream, Flock) :-
   'flocksIO.writeFlock.p2'(Stream, Flock).


'flocksIO.readFlock.p2'(Stream, Flock) :-
   'iO':translate_stream(Stream, PrologStream),
   read(PrologStream, Flock).

'~flocksIO.readFlock.p2'(Stream, Flock) :-
   'flocksIO.readFlock.p2'(Stream, Flock).

%------------------------------------------------------------------------------

'flocksIO.flockCompile.p2'(GString, 'flocks.flock.f1'(FlockList)) :-
   nonvar(GString), !,
   user:gstring2string(GString, String),
   ( open(String, read, Stream)
     -> user:read_file(Stream, Chars),
        'units':token_identifiers(Chars, Tokens, []),
        user:flock_compile_cmd_aux(Tokens, FlockList), !,
        close(Stream)
     ;  format(user_error, '~nError: cannot open file "~a".~n', [String])
   ).

'flocksIO.flockCompile.p2'(GString, Flock) :-
   user:goedel_freeze(ground([GString]),
        'flocksIO':'flocksIO.flockCompile.p2'(GString, Flock) ).


'~flocksIO.flockCompile.p2'(GString, Flock) :-
   'flocksIO.flockCompile.p2'(GString, Flock).

%------------------------------------------------------------------------------

'flocksIO.flockDecompile.p2'(Flock, GString) :-
   nonvar(Flock), !,
   nonvar(GString), !,
   user:gstring2string(GString, String),
   Flock = 'flocks.flock.f1'(List),
   ( open(String, write, Stream)
     -> user:flock_decompile_cmd_aux(List, Stream), !,
        close(Stream)
     ;  format(user_error, '~nError: cannot open file "~a".~n', [String])
   ).


'flocksIO.flockDecompile.p2'(Flock, GString) :-
   user:goedel_freeze(ground([GString, Flock]),
        'flocksIO':'flocksIO.flockDecompile.p2'(Flock, GString) ).


'~flocksIO.flockDecompile.p2'(Flock, GString) :-
   'flocksIO.flockDecompile.p2'(Flock, GString).

