db_lex.c (623) | db_lex.c (798) |
---|---|
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_lex.c,v 1.2 1993/10/16 16:47:17 rgrimes Exp $ |
27 */ 28 29/* 30 * Author: David B. Golub, Carnegie Mellon University 31 * Date: 7/90 32 */ 33/* 34 * Lexical analyzer. 35 */ | 27 */ 28 29/* 30 * Author: David B. Golub, Carnegie Mellon University 31 * Date: 7/90 32 */ 33/* 34 * Lexical analyzer. 35 */ |
36#include "param.h" 37#include "systm.h" 38#include "ddb/ddb.h" |
|
36#include <ddb/db_lex.h> 37 38char db_line[120]; 39char * db_lp, *db_endlp; 40 41int 42db_read_line() 43{ --- 29 unchanged lines hidden (view full) --- 73 c = -1; 74 else 75 c = *db_lp++; 76 return (c); 77} 78 79void 80db_unread_char(c) | 39#include <ddb/db_lex.h> 40 41char db_line[120]; 42char * db_lp, *db_endlp; 43 44int 45db_read_line() 46{ --- 29 unchanged lines hidden (view full) --- 76 c = -1; 77 else 78 c = *db_lp++; 79 return (c); 80} 81 82void 83db_unread_char(c) |
84 int c; |
|
81{ 82 db_look_char = c; 83} 84 85int db_look_token = 0; 86 87void 88db_unread_token(t) --- 38 unchanged lines hidden (view full) --- 127 while (c <= ' ' || c > '~') { 128 if (c == '\n' || c == -1) 129 return (tEOL); 130 c = db_read_char(); 131 } 132 133 if (c >= '0' && c <= '9') { 134 /* number */ | 85{ 86 db_look_char = c; 87} 88 89int db_look_token = 0; 90 91void 92db_unread_token(t) --- 38 unchanged lines hidden (view full) --- 131 while (c <= ' ' || c > '~') { 132 if (c == '\n' || c == -1) 133 return (tEOL); 134 c = db_read_char(); 135 } 136 137 if (c >= '0' && c <= '9') { 138 /* number */ |
135 int r, digit; | 139 int r, digit = 0; |
136 137 if (c > '0') 138 r = db_radix; 139 else { 140 c = db_read_char(); 141 if (c == 'O' || c == 'o') 142 r = 8; 143 else if (c == 'T' || c == 't') --- 132 unchanged lines hidden --- | 140 141 if (c > '0') 142 r = db_radix; 143 else { 144 c = db_read_char(); 145 if (c == 'O' || c == 'o') 146 r = 8; 147 else if (c == 'T' || c == 't') --- 132 unchanged lines hidden --- |