home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char SccsId[] = "@(#)ViewDump.c V1.9 1/19/93";
- #endif
- /* ====================================================================
- ViewDump - Dump contents of a view in human readable form
- --------------------------------------------------------------------
- SYNOPSIS
- ViewDump <viewfile> <outputfile>
- DESCRIPTION
- This program examines a viewfile and prints out its notable
- contents. There are two major sections of output, the datasource
- section and the drawing objects section. The datasource section
- contains information about each datasource variable of each
- datasource in the datasource list. The drawing object section
- contains pertinent information about selected objects and
- subobjects. An object is described if it falls into one of the
- following categories:
-
- o It is a drawing
- o It is a subdrawing, image or icon
- o It is a graph
- o It is a named object
- o It has dynamics
-
- HISTORY
- 29-Jul-91 RBW Created this file based on ViewDump utility
- 29-Jul-91 RBW Added missing message for Non-Dynamic Drawings
- 30-Jul-91 RBW removed 12 char limit to object name output
- 30-Jul-91 RBW Added output of value of text/vector text objects
- 31-Jul-91 RBW Added output of some 8.0 dynamics
- 1-Aug-91 RBW Standardized output of filenames to facilitate "grep"s
- 20-Jan-93 CJH Added new graphs & input types
- ================================================================= */
-
- #include "std.h"
- #include "dvstd.h"
- #include "dvtools.h"
- #include "Tfundecl.h"
- #include "VOstd.h"
- #include "vofundecl.h"
- #include "vgfundecl.h"
- #include "dvGR.h"
-
- typedef void (*ProcPtr)(); /* pointer to a procedure */
-
- #define DVPRINTF fprintf
- FILE *where;
-
- LOCAL CHAR result[80];
- LOCAL INT Depth = 0;
- DRAWING_OBJECT drawing;
-
- VOID DepthArrow();
- VOID DoDatagroup();
- VOID DoInputobject();
- VOID CheckColorDynamics();
- VOID DoIcon();
- VOID DoImage();
- VOID DoPixmap();
- VOID DoSubdrawing();
- VOID DoDynamicDrawing();
- ADDRESS ExamDataSource(ADDRESS,ADDRESS), ExamObject(OBJECT,ADDRESS);
- VOID init_dispforms();
- VOID init_inhandlers();
-
-
-
- /*ARGSUSED*/
- VOID NoDetails( object ) OBJECT object; { DVPRINTF(where,"\n");}
-
- /*==============================================================*/
- /* Table of Post 7.0 Dynamics */
- /*==============================================================*/
- struct
- {
- int action_flag; /* DVtools action flag constant */
- char *name; /* name of dynamic type */
- BOOL multiple_allowed; /* can object have more than 1 */
- ProcPtr print_details; /* routine to print details */
- }
- DynamicType[] =
- {
- V_DYN_VISIBILITY, "VISIBILITY", NO, NoDetails,
- V_DYN_TEXT, "TEXT", NO, NoDetails,
- V_DYN_SUBDRAWING, "SUBDRAWING", NO, DoDynamicDrawing,
- V_DYN_ROTATE, "ROTATION", YES, NoDetails,
- V_DYN_REL_MOVE_X, "Rel X Move", YES, NoDetails,
- V_DYN_REL_MOVE_Y, "Rel Y Move", YES, NoDetails,
- V_DYN_PATH_MOVE, "Path Move", NO, NoDetails,
- V_DYN_ABS_MOVE_X, "Abs X Move", NO, NoDetails,
- V_DYN_ABS_MOVE_Y, "Abs Y Move", NO, NoDetails,
- V_DYN_FILL_DOWN, "Fill Down", NO, NoDetails,
- V_DYN_FILL_UP, "Fill Up", NO, NoDetails,
- V_DYN_FILL_LEFT, "Fill Left", NO, NoDetails,
- V_DYN_FILL_RIGHT, "Fill Right", NO, NoDetails,
- V_DYN_SCALE, "SCALE", YES, NoDetails,
- V_DYN_SCALE_X, "SCALE X", YES, NoDetails,
- V_DYN_SCALE_Y, "SCALE Y", YES, NoDetails,
- TEXT_POSITION, "TEXT POSITION", NO, NoDetails,
- TEXT_CHARSPACE, "TEXT CHARSPACE", NO, NoDetails,
- TEXT_DIRECTION, "TEXT DIRECTION", NO, NoDetails,
- TEXT_FONTNAME, "TEXT FONTNAME", NO, NoDetails,
- TEXT_LINESPACE, "TEXT LINESPACE", NO, NoDetails,
- TEXT_WIDTH, "TEXT WIDTH", NO, NoDetails,
- TEXT_SLANT, "TEXT SLANT", NO, NoDetails,
- TEXT_NAME, "TEXT NAME", NO, NoDetails,
- TEXT_ANGLE, "TEXT ANGLE", NO, NoDetails,
- TEXT_FONT, "TEXT FONT", NO, NoDetails,
- TEXT_HEIGHT, "TEXT HEIGHT", NO, NoDetails,
- TEXT_SIZE, "TEXT SIZE", NO, NoDetails,
- FILL_STATUS, "FILL STATUS", NO, NoDetails,
- LINE_TYPE, "LINE TYPE", NO, NoDetails,
- LINE_WIDTH, "LINE WIDTH", NO, NoDetails,
- CURVE_TYPE, "CURVE TYPE", NO, NoDetails,
- FOREGROUND_COLOR, "FORECOLOR", NO, NoDetails,
- BACKGROUND_COLOR, "BACKCOLOR", NO, NoDetails,
- 0, NULL, NO, NULL
- };
- /*=============================================================*/
-
- #define DYNAMIC(N) VOdyGetDataObj(dy,DynamicType[i].action_flag,N)
-
- /*-------------------------------------------------------------------------
- ** Check80Dynamics -- checks an object for 8.0 style dynamics. If
- ** yes, then print out information about each dynamic action.
- **-------------------------------------------------------------------------
- */
- VOID Check80Dynamics( object )
- OBJECT object;
- {
- OBJECT dy = VOobDyGet(object), dyno;
- int i,j;
-
- if (dy == (OBJECT)NULL) return;
- Depth++;
-
- for (i=0; DynamicType[i].name; ++i)
- for (j=1; dyno=DYNAMIC(j); ++j)
- {
- DepthArrow();
- DVPRINTF(where,"post 7.0 %s Dynamics #%d ",DynamicType[i].name, j);
- if( DynamicType[i].print_details )
- (*DynamicType[i].print_details)(dyno);
- if (!DynamicType[i].multiple_allowed) break;
- }
-
- --Depth;
- }
-
-
- /*=========================================================================
- * MAIN PROGRAM
- */
- main( argc, argv )
- INT argc;
- CHAR *argv[];
- {
- VIEW view;
- DATASOURCELIST dsl;
-
- /*
- * Check for the correct number of arguements.
- */
- {
- DWORD system;
- FILE *outputfile;
-
- if ( argc == 3 )
- {
-
-
- outputfile = fopen( argv[2],"wt");
- if ( outputfile == NULL )
- {
- Beep( 100,100);
- exit(-1);
- }
- where = outputfile;
- }
- else
- {
- system = GetVersion();
- system = HIWORD(system);
- if ( ( system & 0xF000 ) )
- {
- /* not an NT system */
- outputfile = fopen( "viewdump.out","wt");
- if ( outputfile == NULL )
- {
- Beep( 100,100);
- exit(-1);
- }
- where = outputfile;
- }
- else
- where = stdout;
- }
- }
- if ( ( argc < 2 ) || ( argc > 3 ) )
- {
- DVPRINTF(where, "Usage: %s <viewfile> [outputfile] \n", argv[0] );
- #if 0
- exit( EXIT_ERR );
- #endif
- }
-
-
-
- DVPRINTF(where,">>>>>>>>>>>>>>>>>>>>> ViewDump: processing FILE:[%s]...\n",argv[1]);
- /* Finish initializing display formatter table */
- init_dispforms();
- init_inhandlers();
-
-
- /*
- * Initialize DV-Tools, load the view and gets its drawing
- * and datasource list.
- */
- TInit( (CHAR *)NULL, /* Use DVPATH config var */
- (CHAR *)NULL );
- if ( ! ( view = TviLoad( argv[1] ) ) )
- {
- DVPRINTF(where, "Could not load FILE:[%s] as view.\n", argv[1] );
- TTerminate();
- exit( EXIT_ERR );
- }
- dsl = TviGetDataSourceList( view );
- drawing = TviGetDrawing( view );
-
- /*
- * Print the information on datasources and the information on
- * all of the drawing objects.
- */
- DVPRINTF(where, "=================> DataSources \n" );
- TdlForEachDataSource( dsl, ExamDataSource, (ADDRESS)NULL );
- DVPRINTF(where, "\n" );
- DVPRINTF(where, "=================> Drawing Objects \n" );
- TobForEachSubobject( drawing, ExamObject, (ADDRESS)NULL );
-
- /*
- * Terminate DV-Tools.
- */
- TTerminate();
- return EXIT_OK;
- }
-
-
- /*
- * ExamDataSource -- prints the name of the data source and
- * examines each datasource variable in the datasource.
- */
- /*ARGSUSED*/
- ADDRESS ExamDataSource( datasource, args )
- DATASOURCE datasource;
- ADDRESS args;
- {
- ADDRESS ExamDsv(DSVAR,ADDRESS);
-
- DVPRINTF(where, "---> %s \n", TdsGetName( datasource ) );
- TdsForEachVar( datasource, ExamDsv, (ADDRESS)NULL );
- return NULL;
- }
-
-
- /*
- * ExamDsv -- prints the name, type, and shape(size) of a
- * datasource variable.
- */
- /*ARGSUSED*/
- ADDRESS ExamDsv( dsvar, args )
- DSVAR dsvar;
- ADDRESS args;
- {
- CHAR *GetVarType(), *GetVarSize();
- INT rows, columns;
-
- DVPRINTF(where, "-----> %-20s ", TdsvGetName( dsvar ) );
- DVPRINTF(where, "%s ", GetVarType( TdsvGetType( dsvar ) ) );
- TdsvGetSize( dsvar, &rows, &columns );
- DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
- return NULL;
- }
-
-
- /*
- * GetVarType -- returns a string containing the expanded name
- * corresponding to a type number.
- */
- CHAR *GetVarType( type )
- INT type;
- {
- switch ( type )
- {
- case V_C_TYPE: return "CHAR ";
- case V_UC_TYPE: return "UNSGN CHAR ";
- case V_S_TYPE: return "SHORT ";
- case V_US_TYPE: return "UNSGN SHORT ";
- case V_I_TYPE: return "INTEGER ";
- case V_UI_TYPE: return "UNSGN INT ";
- case V_F_TYPE: return "FLOAT ";
- case V_D_TYPE: return "DOUBLE ";
- case V_T_TYPE: return "TEXT STRING ";
- default: return "???? ";
- }
- }
-
- /*
- * GetVarSize -- sets up a string(global) containing the shape and
- * size according to the number of rows and columns.
- */
- CHAR *GetVarSize( rows, columns )
- INT rows;
- INT columns;
- {
- if ( rows == 1 && columns == 1 )
- return "Scalar";
-
- if ( rows == 1 )
- {
- sprintf( result, "Column Vector ( %3d )", columns );
- return result;
- }
-
- if ( columns == 1 )
- {
- sprintf( result, "Row Vector ( %3d )", rows );
- return result;
- }
-
- sprintf( result, "Matrix ( %3d X %3d )", rows, columns );
- return result;
- }
-
-
- /*
- * ExamObject -- for each notable object (see ObjectNotable() ),
- * prints the name and type dependent information of an object.
- */
- /*ARGSUSED*/
- ADDRESS ExamObject( object, args )
- OBJECT object;
- ADDRESS args;
- {
- VOID PeruseObject();
- BOOL ObjectNotable();
- CHAR *name, *VOdrGetName();
-
- if ( ! ObjectNotable(object)) return NULL;
-
- Depth++;
- DepthArrow();
-
- if (name=VOdrGetName(drawing,object))
- DVPRINTF(where, "%-12s ", name );
- else
- DVPRINTF(where, "%-12s ", "NO NAME" );
-
- PeruseObject( object );
- DVPRINTF(where, "\n" );
-
- Depth--;
-
- return NULL;
- }
-
-
- /*
- * PeruseObject -- checks the type of and object and prints out
- * the type of the object and any object specific information.
- */
- VOID PeruseObject( object )
- OBJECT object;
- {
- INT type;
-
- type = VOobType( object );
- if ( type != OT_DG && type != OT_INPUT && type != OT_THRESHTABLE )
- {
- switch ( type )
- {
- case OT_ARC:
- DVPRINTF(where, "ARC \n" );
- break;
- case OT_CIRCLE:
- DVPRINTF(where, "CIRCLE \n" );
- break;
- case OT_ICON:
- DVPRINTF(where, "ICON \n");
- DoIcon( object );
- break;
- case OT_IMAGE:
- DVPRINTF(where, "IMAGE \n");
- DoImage( object );
- break;
- case OT_LINE:
- DVPRINTF(where, "LINE \n" );
- break;
- case OT_POLYGON:
- DVPRINTF(where, "POLYGON \n" );
- break;
- case OT_ELLIPSE:
- DVPRINTF(where, "ELLIPSE \n" );
- break;
- case OT_RECTANGLE:
- DVPRINTF(where, "RECTANGLE \n" );
- break;
- case OT_TEXT:
- DVPRINTF(where, "TEXT \"%s\"\n", VOtxGetString(object));
- break;
- case OT_VTEXT:
- DVPRINTF(where,"VECTOR TEXT \"%s\"\n", VOvtGetString(object));
- break;
- case OT_DRAWING:
- DVPRINTF(where, "DRAWING (?!) \n" );
- break;
- case OT_SUBDRAWING:
- DVPRINTF(where, "SUBDRAWING " );
- DoSubdrawing( object );
- break;
- default: /* probably a non-graphical object */
- DVPRINTF(where,"*** unknown object type [%n] in peruse ***\n", type);
- break;
- }
-
- CheckColorDynamics( object );
- Check80Dynamics( object );
- }
- else
- switch ( type )
- {
- case OT_DG:
- DVPRINTF(where, "GRAPH " );
- DoDatagroup( object );
- break;
- case OT_INPUT:
- DVPRINTF(where, "INPUT OBJECT " );
- DoInputobject( object );
- break;
- case OT_THRESHTABLE:
- DVPRINTF(where, "pre 8.0 DYNAMIC DRAWING " );
- DoDynamicDrawing( object );
- break;
- }
- }
-
-
- /*
- * ObjectNotable -- decides whether or not an object is worth the
- * effort of perusing. An object is notable if at least one of the
- * following conditions apply:
- *
- * o It is a named object
- * o It is a drawing object
- * o It is a subdrawing, icon, or image object
- * o It is a datagroup object (graph)
- * o It is a dynamic object (color or drawing)
- */
- BOOL ObjectNotable( object )
- OBJECT object;
- {
- INT type;
-
- if ( VOdrGetName( drawing, object ) ) return YES;
- type = VOobType( object );
- if ( type == OT_DRAWING ) return YES;
- if ( type == OT_SUBDRAWING ) return YES;
- if ( type == OT_ICON ) return YES;
- if ( type == OT_IMAGE ) return YES;
- if ( type == OT_DG ) return YES;
- if ( type == OT_THRESHTABLE ) return YES; /* Dynamic drawing subdrawing */
- if ( type == OT_VD ) return YES; /* Dynamic color object */
- if ( VOuIsDynamic( object ) ) return YES; /* All other dynamic types */
- if ( VOobDyGet( object ) != (OBJECT)NULL )
- {
- DVPRINTF(where,"*** 8.0 dynamics found, but not by VOuIsDynamic ***\n");
- return YES;
- }
- return NO;
- }
-
-
- /*--------------------------------------------------------------------------
- * CheckColorDynamics -- checks an object for color dynamics. If
- * yes, then print out information about the variable that
- * determines the color dynamics, and each segment of the threshold
- * table.
- */
- VOID CheckColorDynamics( object )
- OBJECT object;
- {
- VOID ClosestColor();
- VARDESC vdp, GetFirstVdp(OBJECT,VARDESC,ADDRESS);
- DSVAR dsv;
- DOUBLE low, high;
- COLOR_THRESHOLD *ctp;
- INT num_colors, i;
- FLOAT lowval, highval, range, TTval();
- INT red, green, blue;
- INT slices, columns, rows;
-
- if (! VOuHasColorDynamics(object)) return;
-
- /*
- * Get the variable descriptor and the datasource variable it
- * points to.
- */
- vdp = TobForEachVdp( object, GetFirstVdp, (ADDRESS)NULL );
- dsv = TvdGetDataSourceVariable( vdp );
-
- Depth++;
- DepthArrow();
- DVPRINTF(where, "pre 8.0 Color Dynamics -- %-12s ", TdsvGetName( dsv ) );
- DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
- VGvddim( vdp, &slices, &columns, &rows );
- DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
-
- /*
- * Go through each entry in the threshold table, printing the
- * threshold value (based on the range of the variable) and
- * the rgb value of the color corresponding to that value.
- */
- VGvd_drange( vdp, &low, &high );
- range = high - low;
- VGvdctt( vdp, &num_colors, &ctp );
- for ( i=0; i<num_colors; i++)
- {
- if ( i == 0 )
- lowval = low;
- else
- lowval = TTval( ctp[i-1].upperlimit, low, range );
- if ( i == num_colors - 1 )
- highval = high;
- else
- highval = TTval( ctp[i].upperlimit, low, range );
- Depth++; DepthArrow();
- DVPRINTF(where, "Range %6.4g to %6.4g -- ", lowval, highval );
-
- red = ctp[i].threshcolor.rgb_rep.red;
- green = ctp[i].threshcolor.rgb_rep.green;
- blue = ctp[i].threshcolor.rgb_rep.blue;
- DVPRINTF(where, "%.3d %.3d %.3d ", red, green, blue );
- ClosestColor( red, green, blue );
- DVPRINTF(where, "\n" );
- Depth--;
- }
-
- Depth--;
- }
-
-
- /*
- * DoDatagroup -- prints the type of the graph, and the name, type,
- * and shape of each variable attached to the datagroup.
- */
- VOID DoDatagroup( object )
- OBJECT object;
- {
- DATAGROUP dgp, VOdgAddress();
- VARDESC vdp, VGvdget();
- DSVAR dsvar;
- INT i;
- CHAR *fmtname, *GetDispFormName();
- DOUBLE low, high;
- INT slices, rows, columns;
-
- dgp = VOdgAddress( object );
- fmtname = GetDispFormName( VGdgdf( dgp ) );
- DVPRINTF(where, "\"%s\" \n", fmtname ? fmtname : "UNKNOWN DISPFORM" );
-
- Depth++;
- for ( i=1; i<=(INT)VGvdget( dgp, 0 ); i++ )
- {
- DepthArrow();
- DVPRINTF(where, "Variable #%.2d -- ", i );
- vdp = VGvdget( dgp, i );
- dsvar = TvdGetDataSourceVariable( vdp );
- DVPRINTF(where, "%-12s ", TdsvGetName( dsvar ) );
- DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
- VGvddim( vdp, &slices, &columns, &rows );
- DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
-
- Depth++; DepthArrow();
- VGvd_drange( vdp, &low, &high );
- DVPRINTF(where, "Range is %4.4g to %4.4g \n", low, high );
- Depth--;
- }
- Depth--;
- }
-
- /*
- * DoInputobject -- prints the type of the input object, and the
- * name, type, and shape of each variable attached to the object.
- */
- VOID DoInputobject( input )
- OBJECT input;
- {
- OBJECT intech;
- ADDRESS *VarList;
- INT NumVars;
-
- VARDESC vdp, VGvdget();
- DSVAR dsvar;
- INT i;
- CHAR *fmtname, *GetInHandlerName();
- DOUBLE low, high;
- INT slices, rows, columns;
-
- intech = VOinTechnique( input, DONT_SET_THE_VALUE );
- fmtname = GetInHandlerName( VOitGetInteraction( intech ) );
- DVPRINTF(where, "\"%s\" \n", fmtname ? fmtname : "UNKNOWN INHANDLER" );
-
- Depth++;
- VOinGetVarList( input, &VarList, &NumVars );
- for ( i=0; i<NumVars; i++ )
- {
- DepthArrow();
- DVPRINTF(where, "Variable #%.2d -- ", i+1 );
- vdp = (VARDESC)VarList[i];
- dsvar = TvdGetDataSourceVariable( vdp );
- DVPRINTF(where, "%-12s ", TdsvGetName( dsvar ) );
- DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
- VGvddim( vdp, &slices, &columns, &rows );
- DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
-
- Depth++; DepthArrow();
- VGvd_drange( vdp, &low, &high );
- DVPRINTF(where, "Range is %4.4g to %4.4g \n", low, high );
- Depth--;
- }
- Depth--;
- }
-
-
- /*
- * DoIcon -- prints information about an icon object.
- */
- VOID DoIcon( object )
- OBJECT object;
- {
- OBJECT pixmap;
-
- VOicGet( object, V_IC_PIXMAP, &pixmap, V_IC_ATTR_ARGEND );
- DoPixmap( pixmap );
- }
-
- /*
- * DoImage -- prints information about an image object.
- */
- VOID DoImage( object )
- OBJECT object;
- {
- OBJECT pixmap;
-
- VOimGet( object, V_IM_PIXMAP, &pixmap, V_IM_ATTR_ARGEND );
- DoPixmap( pixmap );
- }
-
- /*
- * DoPixmap -- prints information about an pixmap object.
- */
- VOID DoPixmap( object )
- OBJECT object;
- {
- CHAR *source_filename;
-
- Depth++;
- DepthArrow();
- VOpmGet( object, V_PM_FILENAME, &source_filename, V_PM_ATTR_ARGEND );
- DVPRINTF(where, "Pixmap source FILE:[%s] \n", source_filename );
- Depth--;
- }
-
- /*
- * DoSubdrawing -- prints whether the subdrawing's drawing is
- * included or referenced, the name of the file, and then checks
- * for color color dynamics.
- */
- VOID DoSubdrawing( object )
- OBJECT object;
- {
- if ( VOsdDrKeep(object,2) )
- DVPRINTF(where, "Included \n" );
- else
- DVPRINTF(where, "Referenced \n" );
-
- Depth++;
- DepthArrow();
- DVPRINTF(where, "(Initial) Source FILE:[%s] \n", VOsdFilename( object ) );
- Depth--;
- }
-
-
- typedef struct
- {
- INT thresh;
- OBJECT sd;
- } TTABLE;
-
-
- /*
- * DoDynamicDrawing -- prints whether all of the subdrawing's
- * drawings are included or referenced, then prints the information
- * about the variable that controls the dynamics, then prints out
- * the information in the subdrawing's threshold table.
- */
- VOID DoDynamicDrawing( object )
- OBJECT object;
- {
- TTABLE *ttable;
- INT i, size;
- INT thresh;
- OBJECT sd;
- OBJECT vd_obj;
- DSVAR dsv;
- VARDESC vdp, VOvdAddress();
- DOUBLE low, high;
- FLOAT range, TTval();
- FLOAT lowval, highval;
- INT slices, columns, rows;
-
- size = VOttSize( object );
- ttable = (TTABLE *) S_ALLOC( (size+1) * sizeof(TTABLE) );
- for ( i=0; i<=size; i++ )
- {
- VOttGetThresh( object, i, &thresh, &sd );
- ttable[i].thresh = thresh;
- ttable[i].sd = sd;
- }
-
- DVPRINTF(where, "All drawings are " );
- if ( VOsdDrKeep( ttable[0].sd, 2 ) )
- DVPRINTF(where, "Included \n" );
- else
- DVPRINTF(where, "Referenced \n" );
-
- Depth++;
-
- vd_obj = VOttVd( object );
- vdp = VOvdAddress( vd_obj );
- VGvd_drange( vdp, &low, &high );
- range = high - low;
-
- DepthArrow();
- dsv = TvdGetDataSourceVariable( vdp );
- DVPRINTF(where, "Variable -- %-12s ", TdsvGetName( dsv ) );
- DVPRINTF(where, "%s ", GetVarType( VGvdtype( vdp ) ) );
- VGvddim( vdp, &slices, &columns, &rows );
- DVPRINTF(where, "%s \n", GetVarSize( rows, columns ) );
-
- DepthArrow();
- DVPRINTF(where, "Original drawing FILE:[%s]\n", VOsdFilename( ttable[0].sd ) );
- lowval = low;
- highval = TTval( ttable[1].thresh, low, range );
- Depth++; DepthArrow();
- DVPRINTF(where, "Range %6.4g to %6.4g \n", lowval, highval );
- Depth--;
-
- for ( i=1; i<=size; i++ )
- {
- DepthArrow();
- DVPRINTF(where, "Drawing #%d FILE:[%s]\n", i, VOsdFilename(ttable[i].sd));
- lowval = TTval( ttable[i].thresh, low, range );
- if ( i == size )
- highval = high;
- else
- highval = TTval( ttable[i+1].thresh, low, range );
- Depth++; DepthArrow();
- DVPRINTF(where, "Range %6.4g to %6.4g \n", lowval, highval );
- Depth--;
- }
-
- Depth--;
- }
-
-
- typedef struct
- {
- DISPFORM *df;
- CHAR name[40];
- } DISPFORMS;
-
- GLOBALREF DISPFORM
- VD3dsurface, VDanclock, VDbar, VDbarhoriz, VDbarline, VDbarpacked,
- VDbarsolid, VDbox, VDcenter, VDcircle, VDclock, VDcprects, VDdial,
- VDdial360, VDdigits, VDdrawing, VDface, VDfader, VDfan, VDflowfield,
- VDhighlow, VDhilobar, VDhiloline, VDhistdial, VDimpulse, VDknob,
- VDlegend, VDline, VDlinefill, VDmeter, VDmovedrawing, VDne_radial,
- VDpie, VDpig, VDpoints, VDptsline, VDradial, VDrects, VDscatter,
- VDsize, VDstrip, VDtext, VDtriangle, VDvector, VDweb;
- GLOBALREF DISPFORM
- VD3d, VDbarpackedline, VDbarplstacked, VDbullseye, VDcolorbar,
- VDcontour, VDcontroller, VDfcontour, VDhorizon, Dhorizon,
- VDhorizcontroller, VDimpulseto0, VDindicator, VDlinedist,
- VDlinefstacked, VDlinestacked, VDmultiyweb, VDpigdist, VDrtline,
- VDrtstep, VDspectro, VDspectrointp, VDspectrointpstkd,
- VDspectrostacked, VDstep, VDstripras, VDstripstacked, VDvstrip,
- VDvstrip_r, VDwaterfall, VDwaterfall_r;
-
-
- #define NUMDISPFORMS 75
- DISPFORMS DispFormNames[NUMDISPFORMS];
-
- VOID init_dispforms()
- {
- S_STRCPY( DispFormNames[0].name, "Surface" );
- DispFormNames[0].df = &VD3d;
- S_STRCPY( DispFormNames[1].name, "Surface " );
- DispFormNames[1].df = &VD3dsurface;
- S_STRCPY( DispFormNames[2].name, "Analog Clock" );
- DispFormNames[2].df = &VDanclock;
- S_STRCPY( DispFormNames[3].name, "Vertical Bar Chart" );
- DispFormNames[3].df = &VDbar;
- S_STRCPY( DispFormNames[4].name, "Horizontal Bar Chart" );
- DispFormNames[4].df = &VDbarhoriz;
- S_STRCPY( DispFormNames[5].name, "Bar-Line" );
- DispFormNames[5].df = &VDbarline;
- S_STRCPY( DispFormNames[6].name, "Packed Bar" );
- DispFormNames[6].df = &VDbarpacked;
- S_STRCPY( DispFormNames[7].name, "Packed Bar Line" );
- DispFormNames[7].df = &VDbarpackedline;
- S_STRCPY( DispFormNames[8].name, "Pkd BarLine Stkd" );
- DispFormNames[8].df = &VDbarplstacked;
- S_STRCPY( DispFormNames[9].name, "Solid Bar" );
- DispFormNames[9].df = &VDbarsolid;
- S_STRCPY( DispFormNames[10].name, "Bullseye" );
- DispFormNames[10].df = &VDbullseye;
- S_STRCPY( DispFormNames[11].name, "Box" );
- DispFormNames[11].df = &VDbox;
- S_STRCPY( DispFormNames[12].name, "Centered Bar" );
- DispFormNames[12].df = &VDcenter;
- S_STRCPY( DispFormNames[13].name, "Circle" );
- DispFormNames[13].df = &VDcircle;
- S_STRCPY( DispFormNames[14].name, "Digital Clock" );
- DispFormNames[14].df = &VDclock;
- S_STRCPY( DispFormNames[15].name, "Colorbar" );
- DispFormNames[15].df = &VDcolorbar;
- S_STRCPY( DispFormNames[16].name, "Contour" );
- DispFormNames[16].df = &VDcontour;
- S_STRCPY( DispFormNames[17].name, "Controller" );
- DispFormNames[17].df = &VDcontroller;
- S_STRCPY( DispFormNames[18].name, "Packed Blocks" );
- DispFormNames[18].df = &VDcprects;
- S_STRCPY( DispFormNames[19].name, "Dials" );
- DispFormNames[19].df = &VDdial;
- S_STRCPY( DispFormNames[20].name, "Dial 360" );
- DispFormNames[20].df = &VDdial360;
- S_STRCPY( DispFormNames[21].name, "Digits" );
- DispFormNames[21].df = &VDdigits;
- S_STRCPY( DispFormNames[22].name, "Dynamic Drawing" );
- DispFormNames[22].df = &VDdrawing;
- S_STRCPY( DispFormNames[23].name, "Faces" );
- DispFormNames[23].df = &VDface;
- S_STRCPY( DispFormNames[24].name, "Fader" );
- DispFormNames[24].df = &VDfader;
- S_STRCPY( DispFormNames[25].name, "Fans" );
- DispFormNames[25].df = &VDfan;
- S_STRCPY( DispFormNames[26].name, "Filled Contour" );
- DispFormNames[26].df = &VDfcontour;
- S_STRCPY( DispFormNames[27].name, "Flowfield" );
- DispFormNames[27].df = &VDflowfield;
- S_STRCPY( DispFormNames[28].name, "High Low" );
- DispFormNames[28].df = &VDhighlow;
- S_STRCPY( DispFormNames[29].name, "Hi-Lo w/ Bar" );
- DispFormNames[29].df = &VDhilobar;
- S_STRCPY( DispFormNames[30].name, "Hi-Lo w/ Line" );
- DispFormNames[30].df = &VDhiloline;
- S_STRCPY( DispFormNames[31].name, "Hist. Dials" );
- DispFormNames[31].df = &VDhistdial;
- S_STRCPY( DispFormNames[32].name, "Artificial Horizon" );
- DispFormNames[32].df = &VDhorizon;
- S_STRCPY( DispFormNames[33].name, "Horiz Controller" );
- DispFormNames[33].df = &VDhorizcontroller;
- S_STRCPY( DispFormNames[34].name, "Impulse" );
- DispFormNames[34].df = &VDimpulse;
- S_STRCPY( DispFormNames[35].name, "Impulse To 0" );
- DispFormNames[35].df = &VDimpulseto0;
- S_STRCPY( DispFormNames[36].name, "Indicator" );
- DispFormNames[36].df = &VDindicator;
- S_STRCPY( DispFormNames[37].name, "Knob" );
- DispFormNames[37].df = &VDknob;
- S_STRCPY( DispFormNames[38].name, "Legend" );
- DispFormNames[38].df = &VDlegend;
- S_STRCPY( DispFormNames[39].name, "Line Graph" );
- DispFormNames[39].df = &VDline;
- S_STRCPY( DispFormNames[40].name, "Filled Line Dist" );
- DispFormNames[40].df = &VDlinedist;
- S_STRCPY( DispFormNames[41].name, "Filled Line" );
- DispFormNames[41].df = &VDlinefill;
- S_STRCPY( DispFormNames[42].name, "Line Fill Stckd" );
- DispFormNames[42].df = &VDlinefstacked;
- S_STRCPY( DispFormNames[43].name, "Line Stacked" );
- DispFormNames[43].df = &VDlinestacked;
- S_STRCPY( DispFormNames[44].name, "Meter" );
- DispFormNames[44].df = &VDmeter;
- S_STRCPY( DispFormNames[45].name, "Moving Drawing" );
- DispFormNames[45].df = &VDmovedrawing;
- S_STRCPY( DispFormNames[46].name, "Multy-Y Web" );
- DispFormNames[46].df = &VDmultiyweb;
- S_STRCPY( DispFormNames[47].name, "Radial No Erase" );
- DispFormNames[47].df = &VDne_radial;
- S_STRCPY( DispFormNames[48].name, "Pie Chart" );
- DispFormNames[48].df = &VDpie;
- S_STRCPY( DispFormNames[49].name, "Piggyback Bar" );
- DispFormNames[49].df = &VDpig;
- S_STRCPY( DispFormNames[50].name, "Piggyback Dist" );
- DispFormNames[50].df = &VDpigdist;
- S_STRCPY( DispFormNames[51].name, "Points" );
- DispFormNames[51].df = &VDpoints;
- S_STRCPY( DispFormNames[52].name, "Points w/ Line" );
- DispFormNames[52].df = &VDptsline;
- S_STRCPY( DispFormNames[53].name, "Radial" );
- DispFormNames[53].df = &VDradial;
- S_STRCPY( DispFormNames[54].name, "Blocks" );
- DispFormNames[54].df = &VDrects;
- S_STRCPY( DispFormNames[55].name, "Realtime Line Graph" );
- DispFormNames[55].df = &VDrtline;
- S_STRCPY( DispFormNames[56].name, "Realtime Step Graph" );
- DispFormNames[56].df = &VDrtstep;
- S_STRCPY( DispFormNames[57].name, "Scatter" );
- DispFormNames[57].df = &VDscatter;
- S_STRCPY( DispFormNames[58].name, "Size" );
- DispFormNames[58].df = &VDsize;
- S_STRCPY( DispFormNames[59].name, "Spectrogram" );
- DispFormNames[59].df = &VDspectro;
- S_STRCPY( DispFormNames[60].name, "Smooth Spectro" );
- DispFormNames[60].df = &VDspectrointp;
- S_STRCPY( DispFormNames[61].name, "Smth Spectro Stkd" );
- DispFormNames[61].df = &VDspectrointpstkd;
- S_STRCPY( DispFormNames[62].name, "Spectro Stacked" );
- DispFormNames[62].df = &VDspectrostacked;
- S_STRCPY( DispFormNames[63].name, "Step Graph" );
- DispFormNames[63].df = &VDstep;
- S_STRCPY( DispFormNames[64].name, "Strip Chart" );
- DispFormNames[64].df = &VDstrip;
- S_STRCPY( DispFormNames[65].name, "Raster Strip" );
- DispFormNames[65].df = &VDstripras;
- S_STRCPY( DispFormNames[66].name, "Strip Stkd" );
- DispFormNames[66].df = &VDstripstacked;
- S_STRCPY( DispFormNames[67].name, "Text" );
- DispFormNames[67].df = &VDtext;
- S_STRCPY( DispFormNames[68].name, "Triangle" );
- DispFormNames[68].df = &VDtriangle;
- S_STRCPY( DispFormNames[69].name, "Vector" );
- DispFormNames[69].df = &VDvector;
- S_STRCPY( DispFormNames[70].name, "Vert Strip" );
- DispFormNames[70].df = &VDvstrip;
- S_STRCPY( DispFormNames[71].name, "Raster Vert Strip" );
- DispFormNames[71].df = &VDvstrip_r;
- S_STRCPY( DispFormNames[72].name, "Waterfall" );
- DispFormNames[72].df = &VDwaterfall;
- S_STRCPY( DispFormNames[73].name, "Raster Waterfall" );
- DispFormNames[73].df = &VDwaterfall_r;
- S_STRCPY( DispFormNames[74].name, "Web Chart" );
- DispFormNames[74].df = &VDweb;
- }
-
-
-
- /*
- * GetDispFormName -- returns the name of the display formatter by
- * searching the list for the correct DISPFORM.
- */
- CHAR *GetDispFormName( df )
- DISPFORM df;
- {
- INT i;
-
- for ( i = 0; i < NUMDISPFORMS; i++ )
- if ( *DispFormNames[i].df == df )
- return DispFormNames[i].name;
-
- return NULL;
- }
-
-
- typedef struct
- {
- INHANDLER *df;
- CHAR name[40];
- } INHANDLERS;
-
- GLOBALREF INHANDLER
- VNbutton, /*VNcheck,*/ VNchecklist, /*VNcombine,*/ VNcombiner,
- VNmenu, VNmultiplexor, VNobjchecklist, VNobjmenu, VNobjtoggle, VNpalette,
- VNscrollbar, VNslider, VNslider2D, VNtext, VNtextedit, VNtoggle;
- GLOBALREF INHANDLER
- VNmcheck, VNmmenu, VNmradio,VNmslider,VNmtext,VNmtoggle,
- VNolcheck, VNolmenu, VNolradio,VNolslider,VNoltext,VNoltoggle,
- VNwcheck, VNwmenu, VNwradio,VNwslider,VNwtext,VNwtoggle;
-
-
- #define NUMINHANDLERS 32
- INHANDLERS InHandlerNames[NUMINHANDLERS];
-
- VOID init_inhandlers()
- {
- S_STRCPY( InHandlerNames[0].name, "Button" );
- InHandlerNames[0].df = &VNbutton;
- S_STRCPY( InHandlerNames[1].name, "Checklist" );
- InHandlerNames[1].df = &VNchecklist;
- S_STRCPY( InHandlerNames[2].name, "Combiner" );
- InHandlerNames[2].df = &VNcombiner;
- S_STRCPY( InHandlerNames[3].name, "Menu" );
- InHandlerNames[3].df = &VNmenu;
- S_STRCPY( InHandlerNames[4].name, "Multiplexor" );
- InHandlerNames[4].df = &VNmultiplexor;
- S_STRCPY( InHandlerNames[5].name, "Object Checklist" );
- InHandlerNames[5].df = &VNobjchecklist;
- S_STRCPY( InHandlerNames[6].name, "Object Menu" );
- InHandlerNames[6].df = &VNobjmenu;
- S_STRCPY( InHandlerNames[7].name, "Object Toggle" );
- InHandlerNames[7].df = &VNobjtoggle;
- S_STRCPY( InHandlerNames[8].name, "Palette" );
- InHandlerNames[8].df = &VNpalette;
- S_STRCPY( InHandlerNames[9].name, "Scrollbar" );
- InHandlerNames[9].df = &VNscrollbar;
- S_STRCPY( InHandlerNames[10].name, "Slider" );
- InHandlerNames[10].df = &VNslider;
- S_STRCPY( InHandlerNames[11].name, "2D slider" );
- InHandlerNames[11].df = &VNslider2D;
- S_STRCPY( InHandlerNames[12].name, "Text Input" );
- InHandlerNames[12].df = &VNtext;
- S_STRCPY( InHandlerNames[13].name, "Text Edit" );
- InHandlerNames[13].df = &VNtextedit;
- S_STRCPY( InHandlerNames[14].name, "Toggle" );
- InHandlerNames[14].df = &VNtoggle;
- S_STRCPY( InHandlerNames[15].name, "Motif Checklist" );
- InHandlerNames[15].df = &VNmcheck;
- S_STRCPY( InHandlerNames[16].name, "Motif Menu" );
- InHandlerNames[16].df = &VNmmenu;
- S_STRCPY( InHandlerNames[17].name, "Motif Radio" );
- InHandlerNames[17].df = &VNmradio;
- S_STRCPY( InHandlerNames[18].name, "Motif Slider" );
- InHandlerNames[18].df = &VNmslider;
- S_STRCPY( InHandlerNames[19].name, "Motif Text Intput" );
- InHandlerNames[19].df = &VNmtext;
- S_STRCPY( InHandlerNames[20].name, "Motif Toggle" );
- InHandlerNames[20].df = &VNmtoggle;
- S_STRCPY( InHandlerNames[21].name, "Widget Checklist" );
- InHandlerNames[21].df = &VNwcheck;
- S_STRCPY( InHandlerNames[22].name, "Widget Menu" );
- InHandlerNames[22].df = &VNwmenu;
- S_STRCPY( InHandlerNames[23].name, "Widget Radio" );
- InHandlerNames[23].df = &VNwradio;
- S_STRCPY( InHandlerNames[24].name, "Widget Slider" );
- InHandlerNames[24].df = &VNwslider;
- S_STRCPY( InHandlerNames[25].name, "Widget Text Intput" );
- InHandlerNames[25].df = &VNwtext;
- S_STRCPY( InHandlerNames[26].name, "Open Look Checklist" );
- InHandlerNames[26].df = &VNolcheck;
- S_STRCPY( InHandlerNames[27].name, "Open Look Menu" );
- InHandlerNames[27].df = &VNolmenu;
- S_STRCPY( InHandlerNames[28].name, "Open Look Radio" );
- InHandlerNames[28].df = &VNolradio;
- S_STRCPY( InHandlerNames[29].name, "Open Look Slider" );
- InHandlerNames[29].df = &VNolslider;
- S_STRCPY( InHandlerNames[30].name, "Open Look Text Intput" );
- InHandlerNames[30].df = &VNoltext;
- S_STRCPY( InHandlerNames[31].name, "Open Look Toggle" );
- InHandlerNames[31].df = &VNoltoggle;
- }
-
-
-
- /*
- * GetInHandlerName -- returns the name of the input technique by
- * searching the list for the correct INHANDLER.
- */
- CHAR *GetInHandlerName( df )
- INHANDLER df;
- {
- INT i;
-
- for ( i = 0; i < NUMINHANDLERS; i++ )
- if ( *InHandlerNames[i].df == df )
- return InHandlerNames[i].name;
-
- return NULL;
- }
-
-
- typedef struct { UBYTE red, green, blue; } DEFAULT_COLOR;
-
- LOCAL DEFAULT_COLOR LocalLut[16] =
- {
- 0, 0, 0, /* black */
- 255,255,255, /* white */
- 255, 0, 0, /* red */
- 0,255, 0, /* green */
- 0, 0,255, /* blue */
- 255,255, 0, /* yellow */
- 255, 0,255, /* magenta */
- 0,255,255, /* cyan */
- 128,128,128, /* medium grey */
- 184,184,184, /* light grey */
- 128, 0, 0, /* dark red */
- 0,128, 0, /* dark green */
- 0, 0,128, /* dark blue */
- 128,128, 0, /* dark yellow */
- 128, 0,128, /* dark magenta */
- 0,128,128 /* dark cyan */
- };
-
-
- LOCAL CHAR *ColorStrings[16] =
- {
- "Black", "White", "Red", "Green", "Blue", "Yellow", "Magenta",
- "Cyan", "Medium Grey", "Light Grey", "Dark Red", "Dark Green",
- "Dark Blue", "Dark Yellow", "Dark Magenta", "Dark Cyan"
- };
-
-
- /*
- * ClosestColor -- searchs the local color table for an rgb value
- * that matches the input values. Prints the values and the name
- * of the color if it finds an exact match. Otherwise, it looks
- * for the closest color in rgb space and prints the values and the
- * color name.
- */
- VOID ClosestColor( r, g, b )
- INT r, g, b;
- {
- FAST LONG i, score;
- LONG j, bestscore, bestindex, tablen;
- FAST DEFAULT_COLOR *tabptr;
-
- tabptr = &LocalLut[0];
- tablen = 16;
- for( i=0; i<tablen; i++, tabptr++ )
- if( tabptr->red == r && tabptr->green == g && tabptr->blue == b )
- {
- DVPRINTF(where, "%s!", ColorStrings[i] );
- return;
- }
-
- bestscore = (1<<18); /* Worse than worst possible score */
- tabptr = &LocalLut[0];
- for( j=0; j<tablen; j++, tabptr++ )
- {
- i = tabptr->red - r;
- score = i * i;
- if( score < bestscore )
- {
- i = tabptr->green - g;
- score += ( i * i );
- if( score < bestscore )
- {
- i = tabptr->blue - b;
- score += ( i * i );
- if( score < bestscore )
- { bestscore = score; bestindex = j; }
- }
- }
- }
- DVPRINTF(where, "%s?", ColorStrings[bestindex] );
- return;
- }
-
-
- /*
- * TTval -- translates the normalized value in a threshold table to
- * an actual value based on a low value and a range.
- */
- FLOAT TTval( thresh, low, range )
- INT thresh;
- DOUBLE low;
- FLOAT range;
- {
- return ( low + ( (FLOAT)thresh/32767.0) * range );
- }
-
-
- VOID DepthArrow()
- {
- INT i;
-
- for ( i=0; i<Depth*4; i++ )
- DVPRINTF(where, "-" );
- DVPRINTF(where, "> " );
- }
-
- /*ARGSUSED*/
- ADDRESS GetFirstVdp( vd_obj, vdp, args )
- OBJECT vd_obj;
- VARDESC vdp;
- ADDRESS args;
- {
- return vdp;
- }
-
-