home *** CD-ROM | disk | FTP | other *** search
- 18-Jun-88 14:30:31-MDT,27473;000000000000
- Return-Path: <u-lchoqu%sunset@cs.utah.edu>
- Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Sat, 18 Jun 88 14:29:55 MDT
- Received: by cs.utah.edu (5.54/utah-2.0-cs)
- id AA22231; Sat, 18 Jun 88 14:29:54 MDT
- Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
- id AA24610; Sat, 18 Jun 88 14:29:50 MDT
- Date: Sat, 18 Jun 88 14:29:50 MDT
- From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
- Message-Id: <8806182029.AA24610@sunset.utah.edu>
- To: rthum@simtel20.arpa
- Subject: HFS.c.shar
-
- #! /bin/sh
- #
- # This is a shell archive. Save this into a file, edit it
- # and delete all lines above this comment. Then give this
- # file to sh by executing the command "sh file". The files
- # will be extracted into the current directory owned by
- # you with default permissions.
- #
- # The files contained herein are:
- #
- # 2 HFS.docs
- # 5 hfs.c
- # 12 hfs.h
- # 2 mmstr.c
- # 0 pbcall.Voc
- # 3 pbcall.asm
- # 2 pbhdefs.h
- #
- echo 'Extracting HFS.docs'
- if test -f HFS.docs; then echo 'shar: will not overwrite HFS.docs'; else
- sed 's/^X//' << '________This_Is_The_END________' > HFS.docs
- X HFS EXAMPLE
- X Modified by John Pence, MacMan, Inc., Houston Texas.
- X from MacTutor, Jan,86 issue
- X "Programming for HFS" by Miki Schuster.
- X
- X A "must have" for the serious programmer
- X MACTUTOR(tm) P.O BOX 400
- X PLACENTIA, CA 92670
- X (714) 630-3730
- X
- X
- XTo compile and run the hfs example project from MacTutor
- Xyour project must contain the following:
- X
- X
- X
- Xhfs.c* ( modified for lightspeed already, otherwise same as
- X in article)
- XMacTraps (Lightspeed file)
- Xstdio (Lightspeed file)
- Xstrings (Lightspeed file)
- Xmmstr (contains strntac() and strtac(), include as is or build from
- X the file mmstr.c* as a project)
- Xpbcall.lib (build this from the pbcall.asm* file)
- X
- X
- X* included with this file in this shell archive.
- X
- XI had some problems with Lightspeeds relconv program.
- Xapparently it dislikes labels that contain digits, or at least that end
- Xwith digits. And don't forget the XDEFS for each function label in the
- X.asm file. MDS assember does not add case information to rel files.
- XTherefore, relconv looks in a file named the same as the file being
- Xconverted (only with a .voc extension) for labels that match the labels
- Xin the .rel file. If it finds a match, it uses the label (including its
- Xcase) instead of the matching label as found in the .rel file(lower case)
- XSo, thats why the file pbcall.voc is in this packit.
- X
- XEnjoy- John Pence- [MACMAN]
- ________This_Is_The_END________
- if test `wc -l < HFS.docs` -ne 39; then
- echo 'shar: HFS.docs was damaged during transit'
- echo ' (should have been 39 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting hfs.c'
- if test -f hfs.c; then echo 'shar: will not overwrite hfs.c'; else
- sed 's/^X//' << '________This_Is_The_END________' > hfs.c
- X/* HFS EXAMPLE
- X Modified by John Pence, MacMan, Inc., Houston Texas.
- X from MacTutor, Jan,86 issue
- X "Programming for HFS" by Miki Schuster.
- X
- X A "must have" for the serious programmer
- X MACTUTOR(tm) P.O BOX 400
- X PLACENTIA, CA 92670
- X (714) 630-3730
- X
- X*/
- X#include "stdio.h"
- X#include "hfs.h"
- X#include "pbhdefs.h"
- X
- X
- X
- X/*extern String ptocstr(); Consulair syntax */
- X
- Xextern char *PtoCstr(); /* Lightspeed syntax */
- Xextern int strlen();
- Xextern char *strncat();
- X
- Xextern char *strntac(); /* from the MMSTR project */
- Xextern char *strtac(); /* from the MMSTR project */
- X
- Xextern OSErr pbCall(); /* its in the pbcall.lib */
- X
- X/*
- X
- Xthese were in the article but removed since they're in pbhdefs.h
- X
- X#define PBCloseWD(pb, a) pbCall(pb, a, 0xA260, 2)
- X#define PBOpenWD(pb, a) pbCall(pb, a, 0xA260, 1)
- X#define PBGetWDInfo(pb, a) pbCall(pb, a, 0xA260, 7)
- X
- X#define PBHGetVInfo(pb, a) pbCall(pb, a, 0xA207 )
- X#define PBGetCatInfo(pb, a) pbCall(pb, a, 0xA260, 9)
- X#define PBGetFInfo(pb, a) pbCall(pb, a, 0xA00C )
- X*/
- X
- Xvoid fileproc();
- X
- Xmain()
- X{
- X enumerate(&fileproc);
- X}
- X
- Xenumerate(fileproc)
- X int (*fileproc)();
- X {
- X HVolumeParam vp;
- X DirInfoParam dp;
- X WDParam wp;
- X Str255 vname;
- X Str255 dname;
- X int32 **dirs;
- X int32 *dirp;
- X int32 dir;
- X int ok;
- X
- X /* initialize params */
- X vp.ioNamePtr = &vname;
- X dp.ioNamePtr = &dname;
- X wp.ioNamePtr = NULL;
- X wp.ioWDProcID = 'ENUM';
- X
- X /* enumerate each volume */
- X for (vp.ioVolIndex = 1; !PBHGetVInfo(&vp, 0); vp.ioVolIndex++)
- X {
- X dp.ioVRefNum = vp.ioVRefNum;
- X
- X /* if MFS volume, enumerate each file */
- X if (FCBLen == -1 || vp.ioVSigWord == mfsSigWord)
- X for (dp.ioFDirIndex = 1; !PBGetFInfo(&dp, 0); dp.ioFDirIndex++)
- X (*fileproc)(dp.ioVRefNum, &vp, &dp);
- X
- X /* if HFS volume, allocate space for directory queue */
- X else if (dirs = (int32 **) NewHandle(vp.ioVDirCnt * sizeof(int32)))
- X {
- X /* place root into directory queue */
- X HLock(dirs);
- X dirp = *dirs;
- X *dirp++ = rootDirID;
- X
- X /* enumerate directory queue */
- X while (dirp > *dirs)
- X {
- X dir = *--dirp;
- X wp.ioVRefNum = dp.ioVRefNum;
- X wp.ioWDDirID = dir;
- X
- X /* open working directory */
- X if (!PBOpenWD(&wp, 0))
- X {
- X /* enumerate files in directory */
- X for (dp.ioFDirIndex = 1, dp.ioDrDirID = dir; !PBGetCatInfo(&dp, 0); dp.ioFDirIndex++, dp.ioDrDirID = dir)
- X {
- X /* if offspring is a directory, place on queue */
- X if (dp.ioFlAttrib & ioDirFlg)
- X *dirp++ = dp.ioDrDirID;
- X
- X /* if offsprint is a file, call argument function */
- X else
- X (*fileproc)(wp.ioVRefNum, &vp, &dp);
- X }
- X
- X /* all done with working directory */
- X PBCloseWD(&wp, 0);
- X }
- X }
- X DisposHandle(dirs);
- X }
- X }
- X }
- X
- Xchar *pathname(pname, wdrefnum, n)
- X char *pname;
- X int16 wdrefnum;
- X int16 n;
- X {
- X HVolumeParam vp;
- X WDParam wp;
- X DirInfoParam dp;
- X Str255 dname;
- X
- X /* initialize params */
- X pname[0] = '\0';
- X n--;
- X vp.ioNamePtr = &dname;
- X vp.ioVRefNum = wdrefnum;
- X vp.ioVolIndex = 0;
- X wp.ioNamePtr = NULL;
- X wp.ioVRefNum = wdrefnum;
- X wp.ioWDIndex = 0;
- X wp.ioWDProcID = NULL;
- X dp.ioNamePtr = &dname;
- X dp.ioFDirIndex = -1;
- X
- X /* get volume information */
- X if (!PBHGetVInfo(&vp, 0))
- X /* if MFS or HFS root, return volume name */
- X if (FCBLen == -1 || vp.ioVSigWord == mfsSigWord || vp.ioVRefNum == wdrefnum)
- X strncat(pname, PtoCstr(vp.ioNamePtr), n - 1);
- X
- X /* get working directory information */
- X else if (!PBGetWDInfo(&wp, 0))
- X {
- X /* traverse path from working directory to root */
- X dp.ioVRefNum = wp.ioWDVRefNum;
- X dp.ioDrParID = wp.ioWDDirID;
- X do
- X {
- X /* get next node information */
- X dp.ioDrDirID = dp.ioDrParID;
- X if (PBGetCatInfo(&dp, 0))
- X break;
- X
- X /* concatenate node name to result */
- X strntac(strtac(pname, ":"), PtoCstr(dp.ioNamePtr), n - 1);
- X n -= strlen(dp.ioNamePtr) + 1;
- X }
- X while (dp.ioDrDirID != rootDirID);
- X
- X /* remove last colon */
- X pname[strlen(pname) - 1] = '\0';
- X }
- X return pname;
- X }
- X
- Xvoid fileproc(wdrefnum, vp, fp)
- X int16 wdrefnum;
- X HVolumeParam *vp;
- X DirInfoParam *fp;
- X {
- X char name[256];
- X
- X
- X pathname(name, wdrefnum, sizeof name);
- X PtoCstr(fp->ioNamePtr);
- X printf("%s:%s\n", name, fp->ioNamePtr);
- X CtoPstr(fp->ioNamePtr);
- X }
- X
- X
- ________This_Is_The_END________
- if test `wc -l < hfs.c` -ne 185; then
- echo 'shar: hfs.c was damaged during transit'
- echo ' (should have been 185 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting hfs.h'
- if test -f hfs.h; then echo 'shar: will not overwrite hfs.h'; else
- sed 's/^X//' << '________This_Is_The_END________' > hfs.h
- X#define int8 char /* 8-bit integer */
- X#define int16 short /* 16-bit integer */
- X#define int32 long /* 32-bit integer */
- X
- Xtypedef char *Ptr; /* pointer */
- Xtypedef Ptr *Handle; /* handle */
- Xtypedef int16 (*ProcPtr)(); /* pointer to procedure returning int16 */
- Xtypedef ProcPtr *ProcHandle; /* handle to procedure returning int16 */
- X
- X#define String(size) struct {unsigned char length; char text[size];}
- Xtypedef String(255) Str255; /* maximum length pascal string */
- Xtypedef Str255 *StringPtr; /* pointer to maximum length pascal string */
- Xtypedef StringPtr *StringHandle; /* handle to maximum length pascal string */
- X
- Xtypedef int16 OSErr; /* operating system error code */
- Xtypedef int32 OSType; /* operating system type code */
- Xtypedef Ptr QElemPtr; /* pointer to queue element */
- X
- X#define FCBLen *((int16 *) 0x3f6) /* MFS == -1, HFS == length of FCB */
- X#define mfsSigWord 0xd2d7 /* MFS volume signature */
- X#define hfsSigWord 0x4244 /* HFS volume signature */
- X#define rootDirID 2 /* HFS root volume directory id */
- X#define ioDirFlg 0x10 /* catalog node directory flag */
- X
- Xtypedef struct
- X {
- X OSType fdType; /* file's type */
- X OSType fdCreator; /* file's creator */
- X int16 fdFlags; /* flags */
- X int16 fdLocation[2]; /* file's location */
- X int16 fdFldr; /* file's window */
- X } FInfo, *FInfoPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioRefNum; /* path reference number */
- X int8 ioVersNum; /* version number */
- X int8 ioPermssn; /* read/write permission */
- X Ptr ioMisc; /* miscellaneous */
- X Ptr ioBuffer; /* data buffer */
- X int32 ioReqCount; /* requested number of bytes */
- X int32 ioActCount; /* actual number of bytes */
- X int16 ioPosMode; /* positioning mode and newline */
- X int32 ioPosOffset; /* positioning offset */
- X } IOParam, *IOParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioFRefNum; /* path reference number */
- X int8 ioFVersNum; /* version number */
- X int8 filler1; /* unused */
- X int16 ioFDirIndex; /* sequence number */
- X int8 ioFlAttrib; /* attributes */
- X int8 ioFlVersNum; /* version number */
- X FInfo ioFlFndrInfo; /* finder information */
- X int32 ioFlNum; /* file number */
- X int16 ioFlStBlk; /* first allocation block of data fork */
- X int32 ioFlLgLen; /* logical end-of-file of data fork */
- X int32 ioFlPyLen; /* physical end-of-file of data fork */
- X int16 ioFlRStBlk; /* first allocation block of resource fork */
- X int32 ioFlRLgLen; /* logical end-of-file of resource fork */
- X int32 ioFlRPyLen; /* physical end-of-file of resource fork */
- X int32 ioFlCrDat; /* creation date */
- X int32 ioFlMdDat; /* modification date */
- X } FileParam, *FileParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int32 filler2; /* unused */
- X int16 ioVolIndex; /* volume index */
- X int32 ioVCrDate; /* creation time and date */
- X int32 ioVLsBkUp; /* last backup time and date */
- X int16 ioVAtrb; /* attributes */
- X int16 ioVNmFls; /* number of files in directory */
- X int16 ioVDirSt; /* first block of directory */
- X int16 ioVBlLn; /* length of directory in blocks */
- X int16 ioVNmAlBlks; /* number of allocation blocks */
- X int32 ioVAlBlkSiz; /* size of allocation block */
- X int32 ioVClpSiz; /* number of bytes to allocate */
- X int16 ioAlBlSt; /* first allocation block in map */
- X int32 ioVNxtFNum; /* next unused file number */
- X int16 ioVFrBlk; /* number of unused allocation blocks */
- X } VolumeParam, *VolumeParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioRefNum; /* path reference number */
- X int16 filler; /* unused */
- X int32 ioFCBIndx; /* fcb index for _getfcbinfo */
- X int32 ioFCBFlNm; /* file number */
- X int16 ioFCBFlags; /* flags */
- X int16 ioFCBStBlk; /* first allocation block of file */
- X int32 ioFCBEOF; /* logical end-of-file */
- X int32 ioFCBPLen; /* physical end-of-file */
- X int32 ioFCBCrPs; /* mark */
- X int16 ioFCBVRefNum; /* volume reference number */
- X int32 ioFCBClpSiz; /* file clump size */
- X int32 ioFCBParID; /* parent directory id */
- X } FCBParam, *FCBParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioRefNum; /* path reference number */
- X int8 ioVersNum; /* version number */
- X int8 ioPermssn; /* read/write permission */
- X Ptr ioMisc; /* miscellaneous */
- X Ptr ioBuffer; /* data buffer */
- X int32 ioReqCount; /* requested number of bytes */
- X int32 ioActCount; /* actual number of bytes */
- X int32 filler; /* unused */
- X int32 ioDirID; /* directory id */
- X } HIOParam, *HIOParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioFRefNum; /* path reference number */
- X int16 filler2; /* unused */
- X int16 ioFDirIndex; /* sequence number of file */
- X int8 ioFlAttrib; /* attributes */
- X int8 filler3; /* version number */
- X FInfo ioFlFndrInfo; /* finder information */
- X int32 ioDirID; /* directory id */
- X int16 ioFlStBlk; /* first allocation block of data fork */
- X int32 ioFlLgLen; /* logical end-of-file of data fork */
- X int32 ioFlPyLen; /* physical end-of-file of data fork */
- X int16 ioFlRStBlk; /* first allocation block of resource fork */
- X int32 ioFlRLgLen; /* logical end-of-file of resource fork */
- X int32 ioFlRPyLen; /* physical end-of-file of resource fork */
- X int32 ioFlCrDat; /* creation time and date */
- X int32 ioFlMdDat; /* modification time and date */
- X } HFileParam, *HFileParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int32 filler4; /* unused */
- X int16 ioVolIndex; /* volume index */
- X int32 ioVCrDate; /* creation time and date */
- X int32 ioVLsMod; /* modification time and date */
- X int16 ioVAtrb; /* attributes */
- X int16 ioVNmFls; /* number of files in directory */
- X int16 ioVBitMap; /* first block of volume bitmap */
- X int16 ioVAllocPtr; /* volume space allocation pointer */
- X int16 ioVNmAlBlks; /* number of allocation blocks */
- X int32 ioVAlBlkSiz; /* size of allocation block */
- X int32 ioVClpSiz; /* default clump size */
- X int16 ioAlBlSt; /* first block in block map */
- X int32 ioVNxtFNum; /* next free node id */
- X int16 ioVFrBlk; /* number of unused allocation blocks */
- X int16 ioVSigWord; /* volume signature */
- X int16 ioVDrvInfo; /* drive number */
- X int16 ioVDRefNum; /* driver reference number */
- X int16 ioVFSID; /* file system identifier */
- X int32 ioVBkUp; /* last backup time and date */
- X int16 ioVSeqNum; /* sequence number in backup set */
- X int32 ioVWrCnt; /* volume write count */
- X int32 ioVFilCnt; /* number of files on volume */
- X int32 ioVDirCnt; /* number of directories on volume */
- X int32 ioVFndrInfo[8]; /* finder information */
- X } HVolumeParam, *HVolumeParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioFRefNum; /* file reference number */
- X int16 filler1; /* unused */
- X int16 ioFDirIndex; /* file directory index */
- X int8 ioFlAttrib; /* attributes */
- X int8 filler2; /* unused */
- X FInfo ioFlFndrInfo; /* finder information */
- X int32 ioFlNum; /* file number */
- X int16 ioFlStBlk; /* first allocation block of data fork */
- X int32 ioFlLgLen; /* logical end-of-file of data fork */
- X int32 ioFlPyLen; /* physical end-of-file of data fork */
- X int16 ioFlRStBlk; /* first allocation block of resource fork */
- X int32 ioFlRLgLen; /* logical end-of-file of resource fork */
- X int32 ioFlRPyLen; /* physical end-of-file of resource fork */
- X int32 ioFlCrDat; /* creation time and date */
- X int32 ioFlMdDat; /* modification time and date */
- X int32 ioFlBkDat; /* last backup time and date */
- X FInfo ioFlXFndrInfo; /* additional finder information */
- X int32 ioFlParID; /* parent directory id */
- X int32 ioFlClpSiz; /* file's clump size */
- X } HFileInfoParam, *HFileInfoParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 ioFRefNum; /* file reference number */
- X int16 filler1; /* unused */
- X int16 ioFDirIndex; /* file directory index */
- X int8 ioFlAttrib; /* attributes */
- X int8 filler2; /* unused */
- X int16 ioDrUsrWds[8]; /* directory's user info */
- X int32 ioDrDirID; /* directory id */
- X int16 ioDrNmFls; /* number of files in directory */
- X int16 filler3[9]; /* unused */
- X int32 ioDrCrDat; /* creation time and date */
- X int32 ioDrMdDat; /* modification time and date */
- X int32 ioDrBkDat; /* last backup time and date */
- X int16 ioDrFndrInfo[8]; /* finder information */
- X int32 ioDrParID; /* parent id */
- X int32 filler4; /* unused */
- X } DirInfoParam, *DirInfoParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int32 filler1; /* unused */
- X StringPtr ioNewName; /* new name */
- X int32 filler2; /* unused */
- X int32 ioNewDirID; /* new directory id */
- X int32 filler3[2]; /* unused */
- X int32 ioDirID; /* directory id */
- X } CMoveParam, *CMoveParamPtr;
- X
- Xtypedef struct
- X {
- X QElemPtr qLink; /* next queue entry */
- X int16 qType; /* queue entry type */
- X int16 ioTrap; /* routine trap */
- X Ptr ioCmdAddr; /* routine address */
- X ProcPtr ioCompletion; /* completion routine */
- X OSErr ioResult; /* result code */
- X StringPtr ioNamePtr; /* name */
- X int16 ioVRefNum; /* reference number */
- X int16 filler1; /* unused */
- X int16 ioWDIndex; /* working directory index */
- X int32 ioWDProcID; /* working directory's id */
- X int16 ioWDVRefNum; /* working directory's volume reference number */
- X int16 filler2[7]; /* unused */
- X int32 ioWDDirID; /* working directory's directory id */
- X } WDParam, *WDParamPtr;
- X
- ________This_Is_The_END________
- if test `wc -l < hfs.h` -ne 310; then
- echo 'shar: hfs.h was damaged during transit'
- echo ' (should have been 310 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting mmstr.c'
- if test -f mmstr.c; then echo 'shar: will not overwrite mmstr.c'; else
- sed 's/^X//' << '________This_Is_The_END________' > mmstr.c
- X
- X
- X/****************************************
- X* *
- X* *
- X* custom string library *
- X* 7/10/86 *
- X* MMSTR.C *
- X* *
- X* LIGHTSPEED *
- X* *
- X* John Pence, Macman, Inc. *
- X* *
- X****************************************/
- X
- X/*
- X in this file:
- X
- X char *strnac(str1,str2,num)
- X char *str1,str2;
- X int num;
- X
- X char *strtac(str1,str2)
- X char *str1,str2;
- X
- X*/
- Xextern int strlen();
- X
- Xchar *strtac(s1,s2)
- X register char *s1,*s2;
- X {
- X char *result = s1;
- X register int n = strlen(s2);
- X
- X
- X while(*s1++);
- X
- X
- X while(--s1 >= result)
- X *(s1+n)=*s1; /* move string1 over */
- X
- X
- X s1++; /* point s1 back to start of string1 */
- X while(*s2) /* move string2 into beginning of string1 */
- X *(s1++) = *(s2++);
- X
- X
- X return result;
- X } /* strtac */
- X
- X
- X
- X
- Xchar *strntac(s1,s2,num)
- X register char *s1,*s2;
- X register int num;
- X {
- X register int i;
- X char *result = s1;
- X char *string2 = s2;
- X register int len2 = 0;
- X
- X if(num > (len2=strlen(s2) ) ) num = len2;
- X
- X while(*s1++); /* advance to end */
- X
- X while(--s1 >= result)
- X *(s1+num)=*s1; /* move string1 over */
- X s1++ ; /* point s1 back to start of string1 */
- X
- X for(i=0;i<num; i++) /* move string2 into beginning of string1 */
- X s1[i] = s2[i];
- X
- X return result;
- X } /* strntac */
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- ________This_Is_The_END________
- if test `wc -l < mmstr.c` -ne 87; then
- echo 'shar: mmstr.c was damaged during transit'
- echo ' (should have been 87 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting pbcall.Voc'
- if test -f pbcall.Voc; then echo 'shar: will not overwrite pbcall.Voc'; else
- sed 's/^X//' << '________This_Is_The_END________' > pbcall.Voc
- ________This_Is_The_END________
- if test `wc -l < pbcall.Voc` -ne 0; then
- echo 'shar: pbcall.Voc was damaged during transit'
- echo ' (should have been 0 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting pbcall.asm'
- if test -f pbcall.asm; then echo 'shar: will not overwrite pbcall.asm'; else
- sed 's/^X//' << '________This_Is_The_END________' > pbcall.asm
- X; HFS EXAMPLE
- X; Modified by John Pence, MacMan, Inc., Houston Texas.
- X; from MacTutor, Jan,86 issue
- X; Programming for HFS" by Miki Schuster.
- X;
- X; A "must have" for the serious programmer
- X; MACTUTOR(tm) P.O BOX 400
- X; PLACENTIA, CA 92670
- X; (714) 630-3730;
- X
- X; FILE: PBCALL0.Asm
- X
- X; External routines for Lightspeed for HFS support
- X; Modified by John Pence, MacMan, Inc., Houston Texas.
- X; from MacTutor, Jan,86 issue
- X; "Programming for HFS" by Miki Schuster.
- X;
- X; ENTER THE LABELS FOR THE FUNCTIONS IN THE
- X; CORRESPONDING .VOC FILE IF YOU WISH TO PRESERVE
- X; LABEL'S CASE. THIS FILE MUST BE FIRST PROCESSED WITH
- X; APPLES MDS ASSEMBLER (I tried Consulairs MAC C assenbler with
- X; poor results, but it may also be ok).THEN PROCESS THE .RELFILE
- X; WITH RELCONV (LIGHTSPEED UTILITY). THEN INCLUDE THE RESULTANT
- X; .Lib FILE IN YOUR PROJECT.
- X
- X; C interface macro definitions
- X;
- X;; pbcall(¶mblock,async,trap,trap identifier)
- X;; longword word word word
- X;; (ARGS PUSHED RIGHT TO LEFT)
- X
- X;ON ENTRY
- X;STACK BOTTOM
- X;; OFFSET ITEM
- X; FROM TOS
- X; 52- TRAP IDENTIFIER WORD -WORD
- X;; 50 INSTRUCTION (HEX) -WORD
- X;; 48 ASYNC FLAG -WORD
- X; 44 ADDR. OF PARAMETER BLOCK -LONGWORD
- X;; 40 RETURN ADDRESS -LONGWORD
- X;; 36 D3 - (LIGHTSPEED DOCS -LONGWORD
- X;; 32 D4 - SAY SAVE ALL BUT -LONGWORD
- X;; 28 D5 - D0,D1,D2,A0,A1,A7) -LONGWORD
- X;; 24 D6 -LONGWORD
- X;; 20 D7 -LONGWORD
- X;; 16 A2 -LONGWORD
- X;; 12 A3 -LONGWORD
- X;; 8 A4 -LONGWORD
- X;; 4 A5 -LONGWORD
- X;; 0 A6 -TOP -LONGWORD
- X;;
- X
- XXDEF pbCall
- X
- X;include tooltraps.txt ; for definition of _Debugger
- X
- X
- X
- X
- X
- XpbCall:
- X ;_Debugger ; for a while, I needed this!
- X MOVEM.L D3-D7/A2-A6,-(SP) ; save the world
- X MOVE.W 48(SP),D1 ; GET ASYNC FLAG
- X MOVE.W 50(SP),D2 ; GET INSTRUCTION
- X TST.B D1 ; TEST ASYNC FLAG
- X BEQ.S @1 ; SKIP IF ASYNC
- X OR.W #$400,D2 ; SET BITS IN INSTRUCTION FOR SYNC
- X@1:
- X LEA @2,A0 ; GET ADDRESS OF INSTRUCTION
- X MOVE.W D2,(A0) ; JAM THE OVER THE NOP
- X MOVE.L 44(SP),A0 ; GET THE ADDR OF PARAMETER BLOCK
- X MOVE.W 52(SP),D0 ; GET THE TRAP CALL IDENTIFIER WORD
- X@2:
- X NOP ; put instruction here
- X
- X MOVEM.L (SP)+,D3-D7/A2-A6; RESTORE REGS
- X RTS ; GET BACK
- X
- XEND
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- ________This_Is_The_END________
- if test `wc -l < pbcall.asm` -ne 91; then
- echo 'shar: pbcall.asm was damaged during transit'
- echo ' (should have been 91 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'Extracting pbhdefs.h'
- if test -f pbhdefs.h; then echo 'shar: will not overwrite pbhdefs.h'; else
- sed 's/^X//' << '________This_Is_The_END________' > pbhdefs.h
- X/* PBHDEFS.H- HFS PBCALLS FOR LIGHTSPEED C
- X some adapted for Lightspeed from the January 1986 MacTutor Article
- X My Mike Schuster entitled "Programming for HFS
- X some added by John Pence, MacMan, Inc. Houston, Texas*/
- X
- X#define PBOpenWD(pb, a) pbCall( pb, a, 0xA260, 1 )
- X#define PBCloseWD(pb, a) pbCall( pb, a, 0xA260, 2 )
- X#define PBCatMove(pb, a) pbCall( pb, a, 0xA260, 5 )
- X#define PBDirCreate(pb, a) pbCall( pb, a, 0xA260, 6 )
- X#define PBGetWDInfo(pb, a) pbCall( pb, a, 0xA260, 7 )
- X#define PBGetFCBInfo(pb, a) pbCall( pb, a, 0xA260, 8 )
- X#define PBGetCatInfo(pb, a) pbCall( pb, a, 0xA260, 9 )
- X
- X#define PBHOpen(pb, a) pbCall( pb, a, 0xA200 )
- X#define PBHGetVInfo(pb, a) pbCall( pb, a, 0xA207 )
- X#define PBHCreate(pb, a) pbCall( pb, a, 0xA208 )
- X#define PBHDelete(pb, a) pbCall( pb, a, 0xA209 )
- X#define PBHGetVol(pb, a) pbCall( pb, a, 0xA214 )
- X#define PBHGetFInfo(pb, a) pbCall( pb, a, 0xA20C )
- X#define PBHOpenRF(pb, a) pbCall( pb, a, 0xA20A )
- X#define PBHSetFInfo(pb, a) pbCall( pb, a, 0xA20D )
- X#define PBHSetVol(pb, a) pbCall( pb, a, 0xA215 )
- X#define PBHSetFVers(pb, a) pbCall( pb, a, 0xA243 )
- X#define PBHRename(pb, a) pbCall( pb, a, 0xA20B )
- X#define PBHSetFLock(pb, a) pbCall( pb, a, 0xA241 )
- X#define PBHRstFLock(pb, a) pbCall( pb, a, 0xA242 )
- ________This_Is_The_END________
- if test `wc -l < pbhdefs.h` -ne 26; then
- echo 'shar: pbhdefs.h was damaged during transit'
- echo ' (should have been 26 bytes)'
- fi
- fi ; : end of overwriting check
- exit 0
-