/*Copyright (C) 1992, 1994 by Thomas Glen Smith. All Rights Reserved.*/ /* apllov1 APL2 V1.0.0 ************************************************* * Called from aplloaf if the workspace to be loaded is version 1 type. * ***********************************************************************/ #define INCLUDES APLCB+APLFUNCI+APLMEM+IO+STDIO+STRING+TREE #include "includes.h" int apllov1(fp) int fp; /* file descriptor handle */ { Avladdsb; Lovfscb; Lovfsfn; Strread; Treeroot; Treesrch; extern double fuzz; extern int indxorg; extern Treelist treehdr; Treelist workhdr; Avlnode node; int flags,i,j; char ch,*namebuf; void *leaf; static char eof = '\0'; i = read(fp,&fuzz,sizeof(fuzz)); i = read(fp,&indxorg,sizeof(indxorg)); if (NULL ==(workhdr = treehdr)) workhdr = treeroot(NULL); /* add a new root */ while (1 == (i = read(fp,&ch,sizeof(char)))) { if (ch == eof) break; /* all done reading tree */ namebuf = strread(fp); /* next name */ if (namebuf == NULL) return(105); /* can't read file */ i = read(fp,&flags,sizeof(int)); /* read flags */ if (flags & APLFUNC) leaf = lovfsfn(fp,flags); /* load function def. */ else leaf = lovfscb(fp,flags); /* load apl variable */ if (leaf == NULL) return(105); /* can't read file */ node = avladdsb(&(workhdr->avlhdr),namebuf,leaf); } if (i != 1) return(105); /* can't read file */ return(0); /* ok */ }