]>
Commit | Line | Data |
---|---|---|
fecd2382 | 1 | /* expr.h -> header file for expr.c |
6efd877d KR |
2 | Copyright (C) 1987, 1992 Free Software Foundation, Inc. |
3 | ||
a39116f1 | 4 | This file is part of GAS, the GNU Assembler. |
6efd877d | 5 | |
a39116f1 RP |
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. | |
6efd877d | 10 | |
a39116f1 RP |
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. | |
6efd877d | 15 | |
a39116f1 RP |
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. */ | |
fecd2382 RP |
19 | |
20 | /* | |
21 | * Abbreviations (mnemonics). | |
22 | * | |
23 | * O operator | |
24 | * Q quantity, operand | |
25 | * X eXpression | |
26 | */ | |
27 | ||
28 | /* | |
29 | * By popular demand, we define a struct to represent an expression. | |
30 | * This will no doubt mutate as expressions become baroque. | |
31 | * | |
32 | * Currently, we support expressions like "foo-bar+42". | |
33 | * In other words we permit a (possibly undefined) minuend, a | |
34 | * (possibly undefined) subtrahend and an (absolute) augend. | |
35 | * RMS says this is so we can have 1-pass assembly for any compiler | |
36 | * emmissions, and a 'case' statement might emit 'undefined1 - undefined2'. | |
37 | * | |
38 | * To simplify table-driven dispatch, we also have a "segment" for the | |
39 | * entire expression. That way we don't require complex reasoning about | |
40 | * whether particular components are defined; and we can change component | |
41 | * semantics without re-working all the dispatch tables in the assembler. | |
42 | * In other words the "type" of an expression is its segment. | |
43 | */ | |
44 | ||
45 | typedef struct | |
46 | { | |
6efd877d KR |
47 | symbolS *X_add_symbol; /* foo */ |
48 | symbolS *X_subtract_symbol; /* bar */ | |
49 | long X_add_number; /* 42. Must be signed. */ | |
50 | segT X_seg; /* What segment (expr type)? */ | |
fecd2382 | 51 | } |
6efd877d | 52 | |
fecd2382 RP |
53 | expressionS; |
54 | ||
a39116f1 | 55 | /* result should be type (expressionS *). */ |
fecd2382 RP |
56 | #define expression(result) expr(0,result) |
57 | ||
a39116f1 RP |
58 | /* If an expression is SEG_BIG, look here */ |
59 | /* for its value. These common data may */ | |
60 | /* be clobbered whenever expr() is called. */ | |
6efd877d | 61 | extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */ |
a39116f1 | 62 | /* Enough to hold most precise flonum. */ |
6efd877d | 63 | extern LITTLENUM_TYPE generic_bignum[]; /* Bignums returned here. */ |
fecd2382 RP |
64 | #define SIZE_OF_LARGE_NUMBER (20) /* Number of littlenums in above. */ |
65 | ||
66 | typedef char operator_rankT; | |
67 | ||
6efd877d | 68 | #if __STDC__ == 1 |
fecd2382 | 69 | |
6efd877d KR |
70 | char get_symbol_end (void); |
71 | segT expr (int rank, expressionS * resultP); | |
72 | unsigned int get_single_number (void); | |
fecd2382 | 73 | |
6efd877d | 74 | #else /* not __STDC__ */ |
fecd2382 | 75 | |
6efd877d KR |
76 | char get_symbol_end (); |
77 | segT expr (); | |
78 | unsigned int get_single_number (); | |
fecd2382 | 79 | |
6efd877d | 80 | #endif /* not __STDC__ */ |
fecd2382 | 81 | |
8b228fe9 | 82 | /* end of expr.h */ |