Changeset 21916 for trunk/tools/common
- Timestamp:
- Dec 18, 2011, 10:28:22 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 deleted
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 bin 2 Makefile.inc 1 env.cmd 2 LocalConfig.kmk
-
-
Property svn:mergeinfo
set to
/branches/gcc-kmk merged eligible
- Property svn:ignore
-
trunk/tools/common/kError.cpp
r8003 r21916 16 16 * Header Files * 17 17 *******************************************************************************/ 18 #if defined (__EMX__) && !defined (USE_OS2_TOOLKIT_HEADERS) 19 #define __OS2DEF__ 20 #endif 18 21 #include <os2.h> 22 19 23 #include <string.h> 20 24 #include <stdio.h> -
trunk/tools/common/kFile.cpp
r8003 r21916 19 19 * Header Files * 20 20 *******************************************************************************/ 21 #if defined (__EMX__) && !defined (USE_OS2_TOOLKIT_HEADERS) 22 #define __OS2DEF__ 23 #endif 21 24 #include <os2.h> 22 25 … … 45 48 * @remark 46 49 */ 47 KBOOL kFile::refreshFileStatus() 50 KBOOL kFile::refreshFileStatus() throw (kError) 48 51 { 49 52 if (fStdDev) … … 68 71 * @returns Success indicator. 69 72 */ 70 KBOOL kFile::position() 73 KBOOL kFile::position() throw (kError) 71 74 { 72 75 /* … … 254 257 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 255 258 */ 256 kFile::kFile(const char *pszFilename, KBOOL fReadOnly/*=TRUE*/) 259 kFile::kFile(const char *pszFilename, KBOOL fReadOnly/*=TRUE*/) throw (kError) 257 260 : fReadOnly(fReadOnly), 258 261 fStatusClean(FALSE), … … 332 335 * @param cbBuffer Amount of bytes to read. 333 336 */ 334 int kFile::read(void *pvBuffer, long cbBuffer) 337 int kFile::read(void *pvBuffer, long cbBuffer) throw (kError) 335 338 { 336 339 ULONG cbRead; … … 427 430 * @param off Absolute file offset. 428 431 */ 429 int kFile::readAt(void *pvBuffer, long cbBuffer, long off) 432 int kFile::readAt(void *pvBuffer, long cbBuffer, long off) throw (kError) 430 433 { 431 434 if (set(off)) … … 477 480 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 478 481 */ 479 int kFile::readln(char *pszBuffer, long cchBuffer) throw(kError)482 int kFile::readln(char *pszBuffer, long cchBuffer) 480 483 { 481 484 long cbRead; … … 558 561 * @param cbBuffer Amount of bytes to write. 559 562 */ 560 int kFile::write(const void *pv, long cb) 563 int kFile::write(const void *pv, long cb) throw (kError) 561 564 { 562 565 if (fReadOnly) … … 678 681 * @param off Absolute file offset. 679 682 */ 680 int kFile::writeAt(const void *pvBuffer, long cbBuffer, long off) 683 int kFile::writeAt(const void *pvBuffer, long cbBuffer, long off) throw (kError) 681 684 { 682 685 if (set(off)) … … 788 791 * @param off Relative reposition. 789 792 */ 790 int kFile::move(long off) 793 int kFile::move(long off) throw (kError) 791 794 { 792 795 if ((off + offVirtual) & 0x80000000UL) /* above 2GB or negative */ … … 814 817 * @param off New file position. 815 818 */ 816 int kFile::set(long off) 819 int kFile::set(long off) throw (kError) 817 820 { 818 821 if (off < 0) … … 839 842 * @remark Will only throw error if refreshFileStatus failes. 840 843 */ 841 int kFile::end() 844 int kFile::end() throw (kError) 842 845 { 843 846 if (!refreshFileStatus()) … … 872 875 * @remark Will only throw error if refreshFileStatus failes. 873 876 */ 874 long kFile::getSize() 877 long kFile::getSize() throw (kError) 875 878 { 876 879 if (!refreshFileStatus()) … … 886 889 * @remark Will only throw error if refreshFileStatus failes. 887 890 */ 888 long kFile::getPos() const 891 long kFile::getPos() const throw (kError) 889 892 { 890 893 return offVirtual; … … 898 901 * @remark Will only throw error if refreshFileStatus failes. 899 902 */ 900 KBOOL kFile::isEOF() 903 KBOOL kFile::isEOF() throw (kError) 901 904 { 902 905 #if 0 … … 954 957 * @remark May throw errors. 955 958 */ 956 void *kFile::mapFile(const char *pszFilename) 959 void *kFile::mapFile(const char *pszFilename) throw (kError) 957 960 { 958 961 kFile file(pszFilename); … … 968 971 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 969 972 */ 970 void kFile::mapFree(void *pvFileMapping) 973 void kFile::mapFree(void *pvFileMapping) throw (kError) 971 974 { 972 975 if (pvFileMapping) -
trunk/tools/common/kFileDef.cpp
r9164 r21916 119 119 120 120 121 kFileDef::kFileDef(kFile *pFile) :121 kFileDef::kFileDef(kFile *pFile) throw (kError) : 122 122 kFileFormatBase(pFile), 123 123 pszType(NULL), pszModName(NULL), pszBase(NULL), pszCode(NULL), pszData(NULL), pszDescription(NULL), … … 137 137 * Destructor. Frees used memory. 138 138 */ 139 kFileDef::~kFileDef() 139 kFileDef::~kFileDef() throw (kError) 140 140 { 141 141 if (pszType != NULL) delete pszType; … … 182 182 * @remark throws errorcode on error (TODO: errorhandling) 183 183 */ 184 void kFileDef::read(kFile *pFile) 184 void kFileDef::read(kFile *pFile) throw (kError) 185 185 { 186 186 char *pszTmp; … … 445 445 * @remark tabs are expanded. string is trimmed. comments removed. 446 446 */ 447 char *kFileDef::readln(kFile *pFile, char *pszBuffer, int cbBuffer) 447 char *kFileDef::readln(kFile *pFile, char *pszBuffer, int cbBuffer) throw (kError) 448 448 { 449 449 int i; … … 700 700 * @remark 701 701 */ 702 KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut, int enmOS) 702 KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut, int enmOS) throw(kError) 703 703 { 704 704 PDEFSEGMENT pSeg; -
trunk/tools/common/kFileDef.h
r9162 r21916 105 105 /**@cat Constructor/Destructor */ 106 106 kFileDef(kFile *pFile) throw(kError); 107 virtual ~kFileDef() ;107 virtual ~kFileDef() throw (kError); 108 108 109 109 /** @cat Module information methods. */ -
trunk/tools/common/kFileFormatBase.cpp
r8003 r21916 30 30 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 31 31 */ 32 kFileFormatBase::kFileFormatBase(kFile *pFile) 32 kFileFormatBase::kFileFormatBase(kFile *pFile) throw (kError) 33 33 : pFile(pFile) 34 34 { … … 42 42 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 43 43 */ 44 kFileFormatBase::~kFileFormatBase() 44 kFileFormatBase::~kFileFormatBase() throw (kError) 45 45 { 46 46 if (pFile) -
trunk/tools/common/kFileInterfaces.cpp
r8003 r21916 19 19 * Header Files * 20 20 *******************************************************************************/ 21 #include <malloc.h> 22 21 23 #include "kTypes.h" 22 24 #include "kError.h" … … 63 65 * Save the target we are searching for references to. 64 66 */ 65 PXREFSTATE pState = new XREFSTATE;67 PXREFSTATE pState = (PXREFSTATE)malloc(sizeof(XREFSTATE)); 66 68 pState->ulSegment = ulSegment; 67 69 pState->offSegment = offSegment; … … 131 133 kASSERT(preloc != NULL); 132 134 relocFindClose(preloc); 133 delete preloc->pv2;135 free(preloc->pv2); 134 136 preloc->pv2 = NULL; 135 137 } -
trunk/tools/common/kFileLX.cpp
r8003 r21916 256 256 * @param pszFilename LX executable image name. 257 257 */ 258 kFileLX::kFileLX(const char *pszFilename) :258 kFileLX::kFileLX(const char *pszFilename) throw (kError) : 259 259 kFileFormatBase(NULL), pvBase(NULL) 260 260 { … … 292 292 * @param pFile Pointer to opened LX file. 293 293 */ 294 kFileLX::kFileLX(kFile *pFile) :294 kFileLX::kFileLX(kFile *pFile) throw (kError) : 295 295 kFileFormatBase(pFile), pvBase(NULL) 296 296 { … … 330 330 * Destructor. 331 331 */ 332 kFileLX::~kFileLX() 332 kFileLX::~kFileLX() throw (kError) 333 333 { 334 334 if (pvBase != NULL) … … 412 412 413 413 /* store status - current export entry */ 414 PEXPSTATE pExpState = new EXPSTATE;414 PEXPSTATE pExpState = (PEXPSTATE)malloc(sizeof(EXPSTATE)); 415 415 pExport->pv = pExpState; 416 416 pExpState->pb32 = pBundle; … … 560 560 void kFileLX::exportFindClose(kExportEntry *pExport) 561 561 { 562 delete pExport->pv;562 free(pExport->pv); 563 563 pExport->pv = NULL; 564 564 return; … … 1375 1375 ) 1376 1376 { 1377 PLXRELOCSTATE pState = new LXRELOCSTATE;1377 PLXRELOCSTATE pState = (PLXRELOCSTATE)malloc(sizeof(LXRELOCSTATE)); 1378 1378 pState->ulSegment = ulSegment; 1379 1379 pState->ulPage = paObject[ulSegment].o32_pagemap - 1; … … 1451 1451 if (preloc->isName()) 1452 1452 { 1453 delete (void*)preloc->Info.Name.pszModule;1454 delete (void*)preloc->Info.Name.pszName;1453 delete preloc->Info.Name.pszModule; 1454 delete preloc->Info.Name.pszName; 1455 1455 preloc->Info.Name.pszName = preloc->Info.Name.pszModule = NULL; 1456 1456 } … … 1670 1670 if (preloc->isName()) 1671 1671 { 1672 delete (void*)preloc->Info.Name.pszModule;1673 delete (void*)preloc->Info.Name.pszName;1672 delete preloc->Info.Name.pszModule; 1673 delete preloc->Info.Name.pszName; 1674 1674 preloc->Info.Name.pszName = preloc->Info.Name.pszModule = NULL; 1675 1675 } … … 1677 1677 /* free state info */ 1678 1678 memset(preloc->pv1, 0xff, sizeof(LXRELOCSTATE)); 1679 delete preloc->pv1;1679 free(preloc->pv1); 1680 1680 preloc->pv1 = (void*)0xdeadbeef; 1681 1681 } -
trunk/tools/common/kFileLX.h
r8003 r21916 22 22 kFileLX(const char *pszFilename) throw (kError); 23 23 kFileLX(kFile *pFile) throw (kError); 24 ~kFileLX() ;24 ~kFileLX() throw (kError); 25 25 26 26 /** @cat Module information methods. */ -
trunk/tools/common/kFilePE.cpp
r8003 r21916 11 11 ******************************************************************************/ 12 12 #include <string.h> 13 #include <malloc.h> 13 14 14 15 #include "MZexe.h" … … 36 37 * @remark throws errorcode 37 38 */ 38 kFilePE::kFilePE(kFile *pFile) :39 kFilePE::kFilePE(kFile *pFile) throw (kError) : 39 40 kFileFormatBase(pFile), 40 41 pvBase(NULL), … … 76 77 77 78 /* create mapping */ 78 pvBase = new char [pehdr.OptionalHeader.SizeOfImage];79 pvBase = malloc(pehdr.OptionalHeader.SizeOfImage); 79 80 if (pvBase == NULL) 80 81 throw(kError(kError::NOT_ENOUGH_MEMORY)); … … 93 94 94 95 /* read sections */ 95 for (int i = 0; i < pehdr.FileHeader.NumberOfSections; i++) 96 int i; 97 for (i = 0; i < pehdr.FileHeader.NumberOfSections; i++) 96 98 { 97 99 unsigned long cbSection; … … 138 140 catch (kError err) 139 141 { 140 delete(pvBase);142 free(pvBase); 141 143 pvBase = NULL; 142 144 throw(err); … … 148 150 * Destructor. 149 151 */ 150 kFilePE::~kFilePE() 152 kFilePE::~kFilePE() throw (kError) 151 153 { 152 154 if (pvBase) 153 delete(pvBase);155 free(pvBase); 154 156 } 155 157 -
trunk/tools/common/kFilePE.h
r8003 r21916 67 67 public: 68 68 kFilePE(kFile *pFile) throw (kError); 69 virtual ~kFilePE() ;69 virtual ~kFilePE() throw (kError); 70 70 71 71 /** @cat Module information methods. */ -
trunk/tools/common/kFileSDF.cpp
r8003 r21916 67 67 * 68 68 */ 69 void kFileSDF::parseSDFFile(void *pvFile) 69 void kFileSDF::parseSDFFile(void *pvFile) throw (kError) 70 70 { 71 71 /* … … 160 160 * @remark Will throw error codes. 161 161 */ 162 kFileSDF::kFileSDF(kFile *pFile) :162 kFileSDF::kFileSDF(kFile *pFile) throw (kError) : 163 163 kFileFormatBase(pFile), papStructs(NULL), pHdr(NULL), paTypes(NULL) 164 164 { … … 205 205 206 206 207 kFileSDF::~kFileSDF() 207 kFileSDF::~kFileSDF() throw (kError) 208 208 { 209 209 if (papStructs); -
trunk/tools/common/kFileSDF.h
r8003 r21916 81 81 public: 82 82 kFileSDF(kFile *pFile) throw (kError); 83 ~kFileSDF() ;83 ~kFileSDF() throw (kError); 84 84 85 85 /** @cat Debug Type information methods. */ -
trunk/tools/common/kTypes.h
r21350 r21916 54 54 55 55 /******************************************************************************* 56 * GNU C++ Compilers * 57 *******************************************************************************/ 58 #ifdef __GNUC__ 59 60 #define INLINE static inline 61 #define KLIBCALL _Optlink 62 INLINE void INT3() { __asm__ __volatile__ ("int3\n\tnop"); } 63 64 typedef unsigned long KSIZE; 65 typedef unsigned long KBOOL; 66 67 #endif 68 69 70 /******************************************************************************* 56 71 * Common stuff * 57 72 *******************************************************************************/ … … 183 198 ((expr) ? (void)0 : (kAssertMsg(#expr, __FILE__, __LINE__, __FUNCTION__) ? INT3() : (void)0)) 184 199 200 #ifdef __cplusplus 201 extern "C" 202 #endif 185 203 KBOOL KLIBCALL kAssertMsg(const char *pszExpr, const char *pszFilename, unsigned uLine, const char *pszFunction); 186 204
Note:
See TracChangeset
for help on using the changeset viewer.