home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vectronix 2
/
VECTRONIX2.iso
/
FILES_01
/
X_PROLOG.LZH
/
X_PROLOG
/
SYSTEM
< prev
next >
Wrap
Text File
|
1990-08-13
|
1KB
|
56 lines
% more stuff for a suitable user interface
% please note, that this module relies heavily on the system facility
% system must be consulted AFTER listing
:- op(1, fx, edit).
:- op(1, fx, time).
shell <-
' call your favourite shell from prolog '.
shell :- my_favourite_shell_is(Shell), system(Shell).
my_favourite_shell_is(msh).
(edit name/arity) <-
' edit the named procedure '.
(edit Name/Arity) :-
tell(atempfile),
( functor(Head, Name, Arity),
clause(Head, _),
!, % there is a clause
listing(Head) % write it to the file
;
writeq('"There is now clause '),
writeq(Name/Arity),
writeq(' in the database"')
),
told,
(edit atempfile),
rename(atempfile, []). % delete it
(edit file) <-
' edit the named module '.
(edit File) :-
name(File, Filename),
my_favourite_editor_is(Editor),
append(Editor, Filename, Commandline),
name(Command, Commandline),
system(Command),
reconsult(File).
my_favourite_editor_is("emacs "). % watch out for the blank
(time goal) <-
' compute the time the goal needs for it''s proof '.
(time Goal) :-
OldTime is cputime,
call(Goal),
!,
Difference is cputime - OldTime,
write('Time : '),
write(Difference),
write(' msec.'),
nl.
:- hide([shell, (edit _), (edit _/_), my_favourite_editor_is(_),
my_favourite_shell_is(_), (time _)]).