| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_lex.c,v 1.25 2019/11/22 23:01:49 ad Exp $ */ | | 1 | /* $NetBSD: db_lex.c,v 1.26 2020/07/29 23:29:42 uwe Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Mach Operating System | | 4 | * Mach Operating System |
5 | * Copyright (c) 1991,1990 Carnegie Mellon University | | 5 | * Copyright (c) 1991,1990 Carnegie Mellon University |
6 | * All Rights Reserved. | | 6 | * All Rights Reserved. |
7 | * | | 7 | * |
8 | * Permission to use, copy, modify and distribute this software and its | | 8 | * Permission to use, copy, modify and distribute this software and its |
9 | * documentation is hereby granted, provided that both the copyright | | 9 | * documentation is hereby granted, provided that both the copyright |
10 | * notice and this permission notice appear in all copies of the | | 10 | * notice and this permission notice appear in all copies of the |
11 | * software, derivative works or modified versions, and any portions | | 11 | * software, derivative works or modified versions, and any portions |
12 | * thereof, and that both notices appear in supporting documentation. | | 12 | * thereof, and that both notices appear in supporting documentation. |
13 | * | | 13 | * |
14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | | 14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * | | 24 | * |
25 | * any improvements or extensions that they make and grant Carnegie the | | 25 | * any improvements or extensions that they make and grant Carnegie the |
26 | * rights to redistribute these changes. | | 26 | * rights to redistribute these changes. |
27 | * | | 27 | * |
28 | * Author: David B. Golub, Carnegie Mellon University | | 28 | * Author: David B. Golub, Carnegie Mellon University |
29 | * Date: 7/90 | | 29 | * Date: 7/90 |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Lexical analyzer. | | 33 | * Lexical analyzer. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.25 2019/11/22 23:01:49 ad Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.26 2020/07/29 23:29:42 uwe Exp $"); |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/cpu.h> | | 41 | #include <sys/cpu.h> |
42 | | | 42 | |
43 | #include <ddb/ddb.h> | | 43 | #include <ddb/ddb.h> |
44 | | | 44 | |
45 | db_expr_t db_tok_number; | | 45 | db_expr_t db_tok_number; |
46 | char db_tok_string[TOK_STRING_SIZE]; | | 46 | char db_tok_string[TOK_STRING_SIZE]; |
47 | | | 47 | |
48 | static char db_line[DB_LINE_MAXLEN]; | | 48 | static char db_line[DB_LINE_MAXLEN]; |
49 | static const char *db_lp; | | 49 | static const char *db_lp; |
50 | static const char *db_endlp; | | 50 | static const char *db_endlp; |
| @@ -79,26 +79,36 @@ db_read_line(void) | | | @@ -79,26 +79,36 @@ db_read_line(void) |
79 | return (0); /* EOI */ | | 79 | return (0); /* EOI */ |
80 | db_set_line(db_line, db_line + i); | | 80 | db_set_line(db_line, db_line + i); |
81 | return (i); | | 81 | return (i); |
82 | } | | 82 | } |
83 | | | 83 | |
84 | void | | 84 | void |
85 | db_set_line(const char *sp, const char *ep) | | 85 | db_set_line(const char *sp, const char *ep) |
86 | { | | 86 | { |
87 | | | 87 | |
88 | db_lp = sp; | | 88 | db_lp = sp; |
89 | db_endlp = ep; | | 89 | db_endlp = ep; |
90 | } | | 90 | } |
91 | | | 91 | |
| | | 92 | void |
| | | 93 | db_get_line(const char **psp, const char **pep) |
| | | 94 | { |
| | | 95 | |
| | | 96 | if (psp != NULL) |
| | | 97 | *psp = db_lp; |
| | | 98 | if (pep != NULL) |
| | | 99 | *pep = db_endlp; |
| | | 100 | } |
| | | 101 | |
92 | static void | | 102 | static void |
93 | db_flush_line(void) | | 103 | db_flush_line(void) |
94 | { | | 104 | { |
95 | | | 105 | |
96 | db_lp = db_line; | | 106 | db_lp = db_line; |
97 | db_endlp = db_line; | | 107 | db_endlp = db_line; |
98 | } | | 108 | } |
99 | | | 109 | |
100 | static int | | 110 | static int |
101 | db_read_char(void) | | 111 | db_read_char(void) |
102 | { | | 112 | { |
103 | int c; | | 113 | int c; |
104 | | | 114 | |