expr.h 2.4 KB

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