~ubuntu-branches/ubuntu/hoary/binutils/hoary

« back to all changes in this revision

Viewing changes to gas/expr.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-03-18 13:07:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050318130752-j4i37zgqclj53b94
Tags: 2.15-5ubuntu2
debian/rules: Call pkgstriptranslations if present (the package does not
use debhelper, thus it does not happen automatically).

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "safe-ctype.h"
33
33
#include "obstack.h"
34
34
 
35
 
static void floating_constant PARAMS ((expressionS * expressionP));
36
 
static valueT generic_bignum_to_int32 PARAMS ((void));
 
35
static void floating_constant (expressionS * expressionP);
 
36
static valueT generic_bignum_to_int32 (void);
37
37
#ifdef BFD64
38
 
static valueT generic_bignum_to_int64 PARAMS ((void));
 
38
static valueT generic_bignum_to_int64 (void);
39
39
#endif
40
 
static void integer_constant PARAMS ((int radix, expressionS * expressionP));
41
 
static void mri_char_constant PARAMS ((expressionS *));
42
 
static void current_location PARAMS ((expressionS *));
43
 
static void clean_up_expression PARAMS ((expressionS * expressionP));
44
 
static segT operand PARAMS ((expressionS *));
45
 
static operatorT operator PARAMS ((int *));
 
40
static void integer_constant (int radix, expressionS * expressionP);
 
41
static void mri_char_constant (expressionS *);
 
42
static void current_location (expressionS *);
 
43
static void clean_up_expression (expressionS * expressionP);
 
44
static segT operand (expressionS *);
 
45
static operatorT operator (int *);
46
46
 
47
47
extern const char EXP_CHARS[], FLT_CHARS[];
48
48
 
63
63
   into the fake section expr_section.  */
64
64
 
65
65
symbolS *
66
 
make_expr_symbol (expressionP)
67
 
     expressionS *expressionP;
 
66
make_expr_symbol (expressionS *expressionP)
68
67
{
69
68
  expressionS zero;
70
69
  symbolS *symbolP;
118
117
   the symbol.  */
119
118
 
120
119
int
121
 
expr_symbol_where (sym, pfile, pline)
122
 
     symbolS *sym;
123
 
     char **pfile;
124
 
     unsigned int *pline;
 
120
expr_symbol_where (symbolS *sym, char **pfile, unsigned int *pline)
125
121
{
126
122
  register struct expr_symbol_line *l;
127
123
 
151
147
   but that seems more clumsy.  */
152
148
 
153
149
symbolS *
154
 
expr_build_uconstant (value)
155
 
     offsetT value;
 
150
expr_build_uconstant (offsetT value)
156
151
{
157
152
  expressionS e;
158
153
 
165
160
/* Build an expression for OP s1.  */
166
161
 
167
162
symbolS *
168
 
expr_build_unary (op, s1)
169
 
     operatorT op;
170
 
     symbolS *s1;
 
163
expr_build_unary (operatorT op, symbolS *s1)
171
164
{
172
165
  expressionS e;
173
166
 
180
173
/* Build an expression for s1 OP s2.  */
181
174
 
182
175
symbolS *
183
 
expr_build_binary (op, s1, s2)
184
 
     operatorT op;
185
 
     symbolS *s1;
186
 
     symbolS *s2;
 
176
expr_build_binary (operatorT op, symbolS *s1, symbolS *s2)
187
177
{
188
178
  expressionS e;
189
179
 
197
187
/* Build an expression for the current location ('.').  */
198
188
 
199
189
symbolS *
200
 
expr_build_dot ()
 
190
expr_build_dot (void)
201
191
{
202
192
  expressionS e;
203
193
 
227
217
int generic_floating_point_magic;
228
218
 
229
219
static void
230
 
floating_constant (expressionP)
231
 
     expressionS *expressionP;
 
220
floating_constant (expressionS *expressionP)
232
221
{
233
222
  /* input_line_pointer -> floating-point constant.  */
234
223
  int error_code;
255
244
}
256
245
 
257
246
static valueT
258
 
generic_bignum_to_int32 ()
 
247
generic_bignum_to_int32 (void)
259
248
{
260
249
  valueT number =
261
250
           ((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
266
255
 
267
256
#ifdef BFD64
268
257
static valueT
269
 
generic_bignum_to_int64 ()
 
258
generic_bignum_to_int64 (void)
270
259
{
271
260
  valueT number =
272
261
    ((((((((valueT) generic_bignum[3] & LITTLENUM_MASK)
281
270
#endif
282
271
 
283
272
static void
284
 
integer_constant (radix, expressionP)
285
 
     int radix;
286
 
     expressionS *expressionP;
 
273
integer_constant (int radix, expressionS *expressionP)
287
274
{
288
275
  char *start;          /* Start of number.  */
289
276
  char *suffix = NULL;
642
629
/* Parse an MRI multi character constant.  */
643
630
 
644
631
static void
645
 
mri_char_constant (expressionP)
646
 
     expressionS *expressionP;
 
632
mri_char_constant (expressionS *expressionP)
647
633
{
648
634
  int i;
649
635
 
732
718
   handles the magic symbol `.'.  */
733
719
 
734
720
static void
735
 
current_location (expressionp)
736
 
     expressionS *expressionp;
 
721
current_location (expressionS *expressionp)
737
722
{
738
723
  if (now_seg == absolute_section)
739
724
    {
756
741
        Input_line_pointer->(next non-blank) char after operand.  */
757
742
 
758
743
static segT
759
 
operand (expressionP)
760
 
     expressionS *expressionP;
 
744
operand (expressionS *expressionP)
761
745
{
762
746
  char c;
763
747
  symbolS *symbolP;     /* Points to symbol.  */
1037
1021
      break;
1038
1022
 
1039
1023
    case '+':
 
1024
      /* Do not accept ++e as +(+e) */
 
1025
      if (*input_line_pointer == '+')
 
1026
        goto target_op;
1040
1027
      (void) operand (expressionP);
1041
1028
      break;
1042
1029
 
1054
1041
    case '!':
1055
1042
    case '-':
1056
1043
      {
 
1044
        /* Do not accept --e as -(-e) */
 
1045
        if (c == '-' && *input_line_pointer == '-')
 
1046
          goto target_op;
 
1047
        
1057
1048
        operand (expressionP);
1058
1049
        if (expressionP->X_op == O_constant)
1059
1050
          {
1305
1296
        }
1306
1297
      else
1307
1298
        {
 
1299
        target_op:
1308
1300
          /* Let the target try to parse it.  Success is indicated by changing
1309
1301
             the X_op field to something other than O_absent and pointing
1310
1302
             input_line_pointer past the expression.  If it can't parse the
1354
1346
        Unused fields zeroed to help expr ().  */
1355
1347
 
1356
1348
static void
1357
 
clean_up_expression (expressionP)
1358
 
     expressionS *expressionP;
 
1349
clean_up_expression (expressionS *expressionP)
1359
1350
{
1360
1351
  switch (expressionP->X_op)
1361
1352
    {
1506
1497
#define MRI_MUL_PRECEDENCE 6
1507
1498
 
1508
1499
void
1509
 
expr_set_precedence ()
 
1500
expr_set_precedence (void)
1510
1501
{
1511
1502
  if (flag_m68k_mri)
1512
1503
    {
1525
1516
/* Initialize the expression parser.  */
1526
1517
 
1527
1518
void
1528
 
expr_begin ()
 
1519
expr_begin (void)
1529
1520
{
1530
1521
  expr_set_precedence ();
1531
1522
 
1542
1533
   Does not advance INPUT_LINE_POINTER.  */
1543
1534
 
1544
1535
static inline operatorT
1545
 
operator (num_chars)
1546
 
     int *num_chars;
 
1536
operator (int *num_chars)
1547
1537
{
1548
1538
  int c;
1549
1539
  operatorT ret;
1559
1549
    default:
1560
1550
      return op_encoding[c];
1561
1551
 
 
1552
    case '+':
 
1553
    case '-':
 
1554
      /* Do not allow a++b and a--b to be a + (+b) and a - (-b) */
 
1555
      if (input_line_pointer[1] != c)
 
1556
        return op_encoding[c];
 
1557
      return O_illegal;
 
1558
 
1562
1559
    case '<':
1563
1560
      switch (input_line_pointer[1])
1564
1561
        {
1631
1628
/* Parse an expression.  */
1632
1629
 
1633
1630
segT
1634
 
expr (rankarg, resultP)
1635
 
     int rankarg;       /* Larger # is higher rank.  */
1636
 
     expressionS *resultP;      /* Deliver result here.  */
 
1631
expr (int rankarg,              /* Larger # is higher rank.  */
 
1632
      expressionS *resultP      /* Deliver result here.  */)
1637
1633
{
1638
1634
  operator_rankT rank = (operator_rankT) rankarg;
1639
1635
  segT retval;
1891
1887
   lines end in end-of-line.  */
1892
1888
 
1893
1889
char
1894
 
get_symbol_end ()
 
1890
get_symbol_end (void)
1895
1891
{
1896
1892
  char c;
1897
1893
 
1910
1906
}
1911
1907
 
1912
1908
unsigned int
1913
 
get_single_number ()
 
1909
get_single_number (void)
1914
1910
{
1915
1911
  expressionS exp;
1916
1912
  operand (&exp);