其他作業系統相關的修改

您可能需要修改 TOMUI 類別的 setInput 方法,以在新的作業系統中支援追蹤。建立逐步執行器的輸入串流時,如果要在 setInput 方法中建立新的 ifstream 所發出的呼叫使用 ios::nocreate,則可能會發生編譯錯誤。 因為 ios::nocreate 不屬於 C++ 標準的一部分,所以有一些編譯器(例如,Green Hills)並不支援它。目前,在 tom\tomstep.cpp 檔案中實作 setInput 時可選擇為 UNIX 和 STL 建立 ifstreams,而不必使用 ios::nocreate。 實作如下:

ifdef unix
   // unix : Actually Solaris 2 cannot open for READ if
   // the ios::nocreate is placed here
   ifstream* file = new ifstream(filename);
#else
#ifdef OM_USE_STL
   ifstream* file = new ifstream(filename);
#else
   ifstream* file = new ifstream(filename,ios::nocreate);
#endif

此外,如果新環境不支援 ios::nocreate,則可能需要新增另一個 #ifdef 子句。例如,請在 Green Hills 編譯器的最後一個 #else 之前新增下列程式碼行:

#else
#ifdef green
   ifstream* file = new ifstream(filename);

回饋