| 1 | /* ldexp.h - |
| 2 | |
| 3 | Copyright (C) 1991 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GLD, the Gnu Linker. |
| 6 | |
| 7 | GLD is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 1, or (at your option) |
| 10 | any later version. |
| 11 | |
| 12 | GLD is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GLD; see the file COPYING. If not, write to |
| 19 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | /* The result of an expression tree */ |
| 25 | typedef struct |
| 26 | { |
| 27 | bfd_vma value; |
| 28 | struct lang_output_section_statement_struct *section; |
| 29 | boolean valid; |
| 30 | } etree_value_type; |
| 31 | |
| 32 | |
| 33 | |
| 34 | typedef struct |
| 35 | { |
| 36 | int node_code; |
| 37 | enum { etree_binary, |
| 38 | etree_trinary, |
| 39 | etree_unary, |
| 40 | etree_name, |
| 41 | etree_assign, |
| 42 | etree_undef, |
| 43 | etree_unspec, |
| 44 | etree_value } node_class; |
| 45 | } node_type; |
| 46 | |
| 47 | |
| 48 | |
| 49 | typedef union etree_union |
| 50 | { |
| 51 | node_type type; |
| 52 | struct { |
| 53 | node_type type; |
| 54 | union etree_union *lhs; |
| 55 | union etree_union *rhs; |
| 56 | } binary; |
| 57 | struct { |
| 58 | node_type type; |
| 59 | union etree_union *cond; |
| 60 | union etree_union *lhs; |
| 61 | union etree_union *rhs; |
| 62 | } trinary; |
| 63 | struct { |
| 64 | node_type type; |
| 65 | char *dst; |
| 66 | union etree_union *src; |
| 67 | } assign; |
| 68 | |
| 69 | struct { |
| 70 | node_type type; |
| 71 | union etree_union *child; |
| 72 | } unary; |
| 73 | struct { |
| 74 | node_type type; |
| 75 | char *name; |
| 76 | } name; |
| 77 | struct { |
| 78 | node_type type; |
| 79 | bfd_vma value; |
| 80 | } value; |
| 81 | |
| 82 | } etree_type; |
| 83 | |
| 84 | |
| 85 | PROTO(etree_type *,exp_intop,(bfd_vma)); |
| 86 | |
| 87 | PROTO(etree_value_type, invalid,(void)); |
| 88 | PROTO(etree_value_type, exp_fold_tree,(etree_type *, struct |
| 89 | lang_output_section_statement_struct *, lang_phase_type, |
| 90 | bfd_vma, bfd_vma *)); |
| 91 | |
| 92 | PROTO(etree_type *, exp_binop,(int, etree_type *, etree_type *)); |
| 93 | PROTO(etree_type *,exp_trinop,(int,etree_type *, etree_type *, etree_type *)); |
| 94 | PROTO(etree_type *,exp_unop,(int, etree_type *)); |
| 95 | PROTO(etree_type *,exp_nameop,(int, char *)); |
| 96 | PROTO(etree_type *,exp_assop,(int, char *, etree_type *)); |
| 97 | PROTO(void, exp_print_tree,(struct _iobuf *, etree_type *)); |
| 98 | PROTO(bfd_vma, exp_get_vma,(etree_type *, bfd_vma, char *, enum boolean)); |
| 99 | PROTO(int, exp_get_value_int,(etree_type *, int, char *, enum boolean)); |