home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXT 3rd Party Products 1993
/
NEXT_3rd_party_products_93.iso
/
Xanthus
/
Graphity_Demo
/
API
/
Demo3
/
Graphity_APIListener.m
< prev
next >
Wrap
Text File
|
1993-05-07
|
11KB
|
467 lines
#import <appkit/appkit.h>
#import "Graphity_APIListener.h"
#import <mach/mach.h>
#import <mach/message.h>
#import <servers/netname.h>
extern port_t name_server_port;
extern id NXResponsibleDelegate();
@implementation Graphity_APIListener :Listener
{}
static NXRemoteMethod *remoteMethods = NULL;
#define REMOTEMETHODS 17
+ initialize
/* */
{
if (!remoteMethods) {
remoteMethods =
(NXRemoteMethod *) malloc((REMOTEMETHODS+1)*sizeof(NXRemoteMethod));
remoteMethods[0].key =
@selector(API_setValueAtRow:serie:to:for:in:display:error:);
remoteMethods[0].types = "iidcciI";
remoteMethods[1].key =
@selector(API_setLabelAt:to:for:in:display:error:);
remoteMethods[1].types = "iccciI";
remoteMethods[2].key =
@selector(API_setSerieTitleFor:to:for:in:display:error:);
remoteMethods[2].types = "iccciI";
remoteMethods[3].key =
@selector(API_redisplay:in:error:);
remoteMethods[3].types = "ccI";
remoteMethods[4].key =
@selector(API_recalculate:in:error:);
remoteMethods[4].types = "ccI";
remoteMethods[5].key =
@selector(API_newDocument:error:);
remoteMethods[5].types = "cI";
remoteMethods[6].key =
@selector(API_saveDocument:type:to:error:);
remoteMethods[6].types = "cicI";
remoteMethods[7].key =
@selector(API_shapeDocument:x:y:width:height:error:);
remoteMethods[7].types = "cddddI";
remoteMethods[8].key =
@selector(API_closeDocument:warn:error:);
remoteMethods[8].types = "ciI";
remoteMethods[9].key =
@selector(API_openDocument:type:error:);
remoteMethods[9].types = "ciI";
remoteMethods[10].key =
@selector(API_addGraph:with:in:error:);
remoteMethods[10].types = "iccI";
remoteMethods[11].key =
@selector(API_addSerie:for:in:error:);
remoteMethods[11].types = "cccI";
remoteMethods[12].key =
@selector(API_addRow:for:in:error:);
remoteMethods[12].types = "cccI";
remoteMethods[13].key =
@selector(API_shapeGraph:in:x:y:width:height:error:);
remoteMethods[13].types = "ccddddI";
remoteMethods[14].key =
@selector(API_setGraphTypeFor:in:to:error:);
remoteMethods[14].types = "cciI";
remoteMethods[15].key =
@selector(API_readDataFrom:graph:in:error:);
remoteMethods[15].types = "cccI";
remoteMethods[16].key =
@selector(API_getGraphSize:in:rowCount:serieCount:error:);
remoteMethods[16].types = "ccIII";
remoteMethods[REMOTEMETHODS].key = NULL;
}
return self;
}
-(int)API_setValueAtRow : (int) row
serie : (int) serie
to : (double) v
for : (char *) name
in : (char *) doc
display : (int) display
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_setValueAtRow:serie:to:for:in:display:error:)))
return [_NXd API_setValueAtRow : row
serie : serie
to : v
for : name
in : doc
display : display
error : error];
return -1;
}
-(int)API_setLabelAt : (int) row
to : (char *) label
for : (char *) name
in : (char *) doc
display : (int) display
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_setLabelAt:to:for:in:display:error:)))
return [_NXd API_setLabelAt : row
to : label
for : name
in : doc
display : display
error : error];
return -1;
}
-(int)API_setSerieTitleFor : (int) serie
to : (char *) label
for : (char *) name
in : (char *) doc
display : (int) display
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_setSerieTitleFor:to:for:in:display:error:)))
return [_NXd API_setSerieTitleFor : serie
to : label
for : name
in : doc
display : display
error : error];
return -1;
}
-(int)API_redisplay : (char *) name
in : (char *) doc
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_redisplay:in:error:)))
return [_NXd API_redisplay : name
in : doc
error : error];
return -1;
}
-(int)API_recalculate : (char *) name
in : (char *) doc
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_recalculate:in:error:)))
return [_NXd API_recalculate : name
in : doc
error : error];
return -1;
}
-(int)API_newDocument : (char *) name
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_newDocument:error:)))
return [_NXd API_newDocument : name
error : error];
return -1;
}
-(int)API_saveDocument : (char *) name
type : (int) type
to : (char *) path
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_saveDocument:type:to:error:)))
return [_NXd API_saveDocument : name
type : type
to : path
error : error];
return -1;
}
-(int)API_shapeDocument : (char *) name
x : (double) x
y : (double) y
width : (double) w
height : (double) h
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_shapeDocument:x:y:width:height:error:)))
return [_NXd API_shapeDocument : name
x : x
y : y
width : w
height : h
error : error];
return -1;
}
-(int)API_closeDocument : (char *) name
warn : (int) warn
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_closeDocument:warn:error:)))
return [_NXd API_closeDocument : name
warn : warn
error : error];
return -1;
}
-(int)API_openDocument : (char *) path
type : (int) type
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_openDocument:type:error:)))
return [_NXd API_openDocument : path
type : type
error : error];
return -1;
}
-(int)API_addGraph : (int) type
with : (char *) name
in : (char *) doc
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_addGraph:with:in:error:)))
return [_NXd API_addGraph : type
with : name
in : doc
error : error];
return -1;
}
-(int)API_addSerie : (char *) title
for : (char *) name
in : (char *) doc
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_addSerie:for:in:error:)))
return [_NXd API_addSerie : title
for : name
in : doc
error : error];
return -1;
}
-(int)API_addRow : (char *) label
for : (char *) name
in : (char *) doc
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_addRow:for:in:error:)))
return [_NXd API_addRow : label
for : name
in : doc
error : error];
return -1;
}
-(int)API_shapeGraph : (char *) name
in : (char *) doc
x : (double) x
y : (double) y
width : (double) w
height : (double) h
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_shapeGraph:in:x:y:width:height:error:)))
return [_NXd API_shapeGraph : name
in : doc
x : x
y : y
width : w
height : h
error : error];
return -1;
}
-(int)API_setGraphTypeFor : (char *) name
in : (char *) doc
to : (int) type
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_setGraphTypeFor:in:to:error:)))
return [_NXd API_setGraphTypeFor : name
in : doc
to : type
error : error];
return -1;
}
-(int)API_readDataFrom : (char *) file
graph : (char *) name
in : (char *) docname
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_readDataFrom:graph:in:error:)))
return [_NXd API_readDataFrom : file
graph : name
in : docname
error : error];
return -1;
}
-(int)API_getGraphSize : (char *) name
in : (char *) docname
rowCount : (int *) rowCount
serieCount : (int *) serieCount
error : (int *) error
/* */
{
id _NXd;
if (_NXd = NXResponsibleDelegate(self,
@selector(API_getGraphSize:in:rowCount:serieCount:error:)))
return [_NXd API_getGraphSize : name
in : docname
rowCount : rowCount
serieCount : serieCount
error : error];
return -1;
}
- (int) performRemoteMethod : (NXRemoteMethod *) method
paramList : (NXParamValue *) paramList {
/* */
switch (method - remoteMethods) {
case 0:
return [self API_setValueAtRow : paramList[0].ival
serie : paramList[1].ival
to : paramList[2].dval
for : paramList[3].bval.p
in : paramList[4].bval.p
display : paramList[5].ival
error : ¶mList[6].ival];
case 1:
return [self API_setLabelAt : paramList[0].ival
to : paramList[1].bval.p
for : paramList[2].bval.p
in : paramList[3].bval.p
display : paramList[4].ival
error : ¶mList[5].ival];
case 2:
return [self API_setSerieTitleFor : paramList[0].ival
to : paramList[1].bval.p
for : paramList[2].bval.p
in : paramList[3].bval.p
display : paramList[4].ival
error : ¶mList[5].ival];
case 3:
return [self API_redisplay : paramList[0].bval.p
in : paramList[1].bval.p
error : ¶mList[2].ival];
case 4:
return [self API_recalculate : paramList[0].bval.p
in : paramList[1].bval.p
error : ¶mList[2].ival];
case 5:
return [self API_newDocument : paramList[0].bval.p
error : ¶mList[1].ival];
case 6:
return [self API_saveDocument : paramList[0].bval.p
type : paramList[1].ival
to : paramList[2].bval.p
error : ¶mList[3].ival];
case 7:
return [self API_shapeDocument : paramList[0].bval.p
x : paramList[1].dval
y : paramList[2].dval
width : paramList[3].dval
height : paramList[4].dval
error : ¶mList[5].ival];
case 8:
return [self API_closeDocument : paramList[0].bval.p
warn : paramList[1].ival
error : ¶mList[2].ival];
case 9:
return [self API_openDocument : paramList[0].bval.p
type : paramList[1].ival
error : ¶mList[2].ival];
case 10:
return [self API_addGraph : paramList[0].ival
with : paramList[1].bval.p
in : paramList[2].bval.p
error : ¶mList[3].ival];
case 11:
return [self API_addSerie : paramList[0].bval.p
for : paramList[1].bval.p
in : paramList[2].bval.p
error : ¶mList[3].ival];
case 12:
return [self API_addRow : paramList[0].bval.p
for : paramList[1].bval.p
in : paramList[2].bval.p
error : ¶mList[3].ival];
case 13:
return [self API_shapeGraph : paramList[0].bval.p
in : paramList[1].bval.p
x : paramList[2].dval
y : paramList[3].dval
width : paramList[4].dval
height : paramList[5].dval
error : ¶mList[6].ival];
case 14:
return [self API_setGraphTypeFor : paramList[0].bval.p
in : paramList[1].bval.p
to : paramList[2].ival
error : ¶mList[3].ival];
case 15:
return [self API_readDataFrom : paramList[0].bval.p
graph : paramList[1].bval.p
in : paramList[2].bval.p
error : ¶mList[3].ival];
case 16:
return [self API_getGraphSize : paramList[0].bval.p
in : paramList[1].bval.p
rowCount : ¶mList[2].ival
serieCount : ¶mList[3].ival
error : ¶mList[4].ival];
default:
return [super performRemoteMethod : method paramList : paramList];
}
}
- (NXRemoteMethod *) remoteMethodFor: (SEL) aSel {
/* */
NXRemoteMethod *rm;
if (rm = NXRemoteMethodFromSel(aSel,remoteMethods))
return rm;
return [super remoteMethodFor : aSel];
}
@end