home *** CD-ROM | disk | FTP | other *** search
- The following are changes I have made to xlisp 2.0 source. Most of these
- changes produce considerable speed ups. This distribution is very
- rough but maybe someone can wade through it and come of with a cleaned
- up version of the speed ups. Note this is a striaght context diff so
- more than just the speed ups are included, BEWARE! If you are able to
- clean up or enhance these speed ups in any way I would apreciate the
- feedback.
-
- JonnyG.
-
- diff -c ../xlisp.org/xlbfun.c ../xlisp/xlbfun.c
- *** ../xlisp.org/xlbfun.c Sun May 7 22:25:38 1989
- --- ../xlisp/xlbfun.c Wed Apr 5 16:18:23 1989
- ***************
- *** 558,563 ****
- --- 558,578 ----
- return (val);
- }
-
- + LVAL xcopyarray()
- + {
- + LVAL src, dest;
- + int num;
- + register int i;
- +
- + src = xlgavector();
- + dest = xlgavector();
- + xllastarg();
- + num = (getsize(src) < getsize(dest)) ? getsize(src) : getsize(dest);
- + for (i = 0; i < num; i++)
- + setelement(dest,i,getelement(src,i));
- + return(dest);
- + }
- +
- /* xerror - special form 'error' */
- LVAL xerror()
- {
- diff -c ../xlisp.org/xldbug.c ../xlisp/xldbug.c
- *** ../xlisp.org/xldbug.c Sun May 7 22:25:43 1989
- --- ../xlisp/xldbug.c Wed Apr 5 16:18:24 1989
- ***************
- *** 14,20 ****
- extern char buf[];
-
- /* external routines */
- ! extern char *malloc();
-
- /* forward declarations */
- FORWARD LVAL stacktop();
- --- 14,20 ----
- extern char buf[];
-
- /* external routines */
- ! extern char *xlmalloc();
-
- /* forward declarations */
- FORWARD LVAL stacktop();
- diff -c ../xlisp.org/xldmem.c ../xlisp/xldmem.c
- *** ../xlisp.org/xldmem.c Sun May 7 22:25:46 1989
- --- ../xlisp/xldmem.c Wed Apr 5 16:18:25 1989
- ***************
- *** 6,13 ****
- #include "xlisp.h"
-
- /* node flags */
- ! #define MARK 1
- ! #define LEFT 2
-
- /* macro to compute the size of a segment */
- #define segsize(n) (sizeof(SEGMENT)+((n)-1)*sizeof(struct node))
- --- 6,13 ----
- #include "xlisp.h"
-
- /* node flags */
- ! #define MARK 0x20
- ! #define LEFT 0x40
-
- /* macro to compute the size of a segment */
- #define segsize(n) (sizeof(SEGMENT)+((n)-1)*sizeof(struct node))
- ***************
- *** 21,37 ****
- SEGMENT *segs,*lastseg,*fixseg,*charseg;
- int anodes,nsegs,gccalls;
- long nnodes,nfree,total;
- ! LVAL fnodes;
-
- /* external procedures */
- ! extern char *malloc();
- ! extern char *calloc();
-
- /* forward declarations */
- ! FORWARD LVAL newnode();
- FORWARD unsigned char *stralloc();
- FORWARD SEGMENT *newsegment();
-
- /* cons - construct a new cons node */
- LVAL cons(x,y)
- LVAL x,y;
- --- 21,50 ----
- SEGMENT *segs,*lastseg,*fixseg,*charseg;
- int anodes,nsegs,gccalls;
- long nnodes,nfree,total;
- ! LVAL fnodes = NIL;
-
- /* external procedures */
- ! extern char *xlmalloc();
- ! extern char *xlcalloc();
-
- /* forward declarations */
- ! FORWARD LVAL Newnode();
- FORWARD unsigned char *stralloc();
- FORWARD SEGMENT *newsegment();
-
- + LVAL _nnode;
- + FIXTYPE _tfixed;
- + int _tint;
- +
- + #define newnode(type) (((_nnode = fnodes) != NIL) ? \
- + ((fnodes = cdr(_nnode)), \
- + nfree--, \
- + (_nnode->n_type = type), \
- + rplacd(_nnode,NIL), \
- + _nnode) \
- + : (_nnode = Newnode(type)))
- +
- +
- /* cons - construct a new cons node */
- LVAL cons(x,y)
- LVAL x,y;
- ***************
- *** 129,140 ****
- }
-
- /* cvfixnum - convert an integer to a fixnum node */
- ! LVAL cvfixnum(n)
- FIXTYPE n;
- {
- LVAL val;
- - if (n >= SFIXMIN && n <= SFIXMAX)
- - return (&fixseg->sg_nodes[(int)n-SFIXMIN]);
- val = newnode(FIXNUM);
- val->n_fixnum = n;
- return (val);
- --- 142,151 ----
- }
-
- /* cvfixnum - convert an integer to a fixnum node */
- ! LVAL Cvfixnum(n)
- FIXTYPE n;
- {
- LVAL val;
- val = newnode(FIXNUM);
- val->n_fixnum = n;
- return (val);
- ***************
- *** 151,157 ****
- }
-
- /* cvchar - convert an integer to a character node */
- ! LVAL cvchar(n)
- int n;
- {
- if (n >= CHARMIN && n <= CHARMAX)
- --- 162,168 ----
- }
-
- /* cvchar - convert an integer to a character node */
- ! LVAL Cvchar(n)
- int n;
- {
- if (n >= CHARMIN && n <= CHARMAX)
- ***************
- *** 180,185 ****
- --- 191,225 ----
- return (val);
- }
-
- + #ifdef WINDOWS
- + LVAL newwinobj(size)
- + int size;
- + {
- + LVAL val;
- + val = newnode(WINOBJ);
- + if (size > 0) {
- + xlprot1(val);
- + if ((val->n_winobj = xldcalloc(1,size)) == NULL) {
- + findmem();
- + if ((val->n_winobj = xldcalloc(1,size)) == NULL)
- + xlfail("insufficient memory");
- + }
- + xlpop();
- + }
- + else val->n_winobj = NULL;
- + return(val);
- + }
- +
- + LVAL cvwinobj(p)
- + char *p;
- + {
- + LVAL val;
- + val = newnode(WINOBJ);
- + val->n_winobj = p;
- + return(val);
- + }
- + #endif
- +
- /* newclosure - allocate and initialize a new closure */
- LVAL newclosure(name,type,env,fenv)
- LVAL name,type,env,fenv;
- ***************
- *** 204,212 ****
- vect = newnode(VECTOR);
- vect->n_vsize = 0;
- if (bsize = size * sizeof(LVAL)) {
- ! if ((vect->n_vdata = (LVAL *)calloc(1,bsize)) == NULL) {
- findmem();
- ! if ((vect->n_vdata = (LVAL *)calloc(1,bsize)) == NULL)
- xlfail("insufficient vector space");
- }
- vect->n_vsize = size;
- --- 244,252 ----
- vect = newnode(VECTOR);
- vect->n_vsize = 0;
- if (bsize = size * sizeof(LVAL)) {
- ! if ((vect->n_vdata = (LVAL *)xldcalloc(1,bsize)) == NULL) {
- findmem();
- ! if ((vect->n_vdata = (LVAL *)xldcalloc(1,bsize)) == NULL)
- xlfail("insufficient vector space");
- }
- vect->n_vsize = size;
- ***************
- *** 217,223 ****
- }
-
- /* newnode - allocate a new node */
- ! LOCAL LVAL newnode(type)
- int type;
- {
- LVAL nnode;
- --- 257,263 ----
- }
-
- /* newnode - allocate a new node */
- ! LVAL Newnode(type)
- int type;
- {
- LVAL nnode;
- ***************
- *** 248,256 ****
- unsigned char *sptr;
-
- /* allocate memory for the string copy */
- ! if ((sptr = (unsigned char *)malloc(size)) == NULL) {
- gc();
- ! if ((sptr = (unsigned char *)malloc(size)) == NULL)
- xlfail("insufficient string space");
- }
- total += (long)size;
- --- 288,296 ----
- unsigned char *sptr;
-
- /* allocate memory for the string copy */
- ! if ((sptr = (unsigned char *)xldmalloc(size)) == NULL) {
- gc();
- ! if ((sptr = (unsigned char *)xldmalloc(size)) == NULL)
- xlfail("insufficient string space");
- }
- total += (long)size;
- ***************
- *** 330,336 ****
- LVAL ptr;
- {
- register LVAL this,prev,tmp;
- ! int type,i,n;
-
- /* initialize */
- prev = NIL;
- --- 370,376 ----
- LVAL ptr;
- {
- register LVAL this,prev,tmp;
- ! register int i,n;
-
- /* initialize */
- prev = NIL;
- ***************
- *** 340,380 ****
- for (;;) {
-
- /* descend as far as we can */
- ! while (!(this->n_flags & MARK))
-
- /* check cons and symbol nodes */
- ! if ((type = ntype(this)) == CONS) {
- ! if (tmp = car(this)) {
- ! this->n_flags |= MARK|LEFT;
- ! rplaca(this,prev);
- ! }
- ! else if (tmp = cdr(this)) {
- ! this->n_flags |= MARK;
- rplacd(this,prev);
- ! }
- ! else { /* both sides nil */
- ! this->n_flags |= MARK;
- break;
- ! }
- ! prev = this; /* step down the branch */
- ! this = tmp;
- ! }
- !
- ! /* mark other node types */
- else {
- ! this->n_flags |= MARK;
- ! switch (type) {
- ! case SYMBOL:
- ! case OBJECT:
- ! case VECTOR:
- ! case CLOSURE:
- ! for (i = 0, n = getsize(this); --n >= 0; ++i)
- ! if (tmp = getelement(this,i))
- ! mark(tmp);
- ! break;
- ! }
- ! break;
- ! }
-
- /* backup to a point where we can continue descending */
- for (;;)
- --- 380,409 ----
- for (;;) {
-
- /* descend as far as we can */
- ! while (!(this->n_type & MARK))
-
- /* check cons and symbol nodes */
- ! if ((i = (this->n_type |= MARK) & TYPEFIELD) == CONS) {
- ! if (tmp = car(this)) {
- ! this->n_type |= LEFT;
- ! rplaca(this,prev);}
- ! else if (tmp = cdr(this))
- rplacd(this,prev);
- ! else /* both sides nil */
- break;
- ! prev = this; /* step down the branch */
- ! this = tmp;
- ! }
- else {
- ! if ((i & ARRAY) != 0)
- ! for (i = 0, n = getsize(this); i < n;)
- ! if (tmp = getelement(this,i++))
- ! if ((tmp->n_type & (ARRAY|MARK)) == ARRAY ||
- ! tmp->n_type == CONS)
- ! mark(tmp);
- ! else tmp->n_type |= MARK;
- ! break;
- ! }
-
- /* backup to a point where we can continue descending */
- for (;;)
- ***************
- *** 381,388 ****
-
- /* make sure there is a previous node */
- if (prev) {
- ! if (prev->n_flags & LEFT) { /* came from left side */
- ! prev->n_flags &= ~LEFT;
- tmp = car(prev);
- rplaca(prev,this);
- if (this = cdr(prev)) {
- --- 410,417 ----
-
- /* make sure there is a previous node */
- if (prev) {
- ! if (prev->n_type & LEFT) { /* came from left side */
- ! prev->n_type &= ~LEFT;
- tmp = car(prev);
- rplaca(prev,this);
- if (this = cdr(prev)) {
- ***************
- *** 399,406 ****
- }
-
- /* no previous node, must be done */
- ! else
- ! return;
- }
- }
-
- --- 428,434 ----
- }
-
- /* no previous node, must be done */
- ! else return;
- }
- }
-
- ***************
- *** 407,434 ****
- /* sweep - sweep all unmarked nodes and add them to the free list */
- LOCAL sweep()
- {
- ! SEGMENT *seg;
- ! LVAL p;
- ! int n;
-
- - /* empty the free list */
- fnodes = NIL;
- ! nfree = 0L;
-
- /* add all unmarked nodes */
- for (seg = segs; seg; seg = seg->sg_next) {
- ! if (seg == fixseg) /* don't sweep the fixnum segment */
- continue;
- - else if (seg == charseg) /* don't sweep the character segment */
- - continue;
- p = &seg->sg_nodes[0];
- ! for (n = seg->sg_size; --n >= 0; ++p)
- ! if (!(p->n_flags & MARK)) {
- switch (ntype(p)) {
- case STRING:
- if (getstring(p) != NULL) {
- total -= (long)getslength(p);
- ! free(getstring(p));
- }
- break;
- case STREAM:
- --- 435,463 ----
- /* sweep - sweep all unmarked nodes and add them to the free list */
- LOCAL sweep()
- {
- ! register SEGMENT *seg;
- ! register LVAL p;
- ! register int n;
-
- fnodes = NIL;
- ! nfree = 0l;
-
- /* add all unmarked nodes */
- for (seg = segs; seg; seg = seg->sg_next) {
- ! if (seg == fixseg || seg == charseg)
- ! /* don't sweep the fixed segments */
- continue;
- p = &seg->sg_nodes[0];
- ! for (n = seg->sg_size; --n >= 0;)
- ! if (p->n_type & MARK)
- ! (p++)->n_type &= ~MARK;
- ! else {
- switch (ntype(p)) {
- case STRING:
- if (getstring(p) != NULL) {
- total -= (long)getslength(p);
- ! /* Using getstring here breaks VMEM (JonnyG) */
- ! xldfree(p->n_string);
- }
- break;
- case STREAM:
- ***************
- *** 435,440 ****
- --- 464,474 ----
- if (getfile(p))
- osclose(getfile(p));
- break;
- + #ifdef WINDOWS
- + case WINOBJ:
- + free_winobj(p);
- + break;
- + #endif
- case SYMBOL:
- case OBJECT:
- case VECTOR:
- ***************
- *** 441,447 ****
- case CLOSURE:
- if (p->n_vsize) {
- total -= (long) (p->n_vsize * sizeof(LVAL));
- ! free(p->n_vdata);
- }
- break;
- }
- --- 475,481 ----
- case CLOSURE:
- if (p->n_vsize) {
- total -= (long) (p->n_vsize * sizeof(LVAL));
- ! xldfree(p->n_vdata);
- }
- break;
- }
- ***************
- *** 448,458 ****
- p->n_type = FREE;
- rplaca(p,NIL);
- rplacd(p,fnodes);
- ! fnodes = p;
- ! nfree += 1L;
- }
- - else
- - p->n_flags &= ~MARK;
- }
- }
-
- --- 482,490 ----
- p->n_type = FREE;
- rplaca(p,NIL);
- rplacd(p,fnodes);
- ! fnodes = p++;
- ! nfree++;
- }
- }
- }
-
- ***************
- *** 485,491 ****
- SEGMENT *newseg;
-
- /* allocate the new segment */
- ! if ((newseg = (SEGMENT *)calloc(1,segsize(n))) == NULL)
- return (NULL);
-
- /* initialize the new segment */
- --- 517,524 ----
- SEGMENT *newseg;
-
- /* allocate the new segment */
- !
- ! if ((newseg = (SEGMENT *)xlcalloc(1,segsize(n))) == NULL)
- return (NULL);
-
- /* initialize the new segment */
- ***************
- *** 666,677 ****
- s_gcflag = s_gchook = NIL;
-
- /* allocate the evaluation stack */
- ! if ((xlstkbase = (LVAL **)malloc(EDEPTH * sizeof(LVAL *))) == NULL)
- xlfatal("insufficient memory");
- xlstack = xlstktop = xlstkbase + EDEPTH;
-
- /* allocate the argument stack */
- ! if ((xlargstkbase = (LVAL *)malloc(ADEPTH * sizeof(LVAL))) == NULL)
- xlfatal("insufficient memory");
- xlargstktop = xlargstkbase + ADEPTH;
- xlfp = xlsp = xlargstkbase;
- --- 699,710 ----
- s_gcflag = s_gchook = NIL;
-
- /* allocate the evaluation stack */
- ! if ((xlstkbase = (LVAL **)xlmalloc(EDEPTH * sizeof(LVAL *))) == NULL)
- xlfatal("insufficient memory");
- xlstack = xlstktop = xlstkbase + EDEPTH;
-
- /* allocate the argument stack */
- ! if ((xlargstkbase = (LVAL *)xlmalloc(ADEPTH * sizeof(LVAL))) == NULL)
- xlfatal("insufficient memory");
- xlargstktop = xlargstkbase + ADEPTH;
- xlfp = xlsp = xlargstkbase;
- diff -c ../xlisp.org/xldmem.h ../xlisp/xldmem.h
- *** ../xlisp.org/xldmem.h Sun May 7 22:25:47 1989
- --- ../xlisp/xldmem.h Wed Apr 5 16:45:38 1989
- ***************
- *** 13,21 ****
- #define CHARMAX 255
- #define CHARSIZE 256
-
- - /* new node access macros */
- - #define ntype(x) ((x)->n_type)
- -
- /* cons access macros */
- #define car(x) ((x)->n_car)
- #define cdr(x) ((x)->n_cdr)
- --- 13,18 ----
- ***************
- *** 23,72 ****
- #define rplacd(x,y) ((x)->n_cdr = (y))
-
- /* symbol access macros */
- ! #define getvalue(x) ((x)->n_vdata[0])
- ! #define setvalue(x,v) ((x)->n_vdata[0] = (v))
- ! #define getfunction(x) ((x)->n_vdata[1])
- ! #define setfunction(x,v) ((x)->n_vdata[1] = (v))
- ! #define getplist(x) ((x)->n_vdata[2])
- ! #define setplist(x,v) ((x)->n_vdata[2] = (v))
- ! #define getpname(x) ((x)->n_vdata[3])
- ! #define setpname(x,v) ((x)->n_vdata[3] = (v))
- #define SYMSIZE 4
-
- /* closure access macros */
- ! #define getname(x) ((x)->n_vdata[0])
- ! #define setname(x,v) ((x)->n_vdata[0] = (v))
- ! #define gettype(x) ((x)->n_vdata[1])
- ! #define settype(x,v) ((x)->n_vdata[1] = (v))
- ! #define getargs(x) ((x)->n_vdata[2])
- ! #define setargs(x,v) ((x)->n_vdata[2] = (v))
- ! #define getoargs(x) ((x)->n_vdata[3])
- ! #define setoargs(x,v) ((x)->n_vdata[3] = (v))
- ! #define getrest(x) ((x)->n_vdata[4])
- ! #define setrest(x,v) ((x)->n_vdata[4] = (v))
- ! #define getkargs(x) ((x)->n_vdata[5])
- ! #define setkargs(x,v) ((x)->n_vdata[5] = (v))
- ! #define getaargs(x) ((x)->n_vdata[6])
- ! #define setaargs(x,v) ((x)->n_vdata[6] = (v))
- ! #define getbody(x) ((x)->n_vdata[7])
- ! #define setbody(x,v) ((x)->n_vdata[7] = (v))
- ! #define getenv(x) ((x)->n_vdata[8])
- ! #define setenv(x,v) ((x)->n_vdata[8] = (v))
- ! #define getfenv(x) ((x)->n_vdata[9])
- ! #define setfenv(x,v) ((x)->n_vdata[9] = (v))
- ! #define getlambda(x) ((x)->n_vdata[10])
- ! #define setlambda(x,v) ((x)->n_vdata[10] = (v))
- #define CLOSIZE 11
-
- /* vector access macros */
- #define getsize(x) ((x)->n_vsize)
- ! #define getelement(x,i) ((x)->n_vdata[i])
- ! #define setelement(x,i,v) ((x)->n_vdata[i] = (v))
-
- /* object access macros */
- ! #define getclass(x) ((x)->n_vdata[0])
- ! #define getivar(x,i) ((x)->n_vdata[i+1])
- ! #define setivar(x,i,v) ((x)->n_vdata[i+1] = (v))
-
- /* subr/fsubr access macros */
- #define getsubr(x) ((x)->n_subr)
- --- 20,69 ----
- #define rplacd(x,y) ((x)->n_cdr = (y))
-
- /* symbol access macros */
- ! #define getvalue(x) (ACESSV(x,0))
- ! #define setvalue(x,v) (ACESSV(x,0) = (v))
- ! #define getfunction(x) (ACESSV(x,1))
- ! #define setfunction(x,v) (ACESSV(x,1) = (v))
- ! #define getplist(x) (ACESSV(x,2))
- ! #define setplist(x,v) (ACESSV(x,2) = (v))
- ! #define getpname(x) (ACESSV(x,3))
- ! #define setpname(x,v) (ACESSV(x,3) = (v))
- #define SYMSIZE 4
-
- /* closure access macros */
- ! #define getname(x) (ACESSV(x,0))
- ! #define setname(x,v) (ACESSV(x,0) = (v))
- ! #define gettype(x) (ACESSV(x,1))
- ! #define settype(x,v) (ACESSV(x,1) = (v))
- ! #define getargs(x) (ACESSV(x,2))
- ! #define setargs(x,v) (ACESSV(x,2) = (v))
- ! #define getoargs(x) (ACESSV(x,3))
- ! #define setoargs(x,v) (ACESSV(x,3) = (v))
- ! #define getrest(x) (ACESSV(x,4))
- ! #define setrest(x,v) (ACESSV(x,4) = (v))
- ! #define getkargs(x) (ACESSV(x,5))
- ! #define setkargs(x,v) (ACESSV(x,5) = (v))
- ! #define getaargs(x) (ACESSV(x,6))
- ! #define setaargs(x,v) (ACESSV(x,6) = (v))
- ! #define getbody(x) (ACESSV(x,7))
- ! #define setbody(x,v) (ACESSV(x,7) = (v))
- ! #define getenv(x) (ACESSV(x,8))
- ! #define setenv(x,v) (ACESSV(x,8) = (v))
- ! #define getfenv(x) (ACESSV(x,9))
- ! #define setfenv(x,v) (ACESSV(x,9) = (v))
- ! #define getlambda(x) (ACESSV(x,10))
- ! #define setlambda(x,v) (ACESSV(x,10) = (v))
- #define CLOSIZE 11
-
- /* vector access macros */
- #define getsize(x) ((x)->n_vsize)
- ! #define getelement(x,i) (ACESSV(x,i))
- ! #define setelement(x,i,v) (ACESSV(x,i) = (v))
-
- /* object access macros */
- ! #define getclass(x) (ACESSV(x,0))
- ! #define getivar(x,i) (ACESSV(x,i+1))
- ! #define setivar(x,i,v) (ACESSV(x,i+1) = (v))
-
- /* subr/fsubr access macros */
- #define getsubr(x) ((x)->n_subr)
- ***************
- *** 78,84 ****
- #define getchcode(x) ((x)->n_chcode)
-
- /* string access macros */
- ! #define getstring(x) ((x)->n_string)
- #define getslength(x) ((x)->n_strlen)
-
- /* file stream access macros */
- --- 75,81 ----
- #define getchcode(x) ((x)->n_chcode)
-
- /* string access macros */
- ! #define getstring(x) (ACESSS((x)->n_string))
- #define getslength(x) ((x)->n_strlen)
-
- /* file stream access macros */
- ***************
- *** 93,114 ****
- #define gettail(x) ((x)->n_cdr)
- #define settail(x,v) ((x)->n_cdr = (v))
-
- /* node types */
- #define FREE 0
- #define SUBR 1
- #define FSUBR 2
- #define CONS 3
- ! #define SYMBOL 4
- ! #define FIXNUM 5
- ! #define FLONUM 6
- ! #define STRING 7
- ! #define OBJECT 8
- ! #define STREAM 9
- ! #define VECTOR 10
- ! #define CLOSURE 11
- ! #define CHAR 12
- ! #define USTREAM 13
-
- /* subr/fsubr node */
- #define n_subr n_info.n_xsubr.xs_subr
- #define n_offset n_info.n_xsubr.xs_offset
- --- 90,121 ----
- #define gettail(x) ((x)->n_cdr)
- #define settail(x,v) ((x)->n_cdr = (v))
-
- + #define getwinobj(x) (ACESSS((x)->n_winobj))
- + #define setwinobj(x,v) ((x)->n_winobj = (v))
- +
- /* node types */
- #define FREE 0
- + #define SYMBOL 17
- + #define OBJECT 18
- + #define VECTOR 19
- + #define CLOSURE 20
- #define SUBR 1
- #define FSUBR 2
- #define CONS 3
- ! #define FIXNUM 4
- ! #define FLONUM 5
- ! #define STRING 6
- ! #define STREAM 7
- ! #define CHAR 8
- ! #define USTREAM 9
- ! #define WINOBJ 10
-
- + #define ARRAY 16
- + #define TYPEFIELD 0x1f
- +
- + /* new node access macros */
- + #define ntype(x) ((x)->n_type & TYPEFIELD)
- +
- /* subr/fsubr node */
- #define n_subr n_info.n_xsubr.xs_subr
- #define n_offset n_info.n_xsubr.xs_offset
- ***************
- *** 137,146 ****
- #define n_vsize n_info.n_xvector.xv_size
- #define n_vdata n_info.n_xvector.xv_data
-
- /* node structure */
- typedef struct node {
- char n_type; /* type of node */
- - char n_flags; /* flag bits */
- union ninfo { /* value */
- struct xsubr { /* subr/fsubr node */
- struct node *(*xs_subr)(); /* function pointer */
- --- 144,155 ----
- #define n_vsize n_info.n_xvector.xv_size
- #define n_vdata n_info.n_xvector.xv_data
-
- + /* window/font node */
- + #define n_winobj n_info.n_xwinobj.xw_ptr
- +
- /* node structure */
- typedef struct node {
- char n_type; /* type of node */
- union ninfo { /* value */
- struct xsubr { /* subr/fsubr node */
- struct node *(*xs_subr)(); /* function pointer */
- ***************
- *** 171,176 ****
- --- 180,188 ----
- int xv_size; /* vector size */
- struct node **xv_data; /* vector data */
- } n_xvector;
- + struct xwinobj { /* window/font object */
- + char *xw_ptr; /* Generic structure pointer */
- + } n_xwinobj;
- } n_info;
- } *LVAL;
-
- ***************
- *** 187,195 ****
- extern LVAL cvstring(); /* convert a string */
- extern LVAL cvfile(); /* convert a FILE * to a file */
- extern LVAL cvsubr(); /* convert a function to a subr/fsubr */
- ! extern LVAL cvfixnum(); /* convert a fixnum */
- extern LVAL cvflonum(); /* convert a flonum */
- ! extern LVAL cvchar(); /* convert a character */
-
- extern LVAL newstring(); /* create a new string */
- extern LVAL newvector(); /* create a new vector */
- --- 199,207 ----
- extern LVAL cvstring(); /* convert a string */
- extern LVAL cvfile(); /* convert a FILE * to a file */
- extern LVAL cvsubr(); /* convert a function to a subr/fsubr */
- ! extern LVAL Cvfixnum(); /* convert a fixnum */
- extern LVAL cvflonum(); /* convert a flonum */
- ! extern LVAL Cvchar(); /* convert a character */
-
- extern LVAL newstring(); /* create a new string */
- extern LVAL newvector(); /* create a new vector */
- ***************
- *** 196,198 ****
- --- 208,249 ----
- extern LVAL newobject(); /* create a new object */
- extern LVAL newclosure(); /* create a new closure */
- extern LVAL newustream(); /* create a new unnamed stream */
- +
- +
- + /* Speed ups, reduce function calls for fixed characters and numbers */
- + /* Speed is exeptionaly noticed on machines with large a instruction cache */
- + /* No size effects here (JonnyG) */
- +
- + extern SEGMENT *fixseg,*charseg;
- + extern FIXTYPE _tfixed;
- + extern int _tint;
- +
- + #define cvfixnum(n) ((_tfixed = n), \
- + ((_tfixed > SFIXMIN && _tfixed < SFIXMAX) ? \
- + &fixseg->sg_nodes[(int)_tfixed-SFIXMIN] : \
- + Cvfixnum(_tfixed)))
- +
- + #define cvchar(c) ((_tint = c), \
- + ((_tint >= CHARMIN && _tint <= CHARMIN) ? \
- + &charseg->sg_nodes[_tint-CHARMIN] : \
- + Cvchar(_tint)))
- +
- + extern char *xldmalloc();
- + extern char *xldcalloc();
- +
- + #ifdef VMEM
- +
- + extern char *vload();
- +
- + extern unsigned char *vaccess();
- +
- + #define ACESSV(x,i) (((LVAL *)vaccess((x)->n_vdata))[i])
- + #define ACESSS(x) (vaccess(x))
- +
- + #else
- +
- + #define xlfcalloc xlcalloc
- + #define ACESSV(x,i) (x)->n_vdata[i]
- + #define ACESSS(x) x
- +
- + #endif
- diff -c ../xlisp.org/xlfio.c ../xlisp/xlfio.c
- *** ../xlisp.org/xlfio.c Sun May 7 22:25:52 1989
- --- ../xlisp/xlfio.c Wed Apr 5 16:18:27 1989
- ***************
- *** 349,355 ****
-
- /* copy the substring into the stream */
- for (i = start; i < end; ++i)
- ! xlputc(val,str[i]);
-
- /* restore the stack */
- xlpop();
- --- 349,355 ----
-
- /* copy the substring into the stream */
- for (i = start; i < end; ++i)
- ! xlputc(val,getstring(string) + i);
-
- /* restore the stack */
- xlpop();
- ***************
- *** 450,456 ****
- LOCAL LVAL getstroutput(stream)
- LVAL stream;
- {
- ! unsigned char *str;
- LVAL next,val;
- int len,ch;
-
- --- 450,456 ----
- LOCAL LVAL getstroutput(stream)
- LVAL stream;
- {
- ! int i;
- LVAL next,val;
- int len,ch;
-
- ***************
- *** 462,471 ****
- val = newstring(len + 1);
-
- /* copy the characters into the new string */
- ! str = getstring(val);
- while ((ch = xlgetc(stream)) != EOF)
- ! *str++ = ch;
- ! *str = '\0';
-
- /* return the string */
- return (val);
- --- 462,471 ----
- val = newstring(len + 1);
-
- /* copy the characters into the new string */
- ! i = 0;
- while ((ch = xlgetc(stream)) != EOF)
- ! getstring(val)[i++] = ch;
- ! getstring(val)[i] = '\0';
-
- /* return the string */
- return (val);
-
-
-