%%% KL1-B Test for Wait_Constant (Suspend) %%%
% Wait_Atom %%%%%%%%%%%%% abcdefg
% Wait_Nil %%%%%%%%%%%%%% abcdefg
% Wait_Integer %%%%%%%%%% abcdefg
% Wait_Float %%%%%%%%%%%% abcdefg
% Wait_Vector %%%%%%%%%%% abcdefg

:- module wait_cnst_s.
:- public go/0.

go:- put_console(ascii#"%%% KL1-B Test for Wait_Constant (Suspend) %%%"), put_console(key#lf) | atm.

atm:- put_console(ascii#"% Wait_Atom %%%%%%%%%%%%% ") | atm00.

atm00:- true | atm00(X), unify(X,atom).
atm00(atom):- put_console(c#"a") | atm01.
otherwise.
atm00(_):- put_console(c#"*") | atm01.

atm01:- true | atm01(X), unify(X,[]).
atm01(atom):- put_console(c#"*") | atm02.
otherwise.
atm01(_):- put_console(c#"b") | atm02.

atm02:- true | atm02(X), unify(X,1234).
atm02(atom):- put_console(c#"*") | atm03.
otherwise.
atm02(_):- put_console(c#"c") | atm03.

atm03:- true | atm03(X), unify(X,12.34).
atm03(atom):- put_console(c#"*") | atm04.
otherwise.
atm03(_):- put_console(c#"d") | atm04.

atm04:- true | atm04(X), unify(X,[list]).
atm04(atom):- put_console(c#"*") | atm05.
otherwise.
atm04(_):- put_console(c#"e") | atm05.

atm05:- true | atm05(X), unify(X,{0,1}).
atm05(atom):- put_console(c#"*") | atm06.
otherwise.
atm05(_):- put_console(c#"f") | atm06.

atm06:- true | atm06(X), unify(X,ascii#"String").
atm06(atom):- put_console(c#"*") | atm07.
otherwise.
atm06(_):- put_console(c#"g") | atm07.

atm07:- put_console(key#lf) | nil.

nil:- put_console(ascii#"% Wait_Nil %%%%%%%%%%%%%% ") | nil00.

nil00:- true | nil00(X), unify(X,atom).
nil00([]):- put_console(c#"*") | nil01.
otherwise.
nil00(_):- put_console(c#"a") | nil01.

nil01:- true | nil01(X), unify(X,[]).
nil01([]):- put_console(c#"b") | nil02.
otherwise.
nil01(_):- put_console(c#"*") | nil02.

nil02:- true | nil02(X), unify(X,1234).
nil02([]):- put_console(c#"*") | nil03.
otherwise.
nil02(_):- put_console(c#"c") | nil03.

nil03:- true | nil03(X), unify(X,12.34).
nil03([]):- put_console(c#"*") | nil04.
otherwise.
nil03(_):- put_console(c#"d") | nil04.

nil04:- true | nil04(X), unify(X,[list]).
nil04([]):- put_console(c#"*") | nil05.
otherwise.
nil04(_):- put_console(c#"e") | nil05.

nil05:- true | nil05(X), unify(X,{0,1}).
nil05([]):- put_console(c#"*") | nil06.
otherwise.
nil05(_):- put_console(c#"f") | nil06.

nil06:- true | nil06(X), unify(X,ascii#"String").
nil06([]):- put_console(c#"*") | nil07.
otherwise.
nil06(_):- put_console(c#"g") | nil07.

nil07:- put_console(key#lf) | int.

int:- put_console(ascii#"% Wait_Integer %%%%%%%%%% ") | int00.

int00:- true | int00(X), unify(X,atom).
int00(1234):- put_console(c#"*") | int01.
otherwise.
int00(_):- put_console(c#"a") | int01.

int01:- true | int01(X), unify(X,1234).
int01(1234):- put_console(c#"b") | int02.
otherwise.
int01(_):- put_console(c#"*") | int02.

int02:- true | int02(X), unify(X,123456).
int02(1234):- put_console(c#"*") | int03.
otherwise.
int02(_):- put_console(c#"c") | int03.

int03:- true | int03(X), unify(X,12.34).
int03(1234):- put_console(c#"*") | int04.
otherwise.
int03(_):- put_console(c#"d") | int04.

int04:- true | int04(X), unify(X,[list]).
int04(1234):- put_console(c#"*") | int05.
otherwise.
int04(_):- put_console(c#"e") | int05.

int05:- true | int05(X), unify(X,{0,1}).
int05(1234):- put_console(c#"*") | int06.
otherwise.
int05(_):- put_console(c#"f") | int06.

int06:- true | int06(X), unify(X,ascii#"String").
int06(1234):- put_console(c#"*") | int07.
otherwise.
int06(_):- put_console(c#"g") | int07.

int07:- put_console(key#lf) | flt.

flt:- put_console(ascii#"% Wait_Float %%%%%%%%%%%% ") | flt00.

flt00:- true | flt00(X), unify(X,atom).
flt00(12.34):- put_console(c#"*") | flt01.
otherwise.
flt00(_):- put_console(c#"a") | flt01.

flt01:- true | flt01(X), unify(X,1234).
flt01(12.34):- put_console(c#"*") | flt02.
otherwise.
flt01(_):- put_console(c#"b") | flt02.

flt02:- true | flt02(X), unify(X,12.34).
flt02(12.34):- put_console(c#"c") | flt03.
otherwise.
flt02(_):- put_console(c#"*") | flt03.

flt03:- true | flt03(X), unify(X,123.456).
flt03(12.34):- put_console(c#"*") | flt04.
otherwise.
flt03(_):- put_console(c#"d") | flt04.

flt04:- true | flt04(X), unify(X,[list]).
flt04(12.34):- put_console(c#"*") | flt05.
otherwise.
flt04(_):- put_console(c#"e") | flt05.

flt05:- true | flt05(X), unify(X,{0,1}).
flt05(12.34):- put_console(c#"*") | flt06.
otherwise.
flt05(_):- put_console(c#"f") | flt06.

flt06:- true | flt06(X), unify(X,ascii#"String").
flt06(12.34):- put_console(c#"*") | flt07.
otherwise.
flt06(_):- put_console(c#"g") | flt07.

flt07:- put_console(key#lf) | vec.

vec:- put_console(ascii#"% Wait_Vector %%%%%%%%%%% ") | vec00.

vec00:- true | vec00(X), unify(X,atom).
vec00({_,_}):- put_console(c#"*") | vec01.
otherwise.
vec00(_):- put_console(c#"a") | vec01.

vec01:- true | vec01(X), unify(X,1234).
vec01({_,_}):- put_console(c#"*") | vec02.
otherwise.
vec01(_):- put_console(c#"b") | vec02.

vec02:- true | vec02(X), unify(X,12.34).
vec02({_,_}):- put_console(c#"*") | vec03.
otherwise.
vec02(_):- put_console(c#"c") | vec03.

vec03:- true | vec03(X), unify(X,[list]).
vec03({_,_}):- put_console(c#"*") | vec04.
otherwise.
vec03(_):- put_console(c#"d") | vec04.

vec04:- true | vec04(X), unify(X,{0,1}).
vec04({_,_}):- put_console(c#"e") | vec05.
otherwise.
vec04(_):- put_console(c#"*") | vec05.

vec05:- true | vec05(X), unify(X,{0,1,2}).
vec05({_,_}):- put_console(c#"*") | vec06.
otherwise.
vec05(_):- put_console(c#"f") | vec06.

vec06:- true | vec06(X), unify(X,ascii#"String").
vec06({_,_}):- put_console(c#"*") | vec07.
otherwise.
vec06(_):- put_console(c#"g") | vec07.

vec07:- put_console(key#lf) | done.

done:- true | true.

unify(X,Y):- true | X=Y.
