github.com/rohankumardubey/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/cmd/5a/a.h (about) 1 // Inferno utils/5a/a.h 2 // http://code.google.com/p/inferno-os/source/browse/utils/5a/a.h 3 // 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) 6 // Portions Copyright © 1997-1999 Vita Nuova Limited 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com) 8 // Portions Copyright © 2004,2006 Bruce Ellis 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others 11 // Portions Copyright © 2009 The Go Authors. All rights reserved. 12 // 13 // Permission is hereby granted, free of charge, to any person obtaining a copy 14 // of this software and associated documentation files (the "Software"), to deal 15 // in the Software without restriction, including without limitation the rights 16 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 // copies of the Software, and to permit persons to whom the Software is 18 // furnished to do so, subject to the following conditions: 19 // 20 // The above copyright notice and this permission notice shall be included in 21 // all copies or substantial portions of the Software. 22 // 23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 // THE SOFTWARE. 30 31 #include <bio.h> 32 #include "../5l/5.out.h" 33 34 #ifndef EXTERN 35 #define EXTERN extern 36 #endif 37 38 #undef getc 39 #undef ungetc 40 #undef BUFSIZ 41 42 #define getc ccgetc 43 #define ungetc ccungetc 44 45 typedef struct Sym Sym; 46 typedef struct Gen Gen; 47 typedef struct Io Io; 48 typedef struct Hist Hist; 49 50 #define MAXALIGN 7 51 #define FPCHIP 1 52 #define NSYMB 8192 53 #define BUFSIZ 8192 54 #define HISTSZ 20 55 #ifndef EOF 56 #define EOF (-1) 57 #endif 58 #define IGN (-2) 59 #define GETC() ((--fi.c < 0)? filbuf(): *fi.p++ & 0xff) 60 #define NHASH 503 61 #define STRINGSZ 200 62 #define NMACRO 10 63 64 struct Sym 65 { 66 Sym* link; 67 char* macro; 68 int32 value; 69 ushort type; 70 char *name; 71 char sym; 72 }; 73 #define S ((Sym*)0) 74 75 EXTERN struct 76 { 77 char* p; 78 int c; 79 } fi; 80 81 struct Io 82 { 83 Io* link; 84 char b[BUFSIZ]; 85 char* p; 86 short c; 87 short f; 88 }; 89 #define I ((Io*)0) 90 91 EXTERN struct 92 { 93 Sym* sym; 94 short type; 95 } h[NSYM]; 96 97 struct Gen 98 { 99 Sym* sym; 100 int32 offset; 101 int32 offset2; 102 short type; 103 short reg; 104 short name; 105 double dval; 106 char sval[8]; 107 }; 108 109 struct Hist 110 { 111 Hist* link; 112 char* name; 113 int32 line; 114 int32 offset; 115 }; 116 #define H ((Hist*)0) 117 118 enum 119 { 120 CLAST, 121 CMACARG, 122 CMACRO, 123 CPREPROC, 124 125 Always = 14, 126 }; 127 128 EXTERN char debug[256]; 129 EXTERN Sym* hash[NHASH]; 130 EXTERN char** Dlist; 131 EXTERN int nDlist; 132 EXTERN Hist* ehist; 133 EXTERN int newflag; 134 EXTERN Hist* hist; 135 EXTERN char* hunk; 136 EXTERN char** include; 137 EXTERN Io* iofree; 138 EXTERN Io* ionext; 139 EXTERN Io* iostack; 140 EXTERN int32 lineno; 141 EXTERN int nerrors; 142 EXTERN int32 nhunk; 143 EXTERN int ninclude; 144 EXTERN int32 nsymb; 145 EXTERN Gen nullgen; 146 EXTERN char* outfile; 147 EXTERN int pass; 148 EXTERN char* pathname; 149 EXTERN int32 pc; 150 EXTERN int peekc; 151 EXTERN int32 stmtline; 152 EXTERN int sym; 153 EXTERN char* symb; 154 EXTERN int thechar; 155 EXTERN char* thestring; 156 EXTERN int32 thunk; 157 EXTERN Biobuf obuf; 158 159 void* alloc(int32); 160 void* allocn(void*, int32, int32); 161 void ensuresymb(int32); 162 void errorexit(void); 163 void pushio(void); 164 void newio(void); 165 void newfile(char*, int); 166 Sym* slookup(char*); 167 Sym* lookup(void); 168 void syminit(Sym*); 169 int32 yylex(void); 170 int getc(void); 171 int getnsc(void); 172 void unget(int); 173 int escchar(int); 174 void cinit(void); 175 void pinit(char*); 176 void cclean(void); 177 int isreg(Gen*); 178 void outcode(int, int, Gen*, int, Gen*); 179 void zname(char*, int, int); 180 void zaddr(Gen*, int); 181 void ieeedtod(Ieee*, double); 182 int filbuf(void); 183 Sym* getsym(void); 184 void domacro(void); 185 void macund(void); 186 void macdef(void); 187 void macexpand(Sym*, char*); 188 void macinc(void); 189 void maclin(void); 190 void macprag(void); 191 void macif(int); 192 void macend(void); 193 void outhist(void); 194 void dodefine(char*); 195 void prfile(int32); 196 void linehist(char*, int); 197 void gethunk(void); 198 void yyerror(char*, ...); 199 int yyparse(void); 200 void setinclude(char*); 201 int assemble(char*);