franz/lam2.c
/* Lload *****************************************************************/
/* Reads in and executes forms from the specified file. This should      */
/* really be an nlambda taking multiple arguments, but the error 	 */
/* handling gets funny in that case (one file out of several not 	 */
/* openable, for instance).						 */
Lload
Reads in and executes forms from the specified file. This should
really be an nlambda taking multiple arguments, but the error
handling gets funny in that case (one file out of several not
openable, for instance).
Lload Reads in and executes forms from the specified file . This should really be an nlambda taking multiple arguments but the error handling gets funny in that case ( one file out of several not openable for instance ) .
lispval
Lload()
{
	register FILE *port;
	register char *p, *ttemp; register lispval vtemp;
	struct nament *oldbnp = bnp;
	int orlevel,typ;
	char longname[100];
	char *shortname, *end2, *Ilibdir();
	chkarg(1,"load");
	if((typ = TYPE(lbot->val)) == ATOM)
	    ttemp =  lbot->val->a.pname ;  
	else if(typ == STRNG)
	    ttemp = (char *) lbot->val;
	else 
	     return(error("FILENAME MUST BE ATOMIC",FALSE));
	strcpy(longname, Ilibdir());
	for(p = longname; *p; p++);
	*p++ = '/'; *p = 0;
	shortname = p;
	strcpy(p,ttemp);
	for(; *p; p++);
		end2 = p;
	strcpy(p,".l");
	if ((port = fopen(shortname,"r")) == NULL &&
		(port = fopen(longname, "r")) == NULL) {
			*end2 = 0;
			if ((port = fopen(shortname,"r")) == NULL &&
				(port = fopen(longname, "r")) == NULL)
					errorh1(Vermisc,"Can't open file: ", 
						     nil,FALSE,0,lbot->val);
	}
	orlevel = rlevel;
	rlevel = 0;
	if(ISNIL(copval(gcload,CNIL)) &&
		loading->a.clb != tatom &&
		ISNIL(copval(gcdis,CNIL)))
		gc((struct types *)CNIL);    
	PUSHDOWN(Vpiport,P(port));
	PUSHDOWN(loading,tatom);	
	while ((vtemp = readr(port)) != eofa) {
	    eval(vtemp);
	}
	popnames(oldbnp);		
	rlevel = orlevel;
	fclose(port);
	return(nil);
}
lispval Lload ( ) { register FILE * port ; register char * p , * ttemp ; register lispval vtemp ; struct nament * oldbnp = bnp ; int orlevel , typ ; char longname [ 100 ] ; char * shortname , * end2 , * Ilibdir ( ) ; chkarg ( 1 , " " ) ; if ( ( typ = TYPE ( lbot -> val ) ) == ATOM ) ttemp = lbot -> val -> a . pname ; else if ( typ == STRNG ) ttemp = ( char * ) lbot -> val ; else return ( error ( " " , FALSE ) ) ; strcpy ( longname , Ilibdir ( ) ) ; for ( p = longname ; * p ; p ++ ) ; * p ++ = ' ' ; * p = 0 ; shortname = p ; strcpy ( p , ttemp ) ; for ( ; * p ; p ++ ) ; end2 = p ; strcpy ( p , " " ) ; if ( ( port = fopen ( shortname , " " ) ) == NULL && ( port = fopen ( longname , " " ) ) == NULL ) { * end2 = 0 ; if ( ( port = fopen ( shortname , " " ) ) == NULL && ( port = fopen ( longname , " " ) ) == NULL ) errorh1 ( Vermisc , " " , nil , FALSE , 0 , lbot -> val ) ; } orlevel = rlevel ; rlevel = 0 ; if ( ISNIL ( copval ( gcload , CNIL ) ) && loading -> a . clb != tatom && ISNIL ( copval ( gcdis , CNIL ) ) ) gc ( ( struct types * ) CNIL ) ; PUSHDOWN ( Vpiport , P ( port ) ) ; PUSHDOWN ( loading , tatom ) ; while ( ( vtemp = readr ( port ) ) != eofa ) { eval ( vtemp ) ; } popnames ( oldbnp ) ; rlevel = orlevel ; fclose ( port ) ; return ( nil ) ; }
Lload
Reads in and executes forms from the specified file.
Lload Reads in and executes forms from the specified file .
/*Savestack(4); not necessary because np not altered */ /* ttemp will point to name */ /*  do a gc if gc will be off  */ /* shallow bind the value of lisp atom piport 	*/ /* so readmacros will work			*/ /* set indication of loading status */ /* unbind piport, loading */