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  

wsfe.c

Go to the documentation of this file.
00001 /*write sequential formatted external*/
00002 #include "f2c.h"
00003 #include "fio.h"
00004 #include "fmt.h"
00005 extern int f__hiwater;
00006 
00007 #ifdef KR_headers
00008 x_putc(c)
00009 #else
00010 x_putc(int c)
00011 #endif
00012 {
00013         /* this uses \n as an indicator of record-end */
00014         if(c == '\n' && f__recpos < f__hiwater) {       /* fseek calls fflush, a loss */
00015 #ifndef NON_UNIX_STDIO
00016                 if(f__cf->_ptr + f__hiwater - f__recpos < buf_end(f__cf))
00017                         f__cf->_ptr += f__hiwater - f__recpos;
00018                 else
00019 #endif
00020                         (void) fseek(f__cf, (long)(f__hiwater - f__recpos), SEEK_CUR);
00021         }
00022 #ifdef OMIT_BLANK_CC
00023         if (!f__recpos++ && c == ' ')
00024                 return c;
00025 #else
00026         f__recpos++;
00027 #endif
00028         return putc(c,f__cf);
00029 }
00030 x_wSL(Void)
00031 {
00032         (*f__putn)('\n');
00033         f__recpos=0;
00034         f__cursor = 0;
00035         f__hiwater = 0;
00036         return(1);
00037 }
00038 xw_end(Void)
00039 {
00040         if(f__nonl == 0)
00041                 (*f__putn)('\n');
00042         f__hiwater = f__recpos = f__cursor = 0;
00043         return(0);
00044 }
00045 xw_rev(Void)
00046 {
00047         if(f__workdone) (*f__putn)('\n');
00048         f__hiwater = f__recpos = f__cursor = 0;
00049         return(f__workdone=0);
00050 }
00051 
00052 #ifdef KR_headers
00053 integer s_wsfe(a) cilist *a;    /*start*/
00054 #else
00055 integer s_wsfe(cilist *a)       /*start*/
00056 #endif
00057 {       int n;
00058         if(!f__init) f_init();
00059         if(n=c_sfe(a)) return(n);
00060         f__reading=0;
00061         f__sequential=1;
00062         f__formatted=1;
00063         f__external=1;
00064         f__elist=a;
00065         f__hiwater = f__cursor=f__recpos=0;
00066         f__nonl = 0;
00067         f__scale=0;
00068         f__fmtbuf=a->cifmt;
00069         f__curunit = &f__units[a->ciunit];
00070         f__cf=f__curunit->ufd;
00071         if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
00072         f__putn= x_putc;
00073         f__doed= w_ed;
00074         f__doned= w_ned;
00075         f__doend=xw_end;
00076         f__dorevert=xw_rev;
00077         f__donewrec=x_wSL;
00078         fmt_bg();
00079         f__cplus=0;
00080         f__cblank=f__curunit->ublnk;
00081         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
00082                 err(a->cierr,errno,"write start");
00083         return(0);
00084 }
 

Powered by Plone

This site conforms to the following standards: