diff options
-rw-r--r-- | gas/Makefile.in | 17 | ||||
-rw-r--r-- | gas/app.c | 4 | ||||
-rw-r--r-- | gas/as.c | 10 | ||||
-rw-r--r-- | gas/as.h | 16 | ||||
-rw-r--r-- | gas/atof-generic.c | 887 | ||||
-rw-r--r-- | gas/bignum-copy.c | 68 | ||||
-rw-r--r-- | gas/bignum.h | 4 | ||||
-rw-r--r-- | gas/hex-value.c | 3 | ||||
-rw-r--r-- | gas/input-scrub.c | 6 | ||||
-rw-r--r-- | gas/listing.c | 948 | ||||
-rw-r--r-- | gas/listing.h | 93 | ||||
-rw-r--r-- | gas/read.c | 7 | ||||
-rw-r--r-- | gas/strstr.c | 4 | ||||
-rw-r--r-- | gas/struc-symbol.h | 14 | ||||
-rw-r--r-- | gas/symbols.h | 9 | ||||
-rw-r--r-- | gas/version.c | 2 | ||||
-rw-r--r-- | gas/write.c | 8 | ||||
-rw-r--r-- | gas/write.h | 12 | ||||
-rw-r--r-- | gas/xmalloc.c | 4 | ||||
-rw-r--r-- | gas/xrealloc.c | 4 |
20 files changed, 1016 insertions, 1104 deletions
diff --git a/gas/Makefile.in b/gas/Makefile.in index c557e1c..2759503 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -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 @@ -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++) { @@ -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" diff --git a/gas/atof-generic.c b/gas/atof-generic.c index 42fcfa9..198e980 100644 --- a/gas/atof-generic.c +++ b/gas/atof-generic.c @@ -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 = '+'; + /* + * 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[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[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; } - 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; + 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 */ - 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++; - } + 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 - { - break; /* p -> char after pre-decimal digits. */ + } else { + if (!seen_significant_digit) { + number_of_digits_after_decimal = 0; } - } /* For each digit before decimal mark. */ + 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; -#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; - } + 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; } } -#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; + 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; + 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 (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; } - else + + /* 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 + */ { - 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 - */ - - 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; - } - /* 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 - { + 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'); + printf("before multiply, place_number = %d., power_of_10_flonum:\n", + place_number); + + flonum_print(&power_of_10_flonum); + (void)putchar('\n'); #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 */ + 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'); + 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); + } + + } + + /* + * 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 */ diff --git a/gas/bignum-copy.c b/gas/bignum-copy.c index 38db98d..1134636 100644 --- a/gas/bignum-copy.c +++ b/gas/bignum-copy.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 */ diff --git a/gas/bignum.h b/gas/bignum.h index 130fee3..702a63e 100644 --- a/gas/bignum.h +++ b/gas/bignum.h @@ -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 */ diff --git a/gas/hex-value.c b/gas/hex-value.c index b724377..01fe241 100644 --- a/gas/hex-value.c +++ b/gas/hex-value.c @@ -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 diff --git a/gas/input-scrub.c b/gas/input-scrub.c index a5fcd78..ddd0619 100644 --- a/gas/input-scrub.c +++ b/gas/input-scrub.c @@ -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 diff --git a/gas/listing.c b/gas/listing.c index 343aa62..7724d91 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -97,6 +97,7 @@ #include "targ-cpu.h" #ifndef NO_LISTING + #ifndef LISTING_HEADER #define LISTING_HEADER "GAS LISTING" #endif @@ -117,24 +118,18 @@ #endif - - /* This structure remembers which .s were used */ -typedef struct file_info_struct -{ +typedef struct file_info_struct { char *filename; int linenum; FILE *file; struct file_info_struct *next; int end_pending; - } file_info_type ; -/* this structure rememebrs which line from which file goes into which - frag */ -typedef struct list_info_struct -{ +/* this structure rememebrs which line from which file goes into which frag */ +typedef struct list_info_struct { /* Frag which this line of source is nearest to */ fragS *frag; /* The actual line in the source file */ @@ -158,96 +153,82 @@ typedef struct list_info_struct /* Pointer to any error message associated with this line */ char *message; - enum - { - EDICT_NONE, - EDICT_SBTTL, - EDICT_TITLE, - EDICT_NOLIST, - EDICT_LIST, - EDICT_EJECT - } edict; + enum { + EDICT_NONE, + EDICT_SBTTL, + EDICT_TITLE, + EDICT_NOLIST, + EDICT_LIST, + EDICT_EJECT, + } edict; char *edict_arg; - } list_info_type; - static struct list_info_struct *head; struct list_info_struct *listing_tail; extern int listing; extern unsigned int physical_input_line; extern fragS *frag_now; - static int paper_width = 200; static int paper_height = 60; - /* this static array is used to keep the text of data to be printed - before the start of the line. - It is stored so we can give a bit more info on the next line. To much, and large - initialized arrays will use up lots of paper. - */ + before the start of the line. It is stored so we can give a bit + more info on the next line. To much, and large initialized arrays + will use up lots of paper. */ static char data_buffer[100]; static unsigned int data_buffer_size; - static void - DEFUN(listing_message,(name, message), - char *name AND - char *message) + listing_message(name, message) +char *name; +char *message; { - unsigned int l = strlen(name) + strlen(message)+1; - char *n = malloc(l); + unsigned int l = strlen(name) + strlen(message) + 1; + char *n = malloc(l); strcpy(n,name); strcat(n,message); - if(listing_tail != (list_info_type *)NULL) - { - listing_tail->message = n; - } - -} - - + if (listing_tail != (list_info_type *)NULL) { + listing_tail->message = n; + } + return; +} /* lising_message() */ void - DEFUN(listing_warning,(message), - char *message) + listing_warning(message) +char *message; { listing_message("Warning:", message); } -void - DEFUN(listing_error,(message), - char *message) +void + listing_error(message) +char *message; { listing_message("Error:", message); } - - - static file_info_type *file_info_head; static file_info_type * - DEFUN(file_info, (file_name), - char *file_name) + file_info(file_name) +char *file_name; { /* Find an entry with this file name */ file_info_type *p = file_info_head; - while (p != (file_info_type *)NULL) - { - if (strcmp(p->filename, file_name) == 0) - return p; - p = p->next; - } + while (p != (file_info_type *)NULL) { + if (strcmp(p->filename, file_name) == 0) + return(p); + p = p->next; + } /* Make new entry */ - p = (file_info_type *)xmalloc(sizeof(file_info_type)); + p = (file_info_type *) xmalloc(sizeof(file_info_type)); p->next = file_info_head; file_info_head = p; p->filename = xmalloc(strlen(file_name)+1); @@ -256,70 +237,64 @@ static file_info_type * p->end_pending = 0; p->file = fopen(p->filename,"r"); - return p; - -} + return(p); +} /* file_info() */ static void - DEFUN_VOID(new_frag) + new_frag() { - frag_wane(frag_now); frag_new(0); - } void - DEFUN(listing_newline,(ps), - char *ps) + listing_newline(ps) +char *ps; { char *s = ps; extern char *file_name; - static unsigned int last_line =0xffff ; + static unsigned int last_line = 0xffff ; list_info_type *new; - if (physical_input_line != last_line) - { - last_line = physical_input_line; - new_frag(); - - new = (list_info_type *)malloc(sizeof(list_info_type)); - new->frag = frag_now; - new->line = physical_input_line ; - new->file = file_info(file_name); - - if (listing_tail) - { - listing_tail->next = new; - } - else - { - head = new; - } - listing_tail = new; - new->next = (list_info_type *)NULL; - new->message = (char *)NULL; - new->edict = EDICT_NONE; - new->hll_file = (file_info_type*)NULL; - new->hll_line = 0; - new_frag(); - } -} + if (physical_input_line != last_line) { + last_line = physical_input_line; + new_frag(); + + new = (list_info_type *) malloc(sizeof(list_info_type)); + new->frag = frag_now; + new->line = physical_input_line ; + new->file = file_info(file_name); + + if (listing_tail) { + listing_tail->next = new; + } else { + head = new; + } + + listing_tail = new; + new->next = (list_info_type *) NULL; + new->message = (char *) NULL; + new->edict = EDICT_NONE; + new->hll_file = (file_info_type*) NULL; + new->hll_line = 0; + new_frag(); + } + return; +} /* listing_newline() */ -/* - This function returns the next source line from the file supplied, - truncated to size. It appends a fake line to the end of each input - file to make - */ + +/* This function returns the next source line from the file supplied, + truncated to size. It appends a fake line to the end of each input + file to make. */ static char * - DEFUN(buffer_line,(file, line, size), - file_info_type *file AND - char *line AND - unsigned int size) + buffer_line(file, line, size) +file_info_type *file; +char *line; +unsigned int size; { unsigned int count = 0; int c; @@ -327,10 +302,9 @@ static char * char *p = line; /* If we couldn't open the file, return an empty line */ - if (file->file == (FILE*)NULL) - { - return ""; - } + if (file->file == (FILE*) NULL) { + return(""); + } if (file->end_pending == 10) { *p ++ = '\n'; @@ -338,29 +312,29 @@ static char * file->linenum = 0; file->end_pending = 0; } + c = fgetc(file->file); size -= 1; /* leave room for null */ - while (c != EOF && c != '\n') - { - if (count < size) - *p++ = c; - count++; - - c= fgetc(file->file); - } - if (c == EOF) - { - file->end_pending ++; - *p++ = 'E'; - *p++ = 'O'; - *p++ = 'F'; - } + while (c != EOF && c != '\n') { + if (count < size) + *p++ = c; + count++; + + c = fgetc(file->file); + } + + if (c == EOF) { + file->end_pending ++; + *p++ = 'E'; + *p++ = 'O'; + *p++ = 'F'; + } + file->linenum++; *p++ = 0; - return line; -} - + return(line); +} /* buffer_line() */ static char *fn; @@ -370,55 +344,53 @@ static char *title; /* current title */ static char *subtitle; /* current subtitle */ static unsigned int on_page; /* number of lines printed on current page */ - static void - DEFUN(listing_page,(list), - list_info_type *list) + listing_page(list) +list_info_type *list; { - /* Grope around, see if we can see a title or subtitle edict coming up - soon (we look down 10 lines of the page and see if it's there)*/ - if ((eject || (on_page >= paper_height)) && paper_height != 0) - { - unsigned int c = 10; - int had_title = 0; - int had_subtitle = 0; - - page++; - - while (c != 0 && list) - { - if (list->edict == EDICT_SBTTL && !had_subtitle) - { - had_subtitle = 1; - subtitle = list->edict_arg; - } - if (list->edict == EDICT_TITLE && !had_title) - { - had_title = 1; - title = list->edict_arg; - } - list = list->next; - c--; - } - - - if (page > 1) - { - printf("\f"); + /* Grope around, see if we can see a title or subtitle edict + coming up soon (we look down 10 lines of the page and see + if it's there). */ + + if ((eject || (on_page >= paper_height)) && paper_height != 0) { + unsigned int c = 10; + int had_title = 0; + int had_subtitle = 0; + + page++; + + while (c != 0 && list) { + if (list->edict == EDICT_SBTTL && !had_subtitle) { + had_subtitle = 1; + subtitle = list->edict_arg; } - - printf("%s %s \t\t\tpage %d\n", LISTING_HEADER, fn, page); - printf("%s\n", title); - printf("%s\n", subtitle); - on_page = 3; - eject = 0; - } -} + + if (list->edict == EDICT_TITLE && !had_title) { + had_title = 1; + title = list->edict_arg; + } + list = list->next; + --c; + } + + if (page > 1) { + printf("\f"); + } + + printf("%s %s \t\t\tpage %d\n", LISTING_HEADER, fn, page); + printf("%s\n", title); + printf("%s\n", subtitle); + on_page = 3; + eject = 0; + } + + return; +} /* listing_page() */ static unsigned int - DEFUN(calc_hex,(list), - list_info_type *list) + calc_hex(list) +list_info_type *list; { list_info_type *first = list; list_info_type *last = first; @@ -427,7 +399,7 @@ static unsigned int fragS *frag; fragS *frag_ptr; - unsigned int byte_in_frag = 0; + unsigned int byte_in_frag = 0; int anything = 0; @@ -441,51 +413,42 @@ static unsigned int data_buffer_size = 0; /* Dump all the frags which belong to this line */ - while (frag_ptr != (fragS *)NULL && frag_ptr->line == first) - { - /* Print as many bytes from the fixed part as is sensible */ - while(byte_in_frag < frag_ptr->fr_fix && data_buffer_size < sizeof(data_buffer)-10) - { - if (address == ~0) - { - address = frag_ptr->fr_address; - } - - sprintf(data_buffer + data_buffer_size, - "%02X", - (frag_ptr->fr_literal[byte_in_frag]) & 0xff); - data_buffer_size += 2; - byte_in_frag++; + while (frag_ptr != (fragS *)NULL && frag_ptr->line == first) { + /* Print as many bytes from the fixed part as is sensible */ + while(byte_in_frag < frag_ptr->fr_fix && data_buffer_size < sizeof(data_buffer)-10) { + if (address == ~0) { + address = frag_ptr->fr_address; } - /* Print as many bytes from the variable part as is sensible */ - while (byte_in_frag < frag_ptr->fr_var * frag_ptr->fr_offset - && data_buffer_size < sizeof(data_buffer)-10) - { - if (address == ~0) - { - address = frag_ptr->fr_address; - } - data_buffer[data_buffer_size++] = '*'; - data_buffer[data_buffer_size++] = '*'; - - byte_in_frag++; + + sprintf(data_buffer + data_buffer_size, "%02X", (frag_ptr->fr_literal[byte_in_frag]) & 0xff); + data_buffer_size += 2; + byte_in_frag++; + } + + /* Print as many bytes from the variable part as is sensible */ + while (byte_in_frag < frag_ptr->fr_var * frag_ptr->fr_offset + && data_buffer_size < sizeof(data_buffer)-10) { + if (address == ~0) { + address = frag_ptr->fr_address; } - frag_ptr = frag_ptr->fr_next; - } + data_buffer[data_buffer_size++] = '*'; + data_buffer[data_buffer_size++] = '*'; + + byte_in_frag++; + } + + frag_ptr = frag_ptr->fr_next; + } + data_buffer[data_buffer_size++] = 0; return address; -} - - - - - +} /* calc_hex() */ static void - DEFUN(print_lines,(list, string, address), - list_info_type *list AND - char *string AND - unsigned int address) + print_lines(list, string, address) +list_info_type *list; +char *string; +unsigned int address; { unsigned int idx; unsigned int nchars; @@ -495,128 +458,106 @@ static void /* Print the stuff on the first line */ listing_page(list); - nchars = (LISTING_WORD_SIZE*2 +1) * LISTING_LHS_WIDTH ; + nchars = (LISTING_WORD_SIZE * 2 + 1) * LISTING_LHS_WIDTH ; + /* Print the hex for the first line */ - if (address == ~0) - { - printf("% 4d ", list->line); - for (idx = 0; idx < nchars; idx++) - printf(" "); - - printf("\t%s\n", string ? string : ""); - on_page++; - listing_page(0); - - } - else - { - if (had_errors()) - { - printf("% 4d ???? ", list->line); - } - else - { - printf("% 4d %04x ", list->line, address); + if (address == ~0) { + printf("% 4d ", list->line); + for (idx = 0; idx < nchars; idx++) + printf(" "); + + printf("\t%s\n", string ? string : ""); + on_page++; + listing_page(0); + } else { + if (had_errors()) { + printf("% 4d ???? ", list->line); + } else { + printf("% 4d %04x ", list->line, address); + } + + /* And the data to go along with it */ + idx = 0; + + while (*src && idx < nchars) { + printf("%c%c", src[0], src[1]); + src += 2; + byte_in_word++; + + if (byte_in_word == LISTING_WORD_SIZE) { + printf(" "); + idx++; + byte_in_word = 0; } - - /* And the data to go along with it */ - idx = 0; - - while (*src && idx < nchars) - { + idx+=2; + } + + for (;idx < nchars; idx++) + printf(" "); + + printf("\t%s\n", string ? string : ""); + on_page++; + listing_page(list); + if (list->message) { + printf("**** %s\n",list->message); + listing_page(list); + on_page++; + } + + for (lines = 0; lines < LISTING_LHS_CONT_LINES && *src; lines++) { + nchars = ((LISTING_WORD_SIZE*2) +1) * LISTING_LHS_WIDTH_SECOND -1; + idx = 0; + /* Print any more lines of data, but more compactly */ + printf("% 4d ", list->line); + + while (*src && idx < nchars) { printf("%c%c", src[0], src[1]); - src += 2; - byte_in_word++; - if (byte_in_word == LISTING_WORD_SIZE) - { - printf(" "); - idx++; - byte_in_word = 0; - } + src+=2; idx+=2; - } - - for (;idx < nchars; idx++) - printf(" "); - - printf("\t%s\n", string ? string : ""); - on_page++; - listing_page(list); - if (list->message) - { - printf("**** %s\n",list->message); - listing_page(list); - on_page++; - } - - for (lines = 0; - lines < LISTING_LHS_CONT_LINES - && *src; - lines++) { - nchars = ((LISTING_WORD_SIZE*2) +1) * LISTING_LHS_WIDTH_SECOND -1; - idx = 0; - /* Print any more lines of data, but more compactly */ - printf("% 4d ", list->line); - - while (*src && idx < nchars) - { - printf("%c%c", src[0], src[1]); - src+=2; - idx+=2; - byte_in_word++; - if (byte_in_word == LISTING_WORD_SIZE) - { - printf(" "); - idx++; - byte_in_word = 0; - } + byte_in_word++; + if (byte_in_word == LISTING_WORD_SIZE) { + printf(" "); + idx++; + byte_in_word = 0; } - - printf("\n"); - on_page++; - listing_page(list); - - } - - - } -} - - - - + } + + printf("\n"); + on_page++; + listing_page(list); + } + } +} /* print_lines() */ static void - DEFUN_VOID(list_symbol_table) + list_symbol_table() { extern symbolS *symbol_rootP; + symbolS *ptr; - symbolS *ptr ; eject = 1; listing_page(0); printf("DEFINED SYMBOLS\n"); on_page++; - for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) - { - if (ptr->sy_frag->line) - { - if (strlen(S_GET_NAME(ptr))) - { - printf("%20s:%-5d %2d:%08x %s \n", - ptr->sy_frag->line->file->filename, - ptr->sy_frag->line->line, - S_GET_SEGMENT(ptr), - S_GET_VALUE(ptr), - S_GET_NAME(ptr)); - - on_page++; - listing_page(0); - } - } - - } + for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) { + if (ptr->sy_frag->line) { + if (strlen(S_GET_NAME(ptr))) { + printf("%20s:%-5d %2d:%08x %s \n", + ptr->sy_frag->line->file->filename, + ptr->sy_frag->line->line, + S_GET_SEGMENT(ptr), + S_GET_VALUE(ptr), + S_GET_NAME(ptr)); + + on_page++; + listing_page(0); + } + } + + } + printf("\n"); on_page++; listing_page(0); @@ -624,49 +565,49 @@ static void on_page++; listing_page(0); - for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) - { - if (ptr && strlen(S_GET_NAME(ptr)) != 0) - { - if (ptr->sy_frag->line == 0) - { - printf("%s\n", S_GET_NAME(ptr)); - on_page++; - listing_page(0); - } + for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) { + if (ptr && strlen(S_GET_NAME(ptr)) != 0) { + if (ptr->sy_frag->line == 0) { + printf("%s\n", S_GET_NAME(ptr)); + on_page++; + listing_page(0); } - } -} + } + } + + return; +} /* list_symbol_table() */ void - DEFUN(print_source,(current_file, list, buffer, width), - file_info_type *current_file AND - list_info_type *list AND - char *buffer AND - unsigned int width) + print_source(current_file, list, buffer, width) +file_info_type *current_file; +list_info_type *list; +char *buffer; +unsigned int width; { if (current_file->file) { - while (current_file->linenum < list->hll_line) - { - char * p = buffer_line(current_file, buffer, width); - printf("%4d:%-13s **** %s\n", current_file->linenum, current_file->filename, p); - on_page++; - listing_page(list); - } + while (current_file->linenum < list->hll_line) { + char * p = buffer_line(current_file, buffer, width); + printf("%4d:%-13s **** %s\n", current_file->linenum, current_file->filename, p); + on_page++; + listing_page(list); + } } -} + + return; +} /* print_source() */ /* Sometimes the user doesn't want to be bothered by the debugging records inserted by the compiler, see if the line is suspicioous */ static int - DEFUN(debugging_pseudo,(line), - char *line) + debugging_pseudo(line) +char *line; { while (isspace(*line)) line++; - if(*line != '.') return 0; + if (*line != '.') return 0; line++; @@ -681,110 +622,96 @@ static int if (strncmp(line, "dim",3) ==0) return 1; if (strncmp(line, "tag",3) == 0) return 1; - return 0; - -} + return(0); +} /* debugging_pseudo() */ void - DEFUN(listing_listing,(name), - char *name) + listing_listing(name) +char *name; { - list_info_type *list = head; - file_info_type *current_hll_file = (file_info_type *)NULL; - - unsigned int page= 1; - unsigned int prev = 0; - char *message; char *buffer; + char *message; char *p; - unsigned int addr = 0; + file_info_type *current_hll_file = (file_info_type *) NULL; int on_page = 0; int show_listing = 1; + list_info_type *list = head; + unsigned int addr = 0; + unsigned int page = 1; + unsigned int prev = 0; unsigned int width; buffer = malloc(LISTING_RHS_WIDTH); eject = 1; list = head; - while (list != (list_info_type *)NULL && 0) - { - if (list->next) - list->frag = list->next->frag; - list = list->next; - - } + while (list != (list_info_type *)NULL && 0) { + if (list->next) + list->frag = list->next->frag; + list = list->next; + } list = head->next; - - while ( list) - { - width = LISTING_RHS_WIDTH > paper_width ? paper_width : - LISTING_RHS_WIDTH; - - switch (list->edict) { - case EDICT_LIST: - show_listing++; - break; - case EDICT_NOLIST: - show_listing--; - break; - case EDICT_EJECT: - break; - case EDICT_NONE: - break; - case EDICT_TITLE: - title = list->edict_arg; - break; - case EDICT_SBTTL: - subtitle = list->edict_arg; - break; - default: - abort(); - } - - if (show_listing > 0) - { - /* Scan down the list and print all the stuff which can be done - with this line (or lines) */ - message = 0; - - if (list->hll_file) - { - current_hll_file = list->hll_file; - } - - if (current_hll_file && list->hll_line && listing & LISTING_HLL) - { - print_source(current_hll_file, list, buffer, width); - } - - p = buffer_line(list->file, buffer, width); - - if (! ((listing & LISTING_NODEBUG) && debugging_pseudo(p))) - { - print_lines(list, p, calc_hex(list)); - } - - if (list->edict == EDICT_EJECT) - { - eject = 1; - } + while (list) { + width = LISTING_RHS_WIDTH > paper_width ? paper_width : LISTING_RHS_WIDTH; + + switch (list->edict) { + case EDICT_LIST: + show_listing++; + break; + case EDICT_NOLIST: + show_listing--; + break; + case EDICT_EJECT: + break; + case EDICT_NONE: + break; + case EDICT_TITLE: + title = list->edict_arg; + break; + case EDICT_SBTTL: + subtitle = list->edict_arg; + break; + default: + abort(); + } + + if (show_listing > 0) { + /* Scan down the list and print all the stuff which can be done + with this line (or lines) */ + message = 0; + + if (list->hll_file) { + current_hll_file = list->hll_file; } - else - { - - p = buffer_line(list->file, buffer, width); + + if (current_hll_file && list->hll_line && listing & LISTING_HLL) { + print_source(current_hll_file, list, buffer, width); } - - list = list->next; - } + + p = buffer_line(list->file, buffer, width); + + if (! ((listing & LISTING_NODEBUG) && debugging_pseudo(p))) { + print_lines(list, p, calc_hex(list)); + } + + if (list->edict == EDICT_EJECT) { + eject = 1; + } + } else { + + p = buffer_line(list->file, buffer, width); + } + + list = list->next; + } free(buffer); -} +} /* listing_listing() */ void - DEFUN(listing_print,(name), - char *name) + listing_print(name) +char *name; { title = ""; subtitle = ""; @@ -803,174 +730,115 @@ void { list_symbol_table(); } -} +} /* listing_print() */ void - DEFUN(listing_file,(name), - char *name) + listing_file(name) +char *name; { fn = name; } void - DEFUN_VOID(listing_eject) + listing_eject() { listing_tail->edict = EDICT_EJECT; + return; } void - DEFUN_VOID(listing_flags) + listing_flags() { } + void - DEFUN(listing_list,(on), - unsigned int on) + listing_list(on) +unsigned int on; { listing_tail->edict = on ? EDICT_LIST : EDICT_NOLIST; } void - DEFUN_VOID(listing_psize) + listing_psize() { paper_height = get_absolute_expression(); - if (paper_height < 0 || paper_height > 1000) - { - paper_height = 0; - as_warn("strantge paper height, set to no form"); - } - if (*input_line_pointer == ',') - { - input_line_pointer++; - paper_width = get_absolute_expression(); - } -} + if (paper_height < 0 || paper_height > 1000) { + paper_height = 0; + as_warn("strantge paper height, set to no form"); + } + + if (*input_line_pointer == ',') { + input_line_pointer++; + paper_width = get_absolute_expression(); + } + + return; +} /* listing_psize() */ void - DEFUN(listing_title,(depth), - unsigned int depth) + listing_title(depth) +unsigned int depth; { char *start; char *title; unsigned int length; SKIP_WHITESPACE(); + if (*input_line_pointer=='\"') { input_line_pointer++; start = input_line_pointer; - while (*input_line_pointer) - { - if (*input_line_pointer == '\"') - { - length = input_line_pointer - start; - title = malloc(length + 1); - memcpy(title, start, length); - title[length] = 0; - listing_tail->edict = depth ? EDICT_SBTTL : EDICT_TITLE; - listing_tail->edict_arg = title; - input_line_pointer++; - demand_empty_rest_of_line(); - return; - } - else if (*input_line_pointer == '\n') - { - as_bad("New line in title"); - demand_empty_rest_of_line(); - return; - } - else - { - input_line_pointer++; - } - } + while (*input_line_pointer) { + if (*input_line_pointer == '\"') { + length = input_line_pointer - start; + title = malloc(length + 1); + memcpy(title, start, length); + title[length] = 0; + listing_tail->edict = depth ? EDICT_SBTTL : EDICT_TITLE; + listing_tail->edict_arg = title; + input_line_pointer++; + demand_empty_rest_of_line(); + return; + } else if (*input_line_pointer == '\n') { + as_bad("New line in title"); + demand_empty_rest_of_line(); + return; + } else { + input_line_pointer++; + } + } + } else { + as_bad("expecting title in quotes"); } - else - { - as_bad("expecting title in quotes"); - } -} + + return; +} /* listing_title() */ void - DEFUN(listing_source_line,(line), - unsigned int line) + listing_source_line(line) +unsigned int line; { new_frag(); listing_tail->hll_line = line; new_frag(); - -} + return; +} /* lising_source_line() */ void - DEFUN(listing_source_file,(file), - char *file) + listing_source_file(file) +char *file; { listing_tail->hll_file = file_info(file); } +#endif /* not NO_LISTING */ - -#else - - -/* Dummy functions for when compiled without listing enabled */ - -void - DEFUN_VOID(listing_flags) -{ - s_ignore(); -} - -void DEFUN_VOID(listing_list) -{ - s_ignore(); -} - -void DEFUN_VOID(listing_eject) -{ - s_ignore(); -} -void DEFUN(listing_psize) -{ - s_ignore(); -} - -void DEFUN(listing_title, (depth), - unsigned int depth) -{ - s_ignore(); -} -void - DEFUN(listing_file,(name), - char *name) -{ - -} - -void DEFUN(listing_newline,(name), - char *name) -{ - -} - -void DEFUN(listing_source_line,(n), - unsigned int n) -{ - -} -void DEFUN(listing_source_file, (n), - char *n) -{ - -} - - - -#endif - +/* end of listing.c */ diff --git a/gas/listing.h b/gas/listing.h index 8733bc8..e915555 100644 --- a/gas/listing.h +++ b/gas/listing.h @@ -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; diff --git a/gas/strstr.c b/gas/strstr.c index 717ec1f..7c7074a 100644 --- a/gas/strstr.c +++ b/gas/strstr.c @@ -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 */ diff --git a/gas/struc-symbol.h b/gas/struc-symbol.h index b47b03b..541f65c 100644 --- a/gas/struc-symbol.h +++ b/gas/struc-symbol.h @@ -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) diff --git a/gas/symbols.h b/gas/symbols.h index cda9faf..37db8a0 100644 --- a/gas/symbols.h +++ b/gas/symbols.h @@ -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__ */ /* diff --git a/gas/version.c b/gas/version.c index aad71a3..acc2fc4 100644 --- a/gas/version.c +++ b/gas/version.c @@ -1,4 +1,4 @@ -#if defined(__STDC__) || defined(const) +#if (__STDC__ == 1) || defined(const) const #endif diff --git a/gas/write.c b/gas/write.c index b8eeb6e..63fee36 100644 --- a/gas/write.c +++ b/gas/write.c @@ -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() diff --git a/gas/write.h b/gas/write.h index d3f3072..1dc899e 100644 --- a/gas/write.h +++ b/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: diff --git a/gas/xmalloc.c b/gas/xmalloc.c index 92c06ff..99b2fa2 100644 --- a/gas/xmalloc.c +++ b/gas/xmalloc.c @@ -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 diff --git a/gas/xrealloc.c b/gas/xrealloc.c index 2d551ed..6c7f460 100644 --- a/gas/xrealloc.c +++ b/gas/xrealloc.c @@ -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 |