2000-09-07 Kazu Hirata <kazu@hxi.com>
* config/tc-vax.c: Fix formatting. * input-scrub.c: Likewise.
This commit is contained in:
parent
256d98afc9
commit
e13b337af5
|
@ -1,6 +1,8 @@
|
|||
2000-09-07 Kazu Hirata <kazu@hxi.com>
|
||||
|
||||
* config/tc-mips.c: Fix formatting.
|
||||
* config/tc-vax.c: Likewise.
|
||||
* input-scrub.c: Likewise.
|
||||
|
||||
2000-09-07 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* tc-vax.c - vax-specific -
|
||||
Copyright (C) 1987, 91, 92, 93, 94, 95, 98, 1999
|
||||
Copyright (C) 1987, 91, 92, 93, 94, 95, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
@ -28,8 +28,8 @@
|
|||
another comment */
|
||||
const char comment_chars[] = "#";
|
||||
|
||||
/* These chars only start a comment at the beginning of a line. */
|
||||
/* Note that for the VAX the are the same as comment_chars above. */
|
||||
/* These chars only start a comment at the beginning of a line. */
|
||||
/* Note that for the VAX the are the same as comment_chars above. */
|
||||
const char line_comment_chars[] = "#";
|
||||
|
||||
const char line_separator_chars[] = ";";
|
||||
|
@ -50,13 +50,13 @@ const char FLT_CHARS[] = "dDfFgGhH";
|
|||
static expressionS exp_of_operand[VIT_MAX_OPERANDS];
|
||||
static segT seg_of_operand[VIT_MAX_OPERANDS];
|
||||
|
||||
/* A vax instruction after decoding. */
|
||||
/* A vax instruction after decoding. */
|
||||
static struct vit v;
|
||||
|
||||
/* Hold details of big operands. */
|
||||
/* Hold details of big operands. */
|
||||
LITTLENUM_TYPE big_operand_bits[VIT_MAX_OPERANDS][SIZE_OF_LARGE_NUMBER];
|
||||
FLONUM_TYPE float_operand[VIT_MAX_OPERANDS];
|
||||
/* Above is made to point into big_operand_bits by md_begin(). */
|
||||
/* Above is made to point into big_operand_bits by md_begin(). */
|
||||
|
||||
int flag_hash_long_names; /* -+ */
|
||||
int flag_one; /* -1 */
|
||||
|
@ -173,16 +173,15 @@ int flag_no_hash_mixed_case; /* -h NUM */
|
|||
|
||||
/* These displacements are relative to the start address of the
|
||||
displacement. The first letter is Byte, Word. 2nd letter is
|
||||
Forward, Backward. */
|
||||
Forward, Backward. */
|
||||
#define BF (1+ 127)
|
||||
#define BB (1+-128)
|
||||
#define WF (2+ 32767)
|
||||
#define WB (2+-32768)
|
||||
/* Dont need LF, LB because they always reach. [They are coded as 0.] */
|
||||
|
||||
|
||||
#define C(a,b) ENCODE_RELAX(a,b)
|
||||
/* This macro has no side-effects. */
|
||||
/* This macro has no side-effects. */
|
||||
#define ENCODE_RELAX(what,length) (((what) << 2) + (length))
|
||||
|
||||
const relax_typeS md_relax_table[] =
|
||||
|
@ -231,7 +230,7 @@ const pseudo_typeS md_pseudo_table[] =
|
|||
|
||||
#define STATE_PC_RELATIVE (1)
|
||||
#define STATE_CONDITIONAL_BRANCH (2)
|
||||
#define STATE_ALWAYS_BRANCH (3) /* includes BSB... */
|
||||
#define STATE_ALWAYS_BRANCH (3) /* includes BSB... */
|
||||
#define STATE_COMPLEX_BRANCH (4)
|
||||
#define STATE_COMPLEX_HOP (5)
|
||||
|
||||
|
@ -240,7 +239,6 @@ const pseudo_typeS md_pseudo_table[] =
|
|||
#define STATE_LONG (2)
|
||||
#define STATE_UNDF (3) /* Symbol undefined in pass1 */
|
||||
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
int flonum_gen2vax PARAMS ((char format_letter, FLONUM_TYPE * f,
|
||||
|
@ -284,7 +282,7 @@ md_number_to_chars (con, value, nbytes)
|
|||
/* Fix up some data or instructions after we find out the value of a symbol
|
||||
that they reference. */
|
||||
|
||||
void /* Knows about order of bytes in address. */
|
||||
void /* Knows about order of bytes in address. */
|
||||
md_apply_fix (fixP, value)
|
||||
fixS *fixP;
|
||||
long value;
|
||||
|
@ -295,8 +293,8 @@ md_apply_fix (fixP, value)
|
|||
|
||||
long
|
||||
md_chars_to_number (con, nbytes)
|
||||
unsigned char con[]; /* Low order byte 1st. */
|
||||
int nbytes; /* Number of bytes in the input. */
|
||||
unsigned char con[]; /* Low order byte 1st. */
|
||||
int nbytes; /* Number of bytes in the input. */
|
||||
{
|
||||
long retval;
|
||||
for (retval = 0, con += nbytes - 1; nbytes--; con--)
|
||||
|
@ -311,19 +309,19 @@ md_chars_to_number (con, nbytes)
|
|||
|
||||
void
|
||||
md_assemble (instruction_string)
|
||||
char *instruction_string; /* A string: assemble 1 instruction. */
|
||||
char *instruction_string; /* A string: assemble 1 instruction. */
|
||||
{
|
||||
/* Non-zero if operand expression's segment is not known yet. */
|
||||
/* Non-zero if operand expression's segment is not known yet. */
|
||||
int is_undefined;
|
||||
|
||||
int length_code;
|
||||
char *p;
|
||||
/* An operand. Scans all operands. */
|
||||
/* An operand. Scans all operands. */
|
||||
struct vop *operandP;
|
||||
char *save_input_line_pointer;
|
||||
/* What used to live after an expression. */
|
||||
/* What used to live after an expression. */
|
||||
char c_save;
|
||||
/* 1: instruction_string bad for all passes. */
|
||||
/* 1: instruction_string bad for all passes. */
|
||||
int goofed;
|
||||
/* Points to slot just after last operand. */
|
||||
struct vop *end_operandP;
|
||||
|
@ -331,28 +329,28 @@ md_assemble (instruction_string)
|
|||
expressionS *expP;
|
||||
segT *segP;
|
||||
|
||||
/* These refer to an instruction operand expression. */
|
||||
/* These refer to an instruction operand expression. */
|
||||
/* Target segment of the address. */
|
||||
segT to_seg;
|
||||
valueT this_add_number;
|
||||
/* Positive (minuend) symbol. */
|
||||
/* Positive (minuend) symbol. */
|
||||
symbolS *this_add_symbol;
|
||||
/* As a number. */
|
||||
/* As a number. */
|
||||
long opcode_as_number;
|
||||
/* Least significant byte 1st. */
|
||||
/* Least significant byte 1st. */
|
||||
char *opcode_as_chars;
|
||||
/* As an array of characters. */
|
||||
/* As an array of characters. */
|
||||
/* Least significant byte 1st */
|
||||
char *opcode_low_byteP;
|
||||
/* length (bytes) meant by vop_short. */
|
||||
/* length (bytes) meant by vop_short. */
|
||||
int length;
|
||||
/* 0, or 1 if '@' is in addressing mode. */
|
||||
/* 0, or 1 if '@' is in addressing mode. */
|
||||
int at;
|
||||
/* From vop_nbytes: vax_operand_width (in bytes) */
|
||||
int nbytes;
|
||||
FLONUM_TYPE *floatP;
|
||||
LITTLENUM_TYPE literal_float[8];
|
||||
/* Big enough for any floating point literal. */
|
||||
/* Big enough for any floating point literal. */
|
||||
|
||||
vip (&v, instruction_string);
|
||||
|
||||
|
@ -390,12 +388,12 @@ md_assemble (instruction_string)
|
|||
else
|
||||
{
|
||||
/* Statement has no syntax goofs: let's sniff the expression. */
|
||||
int can_be_short = 0; /* 1 if a bignum can be reduced to a short literal. */
|
||||
int can_be_short = 0; /* 1 if a bignum can be reduced to a short literal. */
|
||||
|
||||
input_line_pointer = operandP->vop_expr_begin;
|
||||
c_save = operandP->vop_expr_end[1];
|
||||
operandP->vop_expr_end[1] = '\0';
|
||||
/* If to_seg == SEG_PASS1, expression() will have set need_pass_2 = 1. */
|
||||
/* If to_seg == SEG_PASS1, expression() will have set need_pass_2 = 1. */
|
||||
*segP = expression (expP);
|
||||
switch (expP->X_op)
|
||||
{
|
||||
|
@ -435,7 +433,7 @@ md_assemble (instruction_string)
|
|||
break;
|
||||
|
||||
case O_big:
|
||||
/* Preserve the bits. */
|
||||
/* Preserve the bits. */
|
||||
if (expP->X_add_number > 0)
|
||||
{
|
||||
bignum_copy (generic_bignum, expP->X_add_number,
|
||||
|
@ -498,20 +496,20 @@ md_assemble (instruction_string)
|
|||
&& operandP->vop_reg == 0xF
|
||||
&& (operandP->vop_mode & 0xE) == 0x8))
|
||||
{
|
||||
/* Saw a '#'. */
|
||||
/* Saw a '#'. */
|
||||
if (operandP->vop_short == ' ')
|
||||
{
|
||||
/* We must chose S^ or I^. */
|
||||
/* We must chose S^ or I^. */
|
||||
if (expP->X_add_number > 0)
|
||||
{
|
||||
/* Bignum: Short literal impossible. */
|
||||
/* Bignum: Short literal impossible. */
|
||||
operandP->vop_short = 'i';
|
||||
operandP->vop_mode = 8;
|
||||
operandP->vop_reg = 0xF; /* VAX PC. */
|
||||
operandP->vop_reg = 0xF; /* VAX PC. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Flonum: Try to do it. */
|
||||
/* Flonum: Try to do it. */
|
||||
if (can_be_short)
|
||||
{
|
||||
operandP->vop_short = 's';
|
||||
|
@ -527,17 +525,17 @@ md_assemble (instruction_string)
|
|||
operandP->vop_reg = 0xF; /* VAX PC */
|
||||
}
|
||||
} /* bignum or flonum ? */
|
||||
} /* if #, but no S^ or I^ seen. */
|
||||
/* No more ' ' case: either 's' or 'i'. */
|
||||
} /* if #, but no S^ or I^ seen. */
|
||||
/* No more ' ' case: either 's' or 'i'. */
|
||||
if (operandP->vop_short == 's')
|
||||
{
|
||||
/* Wants to be a short literal. */
|
||||
/* Wants to be a short literal. */
|
||||
if (expP->X_add_number > 0)
|
||||
{
|
||||
as_warn (_("Bignum not permitted in short literal. Immediate mode assumed."));
|
||||
operandP->vop_short = 'i';
|
||||
operandP->vop_mode = 8;
|
||||
operandP->vop_reg = 0xF; /* VAX PC. */
|
||||
operandP->vop_reg = 0xF; /* VAX PC. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -546,10 +544,10 @@ md_assemble (instruction_string)
|
|||
as_warn (_("Can't do flonum short literal: immediate mode used."));
|
||||
operandP->vop_short = 'i';
|
||||
operandP->vop_mode = 8;
|
||||
operandP->vop_reg = 0xF; /* VAX PC. */
|
||||
operandP->vop_reg = 0xF; /* VAX PC. */
|
||||
}
|
||||
else
|
||||
{ /* Encode short literal now. */
|
||||
{ /* Encode short literal now. */
|
||||
int temp = 0;
|
||||
|
||||
switch (-expP->X_add_number)
|
||||
|
@ -579,18 +577,18 @@ md_assemble (instruction_string)
|
|||
} /* flonum or bignum ? */
|
||||
}
|
||||
else
|
||||
{ /* I^# seen: set it up if float. */
|
||||
{ /* I^# seen: set it up if float. */
|
||||
if (expP->X_add_number < 0)
|
||||
{
|
||||
memcpy (floatP->low, literal_float, sizeof (literal_float));
|
||||
}
|
||||
} /* if S^# seen. */
|
||||
} /* if S^# seen. */
|
||||
}
|
||||
else
|
||||
{
|
||||
as_warn (_("A bignum/flonum may not be a displacement: 0x%lx used"),
|
||||
(expP->X_add_number = 0x80000000L));
|
||||
/* Chosen so luser gets the most offset bits to patch later. */
|
||||
/* Chosen so luser gets the most offset bits to patch later. */
|
||||
}
|
||||
expP->X_add_number = floatP->low[0]
|
||||
| ((LITTLENUM_MASK & (floatP->low[1])) << LITTLENUM_NUMBER_OF_BITS);
|
||||
|
@ -623,9 +621,8 @@ md_assemble (instruction_string)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Emit op-code. */
|
||||
/* Remember where it is, in case we want to modify the op-code later. */
|
||||
/* Emit op-code. */
|
||||
/* Remember where it is, in case we want to modify the op-code later. */
|
||||
opcode_low_byteP = frag_more (v.vit_opcode_nbytes);
|
||||
memcpy (opcode_low_byteP, v.vit_opcode, v.vit_opcode_nbytes);
|
||||
opcode_as_number = md_chars_to_number (opcode_as_chars = v.vit_opcode, 4);
|
||||
|
@ -649,7 +646,7 @@ md_assemble (instruction_string)
|
|||
FRAG_APPEND_1_CHAR (0x40 + operandP->vop_ndx);
|
||||
} /* if(vop_ndx>=0) */
|
||||
|
||||
/* Here to make main operand frag(s). */
|
||||
/* Here to make main operand frag(s). */
|
||||
this_add_number = expP->X_add_number;
|
||||
this_add_symbol = expP->X_add_symbol;
|
||||
to_seg = *segP;
|
||||
|
@ -664,7 +661,7 @@ md_assemble (instruction_string)
|
|||
{
|
||||
if (to_seg == now_seg || is_undefined)
|
||||
{
|
||||
/* If is_undefined, then it might BECOME now_seg. */
|
||||
/* If is_undefined, then it might BECOME now_seg. */
|
||||
if (nbytes)
|
||||
{
|
||||
p = frag_more (nbytes);
|
||||
|
@ -728,7 +725,7 @@ md_assemble (instruction_string)
|
|||
{
|
||||
know (!(opcode_as_number & VIT_OPCODE_SYNTHETIC));
|
||||
p = frag_more (nbytes);
|
||||
/* Conventional relocation. */
|
||||
/* Conventional relocation. */
|
||||
fix_new (frag_now, p - frag_now->fr_literal,
|
||||
nbytes, &abs_symbol, this_add_number,
|
||||
1, NO_RELOC);
|
||||
|
@ -744,9 +741,9 @@ md_assemble (instruction_string)
|
|||
*opcode_low_byteP = opcode_as_chars[0] + VAX_WIDEN_LONG;
|
||||
know (opcode_as_chars[1] == 0);
|
||||
p = frag_more (5);
|
||||
p[0] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
p[0] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
md_number_to_chars (p + 1, this_add_number, 4);
|
||||
/* Now (eg) JMP @#foo or JSB @#foo. */
|
||||
/* Now (eg) JMP @#foo or JSB @#foo. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -758,7 +755,7 @@ md_assemble (instruction_string)
|
|||
p[2] = VAX_BRB;
|
||||
p[3] = 6;
|
||||
p[4] = VAX_JMP;
|
||||
p[5] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
p[5] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
md_number_to_chars (p + 6, this_add_number, 4);
|
||||
/*
|
||||
* Now (eg) ACBx 1f
|
||||
|
@ -775,7 +772,7 @@ md_assemble (instruction_string)
|
|||
p[1] = VAX_BRB;
|
||||
p[2] = 6;
|
||||
p[3] = VAX_JMP;
|
||||
p[4] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
p[4] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
md_number_to_chars (p + 5, this_add_number, 4);
|
||||
/*
|
||||
* Now (eg) xOBxxx 1f
|
||||
|
@ -791,11 +788,11 @@ md_assemble (instruction_string)
|
|||
/* b<cond> */
|
||||
*opcode_low_byteP ^= 1;
|
||||
/* To reverse the condition in a VAX branch,
|
||||
complement the lowest order bit. */
|
||||
complement the lowest order bit. */
|
||||
p = frag_more (7);
|
||||
p[0] = 6;
|
||||
p[1] = VAX_JMP;
|
||||
p[2] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
p[2] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
md_number_to_chars (p + 3, this_add_number, 4);
|
||||
/*
|
||||
* Now (eg) BLEQ 1f
|
||||
|
@ -810,7 +807,7 @@ md_assemble (instruction_string)
|
|||
/* to_seg != now_seg && to_seg != SEG_UNKNOWN && to_Seg != SEG_ABSOLUTE */
|
||||
if (nbytes > 0)
|
||||
{
|
||||
/* Pc-relative. Conventional relocation. */
|
||||
/* Pc-relative. Conventional relocation. */
|
||||
know (!(opcode_as_number & VIT_OPCODE_SYNTHETIC));
|
||||
p = frag_more (nbytes);
|
||||
fix_new (frag_now, p - frag_now->fr_literal,
|
||||
|
@ -833,7 +830,7 @@ md_assemble (instruction_string)
|
|||
p + 1 - frag_now->fr_literal, 4,
|
||||
this_add_symbol,
|
||||
this_add_number, 1, NO_RELOC);
|
||||
/* Now eg JMP foo or JSB foo. */
|
||||
/* Now eg JMP foo or JSB foo. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -882,7 +879,7 @@ md_assemble (instruction_string)
|
|||
else
|
||||
{
|
||||
know (operandP->vop_width == VAX_WIDTH_CONDITIONAL_JUMP);
|
||||
*opcode_low_byteP ^= 1; /* Reverse branch condition. */
|
||||
*opcode_low_byteP ^= 1; /* Reverse branch condition. */
|
||||
p = frag_more (7);
|
||||
p[0] = 6;
|
||||
p[1] = VAX_JMP;
|
||||
|
@ -897,8 +894,8 @@ md_assemble (instruction_string)
|
|||
}
|
||||
else
|
||||
{
|
||||
know (operandP->vop_access != 'b'); /* So it is ordinary operand. */
|
||||
know (operandP->vop_access != ' '); /* ' ' target-independent: elsewhere. */
|
||||
know (operandP->vop_access != 'b'); /* So it is ordinary operand. */
|
||||
know (operandP->vop_access != ' '); /* ' ' target-independent: elsewhere. */
|
||||
know (operandP->vop_access == 'a'
|
||||
|| operandP->vop_access == 'm'
|
||||
|| operandP->vop_access == 'r'
|
||||
|
@ -929,10 +926,10 @@ md_assemble (instruction_string)
|
|||
if (operandP->vop_reg >= 0 && (operandP->vop_mode < 8
|
||||
|| (operandP->vop_reg != 0xF && operandP->vop_mode < 10)))
|
||||
{
|
||||
/* One byte operand. */
|
||||
/* One byte operand. */
|
||||
know (operandP->vop_mode > 3);
|
||||
FRAG_APPEND_1_CHAR (operandP->vop_mode << 4 | operandP->vop_reg);
|
||||
/* All 1-bytes except S^# happen here. */
|
||||
/* All 1-bytes except S^# happen here. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -954,7 +951,7 @@ md_assemble (instruction_string)
|
|||
/* At is the only context we need to carry
|
||||
to other side of relax() process. Must
|
||||
be in the correct bit position of VAX
|
||||
operand spec. byte. */
|
||||
operand spec. byte. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -972,9 +969,9 @@ md_assemble (instruction_string)
|
|||
if (this_add_symbol == NULL)
|
||||
{
|
||||
know (to_seg == SEG_ABSOLUTE);
|
||||
/* Do @#foo: simpler relocation than foo-.(pc) anyway. */
|
||||
/* Do @#foo: simpler relocation than foo-.(pc) anyway. */
|
||||
p = frag_more (5);
|
||||
p[0] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
p[0] = VAX_ABSOLUTE_MODE; /* @#... */
|
||||
md_number_to_chars (p + 1, this_add_number, 4);
|
||||
if (length && length != 4)
|
||||
{
|
||||
|
@ -1004,7 +1001,7 @@ md_assemble (instruction_string)
|
|||
if (length == 0)
|
||||
{
|
||||
know (operandP->vop_short == ' ');
|
||||
length = 4; /* Longest possible. */
|
||||
length = 4; /* Longest possible. */
|
||||
}
|
||||
p = frag_more (length + 1);
|
||||
p[0] = 0xF | ((at + "?\12\14?\16"[length]) << 4);
|
||||
|
@ -1035,7 +1032,7 @@ md_assemble (instruction_string)
|
|||
}
|
||||
if (length == 0
|
||||
&& to_seg == SEG_ABSOLUTE && (expP->X_op != O_big)
|
||||
&& operandP->vop_mode == 8 /* No '@'. */
|
||||
&& operandP->vop_mode == 8 /* No '@'. */
|
||||
&& this_add_number < 64)
|
||||
{
|
||||
operandP->vop_short = 's';
|
||||
|
@ -1046,7 +1043,7 @@ md_assemble (instruction_string)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* I^#... */
|
||||
/* I^#... */
|
||||
know (nbytes);
|
||||
p = frag_more (nbytes + 1);
|
||||
know (operandP->vop_reg == 0xF);
|
||||
|
@ -1059,7 +1056,7 @@ md_assemble (instruction_string)
|
|||
* are to be 0xFF or 0x00. BSD4.2 & RMS
|
||||
* say use 0x00. OK --- but this
|
||||
* assembler needs ANOTHER rewrite to
|
||||
* cope properly with this bug. */
|
||||
* cope properly with this bug. */
|
||||
md_number_to_chars (p + 1, this_add_number, min (4, nbytes));
|
||||
if (nbytes > 4)
|
||||
{
|
||||
|
@ -1074,7 +1071,7 @@ md_assemble (instruction_string)
|
|||
* Problem here is to get the bytes
|
||||
* in the right order. We stored
|
||||
* our constant as LITTLENUMs, not
|
||||
* bytes. */
|
||||
* bytes. */
|
||||
LITTLENUM_TYPE *lP;
|
||||
|
||||
lP = floatP->low;
|
||||
|
@ -1170,13 +1167,13 @@ md_estimate_size_before_relax (fragP, segment)
|
|||
{
|
||||
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF):
|
||||
if (S_GET_SEGMENT (fragP->fr_symbol) == segment)
|
||||
{ /* A relaxable case. */
|
||||
{ /* A relaxable case. */
|
||||
fragP->fr_subtype = ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = fragP->fr_literal + old_fr_fix;
|
||||
p[0] |= VAX_PC_RELATIVE_MODE; /* Preserve @ bit. */
|
||||
p[0] |= VAX_PC_RELATIVE_MODE; /* Preserve @ bit. */
|
||||
fragP->fr_fix += 1 + 4;
|
||||
fix_new (fragP, old_fr_fix + 1, 4, fragP->fr_symbol,
|
||||
fragP->fr_offset, 1, NO_RELOC);
|
||||
|
@ -1192,7 +1189,7 @@ md_estimate_size_before_relax (fragP, segment)
|
|||
else
|
||||
{
|
||||
p = fragP->fr_literal + old_fr_fix;
|
||||
*fragP->fr_opcode ^= 1; /* Reverse sense of branch. */
|
||||
*fragP->fr_opcode ^= 1; /* Reverse sense of branch. */
|
||||
p[0] = 6;
|
||||
p[1] = VAX_JMP;
|
||||
p[2] = VAX_PC_RELATIVE_MODE; /* ...(PC) */
|
||||
|
@ -1284,11 +1281,11 @@ md_convert_frag (headers, seg, fragP)
|
|||
segT seg;
|
||||
fragS *fragP;
|
||||
{
|
||||
char *addressP; /* -> _var to change. */
|
||||
char *opcodeP; /* -> opcode char(s) to change. */
|
||||
char *addressP; /* -> _var to change. */
|
||||
char *opcodeP; /* -> opcode char(s) to change. */
|
||||
short int length_code; /* 2=long 1=word 0=byte */
|
||||
short int extension = 0; /* Size of relaxed address. */
|
||||
/* Added to fr_fix: incl. ALL var chars. */
|
||||
short int extension = 0; /* Size of relaxed address. */
|
||||
/* Added to fr_fix: incl. ALL var chars. */
|
||||
symbolS *symbolP;
|
||||
long where;
|
||||
long address_of_var;
|
||||
|
@ -1311,22 +1308,22 @@ md_convert_frag (headers, seg, fragP)
|
|||
{
|
||||
|
||||
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE):
|
||||
know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
|
||||
addressP[0] |= 0xAF; /* Byte displacement. */
|
||||
know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
|
||||
addressP[0] |= 0xAF; /* Byte displacement. */
|
||||
addressP[1] = target_address - (address_of_var + 2);
|
||||
extension = 2;
|
||||
break;
|
||||
|
||||
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_WORD):
|
||||
know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
|
||||
addressP[0] |= 0xCF; /* Word displacement. */
|
||||
know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
|
||||
addressP[0] |= 0xCF; /* Word displacement. */
|
||||
md_number_to_chars (addressP + 1, target_address - (address_of_var + 3), 2);
|
||||
extension = 3;
|
||||
break;
|
||||
|
||||
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_LONG):
|
||||
know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
|
||||
addressP[0] |= 0xEF; /* Long word displacement. */
|
||||
know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
|
||||
addressP[0] |= 0xEF; /* Long word displacement. */
|
||||
md_number_to_chars (addressP + 1, target_address - (address_of_var + 5), 4);
|
||||
extension = 5;
|
||||
break;
|
||||
|
@ -1337,7 +1334,7 @@ md_convert_frag (headers, seg, fragP)
|
|||
break;
|
||||
|
||||
case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD):
|
||||
opcodeP[0] ^= 1; /* Reverse sense of test. */
|
||||
opcodeP[0] ^= 1; /* Reverse sense of test. */
|
||||
addressP[0] = 3;
|
||||
addressP[1] = VAX_BRB + VAX_WIDEN_WORD;
|
||||
md_number_to_chars (addressP + 2, target_address - (address_of_var + 4), 2);
|
||||
|
@ -1345,7 +1342,7 @@ md_convert_frag (headers, seg, fragP)
|
|||
break;
|
||||
|
||||
case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_LONG):
|
||||
opcodeP[0] ^= 1; /* Reverse sense of test. */
|
||||
opcodeP[0] ^= 1; /* Reverse sense of test. */
|
||||
addressP[0] = 6;
|
||||
addressP[1] = VAX_JMP;
|
||||
addressP[2] = VAX_PC_RELATIVE_MODE;
|
||||
|
@ -1423,7 +1420,7 @@ md_convert_frag (headers, seg, fragP)
|
|||
On vax: first 4 bytes are normal unsigned long, next three bytes
|
||||
are symbolnum, least sig. byte first. Last byte is broken up with
|
||||
the upper nibble as nuthin, bit 3 as extern, bits 2 & 1 as length, and
|
||||
bit 0 as pcrel. */
|
||||
bit 0 as pcrel. */
|
||||
#ifdef comment
|
||||
void
|
||||
md_ri_to_chars (the_bytes, ri)
|
||||
|
@ -1442,7 +1439,7 @@ md_ri_to_chars (the_bytes, ri)
|
|||
|
||||
#endif /* comment */
|
||||
|
||||
void
|
||||
void
|
||||
tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
|
||||
char *where;
|
||||
fixS *fixP;
|
||||
|
@ -1556,10 +1553,10 @@ static const short int vax_operand_width_size[256] =
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 8, 0, 4, 8, 16, 0, 0, 0, 4, 0, 0,16, /* ..b.d.fgh...l..o */
|
||||
0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, /* .q.....w........ */
|
||||
0, 0, 1, 0, 8, 0, 4, 8, 16, 0, 0, 0, 4, 0, 0,16, /* ..b.d.fgh...l..o */
|
||||
0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, /* .q.....w........ */
|
||||
0, 0, 1, 0, 8, 0, 4, 8, 16, 0, 0, 0, 4, 0, 0,16, /* ..b.d.fgh...l..o */
|
||||
0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, /* .q.....w........ */
|
||||
0, 0, 1, 0, 8, 0, 4, 8, 16, 0, 0, 0, 4, 0, 0,16, /* ..b.d.fgh...l..o */
|
||||
0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, /* .q.....w........ */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -1676,8 +1673,8 @@ static const struct vot
|
|||
{"jsobgeq", {"mlb:", 0xC00000f4}},
|
||||
{"jsobgtr", {"mlb:", 0xC00000f5}},
|
||||
|
||||
/* CASEx has no branch addresses in our conception of it. */
|
||||
/* You should use ".word ..." statements after the "case ...". */
|
||||
/* CASEx has no branch addresses in our conception of it. */
|
||||
/* You should use ".word ..." statements after the "case ...". */
|
||||
|
||||
{"", {"", 0}} /* empty is end sentinel */
|
||||
|
||||
|
@ -1696,7 +1693,7 @@ static const struct vot
|
|||
|
||||
static const char *
|
||||
vip_begin (synthetic_too, immediate, indirect, displen)
|
||||
int synthetic_too; /* 1 means include jXXX op-codes. */
|
||||
int synthetic_too; /* 1 means include jXXX op-codes. */
|
||||
const char *immediate, *indirect, *displen;
|
||||
{
|
||||
const struct vot *vP; /* scan votstrs */
|
||||
|
@ -1718,7 +1715,6 @@ vip_begin (synthetic_too, immediate, indirect, displen)
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* v i p ( )
|
||||
*
|
||||
|
@ -1745,10 +1741,10 @@ vip_begin (synthetic_too, immediate, indirect, displen)
|
|||
|
||||
static void
|
||||
vip (vitP, instring)
|
||||
struct vit *vitP; /* We build an exploded instruction here. */
|
||||
char *instring; /* Text of a vax instruction: we modify. */
|
||||
struct vit *vitP; /* We build an exploded instruction here. */
|
||||
char *instring; /* Text of a vax instruction: we modify. */
|
||||
{
|
||||
/* How to bit-encode this opcode. */
|
||||
/* How to bit-encode this opcode. */
|
||||
struct vot_wot *vwP;
|
||||
/* 1/skip whitespace.2/scan vot_how */
|
||||
char *p;
|
||||
|
@ -1759,16 +1755,16 @@ vip (vitP, instring)
|
|||
struct vop *operandp;
|
||||
/* error over all operands */
|
||||
const char *alloperr;
|
||||
/* Remember char, (we clobber it with '\0' temporarily). */
|
||||
/* Remember char, (we clobber it with '\0' temporarily). */
|
||||
char c;
|
||||
/* Op-code of this instruction. */
|
||||
/* Op-code of this instruction. */
|
||||
vax_opcodeT oc;
|
||||
|
||||
if (*instring == ' ')
|
||||
++instring; /* Skip leading whitespace. */
|
||||
for (p = instring; *p && *p != ' '; p++);; /* MUST end in end-of-string or exactly 1 space. */
|
||||
/* Scanned up to end of operation-code. */
|
||||
/* Operation-code is ended with whitespace. */
|
||||
++instring; /* Skip leading whitespace. */
|
||||
for (p = instring; *p && *p != ' '; p++);; /* MUST end in end-of-string or exactly 1 space. */
|
||||
/* Scanned up to end of operation-code. */
|
||||
/* Operation-code is ended with whitespace. */
|
||||
if (p - instring == 0)
|
||||
{
|
||||
vitP->vit_error = _("No operator");
|
||||
|
@ -1785,7 +1781,7 @@ vip (vitP, instring)
|
|||
* We trust instring points to an op-name, with no whitespace.
|
||||
*/
|
||||
vwP = (struct vot_wot *) hash_find (op_hash, instring);
|
||||
*p = c; /* Restore char after op-code. */
|
||||
*p = c; /* Restore char after op-code. */
|
||||
if (vwP == 0)
|
||||
{
|
||||
vitP->vit_error = _("Unknown operator");
|
||||
|
@ -1808,7 +1804,7 @@ vip (vitP, instring)
|
|||
* we return 32 bits of opcode, including bucky bits, BUT
|
||||
* an opcode length is either 8 or 16 bits for vit_opcode_nbytes.
|
||||
*/
|
||||
oc = vwP->vot_code; /* The op-code. */
|
||||
oc = vwP->vot_code; /* The op-code. */
|
||||
vitP->vit_opcode_nbytes = (oc & 0xFF) >= 0xFD ? 2 : 1;
|
||||
md_number_to_chars (vitP->vit_opcode, oc, 4);
|
||||
count = 0; /* no operands seen yet */
|
||||
|
@ -1837,7 +1833,7 @@ vip (vitP, instring)
|
|||
operandp->vop_nbytes = vax_operand_width_size[(unsigned) howp[1]];
|
||||
operandp->vop_access = howp[0];
|
||||
vip_op (instring, operandp);
|
||||
*q = c; /* Restore input text. */
|
||||
*q = c; /* Restore input text. */
|
||||
if (operandp->vop_error)
|
||||
alloperr = _("Bad operand");
|
||||
instring = q + (c ? 1 : 0); /* next operand (if any) */
|
||||
|
@ -1849,7 +1845,7 @@ vip (vitP, instring)
|
|||
if (!*alloperr)
|
||||
{
|
||||
if (*instring == ' ')
|
||||
instring++; /* Skip whitespace. */
|
||||
instring++; /* Skip whitespace. */
|
||||
if (*instring)
|
||||
alloperr = _("Too many operands");
|
||||
}
|
||||
|
@ -1870,7 +1866,7 @@ char answer[100]; /* human types a line of vax assembler here */
|
|||
char *mybug; /* "" or an internal logic diagnostic */
|
||||
int mycount; /* number of operands */
|
||||
struct vop *myvop; /* scan operands from myvit */
|
||||
int mysynth; /* 1 means want synthetic opcodes. */
|
||||
int mysynth; /* 1 means want synthetic opcodes. */
|
||||
char my_immediate[200];
|
||||
char my_indirect[200];
|
||||
char my_displen[200];
|
||||
|
@ -1949,7 +1945,7 @@ main ()
|
|||
|
||||
/* vax_reg_parse.c - convert a VAX register name to a number */
|
||||
|
||||
/* Copyright (C) 1987 Free Software Foundation, Inc. A part of GNU. */
|
||||
/* Copyright (C) 1987 Free Software Foundation, Inc. A part of GNU. */
|
||||
|
||||
/*
|
||||
* v a x _ r e g _ p a r s e ( )
|
||||
|
@ -2135,7 +2131,6 @@ vax_reg_parse (c1, c2, c3) /* 3 chars of register name */
|
|||
* if the other outputs are to be taken seriously.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Because this module is useful for both VMS and UN*X style assemblers
|
||||
* and because of the variety of UN*X assemblers we must recognise
|
||||
|
@ -2203,7 +2198,7 @@ vip_op_1 (bit, syms)
|
|||
}
|
||||
|
||||
/* Can be called any time. More arguments may appear in future. */
|
||||
static void
|
||||
static void
|
||||
vip_op_defaults (immediate, indirect, displen)
|
||||
const char *immediate;
|
||||
const char *indirect;
|
||||
|
@ -2282,7 +2277,7 @@ vip_op (optext, vopP)
|
|||
/* Input fields: vop_access, vop_width.
|
||||
Output fields: _ndx, _reg, _mode, _short, _warn,
|
||||
_error _expr_begin, _expr_end, _nbytes.
|
||||
vop_nbytes : number of bytes in a datum. */
|
||||
vop_nbytes : number of bytes in a datum. */
|
||||
struct vop *vopP;
|
||||
{
|
||||
/* track operand text forward */
|
||||
|
@ -2305,7 +2300,7 @@ vip_op (optext, vopP)
|
|||
int ndx = 0;
|
||||
/* report illegal operand, ""==OK */
|
||||
/* " " is a FAKE error: means we won */
|
||||
/* ANY err that begins with ' ' is a fake. */
|
||||
/* ANY err that begins with ' ' is a fake. */
|
||||
/* " " is converted to "" before return */
|
||||
const char *err;
|
||||
/* warn about weird modes pf address */
|
||||
|
@ -2321,8 +2316,8 @@ vip_op (optext, vopP)
|
|||
* get the types wrong below, we lose at compile time rather than at
|
||||
* lint or run time.
|
||||
*/
|
||||
char access_mode; /* vop_access. */
|
||||
char width; /* vop_width. */
|
||||
char access_mode; /* vop_access. */
|
||||
char width; /* vop_width. */
|
||||
|
||||
access_mode = vopP->vop_access;
|
||||
width = vopP->vop_width;
|
||||
|
@ -2332,13 +2327,13 @@ vip_op (optext, vopP)
|
|||
|
||||
p = optext;
|
||||
|
||||
if (*p == ' ') /* Expect all whitespace reduced to ' '. */
|
||||
if (*p == ' ') /* Expect all whitespace reduced to ' '. */
|
||||
p++; /* skip over whitespace */
|
||||
|
||||
if ((at = INDIRECTP (*p)) != 0)
|
||||
{ /* 1 if *p=='@'(or '*' for Un*x) */
|
||||
p++; /* at is determined */
|
||||
if (*p == ' ') /* Expect all whitespace reduced to ' '. */
|
||||
if (*p == ' ') /* Expect all whitespace reduced to ' '. */
|
||||
p++; /* skip over whitespace */
|
||||
}
|
||||
|
||||
|
@ -2359,7 +2354,7 @@ vip_op (optext, vopP)
|
|||
len = ' '; /* len is determined */
|
||||
}
|
||||
|
||||
if (*p == ' ') /* Expect all whitespace reduced to ' '. */
|
||||
if (*p == ' ') /* Expect all whitespace reduced to ' '. */
|
||||
p++; /* skip over whitespace */
|
||||
|
||||
if ((hash = IMMEDIATEP (*p)) != 0) /* 1 if *p=='#' ('$' for Un*x) */
|
||||
|
@ -2377,7 +2372,7 @@ vip_op (optext, vopP)
|
|||
;
|
||||
q--; /* now q points at last char of text */
|
||||
|
||||
if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
|
||||
if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
|
||||
q--;
|
||||
/* reverse over whitespace, but don't */
|
||||
/* run back over *p */
|
||||
|
@ -2430,7 +2425,7 @@ vip_op (optext, vopP)
|
|||
* Otherwise, ndx is index register number, and q points before "[...]".
|
||||
*/
|
||||
|
||||
if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
|
||||
if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
|
||||
q--;
|
||||
/* reverse over whitespace, but don't */
|
||||
/* run back over *p */
|
||||
|
@ -2527,7 +2522,7 @@ vip_op (optext, vopP)
|
|||
*/
|
||||
if (!paren)
|
||||
{
|
||||
if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
|
||||
if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
|
||||
q--;
|
||||
/* reverse over whitespace, but don't */
|
||||
/* run back over *p */
|
||||
|
@ -2591,7 +2586,7 @@ vip_op (optext, vopP)
|
|||
err = " ";
|
||||
}
|
||||
|
||||
/* Since nobody seems to use it: comment this 'feature'(?) out for now. */
|
||||
/* Since nobody seems to use it: comment this 'feature'(?) out for now. */
|
||||
#ifdef NEVER
|
||||
/*
|
||||
* Case of stand-alone operand. e.g. ".long foo"
|
||||
|
@ -2944,7 +2939,7 @@ vip_op (optext, vopP)
|
|||
|
||||
*/
|
||||
|
||||
#ifdef TEST /* #Define to use this testbed. */
|
||||
#ifdef TEST /* #Define to use this testbed. */
|
||||
|
||||
/*
|
||||
* Follows a test program for this function.
|
||||
|
@ -3150,7 +3145,7 @@ md_parse_option (c, arg)
|
|||
break;
|
||||
|
||||
#ifdef OBJ_VMS
|
||||
case '+': /* For g++. Hash any name > 31 chars long. */
|
||||
case '+': /* For g++. Hash any name > 31 chars long. */
|
||||
flag_hash_long_names = 1;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* input_scrub.c - Break up input buffers into whole numbers of lines.
|
||||
Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997
|
||||
Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
@ -17,7 +17,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with GAS; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
02111-1307, USA. */
|
||||
|
||||
#include <errno.h> /* Need this to make errno declaration right */
|
||||
#include "as.h"
|
||||
|
@ -52,18 +52,18 @@
|
|||
*/
|
||||
|
||||
#define BEFORE_STRING ("\n")
|
||||
#define AFTER_STRING ("\0") /* memcpy of 0 chars might choke. */
|
||||
#define AFTER_STRING ("\0") /* memcpy of 0 chars might choke. */
|
||||
#define BEFORE_SIZE (1)
|
||||
#define AFTER_SIZE (1)
|
||||
|
||||
static char *buffer_start; /*->1st char of full buffer area. */
|
||||
static char *partial_where; /*->after last full line in buffer. */
|
||||
static int partial_size; /* >=0. Number of chars in partial line in buffer. */
|
||||
static char *buffer_start; /*->1st char of full buffer area. */
|
||||
static char *partial_where; /*->after last full line in buffer. */
|
||||
static int partial_size; /* >=0. Number of chars in partial line in buffer. */
|
||||
static char save_source[AFTER_SIZE];
|
||||
/* Because we need AFTER_STRING just after last */
|
||||
/* full line, it clobbers 1st part of partial */
|
||||
/* line. So we preserve 1st part of partial */
|
||||
/* line here. */
|
||||
/* line here. */
|
||||
static unsigned int buffer_length; /* What is the largest size buffer that */
|
||||
/* input_file_give_next_buffer() could */
|
||||
/* return to us? */
|
||||
|
@ -84,18 +84,18 @@ int macro_nest;
|
|||
but the latest one are saved off in a struct input_save. These files remain
|
||||
open, so we are limited by the number of open files allowed by the
|
||||
underlying OS. We may also sequentially read more than one source file in an
|
||||
assembly. */
|
||||
assembly. */
|
||||
|
||||
/* We must track the physical file and line number for error messages. We also
|
||||
track a "logical" file and line number corresponding to (C?) compiler
|
||||
source line numbers. Whenever we open a file we must fill in
|
||||
physical_input_file. So if it is NULL we have not opened any files yet. */
|
||||
physical_input_file. So if it is NULL we have not opened any files yet. */
|
||||
|
||||
static char *physical_input_file;
|
||||
static char *logical_input_file;
|
||||
|
||||
typedef unsigned int line_numberT; /* 1-origin line number in a source file. */
|
||||
/* A line ends in '\n' or eof. */
|
||||
typedef unsigned int line_numberT; /* 1-origin line number in a source file. */
|
||||
/* A line ends in '\n' or eof. */
|
||||
|
||||
static line_numberT physical_input_line;
|
||||
static int logical_input_line;
|
||||
|
@ -125,13 +125,13 @@ static char *input_scrub_pop PARAMS ((struct input_save *arg));
|
|||
static void as_1_char PARAMS ((unsigned int c, FILE * stream));
|
||||
|
||||
/* Saved information about the file that .include'd this one. When we hit EOF,
|
||||
we automatically pop to that file. */
|
||||
we automatically pop to that file. */
|
||||
|
||||
static struct input_save *next_saved_file;
|
||||
|
||||
/* Push the state of input reading and scrubbing so that we can #include.
|
||||
The return value is a 'void *' (fudged for old compilers) to a save
|
||||
area, which can be restored by passing it to input_scrub_pop(). */
|
||||
area, which can be restored by passing it to input_scrub_pop(). */
|
||||
static struct input_save *
|
||||
input_scrub_push (saved_position)
|
||||
char *saved_position;
|
||||
|
@ -210,10 +210,10 @@ input_scrub_begin ()
|
|||
buffer_start = xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE));
|
||||
memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE);
|
||||
|
||||
/* Line number things. */
|
||||
/* Line number things. */
|
||||
logical_input_line = -1;
|
||||
logical_input_file = (char *) NULL;
|
||||
physical_input_file = NULL; /* No file read yet. */
|
||||
physical_input_file = NULL; /* No file read yet. */
|
||||
next_saved_file = NULL; /* At EOF, don't pop to any other file */
|
||||
do_scrub_begin (flag_m68k_mri);
|
||||
}
|
||||
|
@ -229,9 +229,9 @@ input_scrub_end ()
|
|||
}
|
||||
}
|
||||
|
||||
/* Start reading input from a new file. */
|
||||
/* Start reading input from a new file. */
|
||||
|
||||
char * /* Return start of caller's part of buffer. */
|
||||
char * /* Return start of caller's part of buffer. */
|
||||
input_scrub_new_file (filename)
|
||||
char *filename;
|
||||
{
|
||||
|
@ -243,10 +243,9 @@ input_scrub_new_file (filename)
|
|||
return (buffer_start + BEFORE_SIZE);
|
||||
}
|
||||
|
||||
|
||||
/* Include a file from the current file. Save our state, cause it to
|
||||
be restored on EOF, and begin handling a new file. Same result as
|
||||
input_scrub_new_file. */
|
||||
input_scrub_new_file. */
|
||||
|
||||
char *
|
||||
input_scrub_include_file (filename, position)
|
||||
|
@ -305,7 +304,7 @@ char *
|
|||
input_scrub_next_buffer (bufp)
|
||||
char **bufp;
|
||||
{
|
||||
register char *limit; /*->just after last char of buffer. */
|
||||
register char *limit; /*->just after last char of buffer. */
|
||||
|
||||
if (sb_index >= 0)
|
||||
{
|
||||
|
@ -348,7 +347,7 @@ input_scrub_next_buffer (bufp)
|
|||
+ partial_size);
|
||||
if (limit)
|
||||
{
|
||||
register char *p; /* Find last newline. */
|
||||
register char *p; /* Find last newline. */
|
||||
|
||||
for (p = limit - 1; *p != '\n'; --p)
|
||||
;
|
||||
|
@ -397,11 +396,11 @@ input_scrub_next_buffer (bufp)
|
|||
/* Tell the listing we've finished the file. */
|
||||
LISTING_EOF ();
|
||||
|
||||
/* If we should pop to another file at EOF, do it. */
|
||||
/* If we should pop to another file at EOF, do it. */
|
||||
if (next_saved_file)
|
||||
{
|
||||
*bufp = input_scrub_pop (next_saved_file); /* Pop state */
|
||||
/* partial_where is now correct to return, since we popped it. */
|
||||
/* partial_where is now correct to return, since we popped it. */
|
||||
}
|
||||
}
|
||||
return (partial_where);
|
||||
|
@ -412,9 +411,8 @@ input_scrub_next_buffer (bufp)
|
|||
* messages and so on.
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
seen_at_least_1_file () /* TRUE if we opened any file. */
|
||||
seen_at_least_1_file () /* TRUE if we opened any file. */
|
||||
{
|
||||
return (physical_input_file != NULL);
|
||||
}
|
||||
|
@ -469,7 +467,7 @@ new_logical_line (fname, line_number)
|
|||
* namep should be char * const *, but there are compilers which screw
|
||||
* up declarations like that, and it's easier to avoid it.
|
||||
*/
|
||||
void
|
||||
void
|
||||
as_where (namep, linep)
|
||||
char **namep;
|
||||
unsigned int *linep;
|
||||
|
@ -496,8 +494,6 @@ as_where (namep, linep)
|
|||
} /* as_where() */
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* a s _ h o w m u c h ()
|
||||
*
|
||||
|
@ -507,23 +503,23 @@ as_where (namep, linep)
|
|||
*/
|
||||
void
|
||||
as_howmuch (stream)
|
||||
FILE *stream; /* Opened for write please. */
|
||||
FILE *stream; /* Opened for write please. */
|
||||
{
|
||||
register char *p; /* Scan input line. */
|
||||
register char *p; /* Scan input line. */
|
||||
/* register char c; JF unused */
|
||||
|
||||
for (p = input_line_pointer - 1; *p != '\n'; --p)
|
||||
{
|
||||
}
|
||||
++p; /* p->1st char of line. */
|
||||
++p; /* p->1st char of line. */
|
||||
for (; p <= input_line_pointer; p++)
|
||||
{
|
||||
/* Assume ASCII. EBCDIC & other micro-computer char sets ignored. */
|
||||
/* Assume ASCII. EBCDIC & other micro-computer char sets ignored. */
|
||||
as_1_char ((unsigned char) *p, stream);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
as_1_char (c, stream)
|
||||
unsigned int c;
|
||||
FILE *stream;
|
||||
|
|
Loading…
Reference in New Issue