github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/cmd/6a/a.h (about)

     1  // Inferno utils/6a/a.h
     2  // http://code.google.com/p/inferno-os/source/browse/utils/6a/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 "../6l/6.out.h"
    33  
    34  
    35  #ifndef	EXTERN
    36  #define	EXTERN	extern
    37  #endif
    38  
    39  #undef	getc
    40  #undef	ungetc
    41  #undef	BUFSIZ
    42  
    43  #define	getc	ccgetc
    44  #define	ungetc	ccungetc
    45  
    46  typedef	struct	Sym	Sym;
    47  typedef	struct	Ref	Ref;
    48  typedef	struct	Gen	Gen;
    49  typedef	struct	Io	Io;
    50  typedef	struct	Hist	Hist;
    51  typedef	struct	Gen2	Gen2;
    52  
    53  #define	MAXALIGN	7
    54  #define	FPCHIP		1
    55  #define	NSYMB		500
    56  #define	BUFSIZ		8192
    57  #define	HISTSZ		20
    58  #ifndef	EOF
    59  #define	EOF		(-1)
    60  #endif
    61  #define	IGN		(-2)
    62  #define	GETC()		((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
    63  #define	NHASH		503
    64  #define	STRINGSZ	200
    65  #define	NMACRO		10
    66  
    67  struct	Sym
    68  {
    69  	Sym*	link;
    70  	Ref*	ref;
    71  	char*	macro;
    72  	vlong	value;
    73  	ushort	type;
    74  	char	*name;
    75  	char	sym;
    76  };
    77  #define	S	((Sym*)0)
    78  
    79  struct	Ref
    80  {
    81  	int	class;
    82  };
    83  
    84  EXTERN struct
    85  {
    86  	char*	p;
    87  	int	c;
    88  } fi;
    89  
    90  struct	Io
    91  {
    92  	Io*	link;
    93  	char	b[BUFSIZ];
    94  	char*	p;
    95  	short	c;
    96  	short	f;
    97  };
    98  #define	I	((Io*)0)
    99  
   100  EXTERN struct
   101  {
   102  	Sym*	sym;
   103  	short	type;
   104  } h[NSYM];
   105  
   106  struct	Gen
   107  {
   108  	double	dval;
   109  	char	sval[8];
   110  	vlong	offset;
   111  	Sym*	sym;
   112  	short	type;
   113  	short	index;
   114  	short	scale;
   115  };
   116  struct	Gen2
   117  {
   118  	Gen	from;
   119  	Gen	to;
   120  };
   121  
   122  struct	Hist
   123  {
   124  	Hist*	link;
   125  	char*	name;
   126  	int32	line;
   127  	vlong	offset;
   128  };
   129  #define	H	((Hist*)0)
   130  
   131  enum
   132  {
   133  	CLAST,
   134  	CMACARG,
   135  	CMACRO,
   136  	CPREPROC,
   137  };
   138  
   139  
   140  EXTERN	char	debug[256];
   141  EXTERN	Sym*	hash[NHASH];
   142  EXTERN	char**	Dlist;
   143  EXTERN	int	nDlist;
   144  EXTERN	Hist*	ehist;
   145  EXTERN	int	newflag;
   146  EXTERN	Hist*	hist;
   147  EXTERN	char*	hunk;
   148  EXTERN	char**	include;
   149  EXTERN	Io*	iofree;
   150  EXTERN	Io*	ionext;
   151  EXTERN	Io*	iostack;
   152  EXTERN	int32	lineno;
   153  EXTERN	int	nerrors;
   154  EXTERN	int32	nhunk;
   155  EXTERN	int	ninclude;
   156  EXTERN	int32	nsymb;
   157  EXTERN	Gen	nullgen;
   158  EXTERN	char*	outfile;
   159  EXTERN	int	pass;
   160  EXTERN	char*	pathname;
   161  EXTERN	int32	pc;
   162  EXTERN	int	peekc;
   163  EXTERN	int32	stmtline;
   164  EXTERN	int	sym;
   165  EXTERN	char*	symb;
   166  EXTERN	int	thechar;
   167  EXTERN	char*	thestring;
   168  EXTERN	int32	thunk;
   169  EXTERN	Biobuf	obuf;
   170  
   171  void*	alloc(int32);
   172  void*	allocn(void*, int32, int32);
   173  void	ensuresymb(int32);
   174  void	errorexit(void);
   175  void	pushio(void);
   176  void	newio(void);
   177  void	newfile(char*, int);
   178  Sym*	slookup(char*);
   179  Sym*	lookup(void);
   180  void	syminit(Sym*);
   181  int32	yylex(void);
   182  int	getc(void);
   183  int	getnsc(void);
   184  void	unget(int);
   185  int	escchar(int);
   186  void	cinit(void);
   187  void	checkscale(int);
   188  void	pinit(char*);
   189  void	cclean(void);
   190  int	isreg(Gen*);
   191  void	outcode(int, Gen2*);
   192  void	outhist(void);
   193  void	zaddr(Gen*, int);
   194  void	zname(char*, int, int);
   195  void	ieeedtod(Ieee*, double);
   196  int	filbuf(void);
   197  Sym*	getsym(void);
   198  void	domacro(void);
   199  void	macund(void);
   200  void	macdef(void);
   201  void	macexpand(Sym*, char*);
   202  void	macinc(void);
   203  void	macprag(void);
   204  void	maclin(void);
   205  void	macif(int);
   206  void	macend(void);
   207  void	dodefine(char*);
   208  void	prfile(int32);
   209  void	linehist(char*, int);
   210  void	gethunk(void);
   211  void	yyerror(char*, ...);
   212  int	yyparse(void);
   213  void	setinclude(char*);
   214  int	assemble(char*);