File: ClassDef.c++

package info (click to toggle)
inventor 2.1.5-10-21
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 36,312 kB
  • sloc: ansic: 33,864; lisp: 7,361; cpp: 3,874; yacc: 369; sh: 359; perl: 234; awk: 141; makefile: 81; csh: 35; sed: 11
file content (1552 lines) | stat: -rw-r--r-- 36,945 bytes parent folder | download | duplicates (8)
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
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
/*
 *
 *  Copyright (C) 2000 Silicon Graphics, Inc.  All Rights Reserved. 
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  Further, this software is distributed without any warranty that it is
 *  free of the rightful claim of any third person regarding infringement
 *  or the like.  Any license provided herein, whether implied or
 *  otherwise, applies only to this software file.  Patent licenses, if
 *  any, provided herein do not apply to combinations of this program with
 *  other software, or any other product whatsoever.
 * 
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 *  Mountain View, CA  94043, or:
 * 
 *  http://www.sgi.com 
 * 
 *  For further information regarding this notice, see: 
 * 
 *  http://oss.sgi.com/projects/GenInfo/NoticeExplan/
 *
 */

#include <Inventor/SoLists.h>
#include <Inventor/SoPath.h>
#include <Inventor/engines/SoConcatenate.h>
#include <Inventor/engines/SoEngine.h>
#include <Inventor/engines/SoGate.h>
#include <Inventor/engines/SoSelectOne.h>
#include <Inventor/fields/SoField.h>
#include <Inventor/fields/SoMFTime.h>
#include <Inventor/fields/SoMFInt32.h>
#include <Inventor/fields/SoMFUInt32.h>
#include <Inventor/fields/SoSFTime.h>
#include <Inventor/fields/SoSFInt32.h>
#include <Inventor/fields/SoSFUInt32.h>
#include <Inventor/nodekits/SoBaseKit.h>
#include <Inventor/nodekits/SoNodekitCatalog.h>
#include "Man.h"

/////////////////////////////////////////////////////////////////////////////
//
// Class: ClassDef
//
/////////////////////////////////////////////////////////////////////////////

const ClassDef *	ClassDef::curClass = NULL;

ClassDef::ClassDef()
{
    parentClass = NULL;
}

ClassDef::~ClassDef()
{
    if (type.isDerivedFrom(SoBase::getClassTypeId()) && instance != NULL)
	((SoBase *) instance)->unref();
}

void
ClassDef::addInherit(ClassDef *def)
{
    // FALSE = add to start of list
    inherits.add(new Inherit(def->name), FALSE);
}

SbBool
ClassDef::read()
{
    SbName	nm;
    SbBool	ok = TRUE;

    curClass = this;

    // Read statements while they exist
    while (ok && Reader::readName(nm)) {

	// See what kind of statement we have
	switch (getStatementType(nm)) {

	  case NAME:
	    ok = (Reader::readName(name) &&
		  Reader::readName(cPrefix) &&
		  Reader::readName(cEnumPrefix) &&
		  Reader::readBracketed(shortDescription));
	    if (! ok)
		Reader::error("NAME spec");
	    break;

	  case DESCRIPTION:
	    ok = Reader::readBracketed(longDescription);
	    if (! ok)
		Reader::error("DESC");
	    break;

	  case INCLUDE:
	    ok = readItem(new Include, &includes);
	    break;

	  case TYPEDEF:
	    ok = readItem(new Typedef, &typedefs);
	    break;

	  case DEFINE:
	    ok = readItem(new Define, &defines);
	    break;

	  case ENUM:
	    ok = readItem(new Enum, &enums);
	    break;

	  case FIELD:
	    ok = readItem(new Field, &fields);
	    break;

	  case INPUT:
	    ok = readItem(new Input, &inputs);
	    break;

	  case OUTPUT:
	    ok = readItem(new Output, &outputs);
	    break;

	  case PART:
	    ok = readItem(new Part, &parts);
	    break;

	  case METHOD:
	    ok = readItem(new Method, &methods);
	    break;

	  case DRAGGER_RESOURCE:
	    ok = readItem(new DraggerResource, &draggerResources);
	    break;

	  case MACRO:
	    ok = readItem(new Macro, &macros);
	    break;

	  case ACTION:
	    ok = readItem(new Action, &actions);
	    break;

	  case MISC:
	    ok = readItem(new Misc, &miscs);
	    break;

	  case ALSO:
	    ok = readItem(new Also, &alsos);
	    break;

	  case BEGIN:
	    {
		SbName	langName;

		ok = Reader::readName(langName);

		if (ok) {
		    if (langName == "C")
			Item::setCurLanguage(C);
		    else if (langName == "C++")
			Item::setCurLanguage(C_PLUS_PLUS);
		    else
			ok = FALSE;
		}

		if (! ok)
		    Reader::error("BEGIN language name");
	    }
	    break;

	  case END:
	    Item::setCurLanguage(ALL);
	    break;

	  default:
	    Reader::error("statement keyword");
	    ok = FALSE;
	}
    }

    // If there's stuff left in the file, error
    if (Reader::get() != EOF)
	ok = FALSE;

    return ok;
}

SbBool
ClassDef::readItem(Item *item, ItemList *list)
{
    if (! item->read())
	return FALSE;

    list->add(item);

    return TRUE;
}

ClassDef::StatementType
ClassDef::getStatementType(const SbName &keyword)
{
    static SbName	*names = NULL;
    static const char	*keywords[] = {
	"NAME",
	"DESC",
	"INCLUDE",
	"TYPEDEF",
	"DEFINE",
	"ENUM",
	"FIELD",
	"INPUT",
	"OUTPUT",
	"PART",
	"METHOD",
	"MACRO",
	"ACTION",
	"MISC",
	"ALSO",
	"BEGIN",
	"END",
	"DRAGGER_RESOURCE",
    };	

#define NUM_KEY_WORDS (sizeof(keywords) / sizeof(keywords[0]))

    size_t i;

    if (names == NULL) {
	names = new SbName[NUM_KEY_WORDS];
	for (i = 0; i < NUM_KEY_WORDS; i++)
	    names[i] = keywords[i];
    }

    for (i = 0; i < NUM_KEY_WORDS; i++)
	if (keyword == keywords[i])
	    return (StatementType) i;

    return UNKNOWN;
}

SbBool
ClassDef::setUp(const ClassDef *mainDef)
{
    curClass = this;

    // Find out the type of the class, if any. Remove the "So" from
    // the name, since the names don't contain the prefix.
    // But first check to see if the prefix is Sb.  If so, don't setup
    // up the file format section.
    SbBool isSb = strncmp(name.getString(), "Sb", 2) ? FALSE : TRUE;
    type = SoType::fromName(name.getString() + 2);

    // Get an instance of the class, if possible. If this is not the
    // main ClassDef (mainDef is NULL), we will use an instance of the
    // main ClassDef for this class as well, rather than choosing one
    // randomly in getInstance().
    if (mainDef != NULL)
	instance = mainDef->instance;

    else if (type.isBad() || isSb)
	instance = NULL;

    else {
	instance = getInstance();

	// Ref instance if necessary to keep it around
	if (type.isDerivedFrom(SoBase::getClassTypeId()) && instance != NULL)
	    ((SoBase *) instance)->ref();
    }

    // Set the C prefix to the class name, unless it was specified
    if (Writer::getLanguage() == C && ! cPrefix)
	cPrefix = name;

    if (Writer::getLanguage() == C)
	setUpTypedefs();

    if (! fields.isEmpty() && ! setUpFields())
	return FALSE;

    if (! inputs.isEmpty() && ! setUpInputs())
	return FALSE;

    if (! outputs.isEmpty() && ! setUpOutputs())
	return FALSE;

    // Look up part types (if any)
    if (! parts.isEmpty() && ! setUpParts())
	return FALSE;

    // Produce nodekit catalog and file format if necessary
    if (! isSb) {
	setUpCatalog();
        setUpFileFormat();
    }

    return TRUE;
}

SbBool
ClassDef::setUpTypedefs()
{
    // The C language version has a typedef for the class if the
    // prefix is not the same as the class name
    if (cPrefix != name) {
	Typedef	*def = new Typedef;
	def->language = C;
	def->type = name.getString();
	def->name = cPrefix;

	typedefs.add(def);
    }

    return TRUE;
}

SbBool
ClassDef::setUpFields()
{
    if (instance == NULL ||
	! type.isDerivedFrom(SoFieldContainer::getClassTypeId())) {
	fprintf(stderr, "Can't create a (non-abstract) field container from "
		"class \"%s\"\n", name.getString());
	return FALSE;
    }

    SoFieldContainer *fc = (SoFieldContainer *) instance;

    for (Item *item = fields.first; item != NULL; item = item->next) {
	Field *f = (Field *) item;

	SoField *field = fc->getField(f->name);

	if (field == NULL) {
	    fprintf(stderr, "No field \"%s\" in class \"%s\"\n",
		    f->name.getString(), name.getString());
	    return FALSE;
	}

	SbString typeName = "So";
	SoType fieldType = field->getTypeId();
	if (fieldType == SoSFInt32::getClassTypeId()) {
	    typeName += "SFInt32";
	} else 	if (fieldType == SoMFInt32::getClassTypeId()) {
	    typeName += "MFInt32";
	} else 	if (fieldType == SoSFUInt32::getClassTypeId()) {
	    typeName += "SFUInt32";
	} else 	if (fieldType == SoMFUInt32::getClassTypeId()) {
	    typeName += "MFUInt32";
	} else
	    typeName += fieldType.getName().getString();
	
	f->type = typeName;
    }

    return TRUE;
}

SbBool
ClassDef::setUpInputs()
{
    if (instance == NULL ||
	! type.isDerivedFrom(SoEngine::getClassTypeId())) {
	fprintf(stderr, "Can't create a (non-abstract) engine from "
		"class \"%s\"\n", name.getString());
	return FALSE;
    }

    SoEngine *eng = (SoEngine *) instance;

    for (Item *item = inputs.first; item != NULL; item = item->next) {
	Input *in = (Input *) item;

	SoField *input = eng->getField(in->name);

	if (input == NULL) {
	    fprintf(stderr, 
		    "No input \"%s\" in class \"%s\"\n"
		    "Assuming <inputType>\n",	
		    in->name.getString(), name.getString());
	    SbString typeName = "<inputType>";	
	    in->type = typeName;
	} 
        else {
	    SbString typeName = "So";
	    SoType inputType = input->getTypeId();

	if (inputType == SoSFInt32::getClassTypeId()) {
	    typeName += "SFInt32";
	} else 	if (inputType == SoMFInt32::getClassTypeId()) {
	    typeName += "MFInt32";
	} else 	if (inputType == SoSFUInt32::getClassTypeId()) {
	    typeName += "SFUInt32";
	} else 	if (inputType == SoMFUInt32::getClassTypeId()) {
	    typeName += "MFUInt32";
	} else
	    typeName += inputType.getName().getString();

	    in->type = typeName;
 	}
    }

    return TRUE;
}

SbBool
ClassDef::setUpOutputs()
{
    if (instance == NULL ||
	! type.isDerivedFrom(SoEngine::getClassTypeId())) {
	fprintf(stderr, "Can't create a (non-abstract) engine from "
		"class \"%s\"\n", name.getString());
	return FALSE;
    }

    SoEngine *eng = (SoEngine *) instance;

    for (Item *item = outputs.first; item != NULL; item = item->next) {
	Output *out = (Output *) item;

	SoEngineOutput *output = eng->getOutput(out->name);

	if (output == NULL) {
	    fprintf(stderr, "No output \"%s\" in class \"%s\"\n"
			"Assuming <outputType>\n",
		    out->name.getString(), name.getString());
	    SbString typeName = "<outputType>";
	    out->type = typeName;
	} 
	else {
	    SbString typeName = "So";

	    SoType outputType = output->getConnectionType();
	    if (outputType == SoSFInt32::getClassTypeId()) {
		typeName += "SFInt32";
	    } else 	if (outputType == SoMFInt32::getClassTypeId()) {
		typeName += "MFInt32";
	    } else 	if (outputType == SoSFUInt32::getClassTypeId()) {
		typeName += "SFUInt32";
	    } else 	if (outputType == SoMFUInt32::getClassTypeId()) {
		typeName += "MFUInt32";
	    } else
		typeName += outputType.getName().getString();
	
	    out->type = typeName;
        }
    }

    return TRUE;
}

SbBool
ClassDef::setUpParts()
{
    if (instance == NULL ||
	! type.isDerivedFrom(SoBaseKit::getClassTypeId())) {
	fprintf(stderr, "Can't create a (non-abstract) node kit from "
		"class \"%s\"\n", name.getString());
	return FALSE;
    }

    SoBaseKit *kit = (SoBaseKit *) instance;

    for (Item *item = parts.first; item != NULL; item = item->next) {
	Part *part = (Part *) item;

	const SoNodekitCatalog *cat = kit->getNodekitCatalog();
	SoType type = cat->getType(part->name);

	if (type.isBad()) {
	    fprintf(stderr,"No part \"%s\" in class \"%s\"\n",
		part->name.getString(), name.getString());
		return FALSE;
	}

	SbString typeName = "So";
	typeName += type.getName().getString();

	part->type = typeName;
    }

    return TRUE;
}

SbBool
ClassDef::setUpCatalog()
{
    int	i;

    if (instance == NULL ||
	! type.isDerivedFrom(SoBaseKit::getClassTypeId())) {
	return TRUE;
    }

    SoBaseKit *kit = (SoBaseKit *) instance;

    const SoNodekitCatalog *cat = kit->getNodekitCatalog();

    //
    // Main catalog part table
    //

    // The .ne (need) request makes sure the smallest table fits on
    // the page. For some reason, tbl gets the wrong value for its own
    // .ne, so this hack fixes up some simple cases.
    // First, figure out how many entries are gonna be in the table:
    int numInPublicTable = 0;
    for (i = 0; i < cat->getNumEntries(); i++ )
	if (cat->isPublic(i)) 
	    numInPublicTable++;

    // Next, print a .ne command to a string, adding our fudge number:
#define PUBLIC_TBL_FUDGE_NUM 9
    char nePublicString[20];
    sprintf(nePublicString, ".ne %d\n", PUBLIC_TBL_FUDGE_NUM+numInPublicTable);

    catalog =   nePublicString;
    catalog +=  ".TS\n"
		"box, tab(!);\n"
		"cb s  s  s\n"
		"lb lb lb lb\n"
		"lb lb lb lb\n"
		"l  l  l  c.\n"
		"All parts\n"
		"!!!NULL by\n"
		"Part Name!Part Type!Default Type!Default\n"
		"\n";

    for (i = 0; i < cat->getNumEntries(); i++ ) {

	if (cat->isPublic(i)) {

	    // Part name
	    catalog += cat->getName(i).getString();

	    // Part type
	    catalog += "!";
	    catalog += cat->getType(i).getName().getString();

	    // Default type
	    catalog += "!";
	    if (cat->getDefaultType(i) != cat->getType(i))
		catalog += cat->getDefaultType(i).getName().getString();
	    else
		catalog += "--";

	    // NULL by default
	    catalog += "!";
	    catalog += (cat->isNullByDefault(i) ? "yes" : "no");

	    catalog += "\n";
	}
    }

    catalog += "\n.TE\n";

    //
    // Catalog list part table
    //

    // Make sure there is at least one list first
    SbBool	anyLists = FALSE;
    for (i = 0; i < cat->getNumEntries(); i++ ) {
	if (cat->isList(i) && cat->isPublic(i)) {
	    anyLists = TRUE;
	    break;
	}
    }

    if (anyLists) {

	// The .ne (need) request makes sure the smallest table fits on
	// the page. For some reason, tbl gets the wrong value for its own
	// .ne, so this hack fixes up some simple cases.

	// First, figure out how many entries are gonna be in the table:
	int numInListTable = 0;
	for (i = 0; i < cat->getNumEntries(); i++ )
	    if (cat->isList(i) && cat->isPublic(i))
		numInListTable++;

	// Next, print a .ne command to a string, adding our fudge number:
#define LIST_TBL_FUDGE_NUM 9
	char neListSTring[20];
	sprintf(neListSTring, ".ne %d\n", LIST_TBL_FUDGE_NUM+numInListTable);

	catalog += neListSTring;
	catalog += ".TS\n"
		   "box, tab(!);\n"
		   "cb s  s\n"
		   "lb lb lbw(30n)\n"
		   "l  l  l.\n"
		   "Extra information for list parts from above table\n"
		   ".sp\n"
		   "Part Name!Container Type!Permissible Types\n"
		   "\n";

	for (i = 0; i < cat->getNumEntries(); i++ ) {

	    if (cat->isList(i) && cat->isPublic(i)) {

		// Part name
		catalog += cat->getName(i).getString();

		// Container type
		catalog += "!";
		catalog += cat->getListContainerType(i).getName().getString();

		// Permissible types
 		// Note: type names are entered within T{ and T}
		// blocks so that they can be formatted when necessary.
		catalog += "!T{\n";
		const SoTypeList &permTypes = cat->getListItemTypes(i);
		for (int j = 0; j < permTypes.getLength(); j++) {
		    catalog += permTypes[j].getName().getString();
		    if (j < permTypes.getLength() - 1)
			catalog += ", ";
		}
		catalog += "\nT}";

		catalog += "\n";
	    }
	}

	catalog += "\n.TE\n";
    }

    return TRUE;
}

SbBool
ClassDef::setUpFileFormat()
{
    hasFileFormat = FALSE;
    fileFormat.makeEmpty();
    fileFormatTabLength = -1;

    // We need file format if the class is derived from SoNode or SoEngine
    if (type.isDerivedFrom(SoNode::getClassTypeId()) || 
	type.isDerivedFrom(SoEngine::getClassTypeId())) {

	// Abstract class?
	if (isAbstract) {
	    fileFormat = "This is an abstract class. See the reference page "
		"of a derived class for the format and default values.\n";
	    hasFileFormat = TRUE;
	}

	else if (type.isDerivedFrom(SoBaseKit::getClassTypeId())) {
	    ////////////////////////////////////////////////////////
	    //
	    // Special case for nodekits. They print their fields in 
	    // a different order than they are defined.
	    //
	    if (instance == NULL)
		return TRUE;

	    SoBaseKit *kit = (SoBaseKit *) instance;
	    const SoNodekitCatalog *cat = kit->getNodekitCatalog();

	    SoFieldList		list;
	    kit->getFields(list);

	    SoField  *field;
	    int      partNum, i;
	    SbString fieldVal;
	    SbName   fieldName;
	    int      len;

	    // First, write out fields that are NOT parts...
	    // Whatever they are, just write out the field value.
	    for (i = 0; i < list.getLength(); i++) {

		field = list[i];
		kit->getFieldName(field, fieldName);
		partNum = cat->getPartNumber(fieldName);

		if (partNum == SO_CATALOG_NAME_NOT_FOUND) {
		    field->get(fieldVal);
		    fileFormat += fieldName.getString();
		    fileFormat += "\t";
		    fileFormat += fieldVal;
		    fileFormat += "\n";
		    len = fieldName.getLength();
		    if (len > fileFormatTabLength)
			fileFormatTabLength = len;
		}
	    }

	    // Note: we skip all of this for the BOOK version...
	    if (! Writer::isForBook()) {

		// Second, write out fields that are PUBLIC PARTS.
		// Private parts do not get written in the man page.
		// When writing parts, we write <"resourcename"
		// resource> if the node is named in the global
		// database. Otherwise, we write out the scene graph.
		SoNode *partNode;
		for (i = 0; i < list.getLength(); i++) {

		    field = list[i];
		    kit->getFieldName(field, fieldName);
		    partNum = cat->getPartNumber(fieldName);

		    if (partNum != SO_CATALOG_NAME_NOT_FOUND &&
			cat->isPublic(partNum)) {

			partNode = ((SoSFNode *)field)->getValue();
			if (partNode == NULL  || !partNode->getName()) {
			    // If the node has no name in the global dictionary
			    // or is NULL, print out the value of the node.
			    // This might turn out to be an entire scene graph!
			    field->get(fieldVal);
			}
			else {
			    // Just print out the name of the node.
			    fieldVal = "<";
			    fieldVal += partNode->getName().getString();
			    fieldVal += " resource>";
			}
			fileFormat += fieldName.getString();
			fileFormat += "\t";
			fileFormat += fieldVal;
			fileFormat += "\n";
			len = fieldName.getLength();
			if (len > fileFormatTabLength)
			    fileFormatTabLength = len;
		    }
		}

		// Finally, dragger resources may exist for parts that are in
		// nested draggers. Write out these nested partNames
		// and <"resourcename" resource>
		if (! draggerResources.isEmpty()) {
		    Item *item;
		    for (item = draggerResources.first; 
			 item != NULL; item = item->next ) {

			DraggerResource *res = (DraggerResource *) item;

			// Check if any of the parts that use this resource
			// do not simply match the partNames in the catalog.
			// If not, we write out the partName and resource.
			for (int j = 0; j < res->getNumPartDefs(); j++ ) {
			    const SbName pDefName = res->getPartDefName(j);
			    if ( cat->getPartNumber(pDefName) 
				== SO_CATALOG_NAME_NOT_FOUND ) {
				// Write it all out...
				fieldVal = "<";
				fieldVal += res->getResourceName().getString();
				fieldVal += " resource>";

				fileFormat += pDefName.getString();
				fileFormat += "\t";
				fileFormat += fieldVal;
				fileFormat += "\n";
				len = pDefName.getLength();
				if (len > fileFormatTabLength)
				    fileFormatTabLength = len;
			    }
			}
		    }
		}
	    }

	    hasFileFormat = TRUE;

	    //
	    ////////////////////////////////////////////////////////
	}
	else {
	    SoFieldContainer *fc = (SoFieldContainer *) instance;

	    ////////////////////////////////////////////////////////
	    //
	    // Special case for engines whose constructor takes the
	    // type of field to operate on
	    //
	    if (fc->isOfType(SoConcatenate::getClassTypeId()))
		fileFormat +=	"type\t<inputType>\n"
				"input0\t[]\n"
				"input1\t[]\n"
				"input2\t[]\n"
				"input3\t[]\n"
				"input4\t[]\n"
				"input5\t[]\n"
				"input6\t[]\n"
				"input7\t[]\n"
				"input8\t[]\n"
				"input9\t[]\n";

	    else if (fc->isOfType(SoGate::getClassTypeId()) ||
		     fc->isOfType(SoSelectOne::getClassTypeId()))
		fileFormat += "type\t<inputType>\ninput\t[]\n";
	    //
	    ////////////////////////////////////////////////////////

	    // Make sure each field does not have a default value
	    SoFieldList		list;

	    fc->getFields(list);

	    for (int i = 0; i < list.getLength(); i++) {
		SoField		*field = list[i];
		SbString	fieldVal;
		SbName		fieldName;
		int		len;

		fc->getFieldName(field, fieldName);

		// Special case for time fields connected to the clock
		if (field->isConnected() &&
		    (field->isOfType(SoSFTime::getClassTypeId()) ||
		     field->isOfType(SoMFTime::getClassTypeId())))
		    fieldVal = "<current time>";
		else
		    field->get(fieldVal);

		fileFormat += fieldName.getString();
		fileFormat += "\t";
		fileFormat += fieldVal;
		fileFormat += "\n";

		len = fieldName.getLength();
		if (len > fileFormatTabLength)
		    fileFormatTabLength = len;
	    }
	    hasFileFormat = TRUE;
	}
    }

    return TRUE;
}

void *
ClassDef::getInstance()
{
    void	*inst;

    isAbstract = ! type.canCreateInstance();

    // If the given class is not abstract, return an instance of it
    if (! isAbstract)
	inst = type.createInstance();

    else {
	// Otherwise, find all classes derived from the class and
	// return the first one that is not abstract
	SoTypeList list;
	SoType::getAllDerivedFrom(type, list);

	inst = NULL;

	for (int i = 0; i < list.getLength(); i++) {
	    if (list[i].canCreateInstance()) {
		inst = list[i].createInstance();
		break;
	    }
	}
    }

    // No non-abstract classes
    return inst;
}

void
ClassDef::cullMethods()
{
    ////////////////////////////////////////////
    //
    // This method is called on the main ClassDef - the one the man
    // page is for. It removes any method from an inherited class that:
    //	   (1) is a constructor,
    //  or (2) has the same name as a method on a more derived class,
    //  or (3) is a destructor and the language is C++.
    //
    // It also removes hidden methods from the main ClassDef and all
    // inherited ClassDefs.
    //
    ////////////////////////////////////////////

    ClassDef	*cd, *inheritedCd;
    Method	*meth, *inhMeth, *prevMeth;

    //
    // Pass 1: Mark all constructors and destructors
    //
    for (cd = parentClass; cd != NULL; cd = cd->parentClass) {
	for (meth = (Method *) cd->methods.first;
	     meth != NULL;
	     meth = (Method *) meth->next) {

	    // Remove constructors
	    if (meth->type == Method::CONSTRUCTOR)
		meth->skipThis = TRUE;

	    // Remove destructors from C++
	    else if (meth->type == Method::DESTRUCTOR &&
		     Writer::getLanguage() == C_PLUS_PLUS)
		meth->skipThis = TRUE;
	}
    }

    //
    // Pass 2: Mark any method with the same name as in a more
    // derived class. This is a slow way to do this, but it shouldn't
    // be too bad in most cases.
    //
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	for (meth = (Method *) cd->methods.first;
	     meth != NULL;
	     meth = (Method *) meth->next) {

	    if (! meth->skipThis) {

		// Look through inherited classes for a method with
		// the same name

		for (inheritedCd = cd->parentClass; inheritedCd != NULL;
		     inheritedCd = inheritedCd->parentClass) {

		    if (Writer::getLanguage() == C) {
			for (inhMeth = (Method *) inheritedCd->methods.first;
			     inhMeth != NULL;
			     inhMeth = (Method *) inhMeth->next) {

			    if (inhMeth->cName == meth->cName)
				inhMeth->skipThis = TRUE;
			}
		    }
		    else {
			for (inhMeth = (Method *) inheritedCd->methods.first;
			     inhMeth != NULL;
			     inhMeth = (Method *) inhMeth->next) {

			    if (inhMeth->name == meth->name)
				inhMeth->skipThis = TRUE;
			}
		    }
		}
	    }
	}
    }

    //
    // Pass 3: Mark hidden methods
    //
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	for (meth = (Method *) cd->methods.first;
	     meth != NULL;
	     meth = (Method *) meth->next) {

	    if (meth->isHidden)
		meth->skipThis = TRUE;
	}
    }

    //
    // Pass 4: Actually remove marked methods from lists
    //
    for (cd = this; cd != NULL; cd = cd->parentClass) {

	prevMeth = NULL;

	for (meth = (Method *) cd->methods.first;
	     meth != NULL;
	     meth = (Method *) meth->next) {

	    if (meth->skipThis) {
		if (prevMeth == NULL)
		    cd->methods.first = meth->next;
		else
		    prevMeth->next = meth->next;
	    }
	    else
		prevMeth = meth;
	}
    }
}

void
ClassDef::write(SbBool)
{
    curClass = this;

    Writer::writePreface(name);

    if (Writer::isForBook())
	writeForBook();
    else
	writeForNonBook();
}

void
ClassDef::writeForBook()
{
    ClassDef	*cd;
    SbBool	anyItem;

    ////////////////////////////////////////////////////////
    //
    // NAME section
    //

    writeName();

    ////////////////////////////////////////////////////////
    //
    // INHERITS FROM section
    //

    Writer::startSection("INHERITS FROM");
    inherits.write();

    ////////////////////////////////////////////////////////
    //
    // DESCRIPTION section
    //

    Writer::startSection("DESCRIPTION");
    Writer::writeBracketed(longDescription);

    ////////////////////////////////////////////////////////
    //
    // FIELDS section
    //

    anyItem = FALSE;
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	if (! cd->fields.isEmpty()) {
	    anyItem = TRUE;
	    break;
	}
    }
    if (anyItem) {
	Writer::startSection("FIELDS");
	if (! fields.isEmpty())
	    fields.write();
	for (cd = parentClass; cd != NULL; cd = cd->parentClass)
	    if (! cd->fields.isEmpty())
		cd->writeFromClass(&cd->fields, "Fields", TRUE);
    }

    ////////////////////////////////////////////////////////
    //
    // INPUTS section
    //

    anyItem = FALSE;
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	if (! cd->inputs.isEmpty()) {
	    anyItem = TRUE;
	    break;
	}
    }
    if (anyItem) {
	Writer::startSection("INPUTS");
	if (! inputs.isEmpty())
	    inputs.write();
	for (cd = parentClass; cd != NULL; cd = cd->parentClass)
	    if (! cd->inputs.isEmpty())
		cd->writeFromClass(&cd->inputs, "Inputs", TRUE);
    }

    ////////////////////////////////////////////////////////
    //
    // OUTPUTS section
    //

    anyItem = FALSE;
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	if (! cd->outputs.isEmpty()) {
	    anyItem = TRUE;
	    break;
	}
    }
    if (anyItem) {
	Writer::startSection("OUTPUTS");
	if (! outputs.isEmpty())
	    outputs.write();
	for (cd = parentClass; cd != NULL; cd = cd->parentClass)
	    if (! cd->outputs.isEmpty())
		cd->writeFromClass(&cd->outputs, "Outputs", TRUE);
    }

    ////////////////////////////////////////////////////////
    //
    // PARTS section
    //

    anyItem = FALSE;
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	if (! cd->parts.isEmpty()) {
	    anyItem = TRUE;
	    break;
	}
    }
    if (anyItem) {
	Writer::startSection("PARTS");
	if (! parts.isEmpty())
	    parts.write();
	for (cd = parentClass; cd != NULL; cd = cd->parentClass)
	    if (! cd->parts.isEmpty())
		cd->writeFromClass(&cd->parts, "Parts", TRUE);
    }

    ////////////////////////////////////////////////////////
    //
    // METHODS section
    //

    anyItem = FALSE;
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	if (! cd->methods.isEmpty()) {
	    anyItem = TRUE;
	    break;
	}
    }
    if (anyItem) {
	Writer::startSection(Writer::getLanguage() == C ?
			     "FUNCTIONS" : "METHODS");
	if (! methods.isEmpty())
	    methods.write();
	for (cd = parentClass; cd != NULL; cd = cd->parentClass)
	    if (! cd->methods.isEmpty())
		cd->writeFromClass(&cd->methods,
				   (Writer::getLanguage() == C ?
				    "Functions" : "Methods"),
				   TRUE);
    }

    ////////////////////////////////////////////////////////
    //
    // MACROS section
    //

    anyItem = FALSE;
    for (cd = this; cd != NULL; cd = cd->parentClass) {
	if (! cd->macros.isEmpty()) {
	    anyItem = TRUE;
	    break;
	}
    }
    if (anyItem) {
	Writer::startSection("MACROS");
	if (! macros.isEmpty())
	    macros.write();
	for (cd = parentClass; cd != NULL; cd = cd->parentClass)
	    if (! cd->macros.isEmpty())
		cd->writeFromClass(&cd->macros, "Macros", TRUE);
    }

    ////////////////////////////////////////////////////////
    //
    // ACTION BEHAVIOR section
    //

    if (! actions.isEmpty()) {
	Writer::startSection("ACTION BEHAVIOR");
	actions.write();
    }

    ////////////////////////////////////////////////////////
    //
    // CATALOG PARTS section
    //

    if (! ! catalog) {
	Writer::startSection("CATALOG PARTS");
	Writer::write(catalog);
    }

    ////////////////////////////////////////////////////////
    //
    // FILE FORMAT section
    //

    writeFileFormat();

    ////////////////////////////////////////////////////////
    //
    // Include files
    //

    if (! includes.isEmpty()) {
	Writer::startSection("INCLUDE FILE");

	Writer::changeSize(-1);

	// Include files for this class
	includes.write();

	// XXX we needed to list these things somewhere,
	// so here they are --AE
    	// Typedefs for this class
    	typedefs.write();
	
    	// Definitions for this class
    	defines.write();

    	// Enums for this class
    	enums.write();
    }

    ////////////////////////////////////////////////////////
    //
    // Miscellaneous sections
    //

    if (! miscs.isEmpty())
	miscs.write();

    ////////////////////////////////////////////////////////
    //
    // SEE ALSO section
    //

    if (! alsos.isEmpty()) {
	Writer::startSection("SEE ALSO");
	alsos.write();
    }

    ////////////////////////////////////////////////////////

    Writer::finish();
}

void
ClassDef::writeForNonBook()
{
    ////////////////////////////////////////////////////////
    //
    // NAME section
    //

    writeName();

    ////////////////////////////////////////////////////////
    //
    // INHERITS FROM section
    //

    Writer::startSection("INHERITS FROM");
    inherits.write();

    ////////////////////////////////////////////////////////
    //
    // SYNOPSIS section
    //

    writeSynopsis();

    ////////////////////////////////////////////////////////
    //
    // DESCRIPTION section
    //

    Writer::startSection("DESCRIPTION");
    Writer::writeBracketed(longDescription);

    ////////////////////////////////////////////////////////
    //
    // FIELDS section
    //

    if (! fields.isEmpty()) {
	Writer::startSection("FIELDS");
	fields.write();
    }

    ////////////////////////////////////////////////////////
    //
    // INPUTS section
    //

    if (! inputs.isEmpty()) {
	Writer::startSection("INPUTS");
	inputs.write();
    }

    ////////////////////////////////////////////////////////
    //
    // OUTPUTS section
    //

    if (! outputs.isEmpty()) {
	Writer::startSection("OUTPUTS");
	outputs.write();
    }

    ////////////////////////////////////////////////////////
    //
    // PARTS section
    //

    if (! parts.isEmpty()) {
	Writer::startSection("PARTS");
	parts.write();
    }

    ////////////////////////////////////////////////////////
    //
    // METHODS section
    //

    if (! methods.isEmpty()) {
	Writer::startSection(Writer::getLanguage() == C ?
			     "FUNCTIONS" : "METHODS");
	methods.write();
    }

    ////////////////////////////////////////////////////////
    //
    // MACROS section
    //

    if (! macros.isEmpty()) {
	Writer::startSection("MACROS");
	macros.write();
    }

    ////////////////////////////////////////////////////////
    //
    // ACTION BEHAVIOR section
    //

    if (! actions.isEmpty()) {
	Writer::startSection("ACTION BEHAVIOR");
	actions.write();
    }

    ////////////////////////////////////////////////////////
    //
    // CATALOG PARTS section
    //

    if (! ! catalog) {
	Writer::startSection("CATALOG PARTS");
	Writer::write(catalog);
    }

    ////////////////////////////////////////////////////////
    //
    // DRAGGER RESOURCES section (for draggers)
    //

    if (! draggerResources.isEmpty()) {
	Writer::startSection("DRAGGER RESOURCES");
	draggerResources.write();
    }

    ////////////////////////////////////////////////////////
    //
    // FILE FORMAT section
    //

    writeFileFormat();

    ////////////////////////////////////////////////////////
    //
    // Miscellaneous sections
    //

    if (! miscs.isEmpty())
	miscs.write();

    ////////////////////////////////////////////////////////
    //
    // SEE ALSO section
    //

    if (! alsos.isEmpty()) {
	Writer::startSection("SEE ALSO");
	alsos.write();
    }

    ////////////////////////////////////////////////////////

    Writer::finish();
}

void
ClassDef::writeName()
{
    Writer::startSection("NAME");
    Writer::write(name);
    if (Writer::getLanguage() == C) {
	Writer::write(" (");
	Writer::write(cPrefix);
	Writer::write(") \\(em ");
    }
    else
	Writer::write(" \\(em ");

    Writer::writeBracketed(shortDescription);
}

void
ClassDef::writeSynopsis()
{
    ClassDef *cd;

    Writer::setInSynopsis(TRUE);

    Writer::startSection("SYNOPSIS");
    Writer::changeSize(-1);

    // Include files for this class
    includes.write();

    // Typedefs for this class
    typedefs.write();

    // Definitions for this class
    defines.write();

    // Enums for this class
    enums.write();

    // Fields for this class, then all parent classes
    for (cd = this; cd != NULL; cd = cd->parentClass)
	if (! cd->fields.isEmpty())
	    cd->writeFromClass(&cd->fields, "Fields");

    // Inputs for this class, then all parent classes
    for (cd = this; cd != NULL; cd = cd->parentClass)
	if (! cd->inputs.isEmpty())
	    cd->writeFromClass(&cd->inputs, "Inputs");

    // Outputs for this class, then all parent classes
    for (cd = this; cd != NULL; cd = cd->parentClass)
	if (! cd->outputs.isEmpty())
	    cd->writeFromClass(&cd->outputs, "Outputs");

    // Parts for this class, then all parent classes
    for (cd = this; cd != NULL; cd = cd->parentClass)
	if (! cd->parts.isEmpty())
	    cd->writeFromClass(&cd->parts, "Parts");

    // Methods for this class, then all parent classes
    for (cd = this; cd != NULL; cd = cd->parentClass)
	if (! cd->methods.isEmpty())
	    cd->writeFromClass(&cd->methods,
			       (Writer::getLanguage() == C ?
				"Functions" : "Methods"));

    // Macros for this class, then all parent classes
    for (cd = this; cd != NULL; cd = cd->parentClass)
	if (! cd->macros.isEmpty())
	    cd->writeFromClass(&cd->macros, "Macros");

    Writer::setInSynopsis(FALSE);
}

void
ClassDef::writeFileFormat()
{
    // Paths have a special file format:
    if (type == SoPath::getClassTypeId()) {
	Writer::startSection("FILE FORMAT/DEFAULTS");

	Writer::setFill(FALSE);
	Writer::setFont(Writer::FIXED_ROMAN);
	Writer::write("SoPath {\n");
	Writer::setBaseIndent(0.5);
	Writer::write("[head node]\n"
		      "[number of remaining indices]\n"
		      "[index]\n"
		      "\\&...\n"
		      "[index]\n");
	Writer::setBaseIndent(0.0);
	Writer::write("}\n\n");

	Writer::setFill(TRUE);
	Writer::setFont(Writer::TEXT_ROMAN);
	Writer::write("Note that the indices in a written path are "
		      "adjusted based on the nodes that are actually "
		      "written to a file. Since nodes in the graph "
		      "that have no effect on the path (such as some "
		      "separator nodes) are not written, the siblings "
		      "of such nodes must undergo index adjustment "
		      "when written. The actual nodes in the graph "
		      "remain unchanged.\n");
    }

    else if (hasFileFormat) {
	Writer::startSection("FILE FORMAT/DEFAULTS");

	if (isAbstract)
	    Writer::write(fileFormat);

	else {
	    Writer::setFill(FALSE);
	    Writer::setFont(Writer::FIXED_ROMAN);
	    // Remove "So" prefix from name
	    Writer::write(name.getString() + 2);
	    Writer::write(" {\n");

	    // Classes with no fields have an empty fileFormat string
	    if (! ! fileFormat) {
		Writer::setBaseIndent(0.5);
		Writer::setTab(fileFormatTabLength +
			       (fileFormatTabLength < 0 ? 0 : 2));
		Writer::write(fileFormat);
		Writer::setBaseIndent(0.0);
	    }

	    Writer::write("}\n");
	}
    }
}

void
ClassDef::writeFromClass(ItemList *list, const char *whats, SbBool runIn)
{
    if (Writer::isForBook()) {
	Writer::setBaseIndent(0.0);
	Writer::setFont(Writer::TEXT_BOLD);
    }
    else {
	Writer::setBaseIndent(0.5);
	Writer::setFont(Writer::TEXT_ROMAN);
    }
    Writer::write(whats);
    Writer::write(" from class ");
    Writer::write(name);
    Writer::write(":\n");
    if (Writer::isForBook()) {
	Writer::setBaseIndent(0.5);
	Writer::space(.25);
    }
    else {
	Writer::setBaseIndent(0.0);
	Writer::space();
    }

    list->write(runIn);
}