From c60a35fc2a50f938e0d2dcd726784afbb001a756 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 31 Mar 2004 02:42:24 +0000 Subject: Cleanup for unix --- src/basehandler.cpp | 11 ++-------- src/basehandler.h | 8 ++++---- src/levelhandler.cpp | 15 ++------------ src/levelhandler.h | 14 ++++++------- src/reference.h | 3 +-- src/rtfformatting.h | 13 +++--------- src/rtfparser.cpp | 12 +++-------- src/rtfparser.h | 20 ++++++++---------- src/rtfx.cpp | 8 +++----- src/sablo.txt | 0 src/sablotr.cpp | 2 +- src/usuals.h | 5 ++++- src/xmlcomposehelpers.cpp | 4 ++-- src/xmlcomposehelpers.h | 9 +++++--- src/xmlcomposer.cpp | 21 +++++++++---------- src/xmlcomposer.h | 16 ++++----------- win32/rtfx.dsp | 52 ++++++++++++++++++++++++----------------------- 17 files changed, 87 insertions(+), 126 deletions(-) delete mode 100644 src/sablo.txt diff --git a/src/basehandler.cpp b/src/basehandler.cpp index 02c79c1..d561cef 100644 --- a/src/basehandler.cpp +++ b/src/basehandler.cpp @@ -1,13 +1,6 @@ -// BaseHandler.cpp: implementation of the BaseHandler class. -// -////////////////////////////////////////////////////////////////////// -#include "stdafx.h" -#include "BaseHandler.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// +#include "usuals.h" +#include "basehandler.h" BaseHandler::BaseHandler() { diff --git a/src/basehandler.h b/src/basehandler.h index 33cfe61..c7fab13 100644 --- a/src/basehandler.h +++ b/src/basehandler.h @@ -2,10 +2,10 @@ // Implements an RtfHandler for other classes (LevelHandler // and RtfParser) to override. -#ifndef _BASEHANDLER_H_ -#define _BASEHANDLER_H_ +#ifndef __BASEHANDLER_H__ +#define __BASEHANDLER_H__ -#include "RtfReader.h" +#include "rtfreader.h" class BaseHandler : public RtfHandler @@ -26,4 +26,4 @@ protected: RtfReader* m_reader; }; -#endif // _BASEHANDLER_H_ +#endif // __BASEHANDLER_H__ diff --git a/src/levelhandler.cpp b/src/levelhandler.cpp index 1c55e9c..901f8fb 100644 --- a/src/levelhandler.cpp +++ b/src/levelhandler.cpp @@ -1,13 +1,6 @@ -// LevelHandler.cpp: implementation of the LevelHandler class. -// -////////////////////////////////////////////////////////////////////// -#include "stdafx.h" -#include "LevelHandler.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// +#include "usuals.h" +#include "levelhandler.h" LevelHandler::LevelHandler() { @@ -92,7 +85,3 @@ LevelPtr LevelHandler::getLevel() { return m_curLevel; } - - - - diff --git a/src/levelhandler.h b/src/levelhandler.h index 533fdfe..2ba0de3 100644 --- a/src/levelhandler.h +++ b/src/levelhandler.h @@ -2,13 +2,13 @@ // Keeps track of levels (braces) in the RTF file. // -#ifndef _LEVELHANDLER_H_ -#define _LEVELHANDLER_H_ +#ifndef __LEVELHANDLER_H__ +#define __LEVELHANDLER_H__ -#include "RtfReader.h" -#include "BaseHandler.h" -#include "RtfParseHelpers.h" -#include "Reference.h" +#include "rtfreader.h" +#include "basehandler.h" +#include "rtfparsehelpers.h" +#include "reference.h" class LevelHandler : public BaseHandler @@ -38,4 +38,4 @@ protected: }; -#endif // _LEVELHANDLER_H_ +#endif // __LEVELHANDLER_H__ diff --git a/src/reference.h b/src/reference.h index 8b82a61..62be59b 100644 --- a/src/reference.h +++ b/src/reference.h @@ -108,5 +108,4 @@ private: int m_x; }; - -#endif //__REFERENCE_H__ \ No newline at end of file +#endif //__REFERENCE_H__ diff --git a/src/rtfformatting.h b/src/rtfformatting.h index 2dfc126..f5398ba 100644 --- a/src/rtfformatting.h +++ b/src/rtfformatting.h @@ -1,13 +1,6 @@ -// RtfTextProperties.h: interface for the RtfTextProperties class. -// -////////////////////////////////////////////////////////////////////// -#if !defined(AFX_RTFTEXTPROPERTIES_H__719D85C9_69D9_4499_BE5E_7A9A7F6F9C38__INCLUDED_) -#define AFX_RTFTEXTPROPERTIES_H__719D85C9_69D9_4499_BE5E_7A9A7F6F9C38__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 +#ifndef __RTFTEXPROPERTIES_H__ +#define __RTFTEXPROPERTIES_H__ class RtfFormatting { @@ -119,4 +112,4 @@ protected: // TODO: Character styles }; -#endif // !defined(AFX_RTFTEXTPROPERTIES_H__719D85C9_69D9_4499_BE5E_7A9A7F6F9C38__INCLUDED_) +#endif // __RTFTEXPROPERTIES_H__ diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp index f2379b3..336847f 100644 --- a/src/rtfparser.cpp +++ b/src/rtfparser.cpp @@ -1,16 +1,10 @@ -// RtfReader.cpp: implementation of the RtfReader class. -// -////////////////////////////////////////////////////////////////////// -#include "stdafx.h" +#include "usuals.h" #include #include -#include "RtfReader.h" +#include "rtfreader.h" -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// const int RtfHandler::kAsterisk = 0x00000001; const int RtfHandler::kHasParam = 0x00000002; @@ -33,7 +27,7 @@ RtfReader::~RtfReader() bool RtfReader::parse(string fileName) { - FILE* file = fopen(fileName, "r"); + FILE* file = fopen(fileName.c_str(), "r"); if(!file) return false; diff --git a/src/rtfparser.h b/src/rtfparser.h index f28150e..4fe1804 100644 --- a/src/rtfparser.h +++ b/src/rtfparser.h @@ -1,16 +1,12 @@ -// RtfReader.h: interface for the RtfReader class. -// -////////////////////////////////////////////////////////////////////// -#if !defined(AFX_RTFREADER_H__2C77784F_5333_4E16_B0E0_B56E211C2D82__INCLUDED_) -#define AFX_RTFREADER_H__2C77784F_5333_4E16_B0E0_B56E211C2D82__INCLUDED_ +#ifndef __RTFREADER_H__ +#define __RTFREADER_H__ -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include +#include #include +using std::string; +using std::wstring; + class RtfReader; class RtfHandler @@ -18,7 +14,7 @@ class RtfHandler public: virtual void startDocument(RtfReader* reader) = 0; virtual void endDocument() = 0; - virtual void controlWord(const string& cw, int flags, int param) = 0; + virtual void controlWord(const string& cw, int flags, int param) = 0; virtual void groupStart() = 0; virtual void groupEnd() = 0; virtual void charData(wstring data) = 0; @@ -77,4 +73,4 @@ private: void emptyData(RtfContext& cx); }; -#endif // !defined(AFX_RTFREADER_H__2C77784F_5333_4E16_B0E0_B56E211C2D82__INCLUDED_) +#endif // __RTFREADER_H__ diff --git a/src/rtfx.cpp b/src/rtfx.cpp index 6a68a28..e3ceb61 100644 --- a/src/rtfx.cpp +++ b/src/rtfx.cpp @@ -1,12 +1,10 @@ -// rtfm.cpp : Defines the entry point for the console application. -// -#include "stdafx.h" +#include "usuals.h" #include #include -#include "RtfReader.h" -#include "RtfAnalyser.h" +#include "rtfreader.h" +#include "rtfanalyser.h" int usage() { diff --git a/src/sablo.txt b/src/sablo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/sablotr.cpp b/src/sablotr.cpp index 465648a..3b62cd6 100644 --- a/src/sablotr.cpp +++ b/src/sablotr.cpp @@ -23,7 +23,7 @@ // SABLOTRON C++ WRAPPER CONVERSION FUNCTIONS // -#include "wchar.h" +#include #include "sablo.h" bool DOM::transcode16to8(const std::basic_string& data, diff --git a/src/usuals.h b/src/usuals.h index 8cb7526..ea4384c 100644 --- a/src/usuals.h +++ b/src/usuals.h @@ -2,7 +2,10 @@ #define __USUALS_H__ #ifndef NULL -#define NULL ((void*)0) +#define NULL 0 #endif +#include +#include + #endif // __USUALS_H__ \ No newline at end of file diff --git a/src/xmlcomposehelpers.cpp b/src/xmlcomposehelpers.cpp index 4f6f106..3f457b4 100644 --- a/src/xmlcomposehelpers.cpp +++ b/src/xmlcomposehelpers.cpp @@ -1,6 +1,6 @@ -#include "stdafx.h" -#include "RtfParseHelpers.h" +#include "usuals.h" +#include "rtfparsehelpers.h" Level::Level() { diff --git a/src/xmlcomposehelpers.h b/src/xmlcomposehelpers.h index f6c06e7..05abb8b 100644 --- a/src/xmlcomposehelpers.h +++ b/src/xmlcomposehelpers.h @@ -1,10 +1,13 @@ #ifndef __RTFPARSEHELPERS_H__ #define __RTFPARSEHELPERS_H__ -#include "Reference.h" -#include +#include "reference.h" #include "sablo.h" -#include "RtfFormatting.h" +#include "rtfformatting.h" + +#include +using std::wstring; +using std::string; class RtfParser; diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index 1bfeb30..9795fe2 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -1,9 +1,6 @@ -// RtfParser.cpp: implementation of the RtfParser class. -// -////////////////////////////////////////////////////////////////////// -#include "stdafx.h" -#include "RtfAnalyser.h" +#include "usuals.h" +#include "rtfanalyser.h" const char* kElDest = "i_dest"; const char* kElBlock = "i_block"; @@ -1010,9 +1007,11 @@ bool RtfParser::isEqualElement(const DOM::Element& el1, const DOM::Element& el2) wstring RtfParser::formatInt(int num) { - wstring n; - n.format(L"%d", num); - return n; + wchar_t buff[12]; + swprintf(buff, L"%d", num); + + wstring n(buff); + return n; } /** @@ -1092,7 +1091,7 @@ void RtfParser::copyAttributes(const DOM::Element& src, DOM::Element& dest, for(const char** t = hideList; *t != NULL; t++) { if(name == *t) - name.clear(); + name.erase(); } } @@ -1477,7 +1476,7 @@ void RtfParser::breakLists(DOM::Document& doc) else { list = NULL; - previd.clear(); + previd.erase(); } } @@ -1808,4 +1807,4 @@ void RtfParser::removeDuplicates(const DOM::Document& doc) } } } -} \ No newline at end of file +} diff --git a/src/xmlcomposer.h b/src/xmlcomposer.h index 9463318..24dd649 100644 --- a/src/xmlcomposer.h +++ b/src/xmlcomposer.h @@ -1,15 +1,7 @@ -// RtfParser.h: interface for the RtfParser class. -// -////////////////////////////////////////////////////////////////////// +#ifndef __RTFPARSER_H__ +#define __RTFPARSER_H__ -#if !defined(AFX_RTFANALYSER_H__0243FE38_142A_4BDD_BA2C_1D122965444B__INCLUDED_) -#define AFX_RTFANALYSER_H__0243FE38_142A_4BDD_BA2C_1D122965444B__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "LevelHandler.h" +#include "levelhandler.h" struct RtfParserOptions { @@ -225,4 +217,4 @@ protected: }; -#endif // !defined(AFX_RTFANALYSER_H__0243FE38_142A_4BDD_BA2C_1D122965444B__INCLUDED_) +#endif // __RTFPARSER_H__ diff --git a/win32/rtfx.dsp b/win32/rtfx.dsp index 0ca726b..2f91bde 100644 --- a/win32/rtfx.dsp +++ b/win32/rtfx.dsp @@ -37,12 +37,13 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "release" +# PROP Intermediate_Dir "release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "sablot/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "sablot/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -62,12 +63,13 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "sablot/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "sablot/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -88,36 +90,36 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\BaseHandler.cpp +SOURCE=..\src\basehandler.cpp # End Source File # Begin Source File -SOURCE=.\LevelHandler.cpp +SOURCE=..\src\levelhandler.cpp # End Source File # Begin Source File -SOURCE=.\RtfAnalyser.cpp +SOURCE=..\src\rtfanalyser.cpp # End Source File # Begin Source File -SOURCE=.\rtfm.cpp +SOURCE=..\src\rtfm.cpp # End Source File # Begin Source File -SOURCE=.\RtfParseHelpers.cpp +SOURCE=..\src\rtfparsehelpers.cpp # End Source File # Begin Source File -SOURCE=.\RtfReader.cpp +SOURCE=..\src\rtfreader.cpp # End Source File # Begin Source File -SOURCE=.\sablotr.cpp +SOURCE=..\src\sablotr.cpp # SUBTRACT CPP /YX /Yc /Yu # End Source File # Begin Source File -SOURCE=.\StdAfx.cpp +SOURCE=..\src\stdafx.cpp # ADD CPP /Yc"stdafx.h" # End Source File # End Group @@ -126,43 +128,43 @@ SOURCE=.\StdAfx.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=.\BaseHandler.h +SOURCE=..\src\basehandler.h # End Source File # Begin Source File -SOURCE=.\LevelHandler.h +SOURCE=..\src\levelhandler.h # End Source File # Begin Source File -SOURCE=.\Reference.h +SOURCE=..\src\reference.h # End Source File # Begin Source File -SOURCE=.\RtfAnalyser.h +SOURCE=..\src\rtfanalyser.h # End Source File # Begin Source File -SOURCE=.\RtfFormatting.h +SOURCE=..\src\rtfformatting.h # End Source File # Begin Source File -SOURCE=.\RtfParseHelpers.h +SOURCE=..\src\rtfparsehelpers.h # End Source File # Begin Source File -SOURCE=.\RtfReader.h +SOURCE=..\src\rtfreader.h # End Source File # Begin Source File -SOURCE=.\sablo.h +SOURCE=..\src\sablo.h # End Source File # Begin Source File -SOURCE=.\StdAfx.h +SOURCE=..\src\stdafx.h # End Source File # Begin Source File -SOURCE=.\usuals.h +SOURCE=..\src\usuals.h # End Source File # End Group # Begin Group "Resource Files" @@ -171,7 +173,7 @@ SOURCE=.\usuals.h # End Group # Begin Source File -SOURCE=.\ReadMe.txt +SOURCE=..\src\readme.txt # End Source File # End Target # End Project -- cgit v1.2.3