Exemple #1
0
int
s_wsue(cilist *a)
{
	int n;
	if(!init) f_init();
	if((n=c_sue(a,WRITE))) return(n);
	reading=0;
	reclen=0;
	if(!curunit->uwrt) nowwriting(curunit);
	recloc=ftell(cf);
	fseek(cf,(long)sizeof(int),1);
	return(0);
}
Exemple #2
0
Fichier : sue.c Projet : Sciumo/f2c
integer s_wsue(cilist *a)
{
	int n;
	if(!f__init) f_init();
	if(n=c_sue(a)) return(n);
	f__reading=0;
	f__reclen=0;
	if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
		err(a->cierr, errno, "write start");
	f__recloc=FTELL(f__cf);
	FSEEK(f__cf,(OFF_T)sizeof(uiolen),SEEK_CUR);
	return(0);
}
Exemple #3
0
integer s_wsue(cilist *a)
#endif
{
	int n;
	if(!f__init) f_init();
	if(n=c_sue(a)) return(n);
	f__reading=0;
	f__reclen=0;
	if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
		err(a->cierr, errno, "write start");
	f__recloc=ftell(f__cf);
	(void) fseek(f__cf,(long)sizeof(uiolen),SEEK_CUR);
	return(0);
}
Exemple #4
0
int
wsue (cilist64 *a, unit **fu)
{
    int             n;
    unit *ftnunit;

    if (!f77init)
        f_init ();
    if (n = c_sue (a, fu))
        return n;
    ftnunit = *fu;
    (void) f77nowwriting( ftnunit );
    ftnunit->f77reclen = 0;
    /*
    if (ftnunit->f77fio_buf == NULL)
       ftnunit->f77fio_buf = malloc (ftnunit->f77fio_size = FIO_ALLOC);
    */
    return (0);
}
Exemple #5
0
int
s_rsue(cilist *a)
{
	int n;
	if(!init) f_init();
	if((n=c_sue(a,READ))) return(n);
	reading=1;
	recpos=0;
	if(curunit->uwrt) nowreading(curunit);
	if(fread(&reclen,sizeof(int),1,cf)
		!= 1)
	{	if(feof(cf))
		{	curunit->uend = 1;
			err(a->ciend, EOF, "start");
		}
		clearerr(cf);
		err(a->cierr, errno, "start");
	}
	return(0);
}
Exemple #6
0
Fichier : sue.c Projet : Sciumo/f2c
integer s_rsue(cilist *a)
{
	int n;
	if(!f__init) f_init();
	f__reading=1;
	if(n=c_sue(a)) return(n);
	f__recpos=0;
	if(f__curunit->uwrt && f__nowreading(f__curunit))
		err(a->cierr, errno, "read start");
	if(fread((char *)&f__reclen,sizeof(uiolen),1,f__cf)
		!= 1)
	{	if(feof(f__cf))
		{	f__curunit->uend = 1;
			err(a->ciend, EOF, "start");
		}
		clearerr(f__cf);
		err(a->cierr, errno, "start");
	}
	return(0);
}
Exemple #7
0
static int
s_rsue_com (cilist64 *a, unit **fu)
{
    int             n;
    unit           *ftnunit;
    int		f77reclen_32bit;

    if (!f77init)
        f_init ();

    n = c_sue (a, fu);
    ftnunit = *fu;
    if (n) {
        if (n > 0) {
            errret(a->cierr, n, "s_rsue");
        } else {
            errret(a->ciend, n, "s_rsue");
        }
    }

    ftnunit->f77recpos = ftnunit->f77reclen = 0;

#ifdef I90
    if (ftnunit->uaction == WRITEONLY )
        errret(ftnunit->f77errlist.cierr,180,"startread");
#endif

    /*
     * The direct unformatted case, yup, in the sequential unformatted
     * file.
     */

    if ((ftnunit->uacc == DIRECT) && (ftnunit->ufmt == 0)) {
        if (ftnunit->url != 1) {
            ftnunit->f77do_unf = do_ud;
            ftnunit->f77reclen = ftnunit->url;
        } else {
            /* For 'SYSTEM' file set a very large MAX_INT value for record
            length so it cannot be exceeded
            */
#if (_MIPS_SIM == _MIPS_SIM_ABI64)
            ftnunit->f77reclen = LONGLONG_MAX;
#else
            ftnunit->f77reclen = LONG_MAX;
#endif
            ftnunit->f77do_unf = do_ud;
        }
        _fio_seq_pos( ftnunit->ufd, ftnunit );
        ftnunit->uwrt &= ~WR_OP;
        return (0);
    } else {
        if (ftnunit->uwrt & WR_OP)
            (void) f77nowreading (ftnunit);
    }

    /* The normal case. */

    if (ftnunit->uacc == KEYED) {
        ftnunit->f77do_unf = do_ui;
        ftnunit->f77idxlist.cimatch = a->cimatch;
        ftnunit->f77idxlist.cikeytype = a->cikeytype;
        ftnunit->f77idxlist.cikeyval.cicharval = a->cikeyval.cicharval;
        ftnunit->f77idxlist.cikeyid = a->cikeyid;
        ftnunit->f77idxlist.cinml = a->cinml;
        ftnunit->f77idxlist.cikeyvallen = a->cikeyvallen;
        if (n = idxread(ftnunit)) {
            if (n > 0) {
                errret(a->cierr, n, "s_rsue");
            } else {
                errret(a->ciend, n, "s_rsue");
            }
        }
    } else if (ftnunit->url != 1) {
        ftnunit->f77do_unf = do_us;
        if (ftnunit->uerror)
            unf_position (ftnunit->ufd, ftnunit);
        if (fread ((char *) &f77reclen_32bit, sizeof (int), 1, ftnunit->ufd) != 1) {
            if (feof (ftnunit->ufd)) {
                ftnunit->uend = 1;
                errret(a->ciend, EOF, "start");
            }
            clearerr(ftnunit->ufd);
            errret(a->cierr, errno, "start");
        }
        ftnunit->f77reclen = f77reclen_32bit;
    } else {
        ftnunit->f77reclen = INT_MAX;
        ftnunit->f77do_unf = do_ud;
    }
    return (0);
}