/*Copyright (C) 1992, 1996 by Thomas Glen Smith. All Rights Reserved.*/ /* lovfsfp APL2 V1.0.0 ************************************************* * Called from lovfsfn to read a function definition during a )load. * ***********************************************************************/ #define INCLUDES APLCB+APLFUNCI+APLTOKEN+IO+STDIO+STRING #include "includes.h" Aplfunc lovfsfp(fp,func,j) int fp; /* File descriptor handle */ Aplfunc func; /* Memory allocated for function stucture */ int j; /* Size of token array pointed to by functary */ { Lovfsfo; Offtptr; Apltoken cur,tok,*tokhdr; int i,k; i = read(fp, &k, sizeof(k)); /* Read offset to name token, */ func->funcname = (Apltoken)offtptr((char *)(func->functary), k); i = read(fp, func->functary, j); /* read array of tokens */ tok = func->functary; /* point to first in token array */ for ( j = func->functotl ; j > 0 ; j-- ) { tok->token_queue.token_next_ptr = (Apltoken)offtptr( (char *)(func->functary), tok->token_queue.token_next_offset); tok++; } tokhdr = func->functokp; /* point to array of token headers */ for ( j = func->funcstmt ; j > 0 ; j-- ) { i = read(fp, &k, sizeof(k)); /* read next offset */ *tokhdr++ = (Apltoken)offtptr( (char *)(func->functary), k); } i = read(fp, &k, sizeof(k)); /* Read offset local variable list, */ func->funcvars = (Apltoken)offtptr((char*)(func->functary), k); i = read(fp, &k, sizeof(k)); /* Read offset label list, */ func->funclabs = (Apltoken)offtptr((char*)(func->functary), k); lovfsfo(fp,func); /* go read token elements */ return(func); }