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  

due.c

Go to the documentation of this file.
00001 #include "f2c.h"
00002 #include "fio.h"
00003 
00004 #ifdef KR_headers
00005 c_due(a) cilist *a;
00006 #else
00007 c_due(cilist *a)
00008 #endif
00009 {
00010         if(!f__init) f_init();
00011         if(a->ciunit>=MXUNIT || a->ciunit<0)
00012                 err(a->cierr,101,"startio");
00013         f__sequential=f__formatted=f__recpos=0;
00014         f__external=1;
00015         f__curunit = &f__units[a->ciunit];
00016         f__elist=a;
00017         if(f__curunit->ufd==NULL && fk_open(DIR,UNF,a->ciunit) ) err(a->cierr,104,"due");
00018         f__cf=f__curunit->ufd;
00019         if(f__curunit->ufmt) err(a->cierr,102,"cdue")
00020         if(!f__curunit->useek) err(a->cierr,104,"cdue")
00021         if(f__curunit->ufd==NULL) err(a->cierr,114,"cdue")
00022         (void) fseek(f__cf,(long)(a->cirec-1)*f__curunit->url,SEEK_SET);
00023         f__curunit->uend = 0;
00024         return(0);
00025 }
00026 #ifdef KR_headers
00027 integer s_rdue(a) cilist *a;
00028 #else
00029 integer s_rdue(cilist *a)
00030 #endif
00031 {
00032         int n;
00033         if(n=c_due(a)) return(n);
00034         f__reading=1;
00035         if(f__curunit->uwrt && f__nowreading(f__curunit))
00036                 err(a->cierr,errno,"read start");
00037         return(0);
00038 }
00039 #ifdef KR_headers
00040 integer s_wdue(a) cilist *a;
00041 #else
00042 integer s_wdue(cilist *a)
00043 #endif
00044 {
00045         int n;
00046         if(n=c_due(a)) return(n);
00047         f__reading=0;
00048         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
00049                 err(a->cierr,errno,"write start");
00050         return(0);
00051 }
00052 integer e_rdue(Void)
00053 {
00054         if(f__curunit->url==1 || f__recpos==f__curunit->url)
00055                 return(0);
00056         (void) fseek(f__cf,(long)(f__curunit->url-f__recpos),SEEK_CUR);
00057         if(ftell(f__cf)%f__curunit->url)
00058                 err(f__elist->cierr,200,"syserr");
00059         return(0);
00060 }
00061 integer e_wdue(Void)
00062 {
00063 #ifdef ALWAYS_FLUSH
00064         if (fflush(f__cf))
00065                 err(f__elist->cierr,errno,"write end");
00066 #endif
00067         return(e_rdue());
00068 }
 

Powered by Plone

This site conforms to the following standards: