Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
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 @(#) libf/include/rnl.h 92.0 10/08/98 14:30:10 */ 00038 00039 00040 /* 00041 * Namelist defines and structures 00042 */ 00043 00044 /* 00045 * These types are output from nicv 00046 */ 00047 00048 #define NVLESS 077 /* Typeless */ 00049 #define NV32I 04027 /* Short integer*/ 00050 #define NV64I 04077 /* Integer */ 00051 #define NVREAL 06077 /* Real */ 00052 #define NVDOUB 06177 /* Double */ 00053 00054 /* Types passed to nocv to indicate type of conversion */ 00055 00056 #define WLESS 23 00057 #define W32I 11 00058 #define W64I 23 00059 #define WREAL 23 00060 #define WDOUB 40 00061 #define WCOMP 50 00062 00063 #define MAXDIMS 10 /* Maximum number of dimensions for an array */ 00064 #define MAXNAML 31 /* Maximum length of namelist name */ 00065 00066 /* Error processing */ 00067 00068 #define RNL_ERROR -3 00069 00070 #define RERR(css, n) { \ 00071 if (errf) { \ 00072 Nreturn(IO_ERR);\ 00073 } \ 00074 else \ 00075 _ferr(css,n); \ 00076 } 00077 00078 #define RERR2(css, n,m) { \ 00079 if (errf) { \ 00080 Nreturn(IO_ERR);\ 00081 } \ 00082 else \ 00083 _ferr(css,n,m); \ 00084 } 00085 00086 #define RERR3(css, n,m,t) { \ 00087 if (errf) { \ 00088 Nreturn(IO_ERR);\ 00089 } \ 00090 else \ 00091 _ferr(css,n,m,t); \ 00092 } 00093 00094 #define RNLERROR(s) { \ 00095 errno = s; \ 00096 return(RNL_ERROR); \ 00097 } 00098 00099 #define ISSPTB(c) (((c) == ' ') || ((c) == '\t')) 00100 00101 /* 00102 * MIN 00103 * Prevent compiler warnings by removing any definition added 00104 * previously by other header files. 00105 */ 00106 #undef MIN 00107 #define MIN(a,b) ((a) < (b) ? (a) : (b)) 00108 00109 00110 /* 00111 * MATCH(c,a,b) determines whether the bit for character 'c' is set. 00112 * 00113 * a[b] and a[b+1] are bit masks for each ASCII character 00114 */ 00115 00116 #define MATCH(c,a,b) (a[(c >= 0x3f) ? b+1 : b] & (1 << (IND(c)))) 00117 00118 /* 00119 * TOGGLE_CHAR sets or clears the bit for a particular character. 00120 * 00121 * TOGGLE_CHAR(c,a,b) 00122 * 00123 * where: c is the character 00124 * cat is the category 00125 * val set bit if != 0, clear bit if 0 00126 */ 00127 #define TOGGLE_CHAR(c,cat,val) { \ 00128 if (val) \ 00129 _MASKS[(c >= 0x3f) ? cat+1 : cat] |= (1 << (IND(c))); \ 00130 else \ 00131 _MASKS[(c >= 0x3f) ? cat+1 : cat] &= ~(1 << (IND(c))); \ 00132 } 00133 00134 /* IND computes the bit index of a character */ 00135 00136 #define IND(c) ((c >= 0x3f) ? 0x7f - (unsigned)c : (unsigned)(0x40 - c - 1)) 00137 00138 #define Nreturn(n) { \ 00139 ss = n; \ 00140 goto ret; \ 00141 } 00142 00143 /* End of file processing */ 00144 00145 #define NEND(css, n) { \ 00146 if (endf) { \ 00147 Nreturn(IO_END);\ 00148 } \ 00149 else \ 00150 _ferr(css,n); \ 00151 } 00152 00153 /* Logical equates */ 00154 00155 #undef TRUE 00156 #define TRUE (_btol(1)) 00157 00158 #undef FALSE 00159 #define FALSE (_btol(0)) 00160 00161 /* 00162 * LGET and CMNTLGET return a character from the current record. 00163 * If we are at EOR, they call _rnl_fillrec() to read the next 00164 * record. The two routines differ in the way they treat 00165 * comment characters: LGET does not look for comment characters. 00166 * It would be used when comment characters do not have a special 00167 * meaning (e.g., when inside a quoted string). CMNTLGET 00168 * recognizes comment characters and treats them as EOR. 00169 */ 00170 00171 #define LGET(x) { \ 00172 if (!inptr->incnt) \ 00173 if (ss = _rnl_fillrec(cup, echoptr, inptr)) \ 00174 return(ss); \ 00175 x = (char) *inptr->inptr++; \ 00176 inptr->incnt--; \ 00177 } 00178 00179 #define CMNTLGET(x) { \ 00180 if (!inptr->incnt) \ 00181 if (ss = _rnl_fillrec(cup, echoptr, inptr)) \ 00182 return(ss); \ 00183 x = (char) *inptr->inptr++; \ 00184 if (MATCH(x, _MASKS, MRNLCOMM)) { \ 00185 x = ' '; \ 00186 /* start new record next time*/ \ 00187 inptr->incnt = 1; \ 00188 } \ 00189 inptr->incnt--; \ 00190 } 00191 00192 /* 00193 * These are identical to LGET and CMNTLGET, except in the way they 00194 * treat end of file. They are to be used from the main routine, 00195 * where eof must be handled according to how RNL was called. 00196 */ 00197 00198 #define MAINLGET(x) { \ 00199 if (!inptr->incnt) \ 00200 if (ss = _rnl_fillrec(cup, echoptr, inptr)) { \ 00201 if (ss == EOF) { \ 00202 NEND(css, FERDNLEF); \ 00203 } \ 00204 else { \ 00205 RERR(css, ss); \ 00206 } \ 00207 } \ 00208 x = (char) *inptr->inptr++; \ 00209 inptr->incnt--; \ 00210 } 00211 00212 #define MAINCMNTLGET(x) { \ 00213 if (!inptr->incnt) \ 00214 if (ss = _rnl_fillrec(cup, echoptr, inptr)) { \ 00215 if (ss == EOF) { \ 00216 NEND(css, FERDNLEF); \ 00217 } \ 00218 else { \ 00219 RERR(css, ss); \ 00220 } \ 00221 } \ 00222 x = (char) *inptr->inptr++; \ 00223 if (MATCH(x, _MASKS, MRNLCOMM)) { \ 00224 x = ' '; \ 00225 inptr->incnt = 1; \ 00226 } \ 00227 inptr->incnt--; \ 00228 } 00229 00230 /* Indicies into _MASKS */ 00231 00232 #define MRNLDELIM 0 00233 #define MRNLREP 4 00234 #define MRNLSEP 6 00235 #define MRNLFLAG 8 00236 #define MRNLCOMM 10 00237 00238 struct Inpinfo { 00239 long *inbuff; /* Input records are read into this buffer, 00240 * starting at inbuff[1]. inbuff[0] is 00241 * reserved as a flag character to indicate 00242 * when we need to echo input */ 00243 long *instart; 00244 long *inptr; 00245 long incnt; 00246 }; 00247 00248 typedef struct { /* dimension structure */ 00249 signed int lower : 32, /* lower bound */ 00250 span : 32; /* span of the dimension */ 00251 } Dims; 00252 00253 typedef struct { /* Variable descriptor - 1 per var/array */ 00254 00255 char varname[MAXNAML+1]; /* name of variable */ 00256 00257 struct { 00258 unsigned nels : 32, /* number of elements */ 00259 unused : 1, 00260 type : 4, /* type (0 = typeless, 00261 * 1 = 32 bit integer, 00262 * 2 = 64 bit integer, 00263 * 3 = real, 4 = double, 00264 * 5 = complex, 00265 * 6 = character, 9 = logical*/ 00266 munused : 2, /* unused */ 00267 taskcm : 1, /* task common flag (not used on X/Y) */ 00268 ndims : 3, /* number of dimensions */ 00269 newfmt : 3, /* Indicates new namelist table format*/ 00270 /* (not used on X-MP/Y-MP) */ 00271 lmf : 1, /* local memory flag (not used on X/Y)*/ 00272 stkf : 1, /* stack flag */ 00273 offdim : 16; /* offset from base of Namelist */ 00274 /* structure to dimension structure */ 00275 } na; 00276 00277 struct { 00278 #ifdef _ADDR64 00279 unsigned long varaddr ; /* address of the variable or array. 00280 * If the variable is of type 00281 * character, this is an offset from 00282 * the base of the Namelist structure 00283 */ 00284 #else 00285 unsigned reserved : 16, /* reserved for use by loader */ 00286 lmaddr : 16, /* if task common, address in local 00287 * memory that contains address in 00288 * common memory of the start of the 00289 * task common block (unused on X/Y) */ 00290 varaddr : 32; /* address of the variable or array. 00291 * If the variable is of type 00292 * character, this is an offset from 00293 * the base of the Namelist structure 00294 * to the character descriptor */ 00295 #endif 00296 } va; 00297 00298 } Nlentry; 00299 00300 typedef struct { /* Namelist table */ 00301 char nlname[MAXNAML+1]; /* name of namelist group */ 00302 Nlentry nlvnames[1]; /* array of variable descriptors */ 00303 } Namelist; 00304 00305 /* External declarations */ 00306 00307 extern long _wnlrecsiz; 00308 extern long _BLNKSEP; 00309 extern long _MASKS[]; 00310 extern long OUT_CHAR; 00311 extern long OUT_ECHO; 00312 extern long OUT_EQ; 00313 extern long OUT_LINE; 00314 extern long OUT_SEP; 00315 extern unum_t _OUT_UNIT; 00316 extern long _SKP_MESS; 00317 extern long _TYP_CONV;