Re: how to write an interactive crm program?

Bill Yerazunis <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>
   From: Thomas Michael Hagen <[email protected]>

   this is where my problem comes in: i'm trying to make the process
   interactive, so that i can tell the program whether it classified each
   article correctly. to do that, i have written the following function (please
   excuse gmail's lack of indentation):

   :interact: {
   {
       isolate (:user-feedback:)
       syscall () (:user-feedback:) /crm interact.crm/
       match (:incorrect:) [:user-feedback:] /w/    # 'w' for wrong
       output /The piece was NOT classified correctly; you input
   ':*:incorrect:'\n/
       # here is where the DSTTTR stuff will eventually go
       return
   }
   output /The piece was classified correctly\n/
   return
   }

   the syscall calls the following crm program:

   {
       isolate (:user-input:)
       output /:*:user-input:/
   }

   i have tried various variations over this, but i haven't been able to get
   anything back from the interact.crm program, since it doesn't stop and wait
   for my input to populate the variable (:user-input:). this leads to the
   interact function in the main program matching on an empty string - the
   (:user-feedback:) variable.

   the main program runs only when it gets an EOF, as it should, but the
   interact.crm program doesn't seem to require an EOF. i was hoping it would
   stop to wait for my input from the terminal (ended by an EOF) before it
   continued.

And that's your problem right there.  

Syscall replaces stdin on the called routine with the first parameter of the
SYSCALL statement.  Since that's a NULL here, you get nothing.

What would be much easier would be to do would be just to do an INPUT from 
stdin, like this.

   ... blah blah blah ...
   isolate (:user_feedback:)
   output [stdout] /Was this right?  Enter "w" for "wrong" : /0
   input <byline> [stdin] (:user-feedback:) 
   ... blah blah blah ...

and wh

   i haven't been able to find anything on interactivity or user input from the
   terminal in the documentation. crm seems very mail-oriented.

Well, mail is one common usage, so docs tend to be mail-centric.

      - Bill Yerazunis

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.