]>
git.saurik.com Git - wxWidgets.git/blob - utils/tex2rtf/src/tex2rtf.cpp
88d23ff9c82845cbc5c0cb457b8b5e0f8b47f8c6
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Converts Latex to linear/WinHelp RTF, HTML, wxHelp.
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
32 #if defined(NO_GUI) || defined(__UNIX__)
48 #if (defined(__WXGTK__) || defined(__WXMOTIF__)) && !defined(NO_GUI)
49 #include "tex2rtf.xpm"
52 const float versionNo
= 2.0;
54 TexChunk
*currentMember
= NULL
;
55 bool startedSections
= FALSE
;
56 char *contentsString
= NULL
;
57 bool suppressNameDecoration
= FALSE
;
58 bool OkToClose
= TRUE
;
64 wxHelpController
*HelpInstance
= NULL
;
68 static char *ipc_buffer
= NULL
;
69 static char Tex2RTFLastStatus
[100];
70 Tex2RTFServer
*TheTex2RTFServer
= NULL
;
74 char *bulletFile
= NULL
;
76 FILE *Contents
= NULL
; // Contents page
77 FILE *Chapters
= NULL
; // Chapters (WinHelp RTF) or rest of file (linear RTF)
78 FILE *Sections
= NULL
;
79 FILE *Subsections
= NULL
;
80 FILE *Subsubsections
= NULL
;
82 FILE *WinHelpContentsFile
= NULL
;
84 char *InputFile
= NULL
;
85 char *OutputFile
= NULL
;
86 char *MacroFile
= copystring("tex2rtf.ini");
88 char *FileRoot
= NULL
;
89 char *ContentsName
= NULL
; // Contents page from last time around
90 char *TmpContentsName
= NULL
; // Current contents page
91 char *TmpFrameContentsName
= NULL
; // Current frame contents page
92 char *WinHelpContentsFileName
= NULL
; // WinHelp .cnt file
93 char *RefName
= NULL
; // Reference file name
95 char *RTFCharset
= copystring("ansi");
98 int BufSize
= 100; // Size of buffer in K
104 void ShowOptions(void);
108 #if wxUSE_GUI || !defined(__UNIX__)
109 // wxBase for Unix does not have wxBuffer
112 char *wxBuffer
; // we must init it, otherwise tex2rtf will crash
114 int main(int argc
, char **argv
)
116 wxMenuBar
*menuBar
= NULL
;
117 MyFrame
*frame
= NULL
;
119 // DECLARE_APP(MyApp)
122 // `Main program' equivalent, creating windows and returning main app frame
126 // Use default list of macros defined in tex2any.cc
127 DefineDefaultMacros();
128 AddMacroDef(ltHARDY
, "hardy", 0);
130 FileRoot
= new char[300];
131 ContentsName
= new char[300];
132 TmpContentsName
= new char[300];
133 TmpFrameContentsName
= new char[300];
134 WinHelpContentsFileName
= new char[300];
135 RefName
= new char[300];
139 // Read input/output files
142 if (argv
[1][0] != '-')
149 if (argv
[2][0] != '-')
151 OutputFile
= argv
[2];
159 wxBuffer
= new char[1500];
160 // this is done in wxApp, but NO_GUI version doesn't call it :-(
162 if (!InputFile
|| !OutputFile
)
164 cout
<< "Tex2RTF: input or output file is missing.\n";
172 TexPathList
.EnsureFileAccessible(InputFile
);
174 if (!InputFile
|| !OutputFile
)
175 isInteractive
= TRUE
;
178 for (i
= n
; i
< argc
;)
180 if (strcmp(argv
[i
], "-winhelp") == 0)
183 convertMode
= TEX_RTF
;
187 else if (strcmp(argv
[i
], "-interactive") == 0)
190 isInteractive
= TRUE
;
193 else if (strcmp(argv
[i
], "-sync") == 0) // Don't yield
198 else if (strcmp(argv
[i
], "-rtf") == 0)
201 convertMode
= TEX_RTF
;
203 else if (strcmp(argv
[i
], "-html") == 0)
206 convertMode
= TEX_HTML
;
208 else if (strcmp(argv
[i
], "-xlp") == 0)
211 convertMode
= TEX_XLP
;
213 else if (strcmp(argv
[i
], "-twice") == 0)
218 else if (strcmp(argv
[i
], "-macros") == 0)
223 MacroFile
= copystring(argv
[i
]);
227 else if (strcmp(argv
[i
], "-bufsize") == 0)
232 BufSize
= atoi(argv
[i
]);
236 else if (strcmp(argv
[i
], "-charset") == 0)
243 if (strcmp(s
, "ansi") == 0 || strcmp(s
, "pc") == 0 || strcmp(s
, "mac") == 0 ||
244 strcmp(s
, "pca") == 0)
245 RTFCharset
= copystring(s
);
248 OnError("Incorrect argument for -charset");
256 sprintf(buf
, "Invalid switch %s.\n", argv
[i
]);
267 #if defined(__WXMSW__) && !defined(NO_GUI)
269 Tex2RTFLastStatus
[0] = 0; // DDE connection return value
270 TheTex2RTFServer
= new Tex2RTFServer
;
271 TheTex2RTFServer
->Create("TEX2RTF");
274 #if defined(__WXMSW__) && defined(__WIN16__)
275 // Limit to max Windows array size
276 if (BufSize
> 64) BufSize
= 64;
279 TexInitialize(BufSize
);
280 ResetContentsLevels(0);
288 // Create the main frame window
289 frame
= new MyFrame(NULL
, -1, "Tex2RTF", wxPoint(-1, -1), wxSize(400, 300));
290 frame
->CreateStatusBar(2);
293 // TODO: uncomment this when we have tex2rtf.xpm
294 frame
->SetIcon(wxICON(tex2rtf
));
298 sprintf(buf
, "Tex2RTF [%s]", FileNameFromPath(InputFile
));
299 frame
->SetTitle(buf
);
303 wxMenu
*file_menu
= new wxMenu
;
304 file_menu
->Append(TEX_GO
, "&Go", "Run converter");
305 file_menu
->Append(TEX_SET_INPUT
, "Set &Input File", "Set the LaTeX input file");
306 file_menu
->Append(TEX_SET_OUTPUT
, "Set &Output File", "Set the output file");
307 file_menu
->AppendSeparator();
308 file_menu
->Append(TEX_VIEW_LATEX
, "View &LaTeX File", "View the LaTeX input file");
309 file_menu
->Append(TEX_VIEW_OUTPUT
, "View Output &File", "View output file");
310 file_menu
->Append(TEX_SAVE_FILE
, "&Save log file", "Save displayed text into file");
311 file_menu
->AppendSeparator();
312 file_menu
->Append(TEX_QUIT
, "E&xit", "Exit Tex2RTF");
314 wxMenu
*macro_menu
= new wxMenu
;
316 macro_menu
->Append(TEX_LOAD_CUSTOM_MACROS
, "&Load Custom Macros", "Load custom LaTeX macro file");
317 macro_menu
->Append(TEX_VIEW_CUSTOM_MACROS
, "View &Custom Macros", "View custom LaTeX macros");
319 wxMenu
*mode_menu
= new wxMenu
;
321 mode_menu
->Append(TEX_MODE_RTF
, "Output linear &RTF", "Wordprocessor-compatible RTF");
322 mode_menu
->Append(TEX_MODE_WINHELP
, "Output &WinHelp RTF", "WinHelp-compatible RTF");
323 mode_menu
->Append(TEX_MODE_HTML
, "Output &HTML", "HTML World Wide Web hypertext file");
324 mode_menu
->Append(TEX_MODE_XLP
, "Output &XLP", "wxHelp hypertext help file");
326 wxMenu
*help_menu
= new wxMenu
;
328 help_menu
->Append(TEX_HELP
, "&Help", "Tex2RTF Contents Page");
329 help_menu
->Append(TEX_ABOUT
, "&About Tex2RTF", "About Tex2RTF");
331 menuBar
= new wxMenuBar
;
332 menuBar
->Append(file_menu
, "&File");
333 menuBar
->Append(macro_menu
, "&Macros");
334 menuBar
->Append(mode_menu
, "&Conversion Mode");
335 menuBar
->Append(help_menu
, "&Help");
337 frame
->SetMenuBar(menuBar
);
338 frame
->textWindow
= new wxTextCtrl(frame
, -1, "", wxPoint(-1, -1), wxSize(-1, -1), wxTE_READONLY
|wxTE_MULTILINE
);
340 (*frame
->textWindow
) << "Welcome to Julian Smart's LaTeX to RTF converter.\n";
344 HelpInstance
= new wxHelpController();
345 HelpInstance
->Initialize("tex2rtf");
349 * Read macro/initialisation file
354 if ((path
= TexPathList
.FindValidPath(MacroFile
)) != "")
355 ReadCustomMacros((char*) (const char*) path
);
359 if (winHelp
&& (convertMode
== TEX_RTF
))
360 strcat(buf
, "WinHelp RTF");
361 else if (!winHelp
&& (convertMode
== TEX_RTF
))
362 strcat(buf
, "linear RTF");
363 else if (convertMode
== TEX_HTML
) strcat(buf
, "HTML");
364 else if (convertMode
== TEX_XLP
) strcat(buf
, "XLP");
365 strcat(buf
, " mode.");
366 frame
->SetStatusText(buf
, 1);
375 * Read macro/initialisation file
380 if ((path
= TexPathList
.FindValidPath(MacroFile
)) != "")
381 ReadCustomMacros((char*) (const char*) path
);
393 // Return the main frame window
404 wxNode
*node
= CustomMacroList
.First();
407 CustomMacro
*macro
= (CustomMacro
*)node
->Data();
410 node
= CustomMacroList
.First();
412 MacroDefs
.BeginFind();
413 node
= MacroDefs
.Next();
416 TexMacroDef
* def
= (TexMacroDef
*) node
->Data();
418 node
= MacroDefs
.Next();
422 delete TheTex2RTFServer
;
430 // TODO: this simulates zero-memory leaks!
431 // Otherwise there are just too many...
433 wxDebugContext::SetCheckpoint();
439 void ShowOptions(void)
442 sprintf(buf
, "Tex2RTF version %.2f", versionNo
);
444 OnInform("Usage: tex2rtf [input] [output] [switches]\n");
445 OnInform("where valid switches are");
446 OnInform(" -interactive");
447 OnInform(" -bufsize <size in K>");
448 OnInform(" -charset <pc | pca | ansi | mac> (default ansi)");
451 OnInform(" -macros <filename>");
452 OnInform(" -winhelp");
460 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
461 EVT_CLOSE(MyFrame::OnCloseWindow
)
462 EVT_MENU(TEX_QUIT
, MyFrame::OnExit
)
463 EVT_MENU(TEX_GO
, MyFrame::OnGo
)
464 EVT_MENU(TEX_SET_INPUT
, MyFrame::OnSetInput
)
465 EVT_MENU(TEX_SET_OUTPUT
, MyFrame::OnSetOutput
)
466 EVT_MENU(TEX_SAVE_FILE
, MyFrame::OnSaveFile
)
467 EVT_MENU(TEX_VIEW_LATEX
, MyFrame::OnViewLatex
)
468 EVT_MENU(TEX_VIEW_OUTPUT
, MyFrame::OnViewOutput
)
469 EVT_MENU(TEX_VIEW_CUSTOM_MACROS
, MyFrame::OnShowMacros
)
470 EVT_MENU(TEX_LOAD_CUSTOM_MACROS
, MyFrame::OnLoadMacros
)
471 EVT_MENU(TEX_MODE_RTF
, MyFrame::OnModeRTF
)
472 EVT_MENU(TEX_MODE_WINHELP
, MyFrame::OnModeWinHelp
)
473 EVT_MENU(TEX_MODE_HTML
, MyFrame::OnModeHTML
)
474 EVT_MENU(TEX_MODE_XLP
, MyFrame::OnModeXLP
)
475 EVT_MENU(TEX_HELP
, MyFrame::OnHelp
)
476 EVT_MENU(TEX_ABOUT
, MyFrame::OnAbout
)
479 // My frame constructor
480 MyFrame::MyFrame(wxFrame
*frame
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
):
481 wxFrame(frame
, id
, title
, pos
, size
)
484 void MyFrame::OnCloseWindow(wxCloseEvent
& event
)
486 if (!stopRunning
&& !OkToClose
)
498 void MyFrame::OnExit(wxCommandEvent
& event
)
503 void MyFrame::OnGo(wxCommandEvent
& event
)
506 menuBar
->EnableTop(0, FALSE
);
507 menuBar
->EnableTop(1, FALSE
);
508 menuBar
->EnableTop(2, FALSE
);
509 menuBar
->EnableTop(3, FALSE
);
519 menuBar
->EnableTop(0, TRUE
);
520 menuBar
->EnableTop(1, TRUE
);
521 menuBar
->EnableTop(2, TRUE
);
522 menuBar
->EnableTop(3, TRUE
);
525 void MyFrame::OnSetInput(wxCommandEvent
& event
)
527 ChooseInputFile(TRUE
);
530 void MyFrame::OnSetOutput(wxCommandEvent
& event
)
532 ChooseOutputFile(TRUE
);
535 void MyFrame::OnSaveFile(wxCommandEvent
& event
)
537 wxString s
= wxFileSelector("Save text to file", "", "", "txt", "*.txt");
540 textWindow
->SaveFile(s
);
542 sprintf(buf
, "Saved text to %s", (const char*) s
);
543 frame
->SetStatusText(buf
, 0);
547 void MyFrame::OnViewOutput(wxCommandEvent
& event
)
550 if (OutputFile
&& wxFileExists(OutputFile
))
552 textWindow
->LoadFile(OutputFile
);
554 wxString
str(wxFileNameFromPath(OutputFile
));
555 sprintf(buf
, "Tex2RTF [%s]", (const char*) str
);
556 frame
->SetTitle(buf
);
560 void MyFrame::OnViewLatex(wxCommandEvent
& event
)
563 if (InputFile
&& wxFileExists(InputFile
))
565 textWindow
->LoadFile(InputFile
);
567 wxString
str(wxFileNameFromPath(OutputFile
));
568 sprintf(buf
, "Tex2RTF [%s]", (const char*) str
);
569 frame
->SetTitle(buf
);
573 void MyFrame::OnLoadMacros(wxCommandEvent
& event
)
576 wxString s
= wxFileSelector("Choose custom macro file", wxPathOnly(MacroFile
), wxFileNameFromPath(MacroFile
), "ini", "*.ini");
577 if (s
!= "" && wxFileExists(s
))
579 MacroFile
= copystring(s
);
580 ReadCustomMacros((char*) (const char*) s
);
585 void MyFrame::OnShowMacros(wxCommandEvent
& event
)
592 void MyFrame::OnModeRTF(wxCommandEvent
& event
)
594 convertMode
= TEX_RTF
;
598 SetStatusText("In linear RTF mode.", 1);
601 void MyFrame::OnModeWinHelp(wxCommandEvent
& event
)
603 convertMode
= TEX_RTF
;
607 SetStatusText("In WinHelp RTF mode.", 1);
610 void MyFrame::OnModeHTML(wxCommandEvent
& event
)
612 convertMode
= TEX_HTML
;
616 SetStatusText("In HTML mode.", 1);
619 void MyFrame::OnModeXLP(wxCommandEvent
& event
)
621 convertMode
= TEX_XLP
;
624 SetStatusText("In XLP mode.", 1);
627 void MyFrame::OnHelp(wxCommandEvent
& event
)
630 HelpInstance
->LoadFile();
631 HelpInstance
->DisplayContents();
635 void MyFrame::OnAbout(wxCommandEvent
& event
)
639 char *platform
= " (32-bit)";
642 char *platform
= " (16-bit)";
647 sprintf(buf
, "Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, HTML and wxHelp Conversion\n\n(c) Julian Smart 1999", versionNo
, platform
);
648 wxMessageBox(buf
, "About Tex2RTF");
651 void ChooseInputFile(bool force
)
653 if (force
|| !InputFile
)
655 wxString s
= wxFileSelector("Choose LaTeX input file", wxPathOnly(InputFile
), wxFileNameFromPath(InputFile
), "tex", "*.tex");
658 // Different file, so clear index entries.
660 ResetContentsLevels(0);
663 InputFile
= copystring(s
);
664 wxString str
= wxFileNameFromPath(InputFile
);
665 sprintf(buf
, "Tex2RTF [%s]", (const char*) str
);
666 frame
->SetTitle(buf
);
672 void ChooseOutputFile(bool force
)
674 char extensionBuf
[10];
676 strcpy(wildBuf
, "*.");
679 path
= wxPathOnly(OutputFile
);
681 path
= wxPathOnly(InputFile
);
687 strcpy(extensionBuf
, "rtf");
688 strcat(wildBuf
, "rtf");
693 strcpy(extensionBuf
, "xlp");
694 strcat(wildBuf
, "xlp");
699 #if defined(__WXMSW__) && defined(__WIN16__)
700 strcpy(extensionBuf
, "htm");
701 strcat(wildBuf
, "htm");
703 strcpy(extensionBuf
, "html");
704 strcat(wildBuf
, "html");
709 if (force
|| !OutputFile
)
711 wxString s
= wxFileSelector("Choose output file", path
, wxFileNameFromPath(OutputFile
),
712 extensionBuf
, wildBuf
);
714 OutputFile
= copystring(s
);
726 if (!InputFile
|| !OutputFile
)
733 wxString str
= wxFileNameFromPath(InputFile
);
735 sprintf(buf
, "Tex2RTF [%s]", (const char*) str
);
736 frame
->SetTitle(buf
);
742 // Find extension-less filename
743 strcpy(FileRoot
, OutputFile
);
744 StripExtension(FileRoot
);
746 if (truncateFilenames
&& convertMode
== TEX_HTML
)
748 // Truncate to five characters. This ensures that
749 // we can generate DOS filenames such as thing999. But 1000 files
750 // may not be enough, of course...
751 char* sName
= wxFileNameFromPath( FileRoot
); // this Julian's method is non-destructive reference
754 if(strlen( sName
) > 5)
755 sName
[5] = '\0'; // that should do!
758 sprintf(ContentsName
, "%s.con", FileRoot
);
759 sprintf(TmpContentsName
, "%s.cn1", FileRoot
);
760 sprintf(TmpFrameContentsName
, "%s.frc", FileRoot
);
761 sprintf(WinHelpContentsFileName
, "%s.cnt", FileRoot
);
762 sprintf(RefName
, "%s.ref", FileRoot
);
764 TexPathList
.EnsureFileAccessible(InputFile
);
767 wxString s
= TexPathList
.FindValidPath("bullet.bmp");
770 wxString str
= wxFileNameFromPath(s
);
771 bulletFile
= copystring(str
);
775 if (wxFileExists(RefName
))
776 ReadTexReferences(RefName
);
778 bool success
= FALSE
;
780 if (InputFile
&& OutputFile
)
782 if (!FileExists(InputFile
))
784 OnError("Cannot open input file!");
792 sprintf(buf
, "Working, pass %d...", passNumber
);
793 frame
->SetStatusText(buf
);
797 OnInform("Reading LaTeX file...");
798 TexLoadFile(InputFile
);
821 OnInform("*** Aborted by user.");
828 WriteTexReferences(RefName
);
830 startedSections
= FALSE
;
834 long tim
= wxGetElapsedTime();
835 sprintf(buf
, "Finished PASS #%d in %ld seconds.\n", passNumber
, (long)(tim
/1000.0));
839 sprintf(buf
, "Done, %d %s.", passNumber
, (passNumber
> 1) ? "passes" : "pass");
840 frame
->SetStatusText(buf
);
843 sprintf(buf
, "Done, %d %s.", passNumber
, (passNumber
> 1) ? "passes" : "pass");
852 startedSections
= FALSE
;
854 OnInform("Sorry, unsuccessful.");
859 void OnError(char *msg
)
862 cerr
<< "Error: " << msg
<< "\n";
865 if (isInteractive
&& frame
)
866 (*frame
->textWindow
) << "Error: " << msg
<< "\n";
870 cerr
<< "Error: " << msg
<< "\n";
881 void OnInform(char *msg
)
887 if (isInteractive
&& frame
)
888 (*frame
->textWindow
) << msg
<< "\n";
906 void OnMacro(int macroId
, int no_args
, bool start
)
912 RTFOnMacro(macroId
, no_args
, start
);
917 XLPOnMacro(macroId
, no_args
, start
);
922 HTMLOnMacro(macroId
, no_args
, start
);
928 bool OnArgument(int macroId
, int arg_no
, bool start
)
934 return RTFOnArgument(macroId
, arg_no
, start
);
939 return XLPOnArgument(macroId
, arg_no
, start
);
944 return HTMLOnArgument(macroId
, arg_no
, start
);
954 #if defined(__WXMSW__) && !defined(NO_GUI)
960 wxConnectionBase
*Tex2RTFServer::OnAcceptConnection(const wxString
& topic
)
962 if (topic
== "TEX2RTF")
965 ipc_buffer
= new char[1000];
967 return new Tex2RTFConnection(ipc_buffer
, 4000);
977 Tex2RTFConnection::Tex2RTFConnection(char *buf
, int size
):wxDDEConnection(buf
, size
)
981 Tex2RTFConnection::~Tex2RTFConnection(void)
985 bool SplitCommand(char *data
, char *firstArg
, char *secondArg
)
990 int len
= strlen(data
);
992 // Find first argument (command name)
995 if (data
[i
] == ' ' || data
[i
] == 0)
999 firstArg
[i
] = data
[i
];
1006 // Find second argument
1009 while (data
[i
] != 0)
1011 secondArg
[j
] = data
[i
];
1020 bool Tex2RTFConnection::OnExecute(const wxString
& topic
, char *data
, int size
, int format
)
1022 strcpy(Tex2RTFLastStatus
, "OK");
1025 char secondArg
[300];
1026 if (SplitCommand(data
, firstArg
, secondArg
))
1028 bool hasArg
= (strlen(secondArg
) > 0);
1029 if (strcmp(firstArg
, "INPUT") == 0 && hasArg
)
1031 if (InputFile
) delete[] InputFile
;
1032 InputFile
= copystring(secondArg
);
1036 wxString str
= wxFileNameFromPath(InputFile
);
1037 sprintf(buf
, "Tex2RTF [%s]", (const char*) str
);
1038 frame
->SetTitle(buf
);
1041 else if (strcmp(firstArg
, "OUTPUT") == 0 && hasArg
)
1043 if (OutputFile
) delete[] OutputFile
;
1044 OutputFile
= copystring(secondArg
);
1046 else if (strcmp(firstArg
, "GO") == 0)
1048 strcpy(Tex2RTFLastStatus
, "WORKING");
1050 strcpy(Tex2RTFLastStatus
, "CONVERSION ERROR");
1052 strcpy(Tex2RTFLastStatus
, "OK");
1054 else if (strcmp(firstArg
, "EXIT") == 0)
1056 if (frame
) frame
->Close();
1058 else if (strcmp(firstArg
, "MINIMIZE") == 0 || strcmp(firstArg
, "ICONIZE") == 0)
1061 frame
->Iconize(TRUE
);
1063 else if (strcmp(firstArg
, "SHOW") == 0 || strcmp(firstArg
, "RESTORE") == 0)
1067 frame
->Iconize(FALSE
);
1073 // Try for a setting
1074 strcpy(Tex2RTFLastStatus
, RegisterSetting(firstArg
, secondArg
, FALSE
));
1076 if (frame
&& strcmp(firstArg
, "conversionMode") == 0)
1081 if (winHelp
&& (convertMode
== TEX_RTF
))
1082 strcat(buf
, "WinHelp RTF");
1083 else if (!winHelp
&& (convertMode
== TEX_RTF
))
1084 strcat(buf
, "linear RTF");
1085 else if (convertMode
== TEX_HTML
) strcat(buf
, "HTML");
1086 else if (convertMode
== TEX_XLP
) strcat(buf
, "XLP");
1087 strcat(buf
, " mode.");
1088 frame
->SetStatusText(buf
, 1);
1096 char *Tex2RTFConnection::OnRequest(const wxString
& topic
, const wxString
& item
, int *size
, int format
)
1098 return Tex2RTFLastStatus
;
1105 //void wxObject::Dump(ostream& str)
1107 // if (GetClassInfo() && GetClassInfo()->GetClassName())
1108 // str << GetClassInfo()->GetClassName();
1110 // str << "unknown object class";