home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
clips
/
main.c
< prev
next >
Wrap
Text File
|
1990-05-12
|
5KB
|
102 lines
/* CLIPS Version 4.30 4/25/89 */
#define INCL_BASE
#define INCL_DOSFILEMGR
#include <os2.h>
/***************************************************************/
/* MAIN: Start execution of CLIPS. This function must be */
/* redefined in order to embed CLIPS within another program. */
/* Example of redefined main: */
/* main() */
/* { */
/* init_clips(); */
/* . */
/* . */
/* . */
/* process_data(); */
/* run(-1); */
/* evaluate_data(); */
/* . */
/* . */
/* . */
/* final_results(); */
/* } */
/***************************************************************/
main(argc,argv)
int argc ;
char *argv[] ;
{
int err;
HPIPE stdout, stdin, hpClipsOut, hpClipsIn;
USHORT usAction;
USHORT cbBytesWritten;
/* Connect to the Output Pipe */
DosWaitNmPipe("\\pipe\\clipsOut", 999999L); /* Wait for Pipe Ready */
err = DosOpen("\\pipe\\clipsOut", /* filename to open */
&hpClipsOut, /* address of file handle */
&usAction, /* action taken */
512, /* size of new file */
FILE_NORMAL, /* file attribute */
FILE_OPEN | FILE_CREATE, /* create the file */
OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE,/* open mode */
0L); /* reserved */
if ( err) {
printf( "clipsOut Pipe open fail in CLIPS: %d\n", err);
}
/* Connect to the Input Pipe */
DosWaitNmPipe("\\pipe\\clipsIn", 999999L); /* Wait for Pipe Ready */
err = DosOpen("\\pipe\\clipsIn", /* filename to open */
&hpClipsIn, /* address of file handle */
&usAction, /* action taken */
512, /* size of new file */
FILE_NORMAL, /* file attribute */
FILE_OPEN | FILE_CREATE, /* create the file */
OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, /* open mode */
0L); /* reserved */
if ( err) {
printf( "clipsIn Pipe open fail in CLIPS: %d\n", err);
}
DosClose( 1); /* Close StdOut */
stdout = 1; /* StdOut ID */
DosDupHandle( hpClipsOut, &stdout); /* Reset StdOut to Pipe */
DosClose( 0); /* Close StdIn */
stdin = 0; /* StdIn ID */
DosDupHandle( hpClipsIn, &stdin); /* Reset StdIN to Pipe */
init_clips();
/* reroute_stdin(argc,argv); */
cl_print("wclips","\n>>> CLIPS (V4.30 5/5/89)\n");
cl_print("wclips",">>> PMCLIPS FRONT END (V0.1 4/17/90)\n\n");
command_loop();
}
/*************************************************************/
/* USRFUNCS: The function which informs CLIPS of any user */
/* defined functions. In the default case, there are no */
/* user defined functions. To define functions, either */
/* this function must be replaced by a function with the */
/* same name within this file, or this function can be */
/* deleted from this file and included in another file. */
/* User defined functions may be included in this file or */
/* other files. */
/* Example of redefined usrfuncs: */
/* usrfuncs() */
/* { */
/* define_function("fun1",'i',fun1,"fun1"); */
/* define_function("other",'f',other,"other"); */
/* } */
/*************************************************************/
usrfuncs()
{
}