Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #pragma ident "@(#) libf/fio/inqil.c 92.1 06/21/99 10:37:55"
00039
00040 #include <fortran.h>
00041 #include <liberrno.h>
00042 #include "fio.h"
00043 #include "f90io.h"
00044
00045
00046
00047
00048
00049
00050 typedef struct InfoFlags {
00051 unsigned int version :8;
00052 unsigned int :24;
00053 unsigned int :8;
00054 unsigned int stksize :8;
00055
00056 unsigned int :8;
00057 unsigned int icount :8;
00058
00059 } InfoFlagsType;
00060
00061 _f_int
00062 _INQIL (InfoFlagsType *info,
00063 iolist_header *iolist,
00064 void *stck)
00065 {
00066 int num_ioentries;
00067 int f90_type;
00068 int int_len;
00069 ioentry_header *nextioh;
00070 void *nexte;
00071 int **indarray;
00072 long elsize;
00073 int i;
00074 int *iptr;
00075
00076
00077
00078 iptr = (int *) stck;
00079 if (iolist->iolfirst) {
00080 iptr[0] = 0;
00081 }
00082
00083 num_ioentries = iolist->icount;
00084 nextioh = (ioentry_header *) (iolist + 1);
00085
00086
00087
00088
00089
00090
00091
00092 while (num_ioentries--) {
00093 nexte = nextioh + 1;
00094 switch (nextioh->valtype) {
00095 case IO_SCALAR :
00096 {
00097 ioscalar_entry *se;
00098
00099
00100
00101
00102
00103 se = nexte;
00104 f90_type = se->tinfo.type;
00105 int_len = se->tinfo.int_len;
00106
00107 if (f90_type == DVTYPE_ASCII) {
00108 const int bytesperchar = 1;
00109
00110
00111
00112
00113
00114 elsize = _fcdlen (se->iovar_address.fcd);
00115 elsize *= bytesperchar;
00116 } else {
00117 elsize = int_len >> 3;
00118 #if defined(_UNICOS)
00119
00120
00121
00122
00123
00124
00125 if (elsize >= sizeof (long)) {
00126 i = iptr[0] & (sizeof(long) - 1);
00127 if (i)
00128 iptr[0] += sizeof(long) - i;
00129 }
00130 #endif
00131 }
00132 iptr[0] += elsize;
00133 break;
00134 }
00135
00136 case IO_DOPEVEC :
00137 {
00138 ioarray_entry *ae;
00139
00140 ae = nexte;
00141 if (ae->dv->type_lens.type == DVTYPE_ASCII)
00142 elsize = _fcdlen (ae->dv->base_addr.charptr);
00143 else {
00144 elsize = ae->dv->type_lens.int_len >> 3;
00145
00146 #if defined(_UNICOS)
00147
00148
00149
00150
00151
00152
00153 if (elsize >= sizeof (long)) {
00154 i = iptr[0] & (sizeof(long) - 1);
00155 if (i)
00156 iptr[0] += sizeof(long) - i;
00157 }
00158 #endif
00159 }
00160
00161
00162
00163
00164
00165
00166 if (!ae->indflag) {
00167 for (i = 0; i < ae->dv->n_dim; i++)
00168 elsize *= ae->dv->dimension[i].extent;
00169
00170
00171
00172
00173
00174
00175
00176 } else {
00177 indarray = ae->dovar;
00178 for (i = 0; i < ae->dv->n_dim; i++) {
00179 if (indarray[i] == NULL)
00180 elsize *= ae->dv->dimension[i].extent;
00181 }
00182 }
00183 iptr[0] += elsize;
00184 break;
00185 }
00186
00187 case IO_LOOP :
00188 {
00189 long inc;
00190 long beg;
00191 long end;
00192 long ret;
00193 long tripcnt;
00194 ioimplieddo_entry *ie;
00195 long cntsave;
00196
00197 ie = nexte;
00198 inc = *ie->ioinccnt;
00199 beg = *ie->iobegcnt;
00200 end = *ie->ioendcnt;
00201
00202
00203
00204
00205
00206
00207
00208
00209 if (inc < 0) {
00210 beg = -beg;
00211 end = -end;
00212 inc = -inc;
00213 }
00214 tripcnt = (end + inc - beg) / inc;
00215 if (tripcnt < 0)
00216 tripcnt = 0;
00217
00218 cntsave = iptr[0];
00219 ret = _INQIL (info, (void *) (ie+1), stck);
00220
00221
00222
00223
00224
00225 iptr[0] += (ret - cntsave) * (tripcnt - 1);
00226 break;
00227 }
00228
00229 default :
00230 _lerror (_LELVL_ABORT, FEINTUNK);
00231 }
00232
00233 nextioh = (ioentry_header *) ((long *)nextioh + nextioh->ioentsize);
00234 }
00235
00236 return (iptr[0]);
00237 }