home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / hdf / unix / hdf3_2r2 / src / hdfi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-04  |  26.6 KB  |  837 lines

  1. /***************************************************************************
  2. *
  3. *
  4. *                         NCSA HDF version 3.2r2
  5. *                            October 30, 1992
  6. *
  7. * NCSA HDF Version 3.2 source code and documentation are in the public
  8. * domain.  Specifically, we give to the public domain all rights for future
  9. * licensing of the source code, all resale rights, and all publishing rights.
  10. *
  11. * We ask, but do not require, that the following message be included in all
  12. * derived works:
  13. *
  14. * Portions developed at the National Center for Supercomputing Applications at
  15. * the University of Illinois at Urbana-Champaign, in collaboration with the
  16. * Information Technology Institute of Singapore.
  17. *
  18. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  19. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  20. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  21. *
  22. ****************************************************************************
  23. */
  24.  
  25. /*
  26. $Header: /hdf/hdf/v3.2r2/src/RCS/hdfi.h,v 1.13 1992/10/23 19:51:58 koziol beta koziol $
  27.  
  28. $Log: hdfi.h,v $
  29.  * Revision 1.13  1992/10/23  19:51:58  koziol
  30.  * Added _HUGE keyword for MS-Windows and MS-DOS compatibility.  On
  31.  * all other machines it gets pre-processed out.  Please use this
  32.  * in all future prototype declarations with pointers in them.
  33.  *
  34.  * Revision 1.12  1992/10/23  00:21:45  koziol
  35.  * Fixed typo in WINIO declaration
  36.  *
  37.  * Revision 1.11  1992/10/23  00:14:11  koziol
  38.  * Changed all DFIstr*() and DFImem*() calls to HDstr*() and HDmem*() calls
  39.  * #ifdef'd out the macros Jason defined for Hopen, Hclose, etc. for Vsets
  40.  * Replaced Vset VFREESPACE and VGETSPACE calls with actual calls to HDfreespace
  41.  * and HDgetspace
  42.  * Added a MS-Windows lower lower for file I/O (which may not be completely working
  43.  *
  44.  * Revision 1.9  1992/10/12  18:11:51  koziol
  45.  * Updated for v3.2r2 release
  46.  *
  47.  * Revision 1.8  1992/09/28  17:05:50  koziol
  48.  * Removed "#define BSD" from NeXT section
  49.  *
  50.  * Revision 1.7  1992/09/25  15:35:12  koziol
  51.  * Added #define's for NeXT support (use -DNEXT on the compile line
  52.  * for the machine type)
  53.  *
  54.  * Revision 1.6  1992/09/24  20:13:41  koziol
  55.  * Put the "const" kludge in for HP9000 machines
  56.  *
  57.  * Revision 1.5  1992/09/18  21:52:57  koziol
  58.  * Added the crazy __STDC__ define to the Convex section
  59.  *
  60.  * Revision 1.4  1992/09/17  19:43:59  koziol
  61.  * Included Mike's changes to make Prototypes work on the Convex
  62.  *
  63.  * Revision 1.3  1992/09/11  14:15:04  koziol
  64.  * Changed Fortran stubs' parameter passing to use a new typedef, intf,
  65.  * which should be typed to the size of an INTEGER*4 in whatever Fortran
  66.  * compiler the C functions need to be compatible with.  (This is mostly
  67.  * for the PC and possibly for the Mac)
  68.  *
  69.  * Revision 1.2  1992/09/04  22:05:02  georgev
  70.  * Fixed "const" problem for MIPSEL.
  71.  *
  72.  * Revision 1.1  1992/08/25  21:40:44  koziol
  73.  * Initial revision
  74.  *
  75. */
  76. #ifndef HDFI_H
  77. #define HDFI_H
  78.  
  79. #ifdef GOT_MACHINE
  80. #undef GOT_MACHINE
  81. #endif
  82.  
  83. /*--------------------------------------------------------------------------*/
  84. /*                              MT/NT constants                             */
  85. /*  four MT nibbles represent double, float, int, uchar (from most          */
  86. /*  significant to least significant).                                      */
  87. /*  The values for each nibble are:                                         */
  88. /*      1 - Big Endian                                                      */
  89. /*      2 - VAX                                                             */
  90. /*      3 - Cray                                                            */
  91. /*      4 - Little Endian                                                   */
  92. /*--------------------------------------------------------------------------*/
  93. #define     DFMT_SUN            0x1111
  94. #define     DFMT_ALLIANT        0x1111
  95. #define     DFMT_IRIS4          0x1111
  96. #define     DFMT_APOLLO         0x1111
  97. #define     DFMT_IBM6000        0x1111
  98. #define     DFMT_HP9000         0x1111
  99. #define     DFMT_CONVEXNATIVE   0x5511
  100. #define     DFMT_CONVEX         0x1111
  101. #define     DFMT_UNICOS         0x3331
  102. #define     DFMT_CTSS           0x3331
  103. #define     DFMT_VAX            0x2221
  104. #define     DFMT_MIPSEL         0x4441
  105. #define     DFMT_PC             0x4441
  106. #define     DFMT_MAC            0x1111
  107. #define     DFMT_SUN386         0x4441
  108. #define     DFMT_NEXT           0x1111
  109. #define     DFMT_MOTOROLA       0x1111
  110.  
  111. /* I/O library constants */
  112. #define UNIXUNBUFIO 1
  113. #define UNIXBUFIO   2
  114. #define MACIO       3
  115. #define PCIO        4
  116. #define WINIO       5
  117.  
  118. #include <stdio.h>
  119.  
  120. #ifdef __STDC__
  121. #define PROTOTYPE
  122. #include <stdlib.h>
  123. #endif
  124.  
  125. #ifdef SUN
  126.  
  127. #ifdef GOT_MACHINE
  128. If you get an error on this line more than one machine type has been defined.
  129. Please check your Makefile.
  130. #endif
  131. #define GOT_MACHINE
  132.  
  133. #   define BSD
  134. #include <string.h>
  135. #ifndef __GNUC__
  136. #include <memory.h>
  137. #endif /* __GNUC__ */
  138. #include <unistd.h>
  139. #include <sys/file.h>               /* for unbuffered i/o stuff */
  140. #define DF_MT             DFMT_SUN
  141. typedef void              VOID;
  142. typedef char              *VOIDP;
  143. typedef char              *_fcd;
  144. typedef int               bool;
  145. typedef char              char8;
  146. typedef unsigned char     uchar8;
  147. typedef char              int8;
  148. typedef unsigned char     uint8;
  149. typedef short int         int16;
  150. typedef unsigned short int uint16;
  151. typedef long int          int32;
  152. typedef unsigned long int uint32;
  153. typedef int               intn;
  154. typedef unsigned int      uintn;
  155. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  156. typedef float             float32;
  157. typedef double            float64;
  158. #define _HUGE              /* This should only be defined to a value on the PC */
  159. #define DFmovmem(from, to, len) memcpy(to, from, len)
  160. #define FNAME_POST_UNDERSCORE
  161. #define _fcdtocp(desc) (desc)
  162. #define FILELIB UNIXBUFIO
  163. #ifndef __STDC__
  164. #define const
  165. #endif
  166. #endif /* SUN */
  167.  
  168.  
  169. #ifdef IBM6000
  170.  
  171. #ifdef GOT_MACHINE
  172. If you get an error on this line more than one machine type has been defined.
  173. Please check your Makefile.
  174. #endif
  175. #define GOT_MACHINE
  176.  
  177. #   define BSD
  178. #include <string.h>
  179. #ifndef __GNUC__
  180. #include <memory.h>
  181. #endif /* __GNUC__ */
  182. #include <sys/file.h>               /* for unbuffered i/o stuff */
  183. #define DF_MT             DFMT_IBM6000
  184. typedef void              VOID;
  185. typedef void              *VOIDP;
  186. typedef char              *_fcd;
  187. typedef int               bool;
  188. typedef char              char8;
  189. typedef unsigned char     uchar8;
  190. typedef char              int8;
  191. typedef unsigned char     uint8;
  192. typedef short int         int16;
  193. typedef unsigned short int uint16;
  194. typedef long int          int32;
  195. typedef unsigned long int uint32;
  196. typedef int               intn;
  197. typedef unsigned int      uintn;
  198. typedef float             float32;
  199. typedef double            float64;
  200. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  201. #define _HUGE              /* This should only be defined to a value on the PC */
  202. #define DFmovmem(from, to, len) memcpy(to, from, len)
  203. #define _fcdtocp(desc) (desc)
  204. #define FILELIB UNIXBUFIO
  205. #endif /* IBM6000 */
  206.  
  207. #ifdef HP9000
  208.  
  209. #ifdef GOT_MACHINE
  210. If you get an error on this line more than one machine type has been defined.
  211. Please check your Makefile.
  212. #endif
  213. #define GOT_MACHINE
  214.  
  215. #   define BSD
  216. #include <string.h>
  217. #ifndef __GNUC__
  218. #include <memory.h>
  219. #endif /* __GNUC__ */
  220. #include <sys/file.h>               /* for unbuffered i/o stuff */
  221. #define DF_MT             DFMT_HP9000
  222. typedef void              VOID;
  223. typedef void              *VOIDP;
  224. typedef char              *_fcd;
  225. typedef int               bool;
  226. typedef char              char8;
  227. typedef unsigned char     uchar8;
  228. typedef char              int8;
  229. typedef unsigned char     uint8;
  230. typedef short int         int16;
  231. typedef unsigned short int uint16;
  232. typedef long int          int32;
  233. typedef unsigned long int uint32;
  234. typedef int               intn;
  235. typedef unsigned int      uintn;
  236. typedef float             float32;
  237. typedef double            float64;
  238. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  239. #define _HUGE              /* This should only be defined to a value on the PC */
  240. #define DFmovmem(from, to, len) memcpy(to, from, len)
  241. #define _fcdtocp(desc) (desc)
  242. #define FILELIB UNIXBUFIO
  243. #ifndef __STDC__
  244. #define const
  245. #endif
  246. #endif /* HP9000 */
  247.  
  248.  
  249. #ifdef IRIS4
  250.  
  251. #ifdef GOT_MACHINE
  252. If you get an error on this line more than one machine type has been defined.
  253. Please check your Makefile.
  254. #endif
  255. #define GOT_MACHINE 1
  256.  
  257. #   define BSD
  258. #include <string.h>
  259. #ifndef __GNUC__
  260. #include <memory.h>
  261. #endif /* __GNUC__ */
  262. #include <sys/file.h>               /* for unbuffered i/o stuff */
  263. #define DF_MT              DFMT_IRIS4
  264. typedef void               VOID;
  265. typedef char               *VOIDP;
  266. typedef char               *_fcd;
  267. typedef int                bool;
  268. typedef char               char8;
  269. typedef unsigned char      uchar8;
  270. typedef char               int8;
  271. typedef unsigned char      uint8;
  272. typedef short int          int16;
  273. typedef unsigned short int uint16;
  274. typedef long int           int32;
  275. typedef unsigned long int  uint32;
  276. typedef int                intn;
  277. typedef unsigned int       uintn;
  278. typedef float              float32;
  279. typedef double             float64;
  280. typedef int                intf;     /* size of INTEGERs in Fortran compiler */
  281. #define _HUGE              /* This should only be defined to a value on the PC */
  282. #define DFmovmem(from, to, len) memcpy(to, from, len)
  283. #define FNAME_POST_UNDERSCORE
  284. #define _fcdtocp(desc) (desc)
  285. #define FILELIB UNIXBUFIO
  286. #endif /* IRIS4 */
  287.  
  288.  
  289. #ifdef UNICOS
  290.  
  291. #ifdef GOT_MACHINE
  292. If you get an error on this line more than one machine type has been defined.
  293. Please check your Makefile.
  294. #endif
  295. #define GOT_MACHINE 1
  296.  
  297. #include <string.h>
  298. #include <memory.h>
  299. #include <fortran.h>
  300. #ifndef O_RDONLY
  301. #include <fcntl.h>              /* for unbuffered i/o stuff */
  302. #define L_INCR  1
  303. #endif /*O_RDONLY*/
  304.  
  305. #define DF_MT   DFMT_UNICOS
  306. typedef void            VOID;
  307. typedef char            *VOIDP;
  308. typedef char            *_fcd;
  309. typedef int             bool;
  310. typedef char            char8;
  311. typedef unsigned char   uchar8;
  312. typedef char            int8;
  313. typedef unsigned char   uint8;
  314. typedef int             int16;
  315. typedef unsigned int    uint16;
  316. typedef int             int32;
  317. typedef unsigned int    uint32;
  318. typedef int             intn;
  319. typedef unsigned int    uintn;
  320. typedef float           float32;
  321. typedef double          float64;
  322. typedef int             intf;     /* size of INTEGERs in Fortran compiler */
  323. #define _HUGE              /* This should only be defined to a value on the PC */
  324.  
  325. #define DFmovmem(from, to, len) memcpy(to, from, len)
  326. #define DF_CAPFNAMES            /* fortran names are in all caps */
  327. #define FILELIB UNIXBUFIO
  328.  
  329. #endif /* UNICOS */
  330.  
  331. #ifdef VMS
  332.  
  333. #ifdef GOT_MACHINE
  334. If you get an error on this line more than one machine type has been defined.
  335. Please check your Makefile.
  336. #endif
  337. #define GOT_MACHINE 1
  338. #include <file.h>               /* for unbuffered i/o stuff */
  339.  
  340. #define DF_MT              DFMT_VAX
  341. typedef int                VOID;
  342. typedef char               *VOIDP;
  343. typedef char               *_fcd;
  344. typedef int                bool;
  345. typedef char               char8;
  346. typedef unsigned char      uchar8;
  347. typedef char               int8;
  348. typedef unsigned char      uint8;
  349. typedef short int          int16;
  350. typedef unsigned short int uint16;
  351. typedef long int           int32;
  352. typedef unsigned long int  uint32;
  353. typedef int                intn;
  354. typedef unsigned int       uintn;
  355. typedef float              float32;
  356. typedef double             float64;
  357. typedef int                intf;     /* size of INTEGERs in Fortran compiler */
  358. #define _HUGE              /* This should only be defined to a value on the PC */
  359. #define DFmovmem(from, to, len) memcpy(to, from, len)
  360. #define _fcdtocp(desc)  ((char *) *((char **) &desc[4]))
  361.  
  362. /* 
  363.   Redef a couple of C routine names to avoid conflicts
  364.   since the VMS link command is case-insensitive
  365. */
  366. #define FILELIB UNIXBUFIO
  367. #include "dfivms.h"
  368.  
  369. #endif /* VMS */
  370.  
  371. /* For Convex machines with native format floats */
  372. #ifdef CONVEXNATIVE
  373. #   define CONVEX
  374. #endif
  375.  
  376. #ifdef CONVEX
  377.  
  378. #ifdef GOT_MACHINE
  379. If you get an error on this line more than one machine type has been defined.
  380. Please check your Makefile.
  381. #endif
  382. #define GOT_MACHINE
  383.  
  384. #include <sys/file.h>               /* for unbuffered i/o stuff */
  385. #include <stdlib.h>
  386.  
  387. #define __STDC__                    /* To invoke ANSI compilation */
  388. #ifndef PROTOTYPE
  389. #define PROTOTYPE                     /* to invoke ANSI compilation */
  390. #endif /* PROTOTYPE */
  391.  
  392. #ifdef CONVEXNATIVE
  393. #define DF_MT             DFMT_CONVEXNATIVE
  394. #else
  395. #define DF_MT             DFMT_CONVEX
  396. #endif
  397. typedef void              VOID;
  398. typedef char              *VOIDP;
  399. typedef char              *_fcd;
  400. typedef int               bool;
  401. typedef char              char8;
  402. typedef unsigned char     uchar8;
  403. typedef char              int8;
  404. typedef unsigned char     uint8;
  405. typedef short int         int16;
  406. typedef unsigned short int uint16;
  407. typedef long int          int32;
  408. typedef unsigned long int uint32;
  409. typedef int               intn;
  410. typedef unsigned int      uintn;
  411. typedef float             float32;
  412. typedef double            float64;
  413. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  414. #define _HUGE              /* This should only be defined to a value on the PC */
  415. #define DFmovmem(from, to, len) bcopy(from, to, len)
  416. #define FNAME_POST_UNDERSCORE
  417. #define _fcdtocp(desc) (desc)
  418. #define FILELIB UNIXBUFIO
  419. #endif /* CONVEX */
  420.  
  421.  
  422. #ifdef MIPSEL
  423.  
  424. #ifdef GOT_MACHINE
  425. If you get an error on this line more than one machine type has been defined.
  426. Please check your Makefile.
  427. #endif
  428. #define GOT_MACHINE 1
  429.  
  430. #include <sys/types.h>
  431. #include <sys/file.h>               /* for unbuffered i/o stuff */
  432. #define DF_MT   DFMT_MIPSEL
  433. typedef void            VOID;
  434. typedef char            *VOIDP;
  435. typedef char            *_fcd;
  436. typedef int             bool;
  437. typedef char            char8;
  438. typedef unsigned char   uchar8;
  439. typedef char            int8;
  440. typedef unsigned char   uint8;
  441. typedef short           int16;
  442. typedef unsigned short  uint16;
  443. typedef int             int32;
  444. typedef unsigned int    uint32;
  445. typedef int             intn;
  446. typedef unsigned int    uintn;
  447. typedef float           float32;
  448. typedef double          float64;
  449. typedef int             intf;     /* size of INTEGERs in Fortran compiler */
  450. #define _HUGE              /* This should only be defined to a value on the PC */
  451. #define DFmovmem(from, to, len) memcpy(to, from, len)
  452. #define _fcdtocp(desc) (desc)
  453. #define FNAME_POST_UNDERSCORE
  454. #define FILELIB UNIXBUFIO
  455. #ifndef __STDC__
  456. #define const
  457. #endif /* __STDC__ */
  458. #endif /* MIPSEL */
  459.  
  460. #ifdef MAC
  461.  
  462. #ifdef GOT_MACHINE
  463. If you get an error on this line more than one machine type has been defined.
  464. Please check your Makefile.
  465. #endif
  466. #define GOT_MACHINE 1
  467. #define PROTOTYPE
  468.  
  469. #include <memory.h>             /* malloc stuff for MPW 3.0 */
  470. #include <fcntl.h>              /* unbuffered IO stuff for MPW 3.0 */
  471. #include <String.h>
  472. #ifdef THINK_C                  /* for LightSpeed C */
  473. #include <unix.h>
  474. #define isascii(c)  (isprint(c) || iscntrl(c))
  475. #else /*THINK_C                   MPW, possibly others */
  476. #include <Files.h>              /* for unbuffered i/o stuff */
  477. #endif /*THINK_C*/
  478. #define    DF_CAPFNAMES            /* fortran names are in all caps */
  479. #define DF_DYNAMIC                /* use dynamic allocation */
  480. #define DFmovmem(from, to, len) memcpy(to, from, len)
  481. #define malloc(x)   NewPtr((Size)   (x))    /* don't use malloc on the Mac */
  482. #define free(x)     DisposPtr((Ptr) (x))    /* don't use free on the Mac   */
  483. #define DF_MT   DFMT_MAC
  484.  
  485. typedef void              VOID;
  486. typedef char              *VOIDP;
  487. typedef char              *_fcd;
  488. typedef int               bool;
  489. typedef char              char8;
  490. typedef unsigned char     uchar8;
  491. typedef char              int8;
  492. typedef unsigned char     uint8;
  493. typedef short int         int16;
  494. typedef unsigned short int uint16;
  495. typedef long int          int32;
  496. typedef unsigned long int uint32;
  497. typedef int               intn;
  498. typedef unsigned int      uintn;
  499. typedef float             float32;
  500. typedef double            float64;
  501. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  502. #define _HUGE              /* This should only be defined to a value on the PC */
  503. #define _fcdtocp(desc) (desc)
  504. void exit(int status);
  505.  
  506. #define register   /* don't mess with the MAC compiler's register allocation */
  507. #define FILELIB MACIO
  508. #endif /*MAC*/
  509.  
  510.  
  511. #ifdef WIN3
  512. #define PC
  513. #endif  /* WIN3 */
  514.  
  515. #ifdef PC
  516.  
  517. #ifdef GOT_MACHINE
  518. If you get an error on this line more than one machine type has been defined.
  519. Please check your Makefile.
  520. #endif
  521. #define GOT_MACHINE 1
  522.  
  523. #include <fcntl.h>
  524. #include <sys\types.h>      /* for unbuffered file I/O */
  525. #include <sys\stat.h>
  526. #include <io.h>
  527. #include <malloc.h>
  528. #include <conio.h>          /* for debugging getch() calls */
  529. #include <string.h>         /* for vaious string functions */
  530. #include <limits.h>         /* for UINT_MAX used in various places */
  531. #ifdef WIN3
  532. #ifndef GMEM_MOVEABLE       /* check if windows header is already included */
  533. #include <windows.h>        /* include the windows headers */
  534. #endif
  535. #endif /* WIN3 */
  536.  
  537. #define DF_MT             DFMT_PC
  538.  
  539. #ifndef PROTOTYPE
  540. /* Want prototypes for the PC even if we're not completely ANSI C compliant */
  541. #define PROTOTYPE
  542. #endif  /* !PROTOTYPE */
  543.  
  544. #ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
  545. typedef void              VOID;
  546. #endif  /* end VOID */
  547. typedef void              huge *VOIDP;
  548. typedef char              huge *_fcd;
  549. typedef int               bool;
  550. typedef char              char8;
  551. typedef unsigned char     uchar8;
  552. typedef char              int8;
  553. typedef unsigned char     uint8;
  554. typedef short int         int16;
  555. typedef unsigned short int uint16;
  556. typedef long int          int32;
  557. typedef unsigned long int uint32;
  558. typedef int               intn;
  559. typedef unsigned int      uintn;
  560. typedef float             float32;
  561. typedef double            float64;
  562. typedef long              intf;     /* size of INTEGERs in Fortran compiler */
  563. /* used to force the prototypes in hproto.h to use huge pointers */
  564. #define _HUGE              huge      
  565.  
  566. #ifdef WIN3
  567. #define DFmovmem(from, to, len) _fmemmove(to, from, len)
  568. #else   /* !WIN3 */
  569. #define DFmovmem(from, to, len) memcpy(to, from, len)
  570. #endif  /* WIN3 */
  571.  
  572. #define _fcdtocp(desc) (desc)
  573.  
  574. #define register    /* don't mess with the PC compiler's register allocation */
  575. #ifdef WIN3
  576. #define FILELIB WINIO
  577. #else /* !WIN3 */
  578. #define FILELIB PCIO
  579. #endif /* WIN3 */
  580. #endif /* PC */
  581.  
  582. #ifdef NEXT
  583.  
  584. #ifdef GOT_MACHINE
  585. If you get an error on this line more than one machine type has been defined.
  586. Please check your Makefile.
  587. #endif
  588. #define GOT_MACHINE
  589.  
  590. #include <string.h>
  591. #ifndef __GNUC__
  592. #include <memory.h>
  593. #endif /* __GNUC__ */
  594. #include <sys/file.h>               /* for unbuffered i/o stuff */
  595. #define DF_MT             DFMT_NEXT
  596. typedef void              VOID;
  597. typedef char              *VOIDP;
  598. typedef char              *_fcd;
  599. typedef int               bool;
  600. typedef char              char8;
  601. typedef unsigned char     uchar8;
  602. typedef char              int8;
  603. typedef unsigned char     uint8;
  604. typedef short int         int16;
  605. typedef unsigned short int uint16;
  606. typedef long int          int32;
  607. typedef unsigned long int uint32;
  608. typedef int               intn;
  609. typedef unsigned int      uintn;
  610. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  611. typedef float             float32;
  612. typedef double            float64;
  613. #define _HUGE              /* This should only be defined to a value on the PC */
  614. #define DFmovmem(from, to, len) memcpy(to, from, len)
  615. #define FNAME_POST_UNDERSCORE
  616. #define _fcdtocp(desc) (desc)
  617. #define FILELIB UNIXBUFIO
  618. #endif /* NEXT */
  619.  
  620.  
  621. #ifndef GOT_MACHINE
  622. No machine type has been defined.  Your Makefile needs to have someing like
  623. -DSUN or -DUNICOS in order for the HDF internal structures to be defined
  624. correctly.
  625. #endif
  626.  
  627. #ifdef MOTOROLA
  628.  
  629. #ifdef GOT_MACHINE
  630. If you get an error on this line more than one machine type has been defined.
  631. Please check your Makefile.
  632. #endif
  633. #define GOT_MACHINE
  634.  
  635. #include <string.h>
  636. #ifndef __GNUC__
  637. #include <memory.h>
  638. #endif /* __GNUC__ */
  639. #include <unistd.h>
  640. #include <sys/file.h>               /* for unbuffered i/o stuff */
  641. #ifndef O_RDONLY
  642. #include <fcntl.h>              /* for unbuffered i/o stuff */
  643. #endif /*O_RDONLY*/
  644. #define DF_MT             DFMT_MOTOROLA
  645. typedef void              VOID;
  646. typedef char              *VOIDP;
  647. typedef char              *_fcd;
  648. typedef int               bool;
  649. typedef char              char8;
  650. typedef unsigned char     uchar8;
  651. typedef char              int8;
  652. typedef unsigned char     uint8;
  653. typedef short int         int16;
  654. typedef unsigned short int uint16;
  655. typedef long int          int32;
  656. typedef unsigned long int uint32;
  657. typedef int               intn;
  658. typedef unsigned int      uintn;
  659. typedef int               intf;     /* size of INTEGERs in Fortran compiler */
  660. typedef float             float32;
  661. typedef double            float64;
  662. #define _HUGE              /* This should only be defined to a value on the PC */
  663. #define DFmovmem(from, to, len) memcpy(to, from, len)
  664. #define FNAME_POST_UNDERSCORE
  665. #define _fcdtocp(desc) (desc)
  666. #define FILELIB UNIXBUFIO
  667. #ifndef __STDC__
  668. #define const
  669. #endif
  670. #endif /* MOTOROLA */
  671.  
  672.  
  673. /*-----------------------------------------------------*/
  674. /*              encode and decode macros               */
  675. /*-----------------------------------------------------*/
  676.  
  677. #   define INT16ENCODE(p, i) \
  678. { *(p) = (uint8)(((uint16)(i) >> 8) & 0xff); (p)++; \
  679.         *(p) = (uint8)((uint16)(i) & 0xff); (p)++; }
  680.  
  681. #   define UINT16ENCODE(p, i) \
  682. { *(p) = (uint8)(((uint16)(i) >> 8) & 0xff); (p)++; *(p) = (uint8)((i) & 0xff); (p)++; }
  683.  
  684. #   define INT32ENCODE(p, i) \
  685. { *(p) = (uint8)(((uint32)(i) >> 24) & 0xff); (p)++; \
  686.         *(p) = (uint8)(((uint32)(i) >> 16) & 0xff); (p)++; \
  687.         *(p) = (uint8)(((uint32)(i) >> 8) & 0xff); (p)++; \
  688.         *(p) = (uint8)((uint32)(i) & 0xff); (p)++; }
  689.  
  690. #   define UINT32ENCODE(p, i) \
  691. { *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \
  692.         *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \
  693.         *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \
  694.         *(p) = (uint8)((i) & 0xff); (p)++; }
  695.  
  696. #   define INT16DECODE(p, i) \
  697. { (i) = (*(p) & 0xff) << 8; (p)++; (i) |= (*(p) & 0xff); (p)++; }
  698.  
  699. #   define UINT16DECODE(p, i) \
  700. { (i) = ((*(p) & 0xff) << 8); (p)++; (i) |= (*(p) & 0xff); (p)++; }
  701.  
  702. #   define INT32DECODE(p, i) \
  703. { (i) = ((int32)(*(p) & 0xff) << 24); (p)++; \
  704.         (i) |= ((int32)(*(p) & 0xff) << 16); (p)++; \
  705.         (i) |= ((int32)(*(p) & 0xff) << 8); (p)++; \
  706.         (i) |= (*(p) & 0xff); (p)++; }
  707.  
  708. #   define UINT32DECODE(p, i) \
  709. { (i) = ((uint32)(*(p) & 0xff) << 24); (p)++; \
  710.         (i) |= ((uint32)(*(p) & 0xff) << 16); (p)++; \
  711.         (i) |= ((uint32)(*(p) & 0xff) << 8); (p)++; \
  712.         (i) |= (*(p) & 0xff); (p)++; }
  713.  
  714. /**************************************************************************
  715. *                   Conversion Routine Pointers
  716. ***************************************************************************/
  717. #    ifndef DFKMASTER
  718. #if defined __STDC__ || defined PC
  719. extern int (*DFKnumin)(void _HUGE * source, void _HUGE * dest, uint32 num_elm,
  720.             uint32 source_stride,uint32 dest_stride);
  721. extern int (*DFKnumout)(void _HUGE * source, void _HUGE * dest, uint32 num_elm,
  722.             uint32 source_stride,uint32 dest_stride);
  723. #else
  724. extern int (*DFKnumin)();
  725. extern int (*DFKnumout)();
  726. #endif
  727. #     endif /* DFKMASTER */
  728.  
  729. /*****************************************************************
  730. *  Create DFtbuf: a temporary buffer used when a small amount of
  731. *  memory is needed, as when small conversions are done
  732. ******************************************************************/
  733. #define DF_TBUFSZ       512     /* buffer size can be smaller */
  734. #ifdef  HMASTER
  735.     int    int_DFtbuf[DF_TBUFSZ]; /* int declaration to force word boundary */
  736.     uint8  *DFtbuf = (uint8 *) int_DFtbuf;
  737. #else /* !HMASTER */
  738. extern uint8 *DFtbuf;
  739. #endif /*HMASTER*/
  740.  
  741. /*----------------------------------------------------------------
  742. ** MACRO FCALLKEYW for any special fortran-C stub keyword
  743. **
  744. ** MacIntosh MPW LS-fortran needs pascal since it can interface
  745. **  best with pascal functions.
  746. ** Microsoft C and Fortran need _fortran for Fortran callable C
  747. **  routines.
  748. **
  749. ** MACRO FRETVAL for any return value from a fortran-C stub function
  750. **  Replaces the older FCALLKEYW macro.
  751. **---------------------------------------------------------------*/
  752. #ifdef FRETVAL
  753. #undef FRETVAL
  754. #endif
  755.  
  756. #if defined(MAC)                /* with LS FORTRAN */
  757. #   define FCALLKEYW    pascal
  758. #   define FRETVAL(x)   pascal x
  759. #endif
  760.  
  761. #if defined(PC)   /* with MS Fortran */
  762. #   define FCALLKEYW    _fortran
  763. #   define FRETVAL(x)   x _fortran
  764. #endif
  765.  
  766. #ifndef FRETVAL /* !MAC && !PC */
  767. #   define FCALLKEYW    /*NONE*/
  768. #   define FRETVAL(x)   x
  769. #endif
  770.  
  771.  
  772. /*----------------------------------------------------------------
  773. ** MACRO FNAME for any fortran callable routine name.
  774. **
  775. **  This macro prepends, appends, or does not modify a name
  776. **  passed as a macro parameter to it based on the FNAME_PRE_UNDERSCORE,
  777. **  FNAME_POST_UNDERSCORE macros set for a specific system.
  778. **
  779. **---------------------------------------------------------------*/
  780. #if defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE)
  781. #ifdef __STDC__
  782. #   define FNAME(x)     _##x##_
  783. #else
  784. #   define FNAME(x)     _/**/x/**/_
  785. #endif
  786. #endif
  787. #if defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE)
  788. #ifdef __STDC__
  789. #   define FNAME(x)     _##x
  790. #else
  791. #   define FNAME(x)     _/**/x
  792. #endif
  793. #endif
  794. #if !defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE)
  795. #ifdef __STDC__
  796. #   define FNAME(x)     x##_
  797. #else
  798. #   define FNAME(x)     x/**/_
  799. #endif
  800. #endif
  801. #if !defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE)
  802. #   define FNAME(x)     x
  803. #endif
  804.  
  805. /**************************************************************************
  806. *  String functions defined differently under MS Windows
  807. **************************************************************************/
  808.  
  809. #ifdef WIN3
  810. #  define HDstrcat(s1,s2)   (_fstrcat((s1),(s2)))
  811. #  define HDstrcmp(s,t)     (_fstrcmp((s),(t)))
  812. #  define HDstrcpy(s,d)     (_fstrcpy((s),(d)))
  813. #  define HDstrlen(s)       (_fstrlen(s))
  814. #  define HDstrncmp(s1,s2,n)    (_fstrncmp((s1),(s2),(n)))
  815. #  define HDstrncpy(s1,s2,n)    (_fstrncpy((s1),(s2),(n)))
  816. #else
  817. #  define HDstrcat(s1,s2)   (strcat((s1),(s2)))
  818. #  define HDstrcmp(s,t)     (strcmp((s),(t)))
  819. #  define HDstrcpy(s,d)     (strcpy((s),(d)))
  820. #  define HDstrlen(s)       (strlen(s))
  821. #  define HDstrncmp(s1,s2,n)    (strncmp((s1),(s2),(n)))
  822. #  define HDstrncpy(s1,s2,n)    (strncpy((s1),(s2),(n)))
  823. #endif /* WIN3 */
  824.  
  825.  
  826. /**************************************************************************
  827. *  Memory functions defined differently under MS Windows
  828. **************************************************************************/
  829.  
  830. #ifdef WIN3
  831. #  define HDmemcpy(dst,src,n) (_fmemcpy((dst),(src),(n)))
  832. #else
  833. #  define HDmemcpy(dst,src,n) (memcpy((dst),(src),(n)))
  834. #endif /* WIN3 */
  835.  
  836. #endif /* HDFI_H */
  837.