db_output.c (0edf66eca446dc74078eeb1f019becce246e468b) | db_output.c (381fe1aaf4d3cb1ad62f758c15ace6cb07eea97a) |
---|---|
1/* 2 * Mach Operating System 3 * Copyright (c) 1991,1990 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the --- 9 unchanged lines hidden (view full) --- 18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 19 * School of Computer Science 20 * Carnegie Mellon University 21 * Pittsburgh PA 15213-3890 22 * 23 * any improvements or extensions that they make and grant Carnegie the 24 * rights to redistribute these changes. 25 * | 1/* 2 * Mach Operating System 3 * Copyright (c) 1991,1990 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the --- 9 unchanged lines hidden (view full) --- 18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 19 * School of Computer Science 20 * Carnegie Mellon University 21 * Pittsburgh PA 15213-3890 22 * 23 * any improvements or extensions that they make and grant Carnegie the 24 * rights to redistribute these changes. 25 * |
26 * $Id$ | 26 * $Id: db_output.c,v 1.4 1993/10/16 16:47:20 rgrimes Exp $ |
27 */ 28 29/* 30 * Author: David B. Golub, Carnegie Mellon University 31 * Date: 7/90 32 */ 33 34/* 35 * Printf and character output for debugger. 36 */ 37 38#include "param.h" 39#include "systm.h" 40#include <machine/stdarg.h> | 27 */ 28 29/* 30 * Author: David B. Golub, Carnegie Mellon University 31 * Date: 7/90 32 */ 33 34/* 35 * Printf and character output for debugger. 36 */ 37 38#include "param.h" 39#include "systm.h" 40#include <machine/stdarg.h> |
41#include "ddb/ddb.h" |
|
41 42/* 43 * Character output - tracks position in line. 44 * To do this correctly, we should know how wide 45 * the output device is - then we could zero 46 * the line position when the output device wraps 47 * around to the start of the next line. 48 * --- 4 unchanged lines hidden (view full) --- 53 */ 54int db_output_position = 0; /* output column */ 55int db_last_non_space = 0; /* last non-space character */ 56int db_tab_stop_width = 8; /* how wide are tab stops? */ 57#define NEXT_TAB(i) \ 58 ((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width) 59int db_max_width = 80; /* output line width */ 60 | 42 43/* 44 * Character output - tracks position in line. 45 * To do this correctly, we should know how wide 46 * the output device is - then we could zero 47 * the line position when the output device wraps 48 * around to the start of the next line. 49 * --- 4 unchanged lines hidden (view full) --- 54 */ 55int db_output_position = 0; /* output column */ 56int db_last_non_space = 0; /* last non-space character */ 57int db_tab_stop_width = 8; /* how wide are tab stops? */ 58#define NEXT_TAB(i) \ 59 ((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width) 60int db_max_width = 80; /* output line width */ 61 |
61extern void db_check_interrupt(); | |
62 | 62 |
63static void db_printf_guts(const char *, va_list); 64 |
|
63/* 64 * Force pending whitespace. 65 */ 66void 67db_force_whitespace() 68{ 69 register int last_print, next_tab; 70 --- 12 unchanged lines hidden (view full) --- 83 } 84 } 85 db_last_non_space = db_output_position; 86} 87 88/* 89 * Output character. Buffer whitespace. 90 */ | 65/* 66 * Force pending whitespace. 67 */ 68void 69db_force_whitespace() 70{ 71 register int last_print, next_tab; 72 --- 12 unchanged lines hidden (view full) --- 85 } 86 } 87 db_last_non_space = db_output_position; 88} 89 90/* 91 * Output character. Buffer whitespace. 92 */ |
93void |
|
91db_putchar(c) 92 int c; /* character to output */ 93{ 94 if (c > ' ' && c <= '~') { 95 /* 96 * Printing character. 97 * If we have spaces to print, print them first. 98 * Use tabs if possible. --- 32 unchanged lines hidden (view full) --- 131db_print_position() 132{ 133 return (db_output_position); 134} 135 136/* 137 * Printing 138 */ | 94db_putchar(c) 95 int c; /* character to output */ 96{ 97 if (c > ' ' && c <= '~') { 98 /* 99 * Printing character. 100 * If we have spaces to print, print them first. 101 * Use tabs if possible. --- 32 unchanged lines hidden (view full) --- 134db_print_position() 135{ 136 return (db_output_position); 137} 138 139/* 140 * Printing 141 */ |
139extern int db_radix; 140 141/*VARARGS1*/ 142db_printf(char *fmt, ...) | 142void 143db_printf(const char *fmt, ...) |
143{ 144 va_list listp; 145 va_start(listp, fmt); 146 db_printf_guts (fmt, listp); 147 va_end(listp); 148} 149 150/* alternate name */ 151 152/*VARARGS1*/ | 144{ 145 va_list listp; 146 va_start(listp, fmt); 147 db_printf_guts (fmt, listp); 148 va_end(listp); 149} 150 151/* alternate name */ 152 153/*VARARGS1*/ |
154void |
|
153kdbprintf(char *fmt, ...) 154{ 155 va_list listp; 156 va_start(listp, fmt); 157 db_printf_guts (fmt, listp); 158 va_end(listp); 159} 160 --- 24 unchanged lines hidden (view full) --- 185 do { 186 *++p = "0123456789abcdef"[ul % base]; 187 } while (ul /= base); 188 if (lenp) 189 *lenp = p - buf; 190 return (p); 191} 192 | 155kdbprintf(char *fmt, ...) 156{ 157 va_list listp; 158 va_start(listp, fmt); 159 db_printf_guts (fmt, listp); 160 va_end(listp); 161} 162 --- 24 unchanged lines hidden (view full) --- 187 do { 188 *++p = "0123456789abcdef"[ul % base]; 189 } while (ul /= base); 190 if (lenp) 191 *lenp = p - buf; 192 return (p); 193} 194 |
195static void |
|
193db_printf_guts(fmt, ap) 194 register const char *fmt; 195 va_list ap; 196{ 197 register char *p; 198 register int ch, n; 199 u_long ul; 200 int base, lflag, tmp, width; --- 166 unchanged lines hidden --- | 196db_printf_guts(fmt, ap) 197 register const char *fmt; 198 va_list ap; 199{ 200 register char *p; 201 register int ch, n; 202 u_long ul; 203 int base, lflag, tmp, width; --- 166 unchanged lines hidden --- |