lread.c

Go to the documentation of this file.
00001 #include "f2c.h"
00002 #include "fio.h"
00003 #ifdef _MSC_VER
00004 #include <stdio.h>
00005 #endif
00006 /* Compile with -DF8X_NML_ELIDE_QUOTES to permit eliding quotation */
00007 /* marks in namelist input a la the Fortran 8X Draft published in  */
00008 /* the May 1989 issue of Fortran Forum. */
00009 
00010 
00011 extern char *f__fmtbuf;
00012 
00013 #ifdef Allow_TYQUAD
00014 static longint f__llx;
00015 #endif
00016 
00017 #ifdef KR_headers
00018 extern double atof();
00019 extern char *malloc(), *realloc();
00020 int (*f__lioproc)(), (*l_getc)(), (*l_ungetc)();
00021 #else
00022 #undef abs
00023 #undef min
00024 #undef max
00025 #include "stdlib.h"
00026 #endif
00027 
00028 #include "fmt.h"
00029 #include "lio.h"
00030 #include "ctype.h"
00031 #include "fp.h"
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 #ifndef KR_headers
00037 int (*f__lioproc)(ftnint*, char*, ftnlen, ftnint), (*l_getc)(void),
00038         (*l_ungetc)(int,FILE*);
00039 #endif
00040 
00041 int l_eof;
00042 
00043 #define isblnk(x) (f__ltab[x+1]&B)
00044 #define issep(x) (f__ltab[x+1]&SX)
00045 #define isapos(x) (f__ltab[x+1]&AX)
00046 #define isexp(x) (f__ltab[x+1]&EX)
00047 #define issign(x) (f__ltab[x+1]&SG)
00048 #define iswhit(x) (f__ltab[x+1]&WH)
00049 #define SX 1
00050 #define B 2
00051 #define AX 4
00052 #define EX 8
00053 #define SG 16
00054 #define WH 32
00055 char f__ltab[128+1] = { /* offset one for EOF */
00056         0,
00057         0,0,AX,0,0,0,0,0,0,WH|B,SX|WH,0,0,0,0,0,
00058         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00059         SX|B|WH,0,AX,0,0,0,0,AX,0,0,0,SG,SX,SG,0,SX,
00060         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00061         0,0,0,0,EX,EX,0,0,0,0,0,0,0,0,0,0,
00062         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00063         AX,0,0,0,EX,EX,0,0,0,0,0,0,0,0,0,0,
00064         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
00065 };
00066 
00067 #ifdef ungetc
00068  static int
00069 #ifdef KR_headers
00070 un_getc(x,f__cf) int x; FILE *f__cf;
00071 #else
00072 un_getc(int x, FILE *f__cf)
00073 #endif
00074 { return ungetc(x,f__cf); }
00075 #else
00076 #define un_getc ungetc
00077 #ifdef KR_headers
00078  extern int ungetc();
00079 #else
00080 #ifndef _MSC_VER
00081 extern int ungetc(int, FILE*);  /* for systems with a buggy stdio.h */
00082 #endif
00083 #endif
00084 #endif
00085 
00086  int
00087 t_getc(Void)
00088 {       int ch;
00089         if(f__curunit->uend) return(EOF);
00090         if((ch=getc(f__cf))!=EOF) return(ch);
00091         if(feof(f__cf))
00092                 f__curunit->uend = l_eof = 1;
00093         return(EOF);
00094 }
00095 integer e_rsle(Void)
00096 {
00097         int ch;
00098         if(f__curunit->uend) return(0);
00099         while((ch=t_getc())!='\n')
00100                 if (ch == EOF) {
00101                         if(feof(f__cf))
00102                                 f__curunit->uend = l_eof = 1;
00103                         return EOF;
00104                         }
00105         return(0);
00106 }
00107 
00108 flag f__lquit;
00109 int f__lcount,f__ltype,nml_read;
00110 char *f__lchar;
00111 double f__lx,f__ly;
00112 #define ERR(x) if(n=(x)) return(n)
00113 #define GETC(x) (x=(*l_getc)())
00114 #define Ungetc(x,y) (*l_ungetc)(x,y)
00115 
00116  static int
00117 #ifdef KR_headers
00118 l_R(poststar, reqint) int poststar, reqint;
00119 #else
00120 l_R(int poststar, int reqint)
00121 #endif
00122 {
00123         char s[FMAX+EXPMAXDIGS+4];
00124         register int ch;
00125         register char *sp, *spe, *sp1;
00126         long e, exp;
00127         int havenum, havestar, se;
00128 
00129         if (!poststar) {
00130                 if (f__lcount > 0)
00131                         return(0);
00132                 f__lcount = 1;
00133                 }
00134 #ifdef Allow_TYQUAD
00135         f__llx = 0;
00136 #endif
00137         f__ltype = 0;
00138         exp = 0;
00139         havestar = 0;
00140 retry:
00141         sp1 = sp = s;
00142         spe = sp + FMAX;
00143         havenum = 0;
00144 
00145         switch(GETC(ch)) {
00146                 case '-': *sp++ = ch; sp1++; spe++;
00147                 case '+':
00148                         GETC(ch);
00149                 }
00150         while(ch == '0') {
00151                 ++havenum;
00152                 GETC(ch);
00153                 }
00154         while(isdigit(ch)) {
00155                 if (sp < spe) *sp++ = ch;
00156                 else ++exp;
00157                 GETC(ch);
00158                 }
00159         if (ch == '*' && !poststar) {
00160                 if (sp == sp1 || exp || *s == '-') {
00161                         errfl(f__elist->cierr,112,"bad repetition count");
00162                         }
00163                 poststar = havestar = 1;
00164                 *sp = 0;
00165                 f__lcount = atoi(s);
00166                 goto retry;
00167                 }
00168         if (ch == '.') {
00169 #ifndef ALLOW_FLOAT_IN_INTEGER_LIST_INPUT
00170                 if (reqint)
00171                         errfl(f__elist->cierr,115,"invalid integer");
00172 #endif
00173                 GETC(ch);
00174                 if (sp == sp1)
00175                         while(ch == '0') {
00176                                 ++havenum;
00177                                 --exp;
00178                                 GETC(ch);
00179                                 }
00180                 while(isdigit(ch)) {
00181                         if (sp < spe)
00182                                 { *sp++ = ch; --exp; }
00183                         GETC(ch);
00184                         }
00185                 }
00186         havenum += sp - sp1;
00187         se = 0;
00188         if (issign(ch))
00189                 goto signonly;
00190         if (havenum && isexp(ch)) {
00191 #ifndef ALLOW_FLOAT_IN_INTEGER_LIST_INPUT
00192                 if (reqint)
00193                         errfl(f__elist->cierr,115,"invalid integer");
00194 #endif
00195                 GETC(ch);
00196                 if (issign(ch)) {
00197 signonly:
00198                         if (ch == '-') se = 1;
00199                         GETC(ch);
00200                         }
00201                 if (!isdigit(ch)) {
00202 bad:
00203                         errfl(f__elist->cierr,112,"exponent field");
00204                         }
00205 
00206                 e = ch - '0';
00207                 while(isdigit(GETC(ch))) {
00208                         e = 10*e + ch - '0';
00209                         if (e > EXPMAX)
00210                                 goto bad;
00211                         }
00212                 if (se)
00213                         exp -= e;
00214                 else
00215                         exp += e;
00216                 }
00217         (void) Ungetc(ch, f__cf);
00218         if (sp > sp1) {
00219                 ++havenum;
00220                 while(*--sp == '0')
00221                         ++exp;
00222                 if (exp)
00223                         sprintf(sp+1, "e%ld", exp);
00224                 else
00225                         sp[1] = 0;
00226                 f__lx = atof(s);
00227 #ifdef Allow_TYQUAD
00228                 if (reqint&2 && (se = sp - sp1 + exp) > 14 && se < 20) {
00229                         /* Assuming 64-bit longint and 32-bit long. */
00230                         if (exp < 0)
00231                                 sp += exp;
00232                         if (sp1 <= sp) {
00233                                 f__llx = *sp1 - '0';
00234                                 while(++sp1 <= sp)
00235                                         f__llx = 10*f__llx + (*sp1 - '0');
00236                                 }
00237                         while(--exp >= 0)
00238                                 f__llx *= 10;
00239                         if (*s == '-')
00240                                 f__llx = -f__llx;
00241                         }
00242 #endif
00243                 }
00244         else
00245                 f__lx = 0.;
00246         if (havenum)
00247                 f__ltype = TYLONG;
00248         else
00249                 switch(ch) {
00250                         case ',':
00251                         case '/':
00252                                 break;
00253                         default:
00254                                 if (havestar && ( ch == ' '
00255                                                 ||ch == '\t'
00256                                                 ||ch == '\n'))
00257                                         break;
00258                                 if (nml_read > 1) {
00259                                         f__lquit = 2;
00260                                         return 0;
00261                                         }
00262                                 errfl(f__elist->cierr,112,"invalid number");
00263                         }
00264         return 0;
00265         }
00266 
00267  static int
00268 #ifdef KR_headers
00269 rd_count(ch) register int ch;
00270 #else
00271 rd_count(register int ch)
00272 #endif
00273 {
00274         if (ch < '0' || ch > '9')
00275                 return 1;
00276         f__lcount = ch - '0';
00277         while(GETC(ch) >= '0' && ch <= '9')
00278                 f__lcount = 10*f__lcount + ch - '0';
00279         Ungetc(ch,f__cf);
00280         return f__lcount <= 0;
00281         }
00282 
00283  static int
00284 l_C(Void)
00285 {       int ch, nml_save;
00286         double lz;
00287         if(f__lcount>0) return(0);
00288         f__ltype=0;
00289         GETC(ch);
00290         if(ch!='(')
00291         {
00292                 if (nml_read > 1 && (ch < '0' || ch > '9')) {
00293                         Ungetc(ch,f__cf);
00294                         f__lquit = 2;
00295                         return 0;
00296                         }
00297                 if (rd_count(ch))
00298                         if(!f__cf || !feof(f__cf))
00299                                 errfl(f__elist->cierr,112,"complex format");
00300                         else
00301                                 err(f__elist->cierr,(EOF),"lread");
00302                 if(GETC(ch)!='*')
00303                 {
00304                         if(!f__cf || !feof(f__cf))
00305                                 errfl(f__elist->cierr,112,"no star");
00306                         else
00307                                 err(f__elist->cierr,(EOF),"lread");
00308                 }
00309                 if(GETC(ch)!='(')
00310                 {       Ungetc(ch,f__cf);
00311                         return(0);
00312                 }
00313         }
00314         else
00315                 f__lcount = 1;
00316         while(iswhit(GETC(ch)));
00317         Ungetc(ch,f__cf);
00318         nml_save = nml_read;
00319         nml_read = 0;
00320         if (ch = l_R(1,0))
00321                 return ch;
00322         if (!f__ltype)
00323                 errfl(f__elist->cierr,112,"no real part");
00324         lz = f__lx;
00325         while(iswhit(GETC(ch)));
00326         if(ch!=',')
00327         {       (void) Ungetc(ch,f__cf);
00328                 errfl(f__elist->cierr,112,"no comma");
00329         }
00330         while(iswhit(GETC(ch)));
00331         (void) Ungetc(ch,f__cf);
00332         if (ch = l_R(1,0))
00333                 return ch;
00334         if (!f__ltype)
00335                 errfl(f__elist->cierr,112,"no imaginary part");
00336         while(iswhit(GETC(ch)));
00337         if(ch!=')') errfl(f__elist->cierr,112,"no )");
00338         f__ly = f__lx;
00339         f__lx = lz;
00340 #ifdef Allow_TYQUAD
00341         f__llx = 0;
00342 #endif
00343         nml_read = nml_save;
00344         return(0);
00345 }
00346 
00347  static char nmLbuf[256], *nmL_next;
00348  static int (*nmL_getc_save)(Void);
00349 #ifdef KR_headers
00350  static int (*nmL_ungetc_save)(/* int, FILE* */);
00351 #else
00352  static int (*nmL_ungetc_save)(int, FILE*);
00353 #endif
00354 
00355  static int
00356 nmL_getc(Void)
00357 {
00358         int rv;
00359         if (rv = *nmL_next++)
00360                 return rv;
00361         l_getc = nmL_getc_save;
00362         l_ungetc = nmL_ungetc_save;
00363         return (*l_getc)();
00364         }
00365 
00366  static int
00367 #ifdef KR_headers
00368 nmL_ungetc(x, f) int x; FILE *f;
00369 #else
00370 nmL_ungetc(int x, FILE *f)
00371 #endif
00372 {
00373         f = f;  /* banish non-use warning */
00374         return *--nmL_next = x;
00375         }
00376 
00377  static int
00378 #ifdef KR_headers
00379 Lfinish(ch, dot, rvp) int ch, dot, *rvp;
00380 #else
00381 Lfinish(int ch, int dot, int *rvp)
00382 #endif
00383 {
00384         char *s, *se;
00385         static char what[] = "namelist input";
00386 
00387         s = nmLbuf + 2;
00388         se = nmLbuf + sizeof(nmLbuf) - 1;
00389         *s++ = ch;
00390         while(!issep(GETC(ch)) && ch!=EOF) {
00391                 if (s >= se) {
00392  nmLbuf_ovfl:
00393                         return *rvp = err__fl(f__elist->cierr,131,what);
00394                         }
00395                 *s++ = ch;
00396                 if (ch != '=')
00397                         continue;
00398                 if (dot)
00399                         return *rvp = err__fl(f__elist->cierr,112,what);
00400  got_eq:
00401                 *s = 0;
00402                 nmL_getc_save = l_getc;
00403                 l_getc = nmL_getc;
00404                 nmL_ungetc_save = l_ungetc;
00405                 l_ungetc = nmL_ungetc;
00406                 nmLbuf[1] = *(nmL_next = nmLbuf) = ',';
00407                 *rvp = f__lcount = 0;
00408                 return 1;
00409                 }
00410         if (dot)
00411                 goto done;
00412         for(;;) {
00413                 if (s >= se)
00414                         goto nmLbuf_ovfl;
00415                 *s++ = ch;
00416                 if (!isblnk(ch))
00417                         break;
00418                 if (GETC(ch) == EOF)
00419                         goto done;
00420                 }
00421         if (ch == '=')
00422                 goto got_eq;
00423  done:
00424         Ungetc(ch, f__cf);
00425         return 0;
00426         }
00427 
00428  static int
00429 l_L(Void)
00430 {
00431         int ch, rv, sawdot;
00432 
00433         if(f__lcount>0)
00434                 return(0);
00435         f__lcount = 1;
00436         f__ltype=0;
00437         GETC(ch);
00438         if(isdigit(ch))
00439         {
00440                 rd_count(ch);
00441                 if(GETC(ch)!='*')
00442                         if(!f__cf || !feof(f__cf))
00443                                 errfl(f__elist->cierr,112,"no star");
00444                         else
00445                                 err(f__elist->cierr,(EOF),"lread");
00446                 GETC(ch);
00447         }
00448         sawdot = 0;
00449         if(ch == '.') {
00450                 sawdot = 1;
00451                 GETC(ch);
00452                 }
00453         switch(ch)
00454         {
00455         case 't':
00456         case 'T':
00457                 if (nml_read && Lfinish(ch, sawdot, &rv))
00458                         return rv;
00459                 f__lx=1;
00460                 break;
00461         case 'f':
00462         case 'F':
00463                 if (nml_read && Lfinish(ch, sawdot, &rv))
00464                         return rv;
00465                 f__lx=0;
00466                 break;
00467         default:
00468                 if(isblnk(ch) || issep(ch) || ch==EOF)
00469                 {       (void) Ungetc(ch,f__cf);
00470                         return(0);
00471                 }
00472                 if (nml_read > 1) {
00473                         Ungetc(ch,f__cf);
00474                         f__lquit = 2;
00475                         return 0;
00476                         }
00477                 errfl(f__elist->cierr,112,"logical");
00478         }
00479         f__ltype=TYLONG;
00480         while(!issep(GETC(ch)) && ch!=EOF);
00481         Ungetc(ch, f__cf);
00482         return(0);
00483 }
00484 
00485 #define BUFSIZE 128
00486 
00487  static int
00488 l_CHAR(Void)
00489 {       int ch,size,i;
00490         static char rafail[] = "realloc failure";
00491         char quote,*p;
00492         if(f__lcount>0) return(0);
00493         f__ltype=0;
00494         if(f__lchar!=NULL) free(f__lchar);
00495         size=BUFSIZE;
00496         p=f__lchar = (char *)malloc((unsigned int)size);
00497         if(f__lchar == NULL)
00498                 errfl(f__elist->cierr,113,"no space");
00499 
00500         GETC(ch);
00501         if(isdigit(ch)) {
00502                 /* allow Fortran 8x-style unquoted string...    */
00503                 /* either find a repetition count or the string */
00504                 f__lcount = ch - '0';
00505                 *p++ = ch;
00506                 for(i = 1;;) {
00507                         switch(GETC(ch)) {
00508                                 case '*':
00509                                         if (f__lcount == 0) {
00510                                                 f__lcount = 1;
00511 #ifndef F8X_NML_ELIDE_QUOTES
00512                                                 if (nml_read)
00513                                                         goto no_quote;
00514 #endif
00515                                                 goto noquote;
00516                                                 }
00517                                         p = f__lchar;
00518                                         goto have_lcount;
00519                                 case ',':
00520                                 case ' ':
00521                                 case '\t':
00522                                 case '\n':
00523                                 case '/':
00524                                         Ungetc(ch,f__cf);
00525                                         /* no break */
00526                                 case EOF:
00527                                         f__lcount = 1;
00528                                         f__ltype = TYCHAR;
00529                                         return *p = 0;
00530                                 }
00531                         if (!isdigit(ch)) {
00532                                 f__lcount = 1;
00533 #ifndef F8X_NML_ELIDE_QUOTES
00534                                 if (nml_read) {
00535  no_quote:
00536                                         errfl(f__elist->cierr,112,
00537                                                 "undelimited character string");
00538                                         }
00539 #endif
00540                                 goto noquote;
00541                                 }
00542                         *p++ = ch;
00543                         f__lcount = 10*f__lcount + ch - '0';
00544                         if (++i == size) {
00545                                 f__lchar = (char *)realloc(f__lchar,
00546                                         (unsigned int)(size += BUFSIZE));
00547                                 if(f__lchar == NULL)
00548                                         errfl(f__elist->cierr,113,rafail);
00549                                 p = f__lchar + i;
00550                                 }
00551                         }
00552                 }
00553         else    (void) Ungetc(ch,f__cf);
00554  have_lcount:
00555         if(GETC(ch)=='\'' || ch=='"') quote=ch;
00556         else if(isblnk(ch) || (issep(ch) && ch != '\n') || ch==EOF) {
00557                 Ungetc(ch,f__cf);
00558                 return 0;
00559                 }
00560 #ifndef F8X_NML_ELIDE_QUOTES
00561         else if (nml_read > 1) {
00562                 Ungetc(ch,f__cf);
00563                 f__lquit = 2;
00564                 return 0;
00565                 }
00566 #endif
00567         else {
00568                 /* Fortran 8x-style unquoted string */
00569                 *p++ = ch;
00570                 for(i = 1;;) {
00571                         switch(GETC(ch)) {
00572                                 case ',':
00573                                 case ' ':
00574                                 case '\t':
00575                                 case '\n':
00576                                 case '/':
00577                                         Ungetc(ch,f__cf);
00578                                         /* no break */
00579                                 case EOF:
00580                                         f__ltype = TYCHAR;
00581                                         return *p = 0;
00582                                 }
00583  noquote:
00584                         *p++ = ch;
00585                         if (++i == size) {
00586                                 f__lchar = (char *)realloc(f__lchar,
00587                                         (unsigned int)(size += BUFSIZE));
00588                                 if(f__lchar == NULL)
00589                                         errfl(f__elist->cierr,113,rafail);
00590                                 p = f__lchar + i;
00591                                 }
00592                         }
00593                 }
00594         f__ltype=TYCHAR;
00595         for(i=0;;)
00596         {       while(GETC(ch)!=quote && ch!='\n'
00597                         && ch!=EOF && ++i<size) *p++ = ch;
00598                 if(i==size)
00599                 {
00600                 newone:
00601                         f__lchar= (char *)realloc(f__lchar,
00602                                         (unsigned int)(size += BUFSIZE));
00603                         if(f__lchar == NULL)
00604                                 errfl(f__elist->cierr,113,rafail);
00605                         p=f__lchar+i-1;
00606                         *p++ = ch;
00607                 }
00608                 else if(ch==EOF) return(EOF);
00609                 else if(ch=='\n')
00610                 {       if(*(p-1) != '\\') continue;
00611                         i--;
00612                         p--;
00613                         if(++i<size) *p++ = ch;
00614                         else goto newone;
00615                 }
00616                 else if(GETC(ch)==quote)
00617                 {       if(++i<size) *p++ = ch;
00618                         else goto newone;
00619                 }
00620                 else
00621                 {       (void) Ungetc(ch,f__cf);
00622                         *p = 0;
00623                         return(0);
00624                 }
00625         }
00626 }
00627 
00628  int
00629 #ifdef KR_headers
00630 c_le(a) cilist *a;
00631 #else
00632 c_le(cilist *a)
00633 #endif
00634 {
00635         if(!f__init)
00636                 f_init();
00637         f__fmtbuf="list io";
00638         f__curunit = &f__units[a->ciunit];
00639         if(a->ciunit>=MXUNIT || a->ciunit<0)
00640                 err(a->cierr,101,"stler");
00641         f__scale=f__recpos=0;
00642         f__elist=a;
00643         if(f__curunit->ufd==NULL && fk_open(SEQ,FMT,a->ciunit))
00644                 err(a->cierr,102,"lio");
00645         f__cf=f__curunit->ufd;
00646         if(!f__curunit->ufmt) err(a->cierr,103,"lio")
00647         return(0);
00648 }
00649 
00650  int
00651 #ifdef KR_headers
00652 l_read(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
00653 #else
00654 l_read(ftnint *number, char *ptr, ftnlen len, ftnint type)
00655 #endif
00656 {
00657 #define Ptr ((flex *)ptr)
00658         int i,n,ch;
00659         doublereal *yy;
00660         real *xx;
00661         for(i=0;i<*number;i++)
00662         {
00663                 if(f__lquit) return(0);
00664                 if(l_eof)
00665                         err(f__elist->ciend, EOF, "list in")
00666                 if(f__lcount == 0) {
00667                         f__ltype = 0;
00668                         for(;;)  {
00669                                 GETC(ch);
00670                                 switch(ch) {
00671                                 case EOF:
00672                                         err(f__elist->ciend,(EOF),"list in")
00673                                 case ' ':
00674                                 case '\t':
00675                                 case '\n':
00676                                         continue;
00677                                 case '/':
00678                                         f__lquit = 1;
00679                                         goto loopend;
00680                                 case ',':
00681                                         f__lcount = 1;
00682                                         goto loopend;
00683                                 default:
00684                                         (void) Ungetc(ch, f__cf);
00685                                         goto rddata;
00686                                 }
00687                         }
00688                 }
00689         rddata:
00690                 switch((int)type)
00691                 {
00692                 case TYINT1:
00693                 case TYSHORT:
00694                 case TYLONG:
00695 #ifndef ALLOW_FLOAT_IN_INTEGER_LIST_INPUT
00696                         ERR(l_R(0,1));
00697                         break;
00698 #endif
00699                 case TYREAL:
00700                 case TYDREAL:
00701                         ERR(l_R(0,0));
00702                         break;
00703 #ifdef TYQUAD
00704                 case TYQUAD:
00705                         n = l_R(0,2);
00706                         if (n)
00707                                 return n;
00708                         break;
00709 #endif
00710                 case TYCOMPLEX:
00711                 case TYDCOMPLEX:
00712                         ERR(l_C());
00713                         break;
00714                 case TYLOGICAL1:
00715                 case TYLOGICAL2:
00716                 case TYLOGICAL:
00717                         ERR(l_L());
00718                         break;
00719                 case TYCHAR:
00720                         ERR(l_CHAR());
00721                         break;
00722                 }
00723         while (GETC(ch) == ' ' || ch == '\t');
00724         if (ch != ',' || f__lcount > 1)
00725                 Ungetc(ch,f__cf);
00726         loopend:
00727                 if(f__lquit) return(0);
00728                 if(f__cf && ferror(f__cf)) {
00729                         clearerr(f__cf);
00730                         errfl(f__elist->cierr,errno,"list in");
00731                         }
00732                 if(f__ltype==0) goto bump;
00733                 switch((int)type)
00734                 {
00735                 case TYINT1:
00736                 case TYLOGICAL1:
00737                         Ptr->flchar = (char)f__lx;
00738                         break;
00739                 case TYLOGICAL2:
00740                 case TYSHORT:
00741                         Ptr->flshort = (short)f__lx;
00742                         break;
00743                 case TYLOGICAL:
00744                 case TYLONG:
00745                         Ptr->flint = (ftnint)f__lx;
00746                         break;
00747 #ifdef Allow_TYQUAD
00748                 case TYQUAD:
00749                         if (!(Ptr->fllongint = f__llx))
00750                                 Ptr->fllongint = f__lx;
00751                         break;
00752 #endif
00753                 case TYREAL:
00754                         Ptr->flreal=(real)(f__lx);
00755                         break;
00756                 case TYDREAL:
00757                         Ptr->fldouble=f__lx;
00758                         break;
00759                 case TYCOMPLEX:
00760                         xx=(real *)ptr;
00761                         *xx++ = (real)f__lx;
00762                         *xx = (real)f__ly;
00763                         break;
00764                 case TYDCOMPLEX:
00765                         yy=(doublereal *)ptr;
00766                         *yy++ = f__lx;
00767                         *yy = f__ly;
00768                         break;
00769                 case TYCHAR:
00770                         b_char(f__lchar,ptr,len);
00771                         break;
00772                 }
00773         bump:
00774                 if(f__lcount>0) f__lcount--;
00775                 ptr += len;
00776                 if (nml_read)
00777                         nml_read++;
00778         }
00779         return(0);
00780 #undef Ptr
00781 }
00782 #ifdef KR_headers
00783 integer s_rsle(a) cilist *a;
00784 #else
00785 integer s_rsle(cilist *a)
00786 #endif
00787 {
00788         int n;
00789 
00790         f__reading=1;
00791         f__external=1;
00792         f__formatted=1;
00793         if(n=c_le(a)) return(n);
00794         f__lioproc = l_read;
00795         f__lquit = 0;
00796         f__lcount = 0;
00797         l_eof = 0;
00798         if(f__curunit->uwrt && f__nowreading(f__curunit))
00799                 err(a->cierr,errno,"read start");
00800         if(f__curunit->uend)
00801                 err(f__elist->ciend,(EOF),"read start");
00802         l_getc = t_getc;
00803         l_ungetc = un_getc;
00804         f__doend = xrd_SL;
00805         return(0);
00806 }
00807 #ifdef __cplusplus
00808 }
00809 #endif

Generated on Sun Mar 4 15:03:43 2007 for Scilab [trunk] by  doxygen 1.5.1