Remove a lot of dead Mac code. Part of bug 456662. sr=pinkerton

This commit is contained in:
Josh Aas 2008-09-25 12:23:33 -04:00
parent ca22ed2145
commit 81dfc77596
20 changed files with 2 additions and 3293 deletions

View File

@ -54,17 +54,8 @@
#include "vr_stubs.h"
#if defined(XP_MAC)
#include <Folders.h>
#include <Script.h>
#include <stdlib.h>
#include <Errors.h>
#include "MoreFiles.h"
#include "FullPath.h" /* For FSpLocationFromFullPath() */
#endif
#if defined(XP_MACOSX)
#include <Folders.h>
#ifdef XP_MACOSX
#include <Carbon/Carbon.h>
#include <stdlib.h>
#endif

View File

@ -627,7 +627,6 @@ MAKEFILES_embedding="
embedding/components/ui/progressDlg/Makefile
embedding/config/Makefile
embedding/tests/Makefile
embedding/tests/cocoaEmbed/Makefile
embedding/tests/winEmbed/Makefile
"

View File

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Don Cone <dcone@netscape.com>
* Conrad Carlen <ccarlen@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
%{ C++
#include <Printing.h>
%}
/**
* Native types
*/
native nsTHPrint(THPrint);
/**
* Simplified PrintSettings for Mac interface
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(3C85F9F5-3A9D-4bce-8CF8-A1B14E5E8508)]
interface nsIPrintSettingsMac : nsISupports
{
/*
* thPrint attribute
*
* Getter returns a clone of the current data
* Setter copies (does not take ownership of) the input
*/
[noscript] attribute nsTHPrint tHPrint;
/*
* readPageSetupFromPrefs and writePageSetupToPrefs
*
* Read and write a print record to/from prefs.
*/
[noscript] void readPageSetupFromPrefs();
[noscript] void writePageSetupToPrefs();
};

View File

@ -1,781 +0,0 @@
/*
** Apple Macintosh Developer Technical Support
**
** DirectoryCopy: A robust, general purpose directory copy routine.
**
** by Jim Luther, Apple Developer Technical Support Emeritus
**
** File: DirectoryCopy.c
**
** Copyright © 1992-1998 Apple Computer, Inc.
** All rights reserved.
**
** You may incorporate this sample code into your applications without
** restriction, though the sample code has been provided "AS IS" and the
** responsibility for its operation is 100% yours. However, what you are
** not permitted to do is to redistribute the source as "DSC Sample Code"
** after having made changes. If you're going to re-distribute the source,
** we require that you make it clear in the source that the code was
** descended from Apple Sample Code, but that you've made changes.
*/
// Modified to allow renaming the destination folder
#include <Types.h>
#include <Errors.h>
#include <Memory.h>
#include <Files.h>
#include <Script.h>
#define __COMPILINGMOREFILES
#include "MoreFiles.h"
#include "MoreFilesExtras.h"
#include "MoreDesktopMgr.h"
#include "FileCopy.h"
#include "MacDirectoryCopy.h"
#include <string.h>
/*****************************************************************************/
enum
{
getNextItemOp = 1, /* couldn't access items in this directory - no access privileges */
copyDirCommentOp = 2, /* couldn't copy directory's Finder comment */
copyDirAccessPrivsOp = 3, /* couldn't copy directory's AFP access privileges */
copyDirFMAttributesOp = 4, /* couldn't copy directory's File Manager attributes */
dirCreateOp = 5, /* couldn't create destination directory */
fileCopyOp = 6 /* couldn't copy file */
};
/*****************************************************************************/
#define CallCopyErrProc(userRoutine, error, failedOperation, srcVRefNum, srcDirID, srcName, dstVRefNum, dstDirID, dstName) \
(*(userRoutine))((error), (failedOperation), (srcVRefNum), (srcDirID), (srcName), (dstVRefNum), (dstDirID), (dstName))
/*****************************************************************************/
typedef pascal Boolean (*CopyFilterProcPtr) (const CInfoPBRec * const cpbPtr);
/* ¦ Prototype for the CopyFilterProc function.
This is the prototype for the CopyFilterProc function called by
FilteredDirectoryCopy and GetLevelSize. If true is returned,
the file/folder is included in the copy, otherwise it is excluded.
pb input: Points to the CInfoPBRec for the item under consideration.
__________
Also see: FilteredDirectoryCopy, FSpFilteredDirectoryCopy
*/
#define CallCopyFilterProc(userRoutine, cpbPtr) (*(userRoutine))((cpbPtr))
/*****************************************************************************/
/* local constants */
enum
{
dirCopyBigCopyBuffSize = 0x00004000,
dirCopyMinCopyBuffSize = 0x00000200
};
/*****************************************************************************/
/* local data structures */
/* The EnumerateGlobals structure is used to minimize the amount of
** stack space used when recursively calling CopyLevel and to hold
** global information that might be needed at any time. */
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct EnumerateGlobals
{
Ptr copyBuffer; /* pointer to buffer used for file copy operations */
long bufferSize; /* the size of the copy buffer */
CopyErrProcPtr errorHandler; /* pointer to error handling function */
CopyFilterProcPtr copyFilterProc; /* pointer to filter function */
OSErr error; /* temporary holder of results - saves 2 bytes of stack each level */
Boolean bailout; /* set to true to by error handling function if fatal error */
short destinationVRefNum; /* the destination vRefNum */
Str63 itemName; /* the name of the current item */
CInfoPBRec myCPB; /* the parameter block used for PBGetCatInfo calls */
};
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
typedef struct EnumerateGlobals EnumerateGlobals;
typedef EnumerateGlobals *EnumerateGlobalsPtr;
/* The PreflightGlobals structure is used to minimize the amount of
** stack space used when recursively calling GetLevelSize and to hold
** global information that might be needed at any time. */
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct PreflightGlobals
{
OSErr result; /* temporary holder of results - saves 2 bytes of stack each level */
Str63 itemName; /* the name of the current item */
CInfoPBRec myCPB; /* the parameter block used for PBGetCatInfo calls */
unsigned long dstBlksPerAllocBlk; /* the number of 512 byte blocks per allocation block on destination */
unsigned long allocBlksNeeded; /* the total number of allocation blocks needed */
unsigned long tempBlocks; /* temporary storage for calculations (save some stack space) */
CopyFilterProcPtr copyFilterProc; /* pointer to filter function */
};
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
typedef struct PreflightGlobals PreflightGlobals;
typedef PreflightGlobals *PreflightGlobalsPtr;
/*****************************************************************************/
/* static prototypes */
static void GetLevelSize(long currentDirID,
PreflightGlobals *theGlobals);
static OSErr PreflightDirectoryCopySpace(short srcVRefNum,
long srcDirID,
short dstVRefNum,
CopyFilterProcPtr copyFilterProc,
Boolean *spaceOK);
static void CopyLevel(long sourceDirID,
long dstDirID,
EnumerateGlobals *theGlobals);
/*****************************************************************************/
static void GetLevelSize(long currentDirID,
PreflightGlobals *theGlobals)
{
short index = 1;
do
{
theGlobals->myCPB.dirInfo.ioFDirIndex = index;
theGlobals->myCPB.dirInfo.ioDrDirID = currentDirID; /* we need to do this every time */
/* through, since GetCatInfo */
/* returns ioFlNum in this field */
theGlobals->result = PBGetCatInfoSync(&theGlobals->myCPB);
if ( theGlobals->result == noErr )
{
if ( (theGlobals->copyFilterProc == NULL) ||
CallCopyFilterProc(theGlobals->copyFilterProc, &theGlobals->myCPB) ) /* filter if filter proc was supplied */
{
/* Either there's no filter proc OR the filter proc says to use this item */
if ( (theGlobals->myCPB.dirInfo.ioFlAttrib & ioDirMask) != 0 )
{
/* we have a directory */
GetLevelSize(theGlobals->myCPB.dirInfo.ioDrDirID, theGlobals); /* recurse */
theGlobals->result = noErr; /* clear error return on way back */
}
else
{
/* We have a file - add its allocation blocks to allocBlksNeeded. */
/* Since space on Mac OS disks is always allocated in allocation blocks, */
/* this takes into account rounding up to the end of an allocation block. */
/* get number of 512-byte blocks needed for data fork */
if ( ((unsigned long)theGlobals->myCPB.hFileInfo.ioFlLgLen & 0x000001ff) != 0 )
{
theGlobals->tempBlocks = ((unsigned long)theGlobals->myCPB.hFileInfo.ioFlLgLen >> 9) + 1;
}
else
{
theGlobals->tempBlocks = (unsigned long)theGlobals->myCPB.hFileInfo.ioFlLgLen >> 9;
}
/* now, calculate number of new allocation blocks needed for the data fork and add it to the total */
if ( theGlobals->tempBlocks % theGlobals->dstBlksPerAllocBlk )
{
theGlobals->allocBlksNeeded += (theGlobals->tempBlocks / theGlobals->dstBlksPerAllocBlk) + 1;
}
else
{
theGlobals->allocBlksNeeded += theGlobals->tempBlocks / theGlobals->dstBlksPerAllocBlk;
}
/* get number of 512-byte blocks needed for resource fork */
if ( ((unsigned long)theGlobals->myCPB.hFileInfo.ioFlRLgLen & 0x000001ff) != 0 )
{
theGlobals->tempBlocks = ((unsigned long)theGlobals->myCPB.hFileInfo.ioFlRLgLen >> 9) + 1;
}
else
{
theGlobals->tempBlocks = (unsigned long)theGlobals->myCPB.hFileInfo.ioFlRLgLen >> 9;
}
/* now, calculate number of new allocation blocks needed for the resource fork and add it to the total */
if ( theGlobals->tempBlocks % theGlobals->dstBlksPerAllocBlk )
{
theGlobals->allocBlksNeeded += (theGlobals->tempBlocks / theGlobals->dstBlksPerAllocBlk) + 1;
}
else
{
theGlobals->allocBlksNeeded += theGlobals->tempBlocks / theGlobals->dstBlksPerAllocBlk;
}
}
}
}
++index;
} while ( theGlobals->result == noErr );
}
/*****************************************************************************/
static OSErr PreflightDirectoryCopySpace(short srcVRefNum,
long srcDirID,
short dstVRefNum,
CopyFilterProcPtr copyFilterProc,
Boolean *spaceOK)
{
XVolumeParam pb;
OSErr error;
unsigned long dstFreeBlocks;
PreflightGlobals theGlobals;
error = XGetVolumeInfoNoName(NULL, dstVRefNum, &pb);
if ( error == noErr )
{
/* Convert freeBytes to free disk blocks (512-byte blocks) */
dstFreeBlocks = (pb.ioVFreeBytes >> 9);
/* get allocation block size (always multiple of 512) and divide by 512
to get number of 512-byte blocks per allocation block */
theGlobals.dstBlksPerAllocBlk = ((unsigned long)pb.ioVAlBlkSiz >> 9);
theGlobals.allocBlksNeeded = 0;
theGlobals.myCPB.dirInfo.ioNamePtr = theGlobals.itemName;
theGlobals.myCPB.dirInfo.ioVRefNum = srcVRefNum;
theGlobals.copyFilterProc = copyFilterProc;
GetLevelSize(srcDirID, &theGlobals);
/* Is there enough room on the destination volume for the source file? */
/* Note: This will work because the largest number of disk blocks supported */
/* on a 2TB volume is 0xffffffff and (allocBlksNeeded * dstBlksPerAllocBlk) */
/* will always be less than 0xffffffff. */
*spaceOK = ((theGlobals.allocBlksNeeded * theGlobals.dstBlksPerAllocBlk) <= dstFreeBlocks);
}
return ( error );
}
/*****************************************************************************/
static void CopyLevel(long sourceDirID,
long dstDirID,
EnumerateGlobals *theGlobals)
{
long currentSrcDirID;
long newDirID;
short index = 1;
do
{
/* Get next source item at the current directory level */
theGlobals->myCPB.dirInfo.ioFDirIndex = index;
theGlobals->myCPB.dirInfo.ioDrDirID = sourceDirID;
theGlobals->error = PBGetCatInfoSync(&theGlobals->myCPB);
if ( theGlobals->error == noErr )
{
if ( (theGlobals->copyFilterProc == NULL) ||
CallCopyFilterProc(theGlobals->copyFilterProc, &theGlobals->myCPB) ) /* filter if filter proc was supplied */
{
/* Either there's no filter proc OR the filter proc says to use this item */
/* We have an item. Is it a file or directory? */
if ( (theGlobals->myCPB.hFileInfo.ioFlAttrib & ioDirMask) != 0 )
{
/* We have a directory */
/* Create a new directory at the destination. No errors allowed! */
theGlobals->error = DirCreate(theGlobals->destinationVRefNum, dstDirID, theGlobals->itemName, &newDirID);
if ( theGlobals->error == noErr )
{
/* Save the current source directory ID where we can get it when we come back
** from recursion land. */
currentSrcDirID = theGlobals->myCPB.dirInfo.ioDrDirID;
/* Dive again (copy the directory level we just found below this one) */
CopyLevel(theGlobals->myCPB.dirInfo.ioDrDirID, newDirID, theGlobals);
if ( !theGlobals->bailout )
{
/* Copy comment from old to new directory. */
/* Ignore the result because we really don't care if it worked or not. */
(void) DTCopyComment(theGlobals->myCPB.dirInfo.ioVRefNum, currentSrcDirID, NULL, theGlobals->destinationVRefNum, newDirID, NULL);
/* Copy directory attributes (dates, etc.) to newDirID. */
/* No errors allowed */
theGlobals->error = CopyFileMgrAttributes(theGlobals->myCPB.dirInfo.ioVRefNum, currentSrcDirID, NULL, theGlobals->destinationVRefNum, newDirID, NULL, true);
/* handle any errors from CopyFileMgrAttributes */
if ( theGlobals->error != noErr )
{
if ( theGlobals->errorHandler != NULL )
{
theGlobals->bailout = CallCopyErrProc(theGlobals->errorHandler, theGlobals->error, copyDirFMAttributesOp,
theGlobals->myCPB.dirInfo.ioVRefNum, currentSrcDirID, NULL,
theGlobals->destinationVRefNum, newDirID, NULL);
}
else
{
/* If you don't handle the errors with an error handler, */
/* then the copy stops here. */
theGlobals->bailout = true;
}
}
}
}
else /* error handling for DirCreate */
{
if ( theGlobals->errorHandler != NULL )
{
theGlobals->bailout = CallCopyErrProc(theGlobals->errorHandler, theGlobals->error, dirCreateOp,
theGlobals->myCPB.dirInfo.ioVRefNum, currentSrcDirID, NULL,
theGlobals->destinationVRefNum, dstDirID, theGlobals->itemName);
}
else
{
/* If you don't handle the errors with an error handler, */
/* then the copy stops here. */
theGlobals->bailout = true;
}
}
if ( !theGlobals->bailout )
{
/* clear error return on way back if we aren't bailing out */
theGlobals->error = noErr;
}
}
else
{
/* We have a file, so copy it */
theGlobals->error = FileCopy(theGlobals->myCPB.hFileInfo.ioVRefNum,
theGlobals->myCPB.hFileInfo.ioFlParID,
theGlobals->itemName,
theGlobals->destinationVRefNum,
dstDirID,
NULL,
NULL,
theGlobals->copyBuffer,
theGlobals->bufferSize,
false);
/* handle any errors from FileCopy */
if ( theGlobals->error != noErr )
{
if ( theGlobals->errorHandler != NULL )
{
theGlobals->bailout = CallCopyErrProc(theGlobals->errorHandler, theGlobals->error, fileCopyOp,
theGlobals->myCPB.hFileInfo.ioVRefNum, theGlobals->myCPB.hFileInfo.ioFlParID, theGlobals->itemName,
theGlobals->destinationVRefNum, dstDirID, NULL);
if ( !theGlobals->bailout )
{
/* If the CopyErrProc handled the problem, clear the error here */
theGlobals->error = noErr;
}
}
else
{
/* If you don't handle the errors with an error handler, */
/* then the copy stops here. */
theGlobals->bailout = true;
}
}
}
}
}
else
{ /* error handling for PBGetCatInfo */
/* it's normal to get a fnfErr when indexing; that only means you've hit the end of the directory */
if ( theGlobals->error != fnfErr )
{
if ( theGlobals->errorHandler != NULL )
{
theGlobals->bailout = CallCopyErrProc(theGlobals->errorHandler, theGlobals->error, getNextItemOp,
theGlobals->myCPB.dirInfo.ioVRefNum, sourceDirID, NULL, 0, 0, NULL);
if ( !theGlobals->bailout )
{
/* If the CopyErrProc handled the problem, clear the error here */
theGlobals->error = noErr;
}
}
else
{
/* If you don't handle the errors with an error handler, */
/* then the copy stops here. */
theGlobals->bailout = true;
}
}
}
++index; /* prepare to get next item */
} while ( (theGlobals->error == noErr) && (!theGlobals->bailout) ); /* time to fall back a level? */
}
/*****************************************************************************/
pascal OSErr FilteredDirectoryCopy(short srcVRefNum,
long srcDirID,
ConstStr255Param srcName,
short dstVRefNum,
long dstDirID,
ConstStr255Param dstName,
void *copyBufferPtr,
long copyBufferSize,
Boolean preflight,
CopyErrProcPtr copyErrHandler,
CopyFilterProcPtr copyFilterProc, ConstStr255Param newName );
/* ¦ Make a copy of a directory structure in a new location with item filtering.
The FilteredDirectoryCopy function makes a copy of a directory
structure in a new location. If copyBufferPtr <> NIL, it points to
a buffer of copyBufferSize that is used to copy files data. The
larger the supplied buffer, the faster the copy. If
copyBufferPtr = NIL, then this routine allocates a buffer in the
application heap. If you pass a copy buffer to this routine, make
its size a multiple of 512 ($200) bytes for optimum performance.
The optional copyFilterProc parameter lets a routine you define
decide what files or directories are copied to the destination.
FilteredDirectoryCopy normally creates a new directory *in* the
specified destination directory and copies the source directory's
content into the new directory. However, if root parent directory
(fsRtParID) is passed as the dstDirID parameter and NULL is
passed as the dstName parameter, DirectoryCopy renames the
destination volume to the source directory's name (truncating
if the name is longer than 27 characters) and copies the source
directory's content into the destination volume's root directory.
This special case is supported by FilteredDirectoryCopy, but
not by FSpFilteredDirectoryCopy since with FSpFilteredDirectoryCopy,
the dstName parameter can not be NULL.
srcVRefNum input: Source volume specification.
srcDirID input: Source directory ID.
srcName input: Source directory name, or nil if
srcDirID specifies the directory.
dstVRefNum input: Destination volume specification.
dstDirID input: Destination directory ID.
dstName input: Destination directory name, or nil if
dstDirID specifies the directory.
copyBufferPtr input: Points to a buffer of copyBufferSize that
is used the i/o buffer for the copy or
nil if you want DirectoryCopy to allocate its
own buffer in the application heap.
copyBufferSize input: The size of the buffer pointed to
by copyBufferPtr.
preflight input: If true, DirectoryCopy makes sure there are
enough allocation blocks on the destination
volume to hold the directory's files before
starting the copy.
copyErrHandler input: A pointer to the routine you want called if an
error condition is detected during the copy, or
nil if you don't want to handle error conditions.
If you don't handle error conditions, the first
error will cause the copy to quit and
DirectoryCopy will return the error.
Error handling is recommended...
copyFilterProc input: A pointer to the filter routine you want called
for each item in the source directory, or NULL
if you don't want to filter.
Result Codes
noErr 0 No error
readErr Ð19 Driver does not respond to read requests
writErr Ð20 Driver does not respond to write requests
badUnitErr Ð21 Driver reference number does not
match unit table
unitEmptyErr Ð22 Driver reference number specifies a
nil handle in unit table
abortErr Ð27 Request aborted by KillIO
notOpenErr Ð28 Driver not open
dskFulErr -34 Destination volume is full
nsvErr -35 No such volume
ioErr -36 I/O error
bdNamErr -37 Bad filename
tmfoErr -42 Too many files open
fnfErr -43 Source file not found, or destination
directory does not exist
wPrErr -44 Volume locked by hardware
fLckdErr -45 File is locked
vLckdErr -46 Destination volume is read-only
fBsyErr -47 The source or destination file could
not be opened with the correct access
modes
dupFNErr -48 Destination file already exists
opWrErr -49 File already open for writing
paramErr -50 No default volume or function not
supported by volume
permErr -54 File is already open and cannot be opened using specified deny modes
memFullErr -108 Copy buffer could not be allocated
dirNFErr -120 Directory not found or incomplete pathname
wrgVolTypErr -123 Function not supported by volume
afpAccessDenied -5000 User does not have the correct access
afpDenyConflict -5006 The source or destination file could
not be opened with the correct access
modes
afpObjectTypeErr -5025 Source is a directory, directory not found
or incomplete pathname
__________
Also see: CopyErrProcPtr, CopyFilterProcPtr, FSpFilteredDirectoryCopy,
DirectoryCopy, FSpDirectoryCopy, FileCopy, FSpFileCopy
*/
/*****************************************************************************/
pascal OSErr FilteredDirectoryCopy(short srcVRefNum,
long srcDirID,
ConstStr255Param srcName,
short dstVRefNum,
long dstDirID,
ConstStr255Param dstName,
void *copyBufferPtr,
long copyBufferSize,
Boolean preflight,
CopyErrProcPtr copyErrHandler,
CopyFilterProcPtr copyFilterProc, ConstStr255Param newName)
{
EnumerateGlobals theGlobals;
Boolean isDirectory;
OSErr error;
Boolean ourCopyBuffer = false;
Str63 srcDirName, oldDiskName;
Boolean spaceOK;
/* Make sure a copy buffer is allocated. */
if ( copyBufferPtr == NULL )
{
/* The caller didn't supply a copy buffer so grab one from the application heap.
** Try to get a big copy buffer, if we can't, try for a 512-byte buffer.
** If 512 bytes aren't available, we're in trouble. */
copyBufferSize = dirCopyBigCopyBuffSize;
copyBufferPtr = NewPtr(copyBufferSize);
if ( copyBufferPtr == NULL )
{
copyBufferSize = dirCopyMinCopyBuffSize;
copyBufferPtr = NewPtr(copyBufferSize);
if ( copyBufferPtr == NULL )
{
return ( memFullErr );
}
}
ourCopyBuffer = true;
}
/* Get the real dirID where we're copying from and make sure it is a directory. */
error = GetDirectoryID(srcVRefNum, srcDirID, srcName, &srcDirID, &isDirectory);
if ( error != noErr )
{
goto ErrorExit;
}
if ( !isDirectory )
{
error = dirNFErr;
goto ErrorExit;
}
/* Special case destination if it is the root parent directory. */
/* Since you can't create the root directory, this is needed if */
/* you want to copy a directory's content to a disk's root directory. */
if ( (dstDirID == fsRtParID) && (dstName == NULL) )
{
dstDirID = fsRtParID;
isDirectory = true;
error = noErr;
}
else
{
/* Get the real dirID where we're going to put the copy and make sure it is a directory. */
error = GetDirectoryID(dstVRefNum, dstDirID, dstName, &dstDirID, &isDirectory);
if ( error != noErr )
{
goto ErrorExit;
}
if ( !isDirectory )
{
error = dirNFErr;
goto ErrorExit;
}
}
/* Get the real vRefNum of both the source and destination */
error = DetermineVRefNum(srcName, srcVRefNum, &srcVRefNum);
if ( error != noErr )
{
goto ErrorExit;
}
error = DetermineVRefNum(dstName, dstVRefNum, &dstVRefNum);
if ( error != noErr )
{
goto ErrorExit;
}
if ( preflight )
{
error = PreflightDirectoryCopySpace(srcVRefNum, srcDirID, dstVRefNum, copyFilterProc, &spaceOK);
if ( error != noErr )
{
goto ErrorExit;
}
if ( !spaceOK )
{
error = dskFulErr; /* not enough room on destination */
goto ErrorExit;
}
}
/* Create the new directory in the destination directory with the */
/* same name as the source directory. */
/*
if newName is not empty use it rather than the original dir name.
*/
if ( newName[0] == 0 )
{
error = GetDirName(srcVRefNum, srcDirID, srcDirName);
if ( error != noErr )
{
goto ErrorExit;
}
}
else
{
memcpy(srcDirName, newName, 32 );
}
/* Again, special case destination if the destination is the */
/* root parent directory. This time, we'll rename the disk to */
/* the source directory name. */
if ( dstDirID == fsRtParID )
{
/* Get the current name of the destination disk */
error = GetDirName(dstVRefNum, fsRtDirID, oldDiskName);
if ( error == noErr )
{
/* Shorten the name if it's too long to be the volume name */
TruncPString(srcDirName, srcDirName, 27);
/* Rename the disk */
error = HRename(dstVRefNum, fsRtParID, oldDiskName, srcDirName);
/* and copy to the root directory */
dstDirID = fsRtDirID;
}
}
else
{
error = DirCreate(dstVRefNum, dstDirID, srcDirName, &dstDirID);
}
if ( error != noErr )
{
/* handle any errors from DirCreate */
if ( copyErrHandler != NULL )
{
if ( CallCopyErrProc(copyErrHandler, error, dirCreateOp,
srcVRefNum, srcDirID, NULL,
dstVRefNum, dstDirID, srcDirName) )
{
goto ErrorExit;
}
else
{
/* If the CopyErrProc handled the problem, clear the error here */
/* and continue */
error = noErr;
}
}
else
{
/* If you don't handle the errors with an error handler, */
/* then the copy stops here. */
goto ErrorExit;
}
}
/* dstDirID is now the newly created directory! */
/* Set up the globals we need to access from the recursive routine. */
theGlobals.copyBuffer = (Ptr)copyBufferPtr;
theGlobals.bufferSize = copyBufferSize;
theGlobals.destinationVRefNum = dstVRefNum; /* so we can get to it always */
theGlobals.myCPB.hFileInfo.ioNamePtr = (StringPtr)&theGlobals.itemName;
theGlobals.myCPB.hFileInfo.ioVRefNum = srcVRefNum;
theGlobals.errorHandler = copyErrHandler;
theGlobals.bailout = false;
theGlobals.copyFilterProc = copyFilterProc;
/* Here we go into recursion land... */
CopyLevel(srcDirID, dstDirID, &theGlobals);
error = theGlobals.error; /* get the result */
if ( !theGlobals.bailout )
{
/* Copy comment from source to destination directory. */
/* Ignore the result because we really don't care if it worked or not. */
(void) DTCopyComment(srcVRefNum, srcDirID, NULL, dstVRefNum, dstDirID, NULL);
/* Copy the File Manager attributes */
error = CopyFileMgrAttributes(srcVRefNum, srcDirID, NULL,
dstVRefNum, dstDirID, NULL, true);
/* handle any errors from CopyFileMgrAttributes */
if ( (error != noErr) && (copyErrHandler != NULL) )
{
theGlobals.bailout = CallCopyErrProc(copyErrHandler, error, copyDirFMAttributesOp,
srcVRefNum, srcDirID, NULL,
dstVRefNum, dstDirID, NULL);
}
}
ErrorExit:
/* Get rid of the copy buffer if we allocated it. */
if ( ourCopyBuffer )
{
DisposePtr((Ptr)copyBufferPtr);
}
return ( error );
}
/*****************************************************************************/
pascal OSErr MacFSpDirectoryCopyRename(const FSSpec *srcSpec,
const FSSpec *dstSpec,
ConstStr255Param newName,
void *copyBufferPtr,
long copyBufferSize,
Boolean preflight,
CopyErrProcPtr copyErrHandler)
{
return ( FilteredDirectoryCopy(srcSpec->vRefNum, srcSpec->parID, srcSpec->name,
dstSpec->vRefNum, dstSpec->parID, dstSpec->name,
copyBufferPtr, copyBufferSize, preflight,
copyErrHandler, NULL, newName) );
}

View File

@ -1,158 +0,0 @@
/*
** Apple Macintosh Developer Technical Support
**
** DirectoryCopy: A robust, general purpose directory copy routine.
**
** by Jim Luther, Apple Developer Technical Support Emeritus
**
** File: DirectoryCopy.h
**
** Copyright © 1992-1998 Apple Computer, Inc.
** All rights reserved.
**
** You may incorporate this sample code into your applications without
** restriction, though the sample code has been provided "AS IS" and the
** responsibility for its operation is 100% yours. However, what you are
** not permitted to do is to redistribute the source as "DSC Sample Code"
** after having made changes. If you're going to re-distribute the source,
** we require that you make it clear in the source that the code was
** descended from Apple Sample Code, but that you've made changes.
*/
// Modified to allow renaming the destination folder
#ifndef __MACDIRECTORYCOPY__
#define __MACDIRECTORYCOPY__
#include <Types.h>
#include <Files.h>
#include "Optimization.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef pascal Boolean (*CopyErrProcPtr) (OSErr error,
short failedOperation,
short srcVRefNum,
long srcDirID,
ConstStr255Param srcName,
short dstVRefNum,
long dstDirID,
ConstStr255Param dstName);
/* ¦ Prototype for the CopyErrProc function DirectoryCopy calls.
This is the prototype for the CopyErrProc function DirectoryCopy
calls if an error condition is detected sometime during the copy. If
CopyErrProc returns false, then DirectoryCopy attempts to continue with
the directory copy operation. If CopyErrProc returns true, then
DirectoryCopy stops the directory copy operation.
error input: The error result code that caused CopyErrProc to
be called.
failedOperation input: The operation that returned an error to
DirectoryCopy.
srcVRefNum input: Source volume specification.
srcDirID input: Source directory ID.
srcName input: Source file or directory name, or nil if
srcDirID specifies the directory.
dstVRefNum input: Destination volume specification.
dstDirID input: Destination directory ID.
dstName input: Destination file or directory name, or nil if
dstDirID specifies the directory.
__________
Also see: FilteredDirectoryCopy, FSpFilteredDirectoryCopy, DirectoryCopy, FSpDirectoryCopy
*/
pascal OSErr MacFSpDirectoryCopyRename(const FSSpec *srcSpec,
const FSSpec *dstSpec,
ConstStr255Param newName,
void *copyBufferPtr,
long copyBufferSize,
Boolean preflight,
CopyErrProcPtr copyErrHandler);
/* ¦ Make a copy of a directory structure in a new location.
The FSpDirectoryCopy function makes a copy of a directory structure in a
new location. If copyBufferPtr <> NIL, it points to a buffer of
copyBufferSize that is used to copy files data. The larger the
supplied buffer, the faster the copy. If copyBufferPtr = NIL, then this
routine allocates a buffer in the application heap. If you pass a
copy buffer to this routine, make its size a multiple of 512
($200) bytes for optimum performance.
srcSpec input: An FSSpec record specifying the directory to copy.
dstSpec input: An FSSpec record specifying destination directory
of the copy.
copyBufferPtr input: Points to a buffer of copyBufferSize that
is used the i/o buffer for the copy or
nil if you want DirectoryCopy to allocate its
own buffer in the application heap.
copyBufferSize input: The size of the buffer pointed to
by copyBufferPtr.
preflight input: If true, FSpDirectoryCopy makes sure there are
enough allocation blocks on the destination
volume to hold the directory's files before
starting the copy.
copyErrHandler input: A pointer to the routine you want called if an
error condition is detected during the copy, or
nil if you don't want to handle error conditions.
If you don't handle error conditions, the first
error will cause the copy to quit and
DirectoryCopy will return the error.
Error handling is recommended...
Result Codes
noErr 0 No error
readErr Ð19 Driver does not respond to read requests
writErr Ð20 Driver does not respond to write requests
badUnitErr Ð21 Driver reference number does not
match unit table
unitEmptyErr Ð22 Driver reference number specifies a
nil handle in unit table
abortErr Ð27 Request aborted by KillIO
notOpenErr Ð28 Driver not open
dskFulErr -34 Destination volume is full
nsvErr -35 No such volume
ioErr -36 I/O error
bdNamErr -37 Bad filename
tmfoErr -42 Too many files open
fnfErr -43 Source file not found, or destination
directory does not exist
wPrErr -44 Volume locked by hardware
fLckdErr -45 File is locked
vLckdErr -46 Destination volume is read-only
fBsyErr -47 The source or destination file could
not be opened with the correct access
modes
dupFNErr -48 Destination file already exists
opWrErr -49 File already open for writing
paramErr -50 No default volume or function not
supported by volume
permErr -54 File is already open and cannot be opened using specified deny modes
memFullErr -108 Copy buffer could not be allocated
dirNFErr -120 Directory not found or incomplete pathname
wrgVolTypErr -123 Function not supported by volume
afpAccessDenied -5000 User does not have the correct access
afpDenyConflict -5006 The source or destination file could
not be opened with the correct access
modes
afpObjectTypeErr -5025 Source is a directory, directory not found
or incomplete pathname
__________
Also see: CopyErrProcPtr, DirectoryCopy, FilteredDirectoryCopy,
FSpFilteredDirectoryCopy, FileCopy, FSpFileCopy
*/
/*****************************************************************************/
#ifdef __cplusplus
}
#endif
#include "OptimizationEnd.h"
#endif /* __DIRECTORYCOPY__ */

View File

@ -1,139 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mac_console.h"
#ifndef __CONSOLE__
#include <console.h>
#endif
extern CWPluginContext gPluginContext;
UInt32 mac_console_count = 0;
CWMemHandle mac_console_handle = NULL;
/*
* The following four functions provide the UI for the console package.
* Users wishing to replace SIOUX with their own console package need
* only provide the four functions below in a library.
*/
/*
* extern short InstallConsole(short fd);
*
* Installs the Console package, this function will be called right
* before any read or write to one of the standard streams.
*
* short fd: The stream which we are reading/writing to/from.
* returns short: 0 no error occurred, anything else error.
*/
short InstallConsole(short fd)
{
#pragma unused (fd)
mac_console_count = 0;
CWAllocMemHandle(gPluginContext, 8192, false, &mac_console_handle);
return 0;
}
/*
* extern void RemoveConsole(void);
*
* Removes the console package. It is called after all other streams
* are closed and exit functions (installed by either atexit or _atexit)
* have been called. Since there is no way to recover from an error,
* this function doesn't need to return any.
*/
void RemoveConsole(void)
{
if (mac_console_handle != NULL) {
CWFreeMemHandle(gPluginContext, mac_console_handle);
mac_console_handle = NULL;
}
}
/*
* extern long WriteCharsToConsole(char *buffer, long n);
*
* Writes a stream of output to the Console window. This function is
* called by write.
*
* char *buffer: Pointer to the buffer to be written.
* long n: The length of the buffer to be written.
* returns short: Actual number of characters written to the stream,
* -1 if an error occurred.
*/
long WriteCharsToConsole(char *buffer, long n)
{
long size = 0;
void* ptr = NULL;
if (CWGetMemHandleSize(gPluginContext, mac_console_handle, &size) == noErr) {
if (mac_console_count + n >= size) {
size += 8192;
if (CWResizeMemHandle(gPluginContext, mac_console_handle, size) != noErr)
return -1;
}
}
if (CWLockMemHandle(gPluginContext, mac_console_handle, false, &ptr) == noErr) {
BlockMoveData(buffer, (char *)ptr + mac_console_count, n);
mac_console_count += n;
CWUnlockMemHandle(gPluginContext, mac_console_handle);
}
return 0;
}
/*
* extern long ReadCharsFromConsole(char *buffer, long n);
*
* Reads from the Console into a buffer. This function is called by
* read.
*
* char *buffer: Pointer to the buffer which will receive the input.
* long n: The maximum amount of characters to be read (size of
* buffer).
* returns short: Actual number of characters read from the stream,
* -1 if an error occurred.
*/
long ReadCharsFromConsole(char *buffer, long n)
{
return 0;
}

View File

@ -1,49 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_console.h
*/
#pragma once
#include <Files.h>
#include <Memory.h>
#include "CWPlugins.h"
extern UInt32 mac_console_count;
extern CWMemHandle mac_console_handle;

View File

@ -1,146 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_memory.cpp
*/
#include <new.h>
#include <stdlib.h>
#include <Files.h>
#include <Memory.h>
#include "DropInCompilerLinker.h"
#include "CompilerMapping.h"
#include "CWPluginErrors.h"
extern CWPluginContext gPluginContext;
/**
* Note: memory allocated by these operators will automatically be freed after the
* current call into xpidl_compiler completes. This should be fine in most cases,
* as we are also having the compiler be reloaded for every request to reinitialize
* global data. Just be careful out there!
*/
const Boolean kTemporaryAllocation = false;
void* operator new(size_t size)
{
void* ptr = NULL;
if (CWAllocateMemory(gPluginContext, size, kTemporaryAllocation, &ptr) == cwNoErr)
return ptr;
return NULL;
}
void operator delete(void* ptr)
{
if (ptr != NULL)
CWFreeMemory(gPluginContext, ptr, kTemporaryAllocation);
}
void* operator new[] (size_t size)
{
void* ptr = NULL;
if (CWAllocateMemory(gPluginContext, size, kTemporaryAllocation, &ptr) == cwNoErr)
return ptr;
return NULL;
}
void operator delete[](void* ptr)
{
if (ptr != NULL)
CWFreeMemory(gPluginContext, ptr, kTemporaryAllocation);
}
namespace std {
#define TRACK_ALLOCATION
#define kTrackedCookie 'TRKD'
void* malloc(size_t size)
{
#if defined(TRACK_ALLOCATION)
OSType* ptr = (OSType*) new char[sizeof(OSType) + size];
if (ptr != NULL)
*ptr++ = kTrackedCookie;
return ptr;
#else
return new char[size];
#endif
}
void free(void *ptr)
{
#if defined(TRACK_ALLOCATION)
OSType* type = (OSType*)ptr;
if (*--type == kTrackedCookie)
delete[] (char*) type;
else
DebugStr("\pillegal block passed to free.");
#else
delete[] (char*) ptr;
#endif
}
void* calloc(size_t nmemb, size_t size)
{
size *= nmemb;
void* ptr = malloc(size);
if (ptr != NULL) {
BlockZero(ptr, size);
}
return ptr;
}
void* realloc(void * ptr, size_t size)
{
void* newptr = NULL;
if (size > 0)
newptr = malloc(size);
if (ptr != NULL && newptr != NULL)
BlockMoveData(ptr, newptr, size);
if (ptr != NULL)
free(ptr);
return newptr;
}
}

View File

@ -1,58 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_stdlib.cpp
replacement functions for the CodeWarrior plugin.
by Patrick C. Beard.
*/
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
// simply throw us out of here!
jmp_buf exit_jump;
int exit_status = 0;
void std::exit(int status)
{
exit_status = status;
longjmp(exit_jump, -1);
}

View File

@ -1,38 +0,0 @@
/*
mac_strings.cpp
*/
#include "mac_strings.h"
#include <string.h>
#include <Memory.h>
#include <new>
StringPtr c2p_strcpy(StringPtr pstr, const char* cstr)
{
size_t len = ::strlen(cstr);
if (len > 255) len = 255;
BlockMoveData(cstr, pstr + 1, len);
pstr[0] = len;
return pstr;
}
char* p2c_strcpy(char* cstr, const StringPtr pstr)
{
size_t len = pstr[0];
BlockMoveData(pstr + 1, cstr, len);
cstr[len] = '\0';
return cstr;
}
char* p2c_strdup(StringPtr pstr)
{
size_t len = pstr[0];
char* cstr = new char[1 + len];
if (cstr != NULL) {
BlockMoveData(pstr + 1, cstr, len);
cstr[len] = '\0';
}
return cstr;
}

View File

@ -1,47 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_strings.h
*/
#pragma once
#include <MacTypes.h>
StringPtr c2p_strcpy(StringPtr pstr, const char* cstr);
char* p2c_strcpy(char* cstr, const StringPtr pstr);
char* p2c_strdup(StringPtr pstr);

View File

@ -1,417 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_xpidl.cpp
Metrowerks Codewarrior IDL plugin.
by Patrick C. Beard.
*/
/* standard headers */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <new.h>
#include <setjmp.h>
/* system headers */
#include <Files.h>
#include <Errors.h>
#include <Strings.h>
#include "FullPath.h"
#include "MoreFilesExtras.h"
/* compiler headers */
#include "DropInCompilerLinker.h"
#include "CompilerMapping.h"
#include "CWPluginErrors.h"
/* local headers. */
#include "mac_xpidl.h"
#include "mac_console.h"
#include "mac_strings.h"
#include "mac_xpidl_panel.h"
/* prototypes of local functions */
static CWResult Compile(CWPluginContext context);
static CWResult Disassemble(CWPluginContext context);
static CWResult LocateFile(CWPluginContext context, const char* filename, FSSpec& file);
/* external variables */
extern jmp_buf exit_jump;
extern int exit_status;
/* global variables */
CWPluginContext gPluginContext;
/* local variables */
static CWFileSpec gSourceFile;
static char* gSourcePath = NULL;
static CWFileSpec gOutputFile;
extern "C" {
pascal short xpidl_compiler(CWPluginContext context);
int xpidl_main(int argc, char* argv[]);
int xptdump_main(int argc, char* argv[]);
FILE * FSp_fopen(ConstFSSpecPtr spec, const char * open_mode);
}
pascal short xpidl_compiler(CWPluginContext context)
{
long request;
if (CWGetPluginRequest(context, &request) != cwNoErr)
return cwErrRequestFailed;
gPluginContext = context;
short result = cwNoErr;
/* dispatch on compiler request */
switch (request) {
case reqInitCompiler:
/* compiler has just been loaded into memory */
break;
case reqTermCompiler:
/* compiler is about to be unloaded from memory */
break;
case reqCompile:
/* compile a source file */
result = Compile(context);
break;
case reqCompDisassemble:
/* disassemble a source file */
result = Disassemble(context);
break;
default:
result = cwErrRequestFailed;
break;
}
/* is this necessary? */
CWDonePluginRequest(context, result);
/* return result code */
return (result);
}
static char* full_path_to(const FSSpec& file)
{
short len = 0;
Handle fullPath = NULL;
if (FSpGetFullPath(&file, &len, &fullPath) == noErr && fullPath != NULL) {
char* path = new char[1 + len];
if (path != NULL) {
BlockMoveData(*fullPath, path, len);
path[len] = '\0';
}
DisposeHandle(fullPath);
return path;
}
return NULL;
}
static CWResult GetSettings(CWPluginContext context, XPIDLSettings& settings)
{
CWMemHandle settingsHand;
CWResult err = CWGetNamedPreferences(context, kXPIDLPanelName, &settingsHand);
if (!CWSUCCESS(err))
return (err);
XPIDLSettings* settingsPtr = NULL;
err = CWLockMemHandle(context, settingsHand, false, (void**)&settingsPtr);
if (!CWSUCCESS(err))
return (err);
settings = *settingsPtr;
err = CWUnlockMemHandle(context, settingsHand);
if (!CWSUCCESS(err))
return (err);
return noErr;
}
static CWResult Compile(CWPluginContext context)
{
CWResult err = CWGetMainFileSpec(context, &gSourceFile);
if (!CWSUCCESS(err))
return (err);
long fileNum;
err = CWGetMainFileNumber(context, &fileNum);
if (!CWSUCCESS(err))
return (err);
// get the name of the source file to compile.
gSourcePath = p2c_strdup(gSourceFile.name);
if (gSourcePath == NULL)
return cwErrOutOfMemory;
// build an argument list and call the compiler.
XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeHeader, false, false };
GetSettings(context, settings);
#if 0
// if generating .xpt files, let the IDE tell us where to put the output file.
// otherwise, put them in the project's output directory.
if (settings.mode == kXPIDLModeTypelib)
err = CWGetSuggestedObjectFileSpec(context, fileNum, &gOutputFile);
else
err = CWGetOutputFileDirectory(gPluginContext, &gOutputFile);
#else
// always generate the output file into the project target's data directory.
err = CWGetSuggestedObjectFileSpec(context, fileNum, &gOutputFile);
#endif
if (!CWSUCCESS(err))
return (err);
int argc = 3;
char* modes[] = { "header", "java", "typelib", "doc" };
char* argv[] = { "xpidl", "-m", modes[settings.mode - 1], NULL, NULL, NULL, NULL, };
if (settings.warnings) argv[argc++] = "-w";
if (settings.verbose) argv[argc++] = "-v";
argv[argc++] = gSourcePath;
if (setjmp(exit_jump) == 0) {
if (xpidl_main(argc, argv) != 0)
err = cwErrRequestFailed;
} else {
// evidently the good old exit function got called.
if (exit_status != 0)
err = cwErrRequestFailed;
}
// if the compilation succeeded, tell CodeWarrior about the output file.
// this ensures several things: 1. if the output file is deleted by the user,
// then the IDE will know to recompile it, which is good for dirty builds,
// where the output files may be hand deleted; 2. if the user elects to remove
// objects, the output files are deleted. Thanks to robv@metrowerks.com for
// pointing this new CWPro4 API out.
if (err == cwNoErr) {
CWObjectData objectData;
BlockZero(&objectData, sizeof(objectData));
// for fun, show how large the output file is in the data area.
long dataSize, rsrcSize;
if (FSpGetFileSize(&gOutputFile, &dataSize, &rsrcSize) == noErr)
objectData.idatasize = dataSize;
// tell the IDE that this file was generated by the compiler.
objectData.objectfile = &gOutputFile;
err = CWStoreObjectData(context, fileNum, &objectData);
} else {
// an error occured, delete the output file, which might be a partial file.
if (gOutputFile.name[0] != 0) {
::FSpDelete(&gOutputFile);
}
}
delete[] gSourcePath;
gSourcePath = NULL;
return (err);
}
static CWResult Disassemble(CWPluginContext context)
{
// the disassembly code has moved to the linker.
return noErr;
}
static CWResult LocateFile(CWPluginContext context, const char* filename, FSSpec& file)
{
/* prefill the CWFileInfo struct */
CWFileInfo fileinfo;
BlockZero(&fileinfo, sizeof(fileinfo));
// memset(&fileinfo, 0, sizeof(fileinfo));
fileinfo.fullsearch = true;
fileinfo.suppressload = true;
fileinfo.dependencyType = cwNormalDependency;
fileinfo.isdependentoffile = kCurrentCompiledFile;
/* locate the file name using the project's access paths */
CWResult err = CWFindAndLoadFile(context, filename, &fileinfo);
if (err == cwNoErr) {
file = fileinfo.filespec;
} else if (err == cwErrFileNotFound) {
char errmsg[200];
sprintf(errmsg, "Can't locate file \"%s\".", filename);
CWResult callbackResult = CWReportMessage(context, 0, errmsg, 0, messagetypeError, 0);
}
return (err);
}
/**
* Substitute for standard fopen, treats certain filenames specially,
* and also considers the mode argument. If a file is being opened
* for reading, the file is assumed to be locateable using CodeWarrior's
* standard access paths. If it's for writing, the file is opened in
* the current project's output directory.
*/
FILE* std::fopen(const char* filename, const char *mode)
{
FSSpec filespec;
CWResult err = noErr;
do {
if (filename == gSourcePath || strcmp(filename, gSourcePath) == 0) {
// opening the main source file.
filespec = gSourceFile;
} else if (mode[0] == 'w') {
// if an output file, open it in the current compilation's output directory.
c2p_strcpy(filespec.name, filename);
filespec.vRefNum = gOutputFile.vRefNum;
filespec.parID = gOutputFile.parID;
c2p_strcpy(gOutputFile.name, filename);
} else {
// an input file, use CodeWarrior's search paths to find the named source file.
err = LocateFile(gPluginContext, filename, filespec);
}
} while (0);
// if all went well, we have a file to open.
return (err == noErr ? FSp_fopen(&filespec, mode) : NULL);
}
/**
* Returns the length of a file, assuming it is always located in the
* project's output directory.
*/
size_t mac_get_file_length(const char* filename)
{
long dataSize= 0, rsrcSize = 0;
FSSpec filespec;
if (CWGetOutputFileDirectory(gPluginContext, &filespec) != noErr)
return 0;
c2p_strcpy(filespec.name, filename);
if (FSpGetFileSize(&filespec, &dataSize, &rsrcSize) != noErr)
return 0;
return dataSize;
}
void mac_warning(const char* warning_message)
{
CWReportMessage(gPluginContext, 0, warning_message, 0, messagetypeWarning, 0);
}
void mac_error(const char* error_message)
{
CWReportMessage(gPluginContext, 0, error_message, 0, messagetypeError, 0);
}
// plugin compiler exports.
#if CW_USE_PRAGMA_EXPORT
#pragma export on
#endif
CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
{
static const DropInFlags sFlags = {
kCurrentDropInFlagsVersion,
CWDROPINCOMPILERTYPE,
DROPINCOMPILERLINKERAPIVERSION,
(kGeneratescode | /* kCandisassemble | */ kCompMultiTargAware | kCompAlwaysReload),
Lang_MISC,
DROPINCOMPILERLINKERAPIVERSION
};
*flags = &sFlags;
*flagsSize = sizeof(sFlags);
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
{
static const char* sDropInName = "xpidl";
*dropinName = sDropInName;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
{
static const char* sDisplayName = "xpidl";
*displayName = sDisplayName;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetPanelList)(const CWPanelList** panelList)
{
static const char* sPanelName = kXPIDLPanelName;
static CWPanelList sPanelList = { kCurrentCWPanelListVersion, 1, &sPanelName };
*panelList = &sPanelList;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
{
static CWDataType sCPU = '****';
static CWDataType sOS = '****';
static CWTargetList sTargetList = { kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS };
*targetList = &sTargetList;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
{
static CWExtensionMapping sExtension = { 'TEXT', ".idl", 0 };
static CWExtMapList sExtensionMapList = { kCurrentCWExtMapListVersion, 1, &sExtension };
*defaultMappingList = &sExtensionMapList;
return cwNoErr;
}
#if CW_USE_PRAGMA_EXPORT
#pragma export off
#endif

View File

@ -1,25 +0,0 @@
/*
mac_xpidl.h
prototypes for the Mac CodeWarrior plugin version of xpidl.
by Patrick C. Beard.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _STDIO_H
#include <stdio.h>
#endif
size_t mac_get_file_length(const char* filename);
void mac_warning(const char* warning_message);
void mac_error(const char* error_message);
#ifdef __cplusplus
}
#endif

View File

@ -1,695 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_xpidl_panel.cpp
*/
#define CW_STRICT_DIALOGS 1
/* standard headers */
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
/* system headers */
#include <AERegistry.h>
#include <Drag.h>
#include <Palettes.h>
#include <Resources.h>
#include <Scrap.h>
#include <TextUtils.h>
#include <Sound.h>
/* compiler headers */
#include <DropInPanel.h>
/* project headers */
#include "mac_xpidl_panel.h"
enum {
kFactoryPrefsID = 128,
kCW7ItemListID = 128,
kCW8ItemListID = 129,
kXPIDLModeItem = 1,
kXPIDLWarningsItem,
kXPIDLVerboseItem,
kXPTLinkerOutputItem = 4
};
/* local variables */
static RgnHandle sDragRgn;
static Boolean sHighlightOn;
/* prototypes of local functions */
static short InitDialog(PanelParameterBlock *pb);
static void TermDialog(PanelParameterBlock *pb);
static void PutData(PanelParameterBlock *pb, Handle options);
static short GetData(PanelParameterBlock *pb, Handle options, Boolean noisy);
static void ByteSwapData(XPIDLSettingsHandle options);
static short Filter(PanelParameterBlock *pb, EventRecord *event, short *itemHit);
static void ItemHit(PanelParameterBlock *pb);
static void Validate(Handle original, Handle current, Boolean *recompile, Boolean *relink, Boolean *reset);
static short GetPref(AEKeyword keyword, AEDesc *prefsDesc, Handle settings);
static short SetPref(AEKeyword keyword, const AEDesc *prefsDesc, Handle settings);
static short GetFactory(Handle settings);
static short UpdatePref(Handle settings);
static Boolean ComparePrefs(Handle prefsHand1, Handle prefsHand2);
static Boolean ComparePrefs(XPIDLSettings& prefs1, XPIDLSettings& prefs2);
static void OutlineRect(const Rect* focusRect, Boolean outlineOn);
static OSErr DragEnter(PanelParameterBlock *pb);
static void DragWithin(PanelParameterBlock *pb);
static void DragExit(PanelParameterBlock *pb);
static void DragDrop(PanelParameterBlock *pb);
extern "C" {
pascal short xpidl_panel(PanelParameterBlock *pb);
}
/*
* main - entry-point for Drop-In Preferences Panel
*
*/
pascal short xpidl_panel(PanelParameterBlock *pb)
{
short result;
result = noErr;
switch (pb->request)
{
case reqInitPanel:
/* panel has just been loaded into memory */
break;
case reqTermPanel:
/* panel is about to be unloaded from memory */
break;
case reqFirstLoad:
/* first time panel was loaded. */
break;
case reqInitDialog:
/* hook our dialog item list into the preferences dialog */
result = InitDialog(pb);
break;
case reqTermDialog:
/* unhook our dialog item list from the preferences dialog */
TermDialog(pb);
break;
case reqPutData:
/* put the data in the given handle into our dialog items */
PutData(pb, pb->currentPrefs);
break;
case reqGetData:
/* fill in the given handle with our dialog items */
result = GetData(pb, pb->currentPrefs, true);
break;
case reqByteSwapData:
/* byte swap the data in the handle */
ByteSwapData((XPIDLSettingsHandle)pb->currentPrefs);
break;
case reqFilter:
/* filter an event in the dialog */
result = Filter(pb, pb->event, &pb->itemHit);
break;
case reqItemHit:
/* handle a hit on one of our dialog items */
ItemHit(pb);
break;
case reqDrawCustomItem:
/* handle a request to draw one of our user items (CW/8 and later) */
break;
case reqActivateItem:
break;
case reqDeactivateItem:
break;
case reqHandleKey:
break;
case reqHandleClick:
break;
case reqFindStatus:
break;
case reqObeyCommand:
break;
case reqAEGetPref:
/* return one item in the given handle as an Apple Event descriptor */
result = GetPref(pb->prefsKeyword, &pb->prefsDesc, pb->currentPrefs);
break;
case reqAESetPref:
/* change one item in the given handle according to the given Apple Event descriptor */
result = SetPref(pb->prefsKeyword, &pb->prefsDesc, pb->currentPrefs);
break;
case reqValidate:
/* determine if we need to reset paths, recompile, or relink */
Validate(pb->originalPrefs, pb->currentPrefs, &pb->recompile, &pb->relink, &pb->reset);
break;
case reqGetFactory:
/* return our factory settings */
result = GetFactory(pb->factoryPrefs);
break;
case reqUpdatePref:
/* update the given handle to use the current format for our prefs data */
result = UpdatePref(pb->currentPrefs);
break;
case reqDragEnter:
/* determine if we can accept the drag and, if so, start tracking */
result = DragEnter(pb);
break;
case reqDragWithin:
/* continue tracking */
DragWithin(pb);
break;
case reqDragExit:
/* stop tracking */
DragExit(pb);
break;
case reqDragDrop:
/* the user has dropped in our panel */
DragDrop(pb);
break;
default:
result = paramErr;
break;
}
return (result);
}
/*
* InitDialog - initialize Dialog Box items for this panel
*
*/
static short InitDialog(PanelParameterBlock *pb)
{
OSErr err;
// The library function will call the IDE to append the dialog items
// if possible; else it will call AppendDITL itself. This way, you
// don't have to worry about it.
err = CWPanlAppendItems(pb, kCW8ItemListID);
if (err != noErr)
return (err);
sDragRgn = NewRgn();
return (err);
}
/*
* TermDialog - destroy Dialog Box items for this panel
*
*/
static void TermDialog(PanelParameterBlock *pb)
{
DisposeRgn(sDragRgn);
}
inline Boolean hasLinkerOutput(short mode)
{
return (mode == kXPIDLModeHeader || mode == kXPIDLModeTypelib);
}
/*
* PutData - copy the options data from the handle to the screen
*
*/
static void PutData(PanelParameterBlock *pb, Handle options)
{
// make sure the options are the right size.
UpdatePref(options);
XPIDLSettings prefsData = **(XPIDLSettingsHandle) options;
CWPanlSetItemValue(pb, kXPIDLModeItem, prefsData.mode);
CWPanlSetItemValue(pb, kXPIDLWarningsItem, prefsData.warnings);
CWPanlSetItemValue(pb, kXPIDLVerboseItem, prefsData.verbose);
CWPanlEnableItem(pb, kXPTLinkerOutputItem, hasLinkerOutput(prefsData.mode));
CWPanlSetItemText(pb, kXPTLinkerOutputItem, prefsData.output);
}
/*
* GetData - copy the options data from screen to the handle
*
*/
static short GetData(PanelParameterBlock *pb, Handle options, Boolean noisy)
{
XPIDLSettings prefsData = **(XPIDLSettingsHandle) options;
long mode, warnings, verbose;
CWPanlGetItemValue(pb, kXPIDLModeItem, &mode);
CWPanlGetItemValue(pb, kXPIDLWarningsItem, &warnings);
CWPanlGetItemValue(pb, kXPIDLVerboseItem, &verbose);
prefsData.mode = (short) mode;
prefsData.warnings = (Boolean) warnings;
prefsData.verbose = (Boolean) verbose;
CWPanlGetItemText(pb, kXPTLinkerOutputItem, prefsData.output, sizeof(Str32));
** (XPIDLSettingsHandle) options = prefsData;
return (noErr);
}
static void ByteSwapShort(short* x)
{
union {
short s;
char c[2];
} from,to;
from.s=*x;
to.c[0]=from.c[1];
to.c[1]=from.c[0];
*x = to.s;
}
/*
* ByteSwapData - byte-swap the options data
*
*/
static void ByteSwapData(XPIDLSettingsHandle options)
{
ByteSwapShort(&(**options).version);
ByteSwapShort(&(**options).mode);
}
/*
* Filter - filter an event for the Preferences panel
*
*/
static short Filter(PanelParameterBlock *pb, EventRecord *event, short *itemHit)
{
#pragma unused(pb, event, itemHit)
return (noErr);
}
/*
* ItemHit - handle an itemHit in a Preferences panel
*
*/
static void ItemHit(PanelParameterBlock *pb)
{
short theItem = pb->itemHit - pb->baseItems;
long oldValue;
switch (theItem) {
case kXPIDLModeItem:
CWPanlGetItemValue(pb, theItem, &oldValue);
CWPanlEnableItem(pb, kXPTLinkerOutputItem, hasLinkerOutput(oldValue));
break;
case kXPIDLWarningsItem:
case kXPIDLVerboseItem:
CWPanlGetItemValue(pb, theItem, &oldValue);
break;
}
GetData(pb, pb->currentPrefs, false);
pb->canRevert = !ComparePrefs(pb->originalPrefs, pb->currentPrefs);
pb->canFactory = !ComparePrefs(pb->factoryPrefs, pb->currentPrefs);
}
/*
* Validate - check if panel's changes require a recompile or relink
*
*/
static void Validate(Handle original, Handle current, Boolean *recompile, Boolean *relink, Boolean *reset)
{
#pragma unused(original, current)
XPIDLSettings& origSettings = **(XPIDLSettingsHandle) original;
XPIDLSettings& currentSettings = **(XPIDLSettingsHandle) current;
*recompile = currentSettings.mode != origSettings.mode;
*relink = *recompile && hasLinkerOutput(currentSettings.mode);
*reset = false;
}
/*
* GetPref - get a specified Preference setting for an AppleEvent request
*
*/
static short GetPref(AEKeyword keyword, AEDesc *prefsDesc, Handle settings)
{
#if 0
XPIDLSettings prefsData = ** (XPIDLSettingsHandle) settings;
DescType anEnum;
OSErr err;
switch (keyword) {
case prefsLN_GenerateSymFile:
err = AECreateDesc(typeBoolean, &prefsData.linksym, sizeof(Boolean), prefsDesc);
break;
case prefsPR_ProjectType:
switch (prefsData.projtype)
{
case kProjTypeApplication: anEnum = enum_Project_Application; break;
case kProjTypeLibrary: anEnum = enum_Project_Library; break;
case kProjTypeSharedLib: anEnum = enum_Project_SharedLibrary; break;
case kProjTypeCodeResource: anEnum = enum_Project_CodeResource; break;
case kProjTypeMPWTool: anEnum = enum_Project_MPWTool; break;
default: return (paramErr);
}
err = AECreateDesc(typeEnumeration, &anEnum, sizeof(anEnum), prefsDesc);
break;
case prefsPR_FileName:
err = AECreateDesc(typeChar, prefsData.outfile+1, StrLength(prefsData.outfile), prefsDesc);
break;
default:
err = errAECantHandleClass;
break;
}
return (err);
#else
return (errAECantHandleClass);
#endif
}
/*
* SetPref - set a specified Preference setting from an AppleEvent request
*
*/
static short SetPref(AEKeyword keyword, const AEDesc *prefsDesc, Handle settings)
{
#if 0
XPIDLSettings prefsData = ** (XPIDLSettingsHandle) settings;
AEDesc toDesc = { typeNull, NULL };
OSErr err = noErr;
Handle dataHand;
Size textLength;
DescType anEnum;
switch (keyword)
{
case prefsLN_GenerateSymFile:
if (prefsDesc->descriptorType == typeBoolean)
{
dataHand = prefsDesc->dataHandle;
}
else
{
err = AECoerceDesc(prefsDesc, typeBoolean, &toDesc);
if (err == noErr)
dataHand = toDesc.dataHandle;
}
if (err == noErr)
{
prefsData.linksym = ** (Boolean **) dataHand;
}
break;
case prefsPR_ProjectType:
if (prefsDesc->descriptorType != typeEnumeration)
{
err = errAETypeError;
break;
}
anEnum = ** (DescType **) prefsDesc->dataHandle;
switch (anEnum)
{
case enum_Project_Application: prefsData.projtype = kProjTypeApplication; break;
case enum_Project_Library: prefsData.projtype = kProjTypeLibrary; break;
case enum_Project_SharedLibrary: prefsData.projtype = kProjTypeSharedLib; break;
case enum_Project_CodeResource: prefsData.projtype = kProjTypeCodeResource; break;
case enum_Project_MPWTool: prefsData.projtype = kProjTypeMPWTool; break;
default: return (errAECoercionFail);
}
break;
case prefsPR_FileName:
if (prefsDesc->descriptorType == typeChar)
{
dataHand = prefsDesc->dataHandle;
}
else
{
err = AECoerceDesc(prefsDesc, typeChar, &toDesc);
if (err == noErr)
dataHand = toDesc.dataHandle;
}
if (err == noErr)
{
textLength = GetHandleSize(dataHand);
if (textLength > sizeof(prefsData.outfile) - 1)
textLength = sizeof(prefsData.outfile) - 1;
BlockMoveData(*dataHand, prefsData.outfile+1, textLength);
prefsData.outfile[0] = textLength;
}
break;
default:
err = errAECantHandleClass;
break;
}
if (err == noErr)
{
** (XPIDLSettingsHandle) settings = prefsData;
}
AEDisposeDesc(&toDesc);
return (err);
#else
return (errAECantHandleClass);
#endif
}
/*
* GetFactory - retrieve factory settings
*
*/
static short GetFactory(Handle settings)
{
Handle factory;
Size size;
OSErr err;
factory = Get1Resource('pref', kFactoryPrefsID);
if (factory == NULL) {
err = ResError();
if (err == noErr)
err = resNotFound;
return (err);
}
size = GetHandleSize(factory);
SetHandleSize(settings, size);
err = MemError();
if (err == noErr) {
BlockMoveData(*factory, *settings, size);
}
return (err);
}
/*
* UpdatePref - "upgrade" a pref to the current version
*/
static short UpdatePref(Handle settings)
{
if (GetHandleSize(settings) != sizeof(XPIDLSettings))
GetFactory(settings);
return (noErr);
}
/*
* ComparePrefs
*
*/
static Boolean ComparePrefs(Handle prefsHand1, Handle prefsHand2)
{
XPIDLSettings& prefs1 = **(XPIDLSettingsHandle) prefsHand1;
XPIDLSettings& prefs2 = **(XPIDLSettingsHandle) prefsHand2;
return ((prefs1.mode == prefs2.mode) &&
(prefs1.warnings == prefs2.warnings) &&
(prefs1.verbose == prefs2.verbose) &&
(EqualString(prefs1.output, prefs2.output, true, true)));
}
static Boolean ComparePrefs(XPIDLSettings& prefs1, XPIDLSettings& prefs2)
{
return ((prefs1.mode == prefs2.mode) &&
(prefs1.warnings == prefs2.warnings) &&
(prefs1.verbose == prefs2.verbose) &&
(EqualString(prefs1.output, prefs2.output, true, true)));
}
/*
* OutlineRect
*
*/
static void OutlineRect(const Rect* focusRect, Boolean outlineOn)
{
ColorSpec savedForeColor, backColor;
PenState savedPen;
GetPenState(&savedPen);
PenNormal();
if (!outlineOn)
{
SaveFore(&savedForeColor);
SaveBack(&backColor);
RestoreFore(&backColor);
}
PenSize(2, 2);
FrameRect(focusRect);
SetPenState(&savedPen);
if (!outlineOn)
{
RestoreFore(&savedForeColor);
}
}
/*
* DragEnter
*
*/
static OSErr DragEnter(PanelParameterBlock *pb)
{
#if 0
short theItem = pb->itemHit - pb->baseItems;
unsigned short itemCount;
Rect itemRect;
OSErr err;
#endif
/* Return paramErr if the user is on a item that can't be dropped on */
return (paramErr);
}
/*
* DragWithin
*
*/
static void DragWithin(PanelParameterBlock *pb)
{
#pragma unused(pb)
/* there's nothing to do */
/// SysBreakStr("\preqDragWithin");
}
/*
* DragExit
*
*/
static void DragExit(PanelParameterBlock *pb)
{
OSErr err;
/// SysBreakStr("\preqDragExit");
if (sHighlightOn) {
err = HideDragHilite(pb->dragref);
if (err == noErr)
sHighlightOn = false;
}
}
/*
* DragDrop
*
*/
static void DragDrop(PanelParameterBlock *pb)
{
#if 0
Rect itemRect;
#endif
/// SysBreakStr("\preqDragDrop");
DragExit(pb);
}

View File

@ -1,106 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_xpidl_panel.h
*/
#pragma once
#ifndef __MAC_XPIDL_PANEL__
#define __MAC_XPIDL_PANEL__
#ifndef __TYPES__
#include <Types.h>
#endif
#pragma options align=mac68k
/* this is the name of the panel, as shown in the Finder */
#define kXPIDLPanelName "xpidl Settings"
/*
* AppleScript dictionary info. As a rule of thumb, dropin panels should use the
* same terminology and numeric code in their 'aete' that the IDE uses if there
* is already a similar item in the IDE's 'aete'. That is the case here, so we
* merely duplicate applicable 68K Project and 68K Linker user terms below.
*/
enum {
/* Symbolic Name Code AETE Terminology */
class_XPIDL = 'XIDL',
prefsPR_ProjectType = 'PR01', /* Project Type */
prefsPR_FileName = 'PR02', /* File Name */
prefsLN_GenerateSymFile = 'LN02', /* Generate SYM File */
/* enumeration for project type */
enumeration_ProjectType = 'PRPT',
enum_Project_Application = 'PRPA', /* application */
enum_Project_Library = 'PRPL', /* library */
enum_Project_SharedLibrary = 'PRPS', /* shared library */
enum_Project_CodeResource = 'PRPC', /* code resource */
enum_Project_MPWTool = 'PRPM' /* MPW tool */
};
enum {
kXPIDLModeHeader = 1,
kXPIDLModeJava,
kXPIDLModeTypelib,
kXPIDLModeDoc
};
/* This is the structure that is manipulated by the panel. The sample
* compiler & linker both "know" about this structure.
*/
enum {
kXPIDLSettingsVersion = 0x0100
};
struct XPIDLSettings {
short version; /* version # of settings data */
short mode; /* one of kXPIDLModeHeader, ... */
Boolean warnings; /* generate warnings. */
Boolean verbose; /* verbose mode */
Str32Field output; /* name of the output file */
};
typedef struct XPIDLSettings XPIDLSettings, **XPIDLSettingsHandle;
#pragma options align=reset
#endif /* __MAC_XPIDL_PANEL__ */

View File

@ -1,546 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
mac_xpt_linker.cpp
CodeWarrior plugin linker, links together multiple .xpt files.
by Patrick C. Beard.
*/
/* standard headers */
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
/* system headers */
#include <Files.h>
#include <Strings.h>
#include <Aliases.h>
#include <Resources.h>
/* compiler headers */
#include "DropInCompilerLinker.h"
#include "CompilerMapping.h"
#include "CWPluginErrors.h"
/* project headers */
#include "mac_xpidl_panel.h"
#include "mac_console.h"
#include "mac_strings.h"
#include "FullPath.h"
#include "MoreFilesExtras.h"
/* use standard CodeWarrior debugger */
#define kDebuggerCreator 'MWDB'
/* prototypes of local functions */
static CWResult Link(CWPluginContext context);
static CWResult Disassemble(CWPluginContext context);
static CWResult GetTargetInfo(CWPluginContext context);
extern "C" {
pascal short xpt_linker(CWPluginContext context);
int xptlink_main(int argc, char* argv[]);
int xptdump_main(int argc, char* argv[]);
FILE * FSp_fopen(ConstFSSpecPtr spec, const char * open_mode);
size_t mac_get_file_length(const char* filename);
}
/* external variables */
extern jmp_buf exit_jump;
extern int exit_status;
/* global variables */
CWPluginContext gPluginContext;
/* local variables */
static CWFileSpec gOutputDirectory;
static CWFileSpec gObjectCodeDirectory;
/*
* xpt_linker - main entry-point for linker plugin
*
*/
pascal short xpt_linker(CWPluginContext context)
{
long request;
if (CWGetPluginRequest(context, &request) != cwNoErr)
return cwErrRequestFailed;
gPluginContext = context;
short result = cwNoErr;
/* dispatch on linker request */
switch (request) {
case reqInitLinker:
/* linker has just been loaded into memory */
break;
case reqTermLinker:
/* linker is about to be unloaded from memory */
break;
case reqLink:
/* build the final executable */
result = Link(context);
break;
case reqDisassemble:
/* disassemble object code for a given project file */
result = Disassemble(context);
break;
case reqTargetInfo:
/* return info describing target characteristics */
result = GetTargetInfo(context);
break;
default:
result = cwErrRequestFailed;
break;
}
result = CWDonePluginRequest(context, result);
/* return result code */
return result;
}
static char* full_path_to(const FSSpec& file)
{
short len = 0;
Handle fullPath = NULL;
if (FSpGetFullPath(&file, &len, &fullPath) == noErr && fullPath != NULL) {
char* path = new char[1 + len];
if (path != NULL) {
BlockMoveData(*fullPath, path, len);
path[len] = '\0';
}
DisposeHandle(fullPath);
return path;
}
return NULL;
}
/**
* Provides the full path name to a given directory.
*/
static char* full_path_to(short vRefNum, long dirID)
{
long parID;
if (GetParentID(vRefNum, dirID, NULL, &parID) == noErr) {
FSSpec dirSpec = { vRefNum, parID };
if (GetDirName(vRefNum, dirID, dirSpec.name) == noErr) {
return full_path_to(dirSpec);
}
}
return NULL;
}
/**
* Returns the length of a file, assuming it is always located in the
* project's object code directory.
*/
size_t mac_get_file_length(const char* filename)
{
FSSpec fileSpec = { gObjectCodeDirectory.vRefNum, gObjectCodeDirectory.parID };
c2p_strcpy(fileSpec.name, filename);
long dataSize, rsrcSize;
if (FSpGetFileSize(&fileSpec, &dataSize, &rsrcSize) != noErr)
dataSize = 0;
return dataSize;
}
/**
* replaces standard fopen -- opens files for writing in the project's output directory,
* and files for reading in the object code directory.
*/
FILE* std::fopen(const char* filename, const char *mode)
{
CWFileSpec& fileDir = (mode[0] == 'r' ? gObjectCodeDirectory : gOutputDirectory);
FSSpec fileSpec = { fileDir.vRefNum, fileDir.parID };
c2p_strcpy(fileSpec.name, filename);
return FSp_fopen(&fileSpec, mode);
}
static CWResult GetSettings(CWPluginContext context, XPIDLSettings& settings)
{
CWMemHandle settingsHand;
CWResult err = CWGetNamedPreferences(context, kXPIDLPanelName, &settingsHand);
if (!CWSUCCESS(err))
return err;
XPIDLSettings* settingsPtr = NULL;
err = CWLockMemHandle(context, settingsHand, false, (void**)&settingsPtr);
if (!CWSUCCESS(err))
return err;
settings = *settingsPtr;
err = CWUnlockMemHandle(context, settingsHand);
if (!CWSUCCESS(err))
return err;
return cwNoErr;
}
static CWResult LinkHeaders(CWPluginContext context, XPIDLSettings& settings)
{
// find out how many files there are to link.
long fileCount = 0;
CWResult err = CWGetProjectFileCount(context, &fileCount);
if (err != cwNoErr || fileCount == 0)
return err;
// get the output directory.
FSSpec outputDir;
err = CWGetOutputFileDirectory(context, &outputDir);
if (!CWSUCCESS(err))
return err;
// enumerate all of the output header files, and make aliases to them in
// the output directory.
for (long index = 0; (err == cwNoErr) && (index < fileCount); index++) {
// get the name of each output file.
CWFileSpec outputFile;
err = CWGetStoredObjectFileSpec(context, index, &outputFile);
if (err == cwNoErr) {
FInfo info;
err = FSpGetFInfo(&outputFile, &info);
FSSpec aliasFile = { outputDir.vRefNum, outputDir.parID };
BlockMoveData(outputFile.name, aliasFile.name, 1 + outputFile.name[0]);
AliasHandle alias = NULL;
if (NewAliasMinimal(&outputFile, &alias) == noErr) {
// recreate the alias file from scratch.
FSpDelete(&aliasFile);
FSpCreateResFile(&aliasFile, info.fdCreator, info.fdType, smRoman);
short refNum = FSpOpenResFile(&aliasFile, fsRdWrPerm);
if (refNum != -1) {
UseResFile(refNum);
AddResource(Handle(alias), rAliasType, 0, aliasFile.name);
ReleaseResource(Handle(alias));
UpdateResFile(refNum);
CloseResFile(refNum);
}
// finally, mark the newly created file as an alias file.
FSpGetFInfo(&aliasFile, &info);
info.fdFlags |= kIsAlias;
FSpSetFInfo(&aliasFile, &info);
}
}
}
// create the target file in the output directory.
BlockMoveData(settings.output, outputDir.name, 1 + settings.output[0]);
FILE* outputFile = FSp_fopen(&outputDir, "w");
if (outputFile != NULL) fclose(outputFile);
return err;
}
static CWResult LinkTypeLib(CWPluginContext context, XPIDLSettings& settings)
{
// find out how many files there are to link.
long fileCount = 0;
CWResult err = CWGetProjectFileCount(context, &fileCount);
if (err != cwNoErr || fileCount == 0)
return err;
// assemble the argument list.
// { "xpt_link", outputFile, inputFile1, ..., inputFileN, NULL }
char** argv = new char*[2 + fileCount + 1];
int argc = 0;
argv[argc++] = "xpt_link";
// get the output directory.
err = CWGetOutputFileDirectory(context, &gOutputDirectory);
if (!CWSUCCESS(err))
return err;
// get the object code directory.
err = CWGetStoredObjectFileSpec(context, 0, &gObjectCodeDirectory);
if (!CWSUCCESS(err))
return err;
// push the output file name.
if ((argv[argc++] = p2c_strdup(settings.output)) == NULL)
return cwErrOutOfMemory;
for (long index = 0; (err == cwNoErr) && (index < fileCount); index++) {
// get the name of each output file.
CWFileSpec outputFile;
err = CWGetStoredObjectFileSpec(context, index, &outputFile);
if (err == cwNoErr) {
if ((argv[argc++] = p2c_strdup(outputFile.name)) == NULL) {
err = cwErrOutOfMemory;
break;
}
}
}
if (err != cwNoErr)
return err;
// trap calls to exit, which longjmp back to here.
if (setjmp(exit_jump) == 0) {
if (xptlink_main(argc, argv) != 0)
err = cwErrRequestFailed;
} else {
// evidently the good old exit function got called.
if (exit_status != 0)
err = cwErrRequestFailed;
}
return err;
}
static CWResult Link(CWPluginContext context)
{
// load the relevant prefs.
XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeTypelib, false, false };
CWResult err = GetSettings(context, settings);
if (err != cwNoErr)
return err;
switch (settings.mode) {
case kXPIDLModeHeader:
return LinkHeaders(context, settings);
case kXPIDLModeTypelib:
return LinkTypeLib(context, settings);
default:
return cwNoErr;
}
}
static CWResult Disassemble(CWPluginContext context)
{
CWResult err = noErr;
// cache the project's output directory.
err = CWGetOutputFileDirectory(gPluginContext, &gOutputDirectory);
if (!CWSUCCESS(err))
return err;
long fileNum;
err = CWGetMainFileNumber(context, &fileNum);
if (!CWSUCCESS(err))
return err;
// get the output file's location from the stored object data.
err = CWGetStoredObjectFileSpec(context, fileNum, &gObjectCodeDirectory);
if (!CWSUCCESS(err))
return err;
char* outputName = p2c_strdup(gObjectCodeDirectory.name);
if (outputName == NULL)
return cwErrOutOfMemory;
XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeTypelib, false, false };
GetSettings(context, settings);
// build an argument list and call xpt_dump.
int argc = 1;
char* argv[] = { "xpt_dump", NULL, NULL, NULL };
if (settings.verbose) argv[argc++] = "-v";
argv[argc++] = outputName;
// trap calls to exit, which longjmp back to here.
if (setjmp(exit_jump) == 0) {
if (xptdump_main(argc, argv) != 0)
err = cwErrRequestFailed;
} else {
// evidently the good old exit function got called.
if (exit_status != 0)
err = cwErrRequestFailed;
}
delete[] outputName;
if (err == noErr) {
// display the disassembly in its own fresh text window.
CWNewTextDocumentInfo info = {
NULL,
mac_console_handle,
false
};
CWResizeMemHandle(context, mac_console_handle, mac_console_count);
err = CWCreateNewTextDocument(context, &info);
}
return err;
}
static CWResult GetTargetInfo(CWPluginContext context)
{
CWTargetInfo targ;
memset(&targ, 0, sizeof(targ));
CWResult err = CWGetOutputFileDirectory(context, &targ.outfile);
targ.outputType = linkOutputFile;
targ.symfile = targ.outfile; /* location of SYM file */
targ.linkType = exelinkageFlat;
targ.targetCPU = '****';
targ.targetOS = '****';
// load the relevant settings.
XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeTypelib, false, false };
err = GetSettings(context, settings);
if (err != cwNoErr)
return err;
#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS
// tell the IDE about the output file.
targ.outfileCreator = 'MMCH';
targ.outfileType = 'CWIE';
targ.debuggerCreator = kDebuggerCreator; /* so IDE can locate our debugger */
BlockMoveData(settings.output, targ.outfile.name, 1 + settings.output[0]);
targ.symfile.name[0] = 0;
#endif
#if CWPLUGIN_HOST == CWPLUGIN_HOST_WIN32
targ.debugHelperIsRegKey = true;
*(long*)targ.debugHelperName = kDebuggerCreator;
targ.debugHelperName[4] = 0;
strcat(targ.outfile.path, "\\");
strcat(targ.outfile.path, prefsData.outfile);
strcpy(targ.symfile.path, targ.outfile.path);
strcat(targ.symfile.path, ".SYM");
#endif
targ.runfile = targ.outfile;
targ.linkAgainstFile = targ.outfile;
/* we can only run applications */
// targ.canRun = (prefsData.projtype == kProjTypeApplication);
/* we can only debug if we have a SYM file */
// targ.canDebug = prefsData.linksym;
err = CWSetTargetInfo(context, &targ);
return err;
}
#if 0
#if CW_USE_PRAGMA_EXPORT
#pragma export on
#endif
CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
{
static const DropInFlags sFlags = {
kCurrentDropInFlagsVersion,
CWDROPINLINKERTYPE,
DROPINCOMPILERLINKERAPIVERSION_7,
(linkMultiTargAware | linkAlwaysReload),
0,
DROPINCOMPILERLINKERAPIVERSION
};
*flags = &sFlags;
*flagsSize = sizeof(sFlags);
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
{
static const char* sDropInName = "xpt Linker";
*dropinName = sDropInName;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
{
static const char* sDisplayName = "xpt Linker";
*displayName = sDisplayName;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetPanelList)(const CWPanelList** panelList)
{
// +++Turn this on when the sample panel has been converted!
static const char* sPanelName = kXPIDLPanelName;
static CWPanelList sPanelList = { kCurrentCWPanelListVersion, 1, &sPanelName };
*panelList = &sPanelList;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
{
static CWDataType sCPU = '****';
static CWDataType sOS = '****';
static CWTargetList sTargetList = { kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS };
*targetList = &sTargetList;
return cwNoErr;
}
CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
{
static CWExtensionMapping sExtension = { 'MMCH', ".xpt", 0 };
static CWExtMapList sExtensionMapList = { kCurrentCWExtMapListVersion, 1, &sExtension };
*defaultMappingList = &sExtensionMapList;
return cwNoErr;
}
CWPLUGIN_ENTRY (CWPlugin_GetFamilyList)(const CWFamilyList** familyList)
{
static CWFamily sFamily = { 'XIDL', "xpidl Settings" };
static CWFamilyList sFamilyList = { kCurrentCWFamilyListVersion, 0, &sFamily };
*familyList = &sFamilyList;
return cwNoErr;
}
#if CW_USE_PRAGMA_EXPORT
#pragma export off
#endif
#endif