Page 2 of 2

Re:

Posted: 19 Oct 2011 16:26
by danepa
Paul Cerkez wrote:modify the code I posted like this:

Code: Select all

login(Nama) :-      % now that you modified the declaration, you don't need the bound() anymore.    Nama > "", % prevents a blank filename from being used and causing a windows' file system error.     !,  % add the cut right here.     file::save(string::concat(Nama,".txt"),memor_msg_txt).   login(_) :-        !,  % add the cut right here.    stdio::write(" login file save FAILED"), % or whathever you want returned if there is an error
this should take it back to procedure.
error c603: The flow pattern '(o,i)' does not exist for '>'

Posted: 20 Oct 2011 16:52
by Paul Cerkez
there is something else going in with your code.

please post your current code here so we can examine it in more detail. a pattern error on the > doesn't make sense. it is an operator, not a predicate.

P.

Re:

Posted: 20 Oct 2011 17:25
by danepa

Code: Select all

predicates     login : (string Nama) procedure(o)(i).   facts - memor_msg_txt     memor_msg_txt:(string).   login(Nama) :-      % now that you modified the declaration, you don't need the bound() anymore.    Nama > "", % prevents a blank filename from being used and causing a windows' file system error.     !,  % add the cut right here.     file::save(string::concat(Nama,".txt"),memor_msg_txt).   login(_) :-        !,  % add the cut right here.    stdio::write(" login file save FAILED"), % or whathever you want returned if there is an error  
error c603: The flow pattern '(o,i)' does not exist for '>'

Posted: 20 Oct 2011 17:42
by Paul Cerkez
unless you are expecting the login procedure to return a login "Nama," value remove the (o).

also, change the Nama > "" to Nama <> "" as it is more accurate. (Nama > "" should work but Nama <> "" isa better choice)

P.

Re:

Posted: 21 Oct 2011 1:29
by danepa
Paul Cerkez wrote:unless you are expecting the login procedure to return a login "Nama," value remove the (o).

also, change the Nama > "" to Nama <> "" as it is more accurate. (Nama > "" should work but Nama <> "" isa better choice)

P.

Code: Select all

predicates     login : (string Nama) procedure(o)(i).   facts - memor_msg_txt     memor_msg_txt:(string).   login(Nama) :-      % now that you modified the declaration, you don't need the bound() anymore.    Nama <> "", % prevents a blank filename from being used and causing a windows' file system error.     !,  % add the cut right here.     file::save(string::concat(Nama,".txt"),memor_msg_txt).   login(_) :-        !,  % add the cut right here.    stdio::write(" login file save FAILED"), % or whathever you want returned if there is an error  
error c603: The flow pattern '(o,i)' does not exist for '<>'

Posted: 21 Oct 2011 6:47
by Steve Lympany
Hi,
Repeating what Paul has said, use this code:

Code: Select all

predicates     login : (string Nama) procedure(i).  %NO (o). It is always called with a known Nama                     %REPEAT - you must remove the (o) clauses         login(Nama) :-                 ""=string::isWhiteSpace(Nama),!,                 vpiCommonDialogs::note("you must supply a non-blank name").           login(Nama) :-%for example...  Also check out string::isName                 string::hasDecimalDigits(Nama),!,                 vpiCommonDialogs::note("you must supply a name with no numbers").           login(Nama) :-                  file::save(string::concat(Nama,".txt"),memor_msg_txt).
And also look at class <b>filename::</b>
regards
Steve