[m-dev.] term browser diff
Erwan Jahier
Erwan.Jahier at irisa.fr
Thu May 20 23:02:39 AEST 1999
I have forgotten to include the corresponding Opium-M code in my previous post.
Here it is:
%------------------------------------------------------------------------------%
opium_scenario(
name : browse,
files : [browse],
scenarios : [],
message :
"Scenario that allow to call the Mercury term browser."
).
%------------------------------------------------------------------------------%
opium_command(
name : browse,
arg_list : [VarName],
arg_type_list : [string],
abbrev : _,
interface : button,
command_type : opium,
implementation : browse_Op,
parameters : [],
message :
"Call the Mercury term browser."
).
browse_Op(VarName) :-
quote_string(VarName, VarNameQuoted),
send_message_to_socket(browse(VarNameQuoted)),
browser_loop.
browser_loop :-
print("browser> "), flush(user),
( read_and_check(Term) ->
atom_string(Term, TermStr),
quote_string(TermStr, TermStrQuoted),
send_message_to_socket(external_request(TermStrQuoted)),
read_loop(Msg)
;
send_message_to_socket(external_request('"help"')),
read_loop(Msg)
),
(
Msg = browser_quit,
read_message_from_socket(browser_end),
!
;
Msg = browser_end_command,
!,
browser_loop
;
Msg = error(ErrorMsg),
print(ErrorMsg), nl,
!,
browser_loop
;
print("Msg = "), print(Msg),
print("\n************** Error in browse.op\n")
).
read_loop(MsgOut) :-
read_message_from_socket(Msg),
(
Msg = browser_str(Str),
print(Str),
!,
read_loop(MsgOut)
;
Msg = browser_int(N),
print(N),
!,
read_loop(MsgOut)
;
Msg = browser_nl,
nl,
!,
read_loop(MsgOut)
;
% Msg = browser_quit, browser_end_command, error().
MsgOut = Msg
).
read_and_check(Term) :-
read(Term),
atom(Term).
--
R1.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list