⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 macstuff.h

📁 给出了 zip 压缩算法的完整实现过程。
💻 H
📖 第 1 页 / 共 4 页
字号:
#ifndef _MACSTUFF_H#define _MACSTUFF_H       1/*These Functions were originally part of More Files version 1.4.8More Files fixes many of the broken or underfunctionalparts of the file system.More FilesA collection of File Manager and related routinesby Jim Luther (Apple Macintosh Developer Technical Support Emeritus)with significant code contributions by Nitin Ganatra(Apple Macintosh Developer Technical Support Emeritus)Copyright  1992-1998 Apple Computer, Inc.Portions copyright  1995 Jim LutherAll rights reserved.The Package "More Files" is distributed under the followinglicense terms:         "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          redistribute 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."The following changes are made by Info-ZIP:- The only changes are made by pasting the functions  (mostly found in MoreFilesExtras.c / MoreFiles.c)  directly into macstuff.c / macstuff.h and slightly  reformatting the text (replacement of TABs by spaces,  removal/replacement of non-ASCII characters).  The code itself is NOT changed.This file has been modified by Info-ZIP for use in MacZip.This file is NOT part of the original package More Files.More Files can be found on the MetroWerks CD and Developer CD fromApple. You can also download the latest version from:    http://members.aol.com/JumpLong/#MoreFilesJim Luther's Home-page:    http://members.aol.com/JumpLong/*/#define __MACOSSEVENFIVEONEORLATER 1#define __MACOSSEVENFIVEORLATER    1#define __MACOSSEVENORLATER        1#include <Errors.h>#include <Files.h>/* * Like the MoreFiles routines these fix problems in the standard * Mac calls. */int     FSpLocationFromPath (int length,const char *path, FSSpecPtr theSpec);OSErr   FSpPathFromLocation (FSSpecPtr theSpec,int *length, Handle *fullPath);#define hasDesktopMgr(volParms) (((volParms).vMAttrib & (1L << bHasDesktopMgr)) != 0)/* * The following routines are utility functions.  They are exported * here because they are needed and they are not officially supported, * however.  The first set are from the MoreFiles package. */int             FSpGetDefaultDir (FSSpecPtr theSpec);int             FSpSetDefaultDir (FSSpecPtr dirSpec);pascal  OSErr   FSpGetDirectoryID(const FSSpec *spec,long *theDirID,                                  Boolean *isDirectory);pascal  short   FSpOpenResFileCompat(const FSSpec *spec, SignedByte permission);pascal  void    FSpCreateResFileCompat(const FSSpec *spec,OSType creator,                                       OSType fileType,                                       ScriptCode scriptTag);OSErr           FSpFindFolder (short vRefNum, OSType folderType,                               Boolean createFolder,                               FSSpec *spec);/*****************************************************************************/pascal  OSErr   GetVolumeInfoNoName(ConstStr255Param pathname,                                    short vRefNum,                                    HParmBlkPtr pb);/*   Call PBHGetVInfoSync ignoring returned name.    GetVolumeInfoNoName uses pathname and vRefNum to call PBHGetVInfoSync    in cases where the returned volume name is not needed by the caller.    The pathname and vRefNum parameters are not touched, and the pb    parameter is initialized by PBHGetVInfoSync except that ioNamePtr in    the parameter block is always returned as NULL (since it might point    to GetVolumeInfoNoName's local variable tempPathname).    I noticed using this code in several places, so here it is once.    This reduces the code size of MoreFiles.    pathName    input:  Pointer to a full pathname or nil.  If you pass in a                        partial pathname, it is ignored. A full pathname to a                        volume must end with a colon character (:).    vRefNum     input:  Volume specification (volume reference number, working                        directory number, drive number, or 0).    pb          input:  A pointer to HParamBlockRec.                output: The parameter block as filled in by PBHGetVInfoSync                        except that ioNamePtr will always be NULL.    Result Codes        noErr               0       No error        nsvErr              -35     No such volume        paramErr            -50     No default volume, or pb was NULL*//*****************************************************************************/pascal  OSErr   GetFilenameFromPathname(ConstStr255Param pathname,                                        Str255 filename);/*   Get the object name from the end of a full or partial pathname.    The GetFilenameFromPathname function gets the file (or directory) name    from the end of a full or partial pathname. Returns notAFileErr if the    pathname is nil, the pathname is empty, or the pathname cannot refer to    a filename (with a noErr result, the pathname could still refer to a    directory).    pathname    input:  A full or partial pathname.    filename    output: The file (or directory) name.    Result Codes        noErr               0       No error        notAFileErr         -1302   The pathname is nil, the pathname                                    is empty, or the pathname cannot refer                                    to a filename    __________    See also:   GetObjectLocation.*//*****************************************************************************/pascal  OSErr   FSMakeFSSpecCompat(short vRefNum, long dirID,                                   ConstStr255Param fileName,                                   FSSpec *spec);/*   Initialize a FSSpec record.    The FSMakeFSSpecCompat function fills in the fields of an FSSpec record.    If the file system can't create the FSSpec, then the compatibility code    creates a FSSpec that is exactly like an FSSpec except that spec.name    for a file may not have the same capitalization as the file's catalog    entry on the disk volume. That is because fileName is parsed to get the    name instead of getting the name back from the file system. This works    fine with System 6 where FSMakeSpec isn't available.    vRefNum     input:  Volume specification.    dirID       input:  Directory ID.    fileName    input:  Pointer to object name, or nil when dirID specifies                        a directory that's the object.    spec        output: A file system specification to be filled in by                        FSMakeFSSpecCompat.    Result Codes        noErr               0       No error        nsvErr              -35     Volume doesnt exist        fnfErr              -43     File or directory does not exist                                    (FSSpec is still valid)*/#if !SystemSevenOrLaterstatic  Boolean FSHasFSSpecCalls(void);static  Boolean QTHasFSSpecCalls(void);#endif  /* !SystemSevenOrLater *//*****************************************************************************/pascal  OSErr   GetObjectLocation(short vRefNum,                                  long dirID,                                  ConstStr255Param pathname,                                  short *realVRefNum,                                  long *realParID,                                  Str255 realName,                                  Boolean *isDirectory);/*   Get a file system object's location.    The GetObjectLocation function gets a file system object's location -    that is, its real volume reference number, real parent directory ID,    and name. While we're at it, determine if the object is a file or directory.    If GetObjectLocation returns fnfErr, then the location information    returned is valid, but it describes an object that doesn't exist.    You can use the location information for another operation, such as    creating a file or directory.    vRefNum     input:  Volume specification.    dirID       input:  Directory ID.    pathname    input:  Pointer to object name, or nil when dirID specifies                        a directory that's the object.    realVRefNum output: The real volume reference number.    realParID   output: The parent directory ID of the specified object.    realName    output: The name of the specified object (the case of the                        object name may not be the same as the object's                        catalog entry on disk - since the Macintosh file                        system is not case sensitive, it shouldn't matter).    isDirectory output: True if object is a directory; false if object                        is a file.    Result Codes        noErr               0       No error        nsvErr              -35     No such volume        ioErr               -36     I/O error        bdNamErr            -37     Bad filename        fnfErr              -43     File not found        paramErr            -50     No default volume        dirNFErr            -120    Directory not found or incomplete pathname        notAFileErr         -1302   The pathname is nil, the pathname                                    is empty, or the pathname cannot refer                                    to a filename        afpAccessDenied     -5000   User does not have the correct access        afpObjectTypeErr    -5025   Directory not found or incomplete pathname    __________    See also:   FSMakeFSSpecCompat*/pascal  OSErr   FSpGetDirectoryID(const FSSpec *spec, long *theDirID,                                  Boolean *isDirectory);pascal  OSErr   GetDirectoryID(short vRefNum,long dirID,ConstStr255Param name,                               long *theDirID,Boolean *isDirectory);/*****************************************************************************/pascal  OSErr GetCatInfoNoName(short vRefNum,                               long dirID,                               ConstStr255Param name,                               CInfoPBPtr pb);/*   Call PBGetCatInfoSync ignoring returned name.    GetCatInfoNoName uses vRefNum, dirID and name to call PBGetCatInfoSync    in cases where the returned object is not needed by the caller.    The vRefNum, dirID and name parameters are not touched, and the pb    parameter is initialized by PBGetCatInfoSync except that ioNamePtr in    the parameter block is always returned as NULL (since it might point    to GetCatInfoNoName's local variable tempName).    I noticed using this code in several places, so here it is once.    This reduces the code size of MoreFiles.    vRefNum         input:  Volume specification.    dirID           input:  Directory ID.    name            input:  Pointer to object name, or nil when dirID                            specifies a directory that's the object.    pb              input:  A pointer to CInfoPBRec.                    output: The parameter block as filled in by                            PBGetCatInfoSync except that ioNamePtr will                            always be NULL.    Result Codes        noErr               0       No error        nsvErr              -35     No such volume

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -