home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / texmf / source / SpecHost / special.h < prev    next >
C/C++ Source or Header  |  1994-10-04  |  4KB  |  175 lines

  1. /*
  2. **    SpecialHost for PasTeX
  3. **
  4. **    Copyright © by Olaf Barthel & Georg Heßmann
  5. */
  6.  
  7. /* special.h */
  8.  
  9. #include <dos/dos.h>
  10.  
  11. #define MAGIC_WORD        (('S'<<24) | ('P'<<16) | ('E'<<8) | 'C')
  12.  
  13. #define SPECIAL_PORT        "special_dvi"
  14. #define SPECIAL_REPLY        "special_reply"
  15.  
  16. /* 4 commands for \special-strings */
  17. #define AC_SEND_SPECIAL        1
  18. #define AC_REPLY_SPECIAL    2
  19. #define AC_OK_BITMAP        3
  20. #define AC_REPLY_BITMAP        4
  21.  
  22. /* 2 commands for tpic commands */
  23. #define AC_SEND_TPIC        5
  24. #define AC_REPLY_TPIC        6
  25.  
  26. /* SpecialHost don't know the current action */
  27. #define AC_REPLY_UNKNOWN    7
  28.  
  29.  
  30. #define LOC_NONE        0    /* no picture available             */
  31. #define LOC_BITMAP        1    /* bimap in RAM                 */
  32. #define LOC_FILE        2    /* bitmap in a file             */
  33. #define LOC_BORDER        3    /* no picture, draw only a border    */
  34. #define LOC_RECTANGLE        4    /* no picture, draw a full rectangle */
  35.                     /* LOC_BORDER || LOC_RECTANGLE          */
  36.                     /*        => loc.map == NULL   */
  37. #define LOC_BITMAP_BORDER    5    /* bitmap in RAM + draw border         */
  38. #define LOC_FILE_BORDER        6    /* bitmap in file + draw border         */
  39.  
  40.  
  41.  
  42. /* TPIC commands */
  43. /* only the '!' commands call SpecialHost */
  44.  
  45. #define TPIC_NO_TPIC    0
  46. #define TPIC_PN        1 
  47. #define TPIC_PA     2
  48. #define TPIC_FP     3        /* ! */
  49. #define TPIC_IP     4        /* ! */
  50. #define TPIC_DA     5        /* ! */
  51. #define TPIC_DT        6        /* ! */
  52. #define TPIC_SP     7        /* ! */
  53. #define TPIC_SPB    8        /* ! (same as _SP) */
  54. #define TPIC_AR     9        /* ! */
  55. #define TPIC_IA     10        /* ! */
  56. #define TPIC_SH        11
  57. #define TPIC_SHB    12
  58. #define TPIC_WH        13
  59. #define TPIC_BK        14
  60. #define TPIC_TX        15
  61.  
  62.  
  63. struct tpic_msg {
  64.         char    tpic_com;
  65.         char    whiten;
  66.         char    blacken;
  67.         char    pad;
  68.         long    shade;                /* mult 10000 */
  69.         long    opt_long[4];            /* options to the tpic command */
  70.         char    opt_float[2][12];        /* float werden als String uebergeben! */
  71.         long    pen_size;
  72.         long    path_len;
  73.         long   *xx;
  74.         long   *yy;
  75.     };
  76.  
  77.  
  78. struct driver_map {
  79.         /* cursor */
  80.         long    x;            /* actual cursor position   */
  81.         long    y;            /* in the bitmap.        */
  82.         /* bitmap */
  83.         long    width;            /* width of bitmap in bits  */
  84.         long    height;            /* height of bitmap in bits */
  85.         long    lower_limit;
  86.         long    upper_limit;
  87.         long   *pixptr;            /* pointer to bitmap        */
  88.         long    null_x;            /* (0,0) of the TeX page    */
  89.         long    null_y;
  90.         long    page_width;        /* width of the full page   */
  91.         long    page_height;        /* height of the full page  */
  92.         long    pass;            /* number of current pass   */
  93.         long    passes;            /* number of passes         */
  94.     };
  95.  
  96. /**  Bitmap:
  97.  
  98.          width
  99.         +---------------+
  100.     |        |
  101.      |        |
  102.     |        |
  103.     |        |
  104.     |        |
  105.      ----------------------    upper_limit      \
  106.     |        |                         |
  107.     |        |                          - height
  108.     |        |                         |
  109.      ----------------------    lower_limit      /
  110.     |        |
  111.     |        |
  112.     |        |
  113.     |        |
  114.         +---------------+
  115.  
  116.   Bitmap is only between upper_limit and lower_limit in memory!
  117.  
  118. *****/
  119.  
  120.  
  121.  
  122.  
  123.  
  124. union  location {
  125.         unsigned long    *map;        /* picture as bitmap, lines with word (2Byte) alignment */
  126.         char         *filename;    /* picture as file */
  127.     };
  128.  
  129.  
  130. struct special_map {
  131.         short         where_is;    /* LOC_#? */
  132.         long         hoffset;    /* all in pixel */
  133.         long         voffset;
  134.         long         width;        /* in pixel (bitmap word-alignment!) */
  135.         long         height;    /* in pixel (bitmap word-alignment!) */
  136.     union    location     loc;
  137.         long         reserved1;
  138.         long         reserved2;
  139.         long         reserved3;
  140.         long         reserved4;
  141.     };
  142.  
  143. struct special_msg {
  144.     struct    Message         msg;            /* 20 Bytes */
  145.         short         action;        /* 22 */
  146.         short         ret;            /* 24 */
  147.         char        *special_string;    /* 28 */
  148.         long         hresolution;        /* 32 */
  149.         long         vresolution;        /* 36 */
  150.     struct    tpic_msg    *tpic;            /* 40, if != NULL => tpic message */
  151.     struct    driver_map    *dmap;            /* 44 */
  152.     struct    special_map    *bmap;            /* 48 bytes */
  153.         BPTR         DVIdirLock;        /* 52, new since V1.26 */
  154.                             /* Lock to the directory, where the DVI-File resists */
  155.                             /* watch out for msg->msg.mn_Length to check, if */
  156.                             /* this field exists! (NULL != SYS:) */
  157.  
  158.         long         DVImagnification;    /* 56 bytes */
  159.                             /* new since SpecialHost V1.21, ShowDVI V1.39ß */
  160.                             /* (global DVI magnification, in thousandth of magnification */
  161.         char        *DVIfilename;        /* 60 bytes */
  162.                             /* new since SpecialHost V1.23, ShowDVI V1.39ß */
  163.                             /* (DVI file name) */
  164.     struct    DateStamp    *DVIfiledate;        /* 64 bytes */
  165.         long         DVIcurphypage;        /* 68 bytes physical page number */
  166. };
  167.  
  168.  
  169. /* functions */
  170.  
  171. struct special_map *send_special(char *sp_string);
  172. void             send_tpic(struct tpic_msg *tp);
  173. void            special_ok(void);
  174.  
  175.