Ignore:
Timestamp:
Feb 24, 2002, 3:44:40 AM (24 years ago)
Author:
bird
Message:

New kFile* classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/impdef/ImpDef.cpp

    r5531 r8002  
    1 /* $Id: ImpDef.cpp,v 1.7 2001-04-17 00:26:28 bird Exp $ */
     1/* $Id: ImpDef.cpp,v 1.8 2002-02-24 02:44:40 bird Exp $ */
    22/*
    33 * ImpDef - Create export file which use internal names and ordinals.
     
    1010*   Header Files                                                               *
    1111*******************************************************************************/
    12 #include <os2.h>
     12//#include <os2.h>
    1313#include <stdio.h>
    1414#include <string.h>
    1515#include <stdlib.h>
    16 #include "ImpDef.h"
     16
     17#include "kTypes.h"
     18#include "kError.h"
    1719#include "kFile.h"
    18 #include "kInterFaces.h"
     20#include "kFileInterfaces.h"
    1921#include "kFileFormatBase.h"
    2022#include "kFileDef.h"
     23
     24#include "ImpDef.h"
    2125
    2226
     
    3842{
    3943    int     argi;
    40     BOOL    fFatal = FALSE;
     44    KBOOL   fFatal = FALSE;
    4145    long    lRc = 0;
    4246    char   *pszInput = NULL;
     
    186190    try
    187191    {
    188         kFile Input(pszInput);
     192        kFile * pInput = new kFile(pszInput);
    189193        try
    190194        {
    191             kFileDef DefFile(&Input);
     195            kFileDef * pDefFile = new kFileDef(pInput);
    192196            try
    193197            {
     198                kFile * pOutput = new kFile(pszOutput, FALSE);
    194199                kExportEntry export;
    195                 kFile Output(pszOutput, FALSE);
    196200
    197201                /* generate LIBRARY line */
    198                 Output.printf(
     202                pOutput->printf(
    199203                    ";Internal export definition file - autogenerated by ImpDef.\n"
    200204                    "%s\n",
    201                     DefFile.queryType());
     205                    pDefFile->queryType());
    202206
    203207                /* Description line */
    204                 if (DefFile.queryDescription())
    205                     Output.printf("DESCRIPTION '%s'\n", DefFile.queryDescription());
     208                if (pDefFile->queryDescription())
     209                    pOutput->printf("DESCRIPTION '%s'\n", pDefFile->queryDescription());
    206210
    207211                /* Exports */
    208                 if (DefFile.exportFindFirst(&export))
     212                if (pDefFile->exportFindFirst(&export))
    209213                {
    210                     Output.printf("EXPORTS\n");
     214                    pOutput->printf("EXPORTS\n");
    211215                    do
    212216                    {
     
    235239                        pszName = generateExportName(&export, &szName[0], pOptions);
    236240
    237                         Output.printf("    %-*s  @%ld\n", 40, pszName, export.ulOrdinal);
    238                     } while (DefFile.exportFindNext(&export));
    239                 Output.setSize();
     241                        pOutput->printf("    %-*s  @%ld\n", 40, pszName, export.ulOrdinal);
     242                    } while (pDefFile->exportFindNext(&export));
     243                pOutput->setSize();
     244                delete pOutput;
    240245                }
    241246            }
    242             catch (int errorcode)
    243             {
    244                 kFile::StdErr.printf("error creating output file, '%s', errorcode 0x%x\n", pszOutput, errorcode);
     247            catch (kError err)
     248            {
     249                kFile::StdErr.printf("error creating output file, '%s', errorcode 0x%x\n", pszOutput, err.getErrno());
    245250                lRc = -4;
    246251            }
    247         }
    248         catch (int errorcode)
    249         {
    250             kFile::StdErr.printf("%s is not a valid def file, errorcode 0x%x\n", pszInput, errorcode);
     252            delete pDefFile;
     253        }
     254        catch (kError err)
     255        {
     256            kFile::StdErr.printf("%s is not a valid def file, errorcode 0x%x\n", pszInput, err.getErrno());
    251257            lRc = -3;
    252258        }
    253     }
    254     catch (int errorcode)
    255     {
    256         kFile::StdErr.printf( "error openining inputfile, '%s', errorcode 0x%x\n", pszInput, errorcode);
     259        //delete pInput; - not needed done by ~kFileFormatBase!
     260    }
     261    catch (kError err)
     262    {
     263        kFile::StdErr.printf( "error openining inputfile, '%s', errorcode 0x%x\n", pszInput, err.getErrno());
    257264        lRc = -2;
    258265    }
Note: See TracChangeset for help on using the changeset viewer.