summaryrefslogtreecommitdiff
path: root/xc/unsupported/programs/gpc/brf_trv.c
blob: d1fccc9df58a30829d1cb3f842c03d06ea8f679c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
/* $XConsortium: brf_trv.c,v 5.2 94/04/17 20:44:31 rws Exp $ */
/*

Copyright (c) 1989, 1990, 1991  X Consortium

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.

*/
/***********************************************************
Copyright(c) 1989,1990, 1991 by Sun Microsystems, Inc.

						All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that Sun Microsystems
not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission.

SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/

/*--------------------------------------------------------------------*\
|
|  Copyright (C) 1989,1990, 1991, National Computer Graphics Association
|
|  Permission is granted to any individual or institution to use, copy, or
|  redistribute this software so long as it is not sold for profit, provided
|  this copyright notice is retained.
|
|                         Developed for the
|                National Computer Graphics Association
|                         2722 Merrilee Drive
|                         Fairfax, VA  22031
|                           (703) 698-9600
|
|                                by
|                 SimGraphics Engineering Corporation
|                    1137 Huntington Drive  Unit A
|                      South Pasadena, CA  91030
|                           (213) 255-0900
|---------------------------------------------------------------------
|
| Author        :	SimGraphics Engineering Corportation
|
| File          :	brf_trv.c
| Date          :	Fri Feb  9 10:46:55 PST 1990
| Project       :	PLB
| Description   :	Traverses the BRF structures, collecting usage
|			information on each bif element, and generates
|			the BRF report.
| Status        :	Version 1.0
|
| Revisions     :	
|
|       5/90            MFC Tektronix, Inc.: PEX-SI API Binding change.
|
|      12/90            MFC Tektronix, Inc.: PEX-SI PEX5R1 Release.
|
\*--------------------------------------------------------------------*/

/*--------------------------------------------------------------------*\
|	Table of Contents
|
|	void brf_traverser(	*BIF_Traverser_state, *BIF_All, *BRF_state)
|		:	Walks throuth the BRF structures built for a 
|					givren test
|	void brf_branch (	*BIF_Traverser_state, *BIF_All, *BRF_state)
|		:	NOTE: An improvement to this code would be to add a
|	void brf_report (	*BRF_state )
|		:	Main routine involved in printing out a BRF report
|	void brf_init (	)
|		:	Initialized BRF tables
|	void brf_start_stopwatch ()
|		:	Starts the stop watch
|	void brf_stop_stopwatch ( *BRF_state )
|		:	Stops the stop watch
|
\*--------------------------------------------------------------------*/

#define STRLENGTH 80
#include <stdio.h>
#ifdef SYSV
#include <sys/types.h>
#include <sys/times.h>
#include <time.h>
#endif
#include <sys/time.h>
#include "brf_ents.h"
#include "biftypes.h"
#include "bifmacro.h"
#include "bifparse.h"
#include "brftypes.h"
#include "brf_set.h"
#include "globals.h"
#include "ph_map.h"
#include "brfexption.h"
#include "stopwatch.h"

void brf_branch ();
void brf_report ();
void brf_init ();
extern	char brf_filename[STRLENGTH];
extern	FILE *brf_file;
extern	int  brf_used_flag;
extern  char input_filenm[128];
extern BRF_exception brf_exception[MAX_EXCEPTION];

/*----------------------------------------------------------------------*\
| Program: brf_trv.c
|
\*----------------------------------------------------------------------*/


#define EXCEPTION_HANDLER 1
#ifdef EXTERNALNOTE


	ATTENTION END PORT PROGRAMMERS!!!!!!!!!!!!

  	  Part of the mechanism for the exceptions reporting is inside this
	code, marked with "#ifdef EXCEPTION_HANDLER". These are the global
	plb exception messages, as defined in bifmacro.h and set in bldgeneric.c
	and bifbuild.c. Use this code as an example of how to add exception
	reporters to customized ports. For a better example of exceptions reporting,
	see the code in brf_ents.c

#endif

BRF_table brf_group1[] = 
{
	(BRF_table) &brf_label,
	(BRF_table) &brf_marker,
	(BRF_table) &brf_marker3,
	(BRF_table) &brf_line,
	(BRF_table) &brf_line3,
	(BRF_table) &brf_text,
	(BRF_table) &brf_text3,
	(BRF_table) &brf_annotationtext3,
	(BRF_table) &brf_pixelmap3,
	(BRF_table) &brf_gensphere3,
	(BRF_table) &brf_gencircle,
	(BRF_table) &brf_gencircle3
};
int brf_group1_len = sizeof(brf_group1)/sizeof(BRF_table);

BRF_table brf_group2[] = 
{
	(BRF_table) &brf_linetype,
	(BRF_table) &brf_interiorshading,
	(BRF_table) &brf_interiorlighting,
	(BRF_table) &brf_backfaceprocessing,
	(BRF_table) &brf_edgeflag,
	(BRF_table) &brf_textfont,
	(BRF_table) &brf_textprec,
	(BRF_table) &brf_lightstate,
	(BRF_table) &brf_depthcueindex,
	(BRF_table) &brf_hlhsremoval,
	(BRF_table) &brf_readgeometryfile,
	(BRF_table) &brf_cleargeometry,
	(BRF_table) &brf_beginstructure,
	(BRF_table) &brf_endstructure
};
int brf_group2_len = sizeof(brf_group2)/sizeof(BRF_table);

BRF_table brf_group3[] = 
{
	(BRF_table) &brf_executestructure,
	(BRF_table) &brf_callstructure,
	(BRF_table) &brf_invokeatframe
};
int brf_group3_len = sizeof(brf_group3)/sizeof(BRF_table);

BRF_table brf_group4[] = 
{
	(BRF_table) &brf_defineviewspecification,
	(BRF_table) &brf_definelight,
	(BRF_table) &brf_markertype,
	(BRF_table) &brf_markersize,
	(BRF_table) &brf_markercolor,
	(BRF_table) &brf_markercolorindex,
	(BRF_table) &brf_linewidth,
	(BRF_table) &brf_linecolor,
	(BRF_table) &brf_linecolorindex,
	(BRF_table) &brf_lineshading,
	(BRF_table) &brf_interiorstyle,
	(BRF_table) &brf_interiorpatternindex,
	(BRF_table) &brf_interiorcolor,
	(BRF_table) &brf_interiorcolorindex,
	(BRF_table) &brf_backfaceinteriorcolor,
	(BRF_table) &brf_backfaceinteriorcolorindex,
	(BRF_table) &brf_surfaceproperties,
	(BRF_table) &brf_backfaceproperties,
	(BRF_table) &brf_edgetype,
	(BRF_table) &brf_edgewidth,
	(BRF_table) &brf_edgecolor,
	(BRF_table) &brf_edgecolorindex,
	(BRF_table) &brf_textcolor,
	(BRF_table) &brf_textcolorindex,
	(BRF_table) &brf_textpath,
	(BRF_table) &brf_textalign,
	(BRF_table) &brf_charheight,
	(BRF_table) &brf_charexp,
	(BRF_table) &brf_charspace,
	(BRF_table) &brf_charupvector,
	(BRF_table) &brf_annotextcharheight,
	(BRF_table) &brf_annotextcharupvector,
	(BRF_table) &brf_annotextstyle
};
int brf_group4_len = sizeof(brf_group4)/sizeof(BRF_table);

BRF_table brf_group5[] = 
{
	(BRF_table) &brf_identity3,
	(BRF_table) &brf_concatmatrix3,
	(BRF_table) &brf_invertmatrix3,
	(BRF_table) &brf_rotate3,
	(BRF_table) &brf_rotatexyz3,
	(BRF_table) &brf_translate3,
	(BRF_table) &brf_scale3,
	(BRF_table) &brf_matrix3,
	(BRF_table) &brf_getmatrix3,
	(BRF_table) &brf_pushmatrix3,
	(BRF_table) &brf_popmatrix3,
	(BRF_table) &brf_globaltransformation3,
	(BRF_table) &brf_localtransformation3,
	(BRF_table) &brf_applytoglobal3,
	(BRF_table) &brf_applytolocal3,
	(BRF_table) &brf_vieworientation3,
	(BRF_table) &brf_viewmapping3,
	(BRF_table) &brf_activeview
};
int brf_group5_len = sizeof(brf_group5)/sizeof(BRF_table);

BRF_table brf_group6[] = 
{
	(BRF_table) &brf_begintest,
	(BRF_table) &brf_endtest,
	(BRF_table) &brf_pause,
	(BRF_table) &brf_sleep,
	(BRF_table) &brf_definecolor,
	(BRF_table) &brf_backgroundcolor,
	(BRF_table) &brf_backgroundcolorindex,
	(BRF_table) &brf_defaultviewspecification,
	(BRF_table) &brf_definedepthcue,
	(BRF_table) &brf_configuration
};
int brf_group6_len = sizeof(brf_group6)/sizeof(BRF_table);

BRF_table brf_group7[] = 
{
	(BRF_table) &brf_polygon,
	(BRF_table) &brf_polygon3,
	(BRF_table) &brf_fillareaset,
	(BRF_table) &brf_fillareaset3,
	(BRF_table) &brf_triangle3,
	(BRF_table) &brf_quadmesh3,
	(BRF_table) &brf_indexpolygons3
};
int brf_group7_len = sizeof(brf_group7)/sizeof(BRF_table);


/*----------------------------------------------------------------------*\
| Procedure   : void brf_traverser(	*BIF_Traverser_state, *BIF_All, 
|					*BRF_state)
|------------------------------------------------------------------------
| Description : Walks throuth the BRF structures built for a givren test
|			loop.
|------------------------------------------------------------------------
| Return      : 
\*----------------------------------------------------------------------*/
brf_traverser( traverser_state, bif_entity, brf_state)
BIF_Traverser_state *traverser_state;
BIF_All *bif_entity;
BRF_state *brf_state;
{

	while ( bif_entity != NULL )
	{

#ifdef EXCEPTION_HANDLER
			BRF_do_exceptionsearch(bif_entity,brf_state);
#endif
		brf_branch(traverser_state, bif_entity, brf_state);
		bif_entity = bif_entity->any.next;
	}
} /* End BIF_execute_traverser */
/*----------------------------------------------------------------------*\
| Procedure   : void brf_branch (	*BIF_Traverser_state, *BIF_All, 
|					*BRF_state)
|------------------------------------------------------------------------
| Description : NOTE: An improvement to this code would be to add a
|		pointer to the BRF_data structures in the BIF_data
|		structures, and to fill these pointers in the 
|		new_(entities) calls.  This would eliminate the need for
|		the search done by this procedure, and eliminate the 
|		need for the brf_table
|------------------------------------------------------------------------
| Return      : 
\*----------------------------------------------------------------------*/
void brf_branch ( traverser_state, bif_entity , brf_state)
BIF_Traverser_state *traverser_state;
BIF_All *bif_entity;
BRF_state *brf_state;
{
int i, entity_type;
int (*brf_function)();
	entity_type = bif_entity->entity_type;
	brf_state->brf_flag = BRF_COLLECT;
	for(i=0;i< brf_table_size;i++)
	{
		if(entity_type == brf_table[i]->any.entity_type)
		{
			brf_function = brf_table[i]->any.handler;
			(*brf_function)
		     	(traverser_state,bif_entity,brf_table[i],brf_state);
			break;
		}
	}
}

/*----------------------------------------------------------------------*\
| Procedure   : void brf_report (	*BRF_state )
|------------------------------------------------------------------------
| Description : Main routine involved in printing out a BRF report
|------------------------------------------------------------------------
| Return      : 
\*----------------------------------------------------------------------*/
void brf_report (brf_state )
BRF_state *brf_state;
{
int i;
int (*brf_function)();
char	temp_str[80];
int	num_exceptions;
int	num_ents_used;
static int loop_seq_no = 1;
static char *sep1 =
"------------------------------------------------------------------------\n";
static char *sep2 =
"|----------------------------------------------------------------------|\n";
static char *sep3 =
"| -------                       --------  --------  --------  -------- |\n";

	brf_state->brf_flag = BRF_REPORT;
/*----------------------------------------------------------------------*/
	/* Open the default report if one has not already been specified */
	check_default_report("gpc_brf.out");

#ifdef EXTERNALNOTE
	/* open a gap and print a marker to seperate the test
	loop data from the header/system data. */
#endif

	fprintf(brf_file,"\n\n\n");
	fprintf(brf_file,sep1);
	sprintf(temp_str,"|      Beginning Of Test Loop %d", loop_seq_no++);
	BRF_appendEndBar(temp_str);
	fprintf(brf_file,temp_str);
	fprintf(brf_file,sep1);



	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Graphics Primitives: Polygon Summary Table                     |\n",
"|                                                                      |\n",
"|  Average                       Average   Average   Average   Average |\n",
"|  Times                       Verticies    Facets     Edges  contours |\n",
"|  Called                      Per Frame Per Frame Per Frame Per Frame |\n",
"|  Per Frame                                                           |\n",
"|----------------------------------------------------------------------|\n");



	num_ents_used = 0;
	for(i=0;i< brf_group7_len   ;i++)
	{
		brf_function = brf_group7[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group7[i],brf_state) )
			num_ents_used++ == 0;
	}
	fprintf(brf_file,sep3);
		do_brftotalpoly(NULL,NULL,
			&total_with_data, brf_state);
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Polygon Primitives used in this test loop.                  |\n");

	fprintf(brf_file,sep1);


	fflush(brf_file);
	


	brf_state->brf_flag = BRF_REPORT2;
	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Graphics Primitives: Polygon Optional Data Summary Table       |\n",
"|                                                                      |\n",
"|  Average                       Average   Average   Average   Average |\n",
"|  Times                          Vertex    Vertex     Facet     Facet |\n",
"|  Called                         Colors   Normals     Color   Normals |\n",
"|  Per Frame                   Per Frame Per Frame Per Frame Per Frame |\n",
"|----------------------------------------------------------------------|\n");


	num_ents_used = 0;
	for(i=0;i< brf_group7_len   ;i++)
	{
		brf_function = brf_group7[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group7[i],brf_state) )
			num_ents_used++ == 0;
	}
	fprintf(brf_file,sep3);
		do_brftotalpoly((BIF_Traverser_state *)NULL,NULL,
			&total_with_data, brf_state);
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Polygon Optional Data in this test loop.                    |\n");

	fprintf(brf_file,sep1);


	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Graphics Primitives: Polygon Edge Visibility Table             |\n",
"|                                                                      |\n",
"|  Average                       Average                               |\n",
"|  Times                           Edges                               |\n",
"|  Called                        Visible                               |\n",
"|  Per Frame                   Per Frame                               |\n",
"|----------------------------------------------------------------------|\n");
	brf_state->brf_flag = BRF_REPORT3;
	num_ents_used = 0;
	for(i=0;i< brf_group7_len   ;i++)
	{
		brf_function = brf_group7[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group7[i],brf_state) )
			num_ents_used++ == 0;
	}
	fprintf(brf_file,sep3);
		do_brftotalpoly((BIF_Traverser_state *)NULL,NULL,
			&total_with_data, brf_state);
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Polygon with visible edges in this loop.                    |\n");

	fprintf(brf_file,sep1);

	brf_state->brf_flag = BRF_REPORT;


	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Graphics Primitives: Line and Text Summary Table               |\n",
"|                                                                      |\n",
"|  Average                                                             |\n",
"|  Times                                                               |\n",
"|  Called                                                              |\n",
"|  Per Frame                                                           |\n",
"|----------------------------------------------------------------------|\n");

	num_ents_used = 0;
	for(i=0;i< brf_group1_len   ;i++)
	{
		brf_function = brf_group1[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group1[i],brf_state) )
			num_ents_used++ == 0;
	}
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Line or Text calls to report in this loop.                  |\n");

	fprintf(brf_file,sep1);

	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Graphics Attributes: Summary Table                             |\n",
"|                                                                      |\n",
"|  Average                                                             |\n",
"|  Times                                                               |\n",
"|  Called                                                              |\n",
"|  Per Frame                                                           |\n",
"|----------------------------------------------------------------------|\n");

	num_ents_used = 0;
	for(i=0;i< brf_group4_len   ;i++)
	{
		brf_function = brf_group4[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group4[i],brf_state) )
			num_ents_used++ == 0;
	}

	for(i=0;i< brf_group2_len   ;i++)
	{
		brf_function = brf_group2[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group2[i],brf_state) )
			num_ents_used++ == 0;
	}
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Attribute calls to report in this loop.                     |\n");

	fprintf(brf_file,sep1);

	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Matrix Operations: Summary Table                               |\n",
"|                                                                      |\n",
"|  Average                                                             |\n",
"|  Times                                                               |\n",
"|  Called                                                              |\n",
"|  Per Frame                                                           |\n",
"|----------------------------------------------------------------------|\n");

	num_ents_used = 0;
	for(i=0;i< brf_group5_len   ;i++)
	{
		brf_function = brf_group5[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group5[i],brf_state) )
			num_ents_used++ == 0;
	}
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Matrix calls to report in this loop.                        |\n");

	fprintf(brf_file,sep1);

	fprintf(brf_file,"\n\n%s%s%s%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|       Structure Calls: Summary Table                                 |\n",
"|                                                                      |\n",
"|  Average                                                             |\n",
"|  Times                                                               |\n",
"|  Called                                                              |\n",
"|  Per Frame                                                           |\n",
"|----------------------------------------------------------------------|\n");

	num_ents_used = 0;
	for(i=0;i< brf_group3_len   ;i++)
	{
		brf_function = brf_group3[i]->any.handler;
		if ( (*brf_function)
	     		(NULL,NULL,brf_group3[i],brf_state) )
			num_ents_used++ == 0;
	}
	if ( num_ents_used == 0) fprintf( brf_file,
"|       No Structure calls to report in this loop.                     |\n");

	fprintf(brf_file,sep1);
	fprintf(brf_file,"\n\n");
/*----------------------------------------------------------------------*/

	fprintf(brf_file,"%s%s%s%s%s",
"------------------------------------------------------------------------\n",
"|                                                                      |\n",
"|       Global Exception: Summary Table                                |\n",
"|                                                                      |\n",
"|----------------------------------------------------------------------|\n");

#ifdef EXTERNALNOTE
	/* this is the routine which prints out the global exceptions messages. 
	The errors are defined in brfexception.h along with the number
	of error messages and their exact text strings. This is the last
	of an older system which has been superceded by brf_except.c.*/
#endif
#ifdef EXCEPTION_HANDLER
/* add error message buffer printout right here. */
	num_exceptions = 0;
	/* global error messages */
	{
	int i;
	for(i=0;i<NUM_GLOBAL_ERRORS;i++)
		{
        	   if((plb_exception & POW2(i)) != 0)
		   {
			num_exceptions++;
               		fprintf(brf_file,brf_exception_txt[i]);
		   }
		}
	}
	for(i=0;i<brf_num_ex_tests;i++)
	{
		if(brf_exception[i].brf_ex_numhits > 0)
		{
			num_exceptions++;
			sprintf(temp_str,"|%s",
			     nice_float_8(
				(float)brf_exception[i].brf_ex_numhits
				/brf_state->brf_num_frames));
			strcat(temp_str,brf_exception[i].brf_ex_message);
			BRF_appendEndBar(temp_str);
			fprintf(brf_file,temp_str);
		}
	}
	if ( num_exceptions == 0) fprintf( brf_file,
"|  No Exceptions to report in this loop.                               |\n");


	fprintf(brf_file,sep1);
	fprintf(brf_file,"\n\n");
	fprintf(brf_file,"\n\n");

#endif
}

/*----------------------------------------------------------------------*\
| Procedure   : void brf_init (	)
|------------------------------------------------------------------------
| Description : Initialized BRF tables
|------------------------------------------------------------------------
| Return      : 
\*----------------------------------------------------------------------*/
void brf_init ( )
{
int i;
int (*brf_function)();
BRF_state brf_state;
	brf_state.brf_flag = BRF_INITIALIZE;
	for(i=0;i< brf_table_size;i++)
	{
		brf_function = brf_table[i]->any.handler;
		(*brf_function)
	     	(NULL,NULL,brf_table[i],&brf_state);
	}
}

/*----------------------------------------------------------------------*\
| Procedure   : void brf_start_stopwatch ()
|------------------------------------------------------------------------
| Description : Starts the stop watch
|------------------------------------------------------------------------
| Return      : 
\*----------------------------------------------------------------------*/
brf_start_stopwatch()
{
float sttime;


	sttime = stopwatch(WATCH_START);
	sttime = stopwatch(WATCH_RESET);
	if(sttime != 0)
	{
		fprintf(stderr,"Failure on timer init.\n");
		fprintf(stderr,"Time should read 0.\n");
		fprintf(stderr,"Timer init returns %f.\n\n\n",sttime);
		exit(-1);
	}
#ifdef DEBUG
	fprintf(stderr,"Stopwatch running. Time reads %f\n",sttime);
	fflush(stderr);
#endif


	/* ST = start your timing here */
}

/*----------------------------------------------------------------------*\
| Procedure   : void brf_stop_stopwatch ( *BRF_state )
|------------------------------------------------------------------------
| Description : Stops the stop watch
|------------------------------------------------------------------------
| Return      : 
\*----------------------------------------------------------------------*/
brf_stop_stopwatch(brf_state)
BRF_state *brf_state;
{
    float ettime;
    float tttime;
    int i = 1; /* flag value for pqcr */
    int coli = 1; /* dummy value for pqcr */
    int red; /* dummy value for pqcr */
    int green; /* dummy value for pqcr */
    int blue; /* dummy value for pqcr */
    int errind; /* dummy value for pqcr */

    /* TT = stop take a split here (lap time?) */
    ettime = stopwatch(WATCH_SPLIT);
#ifdef EXTERNALNOTE
    /* sync your graphics pipeline here */
#endif

#ifdef USING_PHIGS
    {
	Pcolr_rep rep;
	Pint errind;

	pinq_colr_rep((Pint)bench_setup.workid, (Pint)0,
		      PINQ_REALIZED, &errind, &rep);
	
    }
#endif /* USING_PHIGS */

    /* ET = stop your timing here */
    tttime = stopwatch(WATCH_SPLIT);
#ifdef EXTERNALNOTE
    /* 

      TIMING METHODOLOGY

      The overall time reported is from first graphics call issued to
      graphics device to end of last pipe synchronization. Under some 
      circumstances, it would be appropriate to run an empty loop
      to obtain system overhead, then subtract that overhead to get
      the real "Cost of Graphics" figure. However, this method
      is less than accurate for systems with asynchronous graphics
      device accelerators. In the interests of portability among
      different systems, the overhead costs are left intact.  This is the
      same methodology as used in the Level 1 GPC Benchmark.

      */
#endif

    BRF_loopTiming( brf_state->brf_num_frames, 
		   tttime,       /* total elapsed time (+ Tdelay) in seconds */
		   (tttime - ettime),        /* ET - TT in seconds */
		   brf_state->brf_num_frames, /* num frames */ 
		   input_filenm,  /* Current input file name */
		   brf_file);     /* Current open report file pointer */
}