home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Demos / DE_MesaAR1 / Examples / API / MesaAPI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-25  |  3.1 KB  |  95 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *                                                                        *
  4.  *          This code is copyright (c) 1992                               *
  5.  *                     Athena Design, Inc.                                *
  6.  *                     and David Pollak                                   *
  7.  *                                                                        *
  8.  *                ALL RIGHTS RESERVED                                     *
  9.  *                                                                        *
  10.  *                                                                        *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  *                                                                        *
  14.  **************************************************************************/
  15.  
  16. #import <objc/Object.h>
  17. #import <mach.h>
  18. #import <sys/message.h>
  19.  
  20. enum {stringMAPIValue, numberMAPIValue, errorMAPIValue};
  21. enum {horizontalOrientation, verticalOrientation};
  22.  
  23. typedef struct _MAPIValue {
  24.     int type;
  25.     short row,col;
  26.     union {
  27.         char *string;
  28.         double number;
  29.         int error;
  30.         } values;
  31.     } MAPIValue;
  32.  
  33. typedef struct _MAPIMessage {
  34.     msg_header_t head;
  35.     msg_type_t handleType;
  36.     int handle;
  37.     msg_type_t lenType;
  38.     int theLen;
  39.     msg_type_t dataType;
  40.     void *theData;
  41.     } MAPIMessage;
  42.     
  43. enum {MAPISuccess, MAPISendError, MAPIReceiveError, MAPILabelNotFoundError,
  44.     MAPISheetClosedError, MAPINotImplError};
  45.     
  46. enum {openSheetMesaDo, unlinkSheetMesaDo, recalcMesaDo, associateMesaDo,
  47.     getLabelRangeMesaDo, getRangeMesaDo, putRangeMesaDo,
  48.     getLabelsMesaDo, saveMesaDo, saveAsMesaDo, getRawInputMesaDo, setRawInputMesaDo,
  49.     hideMesaDo, orderFrontMesaDo, newSheetMesaDo, displayMesaDo};
  50.  
  51. void freeMAPIValue(int,MAPIValue *);
  52.  
  53. @interface MesaAPI : Object
  54. {
  55.     port_t myPort;
  56.     port_t mesaPort;
  57.     MAPIMessage theMessage;
  58. }
  59.  
  60. - initToWorksheet:(const char *)ws;
  61. - initToNewWorksheet;
  62. - free;
  63. - (int)recalc;
  64. - (int)displaySheet;
  65. - (int)saveSheet;
  66. - (int)saveSheetAs:(const char *)name;
  67. - (int)hide;
  68. - (int)makeKeyAndOrderFront;
  69.  
  70. - (int)getValues:(MAPIValue **)mv num:(int *)n
  71.     upperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc;
  72. - (int)putValues:(MAPIValue *)mv num:(int)n
  73.     upperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc;
  74. - (int)getLabels:(char ***)lp ranges:(short **)r num:(int *)num;
  75. - (int)associateLabel:(const char *)l withItems:(char **)it andValues:(MAPIValue *)mv
  76.     offset:(int)off numItems:(int)ni orientation:(int)or;
  77. - (int)getValues:(MAPIValue **)mv  forLabel:(const char *)l num:(int *)n
  78.     upperRow:(int *)ur col:(int *)uc lowerRow:(int *)lr col:(int *)lc;
  79.  
  80. // these methods are private.  Do not use them
  81. - (int)sendMessage:(int)m :(void *)data :(int)len;
  82. - (int)receiveMessage;
  83. @end
  84.  
  85. @interface MesaListen : Object
  86. {
  87.     port_t myPort;
  88.     char *portName;
  89. }
  90.  
  91. - initToPort:(char *)s;
  92. - free;
  93. - gotMessage:(MAPIValue *)mv num:(int)num forUpperRow:(int)ur upperCol:(int)uc lowerRow:(int)lr
  94.     lowerCol:(int)lc;
  95. @end