home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / SRC / GEMLIB38.LZH / v_input.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-10  |  5.5 KB  |  261 lines

  1. /*
  2.  *    Vdi input funcs library interface
  3.  *
  4.  *    ++jrb    bammi@cadence.com
  5.  *    modified: mj -- ntomczak@vm.ucs.ualberta.ca
  6.  *
  7.  * whoever at atari/dri designed this part was
  8.  * definitely *not* on over-the-counter drugs
  9.  *
  10.  * -------------------------------------
  11.  * 12.07.97 cf (felsch@tu-harburg.de)
  12.  *        modified for new control arrays
  13.  *
  14.  * 15.06.98
  15.  *        - restructured, new bindings for all functions
  16.  */
  17. #include "gem.h"
  18.  
  19. void v_hide_c(int handle)
  20. {
  21.     vdi_control[0] = 123;
  22.     vdi_control[1] = 0;
  23.     vdi_control[3] = 0;
  24.     vdi_control[5] = 0;
  25.     vdi_control[6] = handle;
  26.     vdi(&vdi_params);
  27. }
  28.  
  29. void v_show_c(int handle, int reset)
  30. {
  31.     vdi_intin[0] = reset;
  32.     vdi_control[0] = 122;
  33.     vdi_control[1] = 0;
  34.     vdi_control[3] = 1;
  35.     vdi_control[5] = 0;
  36.     vdi_control[6] = handle;
  37.     vdi(&vdi_params);
  38. }
  39.  
  40. void vex_butv(int handle, void *new, void **old)
  41. {
  42.     *((void **)(&vdi_control[7])) = new;
  43.     vdi_control[0] = 125;
  44.     vdi_control[1] = 0;
  45.     vdi_control[3] = 0;
  46.     vdi_control[5] = 0;
  47.     vdi_control[6] = handle;
  48.     vdi(&vdi_params);
  49.     *old = *((void **)(&vdi_control[9]));
  50. }
  51.  
  52. void vex_curv(int handle, void *new, void **old)
  53. {
  54.     *((void **)(&vdi_control[7])) = new;
  55.     vdi_control[0] = 127;
  56.     vdi_control[1] = 0;
  57.     vdi_control[3] = 0;
  58.     vdi_control[5] = 0;
  59.     vdi_control[6] = handle;
  60.     vdi(&vdi_params);
  61.     *old = *((void **)(&vdi_control[9]));
  62. }
  63.  
  64. void vex_motv(int handle, void *new, void **old)
  65. {
  66.     *((void **)(&vdi_control[7])) = new;
  67.     vdi_control[0] = 126;
  68.     vdi_control[1] = 0;
  69.     vdi_control[3] = 0;
  70.     vdi_control[5] = 0;
  71.     vdi_control[6] = handle;
  72.     vdi(&vdi_params);
  73.     *old = *((void **)(&vdi_control[9]));
  74. }
  75.  
  76. void vex_timv(int handle, void *time_addr, void **otime_addr, int *time_conv)
  77. {
  78.     *((void **)(&vdi_control[7])) = time_addr;
  79.     vdi_control[0] = 118;
  80.     vdi_control[1] = 0;
  81.     vdi_control[3] = 0;
  82.     vdi_control[5] = 0;
  83.     vdi_control[6] = handle;
  84.     vdi(&vdi_params);
  85.     *otime_addr = *((void **)(&vdi_control[9]));
  86.     *time_conv  = vdi_intout[0];
  87. }
  88.  
  89. void vq_key_s(int handle, int *state)
  90. {
  91.     vdi_control[0] = 128;
  92.     vdi_control[1] = 0;
  93.     vdi_control[3] = 0;
  94.     vdi_control[5] = 0;
  95.     vdi_control[6] = handle;
  96.     vdi(&vdi_params);
  97.     *state = vdi_intout[0];
  98. }
  99.  
  100. void vq_mouse(int handle, int *pstatus, int *x, int *y)
  101. {
  102.     vdi_control[0] = 124;
  103.     vdi_control[1] = 0;
  104.     vdi_control[3] = 0;
  105.     vdi_control[5] = 0;
  106.     vdi_control[6] = handle;
  107.     vdi(&vdi_params);
  108.     *pstatus = vdi_intout[0];
  109.     *x = vdi_ptsout[0];
  110.     *y = vdi_ptsout[1];
  111. }
  112.  
  113. void vrq_choice(int handle, int cin, int *cout)
  114. {
  115.     vdi_intin[0] = cin;
  116.     vdi_control[0] = 30;
  117.     vdi_control[1] = 0;
  118.     vdi_control[3] = 1;
  119.     vdi_control[5] = 0;
  120.     vdi_control[6] = handle;
  121.     vdi(&vdi_params);
  122.     *cout = vdi_intout[0];
  123. }
  124.  
  125. void vrq_locator(int handle, int x, int y, int *xout, int *yout, int *term)
  126. {
  127.     vdi_ptsin[0] = x;
  128.     vdi_ptsin[1] = y;
  129.     vdi_control[0] = 28;
  130.     vdi_control[1] = 1;
  131.     vdi_control[3] = 0;
  132.     vdi_control[5] = 0;
  133.     vdi_control[6] = handle;
  134.     vdi(&vdi_params);
  135.     *xout = vdi_ptsout[0];
  136.     *yout = vdi_ptsout[1];
  137.     *term = vdi_intout[0];
  138. }
  139.  
  140. void vrq_string(int handle, int len, int echo, int echoxy[], char *str)
  141. {
  142.     vdi_intin[0] = len;
  143.     vdi_intin[1] = echo;
  144.     vdi_ptsin[0] = echoxy[0];
  145.     vdi_ptsin[1] = echoxy[1];
  146.     vdi_control[0] = 31;
  147.     vdi_control[1] = 1;
  148.     vdi_control[3] = 2;
  149.     vdi_control[5] = 0;
  150.     vdi_control[6] = handle;
  151.     vdi(&vdi_params);
  152.     vdi_array2str(vdi_intout, str, vdi_control[4]);
  153. }
  154.  
  155. void vrq_valuator(int handle, int in, int *out, int *term)
  156. {
  157.     vdi_intin[0] = in;
  158.     vdi_control[0] = 29;
  159.     vdi_control[1] = 0;
  160.     vdi_control[3] = 1;
  161.     vdi_control[5] = 0;
  162.     vdi_control[6] = handle;
  163.     vdi(&vdi_params);
  164.     *out = vdi_intout[0];
  165.     *term = vdi_intout[1];
  166. }
  167.  
  168. void vsc_form(int handle, int form[])
  169. {
  170. #ifndef __MSHORT__
  171.     short    i;
  172.  
  173.     for (i = 0; i<37; i++)
  174.         vdi_intin[i] = form[i];
  175. #else
  176.     vdi_params.intin = (short *)&form[0];
  177. #endif
  178.  
  179.     vdi_control[0] = 111;
  180.     vdi_control[1] = 0;
  181.     vdi_control[3] = 37;
  182.     vdi_control[5] = 0;
  183.     vdi_control[6] = handle;
  184.     vdi(&vdi_params);
  185.  
  186. #ifdef __MSHORT__
  187.     vdi_params.intin = (short *)&vdi_intin[0];
  188. #endif
  189. }
  190.  
  191. int vsin_mode(int handle, int dev, int mode)
  192. {
  193.     vdi_intin[0] = dev;
  194.     vdi_intin[1] = mode;
  195.     vdi_control[0] = 33;
  196.     vdi_control[1] = 0;
  197.     vdi_control[3] = 2;
  198.     vdi_control[5] = 0;
  199.     vdi_control[6] = handle;
  200.     vdi(&vdi_params);
  201.     return vdi_intout[0];
  202. }
  203.  
  204. int vsm_choice(int handle, int *choice)
  205. {
  206.     vdi_control[0] = 30;
  207.     vdi_control[1] = 0;
  208.     vdi_control[3] = 0;
  209.     vdi_control[5] = 0;
  210.     vdi_control[6] = handle;
  211.     vdi(&vdi_params);
  212.     *choice = vdi_intout[0];
  213.     return vdi_control[4];
  214. }
  215.  
  216. int vsm_locator(int handle, int x, int y, int *xout, int *yout, int *term)
  217. {
  218.     vdi_ptsin[0] = x;
  219.     vdi_ptsin[1] = y;
  220.     vdi_control[0] = 28;
  221.     vdi_control[1] = 1;
  222.     vdi_control[3] = 0;
  223.     vdi_control[5] = 0;
  224.     vdi_control[6] = handle;
  225.     vdi(&vdi_params);
  226.     *xout = vdi_ptsout[0];
  227.     *yout = vdi_ptsout[1];
  228.     *term = vdi_intout[0];
  229.     return ((vdi_control[4] << 1) | vdi_control[2]);
  230. }
  231.  
  232. int vsm_string(int handle, int len, int echo, int echoxy[], char *str)
  233. {
  234.     vdi_intin[0] = len;
  235.     vdi_intin[1] = echo;
  236.     vdi_ptsin[0] = echoxy[0];
  237.     vdi_ptsin[1] = echoxy[1];
  238.     vdi_control[0] = 31;
  239.     vdi_control[1] = 1;
  240.     vdi_control[3] = 2;
  241.     vdi_control[5] = 0;
  242.     vdi_control[6] = handle;
  243.     vdi(&vdi_params);
  244.     vdi_array2str(vdi_intout, str, vdi_control[4]);
  245.     return vdi_control[4]; 
  246. }
  247.  
  248. void vsm_valuator(int handle, int in, int *out, int *term, int *status)
  249. {
  250.     vdi_intin[0] = in;
  251.     vdi_control[0] = 29;
  252.     vdi_control[1] = 0;
  253.     vdi_control[3] = 1;
  254.     vdi_control[5] = 0;
  255.     vdi_control[6] = handle;
  256.     vdi(&vdi_params);
  257.     *out = vdi_intout[0];
  258.     *term = vdi_intout[1];
  259.     *status = vdi_control[4];
  260. }
  261.