home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume8
/
travesty
/
patch1
/
patches01
Wrap
Text File
|
1990-01-11
|
7KB
|
258 lines
*** ../../travesty/CHANGES Wed Dec 20 10:05:45 1989
--- CHANGES Thu Jan 4 16:09:38 1990
***************
*** 1 ****
--- 1,5 ----
+ travesty version 1.1, 12/23/89.
+
+ Changed cmp() to a slow, portable, inline version. Is ctoi() guaranteed?
+
travesty version 1.0, 12/17/89.
*** ../../travesty/README Wed Dec 20 10:05:46 1989
--- README Thu Jan 4 16:09:39 1990
***************
*** 1,10 ****
travesty - make a travesty of the input
! travesty version 1.0, 12/17/89.
Copyright (c) 1989, Daniel J. Bernstein.
All rights reserved.
! This distribution packaged 12/17/89.
Files:
CHANGES Description of changes since first distributed version
--- 1,10 ----
travesty - make a travesty of the input
! travesty version 1.1, 12/23/89.
Copyright (c) 1989, Daniel J. Bernstein.
All rights reserved.
! This distribution packaged 12/23/89.
Files:
CHANGES Description of changes since first distributed version
*** ../../travesty/travesty.c Wed Dec 20 10:05:49 1989
--- travesty.c Thu Jan 4 16:09:41 1990
***************
*** 7,22 ****
Internet address: brnstnd@acf10.nyu.edu.\n";
static char travestyversion[] =
! "travesty version 1.0, 12/17/89.\n\
Copyright (c) 1989, Daniel J. Bernstein.\n\
All rights reserved.\n";
static char travestycopyright[] =
! "travesty version 1.0, 12/17/89.\n\
Copyright (c) 1989, Daniel J. Bernstein.\n\
All rights reserved.\n\
\n\
! Until January 1, 1993, you are granted the following rights: A. To make\n\
copies of this work in original form, so long as (1) the copies are exact\n\
and complete; (2) the copies include the copyright notice, this paragraph,\n\
and the disclaimer of warranty in their entirety. B. To distribute this\n\
--- 7,22 ----
Internet address: brnstnd@acf10.nyu.edu.\n";
static char travestyversion[] =
! "travesty version 1.1, 12/23/89.\n\
Copyright (c) 1989, Daniel J. Bernstein.\n\
All rights reserved.\n";
static char travestycopyright[] =
! "travesty version 1.1, 12/23/89.\n\
Copyright (c) 1989, Daniel J. Bernstein.\n\
All rights reserved.\n\
\n\
! Until January 1, 1994, you are granted the following rights: A. To make\n\
copies of this work in original form, so long as (1) the copies are exact\n\
and complete; (2) the copies include the copyright notice, this paragraph,\n\
and the disclaimer of warranty in their entirety. B. To distribute this\n\
***************
*** 26,32 ****
includes the copyright notice, this paragraph, and the disclaimer of\n\
warranty in their entirety. These rights are temporary and revocable upon\n\
written, oral, or other notice by Daniel J. Bernstein. These rights are\n\
! automatically revoked on January 1, 1993. This copyright notice shall be\n\
governed by the laws of the state of New York.\n\
\n\
If you have questions about travesty or about this copyright notice,\n\
--- 26,32 ----
includes the copyright notice, this paragraph, and the disclaimer of\n\
warranty in their entirety. These rights are temporary and revocable upon\n\
written, oral, or other notice by Daniel J. Bernstein. These rights are\n\
! automatically revoked on January 1, 1994. This copyright notice shall be\n\
governed by the laws of the state of New York.\n\
\n\
If you have questions about travesty or about this copyright notice,\n\
***************
*** 89,99 ****
#include "djbatoi.h"
/* The following macro had better make chars into ints from 0 thru 255. */
-
#define ctoi(x) ((unsigned int) (x))
#define copy(s,t,len) bcopy(s,t,len)
- #define cmp(s,t,len) bcmp(s,t,len) /* had better return signed value! */
#define ran(n) (((random() % n) + n) % n) /* idiotic % can be negative */
#define MAXORD 20
--- 89,111 ----
#include "djbatoi.h"
/* The following macro had better make chars into ints from 0 thru 255. */
#define ctoi(x) ((unsigned int) (x))
+
#define copy(s,t,len) bcopy(s,t,len)
+ int cmp(s,t,len) /* needs to return a signed value; bcmp() not portable */
+ register char *s;
+ register char *t;
+ register int len;
+ {
+ while (len--)
+ if (*s != *t)
+ return((ctoi(*s) > ctoi(*t)) * 2 - 1);
+ else
+ s++,t++;
+ return(0);
+ }
+
#define ran(n) (((random() % n) + n) % n) /* idiotic % can be negative */
#define MAXORD 20
***************
*** 104,110 ****
int ord1;
int seed;
! int s[MAXORD + 1][257];
char *c;
int curc;
int *p;
--- 116,122 ----
int ord1;
int seed;
! int s[MAXORD + 1][257]; /* dynamic? not worth it */
char *c;
int curc;
int *p;
***************
*** 143,178 ****
}
}
! sort(l,u,m)
register int l,u; /* we are useless if l == u; we crash if l > u */
register int m;
{
register int i;
register int ch;
if (m > ord)
return;
for (ch = 0; ch < 256; ch++)
! s[m][ch] = 0;
for (i = l; i <= u; i++)
! s[m][ctoi(c[p[i] * ord1 + m])]++;
! s[m][0] += l - 1;
for (ch = 1; ch < 256; ch++)
! s[m][ch] += s[m][ch - 1];
for (i = u; i >= l; i--)
! q[s[m][ctoi(c[p[i] * ord1 + m])]--] = p[i]; /* trust me. */
for (i = l; i <= u; i++)
p[i] = q[i];
! s[m][256] = u;
for (ch = 0; ch < 256; ch++)
! if (s[m][ch] + 1 < s[m][ch + 1]) /* anything to save a procedure call */
! sort(s[m][ch] + 1,s[m][ch + 1],m + 1);
}
zeroq()
--- 155,191 ----
}
}
! sort(l,u,m) /* recursive */
register int l,u; /* we are useless if l == u; we crash if l > u */
register int m;
{
register int i;
register int ch;
+ register int *sm = s[m];
if (m > ord)
return;
for (ch = 0; ch < 256; ch++)
! sm[ch] = 0;
for (i = l; i <= u; i++)
! sm[ctoi(c[p[i] * ord1 + m])]++;
! sm[0] += l - 1;
for (ch = 1; ch < 256; ch++)
! sm[ch] += sm[ch - 1];
for (i = u; i >= l; i--)
! q[sm[ctoi(c[p[i] * ord1 + m])]--] = p[i]; /* trust me. */
for (i = l; i <= u; i++)
p[i] = q[i];
! sm[256] = u;
for (ch = 0; ch < 256; ch++)
! if (sm[ch] + 1 < sm[ch + 1]) /* anything to save a procedure call */
! sort(sm[ch] + 1,sm[ch + 1],m + 1);
}
zeroq()
***************
*** 185,192 ****
sigalrm()
{
! fprintf(stderr,"Seed: %d\n",seed);
! fflush(stderr);
}
main(argc,argv,envp)
--- 198,205 ----
sigalrm()
{
! (void) fprintf(stderr,"Seed: %d\n",seed);
! (void) fflush(stderr);
}
main(argc,argv,envp)
*** ../../travesty/travesty.man Wed Dec 20 10:05:48 1989
--- travesty.man Thu Jan 4 16:09:40 1990
***************
*** 109,115 ****
has been tested
on an Astronautics ZS-2 running ZSUnix.
.SH VERSION
! travesty version 1.0, dated 12/17/89.
.SH AUTHOR
Copyright 1989, Daniel J. Bernstein.
.SH "SEE ALSO"
--- 109,115 ----
has been tested
on an Astronautics ZS-2 running ZSUnix.
.SH VERSION
! travesty version 1.1, dated 12/23/89.
.SH AUTHOR
Copyright 1989, Daniel J. Bernstein.
.SH "SEE ALSO"