home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / dvtools / examples / utilities / viewdump.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-08  |  35.8 KB  |  1,191 lines

  1. #ifndef    lint
  2. static char SccsId[] = "@(#)ViewDump.c    V1.9    1/19/93";
  3. #endif
  4. /* ====================================================================
  5.    ViewDump - Dump contents of a view in human readable form
  6.    --------------------------------------------------------------------
  7.    SYNOPSIS
  8.         ViewDump <viewfile> <outputfile>
  9.    DESCRIPTION
  10.         This program examines a viewfile and prints out its notable
  11.    contents.  There are two major sections of output, the datasource
  12.    section and the drawing objects section.  The datasource section
  13.    contains information about each datasource variable of each
  14.    datasource in the datasource list.  The drawing object section
  15.    contains pertinent information about selected objects and
  16.    subobjects.  An object is described if it falls into one of the
  17.    following categories:
  18.  
  19.         o  It is a drawing
  20.         o  It is a subdrawing, image or icon
  21.         o  It is a graph
  22.         o  It is a named object
  23.         o  It has dynamics
  24.  
  25.    HISTORY
  26.     29-Jul-91 RBW    Created this file based on ViewDump utility
  27.     29-Jul-91 RBW    Added missing message for Non-Dynamic Drawings
  28.     30-Jul-91 RBW    removed 12 char limit to object name output
  29.     30-Jul-91 RBW    Added output of value of text/vector text objects
  30.         31-Jul-91 RBW    Added output of some 8.0 dynamics
  31.          1-Aug-91 RBW    Standardized output of filenames to facilitate "grep"s
  32.     20-Jan-93 CJH    Added new graphs & input types
  33.    ================================================================= */
  34.  
  35. #include "std.h"
  36. #include "dvstd.h"
  37. #include "dvtools.h"
  38. #include "Tfundecl.h"
  39. #include "VOstd.h"
  40. #include "vofundecl.h"
  41. #include "vgfundecl.h"
  42. #include "dvGR.h"
  43.  
  44. typedef void    (*ProcPtr)();    /* pointer to a procedure */
  45.  
  46. #define DVPRINTF fprintf
  47. FILE *where;
  48.  
  49. LOCAL CHAR    result[80];
  50. LOCAL INT    Depth = 0;
  51. DRAWING_OBJECT    drawing;
  52.  
  53. VOID         DepthArrow();
  54. VOID        DoDatagroup();
  55. VOID        DoInputobject();
  56. VOID        CheckColorDynamics();
  57. VOID        DoIcon();
  58. VOID        DoImage();
  59. VOID        DoPixmap();
  60. VOID        DoSubdrawing();
  61. VOID        DoDynamicDrawing();
  62. ADDRESS ExamDataSource(ADDRESS,ADDRESS), ExamObject(OBJECT,ADDRESS);
  63. VOID    init_dispforms();
  64. VOID init_inhandlers();
  65.  
  66.  
  67.  
  68. /*ARGSUSED*/
  69. VOID NoDetails( object ) OBJECT object; { DVPRINTF(where,"\n");}
  70.  
  71. /*==============================================================*/
  72. /*        Table of Post 7.0 Dynamics            */
  73. /*==============================================================*/
  74. struct
  75. {
  76.     int    action_flag;        /* DVtools action flag constant */
  77.     char    *name;            /* name of dynamic type        */
  78.     BOOL    multiple_allowed;    /* can object have more than 1    */
  79.     ProcPtr    print_details;        /* routine to print details    */
  80. }
  81. DynamicType[] =
  82. {
  83.   V_DYN_VISIBILITY,    "VISIBILITY",        NO,    NoDetails,
  84.   V_DYN_TEXT,        "TEXT",            NO,    NoDetails,
  85.   V_DYN_SUBDRAWING,    "SUBDRAWING",        NO,    DoDynamicDrawing,
  86.   V_DYN_ROTATE,        "ROTATION",        YES,    NoDetails,
  87.   V_DYN_REL_MOVE_X,    "Rel X Move",        YES,    NoDetails,
  88.   V_DYN_REL_MOVE_Y,    "Rel Y Move",        YES,    NoDetails,
  89.   V_DYN_PATH_MOVE,    "Path  Move",        NO,    NoDetails,
  90.   V_DYN_ABS_MOVE_X,    "Abs X Move",        NO,    NoDetails,
  91.   V_DYN_ABS_MOVE_Y,    "Abs Y Move",        NO,    NoDetails,
  92.   V_DYN_FILL_DOWN,    "Fill Down",        NO,    NoDetails,
  93.   V_DYN_FILL_UP,    "Fill Up",        NO,    NoDetails,
  94.   V_DYN_FILL_LEFT,    "Fill Left",        NO,    NoDetails,
  95.   V_DYN_FILL_RIGHT,    "Fill Right",        NO,    NoDetails,
  96.   V_DYN_SCALE,        "SCALE",        YES,    NoDetails,
  97.   V_DYN_SCALE_X,    "SCALE X",        YES,    NoDetails,
  98.   V_DYN_SCALE_Y,     "SCALE Y",        YES,    NoDetails,
  99.   TEXT_POSITION,    "TEXT POSITION",    NO,    NoDetails,
  100.   TEXT_CHARSPACE,    "TEXT CHARSPACE",    NO,    NoDetails,
  101.   TEXT_DIRECTION,    "TEXT DIRECTION",    NO,    NoDetails,
  102.   TEXT_FONTNAME,    "TEXT FONTNAME",    NO,    NoDetails,
  103.   TEXT_LINESPACE,    "TEXT LINESPACE",    NO,    NoDetails,
  104.   TEXT_WIDTH,        "TEXT WIDTH",        NO,    NoDetails,
  105.   TEXT_SLANT,        "TEXT SLANT",        NO,    NoDetails,
  106.   TEXT_NAME,        "TEXT NAME",        NO,    NoDetails,
  107.   TEXT_ANGLE,        "TEXT ANGLE",        NO,    NoDetails,
  108.   TEXT_FONT,        "TEXT FONT",        NO,    NoDetails,
  109.   TEXT_HEIGHT,        "TEXT HEIGHT",        NO,    NoDetails,
  110.   TEXT_SIZE,        "TEXT SIZE",        NO,    NoDetails,
  111.   FILL_STATUS,        "FILL STATUS",        NO,    NoDetails,
  112.   LINE_TYPE,        "LINE TYPE",        NO,    NoDetails,
  113.   LINE_WIDTH,        "LINE WIDTH",        NO,    NoDetails,
  114.   CURVE_TYPE,        "CURVE TYPE",        NO,    NoDetails,
  115.   FOREGROUND_COLOR,    "FORECOLOR",        NO,    NoDetails,
  116.   BACKGROUND_COLOR,    "BACKCOLOR",        NO,    NoDetails,
  117.   0,            NULL,            NO,    NULL
  118. };    
  119. /*=============================================================*/
  120.  
  121. #define    DYNAMIC(N)    VOdyGetDataObj(dy,DynamicType[i].action_flag,N)
  122.                         
  123. /*-------------------------------------------------------------------------
  124. **   Check80Dynamics  --  checks an object for 8.0 style dynamics.  If
  125. **    yes, then print out information about each dynamic action. 
  126. **-------------------------------------------------------------------------
  127. */
  128. VOID Check80Dynamics( object )
  129.   OBJECT object;
  130. {
  131.   OBJECT    dy = VOobDyGet(object), dyno;
  132.   int        i,j;
  133.   
  134.   if (dy == (OBJECT)NULL) return;
  135.   Depth++;
  136.   
  137.   for (i=0; DynamicType[i].name; ++i)
  138.     for (j=1; dyno=DYNAMIC(j); ++j)
  139.       {
  140.       DepthArrow();
  141.       DVPRINTF(where,"post 7.0 %s Dynamics #%d ",DynamicType[i].name, j);
  142.       if( DynamicType[i].print_details )
  143.     (*DynamicType[i].print_details)(dyno);
  144.       if (!DynamicType[i].multiple_allowed) break;
  145.       }
  146.   
  147.   --Depth;
  148. }
  149.  
  150.  
  151. /*=========================================================================
  152.  *   MAIN PROGRAM
  153.  */
  154. main( argc, argv )
  155.   INT argc;
  156.   CHAR *argv[];
  157. {
  158.   VIEW         view;
  159.   DATASOURCELIST dsl;
  160.  
  161.   /*
  162.    *   Check for the correct number of arguements.
  163.    */
  164.   {
  165.     DWORD system;
  166.     FILE *outputfile; 
  167.  
  168.     if ( argc == 3 )
  169.     {
  170.       
  171.  
  172.       outputfile = fopen( argv[2],"wt");
  173.       if ( outputfile == NULL )
  174.       {
  175.         Beep( 100,100);
  176.         exit(-1);
  177.       }
  178.       where = outputfile;
  179.     }
  180.     else
  181.     {      
  182.       system = GetVersion();
  183.       system = HIWORD(system);
  184.       if ( ( system & 0xF000 ) )
  185.       {
  186.         /* not an NT system */
  187.         outputfile = fopen( "viewdump.out","wt");
  188.         if ( outputfile == NULL )
  189.         {
  190.           Beep( 100,100);
  191.           exit(-1);
  192.         }
  193.         where = outputfile;
  194.       }
  195.       else
  196.         where = stdout;
  197.     }
  198.   }
  199.   if ( ( argc < 2 ) || ( argc > 3 ) )
  200.     {
  201.      DVPRINTF(where, "Usage: %s <viewfile> [outputfile] \n", argv[0] );
  202. #if 0
  203.     exit( EXIT_ERR );
  204. #endif
  205.     }
  206.  
  207.   
  208.  
  209.   DVPRINTF(where,">>>>>>>>>>>>>>>>>>>>> ViewDump: processing FILE:[%s]...\n",argv[1]);
  210.   /* Finish initializing display formatter table */
  211.   init_dispforms();
  212.   init_inhandlers();
  213.  
  214.  
  215.   /*
  216.    *   Initialize DV-Tools, load the view and gets its drawing
  217.    *     and datasource list.
  218.    */
  219.   TInit( (CHAR *)NULL,    /* Use DVPATH config var */
  220.            (CHAR *)NULL );
  221.   if ( ! ( view = TviLoad( argv[1] ) ) )
  222.     {
  223.      DVPRINTF(where, "Could not load FILE:[%s] as view.\n", argv[1] );
  224.     TTerminate();
  225.     exit( EXIT_ERR );
  226.     }
  227.   dsl = TviGetDataSourceList( view );
  228.   drawing = TviGetDrawing( view );
  229.  
  230.   /*
  231.    *   Print the information on datasources and the information on
  232.    *     all of the drawing objects.
  233.    */
  234.   DVPRINTF(where, "=================> DataSources \n" );
  235.   TdlForEachDataSource( dsl, ExamDataSource, (ADDRESS)NULL );
  236.   DVPRINTF(where, "\n" );
  237.   DVPRINTF(where, "=================> Drawing Objects \n" );
  238.   TobForEachSubobject( drawing, ExamObject, (ADDRESS)NULL );
  239.  
  240.   /*
  241.    *   Terminate DV-Tools.
  242.    */
  243.   TTerminate();
  244.   return EXIT_OK;
  245. }
  246.  
  247.  
  248. /*
  249.  *   ExamDataSource  --  prints the name of the data source and
  250.  *     examines each datasource variable in the datasource.
  251.  */
  252. /*ARGSUSED*/
  253. ADDRESS ExamDataSource( datasource, args )
  254.   DATASOURCE datasource;
  255.   ADDRESS args;
  256. {
  257.   ADDRESS ExamDsv(DSVAR,ADDRESS);
  258.  
  259.   DVPRINTF(where, "---> %s \n", TdsGetName( datasource ) );
  260.   TdsForEachVar( datasource, ExamDsv, (ADDRESS)NULL );
  261.   return NULL;
  262. }
  263.  
  264.  
  265. /*
  266.  *   ExamDsv  --  prints the name, type, and shape(size) of a
  267.  *     datasource variable.
  268.  */
  269. /*ARGSUSED*/
  270. ADDRESS ExamDsv( dsvar, args )
  271.   DSVAR dsvar;
  272.   ADDRESS args;
  273. {
  274.   CHAR *GetVarType(), *GetVarSize();
  275.   INT rows, columns;
  276.  
  277.   DVPRINTF(where, "-----> %-20s ", TdsvGetName( dsvar ) );
  278.   DVPRINTF(where, "%s ", GetVarType( TdsvGetType( dsvar ) ) );
  279.   TdsvGetSize( dsvar, &rows, &columns );
  280.   DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
  281.   return NULL;
  282. }
  283.  
  284.  
  285. /*
  286.  *   GetVarType  --  returns a string containing the expanded name
  287.  *     corresponding to a type number.
  288.  */
  289. CHAR *GetVarType( type )
  290.   INT type;
  291. {
  292.   switch ( type )
  293.     {
  294.     case V_C_TYPE:  return "CHAR        ";
  295.     case V_UC_TYPE: return "UNSGN CHAR  ";
  296.     case V_S_TYPE:  return "SHORT       ";
  297.     case V_US_TYPE: return "UNSGN SHORT ";
  298.     case V_I_TYPE:  return "INTEGER     ";
  299.     case V_UI_TYPE: return "UNSGN INT   ";
  300.     case V_F_TYPE:  return "FLOAT       ";
  301.     case V_D_TYPE:  return "DOUBLE      ";
  302.     case V_T_TYPE:  return "TEXT STRING ";
  303.     default:        return "????        ";
  304.     }
  305. }
  306.  
  307. /*
  308.  *   GetVarSize  --  sets up a string(global) containing the shape and
  309.  *     size according to the number of rows and columns.
  310.  */
  311. CHAR *GetVarSize( rows, columns )
  312.   INT rows;
  313.   INT columns;
  314. {
  315.   if ( rows == 1 && columns == 1 )
  316.     return "Scalar";
  317.  
  318.   if ( rows == 1 )
  319.     {
  320.     sprintf( result, "Column Vector  ( %3d )", columns );
  321.     return result;
  322.     }
  323.  
  324.   if ( columns == 1 )
  325.     {
  326.     sprintf( result, "Row Vector     ( %3d )", rows );
  327.     return result;
  328.     }
  329.  
  330.   sprintf( result,   "Matrix   ( %3d X %3d )", rows, columns );
  331.   return result;
  332. }
  333.  
  334.  
  335. /*
  336.  *   ExamObject  --  for each notable object (see ObjectNotable() ),
  337.  *     prints the name and type dependent information of an object.
  338.  */
  339. /*ARGSUSED*/
  340. ADDRESS ExamObject( object, args )
  341.   OBJECT object;
  342.   ADDRESS args;
  343. {
  344.   VOID PeruseObject();
  345.   BOOL ObjectNotable();
  346.   CHAR *name, *VOdrGetName();
  347.  
  348.   if ( ! ObjectNotable(object)) return NULL;
  349.  
  350.   Depth++;
  351.   DepthArrow();
  352.  
  353.   if (name=VOdrGetName(drawing,object))
  354.     DVPRINTF(where, "%-12s  ", name );
  355.   else
  356.     DVPRINTF(where, "%-12s  ", "NO NAME" );
  357.  
  358.   PeruseObject( object );
  359.   DVPRINTF(where, "\n" );
  360.  
  361.   Depth--;
  362.  
  363.   return NULL;
  364. }
  365.  
  366.  
  367. /*
  368.  *   PeruseObject  --  checks the type of and object and prints out
  369.  *     the type of the object and any object specific information.
  370.  */
  371. VOID PeruseObject( object )
  372.   OBJECT object;
  373. {
  374.   INT type;
  375.  
  376.   type = VOobType( object );
  377.   if ( type != OT_DG && type != OT_INPUT && type != OT_THRESHTABLE )
  378.     {
  379.     switch ( type )
  380.       {
  381.       case OT_ARC:
  382.         DVPRINTF(where, "ARC \n" );
  383.     break;
  384.       case OT_CIRCLE:
  385.     DVPRINTF(where, "CIRCLE \n" );
  386.     break;
  387.       case OT_ICON:
  388.     DVPRINTF(where, "ICON \n");
  389.     DoIcon( object );
  390.     break;
  391.       case OT_IMAGE:
  392.     DVPRINTF(where, "IMAGE \n");
  393.     DoImage( object );
  394.     break;
  395.       case OT_LINE:
  396.     DVPRINTF(where, "LINE \n" );
  397.     break;
  398.       case OT_POLYGON:
  399.     DVPRINTF(where, "POLYGON \n" );
  400.     break;
  401.       case OT_ELLIPSE:
  402.     DVPRINTF(where, "ELLIPSE \n" );
  403.     break;
  404.       case OT_RECTANGLE:
  405.     DVPRINTF(where, "RECTANGLE \n" );
  406.     break;
  407.       case OT_TEXT:
  408.     DVPRINTF(where, "TEXT \"%s\"\n", VOtxGetString(object));
  409.     break;
  410.       case OT_VTEXT:
  411.     DVPRINTF(where,"VECTOR TEXT \"%s\"\n", VOvtGetString(object));
  412.     break;
  413.       case OT_DRAWING:
  414.     DVPRINTF(where, "DRAWING (?!) \n" );
  415.     break;
  416.       case OT_SUBDRAWING:
  417.     DVPRINTF(where, "SUBDRAWING " );
  418.     DoSubdrawing( object );
  419.     break;
  420.       default: /* probably a non-graphical object */
  421.     DVPRINTF(where,"*** unknown object type [%n] in peruse ***\n", type);
  422.     break;
  423.       }
  424.  
  425.     CheckColorDynamics( object );
  426.     Check80Dynamics( object );
  427.     }
  428.   else
  429.     switch ( type )
  430.       {
  431.       case OT_DG:
  432.         DVPRINTF(where, "GRAPH " );
  433.     DoDatagroup( object );
  434.     break;
  435.       case OT_INPUT:
  436.         DVPRINTF(where, "INPUT OBJECT " );
  437.     DoInputobject( object );
  438.     break;
  439.       case OT_THRESHTABLE:
  440.     DVPRINTF(where, "pre 8.0 DYNAMIC DRAWING " );
  441.     DoDynamicDrawing( object );
  442.     break;
  443.       }
  444. }
  445.  
  446.  
  447. /*
  448.  *   ObjectNotable  --  decides whether or not an object is worth the
  449.  *     effort of perusing.  An object is notable if at least one of the
  450.  *     following conditions apply:
  451.  *
  452.  *        o  It is a named object
  453.  *        o  It is a drawing object
  454.  *        o  It is a subdrawing, icon, or image object
  455.  *        o  It is a datagroup object (graph)
  456.  *        o  It is a dynamic object (color or drawing)
  457.  */
  458. BOOL ObjectNotable( object )
  459.   OBJECT object;
  460. {
  461.   INT type;
  462.  
  463.   if ( VOdrGetName( drawing, object ) ) return YES;
  464.   type = VOobType( object );
  465.   if ( type == OT_DRAWING ) return YES;
  466.   if ( type == OT_SUBDRAWING ) return YES;
  467.   if ( type == OT_ICON ) return YES;
  468.   if ( type == OT_IMAGE ) return YES;
  469.   if ( type == OT_DG ) return YES;
  470.   if ( type == OT_THRESHTABLE ) return YES;  /* Dynamic drawing subdrawing */
  471.   if ( type == OT_VD ) return YES;           /* Dynamic color object */
  472.   if ( VOuIsDynamic( object ) ) return YES;  /* All other dynamic types */
  473.   if ( VOobDyGet( object ) != (OBJECT)NULL )
  474.     {
  475.     DVPRINTF(where,"*** 8.0 dynamics found, but not by VOuIsDynamic ***\n");
  476.     return YES;
  477.     }
  478.   return NO;
  479. }
  480.  
  481.  
  482. /*--------------------------------------------------------------------------
  483.  *   CheckColorDynamics  --  checks an object for color dynamics.  If
  484.  *     yes, then print out information about the variable that
  485.  *     determines the color dynamics, and each segment of the threshold
  486.  *     table.
  487.  */
  488. VOID CheckColorDynamics( object )
  489.   OBJECT object;
  490. {
  491.   VOID ClosestColor();
  492.   VARDESC vdp, GetFirstVdp(OBJECT,VARDESC,ADDRESS);
  493.   DSVAR dsv;
  494.   DOUBLE low, high;
  495.   COLOR_THRESHOLD *ctp;
  496.   INT num_colors, i;
  497.   FLOAT lowval, highval, range, TTval();
  498.   INT red, green, blue;
  499.   INT slices, columns, rows;
  500.  
  501.   if (! VOuHasColorDynamics(object)) return;
  502.  
  503.   /*
  504.    *   Get the variable descriptor and the datasource variable it
  505.    *     points to.
  506.    */
  507.   vdp = TobForEachVdp( object, GetFirstVdp, (ADDRESS)NULL );
  508.   dsv = TvdGetDataSourceVariable( vdp );
  509.   
  510.   Depth++;
  511.   DepthArrow();
  512.   DVPRINTF(where, "pre 8.0 Color Dynamics -- %-12s  ", TdsvGetName( dsv ) );
  513.   DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
  514.   VGvddim( vdp, &slices, &columns, &rows );
  515.   DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
  516.  
  517.   /*
  518.    *   Go through each entry in the threshold table, printing the
  519.    *     threshold value (based on the range of the variable) and
  520.    *     the rgb value of the color corresponding to that value.
  521.    */
  522.   VGvd_drange( vdp, &low, &high );
  523.   range = high - low;
  524.   VGvdctt( vdp, &num_colors, &ctp );
  525.   for ( i=0; i<num_colors; i++)
  526.     {
  527.     if ( i == 0 )
  528.       lowval = low;
  529.     else
  530.       lowval = TTval( ctp[i-1].upperlimit, low, range );
  531.     if ( i == num_colors - 1  )
  532.       highval = high;
  533.     else
  534.       highval = TTval( ctp[i].upperlimit, low, range );
  535.     Depth++; DepthArrow();
  536.     DVPRINTF(where, "Range %6.4g to %6.4g  --  ", lowval, highval );
  537.  
  538.     red = ctp[i].threshcolor.rgb_rep.red;
  539.     green = ctp[i].threshcolor.rgb_rep.green;
  540.     blue = ctp[i].threshcolor.rgb_rep.blue;
  541.     DVPRINTF(where, "%.3d %.3d %.3d  ", red, green, blue );
  542.     ClosestColor( red, green, blue );
  543.     DVPRINTF(where, "\n" );
  544.     Depth--;
  545.     }
  546.  
  547.   Depth--;
  548. }
  549.  
  550.  
  551. /*
  552.  *   DoDatagroup  --  prints the type of the graph, and the name, type,
  553.  *     and shape of each variable attached to the datagroup.
  554.  */
  555. VOID DoDatagroup( object )
  556.   OBJECT object;
  557. {
  558.   DATAGROUP dgp, VOdgAddress();
  559.   VARDESC vdp, VGvdget();
  560.   DSVAR dsvar;
  561.   INT i;
  562.   CHAR *fmtname, *GetDispFormName();
  563.   DOUBLE low, high;
  564.   INT slices, rows, columns;
  565.  
  566.   dgp = VOdgAddress( object );
  567.   fmtname = GetDispFormName( VGdgdf( dgp ) );
  568.   DVPRINTF(where, "\"%s\" \n", fmtname ? fmtname : "UNKNOWN DISPFORM" );
  569.  
  570.   Depth++;
  571.   for ( i=1; i<=(INT)VGvdget( dgp, 0 ); i++ )
  572.     {
  573.     DepthArrow();
  574.     DVPRINTF(where, "Variable #%.2d -- ", i );
  575.     vdp = VGvdget( dgp, i );
  576.     dsvar = TvdGetDataSourceVariable( vdp );
  577.     DVPRINTF(where, "%-12s  ", TdsvGetName( dsvar ) );
  578.     DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
  579.     VGvddim( vdp, &slices, &columns, &rows );
  580.     DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
  581.  
  582.     Depth++; DepthArrow();
  583.     VGvd_drange( vdp, &low, &high );
  584.     DVPRINTF(where, "Range is %4.4g to %4.4g \n", low, high );
  585.     Depth--;
  586.     }
  587.   Depth--;
  588. }
  589.  
  590. /*
  591.  *   DoInputobject  --  prints the type of the input object, and the
  592.  *     name, type, and shape of each variable attached to the object.
  593.  */
  594. VOID DoInputobject( input )
  595.   OBJECT input;
  596. {
  597.   OBJECT intech;
  598.   ADDRESS *VarList;
  599.   INT NumVars;
  600.  
  601.   VARDESC vdp, VGvdget();
  602.   DSVAR dsvar;
  603.   INT i;
  604.   CHAR *fmtname, *GetInHandlerName();
  605.   DOUBLE low, high;
  606.   INT slices, rows, columns;
  607.  
  608.   intech = VOinTechnique( input, DONT_SET_THE_VALUE );
  609.   fmtname = GetInHandlerName( VOitGetInteraction( intech ) );
  610.   DVPRINTF(where, "\"%s\" \n", fmtname ? fmtname : "UNKNOWN INHANDLER" );
  611.  
  612.   Depth++;
  613.   VOinGetVarList( input, &VarList, &NumVars );
  614.   for ( i=0; i<NumVars; i++ )
  615.     {
  616.     DepthArrow();
  617.     DVPRINTF(where, "Variable #%.2d -- ", i+1 );
  618.     vdp = (VARDESC)VarList[i];
  619.     dsvar = TvdGetDataSourceVariable( vdp );
  620.     DVPRINTF(where, "%-12s  ", TdsvGetName( dsvar ) );
  621.     DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
  622.     VGvddim( vdp, &slices, &columns, &rows );
  623.     DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
  624.  
  625.     Depth++; DepthArrow();
  626.     VGvd_drange( vdp, &low, &high );
  627.     DVPRINTF(where, "Range is %4.4g to %4.4g \n", low, high );
  628.     Depth--;
  629.     }
  630.   Depth--;
  631. }
  632.  
  633.  
  634. /*
  635.  *   DoIcon  --  prints information about an icon object.
  636.  */
  637. VOID DoIcon( object )
  638.   OBJECT object;
  639. {
  640.   OBJECT pixmap;
  641.  
  642.   VOicGet( object, V_IC_PIXMAP, &pixmap, V_IC_ATTR_ARGEND );
  643.   DoPixmap( pixmap );
  644. }
  645.  
  646. /*
  647.  *   DoImage  --  prints information about an image object.
  648.  */
  649. VOID DoImage( object )
  650.   OBJECT object;
  651. {
  652.   OBJECT pixmap;
  653.  
  654.   VOimGet( object, V_IM_PIXMAP, &pixmap, V_IM_ATTR_ARGEND );
  655.   DoPixmap( pixmap );
  656. }
  657.  
  658. /*
  659.  *   DoPixmap  --  prints information about an pixmap object.
  660.  */
  661. VOID DoPixmap( object )
  662.   OBJECT object;
  663. {
  664.   CHAR *source_filename;
  665.  
  666.   Depth++;
  667.   DepthArrow();
  668.   VOpmGet( object, V_PM_FILENAME, &source_filename, V_PM_ATTR_ARGEND );
  669.   DVPRINTF(where, "Pixmap source FILE:[%s] \n", source_filename );
  670.   Depth--;
  671.   }
  672.  
  673. /*
  674.  *   DoSubdrawing  --  prints whether the subdrawing's drawing is
  675.  *     included or referenced, the name of the file, and then checks
  676.  *     for color color dynamics.
  677.  */
  678. VOID DoSubdrawing( object )
  679.   OBJECT object;
  680. {
  681.   if ( VOsdDrKeep(object,2) )
  682.     DVPRINTF(where, "Included \n" );
  683.   else
  684.     DVPRINTF(where, "Referenced \n" );
  685.  
  686.   Depth++;
  687.   DepthArrow();
  688.   DVPRINTF(where, "(Initial) Source FILE:[%s] \n", VOsdFilename( object ) );
  689.   Depth--;
  690. }
  691.  
  692.  
  693. typedef struct
  694.   {
  695.   INT thresh;
  696.   OBJECT sd;
  697.   } TTABLE;
  698.  
  699.  
  700. /*
  701.  *   DoDynamicDrawing  --  prints whether all of the subdrawing's
  702.  *     drawings are included or referenced, then prints the information
  703.  *     about the variable that controls the dynamics, then prints out
  704.  *     the information in the subdrawing's threshold table.
  705.  */
  706. VOID DoDynamicDrawing( object )
  707.   OBJECT object;
  708. {
  709.   TTABLE *ttable;
  710.   INT i, size;
  711.   INT thresh;
  712.   OBJECT sd;
  713.   OBJECT vd_obj;
  714.   DSVAR dsv;
  715.   VARDESC vdp, VOvdAddress();
  716.   DOUBLE low, high;
  717.   FLOAT range, TTval();
  718.   FLOAT lowval, highval;
  719.   INT slices, columns, rows;
  720.  
  721.   size = VOttSize( object );
  722.   ttable = (TTABLE *) S_ALLOC( (size+1) * sizeof(TTABLE) );
  723.   for ( i=0; i<=size; i++ )
  724.     {
  725.     VOttGetThresh( object, i, &thresh, &sd );
  726.     ttable[i].thresh = thresh;
  727.     ttable[i].sd = sd;
  728.     }
  729.  
  730.   DVPRINTF(where, "All drawings are " );
  731.   if ( VOsdDrKeep( ttable[0].sd, 2 ) )
  732.     DVPRINTF(where, "Included \n" );
  733.   else
  734.     DVPRINTF(where, "Referenced \n" );
  735.  
  736.   Depth++;
  737.   
  738.   vd_obj = VOttVd( object );
  739.   vdp = VOvdAddress( vd_obj );
  740.   VGvd_drange( vdp, &low, &high );
  741.   range = high - low;
  742.  
  743.   DepthArrow();
  744.   dsv = TvdGetDataSourceVariable( vdp );
  745.   DVPRINTF(where, "Variable -- %-12s  ", TdsvGetName( dsv ) );
  746.   DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
  747.   VGvddim( vdp, &slices, &columns, &rows );
  748.   DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
  749.  
  750.   DepthArrow();
  751.   DVPRINTF(where, "Original drawing FILE:[%s]\n", VOsdFilename( ttable[0].sd ) );
  752.   lowval = low;
  753.   highval = TTval( ttable[1].thresh, low, range );
  754.   Depth++; DepthArrow();
  755.   DVPRINTF(where, "Range %6.4g to %6.4g \n", lowval, highval );
  756.   Depth--;
  757.   
  758.   for ( i=1; i<=size; i++ )
  759.     {
  760.     DepthArrow();
  761.     DVPRINTF(where, "Drawing #%d        FILE:[%s]\n", i, VOsdFilename(ttable[i].sd));
  762.     lowval = TTval( ttable[i].thresh, low, range );
  763.     if ( i == size )
  764.       highval = high;
  765.     else
  766.       highval = TTval( ttable[i+1].thresh, low, range );
  767.     Depth++; DepthArrow();
  768.     DVPRINTF(where, "Range %6.4g to %6.4g \n", lowval, highval );
  769.     Depth--;
  770.     }
  771.  
  772.   Depth--;
  773. }
  774.  
  775.  
  776. typedef struct 
  777.   {
  778.   DISPFORM *df;
  779.   CHAR name[40];
  780.   } DISPFORMS;
  781.  
  782. GLOBALREF DISPFORM 
  783.  VD3dsurface, VDanclock, VDbar, VDbarhoriz, VDbarline, VDbarpacked,
  784.  VDbarsolid, VDbox, VDcenter, VDcircle, VDclock, VDcprects, VDdial,
  785.  VDdial360, VDdigits, VDdrawing, VDface, VDfader, VDfan, VDflowfield,
  786.  VDhighlow, VDhilobar, VDhiloline, VDhistdial, VDimpulse, VDknob,
  787.  VDlegend, VDline, VDlinefill, VDmeter, VDmovedrawing, VDne_radial,
  788.  VDpie, VDpig, VDpoints, VDptsline, VDradial, VDrects, VDscatter,
  789.  VDsize, VDstrip, VDtext, VDtriangle, VDvector, VDweb;
  790. GLOBALREF  DISPFORM 
  791.   VD3d, VDbarpackedline, VDbarplstacked, VDbullseye, VDcolorbar,
  792.   VDcontour, VDcontroller, VDfcontour, VDhorizon, Dhorizon,
  793.   VDhorizcontroller, VDimpulseto0, VDindicator, VDlinedist,
  794.   VDlinefstacked, VDlinestacked, VDmultiyweb, VDpigdist, VDrtline,
  795.   VDrtstep, VDspectro, VDspectrointp, VDspectrointpstkd,
  796.   VDspectrostacked,  VDstep, VDstripras, VDstripstacked, VDvstrip,
  797.   VDvstrip_r, VDwaterfall, VDwaterfall_r;
  798.  
  799.  
  800. #define NUMDISPFORMS 75 
  801. DISPFORMS DispFormNames[NUMDISPFORMS];
  802.  
  803. VOID init_dispforms()
  804. {
  805.   S_STRCPY( DispFormNames[0].name, "Surface" );
  806.   DispFormNames[0].df = &VD3d;           
  807.   S_STRCPY( DispFormNames[1].name, "Surface " );
  808.   DispFormNames[1].df = &VD3dsurface;     
  809.   S_STRCPY( DispFormNames[2].name, "Analog Clock" );
  810.   DispFormNames[2].df = &VDanclock;       
  811.   S_STRCPY( DispFormNames[3].name, "Vertical Bar Chart" );
  812.   DispFormNames[3].df = &VDbar;           
  813.   S_STRCPY( DispFormNames[4].name, "Horizontal Bar Chart" );
  814.   DispFormNames[4].df = &VDbarhoriz;      
  815.   S_STRCPY( DispFormNames[5].name, "Bar-Line" );
  816.   DispFormNames[5].df = &VDbarline;      
  817.   S_STRCPY( DispFormNames[6].name, "Packed Bar" );
  818.   DispFormNames[6].df = &VDbarpacked;     
  819.   S_STRCPY( DispFormNames[7].name, "Packed Bar Line" );
  820.   DispFormNames[7].df = &VDbarpackedline; 
  821.   S_STRCPY( DispFormNames[8].name, "Pkd BarLine Stkd" );
  822.   DispFormNames[8].df = &VDbarplstacked; 
  823.   S_STRCPY( DispFormNames[9].name, "Solid Bar" );
  824.   DispFormNames[9].df = &VDbarsolid;     
  825.   S_STRCPY( DispFormNames[10].name, "Bullseye" );
  826.   DispFormNames[10].df = &VDbullseye;    
  827.   S_STRCPY( DispFormNames[11].name, "Box" );
  828.   DispFormNames[11].df = &VDbox;        
  829.   S_STRCPY( DispFormNames[12].name, "Centered Bar" );
  830.   DispFormNames[12].df = &VDcenter; 
  831.   S_STRCPY( DispFormNames[13].name, "Circle" );
  832.   DispFormNames[13].df = &VDcircle;   
  833.   S_STRCPY( DispFormNames[14].name, "Digital Clock" );
  834.   DispFormNames[14].df = &VDclock;       
  835.   S_STRCPY( DispFormNames[15].name, "Colorbar" );
  836.   DispFormNames[15].df = &VDcolorbar;    
  837.   S_STRCPY( DispFormNames[16].name, "Contour" );
  838.   DispFormNames[16].df = &VDcontour;   
  839.   S_STRCPY( DispFormNames[17].name, "Controller" );
  840.   DispFormNames[17].df = &VDcontroller;   
  841.   S_STRCPY( DispFormNames[18].name, "Packed Blocks" );
  842.   DispFormNames[18].df = &VDcprects;      
  843.   S_STRCPY( DispFormNames[19].name, "Dials" );
  844.   DispFormNames[19].df = &VDdial;        
  845.   S_STRCPY( DispFormNames[20].name, "Dial 360" );
  846.   DispFormNames[20].df = &VDdial360;     
  847.   S_STRCPY( DispFormNames[21].name, "Digits" );
  848.   DispFormNames[21].df = &VDdigits;      
  849.   S_STRCPY( DispFormNames[22].name, "Dynamic Drawing" );
  850.   DispFormNames[22].df = &VDdrawing;     
  851.   S_STRCPY( DispFormNames[23].name, "Faces" );
  852.   DispFormNames[23].df = &VDface;   
  853.   S_STRCPY( DispFormNames[24].name, "Fader" );
  854.   DispFormNames[24].df = &VDfader;       
  855.   S_STRCPY( DispFormNames[25].name, "Fans" );
  856.   DispFormNames[25].df = &VDfan;          
  857.   S_STRCPY( DispFormNames[26].name, "Filled Contour" );
  858.   DispFormNames[26].df = &VDfcontour;     
  859.   S_STRCPY( DispFormNames[27].name, "Flowfield" );
  860.   DispFormNames[27].df = &VDflowfield;
  861.   S_STRCPY( DispFormNames[28].name, "High Low" );
  862.   DispFormNames[28].df = &VDhighlow;    
  863.   S_STRCPY( DispFormNames[29].name, "Hi-Lo w/ Bar" );
  864.   DispFormNames[29].df = &VDhilobar;   
  865.   S_STRCPY( DispFormNames[30].name, "Hi-Lo w/ Line" );
  866.   DispFormNames[30].df = &VDhiloline;    
  867.   S_STRCPY( DispFormNames[31].name, "Hist. Dials" );
  868.   DispFormNames[31].df = &VDhistdial;   
  869.   S_STRCPY( DispFormNames[32].name, "Artificial Horizon" );
  870.   DispFormNames[32].df = &VDhorizon;      
  871.   S_STRCPY( DispFormNames[33].name, "Horiz Controller" );
  872.   DispFormNames[33].df = &VDhorizcontroller; 
  873.   S_STRCPY( DispFormNames[34].name, "Impulse" );
  874.   DispFormNames[34].df = &VDimpulse;      
  875.   S_STRCPY( DispFormNames[35].name, "Impulse To 0" );
  876.   DispFormNames[35].df = &VDimpulseto0;   
  877.   S_STRCPY( DispFormNames[36].name, "Indicator" );
  878.   DispFormNames[36].df = &VDindicator;    
  879.   S_STRCPY( DispFormNames[37].name, "Knob" );
  880.   DispFormNames[37].df = &VDknob;        
  881.   S_STRCPY( DispFormNames[38].name, "Legend" );
  882.   DispFormNames[38].df = &VDlegend;   
  883.   S_STRCPY( DispFormNames[39].name, "Line Graph" );
  884.   DispFormNames[39].df = &VDline;      
  885.   S_STRCPY( DispFormNames[40].name, "Filled Line Dist" );
  886.   DispFormNames[40].df = &VDlinedist;    
  887.   S_STRCPY( DispFormNames[41].name, "Filled Line" );
  888.   DispFormNames[41].df = &VDlinefill;     
  889.   S_STRCPY( DispFormNames[42].name, "Line Fill Stckd" );
  890.   DispFormNames[42].df = &VDlinefstacked; 
  891.   S_STRCPY( DispFormNames[43].name, "Line Stacked" );
  892.   DispFormNames[43].df = &VDlinestacked;  
  893.   S_STRCPY( DispFormNames[44].name, "Meter" );
  894.   DispFormNames[44].df = &VDmeter;  
  895.   S_STRCPY( DispFormNames[45].name, "Moving Drawing" );
  896.   DispFormNames[45].df = &VDmovedrawing;  
  897.   S_STRCPY( DispFormNames[46].name, "Multy-Y Web" );
  898.   DispFormNames[46].df = &VDmultiyweb;  
  899.   S_STRCPY( DispFormNames[47].name, "Radial No Erase" );
  900.   DispFormNames[47].df = &VDne_radial;   
  901.   S_STRCPY( DispFormNames[48].name, "Pie Chart" );
  902.   DispFormNames[48].df = &VDpie;
  903.   S_STRCPY( DispFormNames[49].name, "Piggyback Bar" );
  904.   DispFormNames[49].df = &VDpig;  
  905.   S_STRCPY( DispFormNames[50].name, "Piggyback Dist" );
  906.   DispFormNames[50].df = &VDpigdist;
  907.   S_STRCPY( DispFormNames[51].name, "Points" );
  908.   DispFormNames[51].df = &VDpoints;
  909.   S_STRCPY( DispFormNames[52].name, "Points w/ Line" );
  910.   DispFormNames[52].df = &VDptsline;    
  911.   S_STRCPY( DispFormNames[53].name, "Radial" );
  912.   DispFormNames[53].df = &VDradial;   
  913.   S_STRCPY( DispFormNames[54].name, "Blocks" );
  914.   DispFormNames[54].df = &VDrects;    
  915.   S_STRCPY( DispFormNames[55].name, "Realtime Line Graph" );
  916.   DispFormNames[55].df = &VDrtline;    
  917.   S_STRCPY( DispFormNames[56].name, "Realtime Step Graph" );
  918.   DispFormNames[56].df = &VDrtstep;      
  919.   S_STRCPY( DispFormNames[57].name, "Scatter" );
  920.   DispFormNames[57].df = &VDscatter;     
  921.   S_STRCPY( DispFormNames[58].name, "Size" );
  922.   DispFormNames[58].df = &VDsize; 
  923.   S_STRCPY( DispFormNames[59].name, "Spectrogram" );
  924.   DispFormNames[59].df = &VDspectro;     
  925.   S_STRCPY( DispFormNames[60].name, "Smooth Spectro" );
  926.   DispFormNames[60].df = &VDspectrointp;  
  927.   S_STRCPY( DispFormNames[61].name, "Smth Spectro Stkd" );
  928.   DispFormNames[61].df = &VDspectrointpstkd;
  929.   S_STRCPY( DispFormNames[62].name, "Spectro Stacked" );
  930.   DispFormNames[62].df = &VDspectrostacked;  
  931.   S_STRCPY( DispFormNames[63].name, "Step Graph" );
  932.   DispFormNames[63].df = &VDstep;     
  933.   S_STRCPY( DispFormNames[64].name, "Strip Chart" );
  934.   DispFormNames[64].df = &VDstrip;      
  935.   S_STRCPY( DispFormNames[65].name, "Raster Strip" );
  936.   DispFormNames[65].df = &VDstripras;     
  937.   S_STRCPY( DispFormNames[66].name, "Strip Stkd" );
  938.   DispFormNames[66].df = &VDstripstacked;  
  939.   S_STRCPY( DispFormNames[67].name, "Text" );
  940.   DispFormNames[67].df = &VDtext;         
  941.   S_STRCPY( DispFormNames[68].name, "Triangle" );
  942.   DispFormNames[68].df = &VDtriangle;    
  943.   S_STRCPY( DispFormNames[69].name, "Vector" );
  944.   DispFormNames[69].df = &VDvector;       
  945.   S_STRCPY( DispFormNames[70].name, "Vert Strip" );
  946.   DispFormNames[70].df = &VDvstrip;       
  947.   S_STRCPY( DispFormNames[71].name, "Raster Vert Strip" );
  948.   DispFormNames[71].df = &VDvstrip_r;     
  949.   S_STRCPY( DispFormNames[72].name, "Waterfall" );
  950.   DispFormNames[72].df = &VDwaterfall;     
  951.   S_STRCPY( DispFormNames[73].name, "Raster Waterfall" );
  952.   DispFormNames[73].df = &VDwaterfall_r;  
  953.   S_STRCPY( DispFormNames[74].name, "Web Chart" );
  954.   DispFormNames[74].df = &VDweb;           
  955. }
  956.  
  957.  
  958.  
  959. /*
  960.  *   GetDispFormName  --  returns the name of the display formatter by
  961.  *     searching the list for the correct DISPFORM.
  962.  */
  963. CHAR *GetDispFormName( df )
  964.   DISPFORM df;
  965. {
  966.   INT i;
  967.  
  968.   for ( i = 0; i < NUMDISPFORMS; i++ )
  969.     if ( *DispFormNames[i].df == df )
  970.       return DispFormNames[i].name;
  971.  
  972.   return NULL;
  973. }
  974.  
  975.  
  976. typedef struct 
  977.   {
  978.   INHANDLER *df;
  979.   CHAR name[40];
  980.   } INHANDLERS;
  981.  
  982. GLOBALREF INHANDLER
  983.   VNbutton, /*VNcheck,*/ VNchecklist, /*VNcombine,*/ VNcombiner,
  984.   VNmenu, VNmultiplexor, VNobjchecklist, VNobjmenu, VNobjtoggle, VNpalette,
  985.   VNscrollbar, VNslider, VNslider2D, VNtext, VNtextedit, VNtoggle;
  986. GLOBALREF INHANDLER
  987.   VNmcheck, VNmmenu,  VNmradio,VNmslider,VNmtext,VNmtoggle,
  988.   VNolcheck, VNolmenu,  VNolradio,VNolslider,VNoltext,VNoltoggle,
  989.   VNwcheck, VNwmenu,  VNwradio,VNwslider,VNwtext,VNwtoggle;
  990.  
  991.  
  992. #define NUMINHANDLERS 32
  993. INHANDLERS InHandlerNames[NUMINHANDLERS];
  994.  
  995. VOID init_inhandlers()
  996. {
  997.   S_STRCPY( InHandlerNames[0].name, "Button" );
  998.   InHandlerNames[0].df = &VNbutton;         
  999.   S_STRCPY( InHandlerNames[1].name, "Checklist" );
  1000.   InHandlerNames[1].df = &VNchecklist;    
  1001.   S_STRCPY( InHandlerNames[2].name, "Combiner" );
  1002.   InHandlerNames[2].df = &VNcombiner;     
  1003.   S_STRCPY( InHandlerNames[3].name, "Menu" );
  1004.   InHandlerNames[3].df = &VNmenu;        
  1005.   S_STRCPY( InHandlerNames[4].name, "Multiplexor" );
  1006.   InHandlerNames[4].df = &VNmultiplexor;  
  1007.   S_STRCPY( InHandlerNames[5].name, "Object Checklist" );
  1008.   InHandlerNames[5].df = &VNobjchecklist;     
  1009.   S_STRCPY( InHandlerNames[6].name, "Object Menu" );
  1010.   InHandlerNames[6].df = &VNobjmenu;      
  1011.   S_STRCPY( InHandlerNames[7].name, "Object Toggle" );
  1012.   InHandlerNames[7].df = &VNobjtoggle;      
  1013.   S_STRCPY( InHandlerNames[8].name, "Palette" );
  1014.   InHandlerNames[8].df = &VNpalette; 
  1015.   S_STRCPY( InHandlerNames[9].name, "Scrollbar" );
  1016.   InHandlerNames[9].df = &VNscrollbar;           
  1017.   S_STRCPY( InHandlerNames[10].name, "Slider" );
  1018.   InHandlerNames[10].df = &VNslider;       
  1019.   S_STRCPY( InHandlerNames[11].name, "2D slider" );
  1020.   InHandlerNames[11].df = &VNslider2D;
  1021.   S_STRCPY( InHandlerNames[12].name, "Text Input" );
  1022.   InHandlerNames[12].df = &VNtext;            
  1023.   S_STRCPY( InHandlerNames[13].name, "Text Edit" );
  1024.   InHandlerNames[13].df = &VNtextedit;         
  1025.   S_STRCPY( InHandlerNames[14].name, "Toggle" );
  1026.   InHandlerNames[14].df = &VNtoggle;       
  1027.   S_STRCPY( InHandlerNames[15].name, "Motif Checklist" );
  1028.   InHandlerNames[15].df = &VNmcheck;       
  1029.   S_STRCPY( InHandlerNames[16].name,     "Motif Menu" );
  1030.   InHandlerNames[16].df = &VNmmenu;       
  1031.   S_STRCPY( InHandlerNames[17].name, "Motif Radio" );
  1032.   InHandlerNames[17].df = &VNmradio;       
  1033.   S_STRCPY( InHandlerNames[18].name, "Motif Slider" );
  1034.   InHandlerNames[18].df = &VNmslider; 
  1035.   S_STRCPY( InHandlerNames[19].name, "Motif Text Intput" );
  1036.   InHandlerNames[19].df = &VNmtext; 
  1037.   S_STRCPY( InHandlerNames[20].name, "Motif Toggle" );
  1038.   InHandlerNames[20].df = &VNmtoggle;           
  1039.   S_STRCPY( InHandlerNames[21].name, "Widget Checklist" );
  1040.   InHandlerNames[21].df = &VNwcheck;  
  1041.   S_STRCPY( InHandlerNames[22].name, "Widget Menu" );
  1042.   InHandlerNames[22].df = &VNwmenu;           
  1043.   S_STRCPY( InHandlerNames[23].name, "Widget Radio" );
  1044.   InHandlerNames[23].df = &VNwradio; 
  1045.   S_STRCPY( InHandlerNames[24].name, "Widget Slider" );
  1046.   InHandlerNames[24].df = &VNwslider;           
  1047.   S_STRCPY( InHandlerNames[25].name, "Widget Text Intput" );
  1048.   InHandlerNames[25].df = &VNwtext; 
  1049.   S_STRCPY( InHandlerNames[26].name, "Open Look Checklist" );
  1050.   InHandlerNames[26].df = &VNolcheck;       
  1051.   S_STRCPY( InHandlerNames[27].name, "Open Look Menu" );
  1052.   InHandlerNames[27].df = &VNolmenu;
  1053.   S_STRCPY( InHandlerNames[28].name, "Open Look Radio" );
  1054.   InHandlerNames[28].df = &VNolradio;           
  1055.   S_STRCPY( InHandlerNames[29].name, "Open Look Slider" );
  1056.   InHandlerNames[29].df = &VNolslider;       
  1057.   S_STRCPY( InHandlerNames[30].name, "Open Look Text Intput" );
  1058.   InHandlerNames[30].df = &VNoltext;       
  1059.   S_STRCPY( InHandlerNames[31].name, "Open Look Toggle" );
  1060.   InHandlerNames[31].df = &VNoltoggle;       
  1061. }
  1062.  
  1063.  
  1064.  
  1065. /*
  1066.  *   GetInHandlerName  --  returns the name of the input technique by
  1067.  *     searching the list for the correct INHANDLER.
  1068.  */
  1069. CHAR *GetInHandlerName( df )
  1070.   INHANDLER df;
  1071. {
  1072.   INT i;
  1073.  
  1074.   for ( i = 0; i < NUMINHANDLERS; i++ )
  1075.     if ( *InHandlerNames[i].df == df )
  1076.       return InHandlerNames[i].name;
  1077.  
  1078.   return NULL;
  1079. }
  1080.  
  1081.  
  1082. typedef struct { UBYTE red, green, blue; } DEFAULT_COLOR;
  1083.  
  1084. LOCAL DEFAULT_COLOR LocalLut[16] =
  1085.   {
  1086.     0,  0,  0, /* black */
  1087.   255,255,255, /* white */
  1088.   255,  0,  0, /* red */
  1089.     0,255,  0, /* green */
  1090.     0,  0,255, /* blue */
  1091.   255,255,  0, /* yellow */
  1092.   255,  0,255, /* magenta */
  1093.     0,255,255, /* cyan */
  1094.   128,128,128, /* medium grey */
  1095.   184,184,184, /* light grey */
  1096.   128,  0,  0, /* dark red */
  1097.     0,128,  0, /* dark green */
  1098.     0,  0,128, /* dark blue */
  1099.   128,128,  0, /* dark yellow */
  1100.   128,  0,128, /* dark magenta */
  1101.     0,128,128  /* dark cyan */
  1102.   };
  1103.  
  1104.  
  1105. LOCAL CHAR *ColorStrings[16] =
  1106.   {
  1107.     "Black", "White", "Red", "Green", "Blue", "Yellow", "Magenta",
  1108.     "Cyan", "Medium Grey", "Light Grey", "Dark Red", "Dark Green",
  1109.     "Dark Blue", "Dark Yellow", "Dark Magenta", "Dark Cyan"
  1110.   };
  1111.  
  1112.  
  1113. /*
  1114.  *   ClosestColor  --  searchs the local color table for an rgb value
  1115.  *     that matches the input values.  Prints the values and the name
  1116.  *     of the color if it finds an exact match.  Otherwise, it looks
  1117.  *     for the closest color in rgb space and prints the values and the
  1118.  *     color name.
  1119.  */ 
  1120. VOID ClosestColor( r, g, b ) 
  1121.   INT r, g, b;
  1122.   {
  1123.   FAST LONG i, score;
  1124.   LONG j, bestscore, bestindex, tablen;
  1125.   FAST DEFAULT_COLOR *tabptr;
  1126.  
  1127.   tabptr = &LocalLut[0];
  1128.   tablen = 16;
  1129.   for( i=0; i<tablen; i++, tabptr++ )
  1130.     if( tabptr->red == r && tabptr->green == g && tabptr->blue == b )
  1131.       {
  1132.       DVPRINTF(where, "%s!", ColorStrings[i] );
  1133.       return;
  1134.       }
  1135.  
  1136.   bestscore = (1<<18); /* Worse than worst possible score */
  1137.   tabptr = &LocalLut[0];
  1138.   for( j=0; j<tablen; j++, tabptr++ )
  1139.     {
  1140.     i = tabptr->red - r;
  1141.     score = i * i;
  1142.     if( score < bestscore )
  1143.       {
  1144.       i = tabptr->green - g;
  1145.       score += ( i * i );
  1146.       if( score < bestscore )
  1147.     {
  1148.     i = tabptr->blue - b;
  1149.     score += ( i * i );
  1150.     if( score < bestscore )
  1151.       { bestscore = score; bestindex = j; }
  1152.     }
  1153.       }
  1154.     }
  1155.   DVPRINTF(where, "%s?", ColorStrings[bestindex] );
  1156.   return;
  1157.   }
  1158.  
  1159.  
  1160. /*
  1161.  *   TTval  --  translates the normalized value in a threshold table to
  1162.  *     an actual value based on a low value and a range.
  1163.  */
  1164. FLOAT TTval( thresh, low, range )
  1165.   INT thresh;
  1166.   DOUBLE low;
  1167.   FLOAT range;
  1168. {
  1169.   return ( low + ( (FLOAT)thresh/32767.0) * range );
  1170. }
  1171.  
  1172.  
  1173. VOID DepthArrow()
  1174. {
  1175.   INT i;
  1176.  
  1177.   for ( i=0; i<Depth*4; i++ )
  1178.     DVPRINTF(where, "-" );
  1179.   DVPRINTF(where, "> " );
  1180. }
  1181.  
  1182. /*ARGSUSED*/
  1183. ADDRESS GetFirstVdp( vd_obj, vdp, args )
  1184.   OBJECT vd_obj;
  1185.   VARDESC vdp;
  1186.   ADDRESS args;
  1187. {
  1188.   return vdp;
  1189. }
  1190.  
  1191.