428 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			428 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
/*
 | 
						|
 * ALDEFS.H
 | 
						|
 *
 | 
						|
 *  Header file for ArchiveLib 1.0
 | 
						|
 *
 | 
						|
 *  Copyright (c) 1994 Greenleaf Software, Inc.
 | 
						|
 *  All Rights Reserved
 | 
						|
 *
 | 
						|
 * DESCRIPTION
 | 
						|
 *
 | 
						|
 *  This is the setup file for ArchiveLib.  Everyone else has to include
 | 
						|
 *  it, because all of the macros defined in here help to control
 | 
						|
 *  how the library operates.  Normally you will never have to include
 | 
						|
 *  this header file, because it is included by ARCLIB.H, and consequently,
 | 
						|
 *  everyone else.
 | 
						|
 *
 | 
						|
 * MACROS
 | 
						|
 *
 | 
						|
 * These are all calculated automatically for supported compilers.
 | 
						|
 *
 | 
						|
 *  AL_WINDOWS_GUI     : This library uses the Windows GUI API
 | 
						|
 *  AL_WINDOWS_MEMORY  : This library uses the Windows Memory API
 | 
						|
 *  AL_FLAT_MODEL      : This library uses 386 Flat Model
 | 
						|
 *  AL_LARGE_DATA      : Data uses 16:16 data pointer
 | 
						|
 *  AL_OS2             : Some day.
 | 
						|
 *  AL_UNIX            : Some day.
 | 
						|
 *
 | 
						|
 *  AL_BUILDING_DLL    : Building the Windows DLL
 | 
						|
 *  AL_USING_DLL       : Linking to the Windows DLL
 | 
						|
 *
 | 
						|
 *  AL_SYMANTEC        : Compiler selection
 | 
						|
 *  AL_BORLAND         : Compiler selection
 | 
						|
 *  AL_MICROSOFT       : Compiler selection
 | 
						|
 *  AL_WATCOM          : Compiler selection
 | 
						|
 *
 | 
						|
 *  Based on those settings, we can set this:
 | 
						|
 *
 | 
						|
 *  AL_WIN32S          : This is NT or Win32s
 | 
						|
 *
 | 
						|
 *                     AL_WINDOWS_GUI  AL_WINDOWS_MEMORY  AL_FLAT_MODEL
 | 
						|
 * Vanilla DOS              NO                NO               NO
 | 
						|
 * Borland DPMI16           NO                YES              NO
 | 
						|
 * Borland DPMI32           NO                YES              YES
 | 
						|
 * Symantec DOSX            NO                NO               YES
 | 
						|
 * Win32s                   YES               YES              YES
 | 
						|
 * Vanilla Windows          YES               YES              NO
 | 
						|
 * 
 | 
						|
 *  Finally, we use those to create these things used in prototypes:
 | 
						|
 *
 | 
						|
 *  AL_CLASS_TYPE     : Sometimes "export", for classes in DLLs
 | 
						|
 *  AL_PROTO          : Sometimes "export", for functions in DLLs
 | 
						|
 *  AL_DLL_FAR        : Sometimes "far", for arguments being passed to DLLs
 | 
						|
 *  AL_FUNCTION       : Vanilla exported functions are "_export pascal"
 | 
						|
 *  AL_CFUNCTION      : Variable argument export functions are "_export cdecl"
 | 
						|
 *
 | 
						|
 * PROTOTYPES:
 | 
						|
 *
 | 
						|
 *
 | 
						|
 * ENUMERATED TYPES:
 | 
						|
 *
 | 
						|
 *  ALMonitorType                  : Used to indicate whether a monitor
 | 
						|
 *                                   is watching objects or an entire job.
 | 
						|
 *
 | 
						|
 *  ALWindowsMessageType           : To indicate whether an object of
 | 
						|
 *                                   class ALMonitor is supposed to be
 | 
						|
 *                                   sending total byte counts or
 | 
						|
 *                                   percentage complete ratios.
 | 
						|
 *
 | 
						|
 *  ALErrors                       : The global list of errors.
 | 
						|
 *
 | 
						|
 *  ALCase                         : Used by ALName to indicate case
 | 
						|
 *                                   sensitivity/handling
 | 
						|
 *
 | 
						|
 *  ALGreenleafCompressionLevels   : The five levels used by ALGreenleafEngine.
 | 
						|
 *
 | 
						|
 *  ALTraverseSetting              : Used to indicate whether class
 | 
						|
 *                                   ALWildCardExpander will traverse
 | 
						|
 *                                   subdirectories when searching.
 | 
						|
 *
 | 
						|
 *  ALStorageType                  : The type of a storage engine.
 | 
						|
 *
 | 
						|
 *  ALCompressionType              : The type of a compression engine.
 | 
						|
 *
 | 
						|
 * REVISION HISTORY
 | 
						|
 *
 | 
						|
 *  May 26, 1994  1.0A  : First release
 | 
						|
 *
 | 
						|
 */
 | 
						|
#ifndef _ALDEFS_H
 | 
						|
#define _ALDEFS_H
 | 
						|
/*
 | 
						|
 *  The next long set of definitions and tests are all here simply to
 | 
						|
 *  determine which compiler we are using, and what sort of target
 | 
						|
 *  configuration we are trying to build/use.
 | 
						|
 */
 | 
						|
#if defined(__BORLANDC__) || defined(__TURBOC__)
 | 
						|
  #if defined( __WIN32__ )
 | 
						|
    #define AL_FLAT_MODEL
 | 
						|
  #endif
 | 
						|
  #if !defined( __BORLANDC__ )
 | 
						|
      #define AL_BORLAND __TURBOC__
 | 
						|
  #else
 | 
						|
      #define AL_BORLAND __BORLANDC__
 | 
						|
  #endif
 | 
						|
  #if sizeof( void * ) == 4
 | 
						|
    #define AL_LARGE_DATA
 | 
						|
  #endif
 | 
						|
  #if defined( _Windows )
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #ifdef __DLL__
 | 
						|
      #define AL_BUILDING_DLL
 | 
						|
    #endif
 | 
						|
    #if !defined( __DPMI16__ ) && !defined( __CONSOLE__ )
 | 
						|
      #define AL_WINDOWS_GUI
 | 
						|
    #endif
 | 
						|
  #endif
 | 
						|
#elif defined( __SC__ )
 | 
						|
  #define AL_SYMANTEC _MSC_VER
 | 
						|
  #if defined( __NT__ )
 | 
						|
    #define AL_FLAT_MODEL
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #define AL_WINDOWS_GUI
 | 
						|
  #endif
 | 
						|
  #if defined( _M_I86HM ) || defined( _M_I86CM ) || defined( _M_I86LM )
 | 
						|
    #define AL_LARGE_DATA
 | 
						|
  #endif
 | 
						|
/*
 | 
						|
 * The _WINDOWS and _WINDLL macros are only documented in LIBRARY.TXT
 | 
						|
 */
 | 
						|
  #ifdef _WINDOWS
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #define AL_WINDOWS_GUI
 | 
						|
    #ifdef _WINDLL
 | 
						|
      #define AL_BUILDING_DLL
 | 
						|
      #ifndef M_I86LM
 | 
						|
        #error All DLLs must be built using Large Model!
 | 
						|
      #endif
 | 
						|
    #endif
 | 
						|
  #endif
 | 
						|
#elif defined( _MSC_VER )
 | 
						|
  #define AL_MICROSOFT _MSC_VER
 | 
						|
  #if defined( _M_I86HM ) || defined( _M_I86CM ) || defined( _M_I86LM )
 | 
						|
    #define AL_LARGE_DATA
 | 
						|
  #endif
 | 
						|
  #if ( AL_MICROSOFT >= 800 )
 | 
						|
/*
 | 
						|
 * I really don't want MSC to tell me when it is using a precompiled
 | 
						|
 * header file.  What is really dumb is that I probably do want it
 | 
						|
 * to tell me when it is creating one, but they generate the same
 | 
						|
 * warning!
 | 
						|
 */
 | 
						|
    #pragma warning( disable : 4699 )
 | 
						|
/*
 | 
						|
 * This error occurs if you have inline functions in a header file and
 | 
						|
 * they don't get used in a particular file.  Bogus.
 | 
						|
 */
 | 
						|
    #pragma warning( disable : 4505 )
 | 
						|
/*
 | 
						|
 * This warning occurs if you are using assert() macros with NDEBUG and /Ox
 | 
						|
 * it is bogus
 | 
						|
 */
 | 
						|
    #pragma warning( disable : 4705 )
 | 
						|
/*
 | 
						|
 * This gives a warning for cout << setw( x )
 | 
						|
 */
 | 
						|
    #pragma warning( disable : 4270 )
 | 
						|
/*
 | 
						|
 * This is informational, it tells me when a function has been
 | 
						|
 * chosen for inlining.
 | 
						|
 */
 | 
						|
    #pragma warning( disable : 4711 )
 | 
						|
/*
 | 
						|
 * This is informational, it tells me when a function has been
 | 
						|
 * rejected for inlining.  The funny part is that it gives
 | 
						|
 * me this message even if I don't select inlining for that
 | 
						|
 * particular function???
 | 
						|
 */
 | 
						|
    #pragma warning( disable : 4710 )
 | 
						|
  #else  /*#if ( AL_MICROSOFT >= 800 ) */
 | 
						|
/*
 | 
						|
 * Microsoft C 7.0 has a major linker problems if a symbol exceeds
 | 
						|
 * 64 characters.  Unfortunately, with full decoration, we have
 | 
						|
 * a couple of functions that hit that wall.  So I have to redefine
 | 
						|
 * a couple of innocuous class names. I am trying to use similar
 | 
						|
 * names so that if you hit them in the debugger you will be able
 | 
						|
 * to understand what they mean.
 | 
						|
 *
 | 
						|
 *  #if defined( _WINDLL )
 | 
						|
 *     #define ALWindowsMessage ALWinMsg_
 | 
						|
 *      #define ALCompressionEngine ALEngine_
 | 
						|
 *  #endif  NOTE: Fixing problem with /H64 in BUILD.INI! */
 | 
						|
  #endif /*#if ( AL_MICROSOFT >= 800 ) ... #else */
 | 
						|
  #ifdef _WINDOWS
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #define AL_WINDOWS_GUI
 | 
						|
    #ifdef _WINDLL
 | 
						|
      #define AL_BUILDING_DLL
 | 
						|
      #ifndef M_I86LM
 | 
						|
        #error All DLLs must be built using Large Model!
 | 
						|
      #endif
 | 
						|
    #endif
 | 
						|
  #endif
 | 
						|
#elif defined( __WATCOMC__ ) && defined( __386__ )
 | 
						|
  #define AL_FLAT_MODEL
 | 
						|
  #ifdef __WINDOWS__
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #define AL_WINDOWS_GUI
 | 
						|
  #endif
 | 
						|
  #pragma warning 690 9 /*  Warning for AL_ASSERT() at /w3 */
 | 
						|
  #pragma warning 549 9 /*  Warning for sizeof() on class */
 | 
						|
#elif defined( __GNUC__ )
 | 
						|
  #define AL_FLAT_MODEL
 | 
						|
  #ifdef __WINDOWS__
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #define AL_WINDOWS_GUI
 | 
						|
  #endif
 | 
						|
#elif defined( __WATCOMC__ ) && !defined( __386__ )
 | 
						|
  #define AL_WATCOM
 | 
						|
  #ifdef __WINDOWS__
 | 
						|
    #define AL_WINDOWS_MEMORY
 | 
						|
    #define AL_WINDOWS_GUI
 | 
						|
    #ifdef __SW_ZU
 | 
						|
      #define AL_BUILDING_DLL
 | 
						|
      #ifndef M_I86LM
 | 
						|
        #error All DLLs must be built using Large Model!
 | 
						|
      #endif
 | 
						|
    #endif
 | 
						|
  #endif
 | 
						|
  #if defined( _M_I86HM ) || defined( _M_I86CM ) || defined( _M_I86LM )
 | 
						|
    #define AL_LARGE_DATA
 | 
						|
  #endif
 | 
						|
  #pragma warning 549 9 /*  Warning for sizeof() on class */
 | 
						|
#elif defined( __IBMC__ ) || defined( __IBMCPP__ )
 | 
						|
  #define AL_IBM
 | 
						|
  #define AL_OS2
 | 
						|
  #define AL_FLAT_MODEL
 | 
						|
#else
 | 
						|
  #error "Unknown compiler!"
 | 
						|
#endif
 | 
						|
 | 
						|
#if defined( AL_WINDOWS_MEMORY ) || defined( AL_WINDOWS_GUI )
 | 
						|
  #define STRICT
 | 
						|
  #include <windows.h>
 | 
						|
  #ifdef AL_FLAT_MODEL
 | 
						|
    #define AL_HUGE
 | 
						|
  #else
 | 
						|
    #define AL_HUGE _huge
 | 
						|
  #endif
 | 
						|
#else
 | 
						|
  #define WORD unsigned int
 | 
						|
  #define DWORD unsigned long
 | 
						|
#endif
 | 
						|
 | 
						|
#if defined( AL_WINDOWS_GUI ) && defined( AL_WINDOWS_MEMORY ) && defined( AL_FLAT_MODEL )
 | 
						|
  #define AL_WIN32S
 | 
						|
#endif
 | 
						|
 | 
						|
#if defined( AL_BUILDING_DLL )
 | 
						|
  #if defined( AL_FLAT_MODEL )
 | 
						|
    #define AL_CLASS_TYPE     _export
 | 
						|
    #define AL_PROTO          _export
 | 
						|
    #define AL_DLL_FAR
 | 
						|
    #define AL_FUNCTION       _export pascal
 | 
						|
    #define AL_CFUNCTION      _export cdecl
 | 
						|
  #elif defined( AL_WATCOM )
 | 
						|
    #define AL_CLASS_TYPE
 | 
						|
    #define AL_PROTO          _export
 | 
						|
    #define AL_DLL_FAR
 | 
						|
    #define AL_FUNCTION       _export _far pascal
 | 
						|
    #define AL_CFUNCTION      _export _far cdecl
 | 
						|
  #else
 | 
						|
    #define AL_CLASS_TYPE     _export
 | 
						|
    #define AL_PROTO          _far
 | 
						|
    #define AL_DLL_FAR        _far
 | 
						|
    #define AL_FUNCTION       _export _far pascal
 | 
						|
    #define AL_CFUNCTION      _export _far cdecl
 | 
						|
  #endif
 | 
						|
#elif defined( AL_USING_DLL )
 | 
						|
  #if defined( AL_FLAT_MODEL ) && defined( AL_BORLAND )
 | 
						|
    #define AL_CLASS_TYPE     _import
 | 
						|
    #define AL_PROTO          _import
 | 
						|
    #define AL_DLL_FAR
 | 
						|
    #define AL_FUNCTION       _import pascal
 | 
						|
    #define AL_CFUNCTION      _import cdecl
 | 
						|
  #elif defined( AL_FLAT_MODEL ) && defined( AL_SYMANTEC )
 | 
						|
    #define AL_CLASS_TYPE     _export
 | 
						|
    #define AL_PROTO          _export
 | 
						|
    #define AL_DLL_FAR
 | 
						|
    #define AL_FUNCTION       _export pascal
 | 
						|
    #define AL_CFUNCTION      _export cdecl
 | 
						|
  #elif defined( AL_WATCOM )
 | 
						|
    #define AL_PROTO
 | 
						|
    #define AL_DLL_FAR
 | 
						|
    #define AL_CLASS_TYPE
 | 
						|
    #define AL_FUNCTION       _far _pascal
 | 
						|
    #define AL_CFUNCTION      _far cdecl
 | 
						|
  #else
 | 
						|
    #define AL_PROTO          _far
 | 
						|
    #define AL_DLL_FAR        _far
 | 
						|
    #ifdef AL_BORLAND
 | 
						|
      #if ( AL_BORLAND >= 0x450 )
 | 
						|
        #define AL_CLASS_TYPE _import
 | 
						|
      #else
 | 
						|
        #define AL_CLASS_TYPE   _huge
 | 
						|
      #endif
 | 
						|
    #else
 | 
						|
      #define AL_CLASS_TYPE   _export
 | 
						|
    #endif
 | 
						|
    #define AL_FUNCTION       _export _far _pascal
 | 
						|
    #define AL_CFUNCTION      _export _far cdecl
 | 
						|
  #endif
 | 
						|
#else
 | 
						|
  #define AL_PROTO
 | 
						|
  #define AL_CLASS_TYPE
 | 
						|
  #define AL_DLL_FAR
 | 
						|
  #define AL_FUNCTION
 | 
						|
  #define AL_CFUNCTION
 | 
						|
#endif
 | 
						|
 | 
						|
/*
 | 
						|
 * All objects of type ALMonitor are set up to monitor jobs or objects.
 | 
						|
 * This enum is passed to the constructor to select which one is desired.
 | 
						|
 */
 | 
						|
enum ALMonitorType {
 | 
						|
    AL_MONITOR_OBJECTS,
 | 
						|
    AL_MONITOR_JOB
 | 
						|
};
 | 
						|
 | 
						|
/*
 | 
						|
 * An ALMonitor object can either send out byte counts or percentage
 | 
						|
 * complete ratios.  When constructing the object, this enum indicates
 | 
						|
 * which strategy is going to be used.
 | 
						|
 */
 | 
						|
enum ALWindowsMessageType {
 | 
						|
    AL_SEND_BYTE_COUNT,
 | 
						|
    AL_SEND_RATIO,
 | 
						|
};
 | 
						|
 | 
						|
/*
 | 
						|
 * Global enumerated error codes
 | 
						|
 */
 | 
						|
enum ALErrors {  
 | 
						|
        AL_CANT_OPEN_BUFFER = -1200,
 | 
						|
        AL_CANT_ALLOCATE_MEMORY,
 | 
						|
        AL_CANT_CREATE_ENGINE,
 | 
						|
        AL_CANT_CREATE_STORAGE_OBJECT,
 | 
						|
        AL_RENAME_ERROR,
 | 
						|
        AL_CANT_OPEN_FILE,
 | 
						|
        AL_SEEK_ERROR,
 | 
						|
        AL_READ_ERROR,
 | 
						|
        AL_WRITE_ERROR,
 | 
						|
        AL_DELETE_ERROR,
 | 
						|
        AL_ILLEGAL_PARAMETER,
 | 
						|
        AL_INTERNAL_ERROR,
 | 
						|
        AL_USER_ABORT,
 | 
						|
        AL_SERVER_NOT_PRESENT,
 | 
						|
        AL_COMPRESSION_TYPE_MISMATCH,
 | 
						|
        AL_NEED_LENGTH,
 | 
						|
        AL_CRC_ERROR,
 | 
						|
        AL_COMPARE_ERROR,
 | 
						|
        AL_UNKNOWN_COMPRESSION_TYPE,
 | 
						|
        AL_UNKNOWN_STORAGE_OBJECT,
 | 
						|
        AL_INVALID_ARCHIVE,
 | 
						|
        AL_LOGIC_ERROR,
 | 
						|
        AL_BACKUP_FAILURE,
 | 
						|
        AL_GETSEL_ERROR,
 | 
						|
        AL_DUPLICATE_ENTRY,
 | 
						|
        AL_END_OF_FILE = -1,
 | 
						|
        AL_SUCCESS = 0
 | 
						|
};
 | 
						|
 | 
						|
/*
 | 
						|
 * Enum used by ALName guys.  Names can either be forced to upper
 | 
						|
 * or lower case, or support normal mixed case representations.  Objects
 | 
						|
 * like MS-DOS file names should be forced to upper or lower, since the
 | 
						|
 * O/S keeps the names as case insensitive.
 | 
						|
 */
 | 
						|
 | 
						|
enum ALCase {
 | 
						|
    AL_UPPER,
 | 
						|
    AL_LOWER,
 | 
						|
    AL_MIXED
 | 
						|
};
 | 
						|
 | 
						|
/*
 | 
						|
 * Compressing levels used by the Greenleaf Engine.  In the archive, this
 | 
						|
 * ratio is stored in the engine private data.
 | 
						|
 */
 | 
						|
enum ALGreenleafCompressionLevels {
 | 
						|
    AL_GREENLEAF_COPY    = -1,
 | 
						|
    AL_GREENLEAF_LEVEL_0 = 0,
 | 
						|
    AL_GREENLEAF_LEVEL_1,
 | 
						|
    AL_GREENLEAF_LEVEL_2,
 | 
						|
    AL_GREENLEAF_LEVEL_3,
 | 
						|
    AL_GREENLEAF_LEVEL_4,
 | 
						|
};
 | 
						|
 | 
						|
/*
 | 
						|
 * Used when constructing ALWildCardExpander objects.  It decides whether
 | 
						|
 * the expander will traverse the entire subdirectory tree, or just stay
 | 
						|
 * on the current level.
 | 
						|
 */
 | 
						|
 | 
						|
enum ALTraverseSetting {
 | 
						|
    AL_TRAVERSE = 1,
 | 
						|
    AL_DONT_TRAVERSE = 0,
 | 
						|
};
 | 
						|
 | 
						|
/*
 | 
						|
 * The type of storage object.  This is stored in the base class, ALStorage,
 | 
						|
 * and is initialized in the constructor.
 | 
						|
 */
 | 
						|
enum ALStorageType {
 | 
						|
    AL_UNDEFINED     = -1,
 | 
						|
    AL_MEMORY_OBJECT = 0,
 | 
						|
    AL_FILE_OBJECT   = 1 };
 | 
						|
 | 
						|
/*
 | 
						|
 * The type of compression engine.  This is stored in the base class,
 | 
						|
 * ALEngine, and is initialized in the constructor.
 | 
						|
 */
 | 
						|
enum ALCompressionType {
 | 
						|
    AL_COMPRESSION_COPY = 0,
 | 
						|
    AL_COMPRESSION_GREENLEAF = 1
 | 
						|
};
 | 
						|
 | 
						|
#endif
 |