home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Demos / DE_MesaAR1 / Examples / API / MAPIDemoCode / MesaAPI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-09  |  3.5 KB  |  102 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_long_t dataType;
  40.     void *theData;
  41.     } MAPIMessage;
  42.     
  43. enum {MAPISuccess, MAPISendError, MAPIReceiveError, MAPILabelNotFoundError,
  44.     MAPISheetClosedError, MAPINotImplError, MAPIGraphNotFoundError,
  45.     MAPIOutOfRangeError,MAPIReportNotFound};
  46.     
  47. enum {openSheetMesaDo, unlinkSheetMesaDo, recalcMesaDo, associateMesaDo,
  48.     getLabelRangeMesaDo, getRangeMesaDo, putRangeMesaDo,
  49.     getLabelsMesaDo, saveMesaDo, saveAsMesaDo, getRawInputMesaDo, setRawInputMesaDo,
  50.     hideMesaDo, orderFrontMesaDo, newSheetMesaDo, displayMesaDo,
  51.     getEPSForLabelMesaDo, getEPSForRangeMesaDo, getEPSForGraphMesaDo,
  52.     printReportMesaDo};
  53.  
  54. void freeMAPIValue(int,MAPIValue *);
  55.  
  56. @interface MesaAPI : Object
  57. {
  58.     port_t myPort;
  59.     port_t mesaPort;
  60.     MAPIMessage theMessage;
  61. }
  62.  
  63. - initToWorksheet:(const char *)ws;
  64. - initToNewWorksheet;
  65. - free;
  66. - (int)recalc;
  67. - (int)displaySheet;
  68. - (int)saveSheet;
  69. - (int)saveSheetAs:(const char *)name;
  70. - (int)hide;
  71. - (int)makeKeyAndOrderFront;
  72.  
  73. - (int)getValues:(MAPIValue **)mv num:(int *)n
  74.     upperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc;
  75. - (int)putValues:(MAPIValue *)mv num:(int)n
  76.     upperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc;
  77. - (int)getLabels:(char ***)lp ranges:(short **)r num:(int *)num;
  78. - (int)associateLabel:(const char *)l withItems:(char **)it andValues:(MAPIValue *)mv
  79.     offset:(int)off numItems:(int)ni orientation:(int)or;
  80. - (int)getValues:(MAPIValue **)mv  forLabel:(const char *)l num:(int *)n
  81.     upperRow:(int *)ur col:(int *)uc lowerRow:(int *)lr col:(int *)lc;
  82. - (int)getEPSForLabel:(char *)l in:(id *)vp;
  83. - (int)getEPSForUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc in:(id *)vp;
  84. - (int)getEPSForGraph:(char *)l in:(id *)vp;
  85. - (int)printReport:(char *)r;
  86.  
  87. // these methods are private.  Do not use them
  88. - (int)sendMessage:(int)m :(void *)data :(int)len;
  89. - (int)receiveMessage;
  90. @end
  91.  
  92. @interface MesaListen : Object
  93. {
  94.     port_t myPort;
  95.     char *portName;
  96. }
  97.  
  98. - initToPort:(char *)s;
  99. - free;
  100. - gotMessage:(MAPIValue *)mv num:(int)num forUpperRow:(int)ur upperCol:(int)uc lowerRow:(int)lr
  101.     lowerCol:(int)lc;
  102. @end