|
From: Ina C. <in...@st...> - 2001-01-31 01:22:06
|
Here is the minimal diff again.
? temp
? server
? soap_test_methods.init
Index: soap_test_methods.m
===================================================================
RCS file: /cvsroot/quicksilver/webserver/server/soap_test_methods.m,v
retrieving revision 1.1
diff -u -r1.1 soap_test_methods.m
--- soap_test_methods.m 2001/01/25 06:54:42 1.1
+++ soap_test_methods.m 2001/01/31 01:19:15
@@ -23,7 +23,8 @@
:- interface.
:- import_module io, int, list, std_util.
-:- pred hello(state::di, state::uo) is det.
+% :- pred hello(state::di, state::uo) is det.
+:- pred hello(univ::out) is det.
:- pred get_sp(list(univ)::in, univ::out) is det.
@@ -51,7 +52,9 @@
% Hello
%---------------------------------------------------------------------%
-hello --> print("Hello, world\n").
+% hello --> print("Hello, world\n").
+hello(OutputAsUniv) :-
+ OutputAsUniv = univ("Hello, world").
%---------------------------------------------------------------------%
% GetStockPrice
Index: web_methods.m
===================================================================
RCS file: /cvsroot/quicksilver/webserver/server/web_methods.m,v
retrieving revision 1.1
diff -u -r1.1 web_methods.m
--- web_methods.m 2001/01/25 06:54:42 1.1
+++ web_methods.m 2001/01/31 01:19:15
@@ -238,7 +238,7 @@
call_Hello_pred(Handle, _Request, Response, HttpCode) -->
{ HelloProc = mercury_proc(predicate, unqualified(soap_library_file),
- "hello", 2, 0) },
+ "hello", 1, 0) },
dl__mercury_sym(Handle, HelloProc, MaybeHello),
(
{ MaybeHello = error(Msg) },
@@ -254,9 +254,13 @@
% Call the procedure whose address
% we just obtained.
- HelloPred,
+ % HelloPred,
+ % { Response = yes("<output>Hello World</output>") },
- { Response = yes("<output>Hello World</output>") },
+ { HelloPred(OutputAsUniv) },
+ { det_univ_to_type(OutputAsUniv, OutputAsString) },
+ { Response = yes(OutputAsString) },
+
{ HttpCode = 200 }
).
@@ -264,9 +268,12 @@
% We need to cast it to the right higher-order inst, which for the
% `hello' procedure is `pred(di, uo) is det', before we can actually
% call it. The function inst_cast_hello/1 defined below does that.
+
+:- type io_pred == pred(univ).
+:- inst io_pred == (pred(out) is det).
-:- type io_pred == pred(io__state, io__state).
-:- inst io_pred == (pred(di, uo) is det).
+% :- type io_pred == pred(io__state, io__state).
+% :- inst io_pred == (pred(di, uo) is det).
:- func inst_cast_hello(io_pred) = io_pred.
:- mode inst_cast_hello(in) = out(io_pred) is det.
@@ -285,12 +292,12 @@
{ list__length(Request^params, Arity) },
% XXX test for function
- % { GetSPProc = mercury_proc(function, unqualified(soap_library_file),
- % "get_stockprice", Arity, 0) },
+ { GetSPProc = mercury_proc(function, unqualified(soap_library_file),
+ "get_stockprice", Arity, 0) },
% XXX test for predicate
- { GetSPProc = mercury_proc(predicate, unqualified(soap_library_file),
- "get_sp", 2, 0) },
+ % { GetSPProc = mercury_proc(predicate, unqualified(soap_library_file),
+ % "get_sp", 2, 0) },
dl__mercury_sym(Handle, GetSPProc, MaybeGetStockPrice),
(
@@ -304,9 +311,9 @@
% Cast the higher-order term that we obtained
% to the correct higher-order inst.
% XXX test for predicate
- { SPProc = inst_cast_sp(SPProc0) },
+ % { SPProc = inst_cast_sp(SPProc0) },
% XXX test for function
- % { wrapper(SPFunc) = inst_cast_stockprice(SPProc0) },
+ { wrapper(SPFunc) = inst_cast_stockprice(SPProc0) },
% message is parsed bottom up, therefore parameter
% list is in reverse order
@@ -317,9 +324,9 @@
% Call the procedure whose address we just obtained
% XXX test for predicate
- { call(SPProc, UnivList, SPUniv) },
+ % { call(SPProc, UnivList, SPUniv) },
% XXX test for function
- % { SPUniv = SPFunc(UnivList) },
+ { SPUniv = SPFunc(UnivList) },
{ det_univ_to_type(SPUniv, SPInt) },
{ string__int_to_string(SPInt, SPString) },
|