Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

lio.h File Reference

Go to the source code of this file.


Data Structures

union  flex

Defines

#define TYUNKNOWN   0
#define TYADDR   1
#define TYSHORT   2
#define TYLONG   3
#define TYREAL   4
#define TYDREAL   5
#define TYCOMPLEX   6
#define TYDCOMPLEX   7
#define TYLOGICAL   8
#define TYCHAR   9
#define TYSUBR   10
#define TYINT1   11
#define TYLOGICAL1   12
#define TYLOGICAL2   13
#define LINTW   24
#define LINE   80
#define LLOGW   2
#define LGFMT   "%.9G"
#define LEFBL   24

Functions

int l_write (ftnint *, char *, ftnlen, ftnint)
void x_wsne (cilist *)
int c_le (cilist *)
int l_read (ftnint *, char *, ftnlen, ftnint)
integer e_rsle (void)
integer e_wsle (void)
integer s_wsne (cilist *)
int z_rnew (void)

Variables

int f__scale
int(* f__lioproc )(ftnint *, char *, ftnlen, ftnint)
int(* l_getc )(void)
int(*)(*) l_ungetc (int, FILE *)
ftnint L_len

Define Documentation

#define LEFBL   24
 

Definition at line 42 of file lio.h.

Referenced by lwrt_C(), and lwrt_F().

#define LGFMT   "%.9G"
 

Definition at line 39 of file lio.h.

Referenced by l_g().

#define LINE   80
 

Definition at line 31 of file lio.h.

Referenced by s_wsle(), and s_wsne().

#define LINTW   24
 

Definition at line 30 of file lio.h.

#define LLOGW   2
 

Definition at line 32 of file lio.h.

Referenced by lwrt_L().

#define TYADDR   1
 

Definition at line 12 of file lio.h.

#define TYCHAR   9
 

Definition at line 20 of file lio.h.

#define TYCOMPLEX   6
 

Definition at line 17 of file lio.h.

#define TYDCOMPLEX   7
 

Definition at line 18 of file lio.h.

#define TYDREAL   5
 

Definition at line 16 of file lio.h.

#define TYINT1   11
 

Definition at line 22 of file lio.h.

#define TYLOGICAL   8
 

Definition at line 19 of file lio.h.

#define TYLOGICAL1   12
 

Definition at line 23 of file lio.h.

#define TYLOGICAL2   13
 

Definition at line 24 of file lio.h.

#define TYLONG   3
 

Definition at line 14 of file lio.h.

#define TYREAL   4
 

Definition at line 15 of file lio.h.

#define TYSHORT   2
 

Definition at line 13 of file lio.h.

#define TYSUBR   10
 

Definition at line 21 of file lio.h.

#define TYUNKNOWN   0
 

Definition at line 11 of file lio.h.


Function Documentation

int c_le cilist  
 

Definition at line 490 of file lread.c.

00492 {
00493         if(!f__init)
00494                 f_init();
00495         f__fmtbuf="list io";
00496         if(a->ciunit>=MXUNIT || a->ciunit<0)
00497                 err(a->cierr,101,"stler");
00498         f__scale=f__recpos=0;
00499         f__elist=a;
00500         f__curunit = &f__units[a->ciunit];
00501         if(f__curunit->ufd==NULL && fk_open(SEQ,FMT,a->ciunit))
00502                 err(a->cierr,102,"lio");
00503         f__cf=f__curunit->ufd;
00504         if(!f__curunit->ufmt) err(a->cierr,103,"lio")
00505         return(0);
00506 }

integer e_rsle void   
 

Referenced by MAIN__(), s_rsne(), and x_rsne().

integer e_wsle void   
 

Referenced by s_wsne().

int l_read ftnint  ,
char *   ,
ftnlen   ,
ftnint   
 

Definition at line 510 of file lread.c.

References b_char(), err, ERR, errfl, f__lchar, f__lcount, f__lquit, f__ltype, f__lx, f__ly, GETC, i, l_C(), l_CHAR(), l_L(), l_R(), nml_read, TYQUAD, and Ungetc.

Referenced by s_rsle(), and x_rsne().

00512 {
00513 #define Ptr ((flex *)ptr)
00514         int i,n,ch;
00515         doublereal *yy;
00516         real *xx;
00517         for(i=0;i<*number;i++)
00518         {
00519                 if(f__lquit) return(0);
00520                 if(l_eof)
00521                         err(f__elist->ciend, EOF, "list in")
00522                 if(f__lcount == 0) {
00523                         f__ltype = 0;
00524                         for(;;)  {
00525                                 GETC(ch);
00526                                 switch(ch) {
00527                                 case EOF:
00528                                         err(f__elist->ciend,(EOF),"list in")
00529                                 case ' ':
00530                                 case '\t':
00531                                 case '\n':
00532                                         continue;
00533                                 case '/':
00534                                         f__lquit = 1;
00535                                         goto loopend;
00536                                 case ',':
00537                                         f__lcount = 1;
00538                                         goto loopend;
00539                                 default:
00540                                         (void) Ungetc(ch, f__cf);
00541                                         goto rddata;
00542                                 }
00543                         }
00544                 }
00545         rddata:
00546                 switch((int)type)
00547                 {
00548                 case TYINT1:
00549                 case TYSHORT:
00550                 case TYLONG:
00551                 case TYREAL:
00552                 case TYDREAL:
00553                         ERR(l_R(0));
00554                         break;
00555 #ifdef TYQUAD
00556                 case TYQUAD:
00557                         quad_read = 1;
00558                         n = l_R(0);
00559                         quad_read = 0;
00560                         if (n)
00561                                 return n;
00562                         break;
00563 #endif
00564                 case TYCOMPLEX:
00565                 case TYDCOMPLEX:
00566                         ERR(l_C());
00567                         break;
00568                 case TYLOGICAL1:
00569                 case TYLOGICAL2:
00570                 case TYLOGICAL:
00571                         ERR(l_L());
00572                         break;
00573                 case TYCHAR:
00574                         ERR(l_CHAR());
00575                         break;
00576                 }
00577         while (GETC(ch) == ' ' || ch == '\t');
00578         if (ch != ',' || f__lcount > 1)
00579                 Ungetc(ch,f__cf);
00580         loopend:
00581                 if(f__lquit) return(0);
00582                 if(f__cf && ferror(f__cf)) {
00583                         clearerr(f__cf);
00584                         errfl(f__elist->cierr,errno,"list in");
00585                         }
00586                 if(f__ltype==0) goto bump;
00587                 switch((int)type)
00588                 {
00589                 case TYINT1:
00590                 case TYLOGICAL1:
00591                         Ptr->flchar = (char)f__lx;
00592                         break;
00593                 case TYLOGICAL2:
00594                 case TYSHORT:
00595                         Ptr->flshort = (short)f__lx;
00596                         break;
00597                 case TYLOGICAL:
00598                 case TYLONG:
00599                         Ptr->flint=f__lx;
00600                         break;
00601 #ifdef Allow_TYQUAD
00602                 case TYQUAD:
00603                         if (!(Ptr->fllongint = f__llx))
00604                                 Ptr->fllongint = f__lx;
00605                         break;
00606 #endif
00607                 case TYREAL:
00608                         Ptr->flreal=f__lx;
00609                         break;
00610                 case TYDREAL:
00611                         Ptr->fldouble=f__lx;
00612                         break;
00613                 case TYCOMPLEX:
00614                         xx=(real *)ptr;
00615                         *xx++ = f__lx;
00616                         *xx = f__ly;
00617                         break;
00618                 case TYDCOMPLEX:
00619                         yy=(doublereal *)ptr;
00620                         *yy++ = f__lx;
00621                         *yy = f__ly;
00622                         break;
00623                 case TYCHAR:
00624                         b_char(f__lchar,ptr,len);
00625                         break;
00626                 }
00627         bump:
00628                 if(f__lcount>0) f__lcount--;
00629                 ptr += len;
00630                 if (nml_read)
00631                         nml_read++;
00632         }
00633         return(0);
00634 #undef Ptr
00635 }

int l_write ftnint  ,
char *   ,
ftnlen   ,
ftnint   
 

Definition at line 245 of file lwrite.c.

References f__fatal(), i, lwrt_A(), lwrt_C(), lwrt_F(), lwrt_I(), lwrt_L(), and TYQUAD.

Referenced by x_wsne().

00247 {
00248 #define Ptr ((flex *)ptr)
00249         int i;
00250         longint x;
00251         double y,z;
00252         real *xx;
00253         doublereal *yy;
00254         for(i=0;i< *number; i++)
00255         {
00256                 switch((int)type)
00257                 {
00258                 default: f__fatal(204,"unknown type in lio");
00259                 case TYINT1:
00260                         x = Ptr->flchar;
00261                         goto xint;
00262                 case TYSHORT:
00263                         x=Ptr->flshort;
00264                         goto xint;
00265 #ifdef Allow_TYQUAD
00266                 case TYQUAD:
00267                         x = Ptr->fllongint;
00268                         goto xint;
00269 #endif
00270                 case TYLONG:
00271                         x=Ptr->flint;
00272                 xint:   lwrt_I(x);
00273                         break;
00274                 case TYREAL:
00275                         y=Ptr->flreal;
00276                         goto xfloat;
00277                 case TYDREAL:
00278                         y=Ptr->fldouble;
00279                 xfloat: lwrt_F(y);
00280                         break;
00281                 case TYCOMPLEX:
00282                         xx= &Ptr->flreal;
00283                         y = *xx++;
00284                         z = *xx;
00285                         goto xcomplex;
00286                 case TYDCOMPLEX:
00287                         yy = &Ptr->fldouble;
00288                         y= *yy++;
00289                         z = *yy;
00290                 xcomplex:
00291                         lwrt_C(y,z);
00292                         break;
00293                 case TYLOGICAL1:
00294                         x = Ptr->flchar;
00295                         goto xlog;
00296                 case TYLOGICAL2:
00297                         x = Ptr->flshort;
00298                         goto xlog;
00299                 case TYLOGICAL:
00300                         x = Ptr->flint;
00301                 xlog:   lwrt_L(Ptr->flint, len);
00302                         break;
00303                 case TYCHAR:
00304                         lwrt_A(ptr,len);
00305                         break;
00306                 }
00307                 ptr += len;
00308         }
00309         return(0);
00310 }

integer s_wsne cilist  
 

Definition at line 9 of file wsne.c.

References a, c_le(), e_wsle(), err, f__nowwriting(), LINE, and x_wsne().

Referenced by print_ne().

00011 {
00012         int n;
00013 
00014         if(n=c_le(a))
00015                 return(n);
00016         f__reading=0;
00017         f__external=1;
00018         f__formatted=1;
00019         f__putn = t_putc;
00020         L_len = LINE;
00021         f__donewrec = x_wSL;
00022         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
00023                 err(a->cierr, errno, "namelist output start");
00024         x_wsne(a);
00025         return e_wsle();
00026         }

void x_wsne cilist  
 

Definition at line 21 of file xwsne.c.

References Vardesc::addr, cilist::cifmt, Vardesc::dims, f__Aquote, l_write(), Namelist::name, Vardesc::name, nl_donewrec(), Namelist::nvars, PUT, Vardesc::type, v, and Namelist::vars.

Referenced by s_wsne(), and s_wsni().

00023 {
00024         Namelist *nl;
00025         char *s;
00026         Vardesc *v, **vd, **vde;
00027         ftnint *number, type;
00028         ftnlen *dims;
00029         ftnlen size;
00030         static ftnint one = 1;
00031         extern ftnlen f__typesize[];
00032 
00033         nl = (Namelist *)a->cifmt;
00034         PUT('&');
00035         for(s = nl->name; *s; s++)
00036                 PUT(*s);
00037         PUT(' ');
00038         f__Aquote = 1;
00039         vd = nl->vars;
00040         vde = vd + nl->nvars;
00041         while(vd < vde) {
00042                 v = *vd++;
00043                 s = v->name;
00044 #ifdef No_Extra_Namelist_Newlines
00045                 if (f__recpos+strlen(s)+2 >= L_len)
00046 #endif
00047                         nl_donewrec();
00048                 while(*s)
00049                         PUT(*s++);
00050                 PUT(' ');
00051                 PUT('=');
00052                 number = (dims = v->dims) ? dims + 1 : &one;
00053                 type = v->type;
00054                 if (type < 0) {
00055                         size = -type;
00056                         type = TYCHAR;
00057                         }
00058                 else
00059                         size = f__typesize[type];
00060                 l_write(number, v->addr, size, type);
00061                 if (vd < vde) {
00062                         if (f__recpos+2 >= L_len)
00063                                 nl_donewrec();
00064                         PUT(',');
00065                         PUT(' ');
00066                         }
00067                 else if (f__recpos+1 >= L_len)
00068                         nl_donewrec();
00069                 }
00070         f__Aquote = 0;
00071         PUT('/');
00072         }

int z_rnew void   
 


Variable Documentation

int(* f__lioproc)(ftnint*, char*, ftnlen, ftnint)
 

Definition at line 63 of file lio.h.

int f__scale
 

Definition at line 55 of file lio.h.

int(* l_getc)(void)
 

ftnint L_len
 

Definition at line 74 of file lio.h.

Referenced by lwrt_A(), lwrt_C(), lwrt_F(), lwrt_I(), and lwrt_L().

int(*)(*) l_ungetc(int,FILE*)
 

Definition at line 66 of file lio.h.

 

Powered by Plone

This site conforms to the following standards: