1: /* @(#)yyoptions.c 2.2 SCCS id keyword */ 2: /* Copyright (c) 1979 Regents of the University of California */ 3: # 4: /* 5: * pi - Pascal interpreter code translator 6: * 7: * Charles Haley, Bill Joy UCB 8: * Version 1.1 February 1978 9: */ 10: 11: #include "whoami" 12: #include "0.h" 13: #include "yy.h" 14: 15: /* 16: * Options processes the option 17: * strings which can appear in 18: * comments and returns the next character. 19: */ 20: options() 21: { 22: register c, ch; 23: register char *optp; 24: int ok; 25: 26: c = readch(); 27: if (c != '$') 28: return (c); 29: do { 30: ch = c = readch(); 31: switch (c) { 32: case 'b': 33: optp = &opts['b'-'a']; 34: goto optdig; 35: case 'x': 36: optp = &opts['x'-'a']; 37: goto optdig; 38: optdig: 39: c = readch(); 40: if (!digit(c)) 41: return (c); 42: *optp = c - '0'; 43: c = readch(); 44: break; 45: default: 46: if (c < 'a' || c > 'z') 47: return (c); 48: optp = &opts[c-'a']; 49: c = readch(); 50: if (c == '+') { 51: *optp = 1; 52: c = readch(); 53: } else if (c == '-') { 54: *optp = 0; 55: c = readch(); 56: } else 57: return (c); 58: break; 59: } 60: #ifdef PI0 61: send(ROSET, ch, *optp); 62: #endif 63: } while (c == ','); 64: if (opts['u'-'a']) 65: setuflg(); 66: return (c); 67: }