home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
misc
/
cp-4.2.lha
/
cP
/
Source
/
rexxif.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-01
|
6KB
|
309 lines
#include "cp.h"
BOOL FEED = TRUE;
LONG HandleARexxMes()
{
struct RexxMsg *rmsg;
char cBuf[24];
char *nextchar;
char errstr[64];
char *error=NULL;
char *result=NULL;
long errlevel=0;
long loopflag=1;
LONG ch;
while (rmsg=GetARexxMsg(RexxStuff))
{
nextchar=stptok(ARG0(rmsg),cBuf,24," ,");
if (*nextchar) nextchar++;
if (!Stricmp("OPEN",cBuf))
{
FreeAllSets();
if (strlen(nextchar))
{
if (! AddSet(nextchar))
{
error="unable to add file";
errlevel = 10;
}
}
else AddNewSet();
}
else if (!Stricmp("ADD",cBuf))
{
if (strlen(nextchar))
{
if (! AddSet(nextchar))
{
error="unable to add file";
errlevel = 10;
}
}
else AddNewSet();
}
else if (!Stricmp("XMIN",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%le",&cv.xmin)!=1)
{
error="unable to convert value";
errlevel = 10;
}
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("XMAX",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%le",&cv.xmax)!=1)
{
error="unable to convert value";
errlevel = 10;
}
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("YMIN",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%le",&cv.ymin)!=1)
{
error="unable to convert value";
errlevel = 10;
}
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("YMAX",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%le",&cv.ymax)!=1)
{
error="unable to convert value";
errlevel = 10;
}
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("POINTS",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%ld",&points)!=1)
{
error="unable to convert value";
errlevel = 10;
}
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("THIN",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%ld",&thin)!=1)
{
error="unable to convert value";
errlevel = 10;
}
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("DELAY",cBuf))
{
if (strlen(nextchar))
{
if (sscanf(nextchar,"%ld",&ch)!=1)
{
error="unable to convert value";
errlevel = 10;
}
else
Delay(ch);
}
else
{
error="no value given";
errlevel = 10;
}
}
else if (!Stricmp("FULL",cBuf))
{
fullClicked();
}
else if (!Stricmp("REDRAW",cBuf))
{
DrawView( FALSE );
}
else if (!Stricmp("LINX",cBuf))
{
LOGX=FALSE;
}
else if (!Stricmp("LINY",cBuf))
{
LOGY=FALSE;
}
else if (!Stricmp("LOGX",cBuf))
{
LOGX=TRUE;
}
else if (!Stricmp("LOGY",cBuf))
{
LOGY=TRUE;
}
else if (!Stricmp("SYM",cBuf))
{
SymAllSets();
sym=TRUE;
}
else if (!Stricmp("NOSYM",cBuf))
{
sym=FALSE;
}
else if (!Stricmp("CPANEL",cBuf))
{
CPANEL=TRUE;
}
else if (!Stricmp("NOCPANEL",cBuf))
{
CPANEL=FALSE;
}
else if (!Stricmp("NOFILENAMEBOXES",cBuf))
{
NOFNAME=TRUE;
}
else if (!Stricmp("FILENAMEBOXES",cBuf))
{
NOFNAME=FALSE;
}
else if (!Stricmp("GRID",cBuf))
{
Grid();
grid=TRUE;
}
else if (!Stricmp("NOGRID",cBuf))
{
Grid();
grid=FALSE;
}
else if (!Stricmp("FEED",cBuf))
{
FEED=TRUE;
}
else if (!Stricmp("NOFEED",cBuf))
{
FEED=FALSE;
}
else if (!Stricmp("ERASE",cBuf))
{
Erase(TRUE);
}
else if (!Stricmp("SCREENTOFRONT",cBuf))
{
ScreenToFront(Scr);
}
else if (!Stricmp("SCREENTOBACK",cBuf))
{
ScreenToBack(Scr);
}
else if (!Strnicmp("XLAB",cBuf,4))
{
strcpy(XLAB,nextchar);
}
else if (!Strnicmp("YLAB",cBuf,4))
{
strcpy(YLAB,nextchar);
}
else if (!Stricmp("TITLE",cBuf))
{
strcpy(TITLE,nextchar);
}
else if (!Stricmp("PRINT",cBuf))
{
errlevel = Dump();
if (errlevel != PDERR_NOERR)
{
if (errlevel == PDERR_CANCEL) error = "user abort";
else if (errlevel == PDERR_NOTGRAPHICS) error = "not graphics";
else if (errlevel == PDERR_INVERTHAM) error = "invert ham";
else if (errlevel == PDERR_BADDIMENSION) error = "bad dimensions";
else if (errlevel == PDERR_DIMENSIONOVFLOW) error = "dimension overflow";
else if (errlevel == PDERR_INTERNALMEMORY) error = "internal memory";
else if (errlevel == PDERR_BUFFERMEMORY) error = "buffer memory";
errlevel = 20;
}
}
else if (!Stricmp("QUIT",cBuf))
{
loopflag=FALSE;
}
else
{
error="unknown command";
errlevel=20;
}
if (error)
{
strcpy(errstr,"REXX ERROR <<<");
strcat(errstr,cBuf);
strcat(errstr," ");
strcat(errstr,nextchar);
strcat(errstr,">>> ***");
strcat(errstr,error);
strcat(errstr,"***");
SetWindowTitles( PlotWindowWnd, NULL,errstr );
SetARexxLastError(RexxStuff,rmsg,error);
}
ReplyARexxMsg(RexxStuff,rmsg,result,errlevel);
}
return (loopflag);
}