From: Rolf K. <lab...@us...> - 2007-09-17 16:13:03
|
Update of /cvsroot/opengtoolkit/lvzip/c_source In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3040/c_source Modified Files: Makefile iomem.c zlibvc.dsp Added Files: lvutil.c lvutil.h Removed Files: macbin.c macbin.h Log Message: changed filename macbin.x to lvutil.x --- macbin.c DELETED --- --- NEW FILE: lvutil.h --- /* lvutil.h -- support functions for macbinary Version 1.9, Sept 17th, 2007 Copyright (C) 2002-2007 Rolf Kalbermatter */ #ifndef _lvUtil_H #define _lvUtil_H #ifdef __cplusplus extern "C" { #endif #if defined(macintosh) || defined(__PPCC__) || defined(THINK_C) || defined(__SC__) || defined(__MWERKS__) || defined(__APPLE_CC__) #define Mac 1 #ifdef __MACH__ #define MacOSX 1 #endif #if defined(__i386__) #define BigEndian 0 #else #define BigEndian 1 #endif #elif defined(__GNUC__) || defined(linux) #define Unix 1 #define BigEndian 0 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN32_WCE) #define Win32 1 #ifdef _DEBUG #define DEBUG 1 #endif #define BigEndian 0 #endif #if defined(DEBUG) #if Win32 #define DoDebugger() {__asm int 3} #elif Mac #define DoDebugger() Debugger() #else #define DoDebugger() #endif #define DEBUGPRINTF(args) DbgPrintf args #else #define DoDebugger() #define DEBUGPRINTF(args) /* long DebugPrintf(char* fmt, ...); long DebugPrintf(char* fmt, ...) { return 0; } */ #endif typedef char int8; typedef unsigned char uInt8; typedef uInt8 uChar; typedef short int16; typedef unsigned short uInt16; typedef long int32; typedef unsigned long uInt32; typedef float float32; typedef double float64; #define Private(T) typedef struct T##_t { void *p; } *T #define PrivateH(T) struct T##_t; typedef struct T##_t **T Private(File); PrivateH(Path); Private(LVRefNum); typedef enum { iB=1, iW, iL, iQ, uB, uW, uL, uQ, fS, fD, fX, cS, cD, cX } NumType; typedef int32 MgErr; typedef int16 McErr; typedef int32 Bool32; #define Cat4Chrs(c1,c2,c3,c4) (((int32)(uInt8)(c1)<<24)|((int32)(uInt8)(c2)<<16)|((int32)(uInt8)(c3)<<8)|((int32)(uInt8)(c4))) #define Cat2Chrs(c1,c2) (((int16)(uInt8)(c1)<<8)|((int16)(uInt8)(c2))) #if BigEndian #define RTToL(c1,c2,c3,c4) Cat4Chrs(c1,c2,c3,c4) #define RTToW(c1,c2) Cat2Chrs(c1,c2) #else #define RTToL(c1,c2,c3,c4) Cat4Chrs(c4,c3,c2,c1) #define RTToW(c1,c2) Cat2Chrs(c2,c1) #endif enum { /* Manager Error Codes */ mgNoErr=0, #if !Mac && !QTMLIncl noErr = mgNoErr, #endif mgArgErr=1, mFullErr, /* Memory Mgr 2-3 */ mZoneErr, fEOF, /* File Mgr 4-12 */ fIsOpen, fIOErr, fNotFound, fNoPerm, fDiskFull, fDupPath, fTMFOpen, fNotEnabled, rFNotFound, /* Resource Mgr 13-15 */ rAddFailed, rNotFound, iNotFound, /* Image Mgr 16-17 */ iMemoryErr, dPenNotExist, /* Draw Mgr 18 */ cfgBadType, /* Config Mgr 19-22 */ cfgTokenNotFound, cfgParseError, cfgAllocError, ecLVSBFormatError, /* extCode Mgr 23 */ ecLVSBOffsetError, /* extCode Mgr 24 */ ecLVSBNoCodeError, /* extCode Mgr 25 */ wNullWindow, /* Window Mgr 26-27 */ wDestroyMixup, menuNullMenu, /* Menu Mgr 28 */ pAbortJob, /* Print Mgr 29-35 */ pBadPrintRecord, pDriverError, pWindowsError, pMemoryError, pDialogError, pMiscError, dvInvalidRefnum, /* Device Mgr 36-41 */ dvDeviceNotFound, dvParamErr, dvUnitErr, dvOpenErr, dvAbortErr, bogusError, /* generic error 42 */ cancelError, /* cancelled by user 43 */ OMObjLowErr, /* object message dispatcher errors 44-52 */ OMObjHiErr, OMObjNotInHeapErr, OMOHeapNotKnownErr, OMBadDPIdErr, OMNoDPinTabErr, OMMsgOutOfRangeErr, OMMethodNullErr, OMUnknownMsgErr, mgNotSupported, ncBadAddressErr, /* Net Connection errors 54-66 */ ncInProgress, ncTimeOutErr, ncBusyErr, ncNotSupportedErr, ncNetErr, ncAddrInUseErr, ncSysOutOfMem, ncSysConnAbortedErr, /* 62 */ ncConnRefusedErr, ncNotConnectedErr, ncAlreadyConnectedErr, ncConnClosedErr, /* 66 */ }; typedef struct { int16 v; int16 h; } LVPoint; typedef uChar Str255[256], *PStr, *CStr, *UPtr, **UHandle; typedef const uChar *ConstCStr, *ConstPStr, ConstStr255[256]; #define PStrBuf(b) (&((PStr)(b))[1]) #define PStrLen(b) (((PStr)(b))[0]) /* # of chars in string */ #define PStrSize(b) (PStrLen(b)+1) /* # of bytes including length */ int32 CToPStr(ConstCStr src, PStr dest); int32 PStrCpy(PStr d, ConstPStr s); int32 StrCpy(CStr t, const CStr s); int32 StrNCpy(CStr t, const CStr s, int32 l); typedef struct { int32 cnt; uChar str[1]; } LStr, *LStrPtr, **LStrHandle; #define LStrLen(p) ((p)->cnt) #define LStrBuf(p) ((p)->str) typedef struct { int32 cnt; uChar str[256]; } LStr256; /* Typedefs */ typedef struct { uInt32 type; /* handled by LabVIEW Type & Creator */ uInt32 creator; /* handled by LabVIEW Type & Creator */ uInt32 size; /* not modified, use EOF */ uInt32 rfSize; /* Mac only, not modified, use EOF */ uInt32 cDate; uInt32 mDate; uInt16 flags; LVPoint location; /* Mac only */ uInt16 fId; /* Mac only */ uInt8 sId; /* Mac only */ uInt8 xFlags; /* Mac only */ } LVFileInfo; #define kUnknownFileType RTToL('?','?','?','?') #define kUnknownCreator RTToL('?','?','?','?') enum { openReadWrite, openReadOnly, openWriteOnly, openWriteOnlyTruncate }; /* open modes */ enum { denyReadWrite, denyWriteOnly, denyNeither}; /* deny modes */ enum { fAbsPath, fRelPath, fNotAPath, fUNCPath, nPathTypes}; /* path type codes */ /* LabVIEW exported functions */ MgErr FPathToText(Path path, LStrPtr lstr); MgErr FPathToPath(Path *p); MgErr FAppendName(Path path, PStr name); Bool32 FIsAPathOfType(Path path, int32 ofType); int32 FDepth(Path path); MgErr FDisposePath(Path p); MgErr FNewRefNum(Path path, File fd, LVRefNum* refnum); int32 DbgPrintf(CStr fmt, ...); UPtr DSNewPClr(int32); MgErr DSDisposePtr(UPtr); UHandle DSNewHClr(int32 size); MgErr DSSetHandleSize(UHandle, int32); int32 DSGetHandleSize(UHandle); MgErr DSDisposeHandle(UHandle); MgErr NumericArrayResize(int32, int32, UHandle*, int32); #define Min(a, b) ((a) < (b)) ? (a) : (b) #define Max(a, b) ((a) > (b)) ? (a) : (b) /* Our exported functions */ extern void ZEXPORT DLLVersion OF((uChar* Version)); extern MgErr ZEXPORT LVPath_ToText OF((Path path, CStr str, int32 *len)); extern MgErr ZEXPORT LVPath_HasResourceFork OF((Path path, int32 *hasResFork)); extern MgErr ZEXPORT LVPath_EncodeMacbinary OF((Path srcFileName, Path dstFileName)); extern MgErr ZEXPORT LVPath_DecodeMacbinary OF((Path srcFileName, Path dstFileName)); extern MgErr ZEXPORT LVPath_UtilFileInfo OF((Path path, uInt8 write, uInt8 *isDirectory, LVFileInfo *finderInfo, LStrHandle comment)); extern MgErr ZEXPORT LVPath_OpenFile OF((LVRefNum *refnum, Path path, uInt8 rsrc, uInt32 openMode, uInt32 denyMode)); extern long ZEXPORT InitializeFileFuncs OF((zlib_filefunc_def* pzlib_filefunc_def, LStrHandle *memory)); #ifdef __cplusplus } #endif #endif /* _lvUtil_H */ --- macbin.h DELETED --- Index: Makefile =================================================================== RCS file: /cvsroot/opengtoolkit/lvzip/c_source/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 10 Jan 2006 22:51:31 -0000 1.7 --- Makefile 17 Sep 2007 16:13:02 -0000 1.8 *************** *** 48,52 **** OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ zutil.o inflate.o infback.o inftrees.o inffast.o \ ! ioapi.o macbin.o zip.o unzip.o OBJA = --- 48,52 ---- OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ zutil.o inflate.o infback.o inftrees.o inffast.o \ ! ioapi.o iomem.o lvutil.o zip.o unzip.o OBJA = *************** *** 146,150 **** infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inftrees.o: zutil.h zlib.h zconf.h inftrees.h ! macbin.o: zlib.h macbin.h minigzip.o: zlib.h zconf.h trees.o: deflate.h zutil.h zlib.h zconf.h trees.h --- 146,150 ---- infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inftrees.o: zutil.h zlib.h zconf.h inftrees.h ! lvutil.o: zlib.h zconf.h ioapi.h iomem.h lvutil.h minigzip.o: zlib.h zconf.h trees.o: deflate.h zutil.h zlib.h zconf.h trees.h *************** *** 152,155 **** --- 152,156 ---- zutil.o: zutil.h zlib.h zconf.h ioapi.o: zlib.h zconf.h ioapi.h + iomem.o: zlib.h zconf.h zutil.h ioapi.h lvutil.h zip.o: zlib.h zconf.h ioapi.h zip.h unzip.o: zlib.h zconf.h ioapi.h unzip.h Index: iomem.c =================================================================== RCS file: /cvsroot/opengtoolkit/lvzip/c_source/iomem.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iomem.c 17 Sep 2007 15:17:25 -0000 1.5 --- iomem.c 17 Sep 2007 16:13:02 -0000 1.6 *************** *** 7,11 **** #include "zutil.h" #include "ioapi.h" ! #include "macbin.h" #include "iomem.h" --- 7,11 ---- #include "zutil.h" #include "ioapi.h" ! #include "lvutil.h" #include "iomem.h" --- NEW FILE: lvutil.c --- /* lvutil.c -- support functions for LabVIEW ZIP library Version 1.9, Sept 17th, 2007 Copyright (C) 2002-2007 Rolf Kalbermatter */ #include <stdio.h> #include <string.h> #include "zlib.h" #include "ioapi.h" #include "lvutil.h" #include "iomem.h" #if Mac #include <CoreServices/CoreServices.h> /* instead of #include <Resources.h> */ #include "MacBinaryIII.h" #define MacIsInvisible(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible) [...1015 lines suppressed...] #if MacOSX if (!err) err = ConvertToPosixPath(lstr->str, NULL, &pathLen); #endif if (!err) { if (str && (*len > pathLen)) { #if MacOSX err = ConvertToPosixPath(lstr->str, str, len); #else StrNCpy(str, lstr->str, *len); #endif } } DSDisposePtr((UPtr)lstr); *len = pathLen + 1; } return err; } Index: zlibvc.dsp =================================================================== RCS file: /cvsroot/opengtoolkit/lvzip/c_source/zlibvc.dsp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** zlibvc.dsp 16 Sep 2007 14:26:17 -0000 1.10 --- zlibvc.dsp 17 Sep 2007 16:13:02 -0000 1.11 *************** *** 254,258 **** # Begin Source File ! SOURCE=.\macbin.c # End Source File # Begin Source File --- 254,258 ---- # Begin Source File ! SOURCE=.\lvutil.c # End Source File # Begin Source File *************** *** 335,339 **** # Begin Source File ! SOURCE=.\macbin.h # End Source File # Begin Source File --- 335,339 ---- # Begin Source File ! SOURCE=.\lvutil.h # End Source File # Begin Source File |