Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
cif_int.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2.1 of the GNU Lesser General Public License 
00007   as published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU Lesser General Public 
00021   License along with this program; if not, write the Free Software 
00022   Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 
00023   USA.
00024 
00025   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00026   Mountain View, CA 94043, or:
00027 
00028   http://www.sgi.com
00029 
00030   For further information regarding this notice, see:
00031 
00032   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00033 
00034 */
00035 
00036 
00037 /* USMID @(#) libcif/cif_int.h  30.1    05/06/96 07:34:46 */
00038 
00039 
00040 /*
00041  * Compiler Information File interface routines internal information
00042  */
00043 
00044 #ifndef __CIFINT_H_
00045 #define __CIFINT_H_
00046 
00047 #ifndef __STDC__
00048 #       define const
00049 #endif
00050 
00051 #define IO_ERROR { \
00052         if (feof(fd)) return (CIF_BADFORM); \
00053         else return (CIF_SYSERR); \
00054 }
00055 
00056 /* --- CIF boolean indicators --- */
00057 #define NO              0
00058 #define YES             1
00059 
00060 /* --- CIF format indicator values --- */
00061 #define NOT_A_CIF       0               /* invalid or unknown cif format */
00062 #define ASCII_CIF       1               /* ASCII file format indicator */
00063 #define BINARY_CIF      2               /* binary file format indicator */
00064 
00065 /* --- CIF formats to add to the returned cifhdr record --- */
00066 /* The above defines cant be used because only one bit was
00067  * allocated for this field in the record. As we will never
00068  * return a NOT_A_CIF cifhdr anyway, this is okay
00069  */
00070 #define ASCII_CIF_FORMAT 0
00071 #define BINARY_CIF_FORMAT 1
00072 
00073 
00074 /* --- CIF internal values --- */
00075 #define CIF_FT_SIZE     10              /* no. of entries in _Cif_Filetbl  */
00076 #define CIF_BUFSIZE     8192            /* size of record input buffer */
00077 #define SEPARATOR       '\036'          /* record separator = CNTL-^ */
00078 #define BINARY_HDR_LEN  7               /* no. chars in binary file header */
00079 
00080 /* --- Constant/object attibute masks --- */
00081 #define CO_ATTR_IMPTYPE         0x01
00082 #define CO_ATTR_CHAR            0x02
00083 #define CO_ATTR_DIM             0x04
00084 #define CO_ATTR_SAVE            0x08
00085 #define CO_ATTR_DATA            0x10
00086 #define CO_ATTR_EQUIV           0x20
00087 #define CO_ATTR_AUTO            0x40
00088 #define CO_ATTR_PE_RESIDENT     0x80
00089 #define CO_ATTR_POINTEE         0x100
00090 #define CO_ATTR_ARRAY_DEC       0x200
00091 #define CO_ATTR_GEOM_DEC        0x400
00092 
00093 /* --- F90 Constant/object attibute masks --- */
00094 #define F90_CO_ATTR_IMPTYPE             0x01
00095 #define F90_CO_ATTR_POINTEE             0x02
00096 #define F90_CO_ATTR_DEF_TYPE            0x04
00097 #define F90_CO_ATTR_STAR_TYPE           0x08
00098 #define F90_CO_ATTR_KIND_TYPE           0x10
00099 
00100 #define F90_CO_ATTR_SAVE                0x20
00101 #define F90_CO_ATTR_DATA                0x40
00102 #define F90_CO_ATTR_EQUIV               0x80
00103 
00104 #define F90_CO_ATTR_ARRAY_DEC           0x100
00105 #define F90_CO_ATTR_GEOM_DEC            0x200
00106 #define F90_CO_ATTR_PE_RESIDENT         0x400
00107 
00108 #define F90_CO_ATTR_ALLOCATABLE         0x800
00109 #define F90_CO_ATTR_INTENTIN            0x1000
00110 #define F90_CO_ATTR_INTENTOUT           0x2000
00111 #define F90_CO_ATTR_INTENTINOUT         0x4000
00112 #define F90_CO_ATTR_OPTIONAL            0x8000
00113 #define F90_CO_ATTR_POINTER             0x10000
00114 #define F90_CO_ATTR_PRIVATE             0x20000
00115 #define F90_CO_ATTR_TARGET              0x40000
00116 #define F90_CO_ATTR_LOCAL_NAME          0x80000
00117 
00118 /* --- F90 scope information attibute masks --- */
00119 #define SC_ATTR_IMPNONE         0x01
00120 #define SC_ATTR_IO              0x02
00121 #define SC_ATTR_CALL            0x04
00122 #define SC_ATTR_CMIC            0x08
00123 
00124 /* --- Entry attribute masks --- */
00125 #define EN_ATTR_IMPTYPE         0x01
00126 #define EN_ATTR_CHAR            0x02
00127 #define EN_ATTR_DIM             0x04
00128 #define EN_ATTR_INTRIN          0x08
00129 #define EN_ATTR_EXTERN          0x10
00130 #define EN_ATTR_STMTF           0x20
00131 #define EN_ATTR_RECUR           0x40
00132 
00133 
00134 /* --- F90 Entry attribute masks --- */
00135 #define F90_EN_ATTR_DEFINED             0x01
00136 #define F90_EN_ATTR_INT_BLOCK           0x02
00137 #define F90_EN_ATTR_ALT_ENTRY           0x04
00138 #define F90_EN_ATTR_USE                 0x04
00139 #define F90_EN_ATTR_REFERENCED          0x08
00140 #define F90_EN_ATTR_OPTIONAL            0x10
00141 #define F90_EN_ATTR_PRIVATE             0x20
00142 #define F90_EN_ATTR_RECUR               0x40
00143 
00144 /* --- memory area table --- */
00145 #define CIF_MEM_BUMP    50      /* number of entries to add/increas */
00146 struct _Cif_Mem_Area {
00147         short used;             /* entry in use */
00148         int nme;                /* index of next entry used for file */
00149         int mused;              /* amount of buffer space used */
00150         int msize;              /* number of bytes in memory area */
00151         char *mbp;              /* pointer to beginning of buffer */
00152 }; 
00153 #ifdef DEFGLOBAL
00154 int _Cif_memasize;              /* current no of entries in _Cif_memarea */
00155 struct _Cif_Mem_Area *_Cif_memarea;
00156 #else
00157 extern int _Cif_memasize;
00158 extern struct _Cif_Mem_Area *_Cif_memarea;
00159 #endif
00160 
00161 /* --- CIF open file table --- */
00162 struct _Cif_File_Tbl {
00163         short form;             /* ASCII/binary file format indicator */
00164         short ifull;            /* buffer already contains a record */ 
00165         short seek;             /* seeking allowed on file flag */
00166         short mode;             /* record memory management mode for file */
00167         int fme;                /* index of first memory entry; managed mode */
00168         int lme;                /* index of curr memory entry; managed mode */
00169         char rmask[CIF_MAXRECORD]; /* record selection marker array */
00170         FILE *fd;               /* file descriptor of cif file */
00171         char *ip;               /* pointer to input buffer for file */
00172         char optype;            /* type of open: r = input, w = output */
00173         int lang;               /* language of cif file */
00174         int version;            /* CIF version */
00175         int return_version;     /* CIF version expected by user */
00176         int srcfid;             /* source file id, read from srcfile record */
00177         char *filename;         /* Filename opened */
00178         int tmp_cif;            /* Set if cif was created by cif_lines or
00179                                  *  cif_convert functions */
00180 };
00181 
00182 #ifdef DEFGLOBAL
00183 struct _Cif_File_Tbl _Cif_filetbl [CIF_FT_SIZE];
00184 #else
00185 extern struct _Cif_File_Tbl _Cif_filetbl [CIF_FT_SIZE];
00186 #endif
00187 
00188 #if CIF_VERSION != 1
00189 
00190 /* Buffer to use when mapping a version 1 cif to a version 2 cif record.
00191  * Required because some records increased in size so reading a v2 record
00192  * into space for a v1 cif would not work. Data is read into this buffer and
00193  * shaped into the correct cif record structure that the application requested.
00194  */
00195 extern struct Cif_generic *_cif_map_buffer;
00196 
00197 /* The cif version number == value of CIF_VERSION
00198  * picked up by Cif_Open function through the use of
00199  * alternative entries to it depending on the value of
00200  * CIF_VERSION. Used in cifdup.c to allow Cif_Duplicate
00201  * to know what version cif to create and copy, and in
00202  * ciffree.c for Cif_Free to know what storage to free.
00203  * See cifopen.c to see how it is initialised. */
00204 
00205 extern int _cif_version;
00206 #endif /* CIF_VERSION != 1 */
00207 
00208 
00209 /* --------------------------------------------------------------------------
00210  * declarations of CIF internal global items
00211  * --------------------------------------------------------------------------
00212  */
00213 
00214 /* The + 1`s allow the arrays to be indexed by CIF_VERSION which is 1 based */
00215 
00216 extern const short _Cif_structsize[CIF_MAXRECORD][_CIF_INT_VERSION + 1];
00217 extern const short _Cif_shortsize[CIF_MAXRECORD][_CIF_INT_VERSION + 1];
00218 
00219 /*
00220  * Mapping between compiler generated object data type values and
00221  * those that the library wants to return. ie a set that is consistent with
00222  * f77 as far as possible and non-overlapping when not
00223  */
00224 extern const int _Cif_f90_to_f77_dtypes[];
00225 
00226 
00227 int _Cif_binary_map_version __((int rtype, struct Cif_generic *map_buffer, struct Cif_generic *cr));
00228 extern int _Cif_Open __((char *, char *, int *, int));
00229 extern int _Cif_binread __((int, int, struct Cif_generic *, FILE *));
00230 extern int _Cif_mementry __((unsigned int));
00231 extern int _Cif_memtbl __(());
00232 extern char * (*_Cif_space[])();
00233 
00234 #endif /* __CIFINT_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines