static char *sccsid
= "@(#)fex3.c 35.1 5/6/81";
/* chkarg ***************************************************************/
/* This insures that there are at least expnum arguments passed to the */
/* BCD function that calls this. If there are fewer, nil arguments */
/* are pushed onto the name stack and np adjusted accordingly. */
int expnum
; /* expected number of args */
register struct argent
*work
;
register struct argent
*lbot
, *np
;
for(work
= np
,np
= lbot
+ expnum
; work
< np
; )
*Ndumplisp -- create executable version of current state of this lisp.
register struct exec
*workp
;
register lispval argptr
, temp
;
extern int dmpmode
,holend
,curhbeg
,usehole
;
int descrip
, des2
, count
, ax
,mode
;
/* dump mode is kept in decimal (which looks like octal in dmpmode)
and is changeable via (sstatus dumpmode n) where n is 413 or 410
if(dmpmode
== 413) mode
= 0413;
workp
->a_text
= curhbeg
& (~PAGRND
);
workp
->a_text
= ((((unsigned) (&holend
)) - 1) & (~PAGRND
)) + PAGSIZ
;
workp
->a_data
= (unsigned) sbrk(0) - workp
->a_text
;
workp
->a_data
= ((int)&end
) - workp
->a_text
;
workp
->a_entry
= (unsigned) gstart();
fname
= "savedlisp"; /*set defaults*/
if(read(des2
,&old
,sizeof(old
))>=0)
work
.a_syms
= old
.a_syms
;
descrip
=creat(fname
,0777); /*doit!*/
if(-1==write(descrip
,workp
,sizeof(work
)))
error("Dumplisp failed",FALSE
);
if(mode
== 0413) lseek(descrip
,PAGSIZ
,0);
if( -1==write(descrip
,0,workp
->a_text
) ||
-1==write(descrip
,workp
->a_text
,workp
->a_data
) ) {
error("Dumplisp failed",FALSE
);
if(des2
>0 && work
.a_syms
) {
count
= old
.a_text
+ old
.a_data
+ sizeof(old
);
if(-1==lseek(des2
,count
,0))
error("Could not seek to stab",FALSE
);
for(count
= old
.a_syms
;count
> 0; count
-=BUFSIZ
) {
ax
= read(des2
,tbuf
,BUFSIZ
);
printf("Unexpected end of syms",count
);
error("Failure to write dumplisp stab",FALSE
);
register struct exec
*workp
;
register lispval argptr
, temp
;
extern int dmpmode
,holend
,curhbeg
,usehole
;
int descrip
, des2
, count
, ax
,mode
;
/* dump mode is kept in decimal (which looks like octal in dmpmode)
and is changeable via (sstatus dumpmode n) where n is 413 or 410
if(dmpmode
== 413) mode
= 0413;
workp
->a_text
= curhbeg
& (~PAGRND
);
workp
->a_text
= ((((unsigned) (&holend
)) - 1) & (~PAGRND
)) + PAGSIZ
;
workp
->a_data
= (unsigned) sbrk(0) - workp
->a_text
;
workp
->a_entry
= (unsigned) gstart();
fname
= "savedlisp"; /*set defaults*/
if(read(des2
,&old
,sizeof(old
))>=0)
work
.a_syms
= old
.a_syms
;
descrip
=creat(fname
,0777); /*doit!*/
if(-1==write(descrip
,workp
,sizeof(work
)))
error("Dumplisp failed",FALSE
);
if(mode
== 0413) lseek(descrip
,PAGSIZ
,0);
if( -1==write(descrip
,0,workp
->a_text
) ||
-1==write(descrip
,workp
->a_text
,workp
->a_data
) ) {
error("Dumplisp failed",FALSE
);
if(des2
>0 && work
.a_syms
) {
count
= old
.a_text
+ old
.a_data
+ (old
.a_magic
== 0413 ? PAGSIZ
if(-1==lseek(des2
,count
,0))
error("Could not seek to stab",FALSE
);
for(count
= old
.a_syms
;count
> 0; count
-=BUFSIZ
) {
ax
= read(des2
,tbuf
,(count
< BUFSIZ
? count
: BUFSIZ
));
printf("Unexpected end of syms",count
);
error("Failure to write dumplisp stab",FALSE
);
(old
.a_magic
== 0413 ? PAGSIZ
: sizeof(old
))
+ old
.a_text
+ old
.a_data
+ old
.a_trsize
+ old
.a_drsize
+ old
.a_syms
,
error(" Could not seek to string table ",FALSE
);
ax
= read(des2
,tbuf
,BUFSIZ
);
error("Error in string table read ",FALSE
);
if ((tx
= TYPE(ptr
)) == typ
) return(tatom
);
if ((tx
== INT
) && (typ
== ATOM
)) return(tatom
);
handy
= lbot
->val
->d
.car
;
if(TYPE(handy
)==ATOM
&& handy
->a
.fnbnd
!=nil
)