Metropoli BBS
VIEWER: lovfscb.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1994 by Thomas Glen Smith.  All Rights Reserved.*/
/* lovfscb APL2 V1.0.0 *************************************************
* Called from apllov1 to read an apl variable during )load operations. *
***********************************************************************/
#define INCLUDES APLCB+IO+STDIO+STRING
#include "includes.h"
Aplcb lovfscb(fp,flags)
int fp; /* file descriptor handle */
int flags; /* aplflags, already read by apllov_ */
{
	Getcb; Lovfscb;
	extern int aplerr;
	Aplcb out;
	int count,i,j,k,rank,size,tflags,type;
	int *ip;
	char *cp;

	i = read(fp,&(count),	sizeof(count));
	i = read(fp,&(rank),	sizeof(rank));
	i = read(fp,&(size),	sizeof(size));
	out = getcb(NULL,count,flags,rank,NULL);
	if (aplerr) return(NULL); /* out of memory */
	ip = out->apldim; /* dimensions ptr */
	for ( j = out->aplrank ; j > 0 ; j-- )
		i = read(fp, ip++, sizeof(int));
	cp = out->aplptr.aplchar; /* save data */
	for ( j = out->aplcount ; j > 0 ; j-- ) {
     	if (flags & APLAPL) {
			i = read(fp,&tflags,sizeof(int)); /* read flags */
          	*((Aplcb*)cp) = lovfscb(fp, tflags); /* read nested */
          }
		else i = read(fp, cp, out->aplsize);
		cp += out->aplsize;
	}
	return(out);
}
[ RETURN TO DIRECTORY ]