- Timestamp:
- 07/09/2017 04:45:34 PM (7 years ago)
- Branches:
- master
- Children:
- 8618599
- Parents:
- 0292fbb
- Location:
- iolib
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
iolib/dofmt.c
r0292fbb r7258c6a 27 27 28 28 #define MAXDIGS 11 29 #define HIBITL (1L << ( (8 * sizeof( long)) - 1))29 #define HIBITL (1L << ( (8 * sizeof(int32_t)) - 1)) 30 30 31 31 #define LONGHMSK 0x0FFFFFFFL … … 38 38 39 39 #if CRUFTY 40 extern long uldiv(long divid, longdivis);41 extern longuldivr;40 extern int32_t uldiv(int32_t divid, int32_t divis); 41 extern int32_t uldivr; 42 42 #endif 43 43 44 long dofmt_(int (*putsub)(), char*format, va_list args)44 int32_t dofmt_(int16_t (*putsub)(), int8_t *format, va_list args) 45 45 { 46 register int fcode;47 48 longk,46 register int16_t fcode; 47 48 int32_t k, 49 49 n, 50 50 lzero, 51 51 count; 52 52 53 int hradix,53 int16_t hradix, 54 54 lowbit, 55 55 length, … … 62 62 prec; 63 63 64 register char*bp, *p;65 66 char*prefix,64 register int8_t *bp, *p; 65 66 int8_t *prefix, 67 67 *tab, 68 68 buf[MAXDIGS]; 69 69 70 longval;70 int32_t val; 71 71 72 72 /* … … 83 83 ; 84 84 85 if (n = ( long)format - (long)bp) {85 if (n = (int32_t)format - (int32_t)bp) { 86 86 87 87 count += n; … … 126 126 if (fcode EQ '*') { 127 127 128 width = va_arg(args, int );128 width = va_arg(args, int16_t); 129 129 130 130 if (width < 0) { … … 149 149 else if (*++format EQ '*') { 150 150 151 prec = va_arg(args, int );151 prec = va_arg(args, int16_t); 152 152 format++; 153 153 } else … … 193 193 194 194 if (length) 195 val = va_arg(args, long);195 val = va_arg(args, int32_t); 196 196 else if (fcode EQ 'd') 197 val = va_arg(args, int );197 val = va_arg(args, int16_t); 198 198 else 199 val = va_arg(args, u nsigned);199 val = va_arg(args, uint16_t); 200 200 201 201 if (fcode EQ 'd') { … … 265 265 } 266 266 267 lzero = ( long)bp - (long)p + (long)prec;267 lzero = (int32_t)bp - (int32_t)p + (int32_t)prec; 268 268 269 269 if (fsharp AND bp NE p) … … 291 291 292 292 case 'c': 293 buf[0] = va_arg(args, int );293 buf[0] = va_arg(args, int16_t); 294 294 295 295 c_merge: … … 299 299 300 300 case 's': 301 p = bp = va_arg(args, char*);301 p = bp = va_arg(args, int8_t *); 302 302 303 303 if (prec < 0) … … 322 322 lzero = 0; 323 323 324 k = (n = ( long)p - (long)bp) + (long)(lzero +324 k = (n = (int32_t)p - (int32_t)bp) + (int32_t)(lzero + 325 325 (prefix[0] EQ '\0' ? 0 : (prefix[1] EQ '\0' ? 1 : 2))); 326 326 -
iolib/mdump.c
r0292fbb r7258c6a 39 39 */ 40 40 41 static void pipc( char chars[], int length)41 static void pipc(int8_t chars[], int16_t length) 42 42 { 43 int i;43 int16_t i; 44 44 45 45 for (i = 0; i < length; i++) … … 60 60 */ 61 61 62 void mdump( char *begin, char *end, longstart)62 void mdump(int8_t *begin, int8_t *end, int32_t start) 63 63 { 64 longi, ii;65 int j, jj, k;66 charc, chars[PERLINE];64 int32_t i, ii; 65 int16_t j, jj, k; 66 int8_t c, chars[PERLINE]; 67 67 68 68 i = 0L; -
iolib/pause.c
r0292fbb r7258c6a 8 8 #include "biosdefs.h" 9 9 10 extern int waitcr(void);11 extern void writeln(int unit, char*buf);10 extern int16_t waitcr(void); 11 extern void writeln(int16_t unit, int8_t *buf); 12 12 13 void pause( char*s)13 void pause(int8_t *s) 14 14 { 15 15 writeln(CON_DEV, s); -
iolib/printf.c
r0292fbb r7258c6a 17 17 #include "stdarg.h" 18 18 19 extern long dofmt_(int (*putsub)(), char*format, va_list args);19 extern int32_t dofmt_(int16_t (*putsub)(), int8_t *format, va_list args); 20 20 21 static int fpsub(int c);21 static int16_t fpsub(int16_t c); 22 22 23 23 /* … … 27 27 */ 28 28 29 long printf(char*fmt, ...)29 int32_t printf(int8_t *fmt, ...) 30 30 { 31 register longcount;31 register int32_t count; 32 32 va_list aptr; 33 33 … … 44 44 */ 45 45 46 static int fpsub(int c)46 static int16_t fpsub(int16_t c) 47 47 { 48 48 /* KLUDGE: since we aren't Unix(tm) we prepend a CR to LF's */ -
iolib/rawio.c
r0292fbb r7258c6a 69 69 70 70 71 int readln(int unit, int nc, char *ctl, int nb, char*buf)72 { 73 register char*cp;74 register int i, j;75 register char*bp;76 register charc;71 int16_t readln(int16_t unit, int16_t nc, int8_t *ctl, int16_t nb, int8_t *buf) 72 { 73 register int8_t *cp; 74 register int16_t i, j; 75 register int8_t *bp; 76 register int8_t c; 77 77 78 78 … … 93 93 for (j = 0; j < nc; j++) /* scan each byte of ctl */ 94 94 if (*ctl++ EQ c ) /* done if we find it */ 95 return((int )c);95 return((int16_t)c); 96 96 97 97 BIOS(B_PUTC, unit, c); /* echo the character */ … … 104 104 */ 105 105 106 int getln(int unit, int nb, char*buf)107 { 108 register char*bp;109 register charc;110 register int bc;106 int16_t getln(int16_t unit, int16_t nb, int8_t *buf) 107 { 108 register int8_t *bp; 109 register int8_t c; 110 register int16_t bc; 111 111 112 112 bc = 0; /* number of characters currently in buffer */ … … 144 144 *bp++ = c; /* put character in buffer */ 145 145 *bp = '\0'; /* terminate line with null */ 146 return((int )c); /* return -- CR or LF hit */146 return((int16_t)c); /* return -- CR or LF hit */ 147 147 148 148 /* … … 152 152 153 153 *buf = '\0'; /* clear the buffer */ 154 return((int )c); /* return -- line cancelled */154 return((int16_t)c); /* return -- line cancelled */ 155 155 156 156 default: … … 169 169 */ 170 170 171 int getrln(int unit, int nb, char*buf)172 { 173 register char*bp;174 register charc;175 register int bc;171 int16_t getrln(int16_t unit, int16_t nb, int8_t *buf) 172 { 173 register int8_t *bp; 174 register int8_t c; 175 register int16_t bc; 176 176 177 177 bc = 0; /* number of characters currently in buffer */ … … 191 191 *bp++ = c; /* put character in buffer */ 192 192 *bp = '\0'; /* terminate line with null */ 193 return((int )c); /* return -- CR, LF, or ^Z hit */193 return((int16_t)c); /* return -- CR, LF, or ^Z hit */ 194 194 195 195 case CTL('X'): 196 196 197 197 *buf = '\0'; /* clear the buffer */ 198 return((int )c); /* return -- line cancelled */198 return((int16_t)c); /* return -- line cancelled */ 199 199 200 200 default: … … 212 212 */ 213 213 214 void writeln(int unit, char*buf)215 { 216 register char*bp;217 register charc;214 void writeln(int16_t unit, int8_t *buf) 215 { 216 register int8_t *bp; 217 register int8_t c; 218 218 219 219 bp = buf; /* setup buffer pointer */ -
iolib/sprintf.c
r0292fbb r7258c6a 8 8 #include "stdarg.h" 9 9 10 extern long dofmt_(int (*putsub)(), char*format, va_list args);10 extern int32_t dofmt_(int16_t (*putsub)(), int8_t *format, va_list args); 11 11 12 static char*buff;13 static int spsub(charc);12 static int8_t *buff; 13 static int16_t spsub(int8_t c); 14 14 15 15 /* … … 19 19 */ 20 20 21 long sprintf(char *str, char*fmt, ...)21 int32_t sprintf(int8_t *str, int8_t *fmt, ...) 22 22 { 23 register longcount;23 register int32_t count; 24 24 va_list aptr; 25 25 … … 38 38 */ 39 39 40 static int spsub(charc)40 static int16_t spsub(int8_t c) 41 41 { 42 42 return((*buff++ = c) & 0xFF); -
iolib/waitcr.c
r0292fbb r7258c6a 21 21 */ 22 22 23 int waitcr(void)23 int16_t waitcr(void) 24 24 { 25 int c;25 int16_t c; 26 26 27 27 BIOS(B_PUTC, CON_DEV, '\007'); /* wake up the operator */ … … 29 29 /* await a CR, in which case we just exit */ 30 30 31 while ('\r' NE (c = (0x007F & (int )BIOS(B_GETC, CON_DEV))))31 while ('\r' NE (c = (0x007F & (int16_t)BIOS(B_GETC, CON_DEV)))) 32 32 if (c EQ '\007') /* ... or a control-G */ 33 33 xtrap15(); /* ... in which case we trap first */
Note:
See TracChangeset
for help on using the changeset viewer.