[gforth] / gforth / Attic / primitives

# gforth: gforth/Attic/primitives

### Diff for /gforth/Attic/primitives between version 1.30 and 1.31

version 1.30, Thu Jan 19 17:48:11 1995 UTC version 1.31, Thu Jan 19 19:43:48 1995 UTC
 Line 132
 Line 132
)  )

condbranch((loop),--            fig     paren_loop,  condbranch((loop),--            fig     paren_loop,
int index = *rp+1;  Cell index = *rp+1;
int limit = rp[1];  Cell limit = rp[1];
if (index != limit) {  if (index != limit) {
*rp = index;      *rp = index;
)  )

condbranch((+loop),n --         fig     paren_plus_loop,  condbranch((+loop),n --         fig     paren_plus_loop,
/* !! check this thoroughly */  /* !! check this thoroughly */
int index = *rp;  Cell index = *rp;
/* sign bit manipulation and test: (x^y)<0 is equivalent to (x<0) != (y<0) */  /* sign bit manipulation and test: (x^y)<0 is equivalent to (x<0) != (y<0) */
/* dependent upon two's complement arithmetic */  /* dependent upon two's complement arithmetic */
int olddiff = index-rp[1];  Cell olddiff = index-rp[1];
#ifdef undefined  #ifdef undefined
if ((olddiff^(olddiff+n))>=0   /* the limit is not crossed */  if ((olddiff^(olddiff+n))>=0   /* the limit is not crossed */
|| (olddiff^n)>=0          /* it is a wrap-around effect */) {      || (olddiff^n)>=0          /* it is a wrap-around effect */) {
 Line 166
 Line 166
crosses the boundary between limit and limit-sign(n). I.e. a symmetric  crosses the boundary between limit and limit-sign(n). I.e. a symmetric
version of (+LOOP).""  version of (+LOOP).""
/* !! check this thoroughly */  /* !! check this thoroughly */
int index = *rp;  Cell index = *rp;
int diff = index-rp[1];  Cell diff = index-rp[1];
int newdiff = diff+n;  Cell newdiff = diff+n;
if (n<0) {  if (n<0) {
diff = -diff;      diff = -diff;
newdiff = -newdiff;      newdiff = -newdiff;
 Line 911
 Line 911
wior =  FILEEXIST(w2 == NULL);  wior =  FILEEXIST(w2 == NULL);

create-file     c_addr u ntype -- w2 wior       file    create_file  create-file     c_addr u ntype -- w2 wior       file    create_file
int     fd;  Cell    fd;
fd = creat(cstr(c_addr, u, 1), 0644);  fd = creat(cstr(c_addr, u, 1), 0644);
if (fd > -1) {  if (fd > -1) {
#ifdef __osf__
(void)close(fd);
w2 = (Cell)fopen(cstr(c_addr, u, 1), fileattr[ntype]);
#else
w2 = (Cell)fdopen(fd, fileattr[ntype]);    w2 = (Cell)fdopen(fd, fileattr[ntype]);
#endif
assert(w2 != NULL);    assert(w2 != NULL);
wior = 0;    wior = 0;
} else {  } else {
 Line 982
 Line 987
write-file      c_addr u1 wfileid -- wior       file    write_file  write-file      c_addr u1 wfileid -- wior       file    write_file
/* !! fwrite does not guarantee enough */  /* !! fwrite does not guarantee enough */
{  {
int u2 = fwrite(c_addr, sizeof(Char), u1, (FILE *)wfileid);    Cell u2 = fwrite(c_addr, sizeof(Char), u1, (FILE *)wfileid);
wior = FILEIO(u2<u1 && ferror((FILE *)wfileid));    wior = FILEIO(u2<u1 && ferror((FILE *)wfileid));
}  }

 Line 1097
 Line 1102

represent               r c_addr u -- n f1 f2   float  represent               r c_addr u -- n f1 f2   float
char *sig;  char *sig;
int flag;  Cell flag;
int decpt;  Cell decpt;
sig=ecvt(r, u, &decpt, &flag);  sig=ecvt(r, u, &decpt, &flag);
n=decpt;  n=decpt;
f1=FLAG(flag!=0);  f1=FLAG(flag!=0);

Generate output suitable for use with a patch program
Legend:
 Removed from v.1.30 changed lines Added in v.1.31