RIP gzip, we found a nicer playmate.
[dragonfly.git] / gnu / usr.bin / as / expr.h
1 /* expr.h -> header file for expr.c
2    Copyright (C) 1987, 1992 Free Software Foundation, Inc.
3
4    This file is part of GAS, the GNU Assembler.
5
6    GAS is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    GAS is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with GAS; see the file COPYING.  If not, write to
18    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19 /*
20  * $FreeBSD: src/gnu/usr.bin/as/expr.h,v 1.6 1999/08/27 23:34:14 peter Exp $
21  * $DragonFly: src/gnu/usr.bin/as/Attic/expr.h,v 1.2 2003/06/17 04:25:44 dillon Exp $
22  */
23
24
25 /*
26  * Abbreviations (mnemonics).
27  *
28  *      O       operator
29  *      Q       quantity,  operand
30  *      X       eXpression
31  */
32
33 /*
34  * By popular demand, we define a struct to represent an expression.
35  * This will no doubt mutate as expressions become baroque.
36  *
37  * Currently, we support expressions like "foo-bar+42".
38  * In other words we permit a (possibly undefined) minuend, a
39  * (possibly undefined) subtrahend and an (absolute) augend.
40  * RMS says this is so we can have 1-pass assembly for any compiler
41  * emmissions, and a 'case' statement might emit 'undefined1 - undefined2'.
42  *
43  * To simplify table-driven dispatch, we also have a "segment" for the
44  * entire expression. That way we don't require complex reasoning about
45  * whether particular components are defined; and we can change component
46  * semantics without re-working all the dispatch tables in the assembler.
47  * In other words the "type" of an expression is its segment.
48  */
49
50 typedef struct {
51         symbolS *X_add_symbol;          /* foo */
52         symbolS *X_subtract_symbol;     /* bar */
53         symbolS *X_got_symbol;          /* got */
54         long X_add_number;              /* 42.    Must be signed. */
55         segT    X_seg;                  /* What segment (expr type)? */
56 }
57 expressionS;
58
59 /* result should be type (expressionS *). */
60 #define expression(result) expr(0,result)
61
62 /* If an expression is SEG_BIG, look here */
63 /* for its value. These common data may */
64 /* be clobbered whenever expr() is called. */
65 extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
66 /* Enough to hold most precise flonum. */
67 extern LITTLENUM_TYPE generic_bignum[]; /* Bignums returned here. */
68 #define SIZE_OF_LARGE_NUMBER (20)       /* Number of littlenums in above. */
69
70 typedef char operator_rankT;
71
72 #if __STDC__ == 1
73
74 char get_symbol_end(void);
75 segT expr(int rank, expressionS *resultP);
76 unsigned int get_single_number(void);
77
78 #else /* not __STDC__ */
79
80 char get_symbol_end();
81 segT expr();
82 unsigned int get_single_number();
83
84 #endif /* not __STDC__ */
85
86 /* end of expr.h */