--- Gnu-Mach/ddb/db_lex.c 2020/09/02 04:36:57 1.1.1.1 +++ Gnu-Mach/ddb/db_lex.c 2020/09/02 04:48:19 1.1.1.4 @@ -1,25 +1,25 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -27,15 +27,19 @@ * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 */ -#include "mach_kdb.h" + #if MACH_KDB /* * Lexical analyzer. */ +#include #include -#include +#include +#include +#include #include +#include char db_line[DB_LEX_LINE_SIZE]; char db_last_line[DB_LEX_LINE_SIZE]; @@ -46,7 +50,7 @@ db_expr_t db_look_token = 0; int db_read_line(repeat_last) - char *repeat_last; + const char *repeat_last; { int i; @@ -70,7 +74,7 @@ db_read_line(repeat_last) } void -db_flush_line() +db_flush_line(void) { db_lp = db_line; db_last_lp = db_lp; @@ -78,9 +82,9 @@ db_flush_line() } void -db_switch_input(buffer, size) - char *buffer; - int size; +db_switch_input( + char *buffer, + int size) { db_lp = buffer; db_last_lp = db_lp; @@ -90,8 +94,7 @@ db_switch_input(buffer, size) } void -db_save_lex_context(lp) - register struct db_lex_context *lp; +db_save_lex_context(struct db_lex_context *lp) { lp->l_ptr = db_lp; lp->l_eptr = db_endlp; @@ -101,7 +104,7 @@ db_save_lex_context(lp) void db_restore_lex_context(lp) - register struct db_lex_context *lp; + const struct db_lex_context *lp; { db_lp = lp->l_ptr; db_last_lp = db_lp; @@ -111,7 +114,7 @@ db_restore_lex_context(lp) } int -db_read_char() +db_read_char(void) { int c; @@ -121,27 +124,25 @@ db_read_char() } else if (db_lp >= db_endlp) c = -1; - else + else c = *db_lp++; return (c); } void -db_unread_char(c) - int c; +db_unread_char(int c) { db_look_char = c; } void -db_unread_token(t) - int t; +db_unread_token(int t) { db_look_token = t; } int -db_read_token() +db_read_token(void) { int t; @@ -163,7 +164,7 @@ char db_tok_string[TOK_STRING_SIZE]; db_expr_t db_radix = 16; void -db_flush_lex() +db_flush_lex(void) { db_flush_line(); db_look_char = 0; @@ -173,12 +174,12 @@ db_flush_lex() #define DB_DISP_SKIP 40 /* number of chars to display skip */ void -db_skip_to_eol() +db_skip_to_eol(void) { - register skip; - register t; - register n; - register char *p; + int skip; + int t; + int n; + char *p; t = db_read_token(); p = db_last_lp; @@ -199,10 +200,10 @@ db_skip_to_eol() } int -db_lex() +db_lex(void) { - register char *cp; - register c; + char *cp; + int c; c = db_read_char(); while (c <= ' ' || c > '~') { @@ -260,7 +261,7 @@ db_lex() (c >= 'a' && c <= 'z') || (c == '_')) { - db_printf("Bad character '%c' after number %s\n", + db_printf("Bad character '%c' after number %s\n", c, db_tok_string); db_error(0); db_flush_lex(); @@ -452,4 +453,4 @@ db_lex() return (tEOF); } -#endif MACH_KDB +#endif /* MACH_KDB */