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

📄 environ.h

📁 arj source code
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * $Id: environ.h,v 1.12 2003/10/16 09:50:46 andrew_belov Exp $ * --------------------------------------------------------------------------- * All environment-specific declarations are held here. * */#ifndef ENVIRON_INCLUDED#define ENVIRON_INCLUDED/* First of all, let's try to guess what kind of compiler we're using. The   COMPILER macro will lead us all the way */#ifndef C_DEFS_INCLUDED                 /* All-time definitions */ #include "c_defs.h"#endif#define GENERIC                    0#define BCC                        1#define MSC                        2#define ICC                        3#define GCC                        4#define HIGHC                      5#define WCC                        6#define MSVC                       7#if defined(__TURBOC__)||defined(__BORLANDC__) #define COMPILER BCC#elif defined(_MSC_VER)||defined(_QC)  #ifdef _WIN32   #define COMPILER MSVC  #else   #define COMPILER MSC   #ifdef MSC_VER    #error BUG   #endif   #if (defined(_MSC_VER)&&_MSC_VER<600)||(!defined(_MSC_VER)&&defined(_QC))    #define MSC_ANCIENT                   /* Old-style Microsoft compiler */   #endif #endif#elif defined(__IBMC__)||defined(__IBMCPP__) #define COMPILER ICC#elif defined(__GNUC__) #define COMPILER GCC#elif defined(__WATCOMC__) #define COMPILER WCC #ifdef M_I386  #define __32BIT__ #endif#elif defined(__HIGHC__)||defined(__HIGHC_ANSI__)||defined(_OS2) #define COMPILER HIGHC #define __32BIT__#else #define COMPILER GENERIC#endif/* Now, make it clear about target OS */#define DOS                        1#define OS2                        2    /* OS/2-32 is OS2+__32BIT__ */#ifdef UNIX #undef UNIX#endif#define UNIX                       3#define WIN32                      4#if defined(_OS2)||defined(__OS2__)||defined(__EMX__) #define TARGET                  OS2#elif defined(_WIN32) #define TARGET                WIN32#elif defined(_UNIX) #define TARGET                 UNIX#else #define TARGET                  DOS#endif#if TARGET==DOS||TARGET==OS2&&!defined(__32BIT__) #define TILED#endif#if TARGET!=UNIX #define HAVE_DRIVES #define HAVE_VOL_LABELS#endif#if TARGET==OS2||TARGET==WIN32 #define HAVE_EAS#endif#include <ctype.h>#if COMPILER==BCC #include <alloc.h>#elif COMPILER==MSC||COMPILER==MSVC #include <malloc.h>#endif #include <errno.h> #include <string.h> #include <stdarg.h> #include <stdio.h> #if COMPILER==ICC&&defined(DEBUG)  #define __DEBUG_ALLOC__               /* For heap checking */ #endif #include <stdlib.h> #include <time.h>#if COMPILER==BCC #include <values.h>#else #include <limits.h>#endif#if TARGET!=UNIX #include <io.h>#endif#if COMPILER==BCC #include <dir.h>#elif COMPILER!=GCC && !defined(SUNOS) #include <direct.h>#endif/* OS-dependent headers */#if TARGET==DOS #include <dos.h>#elif TARGET==OS2 #define INCL_BASE #include <os2.h>#elif TARGET==WIN32 #include <windows.h>#elif TARGET==UNIX #include <dirent.h> #include <sys/types.h> #include <sys/stat.h>                  /* For dev_t, chmod(), etc. */#endif/* Keywords remapping */#if !defined(TILED) #ifndef _WIN32  #define FAR  #define NEAR #endif #define S_NEAR#elif COMPILER==BCC #define FAR                     far #define NEAR                   near #define S_NEAR                 NEAR#elif COMPILER==MSC #if TARGET==DOS  #ifdef MSC_ANCIENT   #define FAR                   far   #define NEAR                 near  #else   #define FAR                  _far   #define NEAR                _near  #endif #endif #ifndef MSC_ANCIENT  #define asm                   _asm #endif #define S_NEAR                 NEAR#else #error *** A FAR/NEAR translation must be defined for this compiler!#endif/* Special functions enablement */#if COMPILER==MSC #define FINETUNE_BUFSIZ                /* Alternate adjustment method */#endif#if defined(TILED)&&!defined(MSC_ANCIENT) #define ASM8086                        /* Enable assembly routines */#endif/* Library functions/equates remapping */#if !defined(TILED) #define farfree                free #define farmalloc            malloc #define farrealloc          realloc #define farcalloc            calloc #define coreleft()          1048576    /* Don't know/care about it */#elif COMPILER==MSC #define farfree              _ffree #define farmalloc(s) _fmalloc((size_t)s) #define farrealloc(p, s)  _frealloc(p, (size_t)s) #define farcalloc(n, s) _fcalloc((size_t)(n), (size_t)(s)) #define coreleft            _memmax    /* Size of largest unallocated block */#endif#if COMPILER==MSC #define findfirst    _dos_findfirst #define findnext      _dos_findnext #define getvect        _dos_getvect #define setvect        _dos_setvect #ifdef MSC_ANCIENT  #define _far                   far #endif #if _MSC_VER>=0x0700  #define diskfree_t     _diskfree_t  #define dosdate_t       _dosdate_t  #define dostime_t       _dostime_t  #define _far                 __far  #define find_t             _find_t  #define _interrupt     __interrupt  #define rccoord          __rccoord  #define stackavail     _stackavail  #define strlwr             _strlwr  #define strupr             _strupr  #define videoconfig  __videoconfig #else  #define _close               close  #define _chmod               chmod  #define _creat               creat  #define _open                 open  #define _read                 read  #define _write               write #endif #if _MSC_VER<600  #define _fcalloc           fcalloc  #define _fmemcmp           fmemcmp  #define _fmemset           fmemset  #define _frealloc         frealloc  #define _fstrcat           fstrcat  #define _fstrchr           fstrchr  #define _fstrcmp           fstrcmp  #define _fstrcpy           fstrcpy  #define _fstrlen           fstrlen #endif#endif#if (COMPILER==MSC&&_MSC_VER>=0x0700)||COMPILER==IBMC||COMPILER==HIGHC||TARGET==OS2&&defined(LIBC) #define filelength      _filelength #define fcloseall        _fcloseall#endif#if COMPILER==BCC||COMPILER==MSC #define _lseek                lseek#endif#if COMPILER==ICC||COMPILER==HIGHC #define mkdir                _mkdir#endif#if TARGET==UNIX #ifndef __QNXNTO__    #define O_BINARY                  0    /* N/A under UNIX */ #endif /* __QNXNTO__ */ #define _lseek                lseek #define _open                  open #define _write                write #define _read                  read #define _close                close#endif/* BSD 4.3 LIBC forwarders */#ifdef HAVE_STRCASECMP #define stricmp          strcasecmp #define strnicmp        strncasecmp#endif/* Watcom variables remapping: the "-5r" convention requires this */#if TARGET==OS2&&COMPILER==WCC&&defined(LIBC) #pragma aux stdin "*" #pragma aux stdout "*" #pragma aux stderr "*" #pragma aux stdaux "*" #pragma aux stdprn "*" #pragma aux _timezone "*" #pragma aux _daylight "*" #pragma aux errno "*"#endif/* MetaWare High C/C++, GCC, etc. add-ons */#if !defined(HAVE_MIN)&&!defined(min) #define min(a, b) ((a)<(b)?(a):(b))#endif#if !defined(HAVE_MAX)&&!defined(max) #define max(a, b) ((a)>(b)?(a):(b))#endif/* Structures that are already present in Borland C but missing from MS C */#if COMPILER!=BCC/* DOS FCB */struct fcb{ char fcb_drive; char fcb_name[8]; char fcb_ext[3]; short fcb_curblk; short fcb_recsize; long fcb_filsize; short fcb_date; char fcb_resv[10]; char fcb_currec; long fcb_random;};/* DOS Extended FCB */struct xfcb{ char xfcb_flag; char xfcb_resv[5]; char xfcb_attr; struct fcb xfcb_fcb;};/* Time structure */struct time{ unsigned char ti_min; unsigned char ti_hour; unsigned char ti_hund; unsigned char ti_sec;};/* Date structure */struct date{ int da_year; char da_day; char da_mon;};#endif/* Far pointer creation macro */#ifndef MK_FP #define MK_FP(seg,ofs)  ((void FAR *)(((unsigned long)seg<<16)+(unsigned long)ofs))#endif/* Far memory comparision macro/function */#if !defined(TILED) #define far_memcmp           memcmp#elif COMPILER==BCC #include "fmemcmp.h"#elif COMPILER==MSC #define far_memcmp         _fmemcmp#endif/* Error message output */#if COMPILER==BCC #define error_report() msg_cprintf(H_ERR, M_ERROR_CODE, errno, strerror(errno)) #define error_freport() msg_cprintf(H_ERR, M_ERROR_CODE, errno, strerror(errno))#else /* LIBCS.DLL complains about missing message resources */ #if defined(LIBC)&&TARGET==OS2  #define error_report() #else  #define error_report() \          { \           msg_cprintf(H_ERR, M_ERROR_CODE, errno, strerror(errno)); \           msg_cprintf(H_ERR, (FMSG *)lf); \          } #endif#endif/* Signal handler parameter set */#if COMPILER==BCC #define SIGHDLPARAMS#else #define SIGHDLPARAMS        int sig#endif/* Host operating system. Note that OS codes are defined separately in   DEFINES.H, so this macro has no effect until DEFINES.H is included. */#if TARGET==DOS #define OS                   OS_DOS#elif TARGET==OS2 #define OS                   OS_OS2#elif TARGET==UNIX #define OS                  OS_UNIX#elif TARGET==WIN32 #define OS                 OS_WIN32#endif/* Case sensitivity (under OS/2, this actually depends on the IFS used!) */#if TARGET!=UNIX #define CASE_INSENSITIVE#endif/* Maximum size of path/path component */#if TARGET==OS2||defined(__TILED__) #define CCHMAXPATH              260 #define CCHMAXPATHCOMP          256#else #define CCHMAXPATH              512 #define CCHMAXPATHCOMP   CCHMAXPATH#endif/* Our own archive filename storage */#ifdef FILENAME_MAX #undef FILENAME_MAX                    /* Already defined in some compilers */#endif#if TARGET==DOS #define FILENAME_MAX            500#else #define FILENAME_MAX            512#endif/* Wildcard equates */#define WC_RESERVE                10    /* Number of bytes to reserve for w/c *//* Length of screen-wide strings */#define INPUT_LENGTH              80    /* Used in various queries */#define TXTD_LENGTH               78    /* Used when displaying found text *//* Length of command lines */#if TARGET==DOS #define CMDLINE_LENGTH          160#elif TARGET==OS2 #define CMDLINE_LENGTH          264#else #define CMDLINE_LENGTH          512    /* ASR fix: applies to Unices too!                                           15/01/2003 -- Win32 preparations */#endif/* Number of command-line parameters. It must NOT be too high since some arrays   are based on its value */#if TARGET==DOS #define PARAMS_MAX               64    /* parameters+spaces: 64*2=128 */ #define SFLIST_MAX               64    /* ARJSFX filelist array limit */#elif TARGET==OS2 #define PARAMS_MAX              131    /* ~262 */ #define SFLIST_MAX              131#else #define PARAMS_MAX             1024    /* May be less on some platforms */ #define SFLIST_MAX             1024#endif/* FAR memory block size limit */#ifdef TILED #if COMPILER==BCC  #define FAR_BLK_MAX           65535 #elif COMPILER==MSC  #define FAR_BLK_MAX           65512 #else  #define FAR_BLK_MAX           65535 #endif #define FLIST_ALLOC_MAX  FAR_BLK_MAX#elif TARGET==OS2 #define FAR_BLK_MAX        469762048   /* Unless it's Aurora */ #define FLIST_ALLOC_MAX        65535#else #define FAR_BLK_MAX        524288000   /* ASR fix 27/10/2002: larger                                           values overflow the 2G limit in                                           FILELIST.C, leading to                                           ARJSFXV/Linux failure */ #define FLIST_ALLOC_MAX        65535#endif/* CFA block increments. It will be wise to keep them proportional to the   page size under OS/2, and memory-conserving under DOS. As a sidenote, this   significantly reduces the memory requirements for ARJ under DOS. */#if TARGET==OS2 #define CFA_BLOCK_SIZE        16384#elif defined(TILED) #define CFA_BLOCK_SIZE         4096#else #define CFA_BLOCK_SIZE        16384    /* Presume i386 paged RAM */#endif/* Maximum # of files in the filelist. No longer an environment limit but   a marketing logic! */#define FILELIST_INCREMENT       256    /* Increment count for order blocks *//* In original ARJ, there was a "commercial" filelist capacity (EXT LIC). The   shareware/ordinary license limit was FLIST_ALLOC_MAX-1. */#define EXT_FILELIST_CAPACITY ((unsigned long)FAR_BLK_MAX*4-5)#define FILELIST_CAPACITY (FLIST_ALLOC_MAX-1)#define FLIST_SPEC_BASE FILELIST_CAPACITY /* Special entries start here */

⌨️ 快捷键说明

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