viewer/sbgtypes.h

Go to the documentation of this file.
00001 
00019 #ifndef           SBGTYPES_H
00020 #define           SBGTYPES_H
00021 
00022 //This file contains all the symbols and types that are not of concern
00023 //to the user, but are common to both the client and the sbdaemon side.
00024 
00025 #include          "sbgconst.h"
00026 #ifdef __UNIX__
00027 #include          <sys/types.h>
00028 #endif
00029 
00030 #define CHECK_TIME      1000     /*1 millisecond */
00031 #define AWAIT_TIME      999999   /*1 second */
00032 #define INFD        0            /*index to fds */
00033 #define OUTFD       1            /*for read/write */
00034 #define EVENTSIZE     16         //event buffer
00035 #define PRIMITIVES      (*(INT32*)((char*)shminfo.shmstart+shminfo.shmsize))
00036 #define EVENT_TAIL      (*(INT32*)((char*)shminfo.shmstart+shminfo.shmsize+sizeof(INT32)))
00037 #define EVENT_HEAD      (*(INT32*)((char*)shminfo.shmstart+shminfo.shmsize+2*sizeof(INT32)))
00038 #define EVENT_INDEX(index)  (((SBD_GRAPHICS_EVENT*)((char*)shminfo.shmstart+shminfo.shmsize+3*sizeof(INT32)))[index])
00039 
00046 typedef enum {
00047   LINECOLOUR,                    /*line_color_index */
00048   PERIMETERCOLOUR,               /*perimeter_color_index */
00049   FILLCOLOUR,                    /*fill_color_index */
00050   MARKERCOLOUR,                  /*marker_color_index */
00051   TEXTCOLOUR,                    /*text_color_index */
00052   TEXTFONT,                      /*text_font_index */
00053   CHARHEIGHT,                    /*character_height */
00054   LINETYPE,                      /*line_type */
00055   MARKERTYPE,                    /*marker_type */
00056   MARKERSIZE,                    /*marker_size */
00057   MARKERMODE,                    /*mode in markersize */
00058   INTERIORSTYLE,                 /*interior_style */
00059   EDGESTYLE,                     /*edge in interior_style */
00060 
00061   MOVE2D,                        /*move2d */
00062   DRAW2D,                        /*draw2d */
00063   RECTANGLE,                     /*rectangle */
00064   TEXT_ALIGNMENT,                //alginment
00065   POLYLINE2D,                    /*polyline2d */
00066   POLYGON2D,                     /*polygon2d */
00067   POLYMARKER2D,                  /*polymarker2d */
00068   TEXT2D,                        /*text2d */
00069   APPENDTEXT,                    /*append_text */
00070   ELLIPSE,                       /*ellipse */
00071   ARC,                           /*arc */
00072 
00073   SHOWIMAGE,                     /*display image */
00074   SHOWLINE,                      /*send image line */
00075 
00076   CREATE,                        /*create_window */
00077   DESTROY,                       /*destroy_window */
00078   CLEAR,                         /*clear_view_surface */
00079   VDCEXTENT,                     /*vdc_extent */
00080   MAKECURRENT,                   /*make_picture_current */
00081   SETSIGNALS,                    //add callback
00082   SETECHO,                       //change cursor
00083   SYNCWIN,                       //sychronize
00084   RE_COMP_COLMAP                 //Re-compute colourmap
00085 } CALL_TYPE;
00086 
00093 typedef union
00094 {
00095   INT16 fd;                      /*input fd */
00096   void *next;                    /*turns to link */
00097 } HEADUNION;
00098 
00103 typedef union
00104 {
00105   float f;                       /*parameter union */
00106   INT32 i;                       /*to reduce structures */
00107 } PARAMUNION;
00108 
00113 typedef struct
00114 {
00115   PARAMUNION p;                  /*single parameter */
00116 } ONEPARAM;
00117 
00122 typedef struct
00123 {
00124   PARAMUNION p[2];               /*two params */
00125 } TWOPARAMS;
00126 
00131 typedef struct
00132 {
00133   PARAMUNION p[4];               /*4 params */
00134 } FOURPARAMS;
00135 
00140 typedef struct
00141 {
00142   PARAMUNION p[8];               /*8 params */
00143 } EIGHTPARAMS;
00144 
00149 typedef struct
00150 {
00151   HEADUNION header;              /*fd/next op */
00152   CALL_TYPE type;                /*call type */
00153   ONEPARAM param;                /*single parameter */
00154 } ONEOP;
00155 
00160 typedef struct
00161 {
00162   HEADUNION header;              /*fd/next op */
00163   CALL_TYPE type;                /*call type */
00164   TWOPARAMS param;               /*single parameter */
00165 } TWOOP;
00166 
00171 typedef struct
00172 {
00173   HEADUNION header;              /*fd/next op */
00174   CALL_TYPE type;                /*call type */
00175   FOURPARAMS param;              /*single parameter */
00176 } FOUROP;
00177 
00182 typedef struct
00183 {
00184   HEADUNION header;              /*fd/next op */
00185   CALL_TYPE type;                /*call type */
00186   EIGHTPARAMS param;             /*single parameter */
00187 } EIGHTOP;
00188 
00195 typedef struct
00196 {
00197   float *clist;                  /*coord list */
00198   INT32 numpts;                  /*number of coords */
00199   INT32 flags;                   /*move/draws on/off */
00200 } POLYPARAM;
00201 
00208 typedef struct
00209 {
00210   HEADUNION header;              /*fd/next */
00211   CALL_TYPE type;                /*operator type */
00212   POLYPARAM param;               /*parameters */
00213   float polyxmin, polyxmax;      /*bounding box */
00214   float polyymin, polyymax;      /*of polyline */
00215   float clist[1];                /*place holder */
00216 } POLYOP;
00217 
00224 typedef struct
00225 {
00226   float x, y;                    /*coords of text */
00227   char *string;                  /*string to draw */
00228   INT32 xform;                   /*coord transform */
00229   INT32 more;                    /*any more text */
00230 } TEXTPARAM;
00231 
00238 typedef struct
00239 {
00240   char *string;                  /*string to draw */
00241   INT32 xform;                   /*coord transform */
00242   INT32 more;                    /*any more text */
00243 } APPENDPARAM;
00244 
00251 typedef struct
00252 {
00253   HEADUNION header;              /*fd/next */
00254   CALL_TYPE type;                /*operator type */
00255   TEXTPARAM param;               /*parameters */
00256   char chars[4];                 /*place holder */
00257 } TEXTOP;
00258 
00265 typedef struct
00266 {
00267   HEADUNION header;              /*fd/next */
00268   CALL_TYPE type;                /*operator type */
00269   APPENDPARAM param;             /*parameters */
00270   char chars[4];                 /*place holder */
00271 } APPENDOP;
00272 
00279 typedef struct
00280 {
00281   HEADUNION header;              /*fd/next */
00282   CALL_TYPE type;                /*operator type */
00283   INT32 size;                    /*size of structure */
00284   UINT8 line[2];                 /*image line */
00285 } IMAGEOP;
00286 
00291 typedef struct
00292 {
00293   HEADUNION header;              /*fd/next */
00294   CALL_TYPE type;                /*operator type */
00295   INT16 xpos, ypos;              /*initial position */
00296   INT16 xsize, ysize;            /*initial size */
00297   float xmin, xmax;              /*scrolling limits */
00298   float ymin, ymax;
00299   BOOL8 downon;                  /*events required */
00300   BOOL8 moveon;
00301   BOOL8 upon;
00302   BOOL8 keyon;
00303   INT32 window_type;             /*false for SMD */
00304   char name[MAXWINDOWNAME];      /*name of window */
00305 } CREATEOP;
00306 
00313 typedef struct
00314 {
00315   #ifdef __UNIX__
00316   int fds[2];                    /*I/O files */
00317   int shmid;                     /*shared memory id */
00318   #else
00319   #ifdef __PCDEMON__
00320   int fds[2];                    /*I/O files */
00321   #else
00322   HANDLE fds[2];                 /*I/O files */
00323   #endif
00324   HANDLE shmid;                  //handle to it
00325   #endif
00326   void *shmstart;                /*addr of shm seg */
00327   INT32 usedsize;                /*amount used */
00328   INT32 shmsize;                 /*size of shm seg */
00329   #ifdef __UNIX
00330   pid_t pid;                     /*child process id */
00331   #endif
00332 } SHMINFO;
00333 
00342 typedef struct sbdgraphicsevent
00343 {
00344   struct sbdgraphicsevent *next; /*next event */
00345   INT16 fd;                      //unix only
00346   INT8 type;                     /*event type */
00347   char key;                      /*keypress */
00348   float x, y;                    /*position of event */
00349 } SBD_GRAPHICS_EVENT;
00350 
00351 //typedef void                 (*SBFUNC)(WINFD*,...);      /*starbase function*/
00352 
00353 typedef void (*DELFUNC) (void *, INT32);
00354                                  /*deletion function */
00359 typedef INT16 SBDWINDOW;
00360 #endif

Generated on Wed Feb 28 19:49:12 2007 for Tesseract by  doxygen 1.5.1