White space and comment changes. #ifdef __STDC__ becomes #if __STDC__
== 1. Get the declarations right in listing.[hc].
This commit is contained in:
parent
a87b326934
commit
3340f7e5fd
20 changed files with 1028 additions and 1116 deletions
|
@ -43,7 +43,7 @@ man6dir = $(mandir)/man6
|
|||
man7dir = $(mandir)/man7
|
||||
man8dir = $(mandir)/man8
|
||||
man9dir = $(mandir)/man9
|
||||
infodir = $(prefix)/info
|
||||
infodir = $(datadir)/info
|
||||
includedir = $(prefix)/include
|
||||
docdir = $(datadir)/doc
|
||||
|
||||
|
@ -135,6 +135,7 @@ REAL_SOURCES = \
|
|||
$(srcdir)/symbols.c \
|
||||
$(srcdir)/version.c \
|
||||
$(srcdir)/write.c \
|
||||
$(srcdir)/listing.c \
|
||||
$(srcdir)/xmalloc.c \
|
||||
$(srcdir)/xrealloc.c
|
||||
|
||||
|
@ -200,6 +201,7 @@ OBJS = \
|
|||
symbols.o \
|
||||
version.o \
|
||||
write.o \
|
||||
listing.o \
|
||||
xmalloc.o \
|
||||
xrealloc.o
|
||||
|
||||
|
@ -216,11 +218,12 @@ install-info:
|
|||
fake-as: force
|
||||
- rm -f ./as.new
|
||||
cp /bin/as ./fake-as
|
||||
cp ./fake-as ./as.new
|
||||
|
||||
# Now figure out from those variables how to compile and link.
|
||||
|
||||
# This is the variable actually used when we compile.
|
||||
ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
|
||||
ALL_CFLAGS = -g $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
|
||||
|
||||
# Even if ALLOCA is set, don't use it if compiling with GCC.
|
||||
USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi`
|
||||
|
@ -333,6 +336,9 @@ input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
|
|||
targ-cpu.h struc-symbol.h \
|
||||
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
|
||||
input-file.h
|
||||
listing.o : listing.c as.h host.h targ-env.h flonum.h bignum.h \
|
||||
listing.h obj-format.h targ-cpu.h struc-symbol.h write.h expr.h \
|
||||
frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
|
||||
messages.o : messages.c as.h host.h targ-env.h obj-format.h \
|
||||
targ-cpu.h struc-symbol.h \
|
||||
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
|
||||
|
@ -411,12 +417,7 @@ $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
|
|||
# `realclean' also deletes everything that could be regenerated automatically.
|
||||
|
||||
clean:
|
||||
-rm -f $(STAGESTUFF)
|
||||
# Delete the temporary source copies for cross compilation.
|
||||
-rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
|
||||
-rm -f $(HOST_PREFIX_1)obstack.c
|
||||
# Delete the stamp files except stamp-gnulib2.
|
||||
-rm -f core
|
||||
-rm -f $(STAGESTUFF) $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c $(HOST_PREFIX_1)obstack.c core
|
||||
|
||||
# Like clean but also delete the links made to configure gas.
|
||||
cleanconfig: clean
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
Modified by Allen Wirfs-Brock, Instantiations Inc 2/90
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include <stdio.h>
|
||||
#include "as.h" /* For BAD_CASE() only */
|
||||
|
||||
#if !defined(__STDC__) && !defined(const)
|
||||
#if (__STDC__ != 1) && !defined(const)
|
||||
#define const /* Nothing */
|
||||
#endif
|
||||
|
||||
|
|
10
gas/as.c
10
gas/as.c
|
@ -1,5 +1,5 @@
|
|||
/* as.c - GAS main program.
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include "as.h"
|
||||
#include "subsegs.h"
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
/* This prototype for got_sig() is ansi. If you want
|
||||
anything else, then your compiler is lying to you when
|
||||
|
@ -68,7 +68,7 @@ static SIGTY got_sig();
|
|||
static char *stralloc(); /* Make a (safe) copy of a string. */
|
||||
static void perform_an_assembly_pass();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#ifdef DONTDEF
|
||||
static char * gdb_symbol_file_name;
|
||||
|
@ -306,7 +306,7 @@ char **argv;
|
|||
md_end(); /* MACHINE.c */
|
||||
|
||||
#ifndef NO_LISTING
|
||||
listing_print();
|
||||
listing_print("");
|
||||
#endif
|
||||
|
||||
#ifndef VMS
|
||||
|
@ -336,10 +336,10 @@ int argc;
|
|||
char **argv;
|
||||
{
|
||||
int saw_a_file = 0;
|
||||
unsigned int i;
|
||||
need_pass_2 = 0;
|
||||
|
||||
#ifdef MANY_SEGMENTS
|
||||
unsigned int i;
|
||||
|
||||
for (i= SEG_E0; i < SEG_UNKNOWN; i++)
|
||||
{
|
||||
|
|
16
gas/as.h
16
gas/as.h
|
@ -1,5 +1,5 @@
|
|||
/* as.h - global header file
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include "host.h"
|
||||
#include "flonum.h"
|
||||
|
||||
#ifndef __STDC__
|
||||
#if __STDC__ != 1
|
||||
#define volatile /**/
|
||||
#ifndef const
|
||||
#define const /**/
|
||||
|
@ -66,8 +66,8 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "listing.h"
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free xfree
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free xfree
|
||||
|
||||
#define xfree free
|
||||
|
||||
|
@ -288,7 +288,7 @@ typedef struct {
|
|||
int poc_val; /* Value to pass to handler */
|
||||
} pseudo_typeS;
|
||||
|
||||
#if defined(__STDC__) & !defined(NO_STDARG)
|
||||
#if (__STDC__ == 1) & !defined(NO_STDARG)
|
||||
|
||||
int had_errors(void);
|
||||
int had_warnings(void);
|
||||
|
@ -308,7 +308,7 @@ void as_warn();
|
|||
|
||||
#endif /* __STDC__ & !NO_STDARG */
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *app_push(void);
|
||||
char *atof_ieee(char *str, int what_kind, LITTLENUM_TYPE *words);
|
||||
|
@ -345,7 +345,7 @@ void subseg_change(segT seg, int subseg);
|
|||
void subseg_new(segT seg, subsegT subseg);
|
||||
void subsegs_begin(void);
|
||||
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *app_push();
|
||||
char *atof_ieee();
|
||||
|
@ -382,7 +382,7 @@ void subseg_change();
|
|||
void subseg_new();
|
||||
void subsegs_begin();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* this one starts the chain of target dependant headers */
|
||||
#include "targ-env.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* atof_generic.c - turn a string of digits into a Flonum
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
#define bzero(s,n) memset(s,0,n)
|
||||
#endif
|
||||
|
||||
/* #define FALSE (0) */
|
||||
/* #define FALSE (0) */
|
||||
/* #define TRUE (1) */
|
||||
|
||||
/***********************************************************************\
|
||||
|
@ -57,491 +57,464 @@
|
|||
|
||||
Syntax:
|
||||
|
||||
<flonum> ::= <optional-sign> <decimal-number> <optional-exponent>
|
||||
<optional-sign> ::= '+' | '-' | {empty}
|
||||
<decimal-number> ::= <integer>
|
||||
<flonum> ::= <optional-sign> <decimal-number> <optional-exponent>
|
||||
<optional-sign> ::= '+' | '-' | {empty}
|
||||
<decimal-number> ::= <integer>
|
||||
| <integer> <radix-character>
|
||||
| <integer> <radix-character> <integer>
|
||||
| <radix-character> <integer>
|
||||
<optional-exponent> ::= {empty} | <exponent-character> <optional-sign> <integer>
|
||||
<integer> ::= <digit> | <digit> <integer>
|
||||
<digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
|
||||
<exponent-character> ::= {one character from "string_of_decimal_exponent_marks"}
|
||||
<radix-character> ::= {one character from "string_of_decimal_marks"}
|
||||
| <radix-character> <integer>
|
||||
|
||||
<optional-exponent> ::= {empty}
|
||||
| <exponent-character> <optional-sign> <integer>
|
||||
|
||||
<integer> ::= <digit> | <digit> <integer>
|
||||
<digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
|
||||
<exponent-character> ::= {one character from "string_of_decimal_exponent_marks"}
|
||||
<radix-character> ::= {one character from "string_of_decimal_marks"}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int /* 0 if OK */
|
||||
atof_generic (
|
||||
address_of_string_pointer, /* return pointer to just AFTER number we read. */
|
||||
address_of_string_pointer, /* return pointer to just
|
||||
AFTER number we read. */
|
||||
string_of_decimal_marks, /* At most one per number. */
|
||||
string_of_decimal_exponent_marks,
|
||||
address_of_generic_floating_point_number)
|
||||
|
||||
char * * address_of_string_pointer;
|
||||
const char * string_of_decimal_marks;
|
||||
const char * string_of_decimal_exponent_marks;
|
||||
FLONUM_TYPE * address_of_generic_floating_point_number;
|
||||
|
||||
char **address_of_string_pointer;
|
||||
const char *string_of_decimal_marks;
|
||||
const char *string_of_decimal_exponent_marks;
|
||||
FLONUM_TYPE *address_of_generic_floating_point_number;
|
||||
{
|
||||
int return_value; /* 0 means OK. */
|
||||
char * first_digit;
|
||||
/* char *last_digit; JF unused */
|
||||
int number_of_digits_before_decimal;
|
||||
int number_of_digits_after_decimal;
|
||||
long decimal_exponent;
|
||||
int number_of_digits_available;
|
||||
char digits_sign_char;
|
||||
|
||||
int return_value; /* 0 means OK. */
|
||||
char * first_digit;
|
||||
/* char * last_digit; JF unused */
|
||||
int number_of_digits_before_decimal;
|
||||
int number_of_digits_after_decimal;
|
||||
long decimal_exponent;
|
||||
int number_of_digits_available;
|
||||
char digits_sign_char;
|
||||
|
||||
{
|
||||
/*
|
||||
* Scan the input string, abstracting (1)digits (2)decimal mark (3) exponent.
|
||||
* It would be simpler to modify the string, but we don't; just to be nice
|
||||
* to caller.
|
||||
* We need to know how many digits we have, so we can allocate space for
|
||||
* the digits' value.
|
||||
*/
|
||||
|
||||
char * p;
|
||||
char c;
|
||||
int seen_significant_digit;
|
||||
|
||||
first_digit = * address_of_string_pointer;
|
||||
c= *first_digit;
|
||||
if (c=='-' || c=='+')
|
||||
{
|
||||
digits_sign_char = c;
|
||||
first_digit ++;
|
||||
}
|
||||
else
|
||||
digits_sign_char = '+';
|
||||
|
||||
if( (first_digit[0]=='n' || first_digit[0]=='N')
|
||||
&& (first_digit[1]=='a' || first_digit[1]=='A')
|
||||
&& (first_digit[2]=='n' || first_digit[2]=='N')) {
|
||||
address_of_generic_floating_point_number->sign=0;
|
||||
address_of_generic_floating_point_number->exponent=0;
|
||||
address_of_generic_floating_point_number->leader=address_of_generic_floating_point_number->low;
|
||||
(*address_of_string_pointer)=first_digit+3;
|
||||
return 0;
|
||||
}
|
||||
if( (first_digit[0]=='i' || first_digit[0]=='I')
|
||||
&& (first_digit[1]=='n' || first_digit[1]=='N')
|
||||
&& (first_digit[2]=='f' || first_digit[2]=='F')) {
|
||||
address_of_generic_floating_point_number->sign= digits_sign_char=='+' ? 'P' : 'N';
|
||||
address_of_generic_floating_point_number->exponent=0;
|
||||
address_of_generic_floating_point_number->leader=address_of_generic_floating_point_number->low;
|
||||
if( (first_digit[3]=='i' || first_digit[3]=='I')
|
||||
&& (first_digit[4]=='n' || first_digit[4]=='N')
|
||||
&& (first_digit[5]=='i' || first_digit[5]=='I')
|
||||
&& (first_digit[6]=='t' || first_digit[6]=='T')
|
||||
&& (first_digit[7]=='y' || first_digit[7]=='Y'))
|
||||
(*address_of_string_pointer)=first_digit+8;
|
||||
else
|
||||
(*address_of_string_pointer)=first_digit+3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
number_of_digits_before_decimal = 0;
|
||||
number_of_digits_after_decimal = 0;
|
||||
decimal_exponent = 0;
|
||||
seen_significant_digit = 0;
|
||||
for (p = first_digit;
|
||||
((c = * p) != '\0')
|
||||
&& (!c || ! strchr (string_of_decimal_marks, c) )
|
||||
&& (!c || ! strchr (string_of_decimal_exponent_marks, c) );
|
||||
p ++)
|
||||
{
|
||||
if (isdigit(c))
|
||||
{
|
||||
if (seen_significant_digit || c > '0')
|
||||
{
|
||||
number_of_digits_before_decimal ++;
|
||||
seen_significant_digit = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_digit++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break; /* p -> char after pre-decimal digits. */
|
||||
}
|
||||
} /* For each digit before decimal mark. */
|
||||
|
||||
#ifndef OLD_FLOAT_READS
|
||||
/* Ignore trailing 0's after the decimal point. The original code here
|
||||
* (ifdef'd out) does not do this, and numbers like
|
||||
* 4.29496729600000000000e+09 (2**31)
|
||||
* come out inexact for some reason related to length of the digit
|
||||
* string.
|
||||
*/
|
||||
if ( c && strchr(string_of_decimal_marks,c) ){
|
||||
int zeros = 0; /* Length of current string of zeros */
|
||||
|
||||
for ( p++; (c = *p) && isdigit(c); p++ ){
|
||||
if ( c == '0'){
|
||||
zeros++;
|
||||
} else {
|
||||
number_of_digits_after_decimal += 1 + zeros;
|
||||
zeros = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (c && strchr (string_of_decimal_marks, c))
|
||||
{
|
||||
for (p ++;
|
||||
((c = * p) != '\0')
|
||||
&& (!c || ! strchr (string_of_decimal_exponent_marks, c) );
|
||||
p ++)
|
||||
{
|
||||
if (isdigit(c))
|
||||
{
|
||||
number_of_digits_after_decimal ++; /* This may be retracted below. */
|
||||
if (/* seen_significant_digit || */ c > '0')
|
||||
{
|
||||
seen_significant_digit = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! seen_significant_digit)
|
||||
{
|
||||
number_of_digits_after_decimal = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} /* For each digit after decimal mark. */
|
||||
}
|
||||
while(number_of_digits_after_decimal && first_digit[number_of_digits_before_decimal+number_of_digits_after_decimal]=='0')
|
||||
--number_of_digits_after_decimal;
|
||||
/* last_digit = p; JF unused */
|
||||
#endif
|
||||
|
||||
if (c && strchr (string_of_decimal_exponent_marks, c) )
|
||||
{
|
||||
char digits_exponent_sign_char;
|
||||
|
||||
c = * ++ p;
|
||||
if (c && strchr ("+-",c))
|
||||
{
|
||||
digits_exponent_sign_char = c;
|
||||
c = * ++ p;
|
||||
}
|
||||
else
|
||||
{
|
||||
digits_exponent_sign_char = '+';
|
||||
}
|
||||
for (;
|
||||
(c);
|
||||
c = * ++ p)
|
||||
{
|
||||
if (isdigit(c))
|
||||
{
|
||||
decimal_exponent = decimal_exponent * 10 + c - '0';
|
||||
/*
|
||||
* BUG! If we overflow here, we lose!
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (digits_exponent_sign_char == '-')
|
||||
{
|
||||
decimal_exponent = - decimal_exponent;
|
||||
}
|
||||
}
|
||||
* address_of_string_pointer = p;
|
||||
/*
|
||||
* Scan the input string, abstracting (1)digits (2)decimal mark (3) exponent.
|
||||
* It would be simpler to modify the string, but we don't; just to be nice
|
||||
* to caller.
|
||||
* We need to know how many digits we have, so we can allocate space for
|
||||
* the digits' value.
|
||||
*/
|
||||
|
||||
char *p;
|
||||
char c;
|
||||
int seen_significant_digit;
|
||||
|
||||
first_digit = *address_of_string_pointer;
|
||||
c = *first_digit;
|
||||
|
||||
if (c == '-' || c == '+') {
|
||||
digits_sign_char = c;
|
||||
first_digit++;
|
||||
} else
|
||||
digits_sign_char = '+';
|
||||
|
||||
if ((first_digit[0] == 'n' || first_digit[0] == 'N')
|
||||
&& (first_digit[1] == 'a' || first_digit[1] == 'A')
|
||||
&& (first_digit[2] == 'n' || first_digit[2] == 'N')) {
|
||||
address_of_generic_floating_point_number->sign = 0;
|
||||
address_of_generic_floating_point_number->exponent = 0;
|
||||
address_of_generic_floating_point_number->leader =
|
||||
address_of_generic_floating_point_number->low;
|
||||
*address_of_string_pointer = first_digit + 3;
|
||||
return(0);
|
||||
}
|
||||
|
||||
number_of_digits_available =
|
||||
number_of_digits_before_decimal
|
||||
+ number_of_digits_after_decimal;
|
||||
return_value = 0;
|
||||
if (number_of_digits_available == 0)
|
||||
{
|
||||
address_of_generic_floating_point_number -> exponent = 0; /* Not strictly necessary */
|
||||
address_of_generic_floating_point_number -> leader
|
||||
= -1 + address_of_generic_floating_point_number -> low;
|
||||
address_of_generic_floating_point_number -> sign = digits_sign_char;
|
||||
/* We have just concocted (+/-)0.0E0 */
|
||||
}
|
||||
else
|
||||
{
|
||||
LITTLENUM_TYPE * digits_binary_low;
|
||||
int precision;
|
||||
int maximum_useful_digits;
|
||||
int number_of_digits_to_use;
|
||||
int more_than_enough_bits_for_digits;
|
||||
int more_than_enough_littlenums_for_digits;
|
||||
int size_of_digits_in_littlenums;
|
||||
int size_of_digits_in_chars;
|
||||
FLONUM_TYPE power_of_10_flonum;
|
||||
FLONUM_TYPE digits_flonum;
|
||||
|
||||
|
||||
precision = (address_of_generic_floating_point_number -> high
|
||||
- address_of_generic_floating_point_number -> low
|
||||
+ 1
|
||||
); /* Number of destination littlenums. */
|
||||
/* Includes guard bits (two littlenums worth) */
|
||||
maximum_useful_digits = ( ((double) (precision - 2))
|
||||
* ((double) (LITTLENUM_NUMBER_OF_BITS))
|
||||
/ (LOG_TO_BASE_2_OF_10)
|
||||
)
|
||||
+ 2; /* 2 :: guard digits. */
|
||||
if (number_of_digits_available > maximum_useful_digits)
|
||||
{
|
||||
number_of_digits_to_use = maximum_useful_digits;
|
||||
|
||||
if ((first_digit[0] == 'i' || first_digit[0] == 'I')
|
||||
&& (first_digit[1] == 'n' || first_digit[1] == 'N')
|
||||
&& (first_digit[2] == 'f' || first_digit[2] == 'F')) {
|
||||
address_of_generic_floating_point_number->sign =
|
||||
digits_sign_char == '+' ? 'P' : 'N';
|
||||
address_of_generic_floating_point_number->exponent = 0;
|
||||
address_of_generic_floating_point_number->leader =
|
||||
address_of_generic_floating_point_number->low;
|
||||
|
||||
if ((first_digit[3] == 'i'
|
||||
|| first_digit[3] == 'I')
|
||||
&& (first_digit[4] == 'n'
|
||||
|| first_digit[4] == 'N')
|
||||
&& (first_digit[5] == 'i'
|
||||
|| first_digit[5] == 'I')
|
||||
&& (first_digit[6] == 't'
|
||||
|| first_digit[6] == 'T')
|
||||
&& (first_digit[7] == 'y'
|
||||
|| first_digit[7] == 'Y')) {
|
||||
*address_of_string_pointer = first_digit + 8;
|
||||
} else {
|
||||
*address_of_string_pointer = first_digit + 3;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
number_of_digits_before_decimal = 0;
|
||||
number_of_digits_after_decimal = 0;
|
||||
decimal_exponent = 0;
|
||||
seen_significant_digit = 0;
|
||||
for (p = first_digit; (((c = * p) != '\0')
|
||||
&& (!c || ! strchr(string_of_decimal_marks, c))
|
||||
&& (!c || !strchr(string_of_decimal_exponent_marks, c)));
|
||||
p++) {
|
||||
if (isdigit(c)) {
|
||||
if (seen_significant_digit || c > '0') {
|
||||
++number_of_digits_before_decimal;
|
||||
seen_significant_digit = 1;
|
||||
} else {
|
||||
first_digit++;
|
||||
}
|
||||
else
|
||||
{
|
||||
number_of_digits_to_use = number_of_digits_available;
|
||||
} else {
|
||||
break; /* p -> char after pre-decimal digits. */
|
||||
}
|
||||
} /* For each digit before decimal mark. */
|
||||
|
||||
#ifndef OLD_FLOAT_READS
|
||||
/* Ignore trailing 0's after the decimal point. The original code here
|
||||
* (ifdef'd out) does not do this, and numbers like
|
||||
* 4.29496729600000000000e+09 (2**31)
|
||||
* come out inexact for some reason related to length of the digit
|
||||
* string.
|
||||
*/
|
||||
if (c && strchr(string_of_decimal_marks, c)) {
|
||||
int zeros = 0; /* Length of current string of zeros */
|
||||
|
||||
for (p++; (c = *p) && isdigit(c); p++) {
|
||||
if (c == '0') {
|
||||
zeros++;
|
||||
} else {
|
||||
number_of_digits_after_decimal += 1 + zeros;
|
||||
zeros = 0;
|
||||
}
|
||||
decimal_exponent += number_of_digits_before_decimal - number_of_digits_to_use;
|
||||
|
||||
more_than_enough_bits_for_digits
|
||||
= ((((double)number_of_digits_to_use) * LOG_TO_BASE_2_OF_10) + 1);
|
||||
more_than_enough_littlenums_for_digits
|
||||
= ( more_than_enough_bits_for_digits
|
||||
/ LITTLENUM_NUMBER_OF_BITS
|
||||
)
|
||||
+ 2;
|
||||
|
||||
/*
|
||||
* Compute (digits) part. In "12.34E56" this is the "1234" part.
|
||||
* Arithmetic is exact here. If no digits are supplied then
|
||||
* this part is a 0 valued binary integer.
|
||||
* Allocate room to build up the binary number as littlenums.
|
||||
* We want this memory to disappear when we leave this function.
|
||||
* Assume no alignment problems => (room for n objects) ==
|
||||
* n * (room for 1 object).
|
||||
*/
|
||||
|
||||
size_of_digits_in_littlenums = more_than_enough_littlenums_for_digits;
|
||||
size_of_digits_in_chars = size_of_digits_in_littlenums
|
||||
* sizeof( LITTLENUM_TYPE );
|
||||
digits_binary_low = (LITTLENUM_TYPE *)
|
||||
alloca (size_of_digits_in_chars);
|
||||
bzero ((char *)digits_binary_low, size_of_digits_in_chars);
|
||||
|
||||
/* Digits_binary_low[] is allocated and zeroed. */
|
||||
|
||||
{
|
||||
/*
|
||||
* Parse the decimal digits as if * digits_low was in the units position.
|
||||
* Emit a binary number into digits_binary_low[].
|
||||
*
|
||||
* Use a large-precision version of:
|
||||
* (((1st-digit) * 10 + 2nd-digit) * 10 + 3rd-digit ...) * 10 + last-digit
|
||||
*/
|
||||
|
||||
char * p;
|
||||
char c;
|
||||
int count; /* Number of useful digits left to scan. */
|
||||
|
||||
for (p = first_digit, count = number_of_digits_to_use;
|
||||
count;
|
||||
p ++, -- count)
|
||||
{
|
||||
c = * p;
|
||||
if (isdigit(c))
|
||||
{
|
||||
/*
|
||||
* Multiply by 10. Assume can never overflow.
|
||||
* Add this digit to digits_binary_low[].
|
||||
*/
|
||||
|
||||
long carry;
|
||||
LITTLENUM_TYPE * littlenum_pointer;
|
||||
LITTLENUM_TYPE * littlenum_limit;
|
||||
|
||||
littlenum_limit
|
||||
= digits_binary_low
|
||||
+ more_than_enough_littlenums_for_digits
|
||||
- 1;
|
||||
carry = c - '0'; /* char -> binary */
|
||||
for (littlenum_pointer = digits_binary_low;
|
||||
littlenum_pointer <= littlenum_limit;
|
||||
littlenum_pointer ++)
|
||||
{
|
||||
long work;
|
||||
|
||||
work = carry + 10 * (long)(*littlenum_pointer);
|
||||
* littlenum_pointer = work & LITTLENUM_MASK;
|
||||
carry = work >> LITTLENUM_NUMBER_OF_BITS;
|
||||
}
|
||||
if (carry != 0)
|
||||
{
|
||||
/*
|
||||
* We have a GROSS internal error.
|
||||
* This should never happen.
|
||||
*/
|
||||
as_fatal("failed sanity check."); /* RMS prefers abort() to any message. */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++ count; /* '.' doesn't alter digits used count. */
|
||||
} /* if valid digit */
|
||||
} /* for each digit */
|
||||
}
|
||||
|
||||
/*
|
||||
* Digits_binary_low[] properly encodes the value of the digits.
|
||||
* Forget about any high-order littlenums that are 0.
|
||||
*/
|
||||
while (digits_binary_low [size_of_digits_in_littlenums - 1] == 0
|
||||
&& size_of_digits_in_littlenums >= 2)
|
||||
size_of_digits_in_littlenums --;
|
||||
|
||||
digits_flonum . low = digits_binary_low;
|
||||
digits_flonum . high = digits_binary_low + size_of_digits_in_littlenums - 1;
|
||||
digits_flonum . leader = digits_flonum . high;
|
||||
digits_flonum . exponent = 0;
|
||||
/*
|
||||
* The value of digits_flonum . sign should not be important.
|
||||
* We have already decided the output's sign.
|
||||
* We trust that the sign won't influence the other parts of the number!
|
||||
* So we give it a value for these reasons:
|
||||
* (1) courtesy to humans reading/debugging
|
||||
* these numbers so they don't get excited about strange values
|
||||
* (2) in future there may be more meaning attached to sign,
|
||||
* and what was
|
||||
* harmless noise may become disruptive, ill-conditioned (or worse)
|
||||
* input.
|
||||
*/
|
||||
digits_flonum . sign = '+';
|
||||
|
||||
{
|
||||
/*
|
||||
* Compute the mantssa (& exponent) of the power of 10.
|
||||
* If sucessful, then multiply the power of 10 by the digits
|
||||
* giving return_binary_mantissa and return_binary_exponent.
|
||||
*/
|
||||
|
||||
LITTLENUM_TYPE *power_binary_low;
|
||||
int decimal_exponent_is_negative;
|
||||
/* This refers to the "-56" in "12.34E-56". */
|
||||
/* FALSE: decimal_exponent is positive (or 0) */
|
||||
/* TRUE: decimal_exponent is negative */
|
||||
FLONUM_TYPE temporary_flonum;
|
||||
LITTLENUM_TYPE *temporary_binary_low;
|
||||
int size_of_power_in_littlenums;
|
||||
int size_of_power_in_chars;
|
||||
|
||||
size_of_power_in_littlenums = precision;
|
||||
/* Precision has a built-in fudge factor so we get a few guard bits. */
|
||||
|
||||
|
||||
decimal_exponent_is_negative = decimal_exponent < 0;
|
||||
if (decimal_exponent_is_negative)
|
||||
{
|
||||
decimal_exponent = - decimal_exponent;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (c && strchr(string_of_decimal_marks, c)) {
|
||||
for (p++; (((c = *p) != '\0')
|
||||
&& (!c || !strchr(string_of_decimal_exponent_marks, c)));
|
||||
p++) {
|
||||
if (isdigit(c)) {
|
||||
number_of_digits_after_decimal++; /* This may be retracted below. */
|
||||
if (/* seen_significant_digit || */ c > '0') {
|
||||
seen_significant_digit = TRUE;
|
||||
}
|
||||
/* From now on: the decimal exponent is > 0. Its sign is seperate. */
|
||||
|
||||
size_of_power_in_chars
|
||||
= size_of_power_in_littlenums
|
||||
* sizeof( LITTLENUM_TYPE ) + 2;
|
||||
power_binary_low = (LITTLENUM_TYPE *) alloca ( size_of_power_in_chars );
|
||||
temporary_binary_low = (LITTLENUM_TYPE *) alloca ( size_of_power_in_chars );
|
||||
bzero ((char *)power_binary_low, size_of_power_in_chars);
|
||||
* power_binary_low = 1;
|
||||
power_of_10_flonum . exponent = 0;
|
||||
power_of_10_flonum . low = power_binary_low;
|
||||
power_of_10_flonum . leader = power_binary_low;
|
||||
power_of_10_flonum . high = power_binary_low + size_of_power_in_littlenums - 1;
|
||||
power_of_10_flonum . sign = '+';
|
||||
temporary_flonum . low = temporary_binary_low;
|
||||
temporary_flonum . high = temporary_binary_low + size_of_power_in_littlenums - 1;
|
||||
/*
|
||||
* (power) == 1.
|
||||
* Space for temporary_flonum allocated.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ...
|
||||
*
|
||||
* WHILE more bits
|
||||
* DO find next bit (with place value)
|
||||
* multiply into power mantissa
|
||||
* OD
|
||||
*/
|
||||
{
|
||||
int place_number_limit;
|
||||
/* Any 10^(2^n) whose "n" exceeds this */
|
||||
/* value will fall off the end of */
|
||||
/* flonum_XXXX_powers_of_ten[]. */
|
||||
int place_number;
|
||||
const FLONUM_TYPE * multiplicand; /* -> 10^(2^n) */
|
||||
|
||||
place_number_limit = table_size_of_flonum_powers_of_ten;
|
||||
multiplicand
|
||||
= ( decimal_exponent_is_negative
|
||||
? flonum_negative_powers_of_ten
|
||||
: flonum_positive_powers_of_ten);
|
||||
for (place_number = 1; /* Place value of this bit of exponent. */
|
||||
decimal_exponent; /* Quit when no more 1 bits in exponent. */
|
||||
decimal_exponent >>= 1
|
||||
, place_number ++)
|
||||
{
|
||||
if (decimal_exponent & 1)
|
||||
{
|
||||
if (place_number > place_number_limit)
|
||||
{
|
||||
/*
|
||||
* The decimal exponent has a magnitude so great that
|
||||
* our tables can't help us fragment it. Although this
|
||||
* routine is in error because it can't imagine a
|
||||
* number that big, signal an error as if it is the
|
||||
* user's fault for presenting such a big number.
|
||||
*/
|
||||
return_value = ERROR_EXPONENT_OVERFLOW;
|
||||
/*
|
||||
* quit out of loop gracefully
|
||||
*/
|
||||
decimal_exponent = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef TRACE
|
||||
printf("before multiply, place_number = %d., power_of_10_flonum:\n", place_number);
|
||||
flonum_print( & power_of_10_flonum );
|
||||
(void)putchar('\n');
|
||||
} else {
|
||||
if (!seen_significant_digit) {
|
||||
number_of_digits_after_decimal = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} /* For each digit after decimal mark. */
|
||||
}
|
||||
|
||||
while (number_of_digits_after_decimal && first_digit[number_of_digits_before_decimal
|
||||
+ number_of_digits_after_decimal] == '0')
|
||||
--number_of_digits_after_decimal;
|
||||
/* last_digit = p; JF unused */
|
||||
#endif
|
||||
flonum_multip(multiplicand + place_number, &power_of_10_flonum, &temporary_flonum);
|
||||
flonum_copy (& temporary_flonum, & power_of_10_flonum);
|
||||
} /* If this bit of decimal_exponent was computable.*/
|
||||
} /* If this bit of decimal_exponent was set. */
|
||||
} /* For each bit of binary representation of exponent */
|
||||
|
||||
if (c && strchr(string_of_decimal_exponent_marks, c) ) {
|
||||
char digits_exponent_sign_char;
|
||||
|
||||
c = *++p;
|
||||
if (c && strchr ("+-",c)) {
|
||||
digits_exponent_sign_char = c;
|
||||
c = *++p;
|
||||
} else {
|
||||
digits_exponent_sign_char = '+';
|
||||
}
|
||||
|
||||
for ( ; (c); c = *++p) {
|
||||
if (isdigit(c)) {
|
||||
decimal_exponent = decimal_exponent * 10 + c - '0';
|
||||
/*
|
||||
* BUG! If we overflow here, we lose!
|
||||
*/
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (digits_exponent_sign_char == '-') {
|
||||
decimal_exponent = -decimal_exponent;
|
||||
}
|
||||
}
|
||||
|
||||
*address_of_string_pointer = p;
|
||||
|
||||
|
||||
|
||||
number_of_digits_available =
|
||||
number_of_digits_before_decimal + number_of_digits_after_decimal;
|
||||
return_value = 0;
|
||||
if (number_of_digits_available == 0) {
|
||||
address_of_generic_floating_point_number->exponent = 0; /* Not strictly necessary */
|
||||
address_of_generic_floating_point_number->leader
|
||||
= -1 + address_of_generic_floating_point_number->low;
|
||||
address_of_generic_floating_point_number->sign = digits_sign_char;
|
||||
/* We have just concocted (+/-)0.0E0 */
|
||||
|
||||
} else {
|
||||
int count; /* Number of useful digits left to scan. */
|
||||
|
||||
LITTLENUM_TYPE *digits_binary_low;
|
||||
int precision;
|
||||
int maximum_useful_digits;
|
||||
int number_of_digits_to_use;
|
||||
int more_than_enough_bits_for_digits;
|
||||
int more_than_enough_littlenums_for_digits;
|
||||
int size_of_digits_in_littlenums;
|
||||
int size_of_digits_in_chars;
|
||||
FLONUM_TYPE power_of_10_flonum;
|
||||
FLONUM_TYPE digits_flonum;
|
||||
|
||||
precision = (address_of_generic_floating_point_number->high
|
||||
- address_of_generic_floating_point_number->low
|
||||
+ 1); /* Number of destination littlenums. */
|
||||
|
||||
/* Includes guard bits (two littlenums worth) */
|
||||
maximum_useful_digits = (((double) (precision - 2))
|
||||
* ((double) (LITTLENUM_NUMBER_OF_BITS))
|
||||
/ (LOG_TO_BASE_2_OF_10))
|
||||
+ 2; /* 2 :: guard digits. */
|
||||
|
||||
if (number_of_digits_available > maximum_useful_digits) {
|
||||
number_of_digits_to_use = maximum_useful_digits;
|
||||
} else {
|
||||
number_of_digits_to_use = number_of_digits_available;
|
||||
}
|
||||
|
||||
decimal_exponent += number_of_digits_before_decimal - number_of_digits_to_use;
|
||||
|
||||
more_than_enough_bits_for_digits
|
||||
= ((((double)number_of_digits_to_use) * LOG_TO_BASE_2_OF_10) + 1);
|
||||
|
||||
more_than_enough_littlenums_for_digits
|
||||
= (more_than_enough_bits_for_digits
|
||||
/ LITTLENUM_NUMBER_OF_BITS)
|
||||
+ 2;
|
||||
|
||||
/*
|
||||
* Compute (digits) part. In "12.34E56" this is the "1234" part.
|
||||
* Arithmetic is exact here. If no digits are supplied then
|
||||
* this part is a 0 valued binary integer.
|
||||
* Allocate room to build up the binary number as littlenums.
|
||||
* We want this memory to disappear when we leave this function.
|
||||
* Assume no alignment problems => (room for n objects) ==
|
||||
* n * (room for 1 object).
|
||||
*/
|
||||
|
||||
size_of_digits_in_littlenums = more_than_enough_littlenums_for_digits;
|
||||
size_of_digits_in_chars = size_of_digits_in_littlenums
|
||||
* sizeof(LITTLENUM_TYPE);
|
||||
|
||||
digits_binary_low = (LITTLENUM_TYPE *)
|
||||
alloca(size_of_digits_in_chars);
|
||||
|
||||
bzero((char *)digits_binary_low, size_of_digits_in_chars);
|
||||
|
||||
/* Digits_binary_low[] is allocated and zeroed. */
|
||||
|
||||
/*
|
||||
* Parse the decimal digits as if * digits_low was in the units position.
|
||||
* Emit a binary number into digits_binary_low[].
|
||||
*
|
||||
* Use a large-precision version of:
|
||||
* (((1st-digit) * 10 + 2nd-digit) * 10 + 3rd-digit ...) * 10 + last-digit
|
||||
*/
|
||||
|
||||
for (p = first_digit, count = number_of_digits_to_use; count; p++, --count) {
|
||||
c = *p;
|
||||
if (isdigit(c)) {
|
||||
/*
|
||||
* Multiply by 10. Assume can never overflow.
|
||||
* Add this digit to digits_binary_low[].
|
||||
*/
|
||||
|
||||
long carry;
|
||||
LITTLENUM_TYPE *littlenum_pointer;
|
||||
LITTLENUM_TYPE *littlenum_limit;
|
||||
|
||||
littlenum_limit = digits_binary_low
|
||||
+ more_than_enough_littlenums_for_digits
|
||||
- 1;
|
||||
|
||||
carry = c - '0'; /* char -> binary */
|
||||
|
||||
for (littlenum_pointer = digits_binary_low;
|
||||
littlenum_pointer <= littlenum_limit;
|
||||
littlenum_pointer++) {
|
||||
long work;
|
||||
|
||||
work = carry + 10 * (long) (*littlenum_pointer);
|
||||
*littlenum_pointer = work & LITTLENUM_MASK;
|
||||
carry = work >> LITTLENUM_NUMBER_OF_BITS;
|
||||
}
|
||||
|
||||
if (carry != 0) {
|
||||
/*
|
||||
* We have a GROSS internal error.
|
||||
* This should never happen.
|
||||
*/
|
||||
as_fatal("failed sanity check."); /* RMS prefers abort() to any message. */
|
||||
}
|
||||
} else {
|
||||
++ count; /* '.' doesn't alter digits used count. */
|
||||
} /* if valid digit */
|
||||
} /* for each digit */
|
||||
|
||||
|
||||
/*
|
||||
* Digits_binary_low[] properly encodes the value of the digits.
|
||||
* Forget about any high-order littlenums that are 0.
|
||||
*/
|
||||
while (digits_binary_low[size_of_digits_in_littlenums - 1] == 0
|
||||
&& size_of_digits_in_littlenums >= 2)
|
||||
size_of_digits_in_littlenums--;
|
||||
|
||||
digits_flonum.low = digits_binary_low;
|
||||
digits_flonum.high = digits_binary_low + size_of_digits_in_littlenums - 1;
|
||||
digits_flonum.leader = digits_flonum.high;
|
||||
digits_flonum.exponent = 0;
|
||||
/*
|
||||
* The value of digits_flonum . sign should not be important.
|
||||
* We have already decided the output's sign.
|
||||
* We trust that the sign won't influence the other parts of the number!
|
||||
* So we give it a value for these reasons:
|
||||
* (1) courtesy to humans reading/debugging
|
||||
* these numbers so they don't get excited about strange values
|
||||
* (2) in future there may be more meaning attached to sign,
|
||||
* and what was
|
||||
* harmless noise may become disruptive, ill-conditioned (or worse)
|
||||
* input.
|
||||
*/
|
||||
digits_flonum.sign = '+';
|
||||
|
||||
{
|
||||
/*
|
||||
* Compute the mantssa (& exponent) of the power of 10.
|
||||
* If sucessful, then multiply the power of 10 by the digits
|
||||
* giving return_binary_mantissa and return_binary_exponent.
|
||||
*/
|
||||
|
||||
LITTLENUM_TYPE *power_binary_low;
|
||||
int decimal_exponent_is_negative;
|
||||
/* This refers to the "-56" in "12.34E-56". */
|
||||
/* FALSE: decimal_exponent is positive (or 0) */
|
||||
/* TRUE: decimal_exponent is negative */
|
||||
FLONUM_TYPE temporary_flonum;
|
||||
LITTLENUM_TYPE *temporary_binary_low;
|
||||
int size_of_power_in_littlenums;
|
||||
int size_of_power_in_chars;
|
||||
|
||||
size_of_power_in_littlenums = precision;
|
||||
/* Precision has a built-in fudge factor so we get a few guard bits. */
|
||||
|
||||
decimal_exponent_is_negative = decimal_exponent < 0;
|
||||
if (decimal_exponent_is_negative) {
|
||||
decimal_exponent = -decimal_exponent;
|
||||
}
|
||||
|
||||
/* From now on: the decimal exponent is > 0. Its sign is seperate. */
|
||||
|
||||
size_of_power_in_chars = size_of_power_in_littlenums
|
||||
* sizeof(LITTLENUM_TYPE) + 2;
|
||||
|
||||
power_binary_low = (LITTLENUM_TYPE *) alloca(size_of_power_in_chars);
|
||||
temporary_binary_low = (LITTLENUM_TYPE *) alloca(size_of_power_in_chars);
|
||||
bzero((char *)power_binary_low, size_of_power_in_chars);
|
||||
* power_binary_low = 1;
|
||||
power_of_10_flonum.exponent = 0;
|
||||
power_of_10_flonum.low = power_binary_low;
|
||||
power_of_10_flonum.leader = power_binary_low;
|
||||
power_of_10_flonum.high = power_binary_low + size_of_power_in_littlenums - 1;
|
||||
power_of_10_flonum.sign = '+';
|
||||
temporary_flonum.low = temporary_binary_low;
|
||||
temporary_flonum.high = temporary_binary_low + size_of_power_in_littlenums - 1;
|
||||
/*
|
||||
* (power) == 1.
|
||||
* Space for temporary_flonum allocated.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ...
|
||||
*
|
||||
* WHILE more bits
|
||||
* DO find next bit (with place value)
|
||||
* multiply into power mantissa
|
||||
* OD
|
||||
*/
|
||||
{
|
||||
int place_number_limit;
|
||||
/* Any 10^(2^n) whose "n" exceeds this */
|
||||
/* value will fall off the end of */
|
||||
/* flonum_XXXX_powers_of_ten[]. */
|
||||
int place_number;
|
||||
const FLONUM_TYPE *multiplicand; /* -> 10^(2^n) */
|
||||
|
||||
place_number_limit = table_size_of_flonum_powers_of_ten;
|
||||
|
||||
multiplicand = (decimal_exponent_is_negative
|
||||
? flonum_negative_powers_of_ten
|
||||
: flonum_positive_powers_of_ten);
|
||||
|
||||
for (place_number = 1; /* Place value of this bit of exponent. */
|
||||
decimal_exponent; /* Quit when no more 1 bits in exponent. */
|
||||
decimal_exponent >>= 1, place_number++) {
|
||||
if (decimal_exponent & 1) {
|
||||
if (place_number > place_number_limit) {
|
||||
/*
|
||||
* The decimal exponent has a magnitude so great that
|
||||
* our tables can't help us fragment it. Although this
|
||||
* routine is in error because it can't imagine a
|
||||
* number that big, signal an error as if it is the
|
||||
* user's fault for presenting such a big number.
|
||||
*/
|
||||
return_value = ERROR_EXPONENT_OVERFLOW;
|
||||
/*
|
||||
* quit out of loop gracefully
|
||||
*/
|
||||
decimal_exponent = 0;
|
||||
} else {
|
||||
#ifdef TRACE
|
||||
printf( " after computing power_of_10_flonum: " );
|
||||
flonum_print( & power_of_10_flonum );
|
||||
(void)putchar('\n');
|
||||
printf("before multiply, place_number = %d., power_of_10_flonum:\n",
|
||||
place_number);
|
||||
|
||||
flonum_print(&power_of_10_flonum);
|
||||
(void)putchar('\n');
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* power_of_10_flonum is power of ten in binary (mantissa) , (exponent).
|
||||
* It may be the number 1, in which case we don't NEED to multiply.
|
||||
*
|
||||
* Multiply (decimal digits) by power_of_10_flonum.
|
||||
*/
|
||||
|
||||
flonum_multip (& power_of_10_flonum, & digits_flonum, address_of_generic_floating_point_number);
|
||||
/* Assert sign of the number we made is '+'. */
|
||||
address_of_generic_floating_point_number -> sign = digits_sign_char;
|
||||
|
||||
} /* If we had any significant digits. */
|
||||
return (return_value);
|
||||
flonum_multip(multiplicand + place_number,
|
||||
&power_of_10_flonum, &temporary_flonum);
|
||||
flonum_copy(&temporary_flonum, &power_of_10_flonum);
|
||||
} /* If this bit of decimal_exponent was computable.*/
|
||||
} /* If this bit of decimal_exponent was set. */
|
||||
} /* For each bit of binary representation of exponent */
|
||||
#ifdef TRACE
|
||||
printf(" after computing power_of_10_flonum: ");
|
||||
flonum_print(&power_of_10_flonum );
|
||||
(void) putchar('\n');
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* power_of_10_flonum is power of ten in binary (mantissa) , (exponent).
|
||||
* It may be the number 1, in which case we don't NEED to multiply.
|
||||
*
|
||||
* Multiply (decimal digits) by power_of_10_flonum.
|
||||
*/
|
||||
|
||||
flonum_multip(&power_of_10_flonum, &digits_flonum, address_of_generic_floating_point_number);
|
||||
/* Assert sign of the number we made is '+'. */
|
||||
address_of_generic_floating_point_number->sign = digits_sign_char;
|
||||
|
||||
} /* If we had any significant digits. */
|
||||
return(return_value);
|
||||
} /* atof_generic () */
|
||||
|
||||
/* end of atof_generic.c */
|
||||
|
|
|
@ -15,7 +15,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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "as.h"
|
||||
|
||||
|
@ -37,39 +37,41 @@
|
|||
|
||||
/* void */
|
||||
int
|
||||
bignum_copy (in, in_length, out, out_length)
|
||||
register LITTLENUM_TYPE * in;
|
||||
register int in_length; /* in sizeof(littlenum)s */
|
||||
register LITTLENUM_TYPE * out;
|
||||
register int out_length; /* in sizeof(littlenum)s */
|
||||
bignum_copy(in, in_length, out, out_length)
|
||||
register LITTLENUM_TYPE *in;
|
||||
register int in_length; /* in sizeof(littlenum)s */
|
||||
register LITTLENUM_TYPE *out;
|
||||
register int out_length; /* in sizeof(littlenum)s */
|
||||
{
|
||||
register int significant_littlenums_dropped;
|
||||
int significant_littlenums_dropped;
|
||||
|
||||
if (out_length < in_length)
|
||||
{
|
||||
register LITTLENUM_TYPE * p; /* -> most significant (non-zero) input littlenum. */
|
||||
|
||||
bcopy ((char *)in, (char *)out, out_length << LITTLENUM_SHIFT);
|
||||
for (p = in + in_length - 1; p >= in; -- p)
|
||||
{
|
||||
if (* p) break;
|
||||
}
|
||||
significant_littlenums_dropped = p - in - in_length + 1;
|
||||
if (significant_littlenums_dropped < 0)
|
||||
{
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bcopy ((char *)in, (char *)out, in_length << LITTLENUM_SHIFT);
|
||||
if (out_length > in_length)
|
||||
{
|
||||
bzero ((char *)(out + out_length), (out_length - in_length) << LITTLENUM_SHIFT);
|
||||
}
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
return (significant_littlenums_dropped);
|
||||
}
|
||||
if (out_length < in_length) {
|
||||
LITTLENUM_TYPE *p; /* -> most significant (non-zero) input
|
||||
littlenum. */
|
||||
|
||||
bcopy((char *) in, (char *) out,
|
||||
out_length << LITTLENUM_SHIFT);
|
||||
for (p = in + in_length - 1; p >= in; --p) {
|
||||
if (* p) break;
|
||||
}
|
||||
significant_littlenums_dropped = p - in - in_length + 1;
|
||||
|
||||
if (significant_littlenums_dropped < 0) {
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
} else {
|
||||
bcopy((char *) in, (char *) out,
|
||||
in_length << LITTLENUM_SHIFT);
|
||||
|
||||
if (out_length > in_length) {
|
||||
bzero((char *) (out + out_length),
|
||||
(out_length - in_length) << LITTLENUM_SHIFT);
|
||||
}
|
||||
|
||||
significant_littlenums_dropped = 0;
|
||||
}
|
||||
|
||||
return(significant_littlenums_dropped);
|
||||
} /* bignum_copy() */
|
||||
|
||||
/* end of bignum-copy.c */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* bignum.h-arbitrary precision integers
|
||||
Copyright (C) 1987 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
typedef unsigned short LITTLENUM_TYPE;
|
||||
|
||||
/* JF truncated this to get around a problem with GCC */
|
||||
#define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651 )
|
||||
#define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651)
|
||||
/* WARNING: I haven't checked that the trailing digits are correct! */
|
||||
|
||||
/* end of bignum.h */
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
#define __ (42) /* blatently illegal digit value */
|
||||
/* exceeds any normal radix */
|
||||
#if !defined(__STDC__) && !defined(const)
|
||||
|
||||
#if (__STDC__ != 1) && !defined(const)
|
||||
#define const /* empty */
|
||||
#endif
|
||||
const char
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* input_scrub.c - Break up input buffers into whole numbers of lines.
|
||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -105,11 +105,11 @@ struct input_save {
|
|||
char *saved_position; /* Caller's saved position in buf */
|
||||
};
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
static void as_1_char(unsigned int c, FILE *stream);
|
||||
#else /* __STDC__ */
|
||||
static void as_1_char();
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* 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
|
||||
|
|
948
gas/listing.c
948
gas/listing.c
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,25 @@
|
|||
/* This file is listing.h
|
||||
Copyright (C) 1987-1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
GAS is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GAS is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef NO_LISTING
|
||||
#define LISTING_NEWLINE() if (listing) listing_newline(input_line_pointer);
|
||||
#else
|
||||
#define LISTING_NEWLINE()
|
||||
#endif
|
||||
void EXFUN(listing_title,(unsigned int depth));
|
||||
void EXFUN(listing_list,());
|
||||
void EXFUN(listing_flags,());
|
||||
void EXFUN(listing_psize,());
|
||||
void EXFUN(listing_eject,());
|
||||
void EXFUN(listing_width,(unsigned int x));
|
||||
void EXFUN(listing_source_line,(unsigned int));
|
||||
void EXFUN(listing_source_file,(char *));
|
||||
|
||||
#ifndef __listing_h__
|
||||
#define __listing_h__
|
||||
|
||||
#define LISTING_LISTING 1
|
||||
#define LISTING_SYMBOLS 2
|
||||
|
@ -21,4 +29,63 @@ void EXFUN(listing_source_file,(char *));
|
|||
|
||||
#define LISTING_DEFAULT (LISTING_LISTING | LISTING_HLL | LISTING_SYMBOLS)
|
||||
|
||||
#ifndef NO_LISTING
|
||||
|
||||
#define LISTING_NEWLINE() { if (listing) listing_newline(input_line_pointer); }
|
||||
|
||||
|
||||
#if __STDC__ == 1
|
||||
|
||||
void listing_eject(void);
|
||||
void listing_error(char *message);
|
||||
void listing_file(char *name);
|
||||
void listing_flags(void);
|
||||
void listing_list(unsigned int on);
|
||||
void listing_newline(char *ps);
|
||||
void listing_print(char *name);
|
||||
void listing_psize(void);
|
||||
void listing_source_file(char *);
|
||||
void listing_source_line(unsigned int);
|
||||
void listing_title(unsigned int depth);
|
||||
void listing_warning(char *message);
|
||||
void listing_width(unsigned int x);
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
void listing_eject();
|
||||
void listing_error();
|
||||
void listing_file();
|
||||
void listing_flags();
|
||||
void listing_list();
|
||||
void listing_newline();
|
||||
void listing_print();
|
||||
void listing_psize();
|
||||
void listing_source_file();
|
||||
void listing_source_line();
|
||||
void listing_title();
|
||||
void listing_warning();
|
||||
void listing_width();
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#else /* not NO_LISTING */
|
||||
|
||||
#define LISTING_NEWLINE() {;}
|
||||
|
||||
/* Dummy functions for when compiled without listing enabled */
|
||||
|
||||
#define listing_flags() {;]
|
||||
#define listing_list() {;]
|
||||
#define listing_eject() {;]
|
||||
#define listing_psize() {;]
|
||||
#define listing_title(depth) {;]
|
||||
#define listing_file(name) {;]
|
||||
#define listing_newline(name) {;]
|
||||
#define listing_source_line(n) {;]
|
||||
#define listing_source_file(n) [;]
|
||||
|
||||
#endif /* not NO_LISTING */
|
||||
|
||||
#endif /* __listing_h__ */
|
||||
|
||||
/* end of listing.h */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* read.c - read a source file -
|
||||
Copyright (C) 1986, 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1986, 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -119,7 +120,7 @@ struct broken_word *broken_words;
|
|||
int new_broken_words = 0;
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
static char *demand_copy_string(int *lenP);
|
||||
int is_it_end_of_statement(void);
|
||||
|
@ -139,7 +140,7 @@ static void grow_bignum();
|
|||
static void pobegin();
|
||||
void stringer();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
extern int listing;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
/* If your compiler is really ansi, then you don't need this. */
|
||||
|
||||
#ifndef __STDC__
|
||||
#if __STDC__ != 1
|
||||
|
||||
#define SIZET int
|
||||
|
||||
|
@ -50,6 +50,6 @@ char *wanted;
|
|||
return(scan);
|
||||
} /* strstr() */
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* end of strstr.c */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* struct_symbol.h - Internal symbol structure
|
||||
Copyright (C) 1987 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -71,21 +71,21 @@ extern const short seg_N_TYPE[]; /* subseg.c */
|
|||
#define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */
|
||||
|
||||
#ifdef SYMBOLS_NEED_BACKPOINTERS
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
void symbol_clear_list_pointers(symbolS *symbolP);
|
||||
void symbol_insert(symbolS *addme, symbolS *target, symbolS **rootP, symbolS **lastP);
|
||||
void symbol_remove(symbolS *symbolP, symbolS **rootP, symbolS **lastP);
|
||||
void verify_symbol_chain(symbolS *rootP, symbolS *lastP);
|
||||
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
|
||||
void symbol_clear_list_pointers();
|
||||
void symbol_insert();
|
||||
void symbol_remove();
|
||||
void verify_symbol_chain();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define symbol_previous(s) ((s)->sy_previous)
|
||||
|
||||
|
@ -95,11 +95,11 @@ void verify_symbol_chain();
|
|||
|
||||
#endif /* SYMBOLS_NEED_BACKPOINTERS */
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
void symbol_append(symbolS *addme, symbolS *target, symbolS **rootP, symbolS **lastP);
|
||||
#else /* __STDC__ */
|
||||
#else /* not __STDC__ */
|
||||
void symbol_append();
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define symbol_next(s) ((s)->sy_next)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* symbols.h -
|
||||
Copyright (C) 1987, 1990 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1987, 1990, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -36,7 +37,7 @@ extern symbolS* dot_text_symbol;
|
|||
extern symbolS* dot_data_symbol;
|
||||
extern symbolS* dot_bss_symbol;
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
char *decode_local_label_name(char *s);
|
||||
char *local_label_name(int n, int augend);
|
||||
|
@ -51,7 +52,7 @@ void symbol_begin(void);
|
|||
void symbol_table_insert(symbolS *symbolP);
|
||||
void verify_symbol_chain(symbolS *rootP, symbolS *lastP);
|
||||
|
||||
#else
|
||||
#else /* not __STDC__ */
|
||||
|
||||
char *decode_local_label_name();
|
||||
char *local_label_name();
|
||||
|
@ -66,7 +67,7 @@ void symbol_begin();
|
|||
void symbol_table_insert();
|
||||
void verify_symbol_chain();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if defined(__STDC__) || defined(const)
|
||||
#if (__STDC__ == 1) || defined(const)
|
||||
const
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* write.c - emit .o file
|
||||
Copyright (C) 1986, 1987, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1986, 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -55,7 +55,7 @@ int magic_number_for_object_file = DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE;
|
|||
/* static long length; JF unused */ /* String length, including trailing '\0'. */
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
static int is_dnrange(struct frag *f1, struct frag *f2);
|
||||
static long fixup_segment(fixS *fixP, segT this_segment_type);
|
||||
|
@ -69,7 +69,7 @@ static long fixup_segment();
|
|||
static relax_addressT relax_align();
|
||||
void relax_segment();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/*
|
||||
* fix_new()
|
||||
|
|
12
gas/write.h
12
gas/write.h
|
@ -1,8 +1,6 @@
|
|||
/* write.h -> write.c */
|
||||
/* write.h
|
||||
|
||||
/* MODIFIED BY CHRIS BENENATI, FOR INTEL CORPORATION, 4/89 */
|
||||
/* write.h -> write.c
|
||||
Copyright (C) 1987 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -95,7 +93,7 @@ COMMON fixS **seg_fix_rootP, **seg_fix_tailP; /* -> one of above. */
|
|||
extern long string_byte_count;
|
||||
extern int section_alignment[];
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
|
||||
bit_fixS *bit_fix_new(char size, char offset, long base_type, long base_adj, long min, long max, long add);
|
||||
void append(char **charPP, char *fromP, unsigned long length);
|
||||
|
@ -111,7 +109,7 @@ fixS *fix_new(fragS *frag,
|
|||
int pcrel,
|
||||
enum reloc_type r_type);
|
||||
|
||||
#else
|
||||
#else /* not __STDC__ */
|
||||
|
||||
bit_fixS *bit_fix_new();
|
||||
fixS *fix_new();
|
||||
|
@ -119,7 +117,7 @@ void append();
|
|||
void record_alignment();
|
||||
void write_object_file();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#ifdef USG
|
||||
|
@ -50,7 +50,7 @@
|
|||
#else
|
||||
char * malloc();
|
||||
#endif /* USG */
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define error as_fatal
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
realloc ()
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
#if __STDC__ == 1
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#ifdef USG
|
||||
|
@ -50,7 +50,7 @@
|
|||
#else
|
||||
char *realloc ();
|
||||
#endif /* USG */
|
||||
#endif /* __STDC__ */
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#define error as_fatal
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue