home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / PMCLIPS.ZIP / MAIN.C < prev    next >
Text File  |  1990-05-12  |  5KB  |  102 lines

  1. /*   CLIPS Version 4.30   4/25/89 */
  2. #define INCL_BASE
  3. #define INCL_DOSFILEMGR
  4.  
  5. #include <os2.h>
  6.  
  7. /***************************************************************/
  8. /* MAIN: Start execution of CLIPS.  This function must be      */
  9. /*   redefined in order to embed CLIPS within another program. */
  10. /*   Example of redefined main:                                */
  11. /*     main()                                                  */
  12. /*       {                                                     */
  13. /*        init_clips();                                        */
  14. /*            .                                                */
  15. /*            .                                                */
  16. /*            .                                                */
  17. /*        process_data();                                      */
  18. /*        run(-1);                                             */
  19. /*        evaluate_data();                                     */
  20. /*            .                                                */
  21. /*            .                                                */
  22. /*            .                                                */
  23. /*        final_results();                                     */
  24. /*       }                                                     */
  25. /***************************************************************/
  26. main(argc,argv)
  27.   int argc ;
  28.   char *argv[] ;
  29.   {
  30.  
  31.    int err;
  32.    HPIPE stdout, stdin, hpClipsOut, hpClipsIn;
  33.    USHORT usAction; 
  34.    USHORT cbBytesWritten;        
  35.                    
  36.    /* Connect to the Output Pipe */
  37.    DosWaitNmPipe("\\pipe\\clipsOut", 999999L); /* Wait for Pipe Ready    */
  38.    err = DosOpen("\\pipe\\clipsOut",         /* filename to open       */
  39.      &hpClipsOut,                            /* address of file handle */
  40.      &usAction,                              /* action taken           */
  41.      512,                                    /* size of new file       */
  42.      FILE_NORMAL,                            /* file attribute         */
  43.      FILE_OPEN | FILE_CREATE,                /* create the file        */
  44.      OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE,/* open mode              */
  45.      0L);                                    /* reserved               */
  46.    if ( err) {
  47.        printf( "clipsOut Pipe open fail in CLIPS: %d\n", err);
  48.        }
  49.  
  50.    /* Connect to the Input Pipe */
  51.    DosWaitNmPipe("\\pipe\\clipsIn", 999999L);  /* Wait for Pipe Ready    */
  52.    err = DosOpen("\\pipe\\clipsIn",          /* filename to open       */
  53.      &hpClipsIn,                             /* address of file handle */
  54.      &usAction,                              /* action taken           */
  55.      512,                                    /* size of new file       */
  56.      FILE_NORMAL,                            /* file attribute         */
  57.      FILE_OPEN | FILE_CREATE,                /* create the file        */
  58.      OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, /* open mode              */
  59.      0L);                                    /* reserved               */
  60.    if ( err) {
  61.        printf( "clipsIn Pipe open fail in CLIPS: %d\n", err);
  62.        }
  63.                                                          
  64.    DosClose( 1);                               /* Close StdOut         */
  65.    stdout = 1;                                 /* StdOut ID            */
  66.    DosDupHandle( hpClipsOut, &stdout);         /* Reset StdOut to Pipe */
  67.  
  68.    DosClose( 0);                               /* Close StdIn         */
  69.    stdin = 0;                                  /* StdIn ID            */
  70.    DosDupHandle( hpClipsIn, &stdin);           /* Reset StdIN to Pipe */
  71.  
  72.  
  73.    init_clips();
  74.    /*  reroute_stdin(argc,argv); */
  75.    cl_print("wclips","\n>>> CLIPS (V4.30 5/5/89)\n");
  76.    cl_print("wclips",">>> PMCLIPS FRONT END (V0.1 4/17/90)\n\n");
  77.  
  78.    command_loop();
  79.   }
  80.   
  81. /*************************************************************/
  82. /* USRFUNCS:  The function which informs CLIPS of any user   */
  83. /*   defined functions.  In the default case, there are no   */
  84. /*   user defined functions.  To define functions, either    */
  85. /*   this function must be replaced by a function with the   */
  86. /*   same name within this file, or this function can be     */
  87. /*   deleted from this file and included in another file.    */
  88. /*   User defined functions may be included in this file or  */
  89. /*   other files.                                            */
  90. /*   Example of redefined usrfuncs:                          */
  91. /*     usrfuncs()                                            */
  92. /*       {                                                   */
  93. /*        define_function("fun1",'i',fun1,"fun1");           */
  94. /*        define_function("other",'f',other,"other");        */
  95. /*       }                                                   */
  96. /*************************************************************/
  97. usrfuncs()
  98.   {
  99.   }
  100.  
  101. 
  102.