Changeset 21916 for trunk/tools/common


Ignore:
Timestamp:
Dec 18, 2011, 10:28:22 PM (14 years ago)
Author:
dmik
Message:

Merge branch gcc-kmk to trunk.

Location:
trunk
Files:
7 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 bin
        2 Makefile.inc
         1env.cmd
         2LocalConfig.kmk
    • Property svn:mergeinfo set to
      /branches/gcc-kmkmergedeligible
  • trunk/tools/common/kError.cpp

    r8003 r21916  
    1616*   Header Files                                                               *
    1717*******************************************************************************/
     18#if defined (__EMX__) && !defined (USE_OS2_TOOLKIT_HEADERS)
     19#define __OS2DEF__
     20#endif
    1821#include <os2.h>
     22
    1923#include <string.h>
    2024#include <stdio.h>
  • trunk/tools/common/kFile.cpp

    r8003 r21916  
    1919*   Header Files                                                               *
    2020*******************************************************************************/
     21#if defined (__EMX__) && !defined (USE_OS2_TOOLKIT_HEADERS)
     22#define __OS2DEF__
     23#endif
    2124#include <os2.h>
    2225
     
    4548 * @remark
    4649 */
    47 KBOOL   kFile::refreshFileStatus()
     50KBOOL   kFile::refreshFileStatus() throw (kError)
    4851{
    4952    if (fStdDev)
     
    6871 * @returns     Success indicator.
    6972 */
    70 KBOOL   kFile::position()
     73KBOOL   kFile::position() throw (kError)
    7174{
    7275    /*
     
    254257 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    255258 */
    256 kFile::kFile(const char *pszFilename, KBOOL fReadOnly/*=TRUE*/)
     259kFile::kFile(const char *pszFilename, KBOOL fReadOnly/*=TRUE*/) throw (kError)
    257260:   fReadOnly(fReadOnly),
    258261    fStatusClean(FALSE),
     
    332335 * @param       cbBuffer    Amount of bytes to read.
    333336 */
    334 int             kFile::read(void *pvBuffer, long cbBuffer)
     337int             kFile::read(void *pvBuffer, long cbBuffer) throw (kError)
    335338{
    336339    ULONG   cbRead;
     
    427430 * @param       off         Absolute file offset.
    428431 */
    429 int             kFile::readAt(void *pvBuffer, long cbBuffer, long off)
     432int             kFile::readAt(void *pvBuffer, long cbBuffer, long off) throw (kError)
    430433{
    431434    if (set(off))
     
    477480 * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    478481 */
    479 int             kFile::readln(char *pszBuffer, long cchBuffer) throw(kError)
     482int             kFile::readln(char *pszBuffer, long cchBuffer)
    480483{
    481484    long    cbRead;
     
    558561 * @param       cbBuffer    Amount of bytes to write.
    559562 */
    560 int             kFile::write(const void *pv, long cb)
     563int             kFile::write(const void *pv, long cb) throw (kError)
    561564{
    562565    if (fReadOnly)
     
    678681 * @param       off         Absolute file offset.
    679682 */
    680 int             kFile::writeAt(const void *pvBuffer, long cbBuffer, long off)
     683int             kFile::writeAt(const void *pvBuffer, long cbBuffer, long off) throw (kError)
    681684{
    682685    if (set(off))
     
    788791 * @param       off     Relative reposition.
    789792 */
    790 int             kFile::move(long off)
     793int             kFile::move(long off) throw (kError)
    791794{
    792795    if ((off + offVirtual) & 0x80000000UL) /* above 2GB or negative */
     
    814817 * @param       off     New file position.
    815818 */
    816 int             kFile::set(long off)
     819int             kFile::set(long off) throw (kError)
    817820{
    818821    if (off < 0)
     
    839842 * @remark      Will only throw error if refreshFileStatus failes.
    840843 */
    841 int             kFile::end()
     844int             kFile::end() throw (kError)
    842845{
    843846    if (!refreshFileStatus())
     
    872875 * @remark      Will only throw error if refreshFileStatus failes.
    873876 */
    874 long            kFile::getSize()
     877long            kFile::getSize() throw (kError)
    875878{
    876879    if (!refreshFileStatus())
     
    886889 * @remark      Will only throw error if refreshFileStatus failes.
    887890 */
    888 long            kFile::getPos() const
     891long            kFile::getPos() const throw (kError)
    889892{
    890893    return offVirtual;
     
    898901 * @remark      Will only throw error if refreshFileStatus failes.
    899902 */
    900 KBOOL           kFile::isEOF()
     903KBOOL           kFile::isEOF() throw (kError)
    901904{
    902905    #if 0
     
    954957 * @remark  May throw errors.
    955958 */
    956 void *kFile::mapFile(const char *pszFilename)
     959void *kFile::mapFile(const char *pszFilename) throw (kError)
    957960{
    958961    kFile file(pszFilename);
     
    968971 * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    969972 */
    970 void kFile::mapFree(void *pvFileMapping)
     973void kFile::mapFree(void *pvFileMapping) throw (kError)
    971974{
    972975    if (pvFileMapping)
  • trunk/tools/common/kFileDef.cpp

    r9164 r21916  
    119119
    120120
    121 kFileDef::kFileDef(kFile *pFile) :
     121kFileDef::kFileDef(kFile *pFile) throw (kError) :
    122122    kFileFormatBase(pFile),
    123123    pszType(NULL), pszModName(NULL), pszBase(NULL), pszCode(NULL), pszData(NULL), pszDescription(NULL),
     
    137137 * Destructor. Frees used memory.
    138138 */
    139 kFileDef::~kFileDef()
     139kFileDef::~kFileDef() throw (kError)
    140140{
    141141    if (pszType        != NULL) delete pszType;
     
    182182 * @remark  throws errorcode on error (TODO: errorhandling)
    183183 */
    184 void kFileDef::read(kFile *pFile)
     184void kFileDef::read(kFile *pFile) throw (kError)
    185185{
    186186    char *pszTmp;
     
    445445 * @remark    tabs are expanded. string is trimmed. comments removed.
    446446 */
    447 char *kFileDef::readln(kFile *pFile, char *pszBuffer, int cbBuffer)
     447char *kFileDef::readln(kFile *pFile, char *pszBuffer, int cbBuffer) throw (kError)
    448448{
    449449    int i;
     
    700700 * @remark
    701701 */
    702 KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut, int enmOS)
     702KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut, int enmOS) throw(kError)
    703703{
    704704    PDEFSEGMENT pSeg;
  • trunk/tools/common/kFileDef.h

    r9162 r21916  
    105105        /**@cat Constructor/Destructor */
    106106        kFileDef(kFile *pFile) throw(kError);
    107         virtual ~kFileDef();
     107        virtual ~kFileDef() throw (kError);
    108108
    109109        /** @cat Module information methods. */
  • trunk/tools/common/kFileFormatBase.cpp

    r8003 r21916  
    3030 * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    3131 */
    32 kFileFormatBase::kFileFormatBase(kFile *pFile)
     32kFileFormatBase::kFileFormatBase(kFile *pFile) throw (kError)
    3333    : pFile(pFile)
    3434{
     
    4242 * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    4343 */
    44 kFileFormatBase::~kFileFormatBase()
     44kFileFormatBase::~kFileFormatBase() throw (kError)
    4545{
    4646    if (pFile)
  • trunk/tools/common/kFileInterfaces.cpp

    r8003 r21916  
    1919*   Header Files                                                               *
    2020*******************************************************************************/
     21#include <malloc.h>
     22
    2123#include "kTypes.h"
    2224#include "kError.h"
     
    6365     * Save the target we are searching for references to.
    6466     */
    65     PXREFSTATE  pState = new XREFSTATE;
     67    PXREFSTATE  pState = (PXREFSTATE)malloc(sizeof(XREFSTATE));
    6668    pState->ulSegment = ulSegment;
    6769    pState->offSegment = offSegment;
     
    131133    kASSERT(preloc != NULL);
    132134    relocFindClose(preloc);
    133     delete preloc->pv2;
     135    free(preloc->pv2);
    134136    preloc->pv2 = NULL;
    135137}
  • trunk/tools/common/kFileLX.cpp

    r8003 r21916  
    256256 * @param     pszFilename   LX executable image name.
    257257 */
    258 kFileLX::kFileLX(const char *pszFilename) :
     258kFileLX::kFileLX(const char *pszFilename) throw (kError) :
    259259    kFileFormatBase(NULL), pvBase(NULL)
    260260{
     
    292292 * @param     pFile     Pointer to opened LX file.
    293293 */
    294 kFileLX::kFileLX(kFile *pFile) :
     294kFileLX::kFileLX(kFile *pFile) throw (kError) :
    295295    kFileFormatBase(pFile), pvBase(NULL)
    296296{
     
    330330 * Destructor.
    331331 */
    332 kFileLX::~kFileLX()
     332kFileLX::~kFileLX() throw (kError)
    333333{
    334334    if (pvBase != NULL)
     
    412412
    413413                /* store status - current export entry */
    414                 PEXPSTATE pExpState = new EXPSTATE;
     414                PEXPSTATE pExpState = (PEXPSTATE)malloc(sizeof(EXPSTATE));
    415415                pExport->pv         = pExpState;
    416416                pExpState->pb32     = pBundle;
     
    560560void kFileLX::exportFindClose(kExportEntry *pExport)
    561561{
    562     delete pExport->pv;
     562    free(pExport->pv);
    563563    pExport->pv = NULL;
    564564    return;
     
    13751375        )
    13761376    {
    1377         PLXRELOCSTATE  pState = new LXRELOCSTATE;
     1377        PLXRELOCSTATE  pState = (PLXRELOCSTATE)malloc(sizeof(LXRELOCSTATE));
    13781378        pState->ulSegment = ulSegment;
    13791379        pState->ulPage = paObject[ulSegment].o32_pagemap - 1;
     
    14511451                if (preloc->isName())
    14521452                {
    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;
    14551455                    preloc->Info.Name.pszName = preloc->Info.Name.pszModule = NULL;
    14561456                }
     
    16701670    if (preloc->isName())
    16711671    {
    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;
    16741674        preloc->Info.Name.pszName = preloc->Info.Name.pszModule = NULL;
    16751675    }
     
    16771677    /* free state info */
    16781678    memset(preloc->pv1, 0xff, sizeof(LXRELOCSTATE));
    1679     delete preloc->pv1;
     1679    free(preloc->pv1);
    16801680    preloc->pv1 = (void*)0xdeadbeef;
    16811681}
  • trunk/tools/common/kFileLX.h

    r8003 r21916  
    2222    kFileLX(const char *pszFilename) throw (kError);
    2323    kFileLX(kFile *pFile) throw (kError);
    24     ~kFileLX();
     24    ~kFileLX() throw (kError);
    2525
    2626    /** @cat Module information methods. */
  • trunk/tools/common/kFilePE.cpp

    r8003 r21916  
    1111******************************************************************************/
    1212#include <string.h>
     13#include <malloc.h>
    1314
    1415#include "MZexe.h"
     
    3637 * @remark    throws errorcode
    3738 */
    38 kFilePE::kFilePE(kFile *pFile) :
     39kFilePE::kFilePE(kFile *pFile) throw (kError) :
    3940    kFileFormatBase(pFile),
    4041    pvBase(NULL),
     
    7677
    7778            /* create mapping */
    78    pvBase = new char [pehdr.OptionalHeader.SizeOfImage];
     79   pvBase = malloc(pehdr.OptionalHeader.SizeOfImage);
    7980   if (pvBase == NULL)
    8081       throw(kError(kError::NOT_ENOUGH_MEMORY));
     
    9394
    9495                    /* read sections */
    95                     for (int i = 0; i < pehdr.FileHeader.NumberOfSections; i++)
     96                    int i;
     97                    for (i = 0; i < pehdr.FileHeader.NumberOfSections; i++)
    9698                    {
    9799           unsigned long  cbSection;
     
    138140   catch (kError err)
    139141   {
    140        delete(pvBase);
     142       free(pvBase);
    141143       pvBase = NULL;
    142144       throw(err);
     
    148150 * Destructor.
    149151 */
    150 kFilePE::~kFilePE()
     152kFilePE::~kFilePE() throw (kError)
    151153{
    152154    if (pvBase)
    153         delete(pvBase);
     155        free(pvBase);
    154156}
    155157
  • trunk/tools/common/kFilePE.h

    r8003 r21916  
    6767    public:
    6868        kFilePE(kFile *pFile) throw (kError);
    69         virtual ~kFilePE();
     69        virtual ~kFilePE() throw (kError);
    7070
    7171        /** @cat Module information methods. */
  • trunk/tools/common/kFileSDF.cpp

    r8003 r21916  
    6767 *
    6868 */
    69 void kFileSDF::parseSDFFile(void *pvFile)
     69void kFileSDF::parseSDFFile(void *pvFile) throw (kError)
    7070{
    7171    /*
     
    160160 * @remark  Will throw error codes.
    161161 */
    162 kFileSDF::kFileSDF(kFile *pFile) :
     162kFileSDF::kFileSDF(kFile *pFile) throw (kError) :
    163163    kFileFormatBase(pFile), papStructs(NULL), pHdr(NULL), paTypes(NULL)
    164164{
     
    205205
    206206
    207 kFileSDF::~kFileSDF()
     207kFileSDF::~kFileSDF() throw (kError)
    208208{
    209209    if (papStructs);
  • trunk/tools/common/kFileSDF.h

    r8003 r21916  
    8181public:
    8282    kFileSDF(kFile *pFile) throw (kError);
    83     ~kFileSDF();
     83    ~kFileSDF() throw (kError);
    8484
    8585    /** @cat Debug Type information methods. */
  • trunk/tools/common/kTypes.h

    r21350 r21916  
    5454
    5555/*******************************************************************************
     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/*******************************************************************************
    5671*   Common stuff                                                               *
    5772*******************************************************************************/
     
    183198    ((expr) ? (void)0 : (kAssertMsg(#expr, __FILE__, __LINE__, __FUNCTION__) ? INT3() : (void)0))
    184199
     200#ifdef __cplusplus
     201extern "C"
     202#endif
    185203KBOOL KLIBCALL kAssertMsg(const char *pszExpr, const char *pszFilename, unsigned uLine, const char *pszFunction);
    186204
Note: See TracChangeset for help on using the changeset viewer.