home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / SRC / GEMLIB38.LZH / v_inquir.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-12  |  5.7 KB  |  266 lines

  1. /*
  2.  *    Vdi inquiry funcs library interface
  3.  *
  4.  *    ++jrb    bammi@cadence.com
  5.  *    modified: mj -- ntomczak@vm.ucs.ualberta.ca
  6.  *
  7.  * -------------------------------------
  8.  * 12.07.97 cf (felsch@tu-harburg.de)
  9.  *        modified for new control arrays
  10.  *
  11.  * 15.06.98
  12.  *        - restructured, new bindings for all functions
  13.  *
  14.  */
  15.  
  16. #include "gem.h"
  17.  
  18. void vq_cellarray(int handle, int pxyarray[], int row_len, int nrows,
  19.                       int *el_used, int *rows_used, int *status, int color[])
  20. {
  21.     short i;
  22.      
  23.     vdi_ptsin[0] = pxyarray[0];
  24.     vdi_ptsin[1] = pxyarray[1];
  25.     vdi_ptsin[2] = pxyarray[2];
  26.     vdi_ptsin[3] = pxyarray[3];
  27.     vdi_control[7] = row_len;
  28.     vdi_control[8] = nrows;
  29.       vdi_control[0] = 27;
  30.     vdi_control[1] = 2;
  31.     vdi_control[3] = 0;
  32.     vdi_control[5] = 0;
  33.     vdi_control[6] = handle;
  34.     vdi(&vdi_params);
  35.     for (i = 0; i<vdi_control[4]; i++)
  36.         color[i] = vdi_intout[i];
  37.     *el_used = vdi_control[9];
  38.     *rows_used = vdi_control[10];
  39.     *status     = vdi_control[11];
  40. }
  41.  
  42. int vq_color(int handle, int index, int flag, int rgb[])
  43. {
  44.     vdi_intin[0] = index;
  45.     vdi_intin[1] = flag;
  46.     vdi_control[0] = 26;
  47.     vdi_control[1] = 0;
  48.     vdi_control[3] = 2;
  49.     vdi_control[5] = 0;
  50.     vdi_control[6] = handle;
  51.     vdi(&vdi_params);
  52.     rgb[0] = vdi_intout[1];
  53.     rgb[1] = vdi_intout[2];
  54.     rgb[2] = vdi_intout[3];
  55.     return vdi_intout[0];
  56. }
  57.  
  58. void vq_extnd(int handle, int flag, int work_out[])
  59. {
  60. #ifndef __MSHORT__
  61.     register short i;
  62. #else
  63.     vdi_params.intout = (short *)&work_out[0];
  64.     vdi_params.ptsout = (short *)&work_out[45];
  65. #endif
  66.  
  67.     vdi_intin[0] = flag;
  68.     vdi_control[0] = 102;
  69.     vdi_control[1] = 0;
  70.     vdi_control[3] = 1;
  71.     vdi_control[5] = 0;
  72.     vdi_control[6] = handle;
  73.     vdi(&vdi_params);
  74.  
  75. #ifndef __MSHORT__
  76.     for (i = 0; i<45; i++)
  77.         work_out[i] = vdi_intout[i];
  78.     for (i = 0; i<12; i++)
  79.         work_out[i+45] = vdi_ptsout[i];
  80. #else
  81.     vdi_params.intout = &vdi_intout[0];
  82.     vdi_params.ptsout = &vdi_ptsout[0];
  83. #endif
  84. }
  85.  
  86. void vqf_attributes(int handle, int atrib[])
  87. {
  88.     vdi_control[0] = 37;
  89.     vdi_control[1] = 0;
  90.     vdi_control[3] = 0;
  91.     vdi_control[5] = 0;
  92.     vdi_control[6] = handle;
  93.     vdi(&vdi_params);
  94.     atrib[0] = vdi_intout[0];     
  95.     atrib[1] = vdi_intout[1];     
  96.     atrib[2] = vdi_intout[2];     
  97.     atrib[3] = vdi_intout[3];     
  98. }
  99.  
  100. void vqin_mode(int handle, int dev, int *mode)
  101. {
  102.     vdi_intin[0] = dev;
  103.     vdi_control[0] = 115;
  104.     vdi_control[1] = 0;
  105.     vdi_control[3] = 1;
  106.     vdi_control[5] = 0;
  107.     vdi_control[6] = handle;
  108.     vdi(&vdi_params);
  109.     *mode = vdi_intout[0];
  110. }
  111.  
  112. void vql_attribute(int handle, int atrib[])
  113. {
  114.     vdi_control[0] = 35;
  115.     vdi_control[1] = 0;
  116.     vdi_control[3] = 0;
  117.     vdi_control[5] = 0;
  118.     vdi_control[6] = handle;
  119.     vdi(&vdi_params);
  120.     atrib[0] = vdi_intout[0];     
  121.     atrib[1] = vdi_intout[1];     
  122.     atrib[2] = vdi_intout[2];     
  123.     atrib[3] = vdi_ptsout[0];     
  124.     atrib[4] = vdi_intout[3];     
  125.     atrib[5] = vdi_intout[4];     
  126. }
  127.  
  128. void vqm_attributes(int handle, int atrib[])
  129. {
  130.     vdi_control[0] = 36;
  131.     vdi_control[1] = 0;
  132.     vdi_control[3] = 0;
  133.     vdi_control[5] = 0;
  134.     vdi_control[6] = handle;
  135.     vdi(&vdi_params);
  136.     atrib[0] = vdi_intout[0];     
  137.     atrib[1] = vdi_intout[1];     
  138.     atrib[2] = vdi_intout[2];     
  139.     atrib[3] = vdi_ptsout[1];     
  140.     atrib[4] = vdi_ptsout[0];     
  141. }
  142.  
  143. void vqt_attributes(int handle, int atrib[])
  144. {
  145. #ifndef __MSHORT__
  146.     short *wptr;
  147.     int     *end;
  148. #else
  149.      vdi_params.intout = (short *)&atrib[0];
  150.      vdi_params.ptsout = (short *)&atrib[6];
  151. #endif
  152.      
  153.     vdi_control[0] = 38;
  154.     vdi_control[1] = 0;
  155.     vdi_control[3] = 0;
  156.     vdi_control[5] = 0;
  157.     vdi_control[6] = handle;
  158.     vdi(&vdi_params);
  159.  
  160. #ifndef __MSHORT__     
  161.     wptr = &vdi_intout[0];
  162.     end = &atrib[6];
  163.     do 
  164.     {
  165.         *atrib++ = *wptr++;
  166.     } while (atrib < end);
  167.     wptr = &vdi_ptsout[0];
  168.     end += 4;
  169.     do 
  170.     {
  171.         *atrib++ = *wptr++;
  172.     } while (atrib < end);
  173. #else
  174.     vdi_params.intout = &vdi_intout[0];
  175.     vdi_params.ptsout = &vdi_ptsout[0];
  176. #endif
  177. }
  178.  
  179. void vqt_cachesize(int handle, int which_cache, long *size)
  180. {
  181.     vdi_intin[0] = which_cache;
  182.     vdi_control[0] = 255;
  183.     vdi_control[1] = 0;
  184.     vdi_control[3] = 1;
  185.     vdi_control[5] = 0;
  186.     vdi_control[6] = handle;
  187.     vdi(&vdi_params);
  188.     *size = *((long *)(&vdi_intout[0]));
  189. }
  190.  
  191. void vqt_extent(int handle, char *str, int extent[])
  192. {
  193.     short    i;
  194.     
  195.     i = vdi_str2array(str, vdi_intin);
  196.     vdi_control[0] = 116;
  197.     vdi_control[1] = 0;
  198.     vdi_control[3] = i;
  199.     vdi_control[6] = handle;
  200.     vdi(&vdi_params);
  201.     
  202.     for (i = 0; i<8; i++)
  203.         extent[i] = vdi_ptsout[i];
  204. }
  205.  
  206. void vqt_fontinfo(int handle, int *minade, int *maxade, int distances[], int *maxwidth, int effects[])
  207. {
  208.     vdi_control[0] = 131;
  209.     vdi_control[1] = 0;
  210.     vdi_control[3] = 0;
  211.     vdi_control[5] = 0;
  212.     vdi_control[6] = handle;
  213.     vdi(&vdi_params);
  214.     *minade = vdi_intout[0];
  215.     *maxade = vdi_intout[1];
  216.     *maxwidth = vdi_ptsout[0];
  217.     distances[0] = vdi_ptsout[1];
  218.     distances[1] = vdi_ptsout[3];
  219.     distances[2] = vdi_ptsout[5];
  220.     distances[3] = vdi_ptsout[7];
  221.     distances[4] = vdi_ptsout[9];
  222.     effects[0] = vdi_ptsout[2];
  223.     effects[1] = vdi_ptsout[4];
  224.     effects[2] = vdi_ptsout[6];     
  225. }
  226.  
  227. void vqt_get_table(int handle, short **map)
  228. {
  229.     vdi_control[0] = 254;
  230.     vdi_control[1] = 0;
  231.     vdi_control[3] = 0;
  232.     vdi_control[5] = 0;
  233.     vdi_control[6] = handle;
  234.     vdi(&vdi_params);
  235.     *map = *((short **)(&vdi_intout[0]));
  236. }
  237.  
  238. int vqt_name(int handle, int element, char *name)
  239. {
  240.     vdi_intin[0] = element;
  241.     vdi_control[0] = 130;
  242.     vdi_control[1] = 0;
  243.     vdi_control[3] = 1;
  244.     vdi_control[5] = 0;
  245.     vdi_control[6] = handle;
  246.     vdi(&vdi_params);
  247.     vdi_array2str(vdi_intout+1, name, 33);
  248.     return vdi_intout[0];
  249. }
  250.  
  251. int vqt_width(int handle, int chr, int *cw, int *ldelta, int *rdelta)
  252. {
  253.     vdi_intin[0] = chr;
  254.     vdi_control[0] = 117;
  255.     vdi_control[1] = 0;
  256.     vdi_control[3] = 1;
  257.     vdi_control[5] = 0;
  258.     vdi_control[6] = handle;
  259.     vdi(&vdi_params);
  260.     *cw = vdi_ptsout[0];
  261.     *ldelta = vdi_ptsout[2];
  262.     *rdelta = vdi_ptsout[4];
  263.     return vdi_intout[0];
  264. }
  265.  
  266.