home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / vfossil.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-05  |  7.0 KB  |  248 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*           This module was originally written by Bob Hartman              */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*                       BinkleyTerm VFOSSIL module                         */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  27. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  28. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  29. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  30. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /*    The Authors can be reached at the following addresses:                */
  34. /*                                                                          */
  35. /*    Robert C. Hartman                      Vincent E. Perriello           */
  36. /*    Spark Software                         VEP Software                   */
  37. /*    427-3 Amherst Street                   111 Carroll Street             */
  38. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  39. /*    Nashua, NH 03061                                                      */
  40. /*                                                                          */
  41. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  42. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  43. /*                                                                          */
  44. /*    Please feel free to contact us at any time to share your comments     */
  45. /*    about our software and/or licensing policies.                         */
  46. /*                                                                          */
  47. /*--------------------------------------------------------------------------*/
  48.  
  49. #include <stdio.h>
  50. #include "vfossil.h"
  51.  
  52. /*PLF Fri  05-05-1989  05:35:11 OS/2 version notes:
  53.  *
  54.  * I have basically made this two completely different versions. A lot
  55.  * of the original real mode version deals with the case when vfossil
  56.  * does not exist. Under OS/2, it is always active.
  57.  *
  58.  */
  59.  
  60. #ifdef OS_2 /*PLF Fri  05-05-1989  05:38:20 */
  61.  
  62. extern int vfossil_installed;
  63.  
  64. void vfossil_init(void )
  65. {
  66.     vfossil_installed = 1;
  67.     VioSetAnsi(ANSI_ON, 0L);
  68. }
  69.  
  70. void vfossil_cursor(int st)
  71. {
  72.     VIOCURSORINFO cur;
  73.  
  74.     VioGetCurType(&cur, 0);
  75.     cur.attr = st ? 0 : -1;
  76.     VioSetCurType(&cur, 0);
  77. }
  78.  
  79. void vfossil_close(void )
  80. {
  81.    vfossil_cursor(1);
  82.    vfossil_installed = 0;
  83. }
  84.  
  85. void fossil_gotoxy(int col, int row)
  86. {
  87.     VioSetCurPos(row, col, 0);
  88. }
  89.  
  90. int fossil_wherex(void)
  91. {
  92.     USHORT row, col;
  93.     VioGetCurPos(&row, &col, 0L);
  94.     return(col);
  95. }
  96.  
  97. int fossil_wherey(void)
  98. {
  99.     USHORT row, col;
  100.     VioGetCurPos(&row, &col, 0L);
  101.     return(row);
  102. }
  103.  
  104. #else       /*PLF Fri  05-05-1989  05:38:45 */
  105.  
  106. #include <dos.h>
  107. #include "com.h"
  108. #include "xfer.h"
  109. #include "zmodem.h"
  110. #include "keybd.h"
  111. #include "sbuf.h"
  112. #include "sched.h"
  113. #include "externs.h"
  114. #include "prototyp.h"
  115.  
  116. static void vfossil_open (void);
  117.  
  118. static VFOSSIL v;
  119.  
  120. void vfossil_init ()
  121. {
  122.    char far *q;
  123.    union REGS r;
  124.    struct SREGS s;
  125.  
  126.    v.vfossil_size = sizeof (VFOSSIL);
  127.    q = (char far *) &v;
  128.  
  129.    r.h.ah = 0x81;
  130.    r.h.al = 0;
  131.  
  132.    segread (&s);
  133.    s.es = FP_SEG (q);
  134.    r.x.di = FP_OFF (q);
  135.    int86x (0x14, &r, &r, &s);
  136.  
  137.    if (r.x.ax == 0x1954)
  138.       {
  139.       /* There is a VFOSSIL out there, so set it up for use */
  140.       vfossil_open ();
  141.       }
  142. }
  143.  
  144. static CURSOR _cursor;
  145.  
  146. void vfossil_cursor (st)
  147. int st;
  148. {
  149.    CURSOR far *q;
  150.  
  151.    if (vfossil_funcs[9])
  152.       {
  153.       q = (CURSOR far *) &_cursor;
  154.       /* We can make the cursor go away */
  155.       VioGetCurType (q, 0);
  156.       _cursor.attr = st ? 0 : -1;  /*PLF Fri  05-05-1989  05:14:33 */
  157.       VioSetCurType (q, 0);
  158.       }
  159. }
  160.  
  161. static void vfossil_open ()
  162. {
  163.    char far *q;
  164.    union REGS r;
  165.    struct SREGS s;
  166.  
  167.    segread (&s);
  168.    r.h.ah = 0x81;
  169.    r.h.al = 1;
  170.    r.x.cx = 80;
  171.    q = (char far *) vfossil_funcs;
  172.    r.x.di = FP_OFF (q);
  173.    s.es = FP_SEG (q);
  174.    int86x (0x14, &r, &r, &s);
  175.    if ((r.x.ax == 0x1954) && (r.x.bx >= 14))
  176.       {
  177.       /* It is really out there */
  178.       vfossil_installed = 1;
  179.       }
  180.    else
  181.       {
  182.       vfossil_funcs[14] = write_screen;
  183.       vfossil_funcs[15] = write_chars;
  184.       }
  185. }
  186.  
  187. void vfossil_close ()
  188. {
  189.    union REGS r;
  190.  
  191.    vfossil_cursor (1);
  192.  
  193.    r.h.ah = 0x81;
  194.    r.h.al = 2;
  195.  
  196.    int86 (0x14, &r, &r);
  197.  
  198.    vfossil_installed = 0;
  199. }
  200.  
  201. int far pascal write_screen (s, l, r, c, h)
  202. CELL far *s;
  203. int l;
  204. int r;
  205. int c;
  206. int h;
  207. {
  208.    int i;
  209.  
  210.    /* The following line is just to make -W3 happy */
  211.    i = h;
  212.  
  213.    gotoxy (c, r);
  214.  
  215.    l = l / 2;
  216.    for (i = 0; i < l; i++)
  217.       {
  218.       WRITE_BIOS (s->b.ch);
  219.       ++s;
  220.       }
  221.  
  222.    return (0);
  223. }
  224.  
  225. int far pascal write_chars (s, l, r, c, h)
  226. char far *s;
  227. int l;
  228. int r;
  229. int c;
  230. int h;
  231. {
  232.    int i;
  233.  
  234.    /* The following line is just to make -W3 happy */
  235.    i = h;
  236.  
  237.    gotoxy (c, r);
  238.  
  239.    for (i = 0; i < l; i++)
  240.       {
  241.       WRITE_BIOS (*s);
  242.       ++s;
  243.       }
  244.  
  245.    return (0);
  246. }
  247. #endif /*PLF Fri  05-05-1989  05:38:34 */
  248.