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

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

'programsIO.programCompile.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'programsIO':'programsIO.programCompile.p2.0'(A,B)).
'~programsIO.programCompile.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'programsIO':'~programsIO.programCompile.p2.0'(A,B)).
'programsIO.programCompile.p2.0'(A, B) :-
        'programsIO.programCompileAux.p2'(A, B).
'~programsIO.programCompile.p2.0'(A, B) :-
        '~programsIO.programCompileAux.p2'(A, B).
'programsIO.getProgram.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'programsIO':'programsIO.getProgram.p2.0'(A,B)).
'~programsIO.getProgram.p2'(A, B) :-
        user:goedel_freeze(ground([A]), 'programsIO':'~programsIO.getProgram.p2.0'(A,B)).
'programsIO.getProgram.p2.0'(A, B) :-
        'programsIO.getProgramAux.p2'(A, B).
'~programsIO.getProgram.p2.0'(A, B) :-
        '~programsIO.getProgramAux.p2'(A, B).
'programsIO.putProgram.p2'(A, B) :-
        user:goedel_freeze(ground([A,B]), 'programsIO':'programsIO.putProgram.p2.0'(A,B)).
'~programsIO.putProgram.p2'(A, B) :-
        user:goedel_freeze(ground([A,B]), 'programsIO':'~programsIO.putProgram.p2.0'(A,B)).
'programsIO.putProgram.p2.0'(A, B) :-
        'programsIO.putProgramAux.p2'(A, B).
'~programsIO.putProgram.p2.0'(A, B) :-
        '~programsIO.putProgramAux.p2'(A, B).
'programsIO.programDecompile.p1'(A) :-
        user:goedel_freeze(ground([A]), 'programsIO':'programsIO.programDecompile.p1.0'(A)).
'~programsIO.programDecompile.p1'(A) :-
        user:goedel_freeze(ground([A]), 'programsIO':'~programsIO.programDecompile.p1.0'(A)).
'programsIO.programDecompile.p1.0'(A) :-
        'programsIO.programDecompileAux.p1'(A).
'~programsIO.programDecompile.p1.0'(A) :-
        '~programsIO.programDecompileAux.p1'(A).
/* 
File:		ProgramsIO.sup
Subject:	Implemention of the system module ProgramsIO
Author: 	Jiwei Wang
Date:		15 June 1992

================================================================================
*/

%% '$$module'('@(#)ProgramsIO.sup 1.26 last updated 93/11/10 17:37:10 by bowers').
%% :- module(programsIO_sup).   %% converted djd

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

% 'programsIO.getProgramAux.p2'(Stream, 'progDefs.cachedProgram.f1'(Main)) :-
%    'iO':translate_stream(Stream, PrologStream),
%    user:readin_program(PrologStream, Program),
%    Program = 'progDefs.program.f4'(Main, _, _, _),
%    retractall(user:cached_program(Main, _)),%
    assert(user:cached_program(Main, Program)).

'programsIO.getProgramAux.p2'(Stream, Program) :-
    'iO':translate_stream(Stream, PrologStream),
    user:readin_program(PrologStream, Program).

'~programsIO.getProgramAux.p2'(Stream, Program) :-
   'programsIO.getProgramAux.p2'(Stream, Program).

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

'programsIO.putProgramAux.p2'(Stream, Program) :-
   'iO':translate_stream(Stream, PrologStream),
   user:file_version(V),
   format(PrologStream, 'version(''~a'', prm).~n', [V]),
   user:create_prm_file_aux(Program, PrologStream), !.

'~programsIO.putProgramAux.p2'(Stream, Program) :-
   'programsIO.putProgramAux.p2'(Stream, Program).

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

'programsIO.programCompileAux.p2'(GModuleName, Program) :-
   user:gstring2string(GModuleName, ModuleName),
   ( user:system_module_name(GModuleName)
     -> user:load_system_module(ModuleName, Program)
     ;  retractall(user:there_is_error),
        assert(user:no_message),
        user:parse_program(ModuleName, make, Program), 
        retractall(user:no_message), !,
	\+ user:there_is_error
   ).

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

'programsIO.programDecompileAux.p1'(Program) :-
   user:'parserPrograms.decompile.p2'(Program, 'parserPrograms.quiet.c0').

