home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / hdf / hdf.lha / DFI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-06  |  20.1 KB  |  559 lines

  1. /*****************************************************************************
  2. *              NCSA HDF version 3.10r2
  3. *                July 1, 1990
  4. *
  5. * NCSA HDF Version 3.10r2 source code and documentation are in the public
  6. * domain.  Specifically, we give to the public domain all rights for future
  7. * licensing of the source code, all resale rights, and all publishing rights.
  8. * We ask, but do not require, that the following message be included in all
  9. * derived works:
  10. * Portions developed at the National Center for Supercomputing Applications at
  11. * the University of Illinois at Urbana-Champaign.
  12. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  13. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  14. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  15. *****************************************************************************/
  16.  
  17. #ifdef RCSID
  18. static char RcsId[] = "@(#)$Revision: 3.14 $"
  19. #endif
  20. /*
  21. $Header: /pita/work/HDF/dev/RCS/src/dfi.h,v 3.14 90/10/02 14:16:49 clow beta $
  22. $Log:    dfi.h,v $
  23.  * Revision 3.14  90/10/02  14:16:49  clow
  24.  * fixed error in the define of DFmovmem in the MIPSEL segment
  25.  * 
  26.  * Revision 3.13  90/09/18  15:09:10  clow
  27.  * Added MIPSEL to 'list of approved machine types'
  28.  * 
  29.  * Revision 3.12  90/09/14  12:49:07  mfolk
  30.  * *** empty log message ***
  31.  * 
  32.  * Revision 3.11  90/08/30  14:51:59  mfolk
  33.  * Add DFMT_MIPSEL  0x4441 machine type and #ifdef section for MIPSEL.
  34.  * This should cover DEC3100 needs.
  35.  * 
  36.  * Revision 3.10  90/07/31  13:30:15  mfolk
  37.  * Added typedef double float64; to all machine types, so that this
  38.  * dfi.h would work with fp2hdf as changed by INEL.  (Mike Folk)
  39.  * 
  40.  * Revision 3.9  90/07/16  11:25:56  clow
  41.  * added #if's so that the compiler will complain if MACHINE is set wrongly.
  42.  * 
  43.  * Revision 3.8  90/07/05  17:00:08  clow
  44.  * Changed the lower value of DF_TBUF 512
  45.  * 
  46.  * Revision 3.7  90/06/28  09:41:26  clow
  47.  * Added segment for APOLLO machines
  48.  * 
  49.  * Revision 3.6  90/05/23  15:47:37  clow
  50.  * added MACRO "DF_OPENERR" to give uniform error open checking,
  51.  * especially for unbufferred I/O open
  52.  * 
  53.  * Revision 3.5  90/05/18  11:09:12  clow
  54.  * added missing #endif
  55.  * 
  56.  * Revision 3.4  90/05/17  17:06:00  clow
  57.  * added _fcd and _fcdtocp for LS FORTRAN so we don't have to go through
  58.  * an extra layer of Fortran stubs
  59.  * 
  60.  * Revision 3.4  90/05/17  16:04:14  clow
  61.  * added _fcd and _fcdtocp for LS FORTRAN so we don't have to go through
  62.  * an extra layer of Fortran stubs
  63.  * 
  64.  * Revision 3.3  90/05/14  23:15:45  clow
  65.  * added definition of MACRO "FCALLKEYW"
  66.  * 
  67. */
  68. /*-----------------------------------------------------------------------------
  69.  * File:    dfi.h
  70.  * Purpose: HDF internal header file
  71.  * Invokes: stdio.h, sys/file.h
  72.  * Contents: 
  73.  *  Compilation parameters
  74.  *  Machine-dependent definitions
  75.  *  Flexibility definitions: i/o buffering, dynamic memory, structure i/o
  76.  *  Size parameters
  77.  * Remarks: To port to a new system, only dfi.h and Makefile need be modified.
  78.  *          This file is included with user programs, but users do not see it.
  79.  *---------------------------------------------------------------------------*/
  80.  
  81.  
  82. #ifndef DF_MAGICK        /* avoid re-inclusion */
  83.  
  84. #define    DF_MAGICK    "\016\003\023\001" /* ^N^C^S^A */
  85.  
  86. #ifndef FILE
  87. #include <stdio.h>
  88. #endif /*FILE*/
  89.  
  90. /*--------------------------------------------------------------------------*/
  91. /*          Compilation Parameters for Flexibility and Portability          */
  92.  
  93. /* modify this line to allow for machine dependencies */
  94. /*#define    SUN*/
  95. /**IMPORTANT** this is now in the in the makefile */
  96.  
  97. #if !defined(SUN) && !defined(SUN386) && !defined(VMS) && !defined(ALLIANT)
  98. #if !defined(IRIS4) && !defined(MAC) && !defined(UNICOS) && !defined(MIPSEL)
  99. if there is error on this line, the MACHINE type is defined wrong!!!
  100. #endif
  101. #endif
  102.  
  103. /* modify this line for buffered/unbuffered i/o */
  104. #define    DF_BUFFIO
  105.  
  106. /* modify this line for dynamic/static memory allocation */
  107. #define    DF_DYNAMIC
  108.  
  109. /* modify this line if structures cannot be read/written as is */
  110. #undef    DF_STRUCTOK        /* leave it this way - hdfsh expects it */
  111.  
  112. /* Current version number */
  113. #define    DFVERSION   3.00
  114.  
  115. /*--------------------------------------------------------------------------*/
  116. /*                              MT/NT constants                             */
  117. /*      four MT nibbles represent int, float, double, uchar                 */
  118. #define    DFMT_SUN        0x1111
  119. #define    DFMT_ALLIANT    0x1111
  120. #define    DFMT_IRIS4      0x1111
  121. #define DFMT_APOLLO    0x1111
  122. #define    DFMT_UNICOS     0x3331
  123. #define    DFMT_CTSS       0x3331
  124. #define    DFMT_VAX        0x2221
  125. #define DFMT_MIPSEL     0x4441
  126. #define    DFMT_PC         0x4144    /* note byte swapping ??? */
  127.                 /* check this... */
  128. #define    DFMT_MAC        0x1111
  129. #define DFMT_SUN386    0x1444
  130.  
  131. #define    DFNT_VERSION    1    /* current version of NT info */
  132.  
  133. /* type info codes */
  134. #define    DFNT_UINT       1
  135. #define    DFNT_INT        2
  136. #define    DFNT_UCHAR      3
  137. #define    DFNT_CHAR       4
  138. #define    DFNT_FLOAT      5
  139. #define    DFNT_DOUBLE     6
  140.  
  141. /* class info codes for int */
  142. #define    DFNTI_MBO       1    /* Motorola byte order 2's compl */
  143. #define    DFNTI_VBO       2    /* Vax byte order 2's compl */
  144. #define    DFNTI_IBO       4    /* Intel byte order 2's compl */
  145.  
  146. /* class info codes for float */
  147. #define    DFNTF_IEEE      1    /* IEEE format */
  148. #define    DFNTF_VAX       2    /* Vax format */
  149. #define    DFNTF_CRAY      3    /* Cray format */
  150. #define    DFNTF_PC        4    /* PC floats - flipped IEEE */
  151.  
  152. /* class info codes for char */
  153. #define    DFNTC_BYTE      0    /* bitwise/numeric field */
  154. #define    DFNTC_ASCII     1    /* ASCII */
  155. #define    DFNTC_EBCDIC    5    /* EBCDIC */
  156.  
  157. /* array order */
  158. #define    DFO_FORTRAN     1    /* column major order */
  159. #define    DFO_C           2    /* row major order */
  160.  
  161. /*--------------------------------------------------------------------------*/
  162. /*                      Machine dependencies                                */
  163. #ifdef PC
  164. #ifndef O_RDONLY
  165. #include <fcntl.h>
  166. #define    L_INCR  1
  167. #endif /*O_RDONLY*/
  168. typedef    int int16;
  169. typedef    unsigned int uint16;
  170. typedef    long int int32;
  171. typedef    double float32;
  172. #define    DFmovmem(from, to, len) memcpy(to, from, len)
  173. #undef DF_STRUCTOK                  /* structure writing will not work on PC */
  174. #undef DF_BUFFIO                    /* unbuffered i/o is faster */
  175. long longswap();                    /* provided elsewhere */
  176.  
  177.     /* in the next 3 lines, p is recast so right number of bytes passed */
  178.     /* ### Note that all calls modify p.  Need to use temporary ptr */
  179. #define    UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  180. #define    INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
  181. #define    INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  182.             x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  183. #define    UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  184. #define    INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  185. #define    INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  186.             *p++ = (x>>8) & 255; *p++ = x & 255; }
  187. #define    DF_CREAT(name, prot) creat(name, prot)
  188. #define    DF_MT   DFMT_PC
  189. #endif /*PC*/
  190.  
  191.  
  192. #ifdef UNICOS
  193. #ifndef O_RDONLY
  194. #include <sys/fcntl.h>              /* for unbuffered i/o stuff */
  195. #define    L_INCR  1
  196. #endif /*O_RDONLY*/
  197. typedef    int int16;
  198. typedef    int uint16;
  199. typedef    int int32;
  200. typedef    float float32;
  201. typedef double float64;
  202. #define    DFmovmem(from, to, len) memcpy(to, from, len)
  203. #undef DF_STRUCTOK          /* cannot directly read/write structures */
  204. #define    DF_CAPFNAMES            /* fortran names are in all caps */
  205. #define    UINT16READ(p, x)    { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  206. #define    INT16READ(p, x)     { x = (*p++)<<8; x |= (*p++) & 255; }
  207. #define    INT32READ(p, x)     { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  208.                                 x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  209. #define    UINT16WRITE(p, x)   { *p++ = (x>>8) & 255; *p++ = x & 255; }
  210. #define    INT16WRITE(p, x)    { *p++ = (x>>8) & 255; *p++ = x & 255; }
  211. #define    INT32WRITE(p, x)    { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;   \
  212.                                 *p++ = (x>>8) & 255; *p++ = x & 255; }
  213. #define    DF_CREAT(name, prot) creat(name, prot)
  214. #define    DF_MT   DFMT_UNICOS
  215. #endif /*UNICOS*/
  216.  
  217.  
  218. #ifdef SUN
  219. #if ! defined mc68010 && ! defined mc68020 && ! defined mc68030
  220. #undef DF_STRUCTOK
  221. #endif
  222. /*#include <file.h>    */           /* for unbuffered i/o stuff */
  223. typedef    short int16;
  224. typedef    unsigned short uint16;
  225. typedef    long int32;
  226. typedef    float float32;
  227. typedef double float64;
  228. #define    DFmovmem(from, to, len) memcpy(to, from, len)
  229. #ifndef DF_STRUCTOK
  230. #define    UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  231. #define    INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
  232. #define    INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  233.             x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  234. #define    UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  235. #define    INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  236. #define    INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  237.             *p++ = (x>>8) & 255; *p++ = x & 255; }
  238. #endif /*DF_STRUCTOK*/
  239. #define    DF_CREAT(name, prot) creat(name, prot)
  240. #define    DF_MT   DFMT_SUN
  241. #endif /*SUN*/
  242.  
  243. #ifdef SUN386
  244. #undef DF_STRUCTOK
  245. #include <sys/file.h>               /* for unbuffered i/o stuff */
  246. typedef    short int16;
  247. typedef    unsigned short uint16;
  248. typedef    long int32;
  249. typedef    float float32;
  250. typedef double float64;
  251. #define    DFmovmem(from, to, len) memcpy(to, from, len)
  252. #ifndef DF_STRUCTOK
  253. #define    UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  254. #define    INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
  255. #define    INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  256.             x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  257. #define    UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  258. #define    INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  259. #define    INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  260.             *p++ = (x>>8) & 255; *p++ = x & 255; }
  261. #endif /*DF_STRUCTOK*/
  262. #define    DF_CREAT(name, prot) creat(name, prot)
  263. #define    DF_MT   DFMT_SUN386
  264. #endif /* SUN386 */
  265.  
  266. #ifdef ALLIANT
  267. #include <sys/file.h>               /* for unbuffered i/o stuff */
  268. typedef    short int16;
  269. typedef    unsigned short uint16;
  270. typedef    long int32;
  271. typedef    float float32;
  272. typedef double float64;
  273. #define    DFmovmem(from, to, len) bcopy(from, to, len)
  274. #ifndef DF_STRUCTOK
  275. #define    UINT16READ(p, x)    { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  276. #define    INT16READ(p, x)     { x = (*p++)<<8; x |= (*p++) & 255; }
  277. #define    INT32READ(p, x)     { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  278.                                 x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  279. #define    UINT16WRITE(p, x)   { *p++ = (x>>8) & 255; *p++ = x & 255; }
  280. #define    INT16WRITE(p, x)    { *p++ = (x>>8) & 255; *p++ = x & 255; }
  281. #define    INT32WRITE(p, x)    { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;   \
  282.                                 *p++ = (x>>8) & 255; *p++ = x & 255; }
  283. #endif /*DF_STRUCTOK*/
  284. #define    DF_CREAT(name, prot) creat(name, prot)
  285. #define    DF_MT   DFMT_ALLIANT
  286. #endif /*ALLIANT*/
  287.  
  288.  
  289. #ifdef IRIS4
  290. #undef DF_STRUCTOK
  291. #include <sys/types.h>
  292. #include <sys/file.h>               /* for unbuffered i/o stuff */
  293. typedef    short int16;
  294. typedef    unsigned short uint16;
  295. typedef    long int32;
  296. typedef    float float32;
  297. typedef double float64;
  298. #define    DFmovmem(from, to, len) bcopy(from, to, len)
  299. #ifndef DF_STRUCTOK
  300. #define    UINT16READ(p, x)    { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  301. #define INT16READ(p, x)     { x = (*p++)<<8; x |= (*p++) & 255; }
  302. #define INT32READ(p, x)     { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  303.                                 x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  304. #define UINT16WRITE(p, x)   { *p++ = (x>>8) & 255; *p++ = x & 255; }
  305. #define INT16WRITE(p, x)    { *p++ = (x>>8) & 255; *p++ = x & 255; }
  306. #define INT32WRITE(p, x)    { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;   \
  307.                                 *p++ = (x>>8) & 255; *p++ = x & 255; }
  308. #endif /*DF_STRUCTOK*/
  309. #define DF_CREAT(name, prot) creat(name, prot)
  310. #define DF_MT   DFMT_IRIS4
  311. #endif /*IRIS4*/
  312.  
  313.  
  314. #ifdef MIPSEL
  315. #undef DF_STRUCTOK
  316. #include <sys/types.h>
  317. #include <sys/file.h>               /* for unbuffered i/o stuff */
  318. typedef short int16;
  319. typedef unsigned short uint16;
  320. typedef long int32;
  321. typedef float float32;
  322. typedef double float64;
  323. #define DFmovmem(from, to, len) memcpy(to, from, len)
  324. #ifndef DF_STRUCTOK
  325. #define UINT16READ(p, x)    { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  326. #define INT16READ(p, x)     { x = (*p++)<<8; x |= (*p++) & 255; }
  327. #define INT32READ(p, x)     { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  328.                               x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  329. #define UINT16WRITE(p, x)   { *p++ = (x>>8) & 255; *p++ = x & 255; }
  330. #define INT16WRITE(p, x)    { *p++ = (x>>8) & 255; *p++ = x & 255; }
  331. #define INT32WRITE(p, x)    { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  332.                               *p++ = (x>>8) & 255; *p++ = x & 255; }
  333. #endif /*DF_STRUCTOK*/
  334. #define DF_CREAT(name, prot) creat(name, prot)
  335. #define DF_MT   DFMT_MIPSEL
  336. #endif /*MIPSEL*/
  337.  
  338.  
  339. #ifdef MAC
  340. #undef DF_BUFFIO        /* use unbuffered i/o */
  341. #include <memory.h>             /* malloc stuff for MPW 3.0 */
  342. #include <fcntl.h>              /* unbuffered IO stuff for MPW 3.0 */
  343. #ifdef THINK_C                  /* for LightSpeed C */
  344. #include <unix.h>
  345. #else /*THINK_C                   MPW, possibly others */
  346. #include <Files.h>              /* for unbuffered i/o stuff */
  347. #endif /*THINK_C*/
  348. #define    DF_CAPFNAMES            /* fortran names are in all caps */
  349. #define DF_DYNAMIC        /* use dynamic allocation */
  350. typedef short int16;
  351. typedef unsigned short uint16;
  352. typedef long int32;
  353. typedef float float32;
  354. typedef double float64;
  355. #ifdef THINK_C                   /* LightSpeed C does not have memcpy */
  356. #define DFmovmem(from, to, len) DFImemcopy(from, to, len)
  357. #else /*THINK_C*/
  358. #define DFmovmem(from, to, len) memcpy(to, from, len)
  359. #endif /*THINK_C*/
  360. #define malloc(x)   NewPtr((Size)   (x))    /* don't use malloc on the Mac */
  361. #define free(x)     DisposPtr((Ptr) (x))    /* don't use free on the Nac   */ 
  362. #undef DF_STRUCTOK
  363. #define UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  364. #define INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
  365. #define INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  366.             x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  367. #define UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  368. #define INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  369. #define INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  370.             *p++ = (x>>8) & 255; *p++ = x & 255; }
  371. #define DF_CREAT(name, prot) mopen(name, O_WRONLY|O_TRUNC|O_CREAT)
  372. #define DF_MT   DFMT_MAC
  373. #endif /*MAC*/
  374.  
  375. #ifdef VMS
  376. /*#undef DF_BUFFIO should be buff !!!!*/
  377.    /* use only unbuff i/o - buff doesn't work! */
  378. #ifndef DFopen                  /* avoid double includes */
  379. #include "dfivms.h"
  380. #endif /*DFopen*/
  381. #undef DF_STRUCTOK
  382. #define DF_CAPFNAMES            /* fortran names are in all caps */
  383. #include <file.h>               /* for unbuffered i/o stuff */
  384. typedef short int16;
  385. typedef unsigned short uint16;
  386. typedef long int32;
  387. typedef float float32;
  388. typedef double float64;
  389. #define DFmovmem(from, to, len) memcpy(to, from, len)
  390. #ifndef DF_STRUCTOK
  391. #define UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  392. #define INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
  393. #define INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  394.             x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  395. #define UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  396. #define INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  397. #define INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  398.             *p++ = (x>>8) & 255; *p++ = x & 255; }
  399. #endif /*DF_STRUCTOK*/
  400. #define DF_CREAT(name, prot) creat(name, prot)
  401. #define DF_MT   DFMT_VAX
  402. #endif /*VMS*/
  403.  
  404. #ifdef APOLLO
  405. #if ! defined mc68010 && ! defined mc68020 && ! defined mc68030
  406. #undef DF_STRUCTOK
  407. #endif
  408. #include <sys/file.h>               /* for unbuffered i/o stuff */
  409. #define int16 short
  410. #define uint16 unsigned short
  411. #define int32 long
  412. #define float32 float
  413. #define DFmovmem(from, to, len) memcpy(to, from, len)
  414. #ifndef DF_STRUCTOK
  415. #define UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
  416. #define INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
  417. #define INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
  418.             x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
  419. #define UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  420. #define INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
  421. #define INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
  422.             *p++ = (x>>8) & 255; *p++ = x & 255; }
  423. #endif /*DF_STRUCTOK*/
  424. #define DF_CREAT(name, prot) creat(name, prot)
  425. #define DF_MT   DFMT_APOLLO
  426. #endif /*APOLLO*/
  427.  
  428.  
  429. /*--------------------------------------------------------------------------*/
  430. /*                      Flexibility parameters                              */
  431. #ifdef MAC            /* MAC specific file manager calls */
  432. #    define DF_OPEN(x,y) mopen(x,y)
  433. #    define DF_CLOSE(x) mclose(x)
  434. #    define DF_SEEK(x,y,z) mlseek(x,y,z)
  435. #    define DF_SKEND(x,y,z) mlseek(x,-1*y,z)
  436. #    define DF_TELL(x) mlseek(x,0L,1)
  437. #    define DF_READ(a,b,c,d) mread(d,a,b*c)
  438. #    define DF_WRITE(a,b,c,d) mwrite(d,a,b*c)
  439. #    define DF_FLUSH(a)            /* no need to flush */
  440. #    define DF_RDACCESS 0        /* dummy */
  441. #    define DF_WRACCESS 0        /* dummy */
  442. #    define DF_OPENERR(f)    ((f) == -1)
  443. #else /* !MAC */
  444. #ifdef DF_BUFFIO            /* set all calls to do buffered I/O */
  445. #define DF_OPEN(x,y) fopen(x,y)
  446. #define DF_CLOSE(x) fclose(x)
  447. #define DF_SEEK(x,y,z) fseek(x,y,z)
  448. #define DF_SKEND(x,y,z) fseek(x,y,z)
  449. #define DF_TELL(x) ftell(x)
  450. #define DF_READ(a,b,c,d) fread(a,b,c,d)
  451. #define DF_WRITE(a,b,c,d) fwrite(a,b,c,d)
  452. #define DF_FLUSH(a) fflush(a)
  453. #define DF_OPENERR(f)    (!(f))
  454. #ifdef PC
  455. #define DF_RDACCESS "rb"
  456. #define DF_WRACCESS "rb+"
  457. #else /*PC*/
  458. #define DF_RDACCESS "r"
  459. #define DF_WRACCESS "r+"
  460. #endif /*PC*/
  461.  
  462. #else /*DF_BUFFIO         unbuffered i/o */
  463. #define DF_OPEN(x,y) open(x,y)
  464. #define DF_CLOSE(x) close(x)
  465. #define DF_SEEK(x,y,z) lseek(x,y,z)
  466. #define DF_SKEND(x,y,z) lseek(x,-1*y,z)
  467. #define DF_TELL(x) lseek(x,0L,1)
  468. #define DF_READ(a,b,c,d) read(d,a,b*c)
  469. #define DF_WRITE(a,b,c,d) write(d,a,b*c)
  470. #define DF_OPENERR(f)    ((f) == -1)
  471. #define DF_FLUSH(a)                             /* no need to flush */
  472. #  ifdef PC
  473. #    define DF_RDACCESS O_RDONLY | O_RAW
  474. #    define DF_WRACCESS O_RDWR | O_RAW
  475. #  else 
  476. #    define DF_RDACCESS O_RDONLY
  477. #    define DF_WRACCESS O_RDWR
  478. #  endif /*!PC*/
  479. #endif /*DF_BUFFIO*/
  480. #endif /* !MAC */
  481.  
  482.  
  483.     /* if not allocating memory dynamically, need buffer for compression */
  484. #ifndef DF_DYNAMIC
  485. #define DF_TBUF
  486. #define DF_TBUFSZ    10000    /* buffer size */
  487. #endif /*DF_DYNAMIC*/
  488.  
  489.     /* if reading/writing structures not ok, need buffer for conversion */
  490. #ifndef DF_TBUF
  491. #ifndef DF_STRUCTOK
  492. #define DF_TBUF
  493. #define DF_TBUFSZ    512    /* buffer size can be smaller */
  494. #endif /*DF_STRUCTOK*/
  495. #endif /*DF_TBUF*/
  496.  
  497.     /* set buffer size */
  498. #ifdef DF_TBUF
  499. #ifndef DFMASTER
  500. extern
  501. #endif /*DFMASTER*/
  502.     char DFtbuf[DF_TBUFSZ];
  503. #endif /*DF_TBUF*/
  504.  
  505. /* VMS str descriptor conversion macro */
  506. #if defined(VMS)
  507. #   define _fcdtocp(desc) ((char *) *((char **) &desc[4]))
  508.     typedef char *_fcd;
  509. #else /* !VMS */
  510. #if defined(UNICOS)
  511. #   include <fortran.h>
  512. #else /* !VMS && !UNICOS */
  513. #if defined(MAC)        /* with LS_FORTRAN */
  514. #   define _fcdtocp(descp) (*((char**)(descp)))
  515.     typedef char** _fcd;
  516. #else /* !VMS && !UNICOS && !MAC */
  517. #   define _fcdtocp(desc) (desc)
  518.     typedef char *_fcd;
  519. #endif
  520. #endif /* !VMS && !UNICOS */
  521. #endif /* !VMS */
  522.  
  523. /* 
  524. MACRO FCALLKEYW for any special fortran-C stub keyword
  525.  
  526. MacIntosh MPW LS-fortran needs pascal since it can interface best with
  527. pascal functions
  528. */
  529. #if defined(MAC)        /* with LS FORTRAN */
  530. #   define FCALLKEYW    pascal
  531. #else /* !MAC */
  532. #   define FCALLKEYW    /*NONE*/
  533. #endif
  534.  
  535. /*--------------------------------------------------------------------------*/
  536. /*                          Size parameters                                 */
  537. #define DF_MAXDFS           32  /* How many DF's can be open at once */
  538. #define DF_DEFAULTDDS       16  /* How many DD's a file has by default */
  539. #define DF_MAXFNLEN         256 /* maximum length of filename parameters */
  540.  
  541. #ifndef MAC
  542. char *strncpy();
  543. char *strcpy();
  544. #ifdef AMIGA
  545. extern void *malloc();
  546. extern void *memcpy();
  547. #else
  548. char *malloc();
  549. char *memcpy();
  550. #endif /* AMIGA */
  551. #endif /* !MAC */
  552.  
  553. #endif /*DF_MAGICK*/
  554.