home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-09 | 128.7 KB | 5,629 lines |
- *** 1.80 1992/08/14 14:37:45
- --- Changelo 1992/10/09 20:34:22
- ***************
- *** 3263,3265 ****
- --- 3263,3363 ----
- in the common case.
-
- ---------------------------- Patchlevel 83 ---------------------------
- +
- + ioctl.h, signal.h:: ers
- + sync with mntlib changes.
- +
- + main.c, ctime.c, getuid.c, lib.h, ltoa.c, sprintf.c:: ers
- + sync with mntlib changes
- +
- + frwbin.c:: ++jrb
- + new file containing the default __FRW_BIN__ flag. this flag controls
- + the default behaviour fread/fwrite:
- + when non-zero, fread/fwrite will not do CR processing
- + even for text mode files (ie: ignore file mode).
- +
- + when zero fread/fwrite is process according to file mode
- +
- + this file is linked in when the user does not specify the variable.
- +
- + fread.c, fwrite.c:: ++jrb
- + incorporate flag.
- +
- + mincl:: ++jrb
- + add target for frwbin.o
- +
- + compiler.h dirent.h float.h math.h mintbind.h osbind.h
- + ostruct.h regexp.h setjmp.h stdarg.h tcfloat.h tcmath.h
- + unistd.h varargs.h :: ++jrb/ers
- + sync up with mntlib 21_2, mainly changes for Turbo/Pure C
- +
- + access.c alphasor.c atof.c bcmp.c bsearch.c calloc.c chmod.c doprnt.c
- + findfile.c flonum.h fopen.c fseek.c ftw.c getbuf.c getenv.c getlogin.c
- + getopt.c getpid.c getpw.c getuid.c gnulib2.c grp.c lib.h localtim.c lseek.c
- + ltoa.c malloc.c putenv.c qsort.c random.c realloc.c regexp.c sbrk.c setbuf.c
- + setvbuf.c strcat.c strchr.c strftime.c strncat.c strncpy.c strrchr.c strtol.c
- + strtoul.c system.c sysvar.c time.c timeoday.c tmpfile.c tmpnam.c utime.c
- + getcwd.c isatty.c spawnve.c sleep.c :: ++jrb/ers
- + sync up with mntlib 21_2, mainly changes for Turbo/Pure C. nice thing
- + about this merge and the earlier soz/lcc merges is that a lot of
- + lint cleaning took place as a result.
- +
- + compiler.h ioctl.h unistd.h signal.h setjmp.h osbind.h mintbind.h
- + math.h keycodes.h :: ++jrb/ers
- + sync with mntlib 21_3
- +
- + perror.c:: ++jrb/ers
- + sync with mntlib 21_3
- +
- + scanf.c:: michal
- + sscanf (test,"%%Page: %d %d\n", &i1, &i2);
- + after "%%" *fc equals 'P' but c was never updated and is still
- + equal '%'. Therefore test on line 232 fails and no conversions will
- + be performed. [the fix was to get the next char into c after testing
- + for '%' - ++jrb]
- + thanks michal!
- +
- + *.s, *.cpp, linea.c crto.c:: howard
- + changes to support baserel code generation.
- +
- + Makefile, mincl:: howard
- + New integrated scheme elimiating makefile.16 makefile.32.
- + thanks howard!
- +
- + maikefile.16, makefile.32 :: ++jrb
- + delete, no longer needed.
- +
- + mintbind.h obsind.h obstack.h
- + doprnt.c getpass.c linea.c malloc.c obstack.c regexp.c
- + sbrk.c stricmp.c strnicmp.c strrchr.c system.c textio.c :: ers/+=jrb
- + more cleanups from mntlib pl 22 (casts etc from compilers that
- + are more fussy [some really overkill]).
- +
- + compiler.h mintbind.h:: ers/++jrb
- + sync up with mntlib pl 23
- +
- + difftime.c:: uunet!gnu.ai.mit.edu!entropy
- + operands were backwards
- +
- + doprnt.c:: Michael (ritzert@dfg.dbp.de)
- + the g-format does not work correctly. In many circumstances, the output is
- + a huge fp-number which is correct in all the 15 significant digits; but the
- + length of the mantissa is roughly doubled and filled with garbage. This
- + seems to be rounding problem - it occurs more frequently with the 68881,
- + but only when the significant rest of the mantissa is a sequence of zeros.
- + I observed it with %g %1.6g %1.14g %1.15g.
- +
- + In my opinion, the g-formatter of cvt() and round() should be rewritten.
- + As i don't have the time doing this, i hacked a kludgy fix:
- + I save the original no of digits, keep track of the '.', and cutoff the
- + buffer before the trailing zeros are stripped. At the same time, i supress
- + unreasonable precision, i.e., digs = min( digs, 15 ).
- +
- + doprnt.c:: Michael/++jrb
- + Michael had a problem with ICONV when doprnt.o is linked
- + from outside gnu.olb. (i have'nt figured out why this
- + would make a difference). Anyways now there is a
- + !defined(__NO_INLINE__) around _ICONV so that the C version
- + may be picked istead of the inline asm version.
- +
- + ---------------------------- Patchlevel 84 ---------------------------
- *** 1.59 1992/08/14 14:37:45
- --- PatchLev.h 1992/10/09 20:34:23
- ***************
- *** 1,5 ****
-
- ! #define PatchLevel "83"
-
- /*
- *
- --- 1,5 ----
-
- ! #define PatchLevel "84"
-
- /*
- *
- *** 1.22 1992/08/14 14:37:45
- --- crt0.c 1992/10/09 20:34:24
- ***************
- *** 176,205 ****
- .text
- .even
- .globl __start
- ! __start:
- ! cmpw #0,a0 /* test acc or prog */
- jeq __start0 /* br if prog */
- tstl a0@(36) /* tst parent basepage pointer */
- jne __start0 /* its a prog if != 0 */
-
- /* its an acc, set up a stck+heap */
- ! movl a0,__base /* sto basepage */
- ! tstl __heapbase /* setup _heapbase and sp */
- jne 1f
- ! movl __stksize,d3 /* _heapbase not specified */
- ! addql #3, d3
- andl #0xfffffffc,d3
- movl d3,sp@- /* _heapbase = Malloc(_stksize) */
- movw #0x48,sp@-
- trap #1
- addqw #6,sp
- ! movl d0, __heapbase
- addl d3,d0
- movl d0, sp /* sp = _heapbase + _stksize */
- jra __acc_main
- 1: /* heap base specified */
- ! movl __heapbase,sp /* setup sp */
- ! addl __stksize,sp
- jra __acc_main"); /* acc main */
- /* dont even think of */
- /* dropping through */
- --- 176,224 ----
- .text
- .even
- .globl __start
- ! __start:
- ! "
- ! #ifdef __MBASE__
- ! " movl a0,a1 /* Find basepage, data seg */
- ! cmpw #0,a1
- ! jne 1f
- ! movl sp@(4),a1
- ! 1:
- ! movl a1@(16)," __MBASESTR__ " /* Set base to data seg + 32K */
- ! subw #32768," __MBASESTR__ "
- !
- ! "
- ! #define Base __MBASESTR__ "@(__base)"
- ! #define Heapbase __MBASESTR__ "@(__heapbase)"
- ! #define Stksize __MBASESTR__ "@(__stksize)"
- ! #else
- ! #define Base "__base"
- ! #define Heapbase "__heapbase"
- ! #define Stksize "__stksize"
- ! #endif
- ! " cmpw #0,a0 /* test acc or prog */
- jeq __start0 /* br if prog */
- tstl a0@(36) /* tst parent basepage pointer */
- jne __start0 /* its a prog if != 0 */
-
- /* its an acc, set up a stck+heap */
- ! movl a0," Base " /* sto basepage */
- ! tstl " Heapbase " /* setup _heapbase and sp */
- jne 1f
- ! movl " Stksize ",d3 /* _heapbase not specified */
- ! addql #3, d3
- andl #0xfffffffc,d3
- movl d3,sp@- /* _heapbase = Malloc(_stksize) */
- movw #0x48,sp@-
- trap #1
- addqw #6,sp
- ! movl d0," Heapbase "
- addl d3,d0
- movl d0, sp /* sp = _heapbase + _stksize */
- jra __acc_main
- 1: /* heap base specified */
- ! movl " Heapbase ",sp /* setup sp */
- ! addl " Stksize ",sp
- jra __acc_main"); /* acc main */
- /* dont even think of */
- /* dropping through */
- ***************
- *** 232,237 ****
- --- 251,257 ----
- {
- register long m __asm("d3");
- register long freemem __asm("d4");
- + extern void etext(); /* fake-out if pcrel used */
-
- _app = 1; /* its an application */
- _base = bp;
- ***************
- *** 240,249 ****
-
- m = parseargs(bp); /* m = # bytes used by environment + args */
- /* make m the total number of bytes required by program sans stack/heap */
- ! m += (bp->p_tlen + bp->p_dlen + bp->p_blen);
- m = (m + 3L) & (~3L);
- /* freemem the amount of free mem accounting for MINFREE at top */
- ! if((freemem = (long)bp->p_hitpa - (long)bp->p_tbase - MINFREE - m) <= 0L)
- goto notenough;
-
- if(_initial_stack)
- --- 260,269 ----
-
- m = parseargs(bp); /* m = # bytes used by environment + args */
- /* make m the total number of bytes required by program sans stack/heap */
- ! m += (bp->p_tlen + bp->p_dlen + bp->p_blen + sizeof(BASEPAGE));
- m = (m + 3L) & (~3L);
- /* freemem the amount of free mem accounting for MINFREE at top */
- ! if((freemem = (long)bp->p_hitpa - (long)bp - MINFREE - m) <= 0L)
- goto notenough;
-
- if(_initial_stack)
- ***************
- *** 250,262 ****
- {
- /* the primary use of _initial_stack will be in dumping */
- /* applications where only a heap for malloc makes sense */
- ! _heapbase = (void *) ((long)bp->p_tbase + m);
- _stksize = _initial_stack;
- }
-
- if((_stksize < -1L))
- {
- ! _heapbase = (void *) ((long)bp->p_tbase + m);
- _stksize = -_stksize - 1;
- }
-
- --- 270,282 ----
- {
- /* the primary use of _initial_stack will be in dumping */
- /* applications where only a heap for malloc makes sense */
- ! _heapbase = (void *) ((long)bp + m);
- _stksize = _initial_stack;
- }
-
- if((_stksize < -1L))
- {
- ! _heapbase = (void *) ((long)bp + m);
- _stksize = -_stksize - 1;
- }
-
- ***************
- *** 269,275 ****
- {
- case -1L: /* keep all but MINFREE */
- _stksize = freemem;
- ! _heapbase = (void *) ((long)bp->p_tbase + m);
- break;
-
- case 0L: /* free all but MINKEEP */
- --- 289,295 ----
- {
- case -1L: /* keep all but MINFREE */
- _stksize = freemem;
- ! _heapbase = (void *) ((long)bp + m);
- break;
-
- case 0L: /* free all but MINKEEP */
- ***************
- *** 298,324 ****
- m += _stksize;
-
- /* make sure there's enough room for the stack */
- ! if ((((long)bp->p_tbase) + m) > ((long)bp->p_hitpa - MINFREE))
- goto notenough;
-
- ! /* set up the new stack to bp->p_tbase + m */
- asm volatile("\
- movl %0, sp | move base to sp
- addal %1, sp | add total bytes"
- : /* outputs */
- ! : "g"(bp->p_tbase), "g"(m) /* inputs */
- ); /* we dont tell gcc about clobbered reggies */
-
- ! /* shrink the TPA */
- ! /* this is right only if bp == bp->p_tbase - sizeof(BASEPAGE) */
- ! (void)Mshrink(bp, m + sizeof(BASEPAGE));
- asm volatile("subl a6,a6"); /* clear link reg for gdb */
-
- /* establish handlers, call the main routine */
- setup_handlers();
- #ifdef __GCRT0__
- ! monstartup((void *)(bp->p_tbase),
- ! (void *)((long)bp->p_tbase + bp->p_tlen));
- #endif
- _main(argc, argv, environ);
- /* not reached normally */
- --- 318,342 ----
- m += _stksize;
-
- /* make sure there's enough room for the stack */
- ! if (((long)bp + m) > ((long)bp->p_hitpa - MINFREE))
- goto notenough;
-
- ! /* set up the new stack to bp + m */
- asm volatile("\
- movl %0, sp | move base to sp
- addal %1, sp | add total bytes"
- : /* outputs */
- ! : "g"(bp), "g"(m) /* inputs */
- ); /* we dont tell gcc about clobbered reggies */
-
- ! /* shrink the TPA - this is always correct, shared text or not -- hyc */
- ! (void)Mshrink(bp, m);
- asm volatile("subl a6,a6"); /* clear link reg for gdb */
-
- /* establish handlers, call the main routine */
- setup_handlers();
- #ifdef __GCRT0__
- ! monstartup((void *)(bp->p_tbase), (void *)etext-1);
- #endif
- _main(argc, argv, environ);
- /* not reached normally */
- *** 1.10 1992/03/06 19:19:47
- --- getcwd.c 1992/10/09 20:34:25
- ***************
- *** 11,16 ****
- --- 11,18 ----
- This routine is in the public domain.
- ********************************************************************/
-
- + char *getcwd __PROTO((char *, int));
- +
- char *getcwd(buf, size)
- char *buf; int size;
- {
- ***************
- *** 23,29 ****
- #endif
-
- if (!buf)
- ! if (!(buf = (char *) malloc((size_t)size)))
- return NULL;
- path[2] = '\0';
- (void)Dgetpath(path+2, 0);
- --- 25,31 ----
- #endif
-
- if (!buf)
- ! if ((buf = (char *) malloc((size_t)size)) == 0)
- return NULL;
- path[2] = '\0';
- (void)Dgetpath(path+2, 0);
- *** 1.9 1991/12/26 15:53:59
- --- isatty.c 1992/10/09 20:34:26
- ***************
- *** 29,35 ****
- if (__open_stat[handle].status != FH_UNKNOWN)
- return(__open_stat[handle].status == FH_ISATTY);
- oldloc = Fseek (0L, fd, SEEK_CUR); /* seek zero bytes from current loc */
- ! if (seekval = Fseek (1L, fd, SEEK_SET)) /* try to seek ahead one byte */
- if ((seekval > 0) || (seekval == ((long)(-EBADARG)))) /* out of range... */
- rc = 0; /* file, not a tty */
- else
- --- 29,35 ----
- if (__open_stat[handle].status != FH_UNKNOWN)
- return(__open_stat[handle].status == FH_ISATTY);
- oldloc = Fseek (0L, fd, SEEK_CUR); /* seek zero bytes from current loc */
- ! if ((seekval = Fseek (1L, fd, SEEK_SET)) != 0) /* try to seek ahead one byte */
- if ((seekval > 0) || (seekval == ((long)(-EBADARG)))) /* out of range... */
- rc = 0; /* file, not a tty */
- else
- *** 1.23 1992/08/14 14:37:45
- --- main.c 1992/10/09 20:34:26
- ***************
- *** 9,14 ****
- --- 9,15 ----
- #include "symdir.h"
- #include <unistd.h>
- #include "lib.h"
- + #include <ctype.h>
-
- int errno;
- int __mint; /* 0 for TOS, MiNT version number otherwise */
- ***************
- *** 65,71 ****
- char *tty;
- register FILE *f;
- register int i;
- ! char *s, *t, *new;
- extern int __default_mode__; /* in defmode.c or defined by user */
- int main(int, char **, char **);
-
- --- 66,72 ----
- char *tty;
- register FILE *f;
- register int i;
- ! char *s, *t;
- extern int __default_mode__; /* in defmode.c or defined by user */
- int main(int, char **, char **);
-
- ***************
- *** 137,148 ****
- for (i = 0; s = _envp[i]; i++) { /* '=', NOT '==' */
- if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
- s[3] == 'H' && s[4] == '=') {
- ! new = alloca(4*strlen(s));
- ! strncpy(new, s, 5);
- ! t = new+5;
- s += 5;
- while (*s) {
- ! if (s[1] == ':') { /* drive letter */
- *t++ = '/';
- *t++ = 'd'; *t++ = 'e'; *t++ = 'v';
- *t++ = '/'; *t++ = *s++; s++;
- --- 138,149 ----
- for (i = 0; s = _envp[i]; i++) { /* '=', NOT '==' */
- if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
- s[3] == 'H' && s[4] == '=') {
- ! _envp[i] = (char *)malloc(4 * strlen(s));
- ! strncpy(_envp[i], s, 5);
- ! t = _envp[i]+5;
- s += 5;
- while (*s) {
- ! if (s[1] == ':' && isalpha(*s)) { /* drive letter */
- *t++ = '/';
- *t++ = 'd'; *t++ = 'e'; *t++ = 'v';
- *t++ = '/'; *t++ = *s++; s++;
- ***************
- *** 153,159 ****
- }
- }
- *t++ = 0;
- - _envp[i] = strdup(new);
- break;
- }
- }
- --- 154,159 ----
- *** 1.14 1992/04/13 15:50:45
- --- scanf.c 1992/10/09 20:34:28
- ***************
- *** 160,166 ****
- {
- /* Whitespace characters match any amount of whitespace. */
- while (isspace (c))
- ! inchar ();
- continue;
- }
- else if (c == fc)
- --- 160,166 ----
- {
- /* Whitespace characters match any amount of whitespace. */
- while (isspace (c))
- ! (void)inchar ();
- continue;
- }
- else if (c == fc)
- ***************
- *** 230,235 ****
- --- 230,237 ----
- case '%': /* Must match a literal '%'. */
- if (c != fc)
- conv_error();
- + else
- + c = inchar();
- break;
-
- case 'n': /* Answer number of assignments done. */
- *** 1.6 1992/03/06 19:19:47
- --- sleep.c 1992/10/09 20:34:28
- ***************
- *** 7,18 ****
-
- /* clock() has a rez of CLOCKS_PER_SEC ticks/sec */
-
- ! #define USEC_PER_TICK (1000000U / ((unsigned long)CLOCKS_PER_SEC))
- #define USEC_TO_CLOCK_TICKS(us) ((us) / USEC_PER_TICK )
-
- ! void
- sleep(n)
- ! unsigned int n;
- {
- unsigned long stop;
-
- --- 7,18 ----
-
- /* clock() has a rez of CLOCKS_PER_SEC ticks/sec */
-
- ! #define USEC_PER_TICK (1000000L / ((unsigned long)CLOCKS_PER_SEC))
- #define USEC_TO_CLOCK_TICKS(us) ((us) / USEC_PER_TICK )
-
- ! unsigned int
- sleep(n)
- ! unsigned int n;
- {
- unsigned long stop;
-
- ***************
- *** 19,24 ****
- --- 19,26 ----
- stop = clock() + n * CLOCKS_PER_SEC;
- while (clock() < stop)
- ;
- +
- + return 0;
- }
-
- /*
- *** 1.16 1992/03/22 21:57:30
- --- spawnve.c 1992/10/09 20:34:28
- ***************
- *** 47,54 ****
- {
- void __exit(long);
- static char path[MAXPATHLEN];
- ! int cmlen = 0;
- ! int enlen = 0;
- char *p;
- char *s, *t;
- char *env;
- --- 47,54 ----
- {
- void __exit(long);
- static char path[MAXPATHLEN];
- ! size_t cmlen;
- ! size_t enlen = 0;
- char *p;
- char *s, *t;
- char *env;
- ***************
- *** 70,76 ****
- enlen += strlen(envp[cmlen]) + 1;
- enlen += 32; /* filler for stuff like ARGV= and zeros */
-
- ! if (!(env = (char *)Malloc((long)enlen))) {
- errno = ENOMEM;
- return -1;
- }
- --- 70,76 ----
- enlen += strlen(envp[cmlen]) + 1;
- enlen += 32; /* filler for stuff like ARGV= and zeros */
-
- ! if ((env = (char *)Malloc((long)enlen)) == NULL) {
- errno = ENOMEM;
- return -1;
- }
- ***************
- *** 154,160 ****
- /* MiNT and MicroRTX support background processes with Pexec(100,...) */
- cmlen = (mode == P_NOWAIT) ? 100 : PE_LOADGO;
-
- ! if ((rval = Pexec(cmlen, path, cmd, env)) < 0)
- {
- errno = -rval;
- cmlen = -1;
- --- 154,160 ----
- /* MiNT and MicroRTX support background processes with Pexec(100,...) */
- cmlen = (mode == P_NOWAIT) ? 100 : PE_LOADGO;
-
- ! if ((rval = Pexec((int)cmlen, path, cmd, env)) < 0)
- {
- errno = -rval;
- cmlen = -1;
- *** 1.1 1992/02/04 17:11:06
- --- _addsubd.cpp 1992/10/09 20:46:12
- ***************
- *** 1,11 ****
- #ifndef __M68881__
- #ifndef sfp004
- - | double floating point add/subtract routine
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- - |
- | Revision 1.3, kub 01-90 :
- | added support for denormalized numbers
- |
- --- 1,16 ----
- + |
- + | double floating point add/subtract routine
- + |
- #ifndef __M68881__
- + .text
- + .even
- + .globl __subdf3, ___subdf3
- + .globl __adddf3, ___adddf3
- #ifndef sfp004
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- | Revision 1.3, kub 01-90 :
- | added support for denormalized numbers
- |
- ***************
- *** 18,28 ****
- | Revision 1.0:
- | original 8088 code from P.S.Housel
-
- - .text
- - .even
- - .globl __subdf3, ___subdf3
- - .globl __adddf3, ___adddf3
- -
- __subdf3:
- ___subdf3:
- eorb #0x80,sp@(12) | reverse sign of v
- --- 23,28 ----
- ***************
- *** 157,172 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- - .text
- - .even
- - .globl __subdf3, ___subdf3
- - .globl __adddf3, ___adddf3
- -
- __subdf3:
- ___subdf3:
- | double precision subtraction
- | sub second arg from fp0
- ! lea 0xfffa50,a0
- movew #0x5400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 157,167 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- __subdf3:
- ___subdf3:
- | double precision subtraction
- | sub second arg from fp0
- ! lea 0xfffffa50:w,a0
- movew #0x5400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 183,189 ****
-
- __adddf3:
- ___adddf3:
- ! lea 0xfffa50,a0
- movew #0x5400,a0@(comm) | load fp0
- cmpiw #0x8900,a0@(resp) | got it?
- movel a7@(4),a0@ | take a hi from stack to FPU
- --- 178,184 ----
-
- __adddf3:
- ___adddf3:
- ! lea 0xfffffa50:w,a0
- movew #0x5400,a0@(comm) | load fp0
- cmpiw #0x8900,a0@(resp) | got it?
- movel a7@(4),a0@ | take a hi from stack to FPU
- *** 1.1 1992/02/04 17:11:06
- --- _addsubs.cpp 1992/10/09 20:46:12
- ***************
- *** 1,12 ****
- #ifndef __M68881__
- # ifndef sfp004
- -
- - | single floating point add/subtract routine
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- - |
- | Revision 1.3, kub 01-90 :
- | added support for denormalized numbers
- |
- --- 1,16 ----
- + |
- + | single floating point add/subtract routine
- + |
- #ifndef __M68881__
- + .text
- + .even
- + .globl __subsf3, ___subsf3
- + .globl __addsf3, ___addsf3
- # ifndef sfp004
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- | Revision 1.3, kub 01-90 :
- | added support for denormalized numbers
- |
- ***************
- *** 21,31 ****
- | Revision 1.0:
- | original 8088 code from P.S.Housel for double floats
-
- - .text
- - .even
- - .globl __subsf3, ___subsf3
- - .globl __addsf3, ___addsf3
- -
- __subsf3:
- ___subsf3:
- eorb #0x80,sp@(8) | reverse sign of v
- --- 25,30 ----
- ***************
- *** 152,165 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- - .text
- - .even
- - .globl __subsf3, ___subsf3
- - .globl __addsf3, ___addsf3
- -
- __subsf3:
- ___subsf3:
- ! lea 0xfffa50,a0
- movew #0x4400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 151,159 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- __subsf3:
- ___subsf3:
- ! lea 0xfffffa50:w,a0
- movew #0x4400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 173,179 ****
-
- __addsf3:
- ___addsf3:
- ! lea 0xfffa50,a0
- movew #0x4400,a0@(comm) | load fp0
- cmpiw #0x8900,a0@(resp) | got it?
- movel a7@(4),a0@ | take a from stack to FPU
- --- 167,173 ----
-
- __addsf3:
- ___addsf3:
- ! lea 0xfffffa50:w,a0
- movew #0x4400,a0@(comm) | load fp0
- cmpiw #0x8900,a0@(resp) | got it?
- movel a7@(4),a0@ | take a from stack to FPU
- *** 1.2 1992/04/13 15:50:45
- --- _cmpdf2.s 1992/10/09 20:46:12
- ***************
- *** 29,35 ****
- bpl 1f
- negl d1 | negate
- negxl d0
- ! eorl #0x80000000,d0 | toggle sign bit
- 1:
- exg a0,d0
- exg a1,d1
- --- 29,35 ----
- bpl 1f
- negl d1 | negate
- negxl d0
- ! bchg #31,d0 | toggle sign bit
- 1:
- exg a0,d0
- exg a1,d1
- ***************
- *** 37,43 ****
- bpl 2f
- negl d1 | negate
- negxl d0
- ! eorl #0x80000000,d0 | toggle sign bit
- 2:
- cmpl d0,a0
- blt lt
- --- 37,43 ----
- bpl 2f
- negl d1 | negate
- negxl d0
- ! bchg #31,d0 | toggle sign bit
- 2:
- cmpl d0,a0
- blt lt
- *** 1.2 1992/04/13 15:50:45
- --- _cmpsf2.s 1992/10/09 20:46:12
- ***************
- *** 28,39 ****
- tstl d1 | check sign bit
- bpl 1f
- negl d1 | negate
- ! eorl #0x80000000,d1 | toggle sign bit
- 1:
- tstl d0 | check sign bit
- bpl 2f
- negl d0 | negate
- ! eorl #0x80000000,d0 | toggle sign bit
- 2:
- cmpl d1,d0
- blt lt
- --- 28,39 ----
- tstl d1 | check sign bit
- bpl 1f
- negl d1 | negate
- ! bchg #31,d1 | toggle sign bit
- 1:
- tstl d0 | check sign bit
- bpl 2f
- negl d0 | negate
- ! bchg #31,d0 | toggle sign bit
- 2:
- cmpl d1,d0
- blt lt
- *** 1.1 1992/02/04 17:11:06
- --- _divdf3.cpp 1992/10/09 20:46:12
- ***************
- *** 1,56 ****
- - #if !defined (__M68881__) && !defined (sfp004)
- -
- - | double floating point divide routine
- - |
- - | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- - | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- - |
- - |
- - | Revision 1.2, kub 01-90 :
- - | added support for denormalized numbers
- |
- ! | Revision 1.1, kub 12-89 :
- ! | Ported over to 68k assembler
- |
- ! | Revision 1.0:
- ! | original 8088 code from P.S.Housel
- !
- ! BIAS8 = 0x3FF-1
- !
- .text
- .even
- .globl __divdf3, ___divdf3
- .globl __infinitydf
- -
- - # ifdef ERROR_CHECK
- LC0:
- .ascii "floating point division by 0\12\15\0"
- .even
- ! # endif ERROR_CHECK
-
- __divdf3:
- ___divdf3:
- !
- ! # ifdef ERROR_CHECK
- tstl a7@(12) | check if divisor is 0
- bne continue
- tstl a7@(16)
- bne continue
-
- ! moveml d0-d1,a7@-
- ! pea LC0
- ! pea __iob+52 |
- jbsr _fprintf |
- addql #8,a7 |
- - moveml a7@+,d0-d1
- | set _errno to ERANGE
- ! # ifdef __MSHORT__
- ! movew #63,_errno
- ! # else
- ! movel #63,_errno
- ! # endif
- ! movel #0x7ff00000,d0 | return signed infinity
- ! clrl d1 |
- btst #31,a7@(4) | transfer sign of dividend
- beq clear | (mjr++)
- bset #31,d0 |
- --- 1,34 ----
- |
- ! | double floating point divide routine
- |
- ! #ifndef __M68881__
- .text
- .even
- .globl __divdf3, ___divdf3
- + #ifdef ERROR_CHECK
- + #include "errbase.h"
- .globl __infinitydf
- LC0:
- .ascii "floating point division by 0\12\15\0"
- .even
- ! #endif ERROR_CHECK
-
- __divdf3:
- ___divdf3:
- ! #ifdef ERROR_CHECK
- tstl a7@(12) | check if divisor is 0
- bne continue
- tstl a7@(16)
- bne continue
-
- ! pea pc@(LC0)
- ! pea Stderr
- jbsr _fprintf |
- addql #8,a7 |
- | set _errno to ERANGE
- ! moveq #ERANGE,d0
- ! Emove d0,Errno
- ! moveml __infinitydf,d0-d1 | return signed infinity
- btst #31,a7@(4) | transfer sign of dividend
- beq clear | (mjr++)
- bset #31,d0 |
- ***************
- *** 60,66 ****
- rts
- continue:
-
- ! # endif ERROR_CHECK
-
- lea sp@(4),a0 | pointer to parameters u and v
- moveml d2-d7,sp@- | save registers
- --- 38,59 ----
- rts
- continue:
-
- ! #endif /* ERROR_CHECK */
- ! #ifndef sfp004
- ! |
- ! | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- ! | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- ! |
- ! | Revision 1.2, kub 01-90 :
- ! | added support for denormalized numbers
- ! |
- ! | Revision 1.1, kub 12-89 :
- ! | Ported over to 68k assembler
- ! |
- ! | Revision 1.0:
- ! | original 8088 code from P.S.Housel
- !
- ! BIAS8 = 0x3FF-1
-
- lea sp@(4),a0 | pointer to parameters u and v
- moveml d2-d7,sp@- | save registers
- ***************
- *** 148,154 ****
- rts | no normalization needed
-
- #ifndef ERROR_CHECK
- ! divz: moveml __infinitydf,d0-d1 | return infinty value
- moveml sp@+,d2-d7 | should really cause trap ?!?
-
- btst #31,a7@(4) | transfer sign of dividend
- --- 141,148 ----
- rts | no normalization needed
-
- #ifndef ERROR_CHECK
- ! | NOTE: __infinitydf is in the text segment
- ! divz: moveml __infinitydf,d0-d1 | return infinity value
- moveml sp@+,d2-d7 | should really cause trap ?!?
-
- btst #31,a7@(4) | transfer sign of dividend
- ***************
- *** 161,168 ****
-
- #endif ERROR_CHECK
-
- ! #endif
- ! #ifdef sfp004
-
- | double precision floating point stuff for Atari-gcc using the SFP004
- | developed with gas
- --- 155,161 ----
-
- #endif ERROR_CHECK
-
- ! #else
-
- | double precision floating point stuff for Atari-gcc using the SFP004
- | developed with gas
- ***************
- *** 190,240 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! # ifdef ERROR_CHECK
- ! LC0:
- ! .ascii "floating point division by 0\12\15\0"
- ! .even
- ! # endif ERROR_CHECK
- !
- ! .text
- ! .even
- ! .globl __divdf3, ___divdf3
- !
- ! __divdf3:
- ! ___divdf3:
- !
- ! # ifdef ERROR_CHECK
- ! tstl a7@(12) | check if divisor is 0
- ! bne continue
- ! tstl a7@(16)
- ! bne continue
- !
- ! moveml d0-d7/a0-a6,a7@- | print error message
- ! pea LC0
- ! movew #9,a7@-
- ! trap #1
- ! addql #6,a7
- ! moveml a7@+,d0-d7/a0-a6
- ! | set _errno to ERANGE
- ! # ifdef __MSHORT__
- ! movew #63,_errno
- ! # else
- ! movel #63,_errno
- ! # endif
- ! movel #0x7ff00000,d0 | return signed infinity
- ! clrl d1 |
- ! btst #31,a7@(4) | transfer sign of dividend
- ! beq clear | (mjr++)
- ! bset #31,d0 |
- ! rts |
- ! clear: |
- ! bclr #31,d0 |
- ! rts
- ! continue:
- !
- ! # endif ERROR_CHECK
- !
- ! lea 0xfffa50,a0
- movew #0x5400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 183,189 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x5400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 249,251 ****
- --- 198,201 ----
- movel a0@,d1
- rts
- #endif sfp004
- + #endif /* !__M68881__ */
- *** 1.1 1992/02/04 17:11:06
- --- _divsf3.cpp 1992/10/09 20:46:13
- ***************
- *** 1,30 ****
- - #if !defined (__M68881__) && !defined (sfp004)
- -
- - | single floating point divide routine
- - |
- - | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- - | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- - |
- - |
- - | Revision 1.2, kub 01-90 :
- - | added support for denormalized numbers
- |
- ! | Revision 1.1, kub 12-89 :
- ! | Created single float version for 68000
- |
- ! | Revision 1.0:
- ! | original 8088 code from P.S.Housel for double floats
- !
- ! BIAS4 = 0x7F-1
- !
- .text
- .even
- .globl __divsf3, ___divsf3
- .globl __infinitysf
-
- - #ifdef ERROR_CHECK
- LC0:
- ! .ascii "FLOATING POINT DIVISION by 0\12\15\0"
- .even
- #endif ERROR_CHECK
-
- --- 1,16 ----
- |
- ! | single floating point divide routine
- |
- ! #ifndef __M68881__
- .text
- .even
- .globl __divsf3, ___divsf3
- + #ifdef ERROR_CHECK
- + #include "errbase.h"
- .globl __infinitysf
-
- LC0:
- ! .ascii "floating point division by 0\12\15\0"
- .even
- #endif ERROR_CHECK
-
- ***************
- *** 31,52 ****
- __divsf3:
- ___divsf3:
-
- ! # ifdef ERROR_CHECK
- tstl a7@(8) | check if divisor is 0
- bne no_exception
-
- ! moveml d0-d1,a7@-
- ! pea LC0
- ! pea __iob+52 |
- jbsr _fprintf |
- addql #8,a7 |
- - moveml a7@+,d0-d1
- | set _errno to ERANGE
- ! # ifdef __MSHORT__
- ! movew #63,_errno
- ! # else
- ! movel #63,_errno
- ! # endif
- movel __infinitysf,d0 | return signed infinity
- btst #31,a7@(4) | transfer sign of dividend
- beq clear | (mjr++)
- --- 17,33 ----
- __divsf3:
- ___divsf3:
-
- ! #ifdef ERROR_CHECK
- tstl a7@(8) | check if divisor is 0
- bne no_exception
-
- ! pea pc@(LC0)
- ! pea Stderr
- jbsr _fprintf |
- addql #8,a7 |
- | set _errno to ERANGE
- ! moveq #ERANGE,d0
- ! Emove d0,Errno
- movel __infinitysf,d0 | return signed infinity
- btst #31,a7@(4) | transfer sign of dividend
- beq clear | (mjr++)
- ***************
- *** 56,64 ****
- rts
-
- no_exception:
-
- ! # endif ERROR_CHECK
-
- lea sp@(4),a0 | pointer to parameters u and v
- moveml d2-d5,sp@- | save registers
- moveml a0@,d4/d5 | d4 = u, d5 = v
- --- 37,60 ----
- rts
-
- no_exception:
- + #endif ERROR_CHECK
-
- ! #ifndef sfp004
- ! |
- ! | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- ! | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- ! |
- ! | Revision 1.2, kub 01-90 :
- ! | added support for denormalized numbers
- ! |
- ! | Revision 1.1, kub 12-89 :
- ! | Created single float version for 68000
- ! |
- ! | Revision 1.0:
- ! | original 8088 code from P.S.Housel for double floats
-
- + BIAS4 = 0x7F-1
- +
- lea sp@(4),a0 | pointer to parameters u and v
- moveml d2-d5,sp@- | save registers
- moveml a0@,d4/d5 | d4 = u, d5 = v
- ***************
- *** 140,147 ****
- bclr #31,d0 |
- rts
- # endif ERROR_CHECK
- ! #endif /* !__M68881__ && !sfp004 */
- ! #ifdef sfp004
-
- | single precision floating point stuff for Atari-gcc using the SFP004
- | or compatible boards with a memory mapped 68881
- --- 136,142 ----
- bclr #31,d0 |
- rts
- # endif ERROR_CHECK
- ! #else
-
- | single precision floating point stuff for Atari-gcc using the SFP004
- | or compatible boards with a memory mapped 68881
- ***************
- *** 172,221 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- !
- ! .text
- ! .even
- ! .globl __divsf3, ___divsf3
- !
- ! #ifdef ERROR_CHECK
- ! LC0:
- ! .ascii "FLOATING POINT DIVISION by 0\12\15\0"
- ! .even
- ! #endif ERROR_CHECK
- !
- ! __divsf3:
- ! ___divsf3:
- !
- ! #ifdef ERROR_CHECK
- ! tstl a7@(8) | check if divisor is 0
- ! bne no_exception
- !
- ! moveml d0-d7/a0-a6,a7@- | print error message
- ! pea LC0
- ! movew #9,a7@-
- ! trap #1
- ! addql #6,a7
- ! moveml a7@+,d0-d7/a0-a6
- ! | set _errno to ERANGE
- ! #ifdef __MSHORT__
- ! movew #63,_errno
- ! #else
- ! movel #63,_errno
- ! #endif
- ! movel __infinitysf,d0 | return signed infinity
- ! btst #31,a7@(4) | transfer sign of dividend
- ! beq clear | (mjr++)
- ! bset #31,d0 |
- ! rts |
- ! clear: |
- ! bclr #31,d0 |
- ! rts
- !
- ! no_exception:
- !
- ! #endif ERROR_CHECK
- !
- ! lea 0xfffa50,a0
- movew #0x4400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 167,173 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x4400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 228,230 ****
- --- 180,183 ----
- rts | if ERROR_CHECK is disabled
-
- #endif sfp004
- + #endif /* !__M68881__ */
- *** 1.1 1992/02/04 17:11:06
- --- _extends.cpp 1992/10/09 20:46:13
- ***************
- *** 1,12 ****
- - #ifndef __M68881__
- - # ifndef sfp004
- |
- | single float to double float conversion routine
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- - |
- | Revision 1.2, kub 01-90 :
- | added support for denormalized numbers
- |
- --- 1,19 ----
- |
- | single float to double float conversion routine
- |
- + .text
- + .even
- + .globl __extendsfdf2, ___extendsfdf2
- +
- + __extendsfdf2:
- + ___extendsfdf2:
- +
- + #ifndef __M68881__
- + # ifndef sfp004
- + |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- | Revision 1.2, kub 01-90 :
- | added support for denormalized numbers
- |
- ***************
- *** 19,30 ****
- BIAS4 = 0x7F-1
- BIAS8 = 0x3FF-1
-
- - .text
- - .even
- - .globl __extendsfdf2, ___extendsfdf2
- -
- - __extendsfdf2:
- - ___extendsfdf2:
- lea sp@(4),a0 | parameter pointer
- moveml d2-d7,sp@- | save regs to keep norm_df happy
- movel a0@,d4 | get number
- --- 26,31 ----
- ***************
- *** 76,88 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! .text
- ! .even
- ! .globl __extendsfdf2, ___extendsfdf2
- !
- ! __extendsfdf2:
- ! ___extendsfdf2:
- ! lea 0xfffa50,a0
- movew #0x4400,a0@(comm) | load argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@ | now push arg
- --- 77,83 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x4400,a0@(comm) | load argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@ | now push arg
- ***************
- *** 110,121 ****
- | no NAN checking implemented since the 68881 treats this situation "correct",
- | i.e. according to IEEE
-
- - .text
- - .even
- - .globl __extendsfdf2, ___extendsfdf2
- -
- - __extendsfdf2:
- - ___extendsfdf2:
- fmoves a7@(4),fp0 | load argument to fp0
- fmoved fp0,a7@- | read back as double
- moveml a7@+,d0-d1
- --- 105,110 ----
- *** 1.2 1992/04/13 15:50:45
- --- _fixdfsi.cpp 1992/10/09 20:46:13
- ***************
- *** 2,21 ****
- | double float to long conversion routine
- |
- | M. Ritzert (ritzert@DFG.DBP.DE)
- -
- .text
- .even
-
- #ifdef ERROR_CHECK
- !
- _Overflow:
- .ascii "OVERFLOW\0"
- _Error_String:
- .ascii "_fixdfsi: %s error\n\0"
- .even
- -
- #endif ERROR_CHECK
-
- #ifdef sfp004
- |
- | 4.10.1990/10.1.1992
- --- 2,23 ----
- | double float to long conversion routine
- |
- | M. Ritzert (ritzert@DFG.DBP.DE)
- .text
- .even
- + .globl __fixdfsi, ___fixdfsi
-
- #ifdef ERROR_CHECK
- ! #include "errbase.h"
- _Overflow:
- .ascii "OVERFLOW\0"
- _Error_String:
- .ascii "_fixdfsi: %s error\n\0"
- .even
- #endif ERROR_CHECK
-
- + __fixdfsi:
- + ___fixdfsi:
- +
- #ifdef sfp004
- |
- | 4.10.1990/10.1.1992
- ***************
- *** 35,44 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! .globl __fixdfsi, ___fixdfsi
- ! __fixdfsi:
- ! ___fixdfsi:
- ! lea 0xfffa50,a0
- movew #0x5403,a0@(comm) | fintrz to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 37,43 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x5403,a0@(comm) | fintrz to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 62,70 ****
- | 30.11.1991/10.1.1992
- |
-
- - .globl __fixdfsi, ___fixdfsi
- - __fixdfsi:
- - ___fixdfsi:
- fintrzd sp@(4),fp0 | convert the arg
- fmovel fp0,d0 | return
-
- --- 61,66 ----
- ***************
- *** 97,108 ****
-
- BIAS8 = 0x3FF-1
-
- - .text
- - .even
- - .globl __fixdfsi, ___fixdfsi
- -
- - __fixdfsi:
- - ___fixdfsi:
- lea sp@(4),a0 | pointer to parameters
- moveml d2/d3,sp@- | save registers
- moveml a0@,d0-d1 | get the number
- --- 93,98 ----
- ***************
- *** 154,191 ****
-
- toobig:
- movel #0x7fffffff,d0 | ugh. Should cause a trap here.
-
- ! #endif !defined (sfp004) && !defined (__M68881__)
-
- #ifdef ERROR_CHECK
-
- | all three versions
- cmpil #0x7fffffff,d0 | >= long_max
- ! bge error_plus |
- cmpil #-0x7fffffff,d0 | <= long_min ?
- ! ble error_minus |
- ! rts |
- ! error_minus:
- ! moveml d0-d1,a7@-
- ! movel #63,_errno | errno = ERANGE
- ! pea _Overflow | for printf
- ! bra error_exit |
- ! error_plus:
- moveml d0-d1,a7@-
- ! movel #63,_errno | errno = ERANGE
- ! pea _Overflow | for printf
- ! bra error_exit |
- !
- ! error_exit:
- ! pea _Error_String |
- ! pea __iob+52 |
- jbsr _fprintf |
- addl #12,a7 |
- moveml a7@+,d0-d1
- ! #endif ERROR_CHECK
-
- - # if !defined (sfp004) && !defined (__M68881__)
- - bra 8b
- - #else
- rts
- - #endif
- --- 144,171 ----
-
- toobig:
- movel #0x7fffffff,d0 | ugh. Should cause a trap here.
- + moveml sp@+,d2/d3
-
- ! #endif /* !defined (sfp004) && !defined (__M68881__) */
-
- #ifdef ERROR_CHECK
-
- | all three versions
- cmpil #0x7fffffff,d0 | >= long_max
- ! bge error_msg
- cmpil #-0x7fffffff,d0 | <= long_min ?
- ! ble error_msg
- ! rts
- ! error_msg:
- moveml d0-d1,a7@-
- ! moveq #ERANGE,d0
- ! Emove d0,Errno
- ! pea pc@(_Overflow) | for printf
- ! pea pc@(_Error_String) |
- ! pea Stderr
- jbsr _fprintf |
- addl #12,a7 |
- moveml a7@+,d0-d1
- ! #endif /* ERROR_CHECK */
-
- rts
- *** 1.1 1992/04/13 15:50:45
- --- _fixsfsi.cpp 1992/10/09 20:46:13
- ***************
- *** 9,14 ****
- --- 9,17 ----
-
- .text
- .even
- + .globl ___fixsfsi
- +
- + ___fixsfsi:
-
- #ifdef sfp004
-
- ***************
- *** 16,24 ****
- resp = -16
- zahl = 0
-
- ! .globl ___fixsfsi
- ! ___fixdfsi:
- ! lea 0xfffa50,a0
- movew #0x5403,a0@(comm) | fintrz to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 19,25 ----
- resp = -16
- zahl = 0
-
- ! lea 0xfffffa50:w,a0
- movew #0x5403,a0@(comm) | fintrz to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 33,40 ****
-
- BIAS4 = 0x7F-1
-
- - .globl ___fixsfsi
- - ___fixsfsi:
- movel sp@(4),d0 | get number
- movel d2,sp@- | save register
- movel d0,d1
- --- 34,39 ----
- *** 1.2 1992/06/01 01:54:10
- --- _fltsi.cpp 1992/10/09 20:46:13
- ***************
- *** 1,11 ****
- - #ifdef __M68881__
- |
- | long integer to double float conversion routine
- |
- - | Written by M.Ritzert
- - | 22.11.91
- - | ritzert@dfg.dbp.de
- - |
- .text
- .even
- .globl __floatsidf, ___floatsidf
- --- 1,6 ----
- ***************
- *** 12,17 ****
- --- 7,18 ----
-
- __floatsidf:
- ___floatsidf:
- + #ifdef __M68881__
- + |
- + | Written by M.Ritzert
- + | 22.11.91
- + | ritzert@dfg.dbp.de
- + |
- fintrzd a7@(4),fp0 | load long int to fp0
- fmoved fp0,a7@- | get double from fp0
- moveml a7@+,d0-d1
- ***************
- *** 19,26 ****
-
- #endif __M68881__
- #ifdef sfp004
- -
- - | long integer to double float conversion routine
- |
- | Written by M.Ritzert
- | 5.10.90
- --- 20,25 ----
- ***************
- *** 42,54 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! .text
- ! .even
- ! .globl __floatsidf, ___floatsidf
- !
- ! __floatsidf:
- ! ___floatsidf:
- ! lea 0xfffa50,a0
- movew #0x4000,a0@(comm) | load long int to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 41,47 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x4000,a0@(comm) | load long int to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 60,72 ****
-
- #endif sfp004
- #if !defined (__M68881__) && !defined (sfp004)
- -
- - | long integer to double float conversion routine
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- - |
- | Revision 1.2, kub 01-90 :
- | added support for denormalized numbers
- |
- --- 53,62 ----
- ***************
- *** 78,89 ****
-
- BIAS8 = 0x3FF-1
-
- - .text
- - .even
- - .globl __floatsidf, ___floatsidf
- -
- - __floatsidf:
- - ___floatsidf:
- movel sp@(4),d0 | get the 4-byte integer
- moveml d2-d7,sp@- | save registers to make norm_df happy
-
- --- 68,73 ----
- *** 1.1 1992/04/13 15:50:45
- --- _fltsisf.cpp 1992/10/09 20:46:13
- ***************
- *** 5,11 ****
- --- 5,15 ----
- | mostly copied from _floatsi.cpp
-
- #ifndef __M68881__
- + .text
- + .even
- + .globl ___floatsisf
-
- + ___floatsisf:
- #ifdef sfp004
-
- | addresses of the 68881 data port. This choice is fastest when much data is
- ***************
- *** 15,26 ****
- resp = -16 | fpu response reg
- zahl = 0 | fpu data reg
-
- ! .text
- ! .even
- ! .globl ___floatsisf
- !
- ! ___floatsisf:
- ! lea 0xfffa50,a0
- movew #0x4000,a0@(comm) | load long int to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 19,25 ----
- resp = -16 | fpu response reg
- zahl = 0 | fpu data reg
-
- ! lea 0xfffffa50:w,a0
- movew #0x4000,a0@(comm) | load long int to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 35,45 ****
-
- BIAS4 = 0x7F-1
-
- - .text
- - .even
- - .globl ___floatsisf
- -
- - ___floatsisf:
- moveml d2-d5,sp@- | save registers to make norm_sf happy
-
- movel sp@(20),d4 | prepare result mantissa
- --- 34,39 ----
- *** 1.1 1992/02/04 17:11:06
- --- _fxunsd.cpp 1992/10/09 20:46:13
- ***************
- *** 4,12 ****
- | mjr
- .text
- .even
-
- #ifdef ERROR_CHECK
- !
- _Overflow:
- .ascii "OVERFLOW\0"
- _Negative:
- --- 4,13 ----
- | mjr
- .text
- .even
- + .globl __fixunsdfsi, ___fixunsdfsi
-
- #ifdef ERROR_CHECK
- ! #include "errbase.h"
- _Overflow:
- .ascii "OVERFLOW\0"
- _Negative:
- ***************
- *** 14,29 ****
- _Error_String:
- .ascii "_fixunsdfsi: %s error\n\0"
- .even
- -
- #endif ERROR_CHECK
-
- - #ifdef __M68881__
- -
- - .globl __fixunsdfsi, ___fixunsdfsi
- -
- __fixunsdfsi:
- ___fixunsdfsi:
-
- fintrzd a7@(4),fp0 | convert
- fmovel fp0,d0
-
- --- 15,36 ----
- _Error_String:
- .ascii "_fixunsdfsi: %s error\n\0"
- .even
- #endif ERROR_CHECK
-
- __fixunsdfsi:
- ___fixunsdfsi:
-
- + #ifdef ERROR_CHECK
- + tstl a7@(4) | negative?
- + beq Continue
- + moveq #ERANGE,d0
- + Emove d0,Errno
- + pea pc@(_Negative)
- + bra error_exit
- + Continue:
- + #endif /* ERROR_CHECK */
- + #ifdef __M68881__
- +
- fintrzd a7@(4),fp0 | convert
- fmovel fp0,d0
-
- ***************
- *** 38,52 ****
- resp = -16
- zahl = 0
-
- ! .text
- ! .even
- ! .globl __fixunsdfsi, ___fixunsdfsi
- !
- ! __fixunsdfsi:
- ! ___fixunsdfsi:
- ! lea 0xfffa50,a0
- ! tstl a4@(4) | negative?
- ! bne Negative
- movew #0x5403,a0@(comm) | fintrz to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 45,51 ----
- resp = -16
- zahl = 0
-
- ! lea 0xfffffa50:w,a0
- movew #0x5403,a0@(comm) | fintrz to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 54,91 ****
- movew #0x6000,a0@(comm) | result to d0
- .long 0x0c688900, 0xfff067f8
- movel a0@,d0
- ! bra Continue
- ! Negative:
- ! clrl d0
- ! Continue:
- ! # endif sfp004
- !
- ! # ifdef ERROR_CHECK
- ! cmpil #0x7fffffff,d0 | >= long_max
- ! bge error_plus |
- ! cmpil #0,d0 | < 0 ?
- ! blt error_minus |
- ! rts |
- ! error_minus:
- ! moveml d0-d1,a7@-
- ! movel #63,_errno | errno = ERANGE
- ! pea _Negative | for printf
- ! bra error_exit |
- ! error_plus:
- ! moveml d0-d1,a7@-
- ! movel #63,_errno | errno = ERANGE
- ! pea _Overflow | for printf
- ! bra error_exit |
- ! error_exit:
- ! pea _Error_String |
- ! pea __iob+52 |
- ! jbsr _fprintf |
- ! addl #12,a7 |
- ! moveml a7@+,d0-d1
- ! rts
- ! # else ERROR_CHECK
- ! rts
- ! # endif ERROR_CHECK
-
- # if !defined (sfp004) && !defined (__M68881__)
-
- --- 53,59 ----
- movew #0x6000,a0@(comm) | result to d0
- .long 0x0c688900, 0xfff067f8
- movel a0@,d0
- ! #endif sfp004
-
- # if !defined (sfp004) && !defined (__M68881__)
-
- ***************
- *** 109,120 ****
-
- BIAS8 = 0x3FF-1
-
- - .text
- - .even
- - .globl __fixunsdfsi, ___fixunsdfsi
- -
- - __fixunsdfsi:
- - ___fixunsdfsi:
- lea sp@(4),a0 | pointer to parameters
- moveml d4/d5,sp@- | save registers
- moveml a0@,d4-d5 | get the number
- --- 77,82 ----
- ***************
- *** 164,170 ****
- bra 7b
-
- toobig:
- movel #0x7fffffff,d0 | ugh. Should cause a trap here.
- - bra 7b
- -
- #endif
- --- 126,150 ----
- bra 7b
-
- toobig:
- + moveml sp@+,d4/d5
- movel #0x7fffffff,d0 | ugh. Should cause a trap here.
- #endif
- +
- + #ifdef ERROR_CHECK
- + cmpil #0x7fffffff,d0 | >= long_max
- + bge error_plus |
- + rts
- + error_plus:
- + moveml d0-d1,a7@-
- + moveq #ERANGE,d0
- + Emove d0,Errno
- + pea pc@(_Overflow) | for printf
- + error_exit:
- + pea pc@(_Error_String) |
- + pea Stderr
- + jbsr _fprintf |
- + addl #12,a7 |
- + moveml a7@+,d0-d1
- + #endif ERROR_CHECK
- + rts
- +
- *** 1.1 1992/02/04 17:11:06
- --- _muldf3.cpp 1992/10/09 20:46:13
- ***************
- *** 1,6 ****
- --- 1,13 ----
- | mjr: not needed on the TT
-
- #ifndef __M68881__
- + .text
- + .even
- + .globl __muldf3, ___muldf3
- +
- + __muldf3:
- + ___muldf3:
- +
- # ifdef sfp004
-
- | double precision floating point stuff for Atari-gcc using the SFP004
- ***************
- *** 30,42 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! .text
- ! .even
- ! .globl __muldf3, ___muldf3
- !
- ! __muldf3:
- ! ___muldf3:
- ! lea 0xfffa50,a0
- movew #0x5400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 37,43 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x5400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 70,81 ****
-
- BIAS8 = 0x3FF-1
-
- - .text
- - .even
- - .globl __muldf3, ___muldf3
- -
- - __muldf3:
- - ___muldf3:
- lea sp@(4),a0
- moveml d2-d7,sp@-
- moveml a0@,d4-d5/d6-d7 | d4-d5 = v, d6-d7 = u
- --- 71,76 ----
- *** 1.1 1992/02/04 17:11:06
- --- _mulsf3.cpp 1992/10/09 20:46:14
- ***************
- *** 1,6 ****
- --- 1,14 ----
- | mjr: not needed on the TT
-
- #ifndef __M68881__
- +
- + .text
- + .even
- + .globl __mulsf3, ___mulsf3
- +
- + __mulsf3:
- + ___mulsf3:
- +
- # ifdef sfp004
-
- | single precision floating point stuff for Atari-gcc using the SFP004
- ***************
- *** 19,31 ****
- resp = -16
- zahl = 0
-
- ! .text
- ! .even
- ! .globl __mulsf3, ___mulsf3
- !
- ! __mulsf3:
- ! ___mulsf3:
- ! lea 0xfffa50,a0
- movew #0x4400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 27,33 ----
- resp = -16
- zahl = 0
-
- ! lea 0xfffffa50:w,a0
- movew #0x4400,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ***************
- *** 57,68 ****
-
- BIAS4 = 0x7F-1
-
- - .text
- - .even
- - .globl __mulsf3, ___mulsf3
- -
- - __mulsf3:
- - ___mulsf3:
- lea sp@(4),a0
- moveml d2-d5,sp@-
- moveml a0@,d4/d5 | d4 = v, d5 = u
- --- 59,64 ----
- *** 1.1 1990/03/26 17:37:17
- --- _negdf2.s 1992/10/09 20:46:14
- ***************
- *** 20,24 ****
- orl sp@(8),d0
- moveml sp@(4),d0-d1 | get number
- beq 0f
- ! eorl #0x80000000,d0 | flip sign bit
- 0: rts
- --- 20,24 ----
- orl sp@(8),d0
- moveml sp@(4),d0-d1 | get number
- beq 0f
- ! bchg #31,d0 | flip sign bit
- 0: rts
- *** 1.1 1990/03/26 17:37:18
- --- _negsf2.s 1992/10/09 20:46:14
- ***************
- *** 18,22 ****
- ___negsf2:
- movel sp@(4),d0 | do not negate if operand is 0.0
- beq 0f
- ! eorl #0x80000000,d0 | flip sign bit
- 0: rts
- --- 18,22 ----
- ___negsf2:
- movel sp@(4),d0 | do not negate if operand is 0.0
- beq 0f
- ! bchg #31,d0 | flip sign bit
- 0: rts
- *** 1.4 1992/02/04 17:11:06
- --- _normdf.cpp 1992/10/09 20:46:14
- ***************
- *** 43,49 ****
- #if !defined (__M68881__) && !defined (sfp004)
- .globl ___normdf
- .globl norm_df
- !
- # ifdef ERROR_CHECK
- LC0:
- .ascii "normdf: OVERFLOW\12\15\0"
- --- 43,49 ----
- #if !defined (__M68881__) && !defined (sfp004)
- .globl ___normdf
- .globl norm_df
- ! #include "errbase.h"
- # ifdef ERROR_CHECK
- LC0:
- .ascii "normdf: OVERFLOW\12\15\0"
- ***************
- *** 163,177 ****
- moveml sp@+,d2-d7
- rts
-
- - .globl _errno | from <errno.h>
- - ERANGE = 63
- -
- retz:
- ! # ifdef __MSHORT__
- ! movew #ERANGE,_errno | set errno
- ! # else
- ! movel #ERANGE,_errno | set errno
- ! # endif
- clrl d0 | return zero value
- clrl d1
- moveml sp@+,d2-d7
- --- 163,171 ----
- moveml sp@+,d2-d7
- rts
-
- retz:
- ! moveq #ERANGE,d0
- ! Emove d0,Errno
- clrl d0 | return zero value
- clrl d1
- moveml sp@+,d2-d7
- ***************
- *** 178,199 ****
- rts
-
- oflow:
- -
- #ifdef ERROR_CHECK
- ! moveml d0-d1,a7@-
- ! pea LC0
- ! pea __iob+52 |
- jbsr _fprintf |
- addql #8,a7 |
- ! moveml a7@+,d0-d1
- ! # ifdef __MSHORT__
- ! movew #ERANGE,_errno | set errno
- ! # else
- ! movel #ERANGE,_errno | set errno
- ! # endif
- #endif ERROR_CHECK
-
- ! moveml __infinitydf,d0-d1 | return infinty value
- andw #0x8000,d2 | get sign bit of argument
- swap d2
- clrw d2
- --- 172,187 ----
- rts
-
- oflow:
- #ifdef ERROR_CHECK
- ! pea pc@(LC0)
- ! pea Stderr
- jbsr _fprintf |
- addql #8,a7 |
- ! moveq #ERANGE,d0
- ! Emove d0,Errno
- #endif ERROR_CHECK
-
- ! moveml pc@(__infinitydf),d0-d1 | return infinity value
- andw #0x8000,d2 | get sign bit of argument
- swap d2
- clrw d2
- *** 1.1 1992/02/04 17:11:06
- --- _normsf.cpp 1992/10/09 20:46:14
- ***************
- *** 31,37 ****
- #if !defined (__M68881__) && !defined (sfp004)
- .globl ___normsf
- .globl norm_sf
- !
- #ifdef ERROR_CHECK
- LC0:
- .ascii "normsf: OVERFLOW\12\15\0"
- --- 31,37 ----
- #if !defined (__M68881__) && !defined (sfp004)
- .globl ___normsf
- .globl norm_sf
- ! #include "errbase.h"
- #ifdef ERROR_CHECK
- LC0:
- .ascii "normsf: OVERFLOW\12\15\0"
- ***************
- *** 116,122 ****
- moveml sp@+,d2-d5
- rts
-
- ! retz: clrl d0
- moveml sp@+,d2-d5
- rts
-
- --- 116,124 ----
- moveml sp@+,d2-d5
- rts
-
- ! retz: moveq #ERANGE,d0
- ! Emove d0,Errno
- ! clrl d0
- moveml sp@+,d2-d5
- rts
-
- ***************
- *** 123,137 ****
- oflow:
-
- #ifdef ERROR_CHECK
- ! moveml d0-d1,a7@-
- ! pea LC0
- ! pea __iob+52 |
- jbsr _fprintf |
- addql #8,a7 |
- ! moveml a7@+,d0-d1
- #endif ERROR_CHECK
-
- ! movel __infinitysf,d0 | return infinty value
-
- btst #15,d2 | transfer sign
- beq ofl_clear | (mjr++)
- --- 125,139 ----
- oflow:
-
- #ifdef ERROR_CHECK
- ! movel d1,a7@-
- ! pea pc@(LC0)
- ! pea Stderr
- jbsr _fprintf |
- addql #8,a7 |
- ! movel a7@+,d1
- #endif ERROR_CHECK
-
- ! movel pc@(__infinitysf),d0 | return infinity value
-
- btst #15,d2 | transfer sign
- beq ofl_clear | (mjr++)
- *** 1.1 1992/02/04 17:11:06
- --- _truncdf.cpp 1992/10/09 20:46:14
- ***************
- *** 1,6 ****
- --- 1,12 ----
- | not needed with -__M68881__
-
- #ifndef __M68881__
- + .text
- + .even
- + .globl __truncdfsf2, ___truncdfsf2
- +
- + __truncdfsf2:
- + ___truncdfsf2:
- # ifdef sfp004
-
- | double float to single float conversion routine
- ***************
- *** 26,38 ****
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! .text
- ! .even
- ! .globl __truncdfsf2, ___truncdfsf2
- !
- ! __truncdfsf2:
- ! ___truncdfsf2:
- ! lea 0xfffa50,a0
- movew #0x5400,a0@(comm) | load double to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@ | push arguments
- --- 32,38 ----
- | is coded directly by
- | .long 0x0c688900, 0xfff067f8
-
- ! lea 0xfffffa50:w,a0
- movew #0x5400,a0@(comm) | load double to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@ | push arguments
- ***************
- *** 62,73 ****
- BIAS4 = 0x7F-1
- BIAS8 = 0x3FF-1
-
- - .text
- - .even
- - .globl __truncdfsf2, ___truncdfsf2
- -
- - __truncdfsf2:
- - ___truncdfsf2:
- lea sp@(4),a0 | parameter pointer
- moveml d2-d5,sp@- | save regs
- moveml a0@,d4-d5 | get number
- --- 62,67 ----
- *** 1.8 1992/06/01 01:54:10
- --- access.c 1992/10/09 20:46:15
- ***************
- *** 14,20 ****
- int mode;
- {
- struct stat sb;
- - int uid, gid;
-
- if (stat(path, &sb) < 0)
- return -1; /* errno was set by stat() */
- --- 14,19 ----
- ***************
- *** 24,30 ****
- /* somewhat crufty code -- relies on R_OK, etc. matching the bits in the
- file mode, but what the heck, we can do this
- */
- ! if (__mint < 9 || ( (uid = geteuid()) == sb.st_uid ) ) {
- if ( ((sb.st_mode >> 6) & mode) == mode )
- return 0;
- else
- --- 23,29 ----
- /* somewhat crufty code -- relies on R_OK, etc. matching the bits in the
- file mode, but what the heck, we can do this
- */
- ! if (__mint < 9 || ( geteuid() == sb.st_uid ) ) {
- if ( ((sb.st_mode >> 6) & mode) == mode )
- return 0;
- else
- ***************
- *** 31,37 ****
- goto accdn;
- }
-
- ! if ( (gid = getegid()) == sb.st_gid ) {
- if ( ((sb.st_mode >> 3) & mode) == mode )
- return 0;
- else
- --- 30,36 ----
- goto accdn;
- }
-
- ! if ( getegid() == sb.st_gid ) {
- if ( ((sb.st_mode >> 3) & mode) == mode )
- return 0;
- else
- *** 1.6 1992/06/01 01:54:10
- --- alloca.s 1992/10/09 20:46:15
- ***************
- *** 14,20 ****
- movel sp@+,d0 | get size -- assist in bug fix, add 4 to sp
-
- addql #1,d0 | ensure address even
- ! andl #0xFFFFFFFE,d0 | lop off extra bits
-
- subl d0,sp | increase stack frame size by that much
- movel sp,d0 | set up to return it
- --- 14,20 ----
- movel sp@+,d0 | get size -- assist in bug fix, add 4 to sp
-
- addql #1,d0 | ensure address even
- ! bclr #0,d0 | lop off odd bit
-
- subl d0,sp | increase stack frame size by that much
- movel sp,d0 | set up to return it
- *** 1.1 1991/04/12 18:19:53
- --- alphasor.c 1992/10/09 20:46:15
- ***************
- *** 3,16 ****
- ** Trivial sorting predicate for scandir; puts entries in alphabetical order.
- */
-
- ! #include <sys/types.h>
- ! #include <sys/dir.h>
- #include <string.h>
-
- int
- alphasort(d1, d2)
- ! struct direct **d1;
- ! struct direct **d2;
- {
- return strcmp(d1[0]->d_name, d2[0]->d_name);
- }
- --- 3,16 ----
- ** Trivial sorting predicate for scandir; puts entries in alphabetical order.
- */
-
- ! #include <types.h>
- ! #include <dirent.h>
- #include <string.h>
-
- int
- alphasort(d1, d2)
- ! struct dirent **d1;
- ! struct dirent **d2;
- {
- return strcmp(d1[0]->d_name, d2[0]->d_name);
- }
- *** 1.21 1992/03/22 21:57:30
- --- atof.c 1992/10/09 20:46:15
- ***************
- *** 77,83 ****
- --- 77,86 ----
-
- static int __ten_mul __PROTO((double *acc, int digit));
- static double __adjust __PROTO((double *acc, int dexp, int sign));
- +
- + #ifdef __OLD__
- static double __ten_pow __PROTO((double r, int e));
- + #endif
-
- /*
- * mul 64 bit accumulator by 10 and add digit
- ***************
- *** 692,698 ****
- .even
- .text
- __Float_:
- ! lea 0xfffa50,a0 | fpu address
-
- movew #0x4092,a0@(comm) | ftentoxl -> fp1
- .long 0x0c688900, 0xfff067f8
- --- 695,701 ----
- .even
- .text
- __Float_:
- ! lea 0xfffffa50:w,a0 | fpu address
-
- movew #0x4092,a0@(comm) | ftentoxl -> fp1
- .long 0x0c688900, 0xfff067f8
- *** 1.11 1992/06/01 01:54:10
- --- bcmp.c 1992/10/09 20:46:16
- ***************
- *** 3,9 ****
- #include <assert.h>
-
- #undef ODD
- ! #define ODD(x) (((long)(x)) & 1)
-
- /*
- * compare n bytes efficientlty
- --- 3,9 ----
- #include <assert.h>
-
- #undef ODD
- ! #define ODD(x) (((long)(x)) & 1L)
-
- /*
- * compare n bytes efficientlty
- *** 1.2 1992/08/14 14:48:29
- --- binmode.c 1992/10/09 20:46:16
- ***************
- *** 7,13 ****
- * ++jrb;
- */
-
- -
- #include <stdio.h>
-
- extern int __default_mode__;
- --- 7,12 ----
- *** 1.8 1992/06/01 01:54:10
- --- bsearch.c 1992/10/09 20:46:16
- ***************
- *** 30,36 ****
- while(a <= b)
- {
- c = (a + b) >> 1; /* == ((a + b) / 2) */
- ! if (dir = (*cmp)((void *)((char *)base + (c * size)), key))
- {
- if (dir > 0)
- {
- --- 30,36 ----
- while(a <= b)
- {
- c = (a + b) >> 1; /* == ((a + b) / 2) */
- ! if ((dir = (*cmp)((void *)((char *)base + (c * size)), key)) != 0)
- {
- if (dir > 0)
- {
- *** 1.1 1992/06/01 01:54:10
- --- calloc.c 1992/10/09 20:46:16
- ***************
- *** 10,15 ****
- --- 10,16 ----
-
- __EXTERN void *_malloc __PROTO((unsigned long));
- __EXTERN void _bzero __PROTO((void *, unsigned long));
- + __EXTERN void *_calloc __PROTO((unsigned long, unsigned long));
-
- #ifdef __GNUC__
- asm(".stabs \"_calloc\",5,0,0,__calloc"); /* dept of clean tricks */
- *** 1.7 1992/06/24 15:32:04
- --- chmod.c 1992/10/09 20:46:17
- ***************
- *** 24,30 ****
- (void)_unx2dos(_path, path);
-
- if (__mint >= 9) { /* use MiNT Fchmod function */
- ! r = Fchmod(path, mode);
- if (r) {
- errno = -r;
- return -1;
- --- 24,30 ----
- (void)_unx2dos(_path, path);
-
- if (__mint >= 9) { /* use MiNT Fchmod function */
- ! r = (int)Fchmod(path, mode);
- if (r) {
- errno = -r;
- return -1;
- ***************
- *** 69,75 ****
-
- if (__mint >= 9) {
- (void)_unx2dos(_name, name);
- ! r = Fchown(name, uid, gid);
- if (r) {
- errno = -r;
- return -1;
- --- 69,75 ----
-
- if (__mint >= 9) {
- (void)_unx2dos(_name, name);
- ! r = (int)Fchown(name, uid, gid);
- if (r) {
- errno = -r;
- return -1;
- *** 1.7 1992/03/06 19:19:47
- --- ctime.c 1992/10/09 20:46:17
- ***************
- *** 71,79 ****
- i = 1900 + time->tm_year;
- *vpos++ = i / 100;
- *vpos = i % 100;
- ! ptr = memcpy(ptr, day[time->tm_wday], 3) + 3;
- ptr += 1;
- ! ptr = memcpy(ptr, month[time->tm_mon], 3) + 3;
- valp = values;
- do
- {
- --- 71,79 ----
- i = 1900 + time->tm_year;
- *vpos++ = i / 100;
- *vpos = i % 100;
- ! ptr = (char *)memcpy(ptr, day[time->tm_wday], 3) + 3;
- ptr += 1;
- ! ptr = (char *)memcpy(ptr, month[time->tm_mon], 3) + 3;
- valp = values;
- do
- {
- *** 1.1 1989/03/25 17:23:13
- --- difftime.c 1992/10/09 20:46:17
- ***************
- *** 2,9 ****
-
- #include <time.h>
-
- ! double difftime(t1, t2)
- ! time_t t1, t2;
- {
- return (double) (t2 - t1);
- }
- --- 2,9 ----
-
- #include <time.h>
-
- ! double difftime(t2, t1)
- ! time_t t2, t1;
- {
- return (double) (t2 - t1);
- }
- *** 1.15 1992/06/01 01:54:10
- --- doprnt.c 1992/10/09 20:46:18
- ***************
- *** 20,25 ****
- --- 20,27 ----
- * ++jrb
- * and for the sfp004 as well as the TT's 68881
- * mjr++
- + * and for turbo C and the MiNT library
- + * ++um,mh
- */
-
- #ifndef __NO_FLOAT__
- ***************
- *** 43,49 ****
- --- 45,55 ----
- static char sccsid[] = "@(#)doprnt.c 5.37 (Berkeley) 3/26/89";
- #endif /* LIBC_SCCS */
-
- + #ifdef __TURBOC__
- + #include <sys\types.h>
- + #else
- #include <sys/types.h>
- + #endif
- #include <stdarg.h>
- #include <stdio.h>
- #include <ctype.h>
- ***************
- *** 101,116 ****
- # include "flonum.h"
- # if __STDC__
- static char *exponent(char *, int, int);
- ! static char *round(double, int *, char *, char *, int, char *);
- static int cvt(double, int, int, char *, int, char *, char *);
- # else
- static char *exponent();
- ! static char *round();
- static int cvt();
- # endif
- #endif
-
- ! #ifdef __GNUC__
- #ifdef __M68020__
-
- #define _ICONV(NUMBER, BASE, BUF) \
- --- 107,122 ----
- # include "flonum.h"
- # if __STDC__
- static char *exponent(char *, int, int);
- ! static char *_round(double, int *, char *, char *, int, char *);
- static int cvt(double, int, int, char *, int, char *, char *);
- # else
- static char *exponent();
- ! static char *_round();
- static int cvt();
- # endif
- #endif
-
- ! #if defined(__GNUC__) && (!defined(__NO_INLINE__))
- #ifdef __M68020__
-
- #define _ICONV(NUMBER, BASE, BUF) \
- ***************
- *** 188,193 ****
- --- 194,200 ----
- #ifdef __FLOATS__
- /* double _double; *//* double precision arguments %[eEfgG] */
- union double_di _dd; /* _double is #defined to be _dd later on */
- + char softsign; /* temporary negative sign for floats */
- #endif __FLOATS__
- u_long _ulong; /* integer arguments %[diouxX] */
- short base; /* base for [diouxX] conversion */
- ***************
- *** 200,206 ****
- short size; /* size of converted field or string */
- short width; /* width from format (%8d), or 0 */
- char sign; /* sign prefix (' ', '+', '-', or \0) */
- - char softsign; /* temporary negative sign for floats */
- char *digs; /* digits for [diouxX] conversion */
- char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */
-
- --- 207,212 ----
- ***************
- *** 208,214 ****
- fmt = (const u_char *) fmt0;
- digs = "0123456789abcdef";
- for (cnt = 0;; ++fmt) {
- ! if (!(ch = *fmt))
- return (cnt);
- if (ch != '%') {
- PUTC(ch);
- --- 214,220 ----
- fmt = (const u_char *) fmt0;
- digs = "0123456789abcdef";
- for (cnt = 0;; ++fmt) {
- ! if ((ch = *fmt) == 0)
- return (cnt);
- if (ch != '%') {
- PUTC(ch);
- ***************
- *** 325,331 ****
- * zeroes later, so buffer size stays rational.
- */
- if (prec > MAXFRACT) {
- ! if (*fmt != 'g' && *fmt != 'G' || (flags&ALT))
- fpprec = prec - MAXFRACT;
- prec = MAXFRACT;
- }
- --- 331,337 ----
- * zeroes later, so buffer size stays rational.
- */
- if (prec > MAXFRACT) {
- ! if ((*fmt != 'g' && *fmt != 'G') || (flags&ALT))
- fpprec = prec - MAXFRACT;
- prec = MAXFRACT;
- }
- ***************
- *** 394,400 ****
- base = 16;
- goto nosign;
- case 's':
- ! if (!(t = va_arg(argp, char *)))
- t = "(null)";
- if (prec >= 0) {
- /*
- --- 400,406 ----
- base = 16;
- goto nosign;
- case 's':
- ! if ((t = va_arg(argp, char *)) == 0)
- t = "(null)";
- if (prec >= 0) {
- /*
- ***************
- *** 409,415 ****
- char *p, *memchr();
- #endif
-
- ! if (p = (char *)memchr(t, 0, (size_t)prec)) {
- size = p - t;
- if (size > prec)
- size = prec;
- --- 415,421 ----
- char *p, *memchr();
- #endif
-
- ! if ((p = (char *)memchr(t, 0, (size_t)prec)) != NULL) {
- size = p - t;
- if (size > prec)
- size = prec;
- ***************
- *** 539,548 ****
- {
- register char *p, *t;
- register double fract;
- ! int dotrim, expcnt, gformat;
- double integer, tmp, modf __PROTO((double, double *));
- char *exponent __PROTO((char *, int, int)),
- ! *round __PROTO((double, int *, char *, char *, int, char *));
-
- dotrim = expcnt = gformat = 0;
- fract = modf(number, &integer);
- --- 545,554 ----
- {
- register char *p, *t;
- register double fract;
- ! int dotrim, expcnt, gformat, /* mjr++ : */ old_prec;
- double integer, tmp, modf __PROTO((double, double *));
- char *exponent __PROTO((char *, int, int)),
- ! *_round __PROTO((double, int *, char *, char *, int, char *));
-
- dotrim = expcnt = gformat = 0;
- fract = modf(number, &integer);
- ***************
- *** 549,555 ****
-
- /* get an extra slot for rounding. */
- t = ++startp;
- !
- /*
- * get integer portion of number; put into the end of the buffer; the
- * .01 is added for modf(356.0 / 10, &integer) returning .59999999...
- --- 555,561 ----
-
- /* get an extra slot for rounding. */
- t = ++startp;
- ! #define DBL_EPSILON 1.1107651257113995e-16 /* mjr ++ /
- /*
- * get integer portion of number; put into the end of the buffer; the
- * .01 is added for modf(356.0 / 10, &integer) returning .59999999...
- ***************
- *** 556,562 ****
- */
- for (p = endp - 1; integer; ++expcnt) {
- tmp = modf(integer / 10, &integer);
- ! *p-- = tochar((int)((tmp + .01) * 10));
- }
- switch(fmtch) {
- case 'f':
- --- 562,568 ----
- */
- for (p = endp - 1; integer; ++expcnt) {
- tmp = modf(integer / 10, &integer);
- ! *p-- = tochar((int)((tmp + DBL_EPSILON) * 10));
- }
- switch(fmtch) {
- case 'f':
- ***************
- *** 579,585 ****
- *t++ = tochar((int)tmp);
- } while (--prec && fract);
- if (fract)
- ! startp = round(fract, (int *)NULL, startp,
- t - 1, (char)0, signp);
- }
- for (; prec--; *t++ = '0');
- --- 585,591 ----
- *t++ = tochar((int)tmp);
- } while (--prec && fract);
- if (fract)
- ! startp = _round(fract, (int *)NULL, startp,
- t - 1, (char)0, signp);
- }
- for (; prec--; *t++ = '0');
- ***************
- *** 600,606 ****
- */
- if (!prec && ++p < endp) {
- fract = 0;
- ! startp = round((double)0, &expcnt, startp,
- t - 1, *p, signp);
- }
- /* adjust expcnt for digit in front of decimal */
- --- 606,612 ----
- */
- if (!prec && ++p < endp) {
- fract = 0;
- ! startp = _round((double)0, &expcnt, startp,
- t - 1, *p, signp);
- }
- /* adjust expcnt for digit in front of decimal */
- ***************
- *** 631,637 ****
- *t++ = tochar((int)tmp);
- } while (--prec && fract);
- if (fract)
- ! startp = round(fract, &expcnt, startp,
- t - 1, (char)0, signp);
- }
- /* if requires more precision */
- --- 637,643 ----
- *t++ = tochar((int)tmp);
- } while (--prec && fract);
- if (fract)
- ! startp = _round(fract, &expcnt, startp,
- t - 1, (char)0, signp);
- }
- /* if requires more precision */
- ***************
- *** 648,653 ****
- --- 654,661 ----
- break;
- case 'g':
- case 'G':
- + old_prec = min(prec,15); /* mjr++, avoid "precision" that */
- + /* cannot be numerically resolved */
- /* a precision of 0 is treated as a precision of 1. */
- if (!prec)
- ++prec;
- ***************
- *** 657,663 ****
- * conversion is less than -4 or greater than the precision.''
- * -- ANSI X3J11
- */
- ! if (expcnt > prec || !expcnt && fract && fract < .0001) {
- /*
- * g/G format counts "significant digits, not digits of
- * precision; for the e/E format, this just causes an
- --- 665,671 ----
- * conversion is less than -4 or greater than the precision.''
- * -- ANSI X3J11
- */
- ! if (expcnt > prec || (!expcnt && fract && fract < .0001)) {
- /*
- * g/G format counts "significant digits, not digits of
- * precision; for the e/E format, this just causes an
- ***************
- *** 685,690 ****
- --- 693,699 ----
- if (prec || flags&ALT) {
- dotrim = 1;
- *t++ = '.';
- + old_prec ++; /* mjr++ */
- }
- else
- dotrim = 0;
- ***************
- *** 706,712 ****
- }
- }
- if (fract)
- ! startp = round(fract, (int *)NULL, startp,
- t - 1, (char)0, signp);
- }
- /* alternate format, adds 0's for precision, else trim 0's */
- --- 715,721 ----
- }
- }
- if (fract)
- ! startp = _round(fract, (int *)NULL, startp,
- t - 1, (char)0, signp);
- }
- /* alternate format, adds 0's for precision, else trim 0's */
- ***************
- *** 713,718 ****
- --- 722,729 ----
- if (flags&ALT)
- for (; prec--; *t++ = '0');
- else if (dotrim) {
- + if( (int)(t-startp) > old_prec ) /* mjr++ */
- + t = startp + old_prec;
- while (t > startp && *--t == '0');
- if (*t != '.')
- ++t;
- ***************
- *** 722,728 ****
- }
-
- static char *
- ! round(fract, exp, start, end, ch, signp)
- double fract;
- int *exp;
- register char *start, *end;
- --- 733,739 ----
- }
-
- static char *
- ! _round(fract, exp, start, end, ch, signp)
- double fract;
- int *exp;
- register char *start, *end;
- *** 1.10 1992/06/01 01:54:10
- --- findfile.c 1992/10/09 20:46:19
- ***************
- *** 9,14 ****
- --- 9,15 ----
- Written by Eric R. Smith and placed in the public domain.
- */
-
- + #include <compiler.h>
- #include <limits.h> /* needed for PATH_MAX */
- #include <stddef.h>
- #include <types.h>
- ***************
- *** 25,30 ****
- --- 26,34 ----
-
- static char *nullext[] = { NULL };
-
- + static int EXISTS __PROTO((char *));
- + char *findfile __PROTO((char *fname, char *fpath, char **fext));
- +
- static int
- EXISTS(name)
- char *name;
- ***************
- *** 54,60 ****
- /* copy the file in, checking to see if a path and/or extension are already
- given */
-
- ! while ( c = *t++ ) {
- if (c == DIRSEP1 || c == DIRSEP2) {
- haspath = 1; hasext = 0;
- }
- --- 58,64 ----
- /* copy the file in, checking to see if a path and/or extension are already
- given */
-
- ! while ( (c = *t++) != 0 ) {
- if (c == DIRSEP1 || c == DIRSEP2) {
- haspath = 1; hasext = 0;
- }
- ***************
- *** 89,95 ****
-
- /* copy in next element of path list */
- s = try;
- ! while ((c = *fpath) && c != PATHSEP1 && c != PATHSEP2) {
- *s++ = c;
- fpath++;
- }
- --- 93,99 ----
-
- /* copy in next element of path list */
- s = try;
- ! while ((c = *fpath) != 0 && c != PATHSEP1 && c != PATHSEP2) {
- *s++ = c;
- fpath++;
- }
- ***************
- *** 96,102 ****
- if (c) fpath++;
- *s++ = DIRSEP1;
- t = fname;
- ! while (*s++ = *t++) ;
- extplace = --s ; /* where the extension gets written */
- }
- return NULL;
- --- 100,106 ----
- if (c) fpath++;
- *s++ = DIRSEP1;
- t = fname;
- ! while ((*s++ = *t++) != 0) ;
- extplace = --s ; /* where the extension gets written */
- }
- return NULL;
- *** 1.5 1990/03/26 17:37:23
- --- flonum.h 1992/10/09 20:46:19
- ***************
- *** 18,23 ****
- --- 18,24 ----
-
- /* quasi-IEEE floating point number definitions */
-
- + #ifndef __TURBOC__
- struct bitfloat {
- unsigned long sign : 1;
- unsigned long exp : 8;
- ***************
- *** 30,35 ****
- --- 31,37 ----
- unsigned long mant1 : 20;
- unsigned long mant2;
- };
- + #endif
-
- union double_di {
- double d;
- *** 1.17 1992/06/01 01:54:10
- --- fopen.c 1992/10/09 20:46:19
- ***************
- *** 7,12 ****
- --- 7,13 ----
- #include <errno.h>
-
- __EXTERN void _getbuf __PROTO((FILE *));
- + static FILE *_fopen __PROTO((const char *, const char *, FILE *));
-
- /* lowest character device handle # */
- #define LAST_DEVICE __SMALLEST_VALID_HANDLE
- ***************
- *** 15,22 ****
-
- static FILE *_fopen(filename, mode, fp)
- const char *filename;
- ! const register char *mode;
- ! register FILE *fp;
- /*
- * INTERNAL FUNCTION. Attempt to open <filename> in the given
- * <mode> and attach it to the stream <fp>
- --- 16,23 ----
-
- static FILE *_fopen(filename, mode, fp)
- const char *filename;
- ! const char *mode;
- ! FILE *fp;
- /*
- * INTERNAL FUNCTION. Attempt to open <filename> in the given
- * <mode> and attach it to the stream <fp>
- *** 1.13 1992/04/08 18:38:50
- --- fread.c 1992/10/09 20:46:20
- ***************
- *** 10,15 ****
- --- 10,17 ----
- #include <string.h>
- #include "lib.h"
-
- + extern short __FRW_BIN__;
- +
- size_t fread(_data, size, count, fp)
- void *_data;
- size_t size;
- ***************
- *** 37,43 ****
- return 0;
- #endif
- assert((n <= (size_t)LONG_MAX));
- ! if( f&_IOBIN ) {
- again:
- if((cnt = fp->_cnt) > 0)
- {
- --- 39,45 ----
- return 0;
- #endif
- assert((n <= (size_t)LONG_MAX));
- ! if( (f&_IOBIN) || __FRW_BIN__ ) {
- again:
- if((cnt = fp->_cnt) > 0)
- {
- *** 1.5 1992/02/04 17:11:06
- --- frexp.cpp 1992/10/09 20:46:20
- ***************
- *** 180,187 ****
- clrl d1
- rts
- nonzero:
- !
- ! lea 0xfffa50,a0
- movew #0x5418,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- --- 180,186 ----
- clrl d1
- rts
- nonzero:
- ! lea 0xfffffa50:w,a0
- movew #0x5418,a0@(comm) | load first argument to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- *** 1.6 1991/04/12 18:19:53
- --- fseek.c 1992/10/09 20:46:20
- ***************
- *** 37,46 ****
- void rewind(fp)
- register FILE *fp;
- {
- - register long rv;
- -
- fflush(fp);
- ! rv = lseek(fp->_file, 0L, SEEK_SET);
- fp->_flag &= ~(_IOEOF|_IOERR);
- }
-
- --- 37,44 ----
- void rewind(fp)
- register FILE *fp;
- {
- fflush(fp);
- ! (void) lseek(fp->_file, 0L, SEEK_SET);
- fp->_flag &= ~(_IOEOF|_IOERR);
- }
-
- *** 1.7 1992/06/01 01:54:10
- --- ftw.c 1992/10/09 20:46:21
- ***************
- *** 8,16 ****
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- ! #include <sys/types.h>
- ! #include <sys/stat.h>
- #include <sys/dir.h>
- #include <ftw.h>
-
- #define EQ(a, b) (strcmp((a), (b)) == 0)
- --- 8,20 ----
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- ! #include <types.h>
- ! #include <stat.h>
- ! #ifdef __TURBOC__
- ! #include <sys\dir.h>
- ! #else
- #include <sys/dir.h>
- + #endif
- #include <ftw.h>
-
- #define EQ(a, b) (strcmp((a), (b)) == 0)
- ***************
- *** 18,24 ****
- int
- ftw(directory, funcptr, depth)
- char *directory;
- ! int (*funcptr)();
- int depth;
- {
- register DIR *dirp;
- --- 22,28 ----
- int
- ftw(directory, funcptr, depth)
- char *directory;
- ! int (*funcptr) __PROTO((char *, struct stat *, int));
- int depth;
- {
- register DIR *dirp;
- ***************
- *** 25,31 ****
- struct direct *entp;
- struct stat stats;
- register char *p;
- ! register int i;
- #ifndef __MINT__
- long seekpoint;
- #endif
- --- 29,35 ----
- struct direct *entp;
- struct stat stats;
- register char *p;
- ! register long i;
- #ifndef __MINT__
- long seekpoint;
- #endif
- ***************
- *** 53,59 ****
- i = (*funcptr)(directory, &stats, FTW_D);
- if (i) {
- closedir(dirp);
- ! return i;
- }
-
- /* Get ready to hold the full paths. */
- --- 57,63 ----
- i = (*funcptr)(directory, &stats, FTW_D);
- if (i) {
- closedir(dirp);
- ! return (int)i;
- }
-
- /* Get ready to hold the full paths. */
- ***************
- *** 69,75 ****
- *p++ = '/';
-
- /* Read all entries in the directory.. */
- ! while (entp = readdir(dirp))
- if (!EQ(entp->d_name, ".") && !EQ(entp->d_name, "..")) {
- #ifndef __MINT__
- if (depth <= 1) {
- --- 73,79 ----
- *p++ = '/';
-
- /* Read all entries in the directory.. */
- ! while ((entp = readdir(dirp)) != 0)
- if (!EQ(entp->d_name, ".") && !EQ(entp->d_name, "..")) {
- #ifndef __MINT__
- if (depth <= 1) {
- ***************
- *** 87,93 ****
- free(fullpath);
- if (dirp)
- closedir(dirp);
- ! return i;
- }
-
- #ifndef __MINT__
- --- 91,97 ----
- free(fullpath);
- if (dirp)
- closedir(dirp);
- ! return (int)i;
- }
-
- #ifndef __MINT__
- *** 1.12 1992/08/14 14:48:29
- --- fwrite.c 1992/10/09 20:46:21
- ***************
- *** 8,13 ****
- --- 8,15 ----
- #include <string.h>
- #include "lib.h"
-
- + extern short __FRW_BIN__;
- +
- size_t fwrite(_data, size, count, fp)
- const void *_data;
- size_t size;
- ***************
- *** 39,45 ****
- n = count * size;
- assert ( n <= (size_t)LONG_MAX); /* otherwise impl will not work */
-
- ! if( f&_IOBIN ) {
- space = fp->_bsiz - fp->_cnt;
- while(n > 0)
- {
- --- 41,47 ----
- n = count * size;
- assert ( n <= (size_t)LONG_MAX); /* otherwise impl will not work */
-
- ! if( (f&_IOBIN) || __FRW_BIN__ ) {
- space = fp->_bsiz - fp->_cnt;
- while(n > 0)
- {
- *** 1.5 1992/03/06 19:19:47
- --- getbuf.c 1992/10/09 20:46:21
- ***************
- *** 18,24 ****
- fp->_bsiz = __DEFAULT_BUFSIZ__;
-
- if((f & _IONBF) /* risky!! but works ok with gnu.may change */
- ! || (!(fp->_base = (unsigned char *)malloc((size_t)fp->_bsiz))) )
- {
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF);
- fp->_flag |= _IONBF;
- --- 18,24 ----
- fp->_bsiz = __DEFAULT_BUFSIZ__;
-
- if((f & _IONBF) /* risky!! but works ok with gnu.may change */
- ! || ((fp->_base = (unsigned char *)malloc((size_t)fp->_bsiz)) == 0) )
- {
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF);
- fp->_flag |= _IONBF;
- *** 1.9 1992/06/24 15:32:04
- --- getenv.c 1992/10/09 20:46:21
- ***************
- *** 18,24 ****
-
- if (!environ) return 0;
-
- ! for (var = environ; name = *var; var++) {
- if (!strncmp(name, tag, len) && name[len] == '=')
- return name+len+1;
- }
- --- 18,24 ----
-
- if (!environ) return 0;
-
- ! for (var = environ; (name = *var) != 0; var++) {
- if (!strncmp(name, tag, len) && name[len] == '=')
- return name+len+1;
- }
- *** 1.8 1992/06/24 15:32:04
- --- getlogin.c 1992/10/09 20:46:21
- ***************
- *** 13,24 ****
- char *getlogin()
- {
- struct passwd *temp;
- ! char *tmplogname;
-
- if(logname != NULL)
- return logname;
-
- - tmplogname = (char *)alloca((size_t)80);
- *tmplogname = '\0';
-
- /* first try the /etc/passwd file */
- --- 13,23 ----
- char *getlogin()
- {
- struct passwd *temp;
- ! char tmplogname[80];
-
- if(logname != NULL)
- return logname;
-
- *tmplogname = '\0';
-
- /* first try the /etc/passwd file */
- *** 1.9 1992/06/01 01:54:10
- --- getopt.c 1992/10/09 20:46:21
- ***************
- *** 11,24 ****
- --- 11,28 ----
- provided by D A Gwyn of BRL for generic ANSI C implementations
- */
-
- + #include <compiler.h>
- #include <stddef.h>
- #include <stdio.h>
- #include <string.h>
- + #include <unistd.h>
-
- int opterr = 1; /* error => print message */
- int optind = 1; /* next argv[] index */
- char *optarg = NULL; /* option parameter if any */
-
- + static int Err __PROTO((char *, char *, int));
- +
- static int
- Err( name, mess, c ) /* returns '?' */
- char *name; /* program name argv[0] */
- ***************
- *** 37,43 ****
- int
- getopt( argc, argv, optstring ) /* returns letter, '?', EOF */
- int argc; /* argument count from main */
- ! const char *argv[]; /* argument vector from main */
- const char *optstring; /* allowed args, e.g. "ab:c" */
- {
- static int sp = 1; /* position within argument */
- --- 41,47 ----
- int
- getopt( argc, argv, optstring ) /* returns letter, '?', EOF */
- int argc; /* argument count from main */
- ! char * const *argv; /* argument vector from main */
- const char *optstring; /* allowed args, e.g. "ab:c" */
- {
- static int sp = 1; /* position within argument */
- *** 1.1 1991/12/26 15:53:59
- --- getpass.c 1992/10/09 20:46:21
- ***************
- *** 18,24 ****
- stty(0, &newsb);
- fputs(prompt, stderr); fflush(stderr);
- buf[0] = buf[81] = 0;
- ! if((ret = fgets(buf, 80, stdin)))
- {
- /* null terminate string */
- buf[strlen(buf) - 1] = 0;
- --- 18,24 ----
- stty(0, &newsb);
- fputs(prompt, stderr); fflush(stderr);
- buf[0] = buf[81] = 0;
- ! if((ret = fgets(buf, 80, stdin)) != 0)
- {
- /* null terminate string */
- buf[strlen(buf) - 1] = 0;
- *** 1.5 1992/06/01 01:54:10
- --- getpid.c 1992/10/09 20:46:22
- ***************
- *** 5,9 ****
-
- extern int __mint;
-
- ! int getpid() { return __mint ? Pgetpid() : ( ((long)_base) >> 8 ); }
- ! int getppid() { return __mint ? Pgetppid() : (((long)(_base->p_parent)) >> 8); }
- --- 5,9 ----
-
- extern int __mint;
-
- ! int getpid() { return __mint ? Pgetpid() : (int) ( ((long)_base) >> 8 ); }
- ! int getppid() { return __mint ? Pgetppid() : (int) (((long)(_base->p_parent)) >> 8); }
- *** 1.10 1992/06/01 01:54:10
- --- getpw.c 1992/10/09 20:46:22
- ***************
- *** 130,136 ****
- return (0);
- }
-
- ! while (fgets (savbuf, sizeof(savbuf), fp) != NULL)
- {
- for (cp = savbuf; *cp && *cp != ':'; cp++)
- ;
- --- 130,136 ----
- return (0);
- }
-
- ! while (fgets (savbuf, (int)sizeof(savbuf), fp) != NULL)
- {
- for (cp = savbuf; *cp && *cp != ':'; cp++)
- ;
- *** 1.8 1992/06/24 15:32:04
- --- getuid.c 1992/10/09 20:46:22
- ***************
- *** 1,4 ****
- --- 1,8 ----
- + #ifdef __TURBOC__
- + #include <sys\types.h>
- + #else
- #include <sys/types.h>
- + #endif
- #include <unistd.h>
- #include <osbind.h>
- #include <mintbind.h>
- ***************
- *** 11,19 ****
- uid_t getuid() { return __mint ? Pgetuid() : __uid; }
- gid_t getgid() { return __mint ? Pgetgid() : __gid; }
-
- ! uid_t geteuid() { return getuid(); }
- ! gid_t getegid() { return getgid(); }
-
- int setuid(x)
- int x;
- {
- --- 15,26 ----
- uid_t getuid() { return __mint ? Pgetuid() : __uid; }
- gid_t getgid() { return __mint ? Pgetgid() : __gid; }
-
- ! uid_t geteuid()
- ! { return __mint >= 95 ? Pgeteuid() : getuid(); }
-
- + gid_t getegid()
- + { return __mint >= 95 ? Pgetegid() : getgid(); }
- +
- int setuid(x)
- int x;
- {
- ***************
- *** 22,28 ****
- if (__mint) {
- r = Psetuid(x);
- if (r) {
- ! errno = -r;
- return -1;
- }
- return 0;
- --- 29,35 ----
- if (__mint) {
- r = Psetuid(x);
- if (r) {
- ! errno = (int) -r;
- return -1;
- }
- return 0;
- ***************
- *** 39,45 ****
- if (__mint) {
- r = Psetgid(x);
- if (r) {
- ! errno = -r;
- return -1;
- }
- return 0;
- --- 46,52 ----
- if (__mint) {
- r = Psetgid(x);
- if (r) {
- ! errno = (int) -r;
- return -1;
- }
- return 0;
- *** 1.9 1992/06/01 01:54:10
- --- gmon.c 1992/10/09 20:46:22
- ***************
- *** 489,494 ****
- --- 489,509 ----
- return 0;
- }
-
- + #ifdef __MBASE__
- + #define Countdown __MBASESTR__ "@(_countdown)"
- + #define Off __MBASESTR__ "@(_off)"
- + #define Shift_val __MBASESTR__ "@(_shift_val)"
- + #define Maxidx __MBASESTR__ "@(_maxidx)"
- + #define Bufr __MBASESTR__ "@(_bufr)"
- + #define Tick_xbra __MBASESTR__ "@(_tick_xbra+8)"
- + #else
- + #define Countdown "_countdown"
- + #define Off "_off"
- + #define Shift_val "_shift_val"
- + #define Maxidx "_maxidx"
- + #define Bufr "_bufr"
- + #define Tick_xbra "_tick_xbra+8"
- + #endif
- #ifdef _USE_TIMER_C_
- /*
- * tick handler
- ***************
- *** 497,523 ****
- __asm__ ("\
- .text; .even
- _tick:
- ! subqw #1,_countdown
- jne 1f
-
- ! movw #4,_countdown
- moveml d0-d1/a0,sp@-
- movl sp@(14),d0 /* get user pc from exception frame */
- ! subl _off,d0
- jcs 2f /* branch if below */
- ! movl _shift_val,d1 /* shift it */
- lsrl d1,d0
- ! cmpl _maxidx:l,d0 /* compare with max index */
- jhi 2f /* branch if out of range */
-
- lsll #1,d0 /* word index */
- ! movl _bufr,a0
- addl d0,a0 /* incr hist word */
- addqw #1,a0@
- 2:
- moveml sp@+,d0-d1/a0
- 1:
- ! movl _tick_xbra+8,sp@-
- rts ");
- #else
- /*
- --- 512,538 ----
- __asm__ ("\
- .text; .even
- _tick:
- ! subqw #1," Countdown "
- jne 1f
-
- ! movw #4," Countdown "
- moveml d0-d1/a0,sp@-
- movl sp@(14),d0 /* get user pc from exception frame */
- ! subl " Off ",d0
- jcs 2f /* branch if below */
- ! movl " Shift_val ",d1 /* shift it */
- lsrl d1,d0
- ! cmpl " Maxidx ",d0 /* compare with max index */
- jhi 2f /* branch if out of range */
-
- lsll #1,d0 /* word index */
- ! movl " Bufr ",a0
- addl d0,a0 /* incr hist word */
- addqw #1,a0@
- 2:
- moveml sp@+,d0-d1/a0
- 1:
- ! movl " Tick_xbra ",sp@-
- rts ");
- #else
- /*
- ***************
- *** 535,553 ****
- .text; .even
- _tick:
- movl sp@(68),d0 /* get user pc from exception frame */
- ! subl _off,d0
- jcs 1f /* branch if below */
- ! movl _shift_val,d1 /* shift it */
- lsrl d1,d0
- ! cmpl _maxidx:l,d0 /* compare with max index */
- jhi 1f /* branch if out of range */
-
- lsll #1,d0 /* word index */
- ! movl _bufr,a0
- addl d0,a0 /* incr hist word */
- addqw #1,a0@
- 1:
- ! movl _tick_xbra+8,sp@- /* call next handler in chain */
- rts ");
- #endif
-
- --- 550,568 ----
- .text; .even
- _tick:
- movl sp@(68),d0 /* get user pc from exception frame */
- ! subl " Off ",d0
- jcs 1f /* branch if below */
- ! movl " Shift_val ",d1 /* shift it */
- lsrl d1,d0
- ! cmpl " Maxidx ",d0 /* compare with max index */
- jhi 1f /* branch if out of range */
-
- lsll #1,d0 /* word index */
- ! movl " Bufr ",a0
- addl d0,a0 /* incr hist word */
- addqw #1,a0@
- 1:
- ! movl " Tick_xbra ",sp@- /* call next handler in chain */
- rts ");
- #endif
-
- *** 1.12 1992/07/20 22:01:12
- --- gnulib2.c 1992/10/09 20:46:22
- ***************
- *** 209,215 ****
- /* These algorithms are all straight out of Knuth, vol. 2, sec. 4.3.1. */
-
- __EXTERN long long __adddi3 __PROTO((long long u, long long v));
- - static int badd __PROTO((unsigned short *a, unsigned short *b, unsigned short *c, size_t n));
- __EXTERN long long __anddi3 __PROTO((long long u, long long v));
- __EXTERN long long __iordi3 __PROTO((long long u, long long v));
- __EXTERN long long __xordi3 __PROTO((long long u, long long v));
- --- 209,214 ----
- ***************
- *** 219,235 ****
- __EXTERN long long __ashldi3 __PROTO((long long u, long int b1));
- __EXTERN long long __ashrdi3 __PROTO((long long u, long int b1));
- __EXTERN long long __subdi3 __PROTO((long long u, long long v));
- - static int bsub __PROTO((unsigned short *a, unsigned short *b, unsigned short *c, size_t n));
- __EXTERN long long __muldi3 __PROTO((long long u, long long v));
- - static void bmul __PROTO((unsigned short *a, unsigned short *b, unsigned short *c, size_t m, size_t n));
- __EXTERN long long __divdi3 __PROTO((long long u, long long v));
- __EXTERN long long __moddi3 __PROTO((long long u, long long v));
- __EXTERN long long __udivdi3 __PROTO((long long u, long long v));
- __EXTERN long long __umoddi3 __PROTO((long long u, long long v));
- __EXTERN long long __negdi2 __PROTO((long long u));
- - static int bneg __PROTO((unsigned short *a, unsigned short *b, size_t n));
- __EXTERN void __bdiv __PROTO((unsigned short *a, unsigned short *b, unsigned short *q, unsigned short *r, size_t m, size_t n));
- - static int bshift __PROTO((unsigned short *u, int k, unsigned short *w, unsigned int carry_in, int n));
- __EXTERN SItype __cmpdi2 __PROTO((long long a, long long b));
- __EXTERN SItype __ucmpdi2 __PROTO((long long a, long long b));
- __EXTERN long long __fixunsdfdi __PROTO((double a));
- --- 218,230 ----
- ***************
- *** 239,244 ****
- --- 234,241 ----
- __EXTERN unsigned SItype __fixunssfsi __PROTO((float a));
-
- #ifdef L_adddi3
- + static int badd __PROTO((unsigned short *a, unsigned short *b, unsigned short *c, size_t n));
- +
- long long
- __adddi3 (u, v)
- long long u, v;
- ***************
- *** 492,497 ****
- --- 489,497 ----
- #endif
-
- #ifdef L_subdi3
- +
- + static int bsub __PROTO((unsigned short *a, unsigned short *b, unsigned short *c, size_t n));
- +
- long long
- __subdi3 (u, v)
- long long u, v;
- ***************
- *** 538,543 ****
- --- 538,546 ----
- #endif
-
- #ifdef L_muldi3
- +
- + static void bmul __PROTO((unsigned short *a, unsigned short *b, unsigned short *c, size_t m, size_t n));
- +
- long long
- __muldi3 (u, v)
- long long u, v;
- ***************
- *** 683,688 ****
- --- 686,694 ----
- #endif
-
- #ifdef L_negdi2
- +
- + static int bneg __PROTO((unsigned short *a, unsigned short *b, size_t n));
- +
- long long
- __negdi2 (u)
- long long u;
- ***************
- *** 738,743 ****
- --- 744,751 ----
- but that is too long for SYSV. */
-
- #ifdef L_bdiv
- + static int bshift __PROTO((unsigned short *u, int k, unsigned short *w, unsigned int carry_in, int n));
- +
- void
- __bdiv (a, b, q, r, m, n)
- unsigned short *a, *b, *q, *r;
- *** 1.5 1992/06/01 01:54:10
- --- grp.c 1992/10/09 20:46:23
- ***************
- *** 91,97 ****
- if (!fp) setgrent();
- if (!fp) return 0;
-
- ! if (fgets (savbuf, sizeof(savbuf), fp) != NULL)
- {
- for (cp = savbuf; *cp && *cp != ':'; cp++)
- ;
- --- 91,97 ----
- if (!fp) setgrent();
- if (!fp) return 0;
-
- ! if (fgets (savbuf, (int) sizeof(savbuf), fp) != NULL)
- {
- for (cp = savbuf; *cp && *cp != ':'; cp++)
- ;
- *** 1.5 1992/03/06 19:19:47
- --- ldexp.cpp 1992/10/09 20:46:24
- ***************
- *** 1,4 ****
- !
- #if !defined (__M68881__) && !defined (sfp004)
-
- | add exponent to floating point number
- --- 1,34 ----
- ! .text
- ! .globl _ldexp
- ! .globl __infinitydf
- ! .even
- ! #ifdef ERROR_CHECK
- ! #include "errbase.h"
- ! _Overflow:
- ! .ascii "ldexp: OVERFLOW\12\15\0"
- ! # if defined(__M68881__) || defined(sfp004)
- ! _Domain:
- ! .ascii "ldexp: NAN\12\15\0"
- ! .even
- ! double_max:
- ! .long 0x7fee42d1
- ! .long 0x30273b76
- ! double_min:
- ! .long 0xffee42d1
- ! .long 0x30273b76
- ! NaN:
- ! .long 0x7fffffff
- ! .long 0xffffffff
- ! p_Inf:
- ! .long 0x7ff00000
- ! .long 0x00000000
- ! m_Inf:
- ! .long 0xfff00000
- ! .long 0x00000000
- ! # endif
- ! .even
- ! #endif ERROR_CHECK
- ! _ldexp:
- #if !defined (__M68881__) && !defined (sfp004)
-
- | add exponent to floating point number
- ***************
- *** 14,30 ****
- | #4 handle exponent overflow when ints are 32 bits -kub-, 04/90
- |-----------------------------------------------------------------------------
-
- - .text; .even
- - .globl _ldexp
- - .globl __infinitydf
- -
- - #ifdef ERROR_CHECK
- - _Overflow:
- - .ascii "ldexp: OVERFLOW\12\15\0"
- - .even
- - #endif ERROR_CHECK
- -
- - _ldexp:
- lea sp@(4),a1
- moveml d2-d7,sp@- | save d2-d7
-
- --- 44,49 ----
- ***************
- *** 56,65 ****
- moveml a1@,d4-d5 | value into d4,d5
- jmp norm_df | norm_df will pop d2-d7 and rts
-
- -
- - .globl _errno | from <errno.h>
- - ERANGE = 63
- -
- retz:
- moveq #0,d0 | zero return value
- moveq #0,d1
- --- 75,80 ----
- ***************
- *** 68,84 ****
- rangerr:
-
- #ifdef ERROR_CHECK
- ! # ifdef __MSHORT__
- ! movew #ERANGE,_errno | set errno
- ! # else
- ! movel #ERANGE,_errno | set errno
- ! # endif
- ! moveml d0-d1,a7@-
- ! pea _Overflow | for printf
- ! pea __iob+52 |
- jbsr _fprintf |
- addql #8,a7 |
- - moveml a7@+,d0-d1
- #endif ERROR_CHECK
-
- moveml __infinitydf,d0-d1 | return HUGE_VAL (same as in <math.h>)
- --- 83,94 ----
- rangerr:
-
- #ifdef ERROR_CHECK
- ! moveq #ERANGE,d0
- ! Emove d0,Errno
- ! pea pc@(_Overflow) | for printf
- ! pea Stderr |
- jbsr _fprintf |
- addql #8,a7 |
- #endif ERROR_CHECK
-
- moveml __infinitydf,d0-d1 | return HUGE_VAL (same as in <math.h>)
- ***************
- *** 104,139 ****
- |# hacked for the 68881 by Michael Ritzert, 5.10.90
- |##############################################################################
- |# ported fromt sfp004 to real coprocessor, mjr, August 1991
- ! |################################################################################
- !
- ! .text; .even
- ! .globl _ldexp
- !
- ! #ifdef ERROR_CHECK
- ! _Domain:
- ! .ascii "ldexp: NAN\12\15\0"
- ! _Overflow:
- ! .ascii "ldexp: OVERFLOW\12\15\0"
- ! .even
- ! double_max:
- ! .long 0x7fee42d1
- ! .long 0x30273b76
- ! double_min:
- ! .long 0xffee42d1
- ! .long 0x30273b76
- ! NaN:
- ! .long 0x7fffffff
- ! .long 0xffffffff
- ! p_Inf:
- ! .long 0x7ff00000
- ! .long 0x00000000
- ! m_Inf:
- ! .long 0xfff00000
- ! .long 0x00000000
- ! .even
- ! #endif ERROR_CHECK
- !
- ! _ldexp:
-
- #ifdef __MSHORT__
- movew a7@(12),d0 | get exponent
- --- 114,120 ----
- |# hacked for the 68881 by Michael Ritzert, 5.10.90
- |##############################################################################
- |# ported fromt sfp004 to real coprocessor, mjr, August 1991
- ! |##############################################################################
-
- #ifdef __MSHORT__
- movew a7@(12),d0 | get exponent
- ***************
- *** 180,214 ****
- | or
- | .long 0x0c6889000, 0x000067f8 (a0)
-
- - .text; .even
- - .globl _ldexp
- -
- - #ifdef ERROR_CHECK
- - _Domain:
- - .ascii "ldexp: NAN\12\15\0"
- - _Overflow:
- - .ascii "ldexp: OVERFLOW\12\15\0"
- - .even
- - double_max:
- - .long 0x7fee42d1
- - .long 0x30273b76
- - double_min:
- - .long 0xffee42d1
- - .long 0x30273b76
- - NaN:
- - .long 0x7fffffff
- - .long 0xffffffff
- - p_Inf:
- - .long 0x7ff00000
- - .long 0x00000000
- - m_Inf:
- - .long 0xfff00000
- - .long 0x00000000
- - .even
- - #endif ERROR_CHECK
- -
- - _ldexp:
- -
- #ifdef __MSHORT__
- movew sp@(12),d0 | get exponent
- extl d0
- --- 161,166 ----
- ***************
- *** 215,221 ****
- #else
- movel sp@(12),d0 | get exponent
- #endif
- ! lea 0xfffa50,a0 | fpu address
- movew #0x549e,a0@(comm) | fgetexpd sp@(4),fp1
- cmpiw #0x8900,a0@(resp)
- movel sp@(4),a0@
- --- 167,173 ----
- #else
- movel sp@(12),d0 | get exponent
- #endif
- ! lea 0xfffffa50:w,a0 | fpu address
- movew #0x549e,a0@(comm) | fgetexpd sp@(4),fp1
- cmpiw #0x8900,a0@(resp)
- movel sp@(4),a0@
- ***************
- *** 246,284 ****
- beq error_plus |
- swap d0 | result ok,
- rts | restore d0
- - # ifndef __MSHORT__
- - error_plus:
- - swap d0
- - movel #63,_errno | Overflow: errno = ERANGE
- - moveml d0-d1,a7@- | print error message
- - pea _Domain | for printf
- - bra error_exit |
- - error_nan:
- - moveml a0@(24),d0-d1 | result = +inf
- - movel #62,_errno | NAN => errno = EDOM
- - moveml d0-d1,a7@- | print error message
- - pea _Overflow | for printf
- - # else __MSHORT__
- error_plus:
- swap d0
- - movew #63,_errno | Overflow: errno = ERANGE
- moveml d0-d1,a7@- | print error message
- ! pea _Domain | for printf
- bra error_exit |
- error_nan:
- moveml a0@(24),d0-d1 | result = +inf
- - movew #62,_errno | NAN => errno = EDOM
- moveml d0-d1,a7@- | print error message
- ! pea _Overflow | for printf
- ! # endif __MSHORT__
- error_exit:
- ! pea __iob+52 |
- jbsr _fprintf |
- addql #8,a7 |
- moveml a7@+,d0-d1
- - rts
- - #else ERROR_CHECK
- - rts
- #endif ERROR_CHECK
-
- #endif /* !__M68881__ && !sfp004 */
- --- 198,222 ----
- beq error_plus |
- swap d0 | result ok,
- rts | restore d0
- error_plus:
- swap d0
- moveml d0-d1,a7@- | print error message
- ! moveq #ERANGE,d0 | Overflow: errno = ERANGE
- ! Emove d0,Errno
- ! pea pc@(_Domain) | for printf
- bra error_exit |
- error_nan:
- + moveq #EDOM,d0 | NAN => errno = EDOM
- + Emove d0,Errno
- moveml a0@(24),d0-d1 | result = +inf
- moveml d0-d1,a7@- | print error message
- ! pea pc@(_Overflow) | for printf
- error_exit:
- ! pea Stderr |
- jbsr _fprintf |
- addql #8,a7 |
- moveml a7@+,d0-d1
- #endif ERROR_CHECK
- + rts
-
- #endif /* !__M68881__ && !sfp004 */
- *** 1.7 1992/06/24 15:32:04
- --- lib.h 1992/10/09 20:46:24
- ***************
- *** 47,55 ****
- --- 47,61 ----
-
- __EXTERN int _doprnt __PROTO((FILE *, const char *, __VA_LIST__));
-
- + #ifdef __MINT__
- + __EXTERN int _scanf __PROTO((void *, int (*)(void *),
- + int (*)(int, void *), unsigned char *, __VA_LIST__));
- + #endif
- +
- __EXTERN long get_sysvar __PROTO((void *var));
- __EXTERN void set_sysvar_to_long __PROTO((void *var, long val));
-
- + __EXTERN void _setstack __PROTO((char *));
- __EXTERN __EXITING __exit __PROTO((long status));
-
- /* from the TOS GCC library */
- ***************
- *** 58,65 ****
- struct mem_chunk
- {
- long valid;
- ! #define VAL_FREE 0xf4ee0abc
- ! #define VAL_ALLOC 0xa11c0abc
-
- struct mem_chunk *next;
- unsigned long size;
- --- 64,71 ----
- struct mem_chunk
- {
- long valid;
- ! #define VAL_FREE 0xf4ee0abcL
- ! #define VAL_ALLOC 0xa11c0abcL
-
- struct mem_chunk *next;
- unsigned long size;
- ***************
- *** 67,72 ****
-
- /* linked list of free blocks */
-
- ! __EXTERN struct mem_chunk _mchunk_free_list;
-
- #endif /* _LIB_H */
- --- 73,78 ----
-
- /* linked list of free blocks */
-
- ! extern struct mem_chunk _mchunk_free_list;
-
- #endif /* _LIB_H */
- *** 1.4 1991/03/13 14:58:25
- --- linea.c 1992/10/09 20:46:24
- ***************
- *** 35,50 ****
-
- int linea2()
- {
- - short retvalue;
- __asm__ volatile
- ("
- ! .word 0xA002;
- ! movew d0,%0"
- ! : "=g"(retvalue) /* outputs */
- : /* inputs */
- : "d0", "d1", "d2", "a0", "a1", "a2" /* clobbered regs */
- );
- - return (int)retvalue;
- }
-
- void linea3()
- --- 35,47 ----
-
- int linea2()
- {
- __asm__ volatile
- ("
- ! .word 0xA002"
- ! : /* outputs */
- : /* inputs */
- : "d0", "d1", "d2", "a0", "a1", "a2" /* clobbered regs */
- );
- }
-
- void linea3()
- *** 1.14 1992/06/01 01:54:10
- --- localtim.c 1992/10/09 20:46:24
- ***************
- *** 9,14 ****
- --- 9,16 ----
- #include <compiler.h>
- #endif
-
- + struct tm *_gmtime __PROTO((const time_t *t, struct tm *stm));
- +
- #if 0
- static void
- DEBUG_TM(nm, tm)
- ***************
- *** 98,104 ****
-
- if (time < 0) /* negative times are bad */
- return 0;
- ! stm->tm_wday = ((time/SECS_PER_DAY) + 4) % 7;
-
- year = 70;
- for (;;) {
- --- 100,106 ----
-
- if (time < 0) /* negative times are bad */
- return 0;
- ! stm->tm_wday = (int) (((time/SECS_PER_DAY) + 4) % 7);
-
- year = 70;
- for (;;) {
- ***************
- *** 114,120 ****
- year++;
- }
- stm->tm_year = year;
- ! mday = stm->tm_yday = time/SECS_PER_DAY;
-
- days_per_mth[1] = (year % 4) ? 28 : 29;
- for (i = 0; mday >= days_per_mth[i]; i++)
- --- 116,122 ----
- year++;
- }
- stm->tm_year = year;
- ! mday = stm->tm_yday = (int)(time/SECS_PER_DAY);
-
- days_per_mth[1] = (year % 4) ? 28 : 29;
- for (i = 0; mday >= days_per_mth[i]; i++)
- ***************
- *** 123,132 ****
- stm->tm_mday = mday + 1;
-
- time = time % SECS_PER_DAY;
- ! stm->tm_hour = time/SECS_PER_HOUR;
- time = time % SECS_PER_HOUR;
- ! stm->tm_min = time/SECS_PER_MIN;
- ! stm->tm_sec = time % SECS_PER_MIN;
- stm->tm_isdst = 0;
-
- DEBUG_TM("gmtime", stm);
- --- 125,134 ----
- stm->tm_mday = mday + 1;
-
- time = time % SECS_PER_DAY;
- ! stm->tm_hour = (int) (time/SECS_PER_HOUR);
- time = time % SECS_PER_HOUR;
- ! stm->tm_min = (int) (time/SECS_PER_MIN);
- ! stm->tm_sec = (int) (time % SECS_PER_MIN);
- stm->tm_isdst = 0;
-
- DEBUG_TM("gmtime", stm);
- ***************
- *** 306,318 ****
- long s;
- const struct tm *t;
- {
- - int wkday;
- -
- - if (t->tm_wday >= 0)
- - wkday = t->tm_wday;
- - else
- - wkday = ((s / SECS_PER_DAY) + 4) % 7;
- -
- if (t->tm_mon == 3) { /* April */
- /* before 1987, see if there's another sunday in the month */
- if (t->tm_year < 87 && t->tm_wday + 30 - t->tm_mday < 7)
- --- 308,313 ----
- *** 1.9 1992/06/24 15:32:04
- --- lseek.c 1992/10/09 20:46:24
- ***************
- *** 1,3 ****
- --- 1,4 ----
- + #include <compiler.h>
- #include <stddef.h>
- #include <stdio.h>
- #include <errno.h>
- ***************
- *** 7,12 ****
- --- 8,15 ----
- #include <unistd.h>
- #include "lib.h"
-
- + static long _real_lseek __PROTO((int, long, int));
- +
- static long _real_lseek(h, where, how)
- int h;
- long where;
- ***************
- *** 31,37 ****
- long current_pos;
- long expected_pos;
- long new_pos;
- ! char *buf;
-
- if ( (mode == SEEK_END) || (offset <= 0) )
- /* do it the usual way */
- --- 34,40 ----
- long current_pos;
- long expected_pos;
- long new_pos;
- ! char buf[256];
-
- if ( (mode == SEEK_END) || (offset <= 0) )
- /* do it the usual way */
- ***************
- *** 52,58 ****
- new_pos = _real_lseek(handle, 0L, SEEK_END); /* go to eof */
- }
-
- - buf = (char *)alloca((size_t)256);
- bzero(buf, (size_t)256);
- while (expected_pos > new_pos)
- {
- --- 55,60 ----
- *** 1.7 1992/06/01 01:54:10
- --- ltoa.c 1992/10/09 20:46:24
- ***************
- *** 1,8 ****
- #include <string.h>
- #include "lib.h"
-
- #ifdef __STRICT_ANSI__
- ! # ifdef __GNUC__
- char * strrev(char *);
- # else
- extern char * strrev();
- --- 1,9 ----
- #include <string.h>
- #include "lib.h"
- + #include "lib.h"
-
- #ifdef __STRICT_ANSI__
- ! # ifdef __STDC__
- char * strrev(char *);
- # else
- extern char * strrev();
- *** 1.21 1992/06/01 01:54:10
- --- malloc.c 1992/10/09 20:46:24
- ***************
- *** 5,10 ****
- --- 5,11 ----
- /* 5/2/92 sb -- modified for Heat-n-Serve C to accomodate its 16-bit size_t */
- /* 5/5/92 sb -- split off realloc() & calloc() to reduce library drag */
-
- + #include <compiler.h>
- #include <stddef.h> /* for size_t */
- #include <stdlib.h>
- #include <memory.h>
- ***************
- *** 14,19 ****
- --- 15,21 ----
- #include "lib.h"
-
- extern long _stksize;
- + void *_malloc __PROTO((unsigned long));
-
- /* minimum chunk to ask OS for */
- static size_t MINHUNK = 4096L; /* default */
- ***************
- *** 32,38 ****
- static int _ZeroMallocs = 0;
-
- __EXTERN void _bzero __PROTO((void *, unsigned long));
- - __EXTERN void *_sbrk __PROTO((long));
-
- #ifdef __GNUC__
- asm(".stabs \"_malloc\",5,0,0,__malloc"); /* dept of clean tricks */
- --- 34,39 ----
- ***************
- *** 161,167 ****
- s = (struct mem_chunk * )(((long) p) + p->size);
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- ! s < (struct mem_chunk *) (_heapbase + _stksize)) {
- assert(s == (struct mem_chunk *) _heapbase);
- _heapbase = (void *) p;
- _stksize += p->size;
- --- 162,168 ----
- s = (struct mem_chunk * )(((long) p) + p->size);
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- ! s < (struct mem_chunk *) ((char *)_heapbase + _stksize)) {
- assert(s == (struct mem_chunk *) _heapbase);
- _heapbase = (void *) p;
- _stksize += p->size;
- ***************
- *** 173,179 ****
- s = (struct mem_chunk * )(((long) r) + r->size);
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- ! s < (struct mem_chunk *) (_heapbase + _stksize)) {
- assert(s == (struct mem_chunk *) _heapbase);
- _heapbase = (void *) r;
- _stksize += r->size;
- --- 174,180 ----
- s = (struct mem_chunk * )(((long) r) + r->size);
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- ! s < (struct mem_chunk *) ((char *)_heapbase + _stksize)) {
- assert(s == (struct mem_chunk *) _heapbase);
- _heapbase = (void *) r;
- _stksize += r->size;
- *** 1.1 1992/02/04 17:11:06
- --- modf.cpp 1992/10/09 20:46:25
- ***************
- *** 141,147 ****
- .even
- _modf:
- movel a1,a7@- | save a1 (necessary?)
- ! lea 0xfffa50,a0
- movew #0x5403,a0@(comm) | fintrz X -> fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(8),a0@ | load X_hi
- --- 141,147 ----
- .even
- _modf:
- movel a1,a7@- | save a1 (necessary?)
- ! lea 0xfffffa50:w,a0
- movew #0x5403,a0@(comm) | fintrz X -> fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(8),a0@ | load X_hi
- *** 1.1 1992/06/01 01:54:10
- --- obstack.c 1992/10/09 20:46:25
- ***************
- *** 15,22 ****
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- - #include <obstack.h>
- #include <compiler.h>
- #ifndef _SIZE_T
- #define _SIZE_T __SIZE_TYPEDEF__
- typedef _SIZE_T size_t;
- --- 15,23 ----
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- #include <compiler.h>
- + #include <obstack.h>
- + #include <stdlib.h>
- #ifndef _SIZE_T
- #define _SIZE_T __SIZE_TYPEDEF__
- typedef _SIZE_T size_t;
- ***************
- *** 64,70 ****
- struct obstack *h;
- size_t size;
- int alignment;
- ! POINTER (*chunkfun) ();
- void (*freefun) ();
- {
- register struct _obstack_chunk* chunk; /* points to new chunk */
- --- 65,71 ----
- struct obstack *h;
- size_t size;
- int alignment;
- ! POINTER (*chunkfun) __PROTO((size_t));
- void (*freefun) ();
- {
- register struct _obstack_chunk* chunk; /* points to new chunk */
- ***************
- *** 82,94 ****
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- ! int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
- ! h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
- h->freefun = freefun;
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
- --- 83,95 ----
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- ! size_t extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
- ! h->chunkfun = (struct _obstack_chunk * (*) __PROTO((size_t))) chunkfun;
- h->freefun = freefun;
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
- ***************
- *** 118,124 ****
- register size_t new_size;
- register size_t obj_size = h->next_free - h->object_base;
- register long i;
- ! int already;
-
- /* Compute size for new chunk. */
- new_size = (obj_size + length) + (obj_size >> 3) + 100;
- --- 119,125 ----
- register size_t new_size;
- register size_t obj_size = h->next_free - h->object_base;
- register long i;
- ! size_t already;
-
- /* Compute size for new chunk. */
- new_size = (obj_size + length) + (obj_size >> 3) + 100;
- *** 1.9 1992/06/01 01:54:10
- --- perror.c 1992/10/09 20:46:25
- ***************
- *** 16,22 ****
- fputs(msg, stderr);
- fputs(": ", stderr);
- }
- ! if(msg = strerror(errno))
- fputs(msg, stderr);
- fputs(".\n", stderr);
- }
- --- 16,22 ----
- fputs(msg, stderr);
- fputs(": ", stderr);
- }
- ! if((msg = strerror(errno)) != NULL)
- fputs(msg, stderr);
- fputs(".\n", stderr);
- }
- *** 1.1 1992/04/13 15:50:45
- --- putenv.c 1992/10/09 20:46:26
- ***************
- *** 27,33 ****
- len++;
-
- /* find the tag in the environment */
- ! for (var = environ; name = *var; var++) {
- if (!strncmp(name, strng, len) && name[len] == '=')
- break;
- }
- --- 27,33 ----
- len++;
-
- /* find the tag in the environment */
- ! for (var = environ; (name = *var) != NULL; var++) {
- if (!strncmp(name, strng, len) && name[len] == '=')
- break;
- }
- *** 1.13 1992/06/24 15:32:04
- --- qsort.c 1992/10/09 20:46:26
- ***************
- *** 226,232 ****
- max_stack_size++;
- }
- /* Create the stack, or die trying! */
- ! if (stack = MAKE_STACK (max_stack_size))
- top = stack;
- else
- return;
- --- 226,232 ----
- max_stack_size++;
- }
- /* Create the stack, or die trying! */
- ! if ((stack = MAKE_STACK (max_stack_size)) != NULL)
- top = stack;
- else
- return;
- *** 1.7 1992/06/01 01:54:10
- --- random.c 1992/10/09 20:46:26
- ***************
- *** 20,25 ****
- --- 20,26 ----
- #endif /* LIBC_SCCS and not lint */
-
- #include <stdio.h>
- + #include <unistd.h>
-
- /*
- * random.c:
- ***************
- *** 121,134 ****
- */
-
- static long randtbl[ DEG_3 + 1 ] = { TYPE_3,
- ! 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342,
- ! 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb,
- ! 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
- ! 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86,
- ! 0xda672e2a, 0x1588ca88, 0xe369735d, 0x904f35f7,
- ! 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
- ! 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b,
- ! 0xf5ad9d0e, 0x8999220b, 0x27fb47b9 };
-
- /*
- * fptr and rptr are two pointers into the state info, a front and a rear
- --- 122,135 ----
- */
-
- static long randtbl[ DEG_3 + 1 ] = { TYPE_3,
- ! 0x9a319039L, 0x32d9c024L, 0x9b663182L, 0x5da1f342L,
- ! 0xde3b81e0L, 0xdf0a6fb5L, 0xf103bc02L, 0x48f340fbL,
- ! 0x7449e56bL, 0xbeb1dbb0L, 0xab5c5918L, 0x946554fdL,
- ! 0x8c2e680fL, 0xeb3d799fL, 0xb11ee0b7L, 0x2d436b86L,
- ! 0xda672e2aL, 0x1588ca88L, 0xe369735dL, 0x904f35f7L,
- ! 0xd7158fd6L, 0x6fa6f051L, 0x616e6b96L, 0xac94efdcL,
- ! 0x36413f93L, 0xc622c298L, 0xf5a42ab8L, 0x8a88d77bL,
- ! 0xf5ad9d0eL, 0x8999220bL, 0x27fb47b9L };
-
- /*
- * fptr and rptr are two pointers into the state info, a front and a rear
- ***************
- *** 187,193 ****
-
- unsigned x;
- {
- ! register int i, j;
- long random();
-
- if( rand_type == TYPE_0 ) {
- --- 188,194 ----
-
- unsigned x;
- {
- ! register int i /* , j */ ;
- long random();
-
- if( rand_type == TYPE_0 ) {
- ***************
- *** 194,203 ****
- state[ 0 ] = x;
- }
- else {
- ! j = 1;
- state[ 0 ] = x;
- for( i = 1; i < rand_deg; i++ ) {
- ! state[i] = 1103515245*state[i - 1] + 12345;
- }
- fptr = &state[ rand_sep ];
- rptr = &state[ 0 ];
- --- 195,204 ----
- state[ 0 ] = x;
- }
- else {
- ! /* j = 1; */
- state[ 0 ] = x;
- for( i = 1; i < rand_deg; i++ ) {
- ! state[i] = 1103515245L*state[i - 1] + 12345;
- }
- fptr = &state[ rand_sep ];
- rptr = &state[ 0 ];
- ***************
- *** 297,304 ****
- char *arg_state;
- {
- register long *new_state = (long *)arg_state;
- ! register int type = new_state[0]%MAX_TYPES;
- ! register int rear = new_state[0]/MAX_TYPES;
- char *ostate = (char *)( &state[ -1 ] );
-
- if( rand_type == TYPE_0 ) state[ -1 ] = rand_type;
- --- 298,305 ----
- char *arg_state;
- {
- register long *new_state = (long *)arg_state;
- ! register int type = (int) (new_state[0]%MAX_TYPES);
- ! register int rear = (int) (new_state[0]/MAX_TYPES);
- char *ostate = (char *)( &state[ -1 ] );
-
- if( rand_type == TYPE_0 ) state[ -1 ] = rand_type;
- ***************
- *** 349,359 ****
- long i;
-
- if( rand_type == TYPE_0 ) {
- ! i = state[0] = ( state[0]*1103515245 + 12345 )&0x7fffffff;
- }
- else {
- *fptr += *rptr;
- ! i = (*fptr >> 1)&0x7fffffff; /* chucking least random bit */
- if( ++fptr >= end_ptr ) {
- fptr = state;
- ++rptr;
- --- 350,360 ----
- long i;
-
- if( rand_type == TYPE_0 ) {
- ! i = state[0] = ( state[0]*1103515245L + 12345 )&0x7fffffffL;
- }
- else {
- *fptr += *rptr;
- ! i = (*fptr >> 1)&0x7fffffffL; /* chucking least random bit */
- if( ++fptr >= end_ptr ) {
- fptr = state;
- ++rptr;
- *** 1.1 1992/06/01 01:54:10
- --- realloc.c 1992/10/09 20:46:26
- ***************
- *** 13,18 ****
- --- 13,19 ----
-
- __EXTERN void *_malloc __PROTO((unsigned long));
- __EXTERN void _bzero __PROTO((void *, unsigned long));
- + void *_realloc __PROTO((void *, unsigned long));
-
- #ifdef __GNUC__
- asm(".stabs \"_realloc\",5,0,0,__realloc"); /* dept of clean tricks */
- *** 1.3 1991/04/26 03:42:08
- --- regexp.c 1992/10/09 20:46:26
- ***************
- *** 32,37 ****
- --- 32,38 ----
- #include <string.h>
- #include <regexp.h>
- #include <stdio.h>
- + #include <types.h>
- #ifndef _COMPILER_H
- #include <compiler.h>
- #endif
- ***************
- *** 172,180 ****
- static void regoptail __PROTO((char *p, char *val));
- static int regtry __PROTO((regexp *prog, char *string));
- static int regmatch __PROTO((char *prog));
- ! static int regrepeat __PROTO((char *p));
- static char *regnext __PROTO((char *p));
- static char *regprop __PROTO((char *op));
-
- /*
- - regcomp - compile a regular expression into internal code
- --- 173,183 ----
- static void regoptail __PROTO((char *p, char *val));
- static int regtry __PROTO((regexp *prog, char *string));
- static int regmatch __PROTO((char *prog));
- ! static size_t regrepeat __PROTO((char *p));
- static char *regnext __PROTO((char *p));
- + #ifdef DEBUG
- static char *regprop __PROTO((char *op));
- + #endif
-
- /*
- - regcomp - compile a regular expression into internal code
- ***************
- *** 197,203 ****
- register regexp *r;
- register char *scan;
- register char *longest;
- ! register int len;
- int flags;
-
- if (exp == (char *)NULL) RFAIL("NULL argument");
- --- 200,206 ----
- register regexp *r;
- register char *scan;
- register char *longest;
- ! register size_t len;
- int flags;
-
- if (exp == (char *)NULL) RFAIL("NULL argument");
- ***************
- *** 501,507 ****
- *flagp |= HASWIDTH | SIMPLE;
- break;
- default:{
- ! register int len;
- register char ender;
-
- regparse--;
- --- 504,510 ----
- *flagp |= HASWIDTH | SIMPLE;
- break;
- default:{
- ! register size_t len;
- register char ender;
-
- regparse--;
- ***************
- *** 529,535 ****
- - regnode - emit a node
- */
- static char *regnode(op)
- ! char op;
- {
- register char *ret;
- register char *ptr;
- --- 532,538 ----
- - regnode - emit a node
- */
- static char *regnode(op)
- ! int op;
- {
- register char *ret;
- register char *ptr;
- ***************
- *** 552,558 ****
- - regc - emit (if appropriate) a byte of code
- */
- static void regc(b)
- ! char b;
- {
- if (regcode != ®dummy)
- *regcode++ = b;
- --- 555,561 ----
- - regc - emit (if appropriate) a byte of code
- */
- static void regc(b)
- ! int b;
- {
- if (regcode != ®dummy)
- *regcode++ = b;
- ***************
- *** 566,572 ****
- * Means relocating the operand.
- */
- static void reginsert(op, opnd)
- ! char op;
- char *opnd;
- {
- register char *src;
- --- 569,575 ----
- * Means relocating the operand.
- */
- static void reginsert(op, opnd)
- ! int op;
- char *opnd;
- {
- register char *src;
- ***************
- *** 597,603 ****
- {
- register char *scan;
- register char *temp;
- ! register int offset;
-
- if (p == ®dummy) return;
-
- --- 600,606 ----
- {
- register char *scan;
- register char *temp;
- ! register long offset;
-
- if (p == ®dummy) return;
-
- ***************
- *** 770,776 ****
- reginput++;
- break;
- case EXACTLY:{
- ! register int len;
- register char *opnd;
-
- opnd = OPERAND(scan);
- --- 773,779 ----
- reginput++;
- break;
- case EXACTLY:{
- ! register size_t len;
- register char *opnd;
-
- opnd = OPERAND(scan);
- ***************
- *** 868,876 ****
- case STAR:
- case PLUS:{
- register char nextch;
- ! register int no;
- register char *save;
- ! register int min;
-
- /* Lookahead to avoid useless match attempts
- * when we know what character comes next. */
- --- 871,879 ----
- case STAR:
- case PLUS:{
- register char nextch;
- ! register size_t no;
- register char *save;
- ! register size_t min;
-
- /* Lookahead to avoid useless match attempts
- * when we know what character comes next. */
- ***************
- *** 911,920 ****
- /*
- - regrepeat - repeatedly match something simple, report how many
- */
- ! static int regrepeat(p)
- char *p;
- {
- ! register int count = 0;
- register char *scan;
- register char *opnd;
-
- --- 914,923 ----
- /*
- - regrepeat - repeatedly match something simple, report how many
- */
- ! static size_t regrepeat(p)
- char *p;
- {
- ! register size_t count = 0;
- register char *scan;
- register char *opnd;
-
- *** 1.12 1992/06/01 01:54:10
- --- sbrk.c 1992/10/09 20:46:27
- ***************
- *** 29,34 ****
- --- 29,36 ----
- extern long _stksize;
- extern short _split_mem;
-
- + static void *HeapAlloc __PROTO((unsigned long sz));
- +
- static void * HeapAlloc( sz )
- unsigned long sz ;
- {
- ***************
- *** 49,57 ****
- return( sp );
- }
-
- ! #ifndef __GNUC__
- asm(".stabs \"_sbrk\",5,0,0,__sbrk"); /* dept of clean tricks */
- - asm(".stabs \"_lsbrk\",5,0,0,__sbrk"); /* dept of clean tricks */
- #endif
-
- /* provided for compilers with sizeof(int) == 2 */
- --- 51,58 ----
- return( sp );
- }
-
- ! #ifdef __GNUC__
- asm(".stabs \"_sbrk\",5,0,0,__sbrk"); /* dept of clean tricks */
- #endif
-
- /* provided for compilers with sizeof(int) == 2 */
- ***************
- *** 84,97 ****
-
- #ifndef __GNUC__
- void *sbrk(x)
- ! int x;
- {
- return _sbrk((long)x);
- - }
- -
- - void *lsbrk(x)
- - long x;
- - {
- - return _sbrk(x);
- }
- #endif
- --- 85,92 ----
-
- #ifndef __GNUC__
- void *sbrk(x)
- ! size_t x;
- {
- return _sbrk((long)x);
- }
- #endif
- *** 1.9 1992/06/01 01:54:10
- --- setbuf.c 1992/10/09 20:46:27
- ***************
- *** 14,20 ****
- free(fp->_base);
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF | _IOMYBUF);
- fp->_cnt = 0;
- ! if(fp->_base = (unsigned char *)buf) /* assignment intentional */
- {
- fp->_flag |= _IOFBF;
- /* this is intentionally not __DEFAULT_BUFSIZ__ ++jrb */
- --- 14,20 ----
- free(fp->_base);
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF | _IOMYBUF);
- fp->_cnt = 0;
- ! if((fp->_base = (unsigned char *)buf) != NULL)
- {
- fp->_flag |= _IOFBF;
- /* this is intentionally not __DEFAULT_BUFSIZ__ ++jrb */
- *** 1.4 1991/04/12 18:19:53
- --- setjmp.cpp 1992/10/09 20:46:27
- ***************
- *** 14,24 ****
- .globl _longjmp
- .globl ___mint
-
- _longjmp:
- #ifdef __MSHORT__
- ! tstw ___mint | see if MiNT is active
- #else
- ! tstl ___mint
- #endif
- beq NOMINT | no -- do not call sigreturn
- movew #0x11a, sp@- | Psigreturn() system call
- --- 14,30 ----
- .globl _longjmp
- .globl ___mint
-
- + #ifdef __MBASE__
- + #define Mint __MBASE__@(___mint)
- + #else
- + #define Mint ___mint
- + #endif
- +
- _longjmp:
- #ifdef __MSHORT__
- ! tstw Mint | see if MiNT is active
- #else
- ! tstl Mint
- #endif
- beq NOMINT | no -- do not call sigreturn
- movew #0x11a, sp@- | Psigreturn() system call
- *** 1.5 1990/02/27 21:25:04
- --- setvbuf.c 1992/10/09 20:46:27
- ***************
- *** 32,38 ****
- }
- else
- {
- ! if(fp->_base = (unsigned char *) malloc(size))
- {
- fp->_flag |= _IOMYBUF;
- }
- --- 32,38 ----
- }
- else
- {
- ! if ((fp->_base = (unsigned char *) malloc(size)) != NULL)
- {
- fp->_flag |= _IOMYBUF;
- }
- *** 1.8 1992/06/01 01:54:10
- --- sprintf.c 1992/10/09 20:46:28
- ***************
- *** 3,9 ****
- #include <limits.h>
- #include "lib.h"
-
- ! #ifdef __SOZOBON__ /* Electronic brain... */
- static FILE dummyf =
- {0L, (unsigned char *)0, (unsigned char *)0,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX, '\0'};
- --- 3,9 ----
- #include <limits.h>
- #include "lib.h"
-
- ! #ifndef __GNUC__
- static FILE dummyf =
- {0L, (unsigned char *)0, (unsigned char *)0,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX, '\0'};
- ***************
- *** 21,27 ****
- {
- register int n;
- va_list argp;
- ! #ifndef __SOZOBON__
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- --- 21,27 ----
- {
- register int n;
- va_list argp;
- ! #ifdef __GNUC__
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- ***************
- *** 44,50 ****
- va_list args;
- {
- register int n;
- ! #ifndef __SOZOBON__ /* Same again, please, landlord. */
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- --- 44,50 ----
- va_list args;
- {
- register int n;
- ! #ifdef __GNUC__
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- *** 1.4 1990/02/27 21:25:12
- --- strcat.c 1992/10/09 20:46:28
- ***************
- *** 15,21 ****
- register char *dscan;
- register const char *sscan;
-
- ! if ((sscan = src))
- {
- for (dscan = dst; *dscan != '\0'; dscan++)
- continue;
- --- 15,21 ----
- register char *dscan;
- register const char *sscan;
-
- ! if ((sscan = src) != NULL)
- {
- for (dscan = dst; *dscan != '\0'; dscan++)
- continue;
- *** 1.8 1992/06/01 01:54:10
- --- strchr.c 1992/10/09 20:46:28
- ***************
- *** 11,17 ****
- char *
- index(s, charwanted)
- const char *s;
- ! char charwanted;
- {
- return strchr(s, charwanted);
- }
- --- 11,17 ----
- char *
- index(s, charwanted)
- const char *s;
- ! int charwanted;
- {
- return strchr(s, charwanted);
- }
- ***************
- *** 20,26 ****
- char * /* found char, or NULL if none */
- strchr(s, charwanted)
- const char *s;
- ! register char charwanted;
- {
- register char c;
-
- --- 20,26 ----
- char * /* found char, or NULL if none */
- strchr(s, charwanted)
- const char *s;
- ! register int charwanted;
- {
- register char c;
-
- *** 1.6 1992/06/01 01:54:10
- --- strftime.c 1992/10/09 20:46:30
- ***************
- *** 37,56 ****
- const char *fmt;
- const struct tm *ts;
- {
- ! int num = 0;
- ! int len = 0, n;
- char q;
- char buf[BIG_LEN], *putstr, *s;
-
- for(;;) {
- if (num >= maxsize) return 0;
- ! if (!(q = *fmt++)) break;
- if (q != '%') {
- *str++ = q;
- num++;
- continue;
- }
- ! if (!(q = *fmt++)) break; /* get format command */
-
- /* assume that sprintf will be used, with a variable length */
- /* this is the most common case, so it saves us some coding to do it here */
- --- 37,57 ----
- const char *fmt;
- const struct tm *ts;
- {
- ! long num = 0;
- ! long len = 0;
- ! int n;
- char q;
- char buf[BIG_LEN], *putstr, *s;
-
- for(;;) {
- if (num >= maxsize) return 0;
- ! if ((q = *fmt++) == 0) break;
- if (q != '%') {
- *str++ = q;
- num++;
- continue;
- }
- ! if ((q = *fmt++) == 0) break; /* get format command */
-
- /* assume that sprintf will be used, with a variable length */
- /* this is the most common case, so it saves us some coding to do it here */
- *** 1.1 1992/08/14 14:48:29
- --- stricmp.c 1992/10/09 20:46:30
- ***************
- *** 11,17 ****
- --- 11,19 ----
- * but doesn't change anything
- */
-
- + #ifdef __GNUC__
- asm(".stabs \"_strcmpi\",5,0,0,_stricmp"); /* dept of clean tricks */
- + #endif
-
- int /* <0 for <, 0 for ==, >0 for > */
- stricmp(scan1, scan2)
- ***************
- *** 43,45 ****
- --- 45,57 ----
- else
- return(c1 - c2);
- }
- +
- + #ifndef __GNUC__
- + int
- + strcmpi(scan1, scan2)
- + register const char *scan1;
- + register const char *scan2;
- + {
- + return stricmp(scan1, scan2);
- + }
- + #endif
- *** 1.4 1990/02/27 21:25:23
- --- strncat.c 1992/10/09 20:46:30
- ***************
- *** 14,20 ****
- register const char *sscan;
- register long count;
-
- ! if((sscan = src) && (n > 0))
- {
- for (dscan = dst; *dscan != '\0'; dscan++)
- continue;
- --- 14,20 ----
- register const char *sscan;
- register long count;
-
- ! if(((sscan = src) != NULL) && (n > 0))
- {
- for (dscan = dst; *dscan != '\0'; dscan++)
- continue;
- *** 1.3 1990/02/27 21:25:26
- --- strncpy.c 1992/10/09 20:46:31
- ***************
- *** 17,23 ****
- register long count;
-
- dscan = dst;
- ! if (!(sscan = src))
- sscan = "";
- count = n;
- while (--count >= 0 && (*dscan++ = *sscan++) != '\0')
- --- 17,23 ----
- register long count;
-
- dscan = dst;
- ! if ((sscan = src) == NULL)
- sscan = "";
- count = n;
- while (--count >= 0 && (*dscan++ = *sscan++) != '\0')
- *** 1.1 1992/08/14 14:48:29
- --- strnicmp.c 1992/10/09 20:46:31
- ***************
- *** 11,17 ****
- --- 11,19 ----
- * but doesn't change anything
- */
-
- + #ifdef __GNUC__
- asm(".stabs \"_strncmpi\",5,0,0,_strnicmp"); /* dept of clean tricks */
- + #endif
-
- int /* <0 for <, 0 for ==, >0 for > */
- strnicmp(scan1, scan2, n)
- ***************
- *** 49,51 ****
- --- 51,64 ----
- else
- return(c1 - c2);
- }
- +
- + #ifndef __GNUC__
- + int
- + strncmpi(scan1, scan2, n)
- + register const char *scan1;
- + register const char *scan2;
- + size_t n;
- + {
- + return strnicmp(scan1, scan2, n);
- + }
- + #endif
- *** 1.8 1992/06/01 01:54:10
- --- strrchr.c 1992/10/09 20:46:31
- ***************
- *** 10,16 ****
- char *
- rindex(s, charwanted)
- const char *s;
- ! char charwanted;
- {
- return strrchr(s, charwanted);
- }
- --- 10,16 ----
- char *
- rindex(s, charwanted)
- const char *s;
- ! int charwanted;
- {
- return strrchr(s, charwanted);
- }
- ***************
- *** 19,31 ****
- char * /* found char, or NULL if none */
- strrchr(s, charwanted)
- const char *s;
- ! register char charwanted;
- {
- register char c;
- register const char *place;
-
- place = NULL;
- ! while (c = *s++)
- if (c == charwanted)
- place = s - 1;
- if (charwanted == '\0')
- --- 19,31 ----
- char * /* found char, or NULL if none */
- strrchr(s, charwanted)
- const char *s;
- ! register int charwanted;
- {
- register char c;
- register const char *place;
-
- place = NULL;
- ! while ((c = *s++) != 0)
- if (c == charwanted)
- place = s - 1;
- if (charwanted == '\0')
- *** 1.11 1991/07/23 22:06:28
- --- strtol.c 1992/10/09 20:46:32
- ***************
- *** 97,103 ****
- else
- result -= digit;
- }
- ! } while (c = *nptr++);
-
-
- if (!negative) {
- --- 97,103 ----
- else
- result -= digit;
- }
- ! } while ((c = *nptr++) != 0);
-
-
- if (!negative) {
- *** 1.6 1991/07/23 22:06:28
- --- strtoul.c 1992/10/09 20:46:32
- ***************
- *** 97,103 ****
- else
- result += digit;
- }
- ! } while (c = *nptr++);
-
- if (negative) /* ANSI says we should do this! */
- result = 0L - result;
- --- 97,103 ----
- else
- result += digit;
- }
- ! } while ((c = *nptr++) != 0);
-
- if (negative) /* ANSI says we should do this! */
- result = 0L - result;
- *** 1.18 1992/06/24 15:32:04
- --- system.c 1992/10/09 20:46:32
- ***************
- *** 24,30 ****
- #include "lib.h"
-
- #define isquote(c) ((c) == '\"' || (c) == '\'' || (c) == '`')
- ! #define ARG_ERR ( (Argentry *) -1 )
-
- /* struct. used to build a list of arguments for the command */
-
- --- 24,30 ----
- #include "lib.h"
-
- #define isquote(c) ((c) == '\"' || (c) == '\'' || (c) == '`')
- ! #define ARG_ERR ( (Argentry *) -1L )
-
- /* struct. used to build a list of arguments for the command */
-
- ***************
- *** 33,38 ****
- --- 33,41 ----
- char string[1];
- } Argentry;
-
- + static Argentry *_argalloc __PROTO((const char *s));
- + static void _argfree __PROTO((Argentry *p));
- + static Argentry *_parseargs __PROTO((const char *s));
-
- /* allocate an Argentry that will hold the string "s" */
-
- ***************
- *** 102,108 ****
- }
- *t = 0;
- cur->next = _argalloc(buf);
- ! if (!(cur = cur->next)) /* couldn't alloc() */
- return ARG_ERR;
- }
- cur->next = (Argentry *) 0;
- --- 105,111 ----
- }
- *t = 0;
- cur->next = _argalloc(buf);
- ! if ((cur = cur->next) == NULL) /* couldn't alloc() */
- return ARG_ERR;
- }
- cur->next = (Argentry *) 0;
- ***************
- *** 132,138 ****
- return 1;
- al = _parseargs(s); /* get a list of args */
- if (al == ARG_ERR) { /* not enough memory */
- ! return errno = ENOMEM;
- return -1;
- }
-
- --- 135,141 ----
- return 1;
- al = _parseargs(s); /* get a list of args */
- if (al == ARG_ERR) { /* not enough memory */
- ! errno = ENOMEM;
- return -1;
- }
-
- ***************
- *** 142,148 ****
- argc = i = 0;
- for (cur = al; cur; cur = cur->next)
- argc++;
- ! if (!(argv = (char **) malloc((size_t)(argc * sizeof(char *))))) {
- errno = ENOMEM; return -1;
- }
- for (cur = al; cur; cur = cur->next) {
- --- 145,153 ----
- argc = i = 0;
- for (cur = al; cur; cur = cur->next)
- argc++;
- ! if ((argv = (char **) malloc((size_t)(argc * sizeof(char *))))
- ! == NULL)
- ! {
- errno = ENOMEM; return -1;
- }
- for (cur = al; cur; cur = cur->next) {
- ***************
- *** 168,197 ****
-
- if (*infile) {
- (void)_unx2dos(infile,path);
- ! infd = Fopen(path, 0);
- if (infd < __SMALLEST_VALID_HANDLE) {
- perror(infile);
- return(2);
- }
- ! oldin = Fdup(0);
- (void)Fforce(0, infd);
- }
- if (*outfile) {
- (void)_unx2dos(outfile,path);
- if (append) {
- ! outfd = Fopen(path, 2);
- if (outfd < __SMALLEST_VALID_HANDLE)
- ! outfd = Fcreate(path, 0);
- else
- (void)Fseek(0L, outfd, 2);
- }
- else
- ! outfd = Fcreate(path, 0);
- if (outfd < __SMALLEST_VALID_HANDLE) {
- perror(outfile);
- return(2);
- }
- ! oldout = Fdup(1);
- (void)Fforce(1, outfd);
- }
-
- --- 173,202 ----
-
- if (*infile) {
- (void)_unx2dos(infile,path);
- ! infd = (int)Fopen(path, 0);
- if (infd < __SMALLEST_VALID_HANDLE) {
- perror(infile);
- return(2);
- }
- ! oldin = (int)Fdup(0);
- (void)Fforce(0, infd);
- }
- if (*outfile) {
- (void)_unx2dos(outfile,path);
- if (append) {
- ! outfd = (int)Fopen(path, 2);
- if (outfd < __SMALLEST_VALID_HANDLE)
- ! outfd = (int)Fcreate(path, 0);
- else
- (void)Fseek(0L, outfd, 2);
- }
- else
- ! outfd = (int)Fcreate(path, 0);
- if (outfd < __SMALLEST_VALID_HANDLE) {
- perror(outfile);
- return(2);
- }
- ! oldout = (int)Fdup(1);
- (void)Fforce(1, outfd);
- }
-
- *** 1.2 1992/03/06 19:19:47
- --- sysvar.c 1992/10/09 20:46:32
- ***************
- *** 13,19 ****
- statements and we get bombs
- */
- ret = *((volatile long *)var);
- ! (void)Super(save_ssp);
- return ret;
- }
-
- --- 13,19 ----
- statements and we get bombs
- */
- ret = *((volatile long *)var);
- ! (void)Super((void *) save_ssp);
- return ret;
- }
-
- ***************
- *** 26,30 ****
-
- save_ssp = Super(0L);
- *((volatile long *)var) = val;
- ! (void)Super(save_ssp);
- }
- --- 26,30 ----
-
- save_ssp = Super(0L);
- *((volatile long *)var) = val;
- ! (void)Super((void *) save_ssp);
- }
- *** 1.4 1992/03/22 21:57:30
- --- textio.c 1992/10/09 20:46:33
- ***************
- *** 33,39 ****
- *to++ = *from++;
- } while (--r);
- } while (buf == to); /* only '\r's? - try to read next nbytes */
- ! return (to - buf);
- }
-
- int
- --- 33,39 ----
- *to++ = *from++;
- } while (--r);
- } while (buf == to); /* only '\r's? - try to read next nbytes */
- ! return (int)(to - buf);
- }
-
- int
- *** 1.5 1992/06/01 01:54:10
- --- time.c 1992/10/09 20:46:33
- ***************
- *** 3,8 ****
- --- 3,9 ----
-
- #include <time.h>
- #include <osbind.h>
- + #include "lib.h"
-
- static struct tm this_tm;
- int _dst;
- *** 1.1 1991/12/26 15:53:59
- --- timeoday.c 1992/10/09 20:46:33
- ***************
- *** 4,10 ****
- --- 4,14 ----
- #include <types.h>
- #include <time.h>
- #include <unistd.h>
- + #ifdef __TURBOC__
- + #include <sys\timeb.h>
- + #else
- #include <sys/timeb.h>
- + #endif
-
- extern int _dst; /* in time.c */
- extern long _timezone; /* in localtim.c */
- *** 1.3 1992/06/01 01:54:10
- --- tmpfile.c 1992/10/09 20:46:33
- ***************
- *** 8,13 ****
- --- 8,15 ----
-
- extern int __mint;
-
- + static void delete_tmpfiles __PROTO((void));
- +
- typedef struct {
- char *name;
- FILE *fp;
- ***************
- *** 33,39 ****
- char *junknam;
- FILE *junkfil;
-
- ! if ( !(junknam = tmpnam(NULL)) || !(junkfil = fopen(junknam, "w+b")) )
- {
- if(junknam)
- free(junknam);
- --- 35,42 ----
- char *junknam;
- FILE *junkfil;
-
- ! if ( ((junknam = tmpnam(NULL)) == NULL) ||
- ! ((junkfil = fopen(junknam, "w+b")) == NULL ))
- {
- if(junknam)
- free(junknam);
- *** 1.8 1992/06/01 01:54:10
- --- tmpnam.c 1992/10/09 20:46:33
- ***************
- *** 19,26 ****
- size_t tlen;
- extern char *mktemp __PROTO((char *));
-
- ! if (!(tmpdir = getenv("TEMP")) && !(tmpdir = getenv("TMPDIR")) &&
- ! !(tmpdir = getenv("TMP")) && !(tmpdir = getenv("TEMPDIR")))
- tmpdir = ".";
-
- tlen = strlen(tmpdir);
- --- 19,26 ----
- size_t tlen;
- extern char *mktemp __PROTO((char *));
-
- ! if (((tmpdir = getenv("TEMP")) == NULL) && ((tmpdir = getenv("TMPDIR")) == NULL) &&
- ! ((tmpdir = getenv("TMP")) == NULL) && ((tmpdir = getenv("TEMPDIR")) == NULL))
- tmpdir = ".";
-
- tlen = strlen(tmpdir);
- *** 1.10 1992/06/24 15:32:04
- --- utime.c 1992/10/09 20:46:34
- ***************
- *** 10,24 ****
- * written by Eric R. Smith, and placed in the public domain.
- *
- */
- !
- #include <limits.h>
- - #include <sys/types.h>
- #include <time.h>
- #include <errno.h>
- #include <osbind.h>
- #include <assert.h>
- #include "lib.h"
-
- /* convert a Unix time into a DOS time. The longword returned contains
- the time word first, then the date word */
-
- --- 10,31 ----
- * written by Eric R. Smith, and placed in the public domain.
- *
- */
- !
- ! #include <compiler.h>
- #include <limits.h>
- #include <time.h>
- #include <errno.h>
- #include <osbind.h>
- #include <assert.h>
- + #ifdef __TURBOC__
- + #include <sys\types.h>
- + #else
- + #include <sys/types.h>
- + #endif
- #include "lib.h"
-
- + time_t dostime __PROTO((time_t t));
- +
- /* convert a Unix time into a DOS time. The longword returned contains
- the time word first, then the date word */
-
- ***************
- *** 28,34 ****
- time_t time, date;
- struct tm *ctm;
-
- ! if (!(ctm = localtime(&t)))
- return 0;
- time = (ctm->tm_hour << 11) | (ctm->tm_min << 5) | (ctm->tm_sec >> 1);
- date = ((ctm->tm_year - 80) & 0x7f) << 9;
- --- 35,41 ----
- time_t time, date;
- struct tm *ctm;
-
- ! if ((ctm = localtime(&t)) == NULL)
- return 0;
- time = (ctm->tm_hour << 11) | (ctm->tm_min << 5) | (ctm->tm_sec >> 1);
- date = ((ctm->tm_year - 80) & 0x7f) << 9;
- ***************
- *** 53,65 ****
-
- (void)_unx2dos(_filename, filename);
- dtime = dostime(settime); /* convert unix time to dos */
- ! fh = Fopen(filename, 2);
- if (fh < 0) {
- errno = -fh;
- return -1;
- }
- ! (void)Fdatime(&dtime, fh, 1);
- ! if (fh = Fclose(fh)) {
- errno = -fh;
- return -1;
- }
- --- 60,72 ----
-
- (void)_unx2dos(_filename, filename);
- dtime = dostime(settime); /* convert unix time to dos */
- ! fh = (int) Fopen(filename, 2);
- if (fh < 0) {
- errno = -fh;
- return -1;
- }
- ! (void)Fdatime((_DOSTIME *) &dtime, fh, 1);
- ! if ((fh = Fclose(fh)) != 0) {
- errno = -fh;
- return -1;
- }
- ***************
- *** 71,85 ****
- {
- unsigned long dtime;
- unsigned date, time;
- - int r;
-
- assert(t != 0);
- dtime = dostime(*t);
- ! date = (dtime & 0xffff);
- ! time = (dtime >> 16) & 0xffff;
-
- ! if ((r = Tsetdate(date)) || (r = Tsettime(time))) {
- ! errno = -r;
- return -1;
- }
- return 0;
- --- 78,91 ----
- {
- unsigned long dtime;
- unsigned date, time;
-
- assert(t != 0);
- dtime = dostime(*t);
- ! date = (int) (dtime & 0xffff);
- ! time = (int) (dtime >> 16) & 0xffff;
-
- ! if (Tsetdate(date) || Tsettime(time)) {
- ! errno = EBADARG;
- return -1;
- }
- return 0;
-