diff options
| author | tv <tv@NetBSD.org> | 1999-02-02 19:51:16 +0000 |
|---|---|---|
| committer | tv <tv@NetBSD.org> | 1999-02-02 19:51:16 +0000 |
| commit | 2e8b57510c512922b01977bf9c07cb986ddbaa67 (patch) | |
| tree | 99f0ff2ba55134ad127492d887b5b6567773ef25 /gnu/dist/binutils | |
| parent | 269cb58003ce63bbb1763517287a25b909583ae4 (diff) | |
By popular demand, import binutils 2.9.1.
Diffstat (limited to 'gnu/dist/binutils')
51 files changed, 20966 insertions, 1958 deletions
diff --git a/gnu/dist/binutils/ChangeLog b/gnu/dist/binutils/ChangeLog index 3f22cc4d6f4..8c27a7749da 100644 --- a/gnu/dist/binutils/ChangeLog +++ b/gnu/dist/binutils/ChangeLog @@ -1,6 +1,566 @@ -Tue May 13 10:42:58 1997 Ian Lance Taylor <ian@cygnus.com> +Mon Apr 27 13:45:26 1998 Ian Lance Taylor <ian@cygnus.com> - * Makefile.in (VERSION): Set to 2.8.1. + * configure.in: Set version number to 2.9.1. + * configure: Rebuild. + +Tue Apr 7 15:41:15 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (DISTSTUFF): Add defparse.h, defparse.c, rclex.c, + rcparse.h, and rcparse.c + * Makefile.in: Rebuild. + +Mon Apr 6 16:24:35 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (PROGS): Move $(ADDR2LINE_PROG) to end, so that + Makefile.in doesn't have an empty continuation line. + (bin_PROGRAMS): Likewise. + * Makefile.in: Rebuild. + +Fri Apr 3 13:41:05 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (mostlyclean-local): New target. + (MOSTLYCLEANFILES): Add binutils.log, binutils.sum, and abcdefg*. + (DISTCLEANFILES): Add site.exp and site.bak + * Makefile.in: Rebuild. + +Wed Apr 1 15:54:16 1998 Ian Lance Taylor <ian@cygnus.com> + + From Zack Weinberg <zack@rabi.phys.columbia.edu> and H.J. Lu + <hjl@gnu.org>: + * ar.c (usage): Mention S modifier. + (main): Add S modifier. + * ar.1, binutils.texi: Document S modifier. + +Wed Apr 1 13:11:23 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * binutils.texi: Use @itemx for a secondary item in a table. + +Tue Mar 31 18:44:13 1998 Ian Lance Taylor <ian@cygnus.com> + + * dep-in.sed: Add rule to remove @OBJDIR@. + * Makefile.am (dep.sed): Substitute for @OBJDIR@. + * Makefile.in: Rebuild. + +Mon Mar 30 16:13:07 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (DISTCLEANFILES): Remove defparse.h, arparse.h, + rcparse.h, and nlmheader.h. + * Makefile.in: Rebuild. + + * configure.in: Set version number to 2.9. + * configure: Rebuild. + +Sat Mar 28 17:39:27 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (MOSTLYCLEANFILES): Define. + * Makefile.in: Rebuild. + + Fix some gcc -Wall warnings: + * nlmconv.c (main): Add casts to avoid warnings. + (alpha_mangle_relocs): Likewise. + * objdump.c (dump_section_stabs): Likewise. + * size.c (print_sysv_format): Likewise. + * srcconv.c (wr_ob): Likewise. + * wrstabs.c (stab_modify_type): Likewise. + (stab_variable): Likewise. + * nlmconv.c (main): Initialize variables to avoid warnings. + * nm.c (sort_symbols_by_size): Likewise. + * objdump.c (disassemble_bytes): Likewise. + * wrstabs.c (stab_end_class_type): Likewise. + * coffgrok.c (do_sections_p2): Change j to unsigned int. + (do_lines): Change l to unsigned int. + * nlmheader.y (yylex): Change i to unsigned int. + * nm.c (print_symbol): Change j to long. + * size.c (lprint_number): Comment out. + * srconv.c (wr_ob): Change i to bfd_size_type. + * sysdump.c (unit_info_list): Comment out. + (object_body_list, program_structure, debug_list): Likewise. + * sysinfo.y (yyerror): Return value. + +Thu Mar 26 17:06:51 1998 Richard Henderson <rth@cygnus.com> + + * defparse.y (explist): Allow epsilon. + Suggestion from Jonathan-Harris@psion.com. + +Thu Mar 26 16:59:09 1998 Richard Henderson <rth@cygnus.com> + + * coffgrok.c (do_sections_p1): Use the section's lma instead of vma + for the benefit of prom loaders. + +Wed Mar 25 13:05:39 1998 Ian Lance Taylor <ian@cygnus.com> + + Based on patch from H.J. Lu <hjl@gnu.org>: + * Makefile.am (DISTSTUFF): New variable. + (diststuff): New target. + (DISTCLEANFILES): New variable. + * Makefile.in: Rebuild. + +Tue Mar 24 19:33:08 1998 Ian Lance Taylor <ian@cygnus.com> + + * rclex.l: Accept { and } as synonyms for BEGIN and END. + +Fri Mar 20 19:18:08 1998 Ian Lance Taylor <ian@cygnus.com> + + * aclocal.m4, configure: Rebuild with libtool 1.2. + +Tue Feb 24 13:07:50 1998 Doug Evans <devans@canuck.cygnus.com> + + * objdump.c (disassemble_data): Delete "++place" after call to + find_symbol_for_address. Set disasm_info.symbols to array of + symbols at the current address. + +Wed Feb 18 23:39:46 1998 Richard Henderson <rth@cygnus.com> + + * Makefile.am (install-exec-local): Install properly when ln + fails or tooldir == prefix. + +Tue Feb 17 18:40:55 1998 Richard Henderson <rth@cygnus.com> + + * objcopy.c (compare_section_lma): Rename from _vma. + (copy_object): Gap fill based on LMA not VMA. + * binutils.texi: Update and clarify. + * objcopy.1: Likewise. + +Tue Feb 17 20:34:11 1998 Ian Lance Taylor <ian@cygnus.com> + + * dlltool.c (make_one_lib_file): Don't add 1 to hint. + +Fri Feb 13 16:37:44 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (AUTOMAKE_OPTIONS): Define. + * configure, Makefile.in, aclocal.m4: Rebuild with automake 1.2e. + +Thu Feb 12 14:13:46 1998 Ian Lance Taylor <ian@cygnus.com> + + * deflex.l: Accept '?' in symbol names, for VC++ mangled names. + From Mikey <jeffdb@netzone.com>. + + * addr2line.c (usage): Update bug-gnu-utils address. + * ar.c (usage): Likewise. + * nlmconv.c (show_usage): Likewise. + * nm.c (usage): Likewise. + * objcopy.c (copy_usage): Likewise. + (strip_usage): Likewise. + * objdump.c (usage): Likewise. + * size.c (usage): Likewise. + * strings.c (usage): Likewise. + * windres.c (usage): Likewise. + * binutils.texi (Bug Reporting): Likewise. + +Sat Feb 7 15:36:24 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure, aclocal.m4: Rebuild with new libtool. + +Thu Feb 5 12:21:13 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure, Makefile.in, aclocal.m4: Rebuild with new libtool. + +Fri Jan 30 19:16:28 1998 Doug Evans <devans@canuck.cygnus.com> + + * Makefile.am (CC_FOR_TARGET,nlmcomv.o): Change program_transform_name + to transform. + * Makefile.in: Regenerate. + +Thu Jan 29 16:24:04 1998 Mumit Khan <khan@xraylith.wisc.edu> + + * dlltool.c: Define exit status macros for _WIN32 but not + __CYGWIN32__. + (gen_lib_file): Check for exit status of unlink. + * resrc.c: Define popen and pclose if _WIN32 but not + __CYGWIN32__. + +Wed Jan 28 17:45:46 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Remove vfork check. + * nlmconv.c: Never include vfork.h. + * aclocal.m4, configure, Makefile.in, config.in: Rebuild. + +Wed Jan 28 17:43:02 1998 J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl> + + * objcopy.c (copy_archive): Only pass one argument to mkdir if + _WIN32 but not __CYGWIN32__. + (smart_rename): Add code for _WIN32 (not __CYGWIN32__), to cope + with different rename behaviour and lack of chown. + + * configure.in: Check for mingw32 when deciding whether to build + dlltool. + * dlltool.c: Never include vfork.h. + (run): Use pexecute rather than vfork. + (gen_lib_file): Check for errors from bfd_set_archive_head and + bfd_close. Close all the BFDs in the archive before deleting the + temporary files. + +Thu Jan 22 16:22:55 1998 Fred Fish <fnf@cygnus.com> + + * objdump.c (disassemble_bytes): Add flag INSN_HAS_RELOC to tell + disassembly function there is a reloc on this line. + +Wed Jan 14 15:29:43 1998 Richard Henderson <rth@cygnus.com> + + * srconv.c (sh, h8300): Delete variables. + (addrsize, toolname, rnames): New variables. + (writeINT): Use addrsize. + (wr_un): Use toolname. + (wr_hd): Set up addrsize et al properly for h8300[hs]. + (walk_tree_symbol): Zero dsy. Use rnames. + (wr_un, wr_hd, wr_ob, wr_du): Use proper bfd access macros. + * sysdump.c (sh, h8300): Delete variables. + (addrsize): New variable. + (getINT): Use it. + (getone): Initialize it. + (getBITS): Range check on MAX. + +Mon Dec 29 16:58:05 1997 Ian Lance Taylor <ian@cygnus.com> + + From Matthew Bellantoni <matthew@chrysalis.com>: + * ar.c (get_pos_bfd): Add default_posname parameter. Change all + callers. + (replace_members): Default to replacing in the same position. + +Mon Dec 22 11:27:22 1997 Ian Lance Taylor <ian@cygnus.com> + + * rclex.l: Don't permit a comma in a STRING. + * rcparse.y (acc_entry): Warn if an inappropriate modifier is used + with a non VIRTKEY. + (acc_event): For a control character, set VIRTKEY, and force the + character to uppercase. + (acc_options): Don't require a comma separator. + +Tue Dec 9 13:25:42 1997 Michael Meissner <meissner@cygnus.com> + + * size.c (size_number): New function to provide size of field. + ({l,r}print_number): For octal and hex fields, print field using + '0' and '0x' suffixes. Do not include following tab. + (sysv_internal_sizer): Size section name, section size, and vma + address fields. + (sysv_internal_printer): Use calculated sizes for the columns. + (print_sysv_format): Size columns before printing. + (print_berkeley_format): Print tabs between numbers now that + {l,r}print_number doesn't. Print fields right justified. + +Mon Dec 8 11:22:04 1997 Nick Clifton <nickc@cygnus.com> + + * objdump.c (objdump_print_addr_with_sym): Remove call to + disasm_symaddr() as this function no longer exists. + +Tue Dec 2 10:23:50 1997 Nick Clifton <nickc@cygnus.com> + + * objdump.c (objdump_print_addr_with_sym): Call disasm_symaddr() + to allow backend to know which symbol has just been displayed. + +Tue Dec 2 13:06:46 1997 Ian Lance Taylor <ian@cygnus.com> + + * windres.h (ESCAPE_*): Define standard escape sequences. + * rclex.l (handle_quotes): Handle standard escape sequences. Warn + about an unrecognized escape character. + * windres.c (unicode_print): Print standard escape sequences. + * rcparse.y (acc_event): Initialize $$.next. + * resbin.c (bin_to_res_menuitems): Don't set MENUITEM_POPUP or + MENUITEM_ENDMENU in the menu item flags. + (bin_to_res_accelerators): Allocate a structure (the old code + never worked). + (res_to_bin_accelerator): Correct the test for setting ACC_LAST. + (res_to_bin_dialog): Save the extended style rather than saving + the style twice. Remove useless shadowing length variable. Set + the length of control data correctly. + * resrc.c (write_rc_dialog): Don't print the class or menu if the + string length is zero. + +Mon Nov 24 18:52:43 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * stabs.c (parse_stab_argtypes): Don't try to parse the name of a + destructor as mangled argument types. + +Mon Nov 10 17:51:41 1997 Gavin Koch <gavin@cygnus.com> + + * addr2line.c (translate_addresses): Use bfd_scan_vma rather + than strtol to scan addresses. + +Sun Nov 9 11:01:31 1997 Jeffrey A Law (law@cygnus.com) + + * Makefile.am (bin_PROGRAMS): Don't use line continuations here. + +Tue Nov 4 11:56:14 1997 Ian Lance Taylor <ian@cygnus.com> + + * objcopy.c (copy_section): Don't crash if there is no particular + information for a section. + +Mon Nov 3 12:36:19 1997 Ian Lance Taylor <ian@cygnus.com> + + * objcopy.c (parse_flags): Make flag check case insensitive. + Check for `contents' flag. Give an error for unrecognized flags. + (copy_section): If the contents flag was set for a section that + had no contents, zero out the new contents. + * binutils.texi (objcopy): Document contents section flag. + +Sun Nov 2 14:49:56 1997 Ian Lance Taylor <ian@cygnus.com> + + * objcopy.c: Move new struct and variable definitions to top of + file. Remove obsolete add_strip_symbol and is_strip_symbol + declarations. Add prototype declarations for add_specific_symbol + and is_specified_symbol. + +Mon Oct 20 15:31:43 1997 Klaus K"ampf <kkaempf@progis.de> + + * configure.com (HAVE_SBRK): Undefine. + +Tue Oct 14 16:14:35 1997 Nick Clifton <nickc@cygnus.com> + + * objdump.c (objdump_symbol_at_address): New function. Returns + true if a symbol can be found at the address passed in. + (disassemble_data): Set the symbol_at_address_func field to point + to objdump_symbol_at_address. + +Fri Oct 10 14:13:09 1997 Richard Henderson <rth@cygnus.com> + + * objcopy.c, objcopy.1, binutils.texi: "localize" is a better name + than "privatize". Update all references. + +Thu Oct 9 15:57:29 1997 Ian Lance Taylor <ian@cygnus.com> + + * binutils.texi (strip): Remove duplicate --target. From Marty + Leisner <leisner@sdsp.mc.xerox.com>. + + * nm.c (lineno_cache_bfd): New file static variable. + (lineno_cache_rel_bfd): New file static variable. + (display_archive): Clear lineno_cache_bfd and lineno_cache_rel_bfd + when closing a BFD. + (display_file): Likewise. + (print_symbol): Use lineno_cache_bfd and lineno_cache_rel_bfd + instead of cache_bfd and cache_rel_bfd. Make seccount static, and + only set it when setting relocs. + +Wed Oct 8 21:19:11 1997 Richard Henderson <rth@cygnus.com> + + * objcopy.c (keep_specific_list, privatize_specific_list, + weaken_specific_list): New variables. + (keep_symbols): Removed. + (add_specific_symbol): New function from the carcas of + add_strip_symbol. Takes a list as an argument. + (is_specified_symbol): Likewise from is_strip_symbol. + (filter_symbols): Honor the new privatize and weaken lists. + Optimize bfd_asymbol_name handling. + (copy_object, copy_options, copy_usage): Add privatize-symbol & + weaken-symbol options. + + * objcopy.1, binutils.texi: Update docs. + +Sun Oct 5 09:05:44 1997 Frank Ch. Eigler <fche@cygnus.com> + + * objdump.c (disassemble_data): Make "--prefix-addresses" + disassembly adjust to mixed-length instructions. + (objdump_print_addr_with_sym): Add "0x" prefix for hexadecimal + symbol-offsets in disassembly. + +Fri Oct 3 12:04:25 1997 Ian Lance Taylor <ian@cygnus.com> + + * objcopy.c (set_times): New static function, replacing + make_same_dates. + (strip_main): If preserve_dates, stat the input file before + copying it, and call set_times afterward. + (copy_main): Likewise. + + * wrstabs.c (write_stabs_in_sections_debugging_info): Cast p to + char * when calling strcpy and strlen. + +Wed Sep 24 11:34:05 1997 Ian Lance Taylor <ian@cygnus.com> + + * binutils.texi (ar cmdline): Document that q now works like r. + From Marty Leisner <leisner@sdsp.mc.xerox.com>. + + * binutils.texi (size): The object file argument is optional. + From Marty Leisner <leisner@sdsp.mc.xerox.com>. + + * aclocal.m4: Rebuild with new libtool. + * configure: Rebuild. + +Tue Aug 26 17:48:34 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (EXEEXT_FOR_BUILD): New variable. Use it in all + references to the sysinfo program. + * configure.in: Rebuild with new bfd/acinclude.m4. + * Makefile.in: Rebuild. + +Fri Aug 8 15:32:49 1997 Ian Lance Taylor <ian@cygnus.com> + + * windres.c: Include <time.h>. + (define_resource): Set a timestamp for the resource. + +Wed Aug 6 13:37:58 1997 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Define TARGET in header file. + * acconfig.h (TARGET): Add #undef. + * Makefile.am (version.o, bucomm.o): Remove special targets. + * bucomm.c (target): Remove. + * nm.c (program_name): Don't declare. + (target): Make static. + * size.c (target): Make static. + * configure, config.in, Makefile.in: Rebuild. + +Tue Aug 5 00:01:41 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am (check-DEJAGNU): Export r. + (.dep1): Use $(INCLUDES) rather than $(ALL_CFLAGS). + * Makefile.in: Rebuild. + + * nlmheader.y: Use VERSIONK rather than VERSION. + + * Makefile.am (STRIP_PROG): Change from strip.new to strip-new. + (NM_PROG): Change from nm.new to nm-new. + (TOOL_PROGS, install-exec-local): Adjust accordingly. + * Makefile.in: Rebuild. + +Mon Aug 4 11:47:31 1997 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Remove AC_ARG_PROGRAM; it's invoked by + AM_INIT_AUTOMAKE. + * configure: Rebuild. + + * Makefile.am (install-exec-local): Create $(tooldir)/bin before + trying to install anything into it. + * Makefile.in: Rebuild. + + * Makefile.am (TOOL_PROGS): Use an explicit $(EXEEXT). + (install-exec-local): When handling $(noinst_PROGRAMS), only use + $(EXEEXT) on the installed file. When handling $(TOOL_PROGS), + handle $(EXEEXT) correctly. + * configure.in: Add an explicit $(EXEEXT) when substituting for + the name of a program to build. + * Makefile.in, configure: Rebuild. + + * aclocal.m4, configure, Makefile.in: Rebuild with new automake + patches. + + * deflex.l, defparse.y: Use VERSIONK rather than VERSION. + * rclex.l, rcparse.y: Likewise. + * Makefile.am (windres_SOURCES): Add $(BULIBS). + * Makefile.in: Rebuild. + +Fri Aug 1 13:08:39 1997 Ian Lance Taylor <ian@cygnus.com> + + * acinclude.m4: Include bfd/acinclude.m4, not bfd/acmacros.m4. + * aclocal.m4, configure: Rebuild with new libtool. + +Thu Jul 31 11:51:35 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.am: New file, based on old Makefile.in. + * acinclude.m4: New file, from old aclocal.m4. + * configure.in: Call AM_INIT_AUTOMAKE and AM_PROG_LIBTOOL. Remove + shared library handling; now handled by libtool. Replace + AC_CONFIG_HEADER with AM_CONFIG_HEADER. Call AC_PROG_YACC, + AC_PROG_LEX, AC_DECL_YYTEST, AM_MAINTAINER_MODE, AM_CYGWIN32, and + AM_EXEEXT. Replace AC_PROG_INSTALL with AM_PROG_INSTALL. Remove + stamp-h handling in AC_OUTPUT. + * acconfig.h: Mention PACKAGE and VERSION. + * stamp-h.in: New file. + * Makefile.in: Now built with automake. + * aclocal.m4: Now built with aclocal. + * config.in, configure: Rebuild. + + From Ton van Overbeek <tvoverbe@wk.estec.esa.nl>: + * rcparse.y (dialog): Default menu and class to be named. + (styles): If FONT is seen, set DS_SETFONT in dialog style. + * resbin.c (res_to_bin_dialog): Correct computation of font + information length. + +Wed Jul 30 11:21:06 1997 Ian Lance Taylor <ian@cygnus.com> + + From Ton van Overbeek <tvoverbe@wk.estec.esa.nl>: + * resbin.c (res_to_bin_menu): Correct computation of menu + vs. menuex length. + * resrc.c (define_stringtable): Add 1 to resource ID. + +Tue Jul 29 11:06:03 1997 Ian Lance Taylor <ian@cygnus.com> + + * resbin.c (bin_to_res_string): Correct adjustment of data and + length. From Ton van Overbeek <tvoverbe@wk.estec.esa.nl>. + +Tue Jul 22 18:01:23 1997 Ian Lance Taylor <ian@cygnus.com> + + * nlmconv.c (link_inputs): Call libiberty pexecute function. + (pexecute) [multiple versions]: Remove. + +Tue Jul 22 16:19:34 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE> + + * bucomm.c (make_tempname): If we might be using a DOS filesystem, + check for a backslash as well as a slash. + +Thu Jun 26 13:53:17 1997 Ian Lance Taylor <ian@cygnus.com> + + * windres.c (main): Quit if we didn't get any resources. + (usage): Fix --yydebug usage message. + * rescoff.c (write_coff_file): Don't free the relocation array + until after we've closed the BFD. + (read_coff_rsrc): Quit rather than try to read standard input. + (write_coff_file): Quit rather than try to write to standard + output. + * rcparse.y: Add a couple of missing semicolons (accepted by bison + but not byacc). + * binutils.texi: Document windres. + +Wed Jun 25 20:57:06 1997 Ian Lance Taylor <ian@cygnus.com> + + * resbin.c: New file. + * rclex.l, rcparse.y, rescoff.c, resrc.c, windres.c, windres.h: + Numerous fixes and improvements. + * Makefile.in: Rebuild dependencies. + (CFILES): Add resbin.c. + (WINDRES_OBJS): Add resbin.o. + +Sun Jun 22 17:29:41 1997 Ian Lance Taylor <ian@cygnus.com> + + First stab at Windows resource compiler: + * windres.h: New file. + * windres.c: New file. + * resrc.c: New file. + * rcparse.y: New file. + * rclex.l: New file. + * rescoff.c: New file. + * configure.in: Define and substitute BUILD_WINDRES. + * configure: Rebuild. + * Makefile.in: Rebuild dependencies. + (WINDRES_PROG): New variable. + (PROGS): Add @BUILD_WINDRES@. + (HFILES): Add dlltool.h and windres.h. + (CFILES): Add windres.c and resrc.c. + (GENERATED_CFILES): Add rcparse.c and rclex.c. + (WINDRES_OBJS): New variable. + $(WINDRES_PROG): New target. + (rcparse.c, rcparse.h, rclex.c): New targets. + +Thu Jun 12 12:27:51 1997 Ian Lance Taylor <ian@cygnus.com> + + * dlltool.c (export_type): Add data field. + (def_exports): Add data parameter. Change all callers. + (dump_def_info): Print data field. + (gen_def_file): Likewise. + (make_one_lib_file): Handle data field by not emitting simple + label and not emitting anything in SEC_TEXT. + (dtab): Print data field. + (process_duplicates): Merge data field. + * dlltool.h (def_exports): Update declaration. + * defparse.y (expline): Accept opt_DATA. Pass it to def_exports. + (opt_DATA): New non-terminal. + +Wed Jun 11 17:15:47 1997 Ian Lance Taylor <ian@cygnus.com> + + * dlltool.h: New file. + * deflex.l: Include dlltool.h and libiberty.h. Don't declare + strdup. Use xstrdup rather than strdup. + * defparse.y: Include bfd.h, bucomm.h, and dlltool.h. + * dlltool.c: Include dlltool.h and time.h. Make a lot of + variables and functions static. Make a lot of char * variables + and parameters const. Add declarations for static functions. Do + some reindenting. Hide more PowerPC stuff inside DLLTOOL_PPC. + +Wed Jun 11 12:05:52 1997 H.J. Lu <hjl@gnu.ai.mit.edu> + + * ar.c (bfd_special_undocumented_glue): Add const. + +Mon May 12 22:09:35 1997 Bob Manson <manson@charmed.cygnus.com> + + * Makefile.in (check): Pass CC_FOR_TARGET and CFLAGS_FOR_TARGET + to runtest. Mon May 12 13:14:22 1997 Ian Lance Taylor <ian@cygnus.com> @@ -13,8 +573,20 @@ Fri Apr 25 14:22:08 1997 H.J. Lu <hjl@gnu.ai.mit.edu> * Makefile.in (maintainer-clean realclean): Change *.info* to binutils.info* to save sysroff.info. +Tue Apr 15 13:42:22 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (INSTALL): Set to @INSTALL@. + (INSTALL_XFORM, INSTALL_XFORM1): Remove. + (install): Depend upon installdirs. Use $(program_transform_name) + directly, rather than using $(INSTALL_XFORM) and + $(INSTALL_XFORM1). + (installdirs): New target. + (install-info): Run mkinstalldirs. + Mon Apr 14 11:52:39 1997 Ian Lance Taylor <ian@cygnus.com> + * Makefile.in (INSTALL): Change install.sh to install-sh. + From Thomas Graichen <graichen@rzpd.de>: * Makefile.in: Always use $(SHELL) when running move-if-change. * configure.in: Use ${CONFIG_SHELL} when running $ac_config_sub. @@ -31,9 +603,11 @@ Fri Apr 4 13:28:02 1997 Ian Lance Taylor <ian@cygnus.com> * Makefile.in (distclean): Remove site.exp and site.bak. Remove everything that clean removes. -Thu Apr 3 18:53:31 1997 Ian Lance Taylor <ian@cygnus.com> +Thu Apr 3 13:18:39 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (VERSION): Set to 2.8.1. - * Makefile.in (VERSION): Set to 2.8. + * Branched binutils 2.8. Tue Apr 1 16:21:44 1997 Klaus Kaempf <kkaempf@progis.de> diff --git a/gnu/dist/binutils/Makefile.am b/gnu/dist/binutils/Makefile.am new file mode 100644 index 00000000000..169146ddedb --- /dev/null +++ b/gnu/dist/binutils/Makefile.am @@ -0,0 +1,449 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus dejagnu + +tooldir = $(exec_prefix)/$(target_alias) + +## These aren't set by automake, because they appear in +## bfd/acinclude.m4, which is included by binutils/acinclude.m4, and +## thus is not seen by automake. +CC_FOR_BUILD = @CC_FOR_BUILD@ +EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ + +YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi` +YFLAGS = -d +LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` + +# these two are almost the same program +AR_PROG=ar +RANLIB_PROG=ranlib + +# objcopy and strip should be the same program +OBJCOPY_PROG=objcopy +STRIP_PROG=strip-new + +STRINGS_PROG=strings + +# These should all be the same program too. +SIZE_PROG=size +NM_PROG=nm-new +OBJDUMP_PROG=objdump + +# This is the demangler, as a standalone program. +# Note: This one is used as the installed name too, unlike the above. +DEMANGLER_PROG=c++filt + +ADDR2LINE_PROG=addr2line + +NLMCONV_PROG=nlmconv +DLLTOOL_PROG=dlltool +WINDRES_PROG=windres + +SRCONV_PROG=srconv sysdump coffdump + +man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \ + addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1 + +PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) + +bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) + +## We need a special rule to install the programs which are built with -new +noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) + +EXTRA_PROGRAMS = $(NLMCONV_PROG) $(SRCONV_PROG) $(DLLTOOL_PROG) $(WINDRES_PROG) + +# Stuff that goes in tooldir/ if appropriate +TOOL_PROGS = nm-new strip-new ar ranlib dlltool + +BASEDIR = $(srcdir)/.. +BFDDIR = $(BASEDIR)/bfd +INCDIR = $(BASEDIR)/include + +DEP = mkdep + +INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ + +HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \ + windres.h + +GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h + +CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \ + dlltool.c filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \ + maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \ + objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \ + stabs.c strings.c sysdump.c version.c wrstabs.c \ + windres.c resrc.c rescoff.c resbin.c + +GENERATED_CFILES = \ + underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \ + defparse.c deflex.c nlmheader.c rcparse.c rclex.c + +DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c +WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c + +# Code shared by all the binutils. +BULIBS = bucomm.c version.c filemode.c + +BFDLIB = ../bfd/libbfd.la + +OPCODES = ../opcodes/libopcodes.la + +LIBIBERTY = ../libiberty/libiberty.a + +EXPECT = `if [ -f $$r/../expect/expect ] ; then \ + echo $$r/../expect/expect ; \ + else echo expect ; fi` +RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \ + echo ${srcdir}/../dejagnu/runtest ; \ + else echo runtest ; fi` + +CC_FOR_TARGET = ` \ + if [ -f $$r/../gcc/xgcc ] ; then \ + if [ -f $$r/../newlib/Makefile ] ; then \ + echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \ + else \ + echo $$r/../gcc/xgcc -B$$r/../gcc/; \ + fi; \ + else \ + if [ "@host@" = "@target@" ] ; then \ + echo $(CC); \ + else \ + echo gcc | sed '$(transform)'; \ + fi; \ + fi` + +check-DEJAGNU: site.exp + srcdir=`cd $(srcdir) && pwd`; export srcdir; \ + r=`pwd`; export r; \ + EXPECT=$(EXPECT); export EXPECT; \ + if [ -f $(top_builddir)/../expect/expect ]; then \ + TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ + export TCL_LIBRARY; \ + fi; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \ + CC_FOR_TARGET="$(CC_FOR_TARGET)" \ + CFLAGS_FOR_TARGET="$(CFLAGS)" $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi + +installcheck: + /bin/sh $(srcdir)/sanity.sh $(bindir) + +info_TEXINFOS = binutils.texi + +LDADD = $(BFDLIB) $(LIBIBERTY) + +size_SOURCES = size.c $(BULIBS) + +objcopy_SOURCES = objcopy.c not-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS) + +strings_SOURCES = strings.c $(BULIBS) + +strip_new_SOURCES = objcopy.c is-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS) + +nm_new_SOURCES = nm.c $(BULIBS) + +objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS) +objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) + +underscore.c: stamp-under ; @true + +stamp-under: Makefile + echo '/*WARNING: This file is automatically generated!*/' >underscore.t + echo "int prepends_underscore = @UNDERSCORE@;" >>underscore.t + $(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c + touch stamp-under + +cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h + $(COMPILE) -c -DMAIN -DVERSION='"$(VERSION)"' $(BASEDIR)/libiberty/cplus-dem.c + +c__filt_SOURCES = +c__filt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) + +ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c $(BULIBS) +ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ + +ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c $(BULIBS) +ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ + +addr2line_SOURCES = addr2line.c $(BULIBS) + +# The following is commented out for the convertion to automake. +# This rule creates a single binary that switches between ar and ranlib +# by looking at argv[0]. Use this kludge to save some disk space. +# However, you have to install things by hand. +# (That is after 'make install', replace the installed ranlib by a link to ar.) +# Alternatively, you can install ranlib.sh as ranlib. +# ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o +# $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) +# -rm -f $(RANLIB_PROG) +# -ln $(AR_PROG) $(RANLIB_PROG) +# +# objcopy and strip in one binary that uses argv[0] to decide its action. +# +#objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o +# $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS) +# -rm -f $(STRIP_PROG) +# -ln $(OBJCOPY_PROG) $(STRIP_PROG) + +sysroff.c: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info + ./sysinfo$(EXEEXT_FOR_BUILD) -c <$(srcdir)/sysroff.info >sysroff.c + ./sysinfo$(EXEEXT_FOR_BUILD) -i <$(srcdir)/sysroff.info >>sysroff.c + ./sysinfo$(EXEEXT_FOR_BUILD) -g <$(srcdir)/sysroff.info >>sysroff.c + +sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info + ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h + +sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o + $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o + +syslex.o: syslex.c sysinfo.h + if [ -r syslex.c ]; then \ + $(CC_FOR_BUILD) -c -I. $(CFLAGS) syslex.c ; \ + else \ + $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(CFLAGS) $(srcdir)/syslex.c ;\ + fi + +sysinfo.o: sysinfo.c + if [ -r sysinfo.c ]; then \ + $(CC_FOR_BUILD) -c -I. $(CFLAGS) sysinfo.c ; \ + else \ + $(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \ + fi + +srconv_SOURCES = srconv.c coffgrok.c $(BULIBS) + +dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS) +dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ + +dlltool.o:dlltool.c + $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c + +coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS) + +sysdump_SOURCES = sysdump.c $(BULIBS) + +# coff/sym.h and coff/ecoff.h won't be found by the automatic dependency +# scripts, since they are only included conditionally. +nlmconv.o: nlmconv.c $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h + ldname=`echo ld | sed '$(transform)'`; \ + $(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c + +nlmconv_SOURCES = nlmconv.c nlmheader.y $(BULIBS) + +windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \ + $(BULIBS) +windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ + +DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \ + syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c + +diststuff: $(DISTSTUFF) info + +DISTCLEANFILES = stamp-under sysinfo underscore.c sysroff.c sysroff.h \ + site.exp site.bak + +# Targets to rebuild dependencies in this Makefile. +# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES). +.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h + rm -f .dep1 + $(MAKE) DEP=$(DEP) .dep1 + sed -f dep.sed <.dep1 >.dep + +# This rule really wants a mkdep that runs "gcc -MM". +.dep1: $(CFILES) $(GENERATED_CFILES) + rm -f .dep2 + echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2 + $(DEP) -f .dep2 $(INCLUDES) $? + $(SHELL) $(srcdir)/../move-if-change .dep2 .dep1 + +dep.sed: dep-in.sed config.status + objdir=`pwd`; \ + sed <$(srcdir)/dep-in.sed >dep.sed \ + -e 's!@INCDIR@!$(INCDIR)!' \ + -e 's!@BFDDIR@!$(BFDDIR)!' \ + -e 's!@SRCDIR@!$(srcdir)!' \ + -e "s!@OBJDIR@!$${objdir}!" + +dep: .dep + sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile + cat .dep >> tmp-Makefile + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile + +dep-in: .dep + sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in + cat .dep >> tmp-Makefile.in + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in + +dep-am: .dep + sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am + cat .dep >> tmp-Makefile.am + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am + +.PHONY: dep dep-in dep-am + +### +# DOCUMENTATION TARGETS +config.texi: Makefile + rm -f config.texi + echo '@set VERSION $(VERSION)' > config.texi + +binutils.dvi: $(srcdir)/binutils.texi config.texi + +binutils.info: $(srcdir)/binutils.texi config.texi + +$(DEMANGLER_PROG).1: cxxfilt.man Makefile + sed -e 's/@PROGRAM@/$(DEMANGLER_PROG)/' < $(srcdir)/cxxfilt.man \ + > $(DEMANGLER_PROG).1 + +MOSTLYCLEANFILES = sysinfo $(DEMANGLER_PROG).1 binutils.log binutils.sum \ + abcdefgh* +mostlyclean-local: + -rm -rf tmpdir + +CLEANFILES = dep.sed .dep .dep1 + +.PHONY: install-exec-local + +install-exec-local: $(bin_PROGRAMS) $(noinst_PROGRAMS) + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`; \ + else :; fi; \ + done + $(mkinstalldirs) $(tooldir)/bin + for i in $(TOOL_PROGS); do \ + if [ -f $$i$(EXEEXT) ]; then \ + j=`echo $$i | sed -e 's/-new//'`; \ + rm -f $(tooldir)/bin/$$j$(EXEEXT); \ + k=`echo $$j | sed '$(transform)'`; \ + if [ "$(bindir)/$$k$(EXEEXT)" != "$(tooldir)/bin/$$j$(EXEEXT)" ]; then \ + ln $(bindir)/$$k$(EXEEXT) $(tooldir)/bin/$$j$(EXEEXT) >/dev/null 2>/dev/null \ + || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$i$(EXEEXT) $(tooldir)/bin/$$j$(EXEEXT); \ + fi; \ + else true; \ + fi; \ + done + +# What appears below is generated by a hacked mkdep using gcc -MM. + +# DO NOT DELETE THIS LINE -- mkdep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h +ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h arsup.h +arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + arsup.h $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h +bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h +coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \ + $(INCDIR)/fopen-same.h +coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + coffgrok.h +debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h +dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/getopt.h $(INCDIR)/demangle.h dlltool.h +filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h +ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h +is-ranlib.o: is-ranlib.c +is-strip.o: is-strip.c +maybe-ranlib.o: maybe-ranlib.c +maybe-strip.o: maybe-strip.c +nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h nlmconv.h +nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/getopt.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h \ + $(INCDIR)/demangle.h $(INCDIR)/libiberty.h +not-ranlib.o: not-ranlib.c +not-strip.o: not-strip.c +objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/getopt.h $(INCDIR)/libiberty.h budbg.h +objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h +prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h +rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/coff/internal.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ + budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h +size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h +srconv.o: srconv.c bucomm.h config.h $(INCDIR)/fopen-same.h \ + sysroff.h coffgrok.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h sysroff.c +stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h +sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h sysroff.h \ + sysroff.c +version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h +wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def +windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/obstack.h windres.h +resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h +rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h +underscore.o: underscore.c +arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h arsup.h +arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h +sysroff.o: sysroff.c +sysinfo.o: sysinfo.c +syslex.o: syslex.c sysinfo.h +defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h dlltool.h +deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ + defparse.h dlltool.h +nlmheader.o: nlmheader.c ../bfd/bfd.h bucomm.h config.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + nlmconv.h +rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h +rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h rcparse.h + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/gnu/dist/binutils/Makefile.in b/gnu/dist/binutils/Makefile.in index 20d1a367586..34475defd55 100644 --- a/gnu/dist/binutils/Makefile.in +++ b/gnu/dist/binutils/Makefile.in @@ -1,86 +1,97 @@ -# Makefile for GNU binary-file utilities -# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. +# Makefile.in generated automatically by automake 1.2e from Makefile.am -# This file is part of GNU binutils. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program 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 of the License, or -# (at your option) any later version. -# # This program 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 this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. -VPATH = @srcdir@ -srcdir = @srcdir@ -target_alias = @target_alias@ -prefix = @prefix@ +SHELL = @SHELL@ -program_transform_name = @program_transform_name@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -tooldir = $(exec_prefix)/$(target_alias) +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ datadir = @datadir@ -mandir = @mandir@ -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ infodir = @infodir@ +mandir = @mandir@ includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ -SHELL = /bin/sh +top_builddir = . -INSTALL = `cd $(srcdir)/..;pwd`/install.sh -c +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ -INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)' -INSTALL_XFORM1 = $(INSTALL_XFORM) -b=.1 -m 644 - -AR = ar -AR_FLAGS = rc +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +BUILD_DLLTOOL = @BUILD_DLLTOOL@ +BUILD_NLMCONV = @BUILD_NLMCONV@ +BUILD_SRCONV = @BUILD_SRCONV@ +BUILD_WINDRES = @BUILD_WINDRES@ CC = @CC@ -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ -HLDFLAGS = @HLDFLAGS@ -HLDENV = @HLDENV@ -RPATH_ENVVAR = @RPATH_ENVVAR@ -MAKEINFO = makeinfo -TEXI2DVI = texi2dvi -RANLIB = ranlib -BISONFLAGS = -d -TEXI2ROFF=texi2roff -MAKEOVERRIDES= -CC_FOR_BUILD = @CC_FOR_BUILD@ -NM_FOR_TARGET = nm -NM = $(NM_FOR_TARGET) -SYMLINK = ln -s +DLLTOOL_DEFS = @DLLTOOL_DEFS@ +EXEEXT = @EXEEXT@ +HDEFINES = @HDEFINES@ +LD = @LD@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NLMCONV_DEFS = @NLMCONV_DEFS@ +NM = @NM@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +UNDERSCORE = @UNDERSCORE@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = cygnus dejagnu -BISON = bison -y -LEX_OPTIONS = -LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` +tooldir = $(exec_prefix)/$(target_alias) -# Distribution version -VERSION=2.8.1 -# Distribution name -DIST_NAME=binutils-${VERSION} +CC_FOR_BUILD = @CC_FOR_BUILD@ +EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -# Where to find texinfo.tex to format docn with TeX -TEXIDIR = $(srcdir)/../texinfo +YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi` +YFLAGS = -d +LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` # these two are almost the same program AR_PROG=ar @@ -88,13 +99,13 @@ RANLIB_PROG=ranlib # objcopy and strip should be the same program OBJCOPY_PROG=objcopy -STRIP_PROG=strip.new +STRIP_PROG=strip-new STRINGS_PROG=strings # These should all be the same program too. SIZE_PROG=size -NM_PROG=nm.new +NM_PROG=nm-new OBJDUMP_PROG=objdump # This is the demangler, as a standalone program. @@ -105,31 +116,34 @@ ADDR2LINE_PROG=addr2line NLMCONV_PROG=nlmconv DLLTOOL_PROG=dlltool +WINDRES_PROG=windres SRCONV_PROG=srconv sysdump coffdump -MANPAGES= ar nm objdump ranlib size strings strip objcopy addr2line nlmconv +man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \ + addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1 + +PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) -PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(ADDR2LINE_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ -STAGESTUFF = $(PROGS) *.o -# Files that can be generated, but should be in the distribution. -# Don't build $(DEMANGLER_PROG).1, since its name may vary with the -# configuration. -DISTSTUFF=arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \ - syslex.c deflex.c +bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) + +noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) + +EXTRA_PROGRAMS = $(NLMCONV_PROG) $(SRCONV_PROG) $(DLLTOOL_PROG) $(WINDRES_PROG) # Stuff that goes in tooldir/ if appropriate -TOOL_PROGS = nm.new strip.new ar ranlib $(DLLTOOL_PROG) +TOOL_PROGS = nm-new strip-new ar ranlib dlltool BASEDIR = $(srcdir)/.. BFDDIR = $(BASEDIR)/bfd INCDIR = $(BASEDIR)/include -INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) + DEP = mkdep -ALL_CFLAGS = -D_GNU_SOURCE $(INCLUDES) @HDEFINES@ $(CFLAGS) +INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h +HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \ + windres.h GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h @@ -137,31 +151,24 @@ CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \ dlltool.c filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \ maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \ objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \ - stabs.c strings.c sysdump.c version.c wrstabs.c + stabs.c strings.c sysdump.c version.c wrstabs.c \ + windres.c resrc.c rescoff.c resbin.c GENERATED_CFILES = \ underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \ - defparse.c deflex.c nlmheader.c + defparse.c deflex.c nlmheader.c rcparse.c rclex.c -.c.o: - $(CC) -c $(ALL_CFLAGS) $< - -DEBUG_OBJS = rddbg.o debug.o stabs.o ieee.o rdcoff.o -WRITE_DEBUG_OBJS = $(DEBUG_OBJS) wrstabs.o - -LIBIBERTY = ../libiberty/libiberty.a +DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c +WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c # Code shared by all the binutils. -BULIBS = bucomm.o version.o filemode.o +BULIBS = bucomm.c version.c filemode.c -BFDLIB_DEP = ../bfd/libbfd.a -BFDLIB = @BFDLIB@ +BFDLIB = ../bfd/libbfd.la -OPCODES_DEP = ../opcodes/libopcodes.a -OPCODES = @OPCODES@ +OPCODES = ../opcodes/libopcodes.la -ADDL_DEPS = $(BULIBS) $(BFDLIB_DEP) $(LIBIBERTY) -ADDL_LIBS = $(BULIBS) $(BFDLIB) $(LIBIBERTY) +LIBIBERTY = ../libiberty/libiberty.a EXPECT = `if [ -f $$r/../expect/expect ] ; then \ echo $$r/../expect/expect ; \ @@ -169,7 +176,6 @@ EXPECT = `if [ -f $$r/../expect/expect ] ; then \ RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \ echo ${srcdir}/../dejagnu/runtest ; \ else echo runtest ; fi` -RUNTESTFLAGS = CC_FOR_TARGET = ` \ if [ -f $$r/../gcc/xgcc ] ; then \ @@ -182,174 +188,781 @@ CC_FOR_TARGET = ` \ if [ "@host@" = "@target@" ] ; then \ echo $(CC); \ else \ - echo gcc | sed '$(program_transform_name)'; \ + echo gcc | sed '$(transform)'; \ fi; \ fi` -FLAGS_TO_PASS = \ - "CC=$(CC)" \ - "CFLAGS=$(CFLAGS)" \ - "RUNTEST=$(RUNTEST)" \ - "RUNTESTFLAGS=$(RUNTESTFLAGS)" -# -## The rules - -all: $(ADDL_DEPS) $(PROGS) - -# These targets are for the dejagnu testsuites. The file site.exp -# contains global variables that all the testsuites will use. - -site.exp: ./config.status Makefile - @echo "Making a new config file..." - @rm -f ./tmp? - @touch site.exp - @mv site.exp site.bak - @echo "## variables are automatically generated by make ##" > ./tmp0 - @echo "# Do not edit here. If you wish to override these" >> ./tmp0 - @echo "# values, add them to the last section" >> ./tmp0 - @echo "# HOST AND TARGET INFO" >> ./tmp0 - @echo "set host_os @host_os@" >> ./tmp0 - @echo "set host_alias @host_alias@" >> ./tmp0 - @echo "set host_cpu @host_cpu@" >> ./tmp0 - @echo "set host_vendor @host_vendor@" >> ./tmp0 - @echo "set target_os @target_os@" >> ./tmp0 - @echo "set target_alias @target_alias@" >> ./tmp0 - @echo "set target_cpu @target_cpu@" >> ./tmp0 - @echo "set target_vendor @target_vendor@" >> ./tmp0 - @echo "set host_triplet @host@" >> ./tmp0 - @echo "set target_triplet @target@" >> ./tmp0 - @echo "# DIRECTORY INFO" >> ./tmp0 - @echo "set objdir `pwd`" >> ./tmp0 - @echo "" >> ./tmp0 - @echo "## Variables generated by configure. Do Not Edit ##" >> ./tmp0 - @cat ./tmp0 > site.exp - @cat site.bak | sed \ - -e '1,/^## Variables generated by.*##/ d' >> site.exp - -@rm -f ./tmp? - -check: site.exp - r=`pwd`; export r ; \ - srcroot=`cd ${srcdir}; pwd` ; export srcroot ; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - $(RPATH_ENVVAR)=$$r/../bfd:$$r/../opcodes:$$$(RPATH_ENVVAR); \ - export $(RPATH_ENVVAR); \ - if [ -f $$r/../expect/expect ] ; then \ - TCL_LIBRARY=$${srcroot}/../tcl/library ; \ - export TCL_LIBRARY ; else true; fi ; \ - $(RUNTEST) --tool binutils --srcdir $(srcdir)/testsuite \ - $(RUNTESTFLAGS) CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" +info_TEXINFOS = binutils.texi -installcheck: - /bin/sh $(srcdir)/sanity.sh $(bindir) +LDADD = $(BFDLIB) $(LIBIBERTY) -info: binutils.info +size_SOURCES = size.c $(BULIBS) -dvi: binutils.dvi +objcopy_SOURCES = objcopy.c not-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS) -$(SIZE_PROG): $(ADDL_DEPS) size.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(EXTRALIBS) +strings_SOURCES = strings.c $(BULIBS) -$(OBJCOPY_PROG): $(ADDL_DEPS) objcopy.o not-strip.o $(WRITE_DEBUG_OBJS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o not-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS) +strip_new_SOURCES = objcopy.c is-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS) -$(STRINGS_PROG): $(ADDL_DEPS) strings.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(STRINGS_PROG) strings.o $(ADDL_LIBS) $(EXTRALIBS) +nm_new_SOURCES = nm.c $(BULIBS) -$(STRIP_PROG): $(ADDL_DEPS) objcopy.o is-strip.o $(WRITE_DEBUG_OBJS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(STRIP_PROG) objcopy.o is-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS) +objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS) +objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) -$(NM_PROG): $(ADDL_DEPS) nm.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(EXTRALIBS) +c__filt_SOURCES = +c__filt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) -$(OBJDUMP_PROG): $(ADDL_DEPS) objdump.o prdbg.o $(DEBUG_OBJS) $(OPCODES_DEP) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJDUMP_PROG) objdump.o prdbg.o $(DEBUG_OBJS) $(OPCODES) $(ADDL_LIBS) $(EXTRALIBS) +ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c $(BULIBS) +ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ -underscore.c: stamp-under ; @true +ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c $(BULIBS) +ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ -stamp-under: Makefile - echo '/*WARNING: This file is automatically generated!*/' >underscore.t - echo "int prepends_underscore = @UNDERSCORE@;" >>underscore.t - $(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c - touch stamp-under +addr2line_SOURCES = addr2line.c $(BULIBS) -version.o: version.c Makefile - $(CC) -DVERSION='"$(VERSION)"' $(ALL_CFLAGS) -c $(srcdir)/version.c +srconv_SOURCES = srconv.c coffgrok.c $(BULIBS) -bucomm.o: bucomm.c Makefile - $(CC) -DTARGET='"@target@"' $(ALL_CFLAGS) -c $(srcdir)/bucomm.c +dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS) +dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ -cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h - $(CC) -c -DMAIN -DVERSION='"$(VERSION)"' $(ALL_CFLAGS) $(BASEDIR)/libiberty/cplus-dem.c +coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS) + +sysdump_SOURCES = sysdump.c $(BULIBS) + +nlmconv_SOURCES = nlmconv.c nlmheader.y $(BULIBS) + +windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \ + $(BULIBS) +windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ + +DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \ + syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c + +DISTCLEANFILES = stamp-under sysinfo underscore.c sysroff.c sysroff.h \ + site.exp site.bak + +MOSTLYCLEANFILES = sysinfo $(DEMANGLER_PROG).1 binutils.log binutils.sum \ + abcdefgh* + +CLEANFILES = dep.sed .dep .dep1 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = size$(EXEEXT) objdump$(EXEEXT) ar$(EXEEXT) \ +strings$(EXEEXT) ranlib$(EXEEXT) c++filt$(EXEEXT) objcopy$(EXEEXT) \ +@BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ \ +addr2line$(EXEEXT) +noinst_PROGRAMS = nm-new$(EXEEXT) strip-new$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +nlmconv_OBJECTS = nlmconv.o nlmheader.o bucomm.o version.o filemode.o +nlmconv_LDADD = $(LDADD) +nlmconv_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +nlmconv_LDFLAGS = +srconv_OBJECTS = srconv.o coffgrok.o bucomm.o version.o filemode.o +srconv_LDADD = $(LDADD) +srconv_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +srconv_LDFLAGS = +sysdump_OBJECTS = sysdump.o bucomm.o version.o filemode.o +sysdump_LDADD = $(LDADD) +sysdump_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +sysdump_LDFLAGS = +coffdump_OBJECTS = coffdump.o coffgrok.o bucomm.o version.o filemode.o +coffdump_LDADD = $(LDADD) +coffdump_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +coffdump_LDFLAGS = +dlltool_OBJECTS = dlltool.o defparse.o deflex.o bucomm.o version.o \ +filemode.o +dlltool_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +dlltool_LDFLAGS = +windres_OBJECTS = windres.o resrc.o rescoff.o resbin.o rcparse.o \ +rclex.o bucomm.o version.o filemode.o +windres_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +windres_LDFLAGS = +size_OBJECTS = size.o bucomm.o version.o filemode.o +size_LDADD = $(LDADD) +size_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +size_LDFLAGS = +objdump_OBJECTS = objdump.o prdbg.o rddbg.o debug.o stabs.o ieee.o \ +rdcoff.o bucomm.o version.o filemode.o +objdump_DEPENDENCIES = ../opcodes/libopcodes.la ../bfd/libbfd.la \ +../libiberty/libiberty.a +objdump_LDFLAGS = +ar_OBJECTS = arparse.o arlex.o ar.o not-ranlib.o arsup.o bucomm.o \ +version.o filemode.o +ar_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +ar_LDFLAGS = +strings_OBJECTS = strings.o bucomm.o version.o filemode.o +strings_LDADD = $(LDADD) +strings_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +strings_LDFLAGS = +ranlib_OBJECTS = ar.o is-ranlib.o arparse.o arlex.o arsup.o bucomm.o \ +version.o filemode.o +ranlib_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +ranlib_LDFLAGS = +c__filt_OBJECTS = +c__filt_DEPENDENCIES = cplus-dem.o underscore.o \ +../libiberty/libiberty.a +c__filt_LDFLAGS = +objcopy_OBJECTS = objcopy.o not-strip.o rddbg.o debug.o stabs.o ieee.o \ +rdcoff.o wrstabs.o bucomm.o version.o filemode.o +objcopy_LDADD = $(LDADD) +objcopy_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +objcopy_LDFLAGS = +addr2line_OBJECTS = addr2line.o bucomm.o version.o filemode.o +addr2line_LDADD = $(LDADD) +addr2line_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +addr2line_LDFLAGS = +nm_new_OBJECTS = nm.o bucomm.o version.o filemode.o +nm_new_LDADD = $(LDADD) +nm_new_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +nm_new_LDFLAGS = +strip_new_OBJECTS = objcopy.o is-strip.o rddbg.o debug.o stabs.o ieee.o \ +rdcoff.o wrstabs.o bucomm.o version.o filemode.o +strip_new_LDADD = $(LDADD) +strip_new_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a +strip_new_LDFLAGS = +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LEXLIB = @LEXLIB@ +YLWRAP = $(top_srcdir)/../ylwrap +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi` +TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex +INFO_DEPS = binutils.info +DVIS = binutils.dvi +TEXINFOS = binutils.texi +MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1 + + +NROFF = nroff +DIST_COMMON = README ChangeLog Makefile.am Makefile.in NEWS acconfig.h \ +acinclude.m4 aclocal.m4 arlex.c arparse.c config.in configure \ +configure.in deflex.c defparse.c nlmheader.c rclex.c rcparse.c \ +stamp-h.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(c__filt_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) +OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(c__filt_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) + +default: all + +.SUFFIXES: +.SUFFIXES: .S .c .dvi .info .l .lo .o .ps .s .texi .texinfo .y +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINT@ configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @: +stamp-h: $(srcdir)/config.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \ + $(SHELL) ./config.status + @echo timestamp > stamp-h +$(srcdir)/config.in: @MAINT@$(srcdir)/stamp-h.in +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + $(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done + +mostlyclean-noinstPROGRAMS: + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +nlmconv$(EXEEXT): $(nlmconv_OBJECTS) $(nlmconv_DEPENDENCIES) + @rm -f nlmconv$(EXEEXT) + $(LINK) $(nlmconv_LDFLAGS) $(nlmconv_OBJECTS) $(nlmconv_LDADD) $(LIBS) + +srconv$(EXEEXT): $(srconv_OBJECTS) $(srconv_DEPENDENCIES) + @rm -f srconv$(EXEEXT) + $(LINK) $(srconv_LDFLAGS) $(srconv_OBJECTS) $(srconv_LDADD) $(LIBS) + +sysdump$(EXEEXT): $(sysdump_OBJECTS) $(sysdump_DEPENDENCIES) + @rm -f sysdump$(EXEEXT) + $(LINK) $(sysdump_LDFLAGS) $(sysdump_OBJECTS) $(sysdump_LDADD) $(LIBS) + +coffdump$(EXEEXT): $(coffdump_OBJECTS) $(coffdump_DEPENDENCIES) + @rm -f coffdump$(EXEEXT) + $(LINK) $(coffdump_LDFLAGS) $(coffdump_OBJECTS) $(coffdump_LDADD) $(LIBS) + +dlltool$(EXEEXT): $(dlltool_OBJECTS) $(dlltool_DEPENDENCIES) + @rm -f dlltool$(EXEEXT) + $(LINK) $(dlltool_LDFLAGS) $(dlltool_OBJECTS) $(dlltool_LDADD) $(LIBS) + +windres$(EXEEXT): $(windres_OBJECTS) $(windres_DEPENDENCIES) + @rm -f windres$(EXEEXT) + $(LINK) $(windres_LDFLAGS) $(windres_OBJECTS) $(windres_LDADD) $(LIBS) -$(DEMANGLER_PROG): cplus-dem.o $(LIBIBERTY) underscore.o $(DEMANGLER_PROG).1 - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(DEMANGLER_PROG) cplus-dem.o $(LIBIBERTY) $(EXTRALIBS) underscore.o +size$(EXEEXT): $(size_OBJECTS) $(size_DEPENDENCIES) + @rm -f size$(EXEEXT) + $(LINK) $(size_LDFLAGS) $(size_OBJECTS) $(size_LDADD) $(LIBS) -arparse.c: arparse.y - $(BISON) $(BISONFLAGS) $(srcdir)/arparse.y - mv -f y.tab.c arparse.c - mv -f y.tab.h arparse.h +objdump$(EXEEXT): $(objdump_OBJECTS) $(objdump_DEPENDENCIES) + @rm -f objdump$(EXEEXT) + $(LINK) $(objdump_LDFLAGS) $(objdump_OBJECTS) $(objdump_LDADD) $(LIBS) -# Separate from arparse.c so that a parallel make doesn't try to build -# both arparse.c and arparse.h simultaneously. +ar$(EXEEXT): $(ar_OBJECTS) $(ar_DEPENDENCIES) + @rm -f ar$(EXEEXT) + $(LINK) $(ar_LDFLAGS) $(ar_OBJECTS) $(ar_LDADD) $(LIBS) + +strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES) + @rm -f strings$(EXEEXT) + $(LINK) $(strings_LDFLAGS) $(strings_OBJECTS) $(strings_LDADD) $(LIBS) + +ranlib$(EXEEXT): $(ranlib_OBJECTS) $(ranlib_DEPENDENCIES) + @rm -f ranlib$(EXEEXT) + $(LINK) $(ranlib_LDFLAGS) $(ranlib_OBJECTS) $(ranlib_LDADD) $(LIBS) + +c++filt$(EXEEXT): $(c__filt_OBJECTS) $(c__filt_DEPENDENCIES) + @rm -f c++filt$(EXEEXT) + $(LINK) $(c__filt_LDFLAGS) $(c__filt_OBJECTS) $(c__filt_LDADD) $(LIBS) + +objcopy$(EXEEXT): $(objcopy_OBJECTS) $(objcopy_DEPENDENCIES) + @rm -f objcopy$(EXEEXT) + $(LINK) $(objcopy_LDFLAGS) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS) + +addr2line$(EXEEXT): $(addr2line_OBJECTS) $(addr2line_DEPENDENCIES) + @rm -f addr2line$(EXEEXT) + $(LINK) $(addr2line_LDFLAGS) $(addr2line_OBJECTS) $(addr2line_LDADD) $(LIBS) + +nm-new$(EXEEXT): $(nm_new_OBJECTS) $(nm_new_DEPENDENCIES) + @rm -f nm-new$(EXEEXT) + $(LINK) $(nm_new_LDFLAGS) $(nm_new_OBJECTS) $(nm_new_LDADD) $(LIBS) + +strip-new$(EXEEXT): $(strip_new_OBJECTS) $(strip_new_DEPENDENCIES) + @rm -f strip-new$(EXEEXT) + $(LINK) $(strip_new_LDFLAGS) $(strip_new_OBJECTS) $(strip_new_LDADD) $(LIBS) +.y.c: + $(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS) +defparse.h: defparse.c arparse.h: arparse.c +rcparse.h: rcparse.c +nlmheader.h: nlmheader.c + +.l.c: + $(SHELL) $(YLWRAP) "$(LEX)" $< $(LEX_OUTPUT_ROOT).c $@ -- $(LFLAGS) + +binutils.info: binutils.texi +binutils.dvi: binutils.texi + + +DVIPS = dvips + +.texi.info: + @rm -f $@ $@-[0-9] $@-[0-9][0-9] + $(MAKEINFO) -I $(srcdir) $< + +.texi.dvi: + TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \ + MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< + +.texi: + @rm -f $@ $@-[0-9] $@-[0-9][0-9] + $(MAKEINFO) -I $(srcdir) $< + +.texinfo.info: + @rm -f $@ $@-[0-9] $@-[0-9][0-9] + $(MAKEINFO) -I $(srcdir) $< + +.texinfo: + @rm -f $@ $@-[0-9] $@-[0-9][0-9] + $(MAKEINFO) -I $(srcdir) $< + +.texinfo.dvi: + TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \ + MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< +.dvi.ps: + $(DVIPS) $< -o $@ + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(infodir) + @for file in $(INFO_DEPS); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ + if test -f $$d/$$ifile; then \ + echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \ + $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ + for file in $(INFO_DEPS); do \ + echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\ + install-info --info-dir=$(infodir) $(infodir)/$$file || :;\ + done; \ + else : ; fi + +uninstall-info: + $(PRE_UNINSTALL) + @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ + ii=yes; \ + else ii=; fi; \ + for file in $(INFO_DEPS); do \ + test -z "$ii" \ + || install-info --info-dir=$(infodir) --remove $$file; \ + done + $(NORMAL_UNINSTALL) + for file in $(INFO_DEPS); do \ + (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ + done -arlex.c: arlex.l - $(LEX) $(LEX_OPTIONS) $(srcdir)/arlex.l - mv lex.yy.c arlex.c +dist-info: $(INFO_DEPS) + for base in $(INFO_DEPS); do \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + for file in `cd $$d && eval echo $$base*`; do \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done; \ + done -$(AR_PROG): $(ADDL_DEPS) ar.o arparse.o arlex.o not-ranlib.o arsup.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o arparse.o arlex.o arsup.o not-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) +mostlyclean-aminfo: + -rm -f binutils.aux binutils.cp binutils.cps binutils.dvi binutils.fn \ + binutils.fns binutils.ky binutils.kys binutils.ps \ + binutils.log binutils.pg binutils.toc binutils.tp \ + binutils.tps binutils.vr binutils.vrs binutils.op binutils.tr \ + binutils.cv binutils.cn -$(RANLIB_PROG): $(ADDL_DEPS) ar.o is-ranlib.o arparse.o arlex.o arsup.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(RANLIB_PROG) ar.o arparse.o arlex.o arsup.o is-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) +clean-aminfo: -$(ADDR2LINE_PROG): $(ADDL_DEPS) addr2line.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(ADDR2LINE_PROG) addr2line.o $(ADDL_LIBS) $(EXTRALIBS) +distclean-aminfo: -# This rule creates a single binary that switches between ar and ranlib -# by looking at argv[0]. Use this kludge to save some disk space. -# However, you have to install things by hand. -# (That is after 'make install', replace the installed ranlib by a link to ar.) +maintainer-clean-aminfo: + for i in $(INFO_DEPS); do \ + rm -f $$i; \ + if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ + rm -f $$i-[0-9]*; \ + fi; \ + done +clean-info: mostlyclean-aminfo +install-man: $(MANS) + $(NORMAL_INSTALL) + $(mkinstalldirs) $(mandir)/man1 + @sect=1; \ + inst=`echo "ar" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/ar.1; then file=$(srcdir)/ar.1; \ + else file=ar.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "nlmconv" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/nlmconv.1; then file=$(srcdir)/nlmconv.1; \ + else file=nlmconv.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "$(DEMANGLER_PROG)" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/$(DEMANGLER_PROG).1; then file=$(srcdir)/$(DEMANGLER_PROG).1; \ + else file=$(DEMANGLER_PROG).1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "nm" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/nm.1; then file=$(srcdir)/nm.1; \ + else file=nm.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "objdump" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/objdump.1; then file=$(srcdir)/objdump.1; \ + else file=objdump.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "ranlib" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/ranlib.1; then file=$(srcdir)/ranlib.1; \ + else file=ranlib.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "size" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/size.1; then file=$(srcdir)/size.1; \ + else file=size.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "strings" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/strings.1; then file=$(srcdir)/strings.1; \ + else file=strings.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "strip" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/strip.1; then file=$(srcdir)/strip.1; \ + else file=strip.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "objcopy" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/objcopy.1; then file=$(srcdir)/objcopy.1; \ + else file=objcopy.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + @sect=1; \ + inst=`echo "addr2line" | sed '$(transform)'`.1; \ + if test -f $(srcdir)/addr2line.1; then file=$(srcdir)/addr2line.1; \ + else file=addr2line.1; fi; \ + echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ + $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst + +uninstall-man: + $(NORMAL_UNINSTALL) + -inst=`echo "ar" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "nlmconv" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "$(DEMANGLER_PROG)" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "nm" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "objdump" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "ranlib" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "size" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "strings" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "strip" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "objcopy" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + -inst=`echo "addr2line" | sed '$(transform)'`.1; \ + rm -f $(mandir)/man1/$$inst + + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) \ + && $(MAKE) dvi \ + && $(MAKE) check \ + && $(MAKE) install \ + && $(MAKE) installcheck \ + && $(MAKE) dist + -rm -rf $(distdir) + @echo "========================"; \ + echo "$(distdir).tar.gz is ready for distribution"; \ + echo "========================" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done + $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info -# Alternatively, you can install ranlib.sh as ranlib. +RUNTESTFLAGS = -ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) - -rm -f $(RANLIB_PROG) - -ln $(AR_PROG) $(RANLIB_PROG) +DEJATOOL = $(PACKAGE) + +RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir +site.exp: Makefile + @echo 'Making a new site.exp file...' + -@rm -f site.bak + @echo '## these variables are automatically generated by make ##' > $@-t + @echo '# Do not edit here. If you wish to override these values' >> $@-t + @echo '# edit the last section' >> $@-t + @echo 'set tool $(DEJATOOL)' >> $@-t + @echo 'set srcdir $(srcdir)' >> $@-t + @echo 'set objdir' `pwd` >> $@-t + @echo 'set host_alias $(host_alias)' >> $@-t + @echo 'set host_triplet $(host_triplet)' >> $@-t + @echo 'set target_alias $(target_alias)' >> $@-t + @echo 'set target_triplet $(target_triplet)' >> $@-t + @echo 'set build_alias $(build_alias)' >> $@-t + @echo 'set build_triplet $(build_triplet)' >> $@-t + @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t + -@sed '1,/^## All variables above are.*##/ d' site.bak >> $@-t + -@mv site.exp site.bak + @mv $@-t site.exp +info: $(INFO_DEPS) +dvi: $(DVIS) +check: + $(MAKE) check-DEJAGNU +installcheck: +install-info: install-info-am +install-exec: install-binPROGRAMS install-exec-local + @$(NORMAL_INSTALL) -# objcopy and strip in one binary that uses argv[0] to decide its action. +install-data: install-man + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: uninstall-binPROGRAMS uninstall-man + +all: Makefile $(PROGRAMS) $(MANS) config.h -objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS) - -rm -f $(STRIP_PROG) - -ln $(OBJCOPY_PROG) $(STRIP_PROG) +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + $(mkinstalldirs) $(bindir) $(mandir)/man1 -sysroff.c: sysinfo sysroff.info - ./sysinfo -c <$(srcdir)/sysroff.info >sysroff.c - ./sysinfo -i <$(srcdir)/sysroff.info >>sysroff.c - ./sysinfo -g <$(srcdir)/sysroff.info >>sysroff.c -sysroff.h: sysinfo sysroff.info - ./sysinfo -d <$(srcdir)/sysroff.info >sysroff.h +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) -# Depend upon arparse.c to avoid building both arparse.c and sysinfo.c -# simultaneously. -sysinfo.c: sysinfo.y arparse.c - $(BISON) -tvd $(srcdir)/sysinfo.y - rm -f sysinfo.c - mv -f y.tab.c sysinfo.c - mv -f y.tab.h sysinfo.h +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) -# Separate from sysinfo.c so that a parallel make doesn't try to build -# both sysinfo.c and sysinfo.h simultaneously. -sysinfo.h: sysinfo.c +distclean-generic: + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -syslex.c : syslex.l - $(LEX) $(LEX_OPTIONS) $(srcdir)/syslex.l - mv lex.yy.c syslex.c +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-hdr mostlyclean-binPROGRAMS \ + mostlyclean-noinstPROGRAMS mostlyclean-compile \ + mostlyclean-libtool mostlyclean-aminfo mostlyclean-tags \ + mostlyclean-generic mostlyclean-local -sysinfo: sysinfo.o syslex.o +clean: clean-hdr clean-binPROGRAMS clean-noinstPROGRAMS clean-compile \ + clean-libtool clean-aminfo clean-tags clean-generic \ + mostlyclean + +distclean: distclean-hdr distclean-binPROGRAMS distclean-noinstPROGRAMS \ + distclean-compile distclean-libtool distclean-aminfo \ + distclean-tags distclean-generic clean + -rm -f config.status + -rm -f libtool + +maintainer-clean: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ + maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-aminfo maintainer-clean-tags \ + maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + -rm -f config.status + +.PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \ +maintainer-clean-hdr mostlyclean-binPROGRAMS distclean-binPROGRAMS \ +clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ +install-binPROGRAMS mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ +clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool install-info-am uninstall-info \ +mostlyclean-aminfo distclean-aminfo clean-aminfo \ +maintainer-clean-aminfo install-man uninstall-man tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir check-DEJAGNU \ +info dvi installcheck install-info install-exec install-data install \ +uninstall all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean + + +check-DEJAGNU: site.exp + srcdir=`cd $(srcdir) && pwd`; export srcdir; \ + r=`pwd`; export r; \ + EXPECT=$(EXPECT); export EXPECT; \ + if [ -f $(top_builddir)/../expect/expect ]; then \ + TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ + export TCL_LIBRARY; \ + fi; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \ + CC_FOR_TARGET="$(CC_FOR_TARGET)" \ + CFLAGS_FOR_TARGET="$(CFLAGS)" $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi + +installcheck: + /bin/sh $(srcdir)/sanity.sh $(bindir) + +underscore.c: stamp-under ; @true + +stamp-under: Makefile + echo '/*WARNING: This file is automatically generated!*/' >underscore.t + echo "int prepends_underscore = @UNDERSCORE@;" >>underscore.t + $(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c + touch stamp-under + +cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h + $(COMPILE) -c -DMAIN -DVERSION='"$(VERSION)"' $(BASEDIR)/libiberty/cplus-dem.c + +# The following is commented out for the convertion to automake. +# This rule creates a single binary that switches between ar and ranlib +# by looking at argv[0]. Use this kludge to save some disk space. +# However, you have to install things by hand. +# (That is after 'make install', replace the installed ranlib by a link to ar.) +# Alternatively, you can install ranlib.sh as ranlib. +# ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o +# $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS) +# -rm -f $(RANLIB_PROG) +# -ln $(AR_PROG) $(RANLIB_PROG) +# +# objcopy and strip in one binary that uses argv[0] to decide its action. +# +#objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o +# $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS) +# -rm -f $(STRIP_PROG) +# -ln $(OBJCOPY_PROG) $(STRIP_PROG) + +sysroff.c: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info + ./sysinfo$(EXEEXT_FOR_BUILD) -c <$(srcdir)/sysroff.info >sysroff.c + ./sysinfo$(EXEEXT_FOR_BUILD) -i <$(srcdir)/sysroff.info >>sysroff.c + ./sysinfo$(EXEEXT_FOR_BUILD) -g <$(srcdir)/sysroff.info >>sysroff.c + +sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info + ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h + +sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o syslex.o: syslex.c sysinfo.h @@ -366,47 +979,16 @@ sysinfo.o: sysinfo.c $(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \ fi -srconv: srconv.o coffgrok.o $(ADDL_DEPS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ srconv.o coffgrok.o $(ADDL_LIBS) $(EXTRALIBS) - -dlltool: dlltool.o defparse.o deflex.o cplus-dem.o $(ADDL_DEPS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ dlltool.o defparse.o deflex.o $(ADDL_LIBS) $(EXTRALIBS) - -defparse.c:defparse.y - $(BISON) $(BISONFLAGS) $(srcdir)/defparse.y - mv -f y.tab.c defparse.c - mv -f y.tab.h defparse.h - -defparse.h: defparse.c - -deflex.c:deflex.l - $(LEX) $(LEX_OPTIONS) $(srcdir)/deflex.l - mv lex.yy.c deflex.c - dlltool.o:dlltool.c - $(CC) -c @DLLTOOL_DEFS@ $(ALL_CFLAGS) $(srcdir)/dlltool.c - -coffdump: coffdump.o coffgrok.o $(ADDL_DEPS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ coffdump.o coffgrok.o $(ADDL_LIBS) $(EXTRALIBS) - -sysdump: sysdump.o $(ADDL_DEPS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ sysdump.o $(ADDL_LIBS) $(EXTRALIBS) - -# Depend upon sysinfo.c to avoid building both nlmheader.c and sysinfo.c -# simultaneously. -nlmheader.c: nlmheader.y sysinfo.c - $(BISON) $(srcdir)/nlmheader.y - rm -f nlmheader.c - mv -f y.tab.c nlmheader.c + $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c # coff/sym.h and coff/ecoff.h won't be found by the automatic dependency # scripts, since they are only included conditionally. nlmconv.o: nlmconv.c $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h - ldname=`echo ld | sed '$(program_transform_name)'`; \ - $(CC) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(ALL_CFLAGS) $(srcdir)/nlmconv.c + ldname=`echo ld | sed '$(transform)'`; \ + $(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c -$(NLMCONV_PROG): nlmconv.o nlmheader.o $(ADDL_DEPS) - $(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ nlmconv.o nlmheader.o $(ADDL_LIBS) $(EXTRALIBS) +diststuff: $(DISTSTUFF) info # Targets to rebuild dependencies in this Makefile. # Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES). @@ -419,14 +1001,16 @@ $(NLMCONV_PROG): nlmconv.o nlmheader.o $(ADDL_DEPS) .dep1: $(CFILES) $(GENERATED_CFILES) rm -f .dep2 echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2 - $(DEP) -f .dep2 $(ALL_CFLAGS) $? + $(DEP) -f .dep2 $(INCLUDES) $? $(SHELL) $(srcdir)/../move-if-change .dep2 .dep1 dep.sed: dep-in.sed config.status + objdir=`pwd`; \ sed <$(srcdir)/dep-in.sed >dep.sed \ -e 's!@INCDIR@!$(INCDIR)!' \ -e 's!@BFDDIR@!$(BFDDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' + -e 's!@SRCDIR@!$(srcdir)!' \ + -e "s!@OBJDIR@!$${objdir}!" dep: .dep sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -438,218 +1022,52 @@ dep-in: .dep cat .dep >> tmp-Makefile.in $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in -.PHONY: dep dep-in +dep-am: .dep + sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am + cat .dep >> tmp-Makefile.am + $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am + +.PHONY: dep dep-in dep-am ### # DOCUMENTATION TARGETS config.texi: Makefile rm -f config.texi echo '@set VERSION $(VERSION)' > config.texi -# TeX output + binutils.dvi: $(srcdir)/binutils.texi config.texi - TEXINPUTS=$(TEXIDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/binutils.texi -# info file for online browsing binutils.info: $(srcdir)/binutils.texi config.texi - $(MAKEINFO) -o binutils.info $(srcdir)/binutils.texi $(DEMANGLER_PROG).1: cxxfilt.man Makefile sed -e 's/@PROGRAM@/$(DEMANGLER_PROG)/' < $(srcdir)/cxxfilt.man \ > $(DEMANGLER_PROG).1 - -# different targets for -ms, -mm, -me -# Try to use a recent texi2roff. v2 was put on prep in jan91. -# If you want an index, see texi2roff doc for postprocessing -# and add -i to texi2roff invocations below. -# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete -# corresponding -e lines when later texi2roff's are current) -# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs. -# + @c's deleted explicitly because texi2roff sees texinfo commands in them -# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank -# + @alphaenumerate is ridiculously new, turned into @enumerate - -# roff output (-ms) -binutils.ms: $(srcdir)/binutils.texi - sed -e '/\\input texinfo/d' \ - -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ - -e '/^@ifinfo/,/^@end ifinfo/d' \ - -e '/^@c/d' \ - -e 's/{.*,,/{/' \ - -e 's/@ / /g' \ - -e 's/^@alphaenumerate/@enumerate/g' \ - -e 's/^@end alphaenumerate/@end enumerate/g' \ - $(srcdir)/binutils.texi | \ - $(TEXI2ROFF) -ms | \ - sed -e 's/---/\\(em/g' \ - >binutils.ms - -# roff output (-mm) -# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer, -# try leaving them in -binutils.mm: $(srcdir)/binutils.texi - sed -e '/\\input texinfo/d' \ - -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ - -e '/^@ifinfo/,/^@end ifinfo/d' \ - -e '/^@c/d' \ - -e 's/{.*,,/{/' \ - -e '/@noindent/d' \ - -e 's/@ / /g' \ - -e 's/^@alphaenumerate/@enumerate/g' \ - -e 's/^@end alphaenumerate/@end enumerate/g' \ - $(srcdir)/binutils.texi | \ - $(TEXI2ROFF) -mm | \ - sed -e 's/---/\\(em/g' \ - >binutils.mm - -# roff output (-me) -binutils.me: $(srcdir)/binutils.texi - sed -e '/\\input texinfo/d' \ - -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ - -e '/^@ifinfo/,/^@end ifinfo/d' \ - -e '/^@c/d' \ - -e 's/{.*,,/{/' \ - -e 's/@ / /g' \ - -e 's/^@alphaenumerate/@enumerate/g' \ - -e 's/^@end alphaenumerate/@end enumerate/g' \ - $(srcdir)/binutils.texi | \ - $(TEXI2ROFF) -me | \ - sed -e 's/---/\\(em/g' \ - >binutils.me - - -### - -mostlyclean: - -rm -f *.o *~ \#* core binutils.?? binutils.??? y.output - -rm -rf tmpdir -clean: mostlyclean - -rm -f $(PROGS) $(DEMANGLER_PROG).1 stamp-under - -rm -f underscore.c sysroff sysroff.c sysroff.h sysinfo dep.sed -distclean: - -rm -f Makefile config.status *.o *~ \#* core y.* - -rm -f binutils.?? binutils.??? binutils.aux binutils.log binutils.toc - -rm -f $(PROGS) underscore.c config.h stamp-h config.cache config.log - -rm -f dep.sed stamp-under $(DEMANGLER_PROG).1 site.bak site.exp - -rm -f sysroff sysroff.c sysroff.h sysinfo +mostlyclean-local: -rm -rf tmpdir -maintainer-clean realclean: clean distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -rm -f $(DISTSTUFF) binutils.info* TAGS - -etags tags: TAGS -TAGS: force - etags $(INCDIR)/*.h $(srcdir)/*.[hc] +.PHONY: install-exec-local -install: all - for i in $(PROGS) ; do \ - $(INSTALL_XFORM) $$i $(bindir)/`echo $$i | sed -e 's/.new//'` ; \ - done - for i in $(MANPAGES) ; do \ - $(INSTALL_XFORM1) $(srcdir)/$$i.1 $(man1dir)/$$i.1 ; \ +install-exec-local: $(bin_PROGRAMS) $(noinst_PROGRAMS) + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`; \ + else :; fi; \ done - if [ x$(DEMANGLER_PROG) != x ]; then \ - $(INSTALL_XFORM1) $(DEMANGLER_PROG).1 $(man1dir)/$(DEMANGLER_PROG).1; \ - fi - test -d $(tooldir) || mkdir $(tooldir) - test -d $(tooldir)/bin || mkdir $(tooldir)/bin - for i in $(TOOL_PROGS) ; do \ - if [ -f $$i ]; then \ - j=`echo $$i | sed -e 's/.new//'`; \ - rm -f $(tooldir)/bin/$$j; \ - k=`echo $$j | sed '$(program_transform_name)'`; \ - ln $(bindir)/$$k $(tooldir)/bin/$$j >/dev/null 2>/dev/null \ - || $(INSTALL_PROGRAM) $$i $(tooldir)/bin/$$j; \ + $(mkinstalldirs) $(tooldir)/bin + for i in $(TOOL_PROGS); do \ + if [ -f $$i$(EXEEXT) ]; then \ + j=`echo $$i | sed -e 's/-new//'`; \ + rm -f $(tooldir)/bin/$$j$(EXEEXT); \ + k=`echo $$j | sed '$(transform)'`; \ + if [ "$(bindir)/$$k$(EXEEXT)" != "$(tooldir)/bin/$$j$(EXEEXT)" ]; then \ + ln $(bindir)/$$k$(EXEEXT) $(tooldir)/bin/$$j$(EXEEXT) >/dev/null 2>/dev/null \ + || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$i$(EXEEXT) $(tooldir)/bin/$$j$(EXEEXT); \ + fi; \ else true; \ fi; \ done -# This little path search is required because in the FSF net releases, -# the info files are included in the source tree, and that may not be -# the same as the build directory. -install-info: binutils.info - if [ -r binutils.info ]; then \ - dir=. ; \ - else \ - dir=$(srcdir) ; \ - fi ; \ - for i in `cd $$dir; echo binutils.info*` ; do \ - $(INSTALL_DATA) $$dir/$$i $(infodir)/$$i ; \ - done - -clean-info: - -rm -rf *.info* - -# Making a dist: -# cvs rtag binutils-x-yy ld+utils -# cvs co -r binutils-x-yy ld+utils -# cd {HERE}; make dist [-f Makefile.in] - -dist: $(DIST_NAME).tar.z - -diststuff: $(DISTSTUFF) info - -$(DIST_NAME).tar.z: - cd ../..; rm -f $(DIST_NAME); ln -s devo $(DIST_NAME) - make diststuff -f Makefile.in - cd ../ld; make diststuff -f Makefile.in - cd ../gprof; make diststuff -f Makefile.in - cd ../texinfo; mv texinfo.tex ..; rm -rf *; mv ../texinfo.tex . - # Take out texinfo from configurable dirs - mv ../configure.in tmp; \ - sed -e '/^host_tools=/s/texinfo //' <tmp >../configure.in; rm tmp - cd ..; chmod og=u `find . -print` - cd ../..; tar chf - $(DIST_NAME) | gzip >$(DIST_NAME).tar.z - rm -rf ../../$(DIST_NAME) - -#----------------------------------------------------------------------------- -# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT -# -# 'VERSION' file must be present and contain a string of the form "x.y" -#----------------------------------------------------------------------------- - -ver960.c: FORCE - rm -f ver960.c - echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c - - -# Dummy target to force execution of dependent targets. -# -force: - -# Target to uncomment host-specific lines in this makefile. Such lines must -# have the following string beginning in column 1: #__<hostname>__# -# Original Makefile is backed up as 'Makefile.old'. -# -# Invoke with: make make HOST=xxx -# -make: - -@if test $(HOST)x = x ; then \ - echo 'Specify "make make HOST=???"'; \ - exit 1; \ - fi ; \ - grep -s "^#The next line was generated by 'make make'" Makefile; \ - if test $$? = 0 ; then \ - echo "Makefile has already been processed with 'make make'";\ - exit 1; \ - fi ; \ - mv -f Makefile Makefile.old; \ - echo "#The next line was generated by 'make make'" >Makefile ; \ - echo "HOST=$(HOST)" >>Makefile ; \ - echo >>Makefile ; \ - sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile - -Makefile: Makefile.in config.status - CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status - -config.h: stamp-h ; @true -stamp-h: config.in config.status - CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status - -config.status: configure $(srcdir)/../bfd/configure.host $(srcdir)/../bfd/config.bfd - $(SHELL) ./config.status --recheck - # What appears below is generated by a hacked mkdep using gcc -MM. # DO NOT DELETE THIS LINE -- mkdep uses it. @@ -675,7 +1093,7 @@ debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ debug.h dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/getopt.h $(INCDIR)/demangle.h + $(INCDIR)/getopt.h $(INCDIR)/demangle.h dlltool.h filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ bucomm.h config.h $(INCDIR)/fopen-same.h ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \ @@ -732,6 +1150,19 @@ wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def +windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/obstack.h windres.h +resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h +rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h underscore.o: underscore.c arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ bucomm.h config.h $(INCDIR)/fopen-same.h arsup.h @@ -739,10 +1170,22 @@ arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c syslex.o: syslex.c sysinfo.h -defparse.o: defparse.c -deflex.o: deflex.c defparse.h +defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h dlltool.h +deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ + defparse.h dlltool.h nlmheader.o: nlmheader.c ../bfd/bfd.h bucomm.h config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ nlmconv.h +rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h +rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + windres.h rcparse.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/gnu/dist/binutils/NEWS b/gnu/dist/binutils/NEWS index 1caa151972b..de6f0bda069 100644 --- a/gnu/dist/binutils/NEWS +++ b/gnu/dist/binutils/NEWS @@ -1,5 +1,15 @@ -*- text -*- +Changes in binutils 2.9: + +* Added windres program, which can be used to manipulate resources in WIN32 + files as used on Windows 95 and Windows NT. + +* The objcopy --gap-fill and --pad-to options operate on the LMA rather than + the VMA of the sections. + +* Added S modifier to ar to not build a symbol table. + Changes in binutils 2.8: * The objdump disassembly format has been changed, and hopefully improved. Use diff --git a/gnu/dist/binutils/README b/gnu/dist/binutils/README index 4ae93cddad4..91d7750bd88 100644 --- a/gnu/dist/binutils/README +++ b/gnu/dist/binutils/README @@ -1,8 +1,8 @@ -This is a beta release of a completely rewritten binutils distribution. -(Rewritten since binutils 1.x, that is.) +These are the GNU binutils. These are utilities of use when dealing +with object files. -The linker (ld) has been moved into a separate directory, which should be -../ld. Linker-specific notes are in ../ld/README. +The linker (ld) is in a separate directory, which should be ../ld. +Linker-specific notes are in ../ld/README. As of version 2.5, the assembler (as) is also included in this package, in ../gas. Assembler-specific notes can be found in ../gas/README. @@ -12,16 +12,16 @@ Recent changes are in ./NEWS, ../ld/NEWS, and ../gas/NEWS. Unpacking and Installation -- quick overview ============================================ -When you unpack the binutils-2.8.tar.gz file, you'll get a directory -called something like `binutils-2.8', which contains various files and +When you unpack the binutils-2.9.tar.gz file, you'll get a directory +called something like `binutils-2.9', which contains various files and directories. Most of the files in the top directory are for information and for configuration. The actual source code is in subdirectories. To build binutils, you can just do: - cd binutils-2.8 - ./configure [ --enable-targets='target1,target2...' ] + cd binutils-2.9 + ./configure [options] make make install # copies the programs files into /usr/local/bin # by default. @@ -29,11 +29,23 @@ To build binutils, you can just do: This will configure and build all the libraries as well as the assembler, the binutils, and the linker. -The --enable-targets option adds support for more binary file -formats besides the default. By default, support for only the -selected target file format is compiled in. To add support for more -formats, list them as the argument to --enable-targets, separated by -commas. For example: +If you have GNU make, we recommend building in a different directory: + + mkdir objdir + cd objdir + ../binutils-2.9/configure [options] + make + make install + +This relies on the VPATH feature of GNU make. + +By default, the binutils will be configured to support the system on +which they are built. When doing cross development, use the --target +configure option to specify a different target. + +The --enable-targets option adds support for more binary file formats +besides the default. List them as the argument to --enable-targets, +separated by commas. For example: ./configure --enable-targets=sun3,rs6000-aix,decstation @@ -42,16 +54,12 @@ the default in releases before 2.3): ./configure --enable-targets=all -The binutils can be used in a cross-development environment. -The file etc/configure.texi contains more information. - You can also specify the --enable-shared option when you run configure. This will build the BFD and opcodes libraries as shared -libraries. This will only work on certain systems, and currently will -only work when compiling with gcc. You can use arguments with the ---enable-shared option to indicate that only certain libraries should -be built shared; for example, --enable-shared=bfd. The only potential -shared libraries in a binutils release are bfd and opcodes. +libraries. You can use arguments with the --enable-shared option to +indicate that only certain libraries should be built shared; for +example, --enable-shared=bfd. The only potential shared libraries in +a binutils release are bfd and opcodes. The binutils will be linked against the shared libraries. The build step will attempt to place the correct library in the runtime search @@ -60,11 +68,6 @@ binaries, you may have to set an environment variable, normally LD_LIBRARY_PATH, so that the system can find the installed libbfd shared library. -If you specify --enable-commonbfdlib as well as --enable-shared, then -a single shared library will be built containing the bfd, opcodes, and -libiberty libraries. It will be installed as libbfd. This option -will make the binutils programs as small as possible. - To build under openVMS/AXP, see the file makefile.vms in the top level directory. @@ -89,7 +92,8 @@ the ranlib program in order to build the distribution. Porting ======= -Binutils-2.8 supports many different architectures, but there + +Binutils-2.9 supports many different architectures, but there are many more not supported, including some that were supported by earlier versions. We are hoping for volunteers to improve this situation. @@ -101,7 +105,30 @@ with gdb-4.x) may also be of help. Reporting bugs ============== -Send bug reports and patches to bug-gnu-utils@prep.ai.mit.edu. Always -mention the version number you are running; this is printed by running -any of the binutils with the --version option. We appreciate reports -about bugs, but we do not promise to fix them. + +Send bug reports and patches to bug-gnu-utils@gnu.org. Always mention +the version number you are running; this is printed by running any of +the binutils with the --version option. We appreciate reports about +bugs, but we do not promise to fix them. + +Testing +======= + +Testing this release of the binutils requires an unreleased version of +dejagnu. There is a dejagnu snapshot available at + ftp://ftp.cygnus.com/pub/binutils +which may be used for testing. + +Maintenance +=========== + +The configure and Makefile.in files in the subdirectories are +generated by autoconf and automake, respectively. The libtool package +is also required. In order to make the generation rules fire +automatically, you must configure with the --enable-maintainer-mode +option. This option is not the default in order to avoid problems on +systems which have out of date versions of autoconf or automake +installed. The generated files in this release were built with +unreleased versions of autoconf, automake, and libtool. You can find +snapshots of the appropriate sources at + ftp://ftp.cygnus.com/pub/binutils diff --git a/gnu/dist/binutils/acconfig.h b/gnu/dist/binutils/acconfig.h index 6ae3d768c35..c38c529c901 100644 --- a/gnu/dist/binutils/acconfig.h +++ b/gnu/dist/binutils/acconfig.h @@ -1,4 +1,13 @@ +/* Name of package. */ +#undef PACKAGE + +/* Version of package. */ +#undef VERSION + +/* Configured target name. */ +#undef TARGET + /* Whether strstr must be declared even if <string.h> is included. */ #undef NEED_DECLARATION_STRSTR diff --git a/gnu/dist/binutils/acinclude.m4 b/gnu/dist/binutils/acinclude.m4 new file mode 100644 index 00000000000..71b09b9f6ac --- /dev/null +++ b/gnu/dist/binutils/acinclude.m4 @@ -0,0 +1 @@ +sinclude(../bfd/acinclude.m4) diff --git a/gnu/dist/binutils/aclocal.m4 b/gnu/dist/binutils/aclocal.m4 index 7adc0045571..ea7ce9b2409 100644 --- a/gnu/dist/binutils/aclocal.m4 +++ b/gnu/dist/binutils/aclocal.m4 @@ -1 +1,460 @@ -sinclude(../bfd/aclocal.m4) +dnl aclocal.m4 generated automatically by aclocal 1.2e + +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +sinclude(../bfd/acinclude.m4) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AM_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + + +# serial 1 + +AC_DEFUN(AM_PROG_INSTALL, +[AC_REQUIRE([AC_PROG_INSTALL]) +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl +]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + + +# serial 24 AM_PROG_LIBTOOL +AC_DEFUN(AM_PROG_LIBTOOL, +[AC_REQUIRE([AM_ENABLE_SHARED])dnl +AC_REQUIRE([AM_ENABLE_STATIC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AM_PROG_LD])dnl +AC_REQUIRE([AM_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Check for any special flags to pass to ltconfig. +libtool_flags= +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$silent" = yes && libtool_flags="$libtool_flags --silent" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$host" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + CFLAGS="$CFLAGS -belf" + ;; +esac + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) +]) + +# AM_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AM_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AM_ENABLE_SHARED, +[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT] +changequote([, ])dnl +[ --enable-shared=PKGS only build shared libraries if the current package + appears as an element in the PKGS list], +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl +]) + +# AM_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AM_DISABLE_SHARED, +[AM_ENABLE_SHARED(no)]) + +# AM_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AM_DISABLE_STATIC, +[AM_ENABLE_STATIC(no)]) + +# AM_ENABLE_STATIC - implement the --enable-static flag +# Usage: AM_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AM_ENABLE_STATIC, +[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT] +changequote([, ])dnl +[ --enable-static=PKGS only build shared libraries if the current package + appears as an element in the PKGS list], +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AM_ENABLE_STATIC_DEFAULT)dnl +]) + + +# AM_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AM_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC]) +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + /* | [A-Za-z]:\\*) +changequote([,])dnl + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_SUBST(LD) +AM_PROG_LD_GNU +]) + +AC_DEFUN(AM_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AM_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AM_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[case "$NM" in +changequote(,)dnl +/* | [A-Za-z]:\\*) +changequote([,])dnl + ac_cv_path_NM="$NM" # Let the user override the test with a path. + ;; +*) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + else + ac_cv_path_NM="$ac_dir/nm" + fi + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm + ;; +esac]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +AC_SUBST(NM) +]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<<am_indx=1 +for am_file in <<$1>>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + if test $USE_MAINTAINER_MODE = yes; then + MAINT= + else + MAINT='#M#' + fi + AC_SUBST(MAINT)dnl +] +) + +# Check to see if we're running under Cygwin32, without using +# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes". +# Otherwise set it to "no". + +dnl AM_CYGWIN32() +AC_DEFUN(AM_CYGWIN32, +[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, +[AC_TRY_COMPILE(,[return __CYGWIN32__;], +am_cv_cygwin32=yes, am_cv_cygwin32=no) +rm -f conftest*]) +CYGWIN32= +test "$am_cv_cygwin32" = yes && CYGWIN32=yes]) + +# Check to see if we're running under Win32, without using +# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe". +# Otherwise set it to "". + +dnl AM_EXEEXT() +dnl This knows we add .exe if we're building in the Cygwin32 +dnl environment. But if we're not, then it compiles a test program +dnl to see if there is a suffix for executables. +AC_DEFUN(AM_EXEEXT, +[AC_REQUIRE([AM_CYGWIN32]) +AC_REQUIRE([AM_MINGW32]) +AC_MSG_CHECKING([for executable suffix]) +AC_CACHE_VAL(am_cv_exeext, +[if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then +am_cv_exeext=.exe +else +cat > am_c_test.c << 'EOF' +int main() { +/* Nothing needed here */ +} +EOF +${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5 +am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` +rm -f am_c_test*]) +test x"${am_cv_exeext}" = x && am_cv_exeext=no +fi +EXEEXT="" +test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext} +AC_MSG_RESULT(${am_cv_exeext}) +AC_SUBST(EXEEXT)]) + +# Check to see if we're running under Mingw, without using +# AC_CANONICAL_*. If so, set output variable MINGW32 to "yes". +# Otherwise set it to "no". + +dnl AM_MINGW32() +AC_DEFUN(AM_MINGW32, +[AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32, +[AC_TRY_COMPILE(,[return __MINGW32__;], +am_cv_mingw32=yes, am_cv_mingw32=no) +rm -f conftest*]) +MINGW32= +test "$am_cv_mingw32" = yes && MINGW32=yes]) + diff --git a/gnu/dist/binutils/addr2line.c b/gnu/dist/binutils/addr2line.c index 7fbbdd855df..b887043ea36 100644 --- a/gnu/dist/binutils/addr2line.c +++ b/gnu/dist/binutils/addr2line.c @@ -1,5 +1,5 @@ /* addr2line.c -- convert addresses to line number and function name - Copyright 1997 Free Software Foundation, Inc. + Copyright 1997, 1998 Free Software Foundation, Inc. Contributed by Ulrich Lauther <Ulrich.Lauther@zfe.siemens.de> This file is part of GNU Binutils. @@ -80,7 +80,7 @@ Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\ program_name); list_supported_targets (program_name, stream); if (status == 0) - fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); + fprintf (stream, "Report bugs to bug-gnu-utils@gnu.org\n"); exit (status); } @@ -158,14 +158,14 @@ translate_addresses (abfd) if (fgets (addr_hex, sizeof addr_hex, stdin) == NULL) break; - pc = strtol (addr_hex, NULL, 16); + pc = bfd_scan_vma (addr_hex, NULL, 16); } else { if (naddr <= 0) break; --naddr; - pc = strtol (*addr++, NULL, 16); + pc = bfd_scan_vma (*addr++, NULL, 16); } found = false; diff --git a/gnu/dist/binutils/ar.1 b/gnu/dist/binutils/ar.1 index a138e4ac061..e4e8cff8134 100644 --- a/gnu/dist/binutils/ar.1 +++ b/gnu/dist/binutils/ar.1 @@ -14,7 +14,7 @@ ar \- create, modify, and extract from archives. .hy 0 .na .BR ar " [\|" "-" "\|]"\c -.I {dmpqrtx}[abcilosuvV] \c +.I {dmpqrtx}[abcilosSuvV] \c [\|\c .I membername\c \&\|] \c @@ -215,6 +215,15 @@ index is not updated, even if it already existed; you can use `\|\c .B ranlib\c \& explicitly to update the symbol table index. +However, too many different systems assume quick append rebuilds the +index, so GNU +.B ar +implements `\|\c +.B q\c +\|' as a synonym for `\|\c +.B r\c +\|'. + .TP .B r Insert \c @@ -416,6 +425,19 @@ archive is equivalent to running `\|\c \|' on it. .TP +.B S +Do not generate an archive symbol table. This can speed up building a +large library in several steps. The resulting archive can not be used +with the linker. In order to build a symbol table, you must omit the +`\|\c +.B S\c +\|' modifier on the last execution of `\|\c +.B ar\c +\|', or you must run `\|\c +.B ranlib\c +\|' on the archive. + +.TP .B u Normally, \c .B ar r\c diff --git a/gnu/dist/binutils/ar.c b/gnu/dist/binutils/ar.c index ceed38e67a8..b52a4ce70e2 100644 --- a/gnu/dist/binutils/ar.c +++ b/gnu/dist/binutils/ar.c @@ -1,5 +1,5 @@ /* ar.c - Archive modify and extract. - Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -52,7 +52,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Kludge declaration from BFD! This is ugly! FIXME! XXX */ struct ar_hdr * - bfd_special_undocumented_glue PARAMS ((bfd * abfd, char *filename)); + bfd_special_undocumented_glue PARAMS ((bfd * abfd, const char *filename)); /* Static declarations */ @@ -146,7 +146,7 @@ enum pos } postype = pos_default; static bfd ** -get_pos_bfd PARAMS ((bfd **, enum pos)); +get_pos_bfd PARAMS ((bfd **, enum pos, const char *)); /* Whether to truncate names of files stored in the archive. */ static boolean ar_truncate = false; @@ -225,7 +225,7 @@ usage (help) s = help ? stdout : stderr; if (! is_ranlib) fprintf (s, "\ -Usage: %s [-]{dmpqrtx}[abcilosuvV] [member-name] archive-file file...\n\ +Usage: %s [-]{dmpqrtx}[abcilosSuvV] [member-name] archive-file file...\n\ %s -M [<mri-script]\n", program_name, program_name); else @@ -235,7 +235,7 @@ Usage: %s [-vV] archive\n", program_name); list_supported_targets (program_name, stderr); if (help) - fprintf (s, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); + fprintf (s, "Report bugs to bug-gnu-utils@gnu.org\n"); xexit (help ? 0 : 1); } @@ -448,6 +448,9 @@ main (argc, argv) case 's': write_armap = 1; break; + case 'S': + write_armap = -1; + break; case 'u': newer_only = 1; break; @@ -1003,12 +1006,25 @@ write_archive (iarch) and should be a pos value. */ static bfd ** -get_pos_bfd (contents, default_pos) +get_pos_bfd (contents, default_pos, default_posname) bfd **contents; enum pos default_pos; + const char *default_posname; { bfd **after_bfd = contents; - enum pos realpos = (postype == pos_default ? default_pos : postype); + enum pos realpos; + const char *realposname; + + if (postype == pos_default) + { + realpos = default_pos; + realposname = default_posname; + } + else + { + realpos = postype; + realposname = posname; + } if (realpos == pos_end) { @@ -1018,7 +1034,7 @@ get_pos_bfd (contents, default_pos) else { for (; *after_bfd; after_bfd = &(*after_bfd)->next) - if (!strcmp ((*after_bfd)->filename, posname)) + if (strcmp ((*after_bfd)->filename, realposname) == 0) { if (realpos == pos_after) after_bfd = &(*after_bfd)->next; @@ -1111,7 +1127,7 @@ move_members (arch, files_to_move) *current_ptr_ptr = current_ptr->next; /* Now glue to end */ - after_bfd = get_pos_bfd (&arch->next, pos_end); + after_bfd = get_pos_bfd (&arch->next, pos_end, NULL); link = *after_bfd; *after_bfd = current_ptr; current_ptr->next = link; @@ -1179,11 +1195,10 @@ replace_members (arch, files_to_move, quick) goto next_file; } - /* snip out this entry from the chain */ - *current_ptr = current->next; - - after_bfd = get_pos_bfd (&arch->next, pos_end); + after_bfd = get_pos_bfd (&arch->next, pos_after, + current->filename); temp = *after_bfd; + *after_bfd = bfd_openr (*files_to_move, NULL); if (*after_bfd == (bfd *) NULL) { @@ -1191,6 +1206,9 @@ replace_members (arch, files_to_move, quick) } (*after_bfd)->next = temp; + /* snip out this entry from the chain */ + *current_ptr = (*current_ptr)->next; + if (verbose) { printf ("r - %s\n", *files_to_move); @@ -1206,7 +1224,7 @@ replace_members (arch, files_to_move, quick) /* Add to the end of the archive. */ - after_bfd = get_pos_bfd (&arch->next, pos_end); + after_bfd = get_pos_bfd (&arch->next, pos_end, NULL); temp = *after_bfd; *after_bfd = bfd_openr (*files_to_move, NULL); if (*after_bfd == (bfd *) NULL) diff --git a/gnu/dist/binutils/binutils.info b/gnu/dist/binutils/binutils.info index 2e7b42b39e4..823cdd29fd9 100644 --- a/gnu/dist/binutils/binutils.info +++ b/gnu/dist/binutils/binutils.info @@ -1,5 +1,5 @@ -This is Info file binutils.info, produced by Makeinfo-1.64 from the -input file ./binutils.texi. +This is Info file binutils.info, produced by Makeinfo version 1.68 from +the input file binutils.texi. START-INFO-DIR-ENTRY * Binutils: (binutils). The GNU binary utilities "ar", "objcopy", @@ -7,7 +7,7 @@ START-INFO-DIR-ENTRY "strings", "strip", and "ranlib". END-INFO-DIR-ENTRY - Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this @@ -25,32 +25,33 @@ versions. Indirect: -binutils.info-1: 969 -binutils.info-2: 49337 +binutils.info-1: 979 +binutils.info-2: 50570 Tag Table: (Indirect) -Node: Top969 -Node: ar2008 -Node: ar cmdline4174 -Node: ar scripts10934 -Node: nm16615 -Node: objcopy23163 -Node: objdump32840 -Node: ranlib41127 -Node: size41861 -Node: strings44528 -Node: strip46353 -Node: c++filt49337 -Node: addr2line51898 -Node: nlmconv54295 -Node: Selecting The Target System56920 -Node: Target Selection57937 -Node: Architecture Selection60637 -Node: Linker Emulation Selection61869 -Node: Reporting Bugs62747 -Node: Bug Criteria63498 -Node: Bug Reporting64044 -Node: Index71033 +Node: Top979 +Node: ar2061 +Node: ar cmdline4227 +Node: ar scripts11462 +Node: nm17143 +Node: objcopy23691 +Node: objdump34033 +Node: ranlib42320 +Node: size43054 +Node: strings45780 +Node: strip47605 +Node: c++filt50570 +Node: addr2line53131 +Node: nlmconv55528 +Node: windres58133 +Node: Selecting The Target System62605 +Node: Target Selection63622 +Node: Architecture Selection66322 +Node: Linker Emulation Selection67554 +Node: Reporting Bugs68432 +Node: Bug Criteria69183 +Node: Bug Reporting69729 +Node: Index76710 End Tag Table diff --git a/gnu/dist/binutils/binutils.info-1 b/gnu/dist/binutils/binutils.info-1 index a8a10d025cb..92fe7b8421c 100644 --- a/gnu/dist/binutils/binutils.info-1 +++ b/gnu/dist/binutils/binutils.info-1 @@ -1,5 +1,5 @@ -This is Info file binutils.info, produced by Makeinfo-1.64 from the -input file ./binutils.texi. +This is Info file binutils.info, produced by Makeinfo version 1.68 from +the input file binutils.texi. START-INFO-DIR-ENTRY * Binutils: (binutils). The GNU binary utilities "ar", "objcopy", @@ -7,7 +7,7 @@ START-INFO-DIR-ENTRY "strings", "strip", and "ranlib". END-INFO-DIR-ENTRY - Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this @@ -30,7 +30,7 @@ Introduction ************ This brief manual contains preliminary documentation for the GNU -binary utilities (collectively version 2.8.1): +binary utilities (collectively version 2.9.1): * Menu: @@ -45,6 +45,7 @@ binary utilities (collectively version 2.8.1): * c++filt:: Filter to demangle encoded C++ symbols * addr2line:: Convert addresses to file and line * nlmconv:: Converts object code into an NLM +* windres:: Manipulate Windows resources * Selecting The Target System:: How these utilities determine the target. * Reporting Bugs:: Reporting Bugs * Index:: Index @@ -154,8 +155,8 @@ of the following, but you must specify only one of them: are printed. `q' - *Quick append*; add the files MEMBER... to the end of ARCHIVE, - without checking for replacement. + *Quick append*; Historically, add the files MEMBER... to the end of + ARCHIVE, without checking for replacement. The modifiers `a', `b', and `i' do *not* affect this operation; new members are always placed at the end of the archive. @@ -166,6 +167,9 @@ of the following, but you must specify only one of them: table index is not updated, even if it already existed; you can use `ar s' or `ranlib' explicitly to update the symbol table index. + However, too many different systems assume quick append rebuilds + the index, so GNU ar implements `q' as a synonym for `r'. + `r' Insert the files MEMBER... into ARCHIVE (with *replacement*). This operation differs from `q' in that any previously existing members @@ -255,6 +259,13 @@ to specify variations on an operation's behavior: this modifier flag either with any operation, or alone. Running `ar s' on an archive is equivalent to running `ranlib' on it. +`S' + Do not generate an archive symbol table. This can speed up + building a large library in several steps. The resulting archive + can not be used with the linker. In order to build a symbol + table, you must omit the `S' modifier on the last execution of + `ar', or you must run `ranlib' on the archive. + `u' Normally, `ar r'... inserts all files listed into the archive. If you would like to insert *only* those of the files you list that @@ -629,6 +640,8 @@ objcopy [ -S | --strip-all ] [ -g | --strip-debug ] [ -K SYMBOLNAME | --keep-symbol=SYMBOLNAME ] [ -N SYMBOLNAME | --strip-symbol=SYMBOLNAME ] + [ -L SYMBOLNAME | --localize-symbol=SYMBOLNAME ] + [ -W SYMBOLNAME | --weaken-symbol=SYMBOLNAME ] [ -x | --discard-all ] [ -X | --discard-locals ] [ -b BYTE | --byte=BYTE ] [ -i INTERLEAVE | --interleave=INTERLEAVE ] @@ -721,8 +734,17 @@ information which is not needed by the binary file. `-N SYMBOLNAME' `--strip-symbol=SYMBOLNAME' Do not copy symbol SYMBOLNAME from the source file. This option - may be given more than once, and may be combined with strip options - other than `-K'. + may be given more than once. + +`-L SYMBOLNAME' +`--localize-symbol=SYMBOLNAME' + Make symbol SYMBOLNAME local to the file, so that it is not + visible externally. This option may be given more than once. + +`-W SYMBOLNAME' +`--weaken-symbol=SYMBOLNAME' + Make symbol SYMBOLNAME weak. This option may be given more than + once. `-x' `--discard-all' @@ -758,15 +780,15 @@ information which is not needed by the binary file. the conversion process can be time consuming. `--gap-fill VAL' - Fill gaps between sections with VAL. This is done by increasing + Fill gaps between sections with VAL. This operation applies to + the *load address* (LMA) of the sections. It is done by increasing the size of the section with the lower address, and filling in the extra space created with VAL. `--pad-to ADDRESS' - Pad the output file up to the virtual address ADDRESS. This is - done by increasing the size of the last section. The extra space - is filled in with the value specified by `--gap-fill' (default - zero). + Pad the output file up to the load address ADDRESS. This is done + by increasing the size of the last section. The extra space is + filled in with the value specified by `--gap-fill' (default zero). `--set-start VAL' Set the address of the new file to VAL. Not all object file @@ -804,8 +826,12 @@ information which is not needed by the binary file. `--set-section-flags SECTION=FLAGS' Set the flags for the named section. The FLAGS argument is a comma separated string of flag names. The recognized names are - `alloc', `load', `readonly', `code', `data', and `rom'. Not all - flags are meaningful for all object file formats. + `alloc', `contents', `load', `readonly', `code', `data', and + `rom'. You can set the `contents' flag for a section which does + not have contents, but it is not meaningful to clear the + `contents' flag of a section which does have contents-just remove + the section instead. Not all flags are meaningful for all object + file formats. `--add-section SECTIONNAME=FILENAME' Add a new section named SECTIONNAME while copying the file. The @@ -1115,14 +1141,15 @@ size size [ -A | -B | --format=COMPATIBILITY ] [ --help ] [ -d | -o | -x | --radix=NUMBER ] [ --target=BFDNAME ] [ -V | --version ] - OBJFILE... + [ OBJFILE... ] The GNU `size' utility lists the section sizes--and the total size--for each of the object or archive files OBJFILE in its argument list. By default, one line of output is generated for each object file or each module in an archive. - OBJFILE... are the object files to be examined. + OBJFILE... are the object files to be examined. If none are +specified, the file `a.out' will be used. The command line options have the following meanings: @@ -1251,7 +1278,7 @@ File: binutils.info, Node: strip, Next: c++filt, Prev: strings, Up: Top strip ***** - strip [ -F BFDNAME | --target=BFDNAME | --target=BFDNAME ] + strip [ -F BFDNAME | --target=BFDNAME ] [ -I BFDNAME | --input-target=BFDNAME ] [ -O BFDNAME | --output-target=BFDNAME ] [ -s | --strip-all ] [ -S | -g | --strip-debug ] diff --git a/gnu/dist/binutils/binutils.info-2 b/gnu/dist/binutils/binutils.info-2 index 4adbdd5944c..e1a9ec443f5 100644 --- a/gnu/dist/binutils/binutils.info-2 +++ b/gnu/dist/binutils/binutils.info-2 @@ -1,5 +1,5 @@ -This is Info file binutils.info, produced by Makeinfo-1.64 from the -input file ./binutils.texi. +This is Info file binutils.info, produced by Makeinfo version 1.68 from +the input file binutils.texi. START-INFO-DIR-ENTRY * Binutils: (binutils). The GNU binary utilities "ar", "objcopy", @@ -7,7 +7,7 @@ START-INFO-DIR-ENTRY "strings", "strip", and "ranlib". END-INFO-DIR-ENTRY - Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this @@ -170,7 +170,7 @@ equivalent. Display only the base of each file name. -File: binutils.info, Node: nlmconv, Next: Selecting The Target System, Prev: addr2line, Up: Top +File: binutils.info, Node: nlmconv, Next: windres, Prev: addr2line, Up: Top nlmconv ******* @@ -243,7 +243,126 @@ In this case, `nlmconv' calls the linker for you. Prints the version number for `nlmconv'. -File: binutils.info, Node: Selecting The Target System, Next: Reporting Bugs, Prev: nlmconv, Up: Top +File: binutils.info, Node: windres, Next: Selecting The Target System, Prev: nlmconv, Up: Top + +windres +******* + + `windres' may be used to manipulate Windows resources. + + *Warning:* `windres' is not always built as part of the binary + utilities, since it is only useful for Windows targets. + + windres [options] [input-file] [output-file] + + `windres' reads resources from an input file and copies them into an +output file. Either file may be in one of three formats: + +`rc' + A text format read by the Resource Compiler. + +`res' + A binary format generated by the Resource Compiler. + +`coff' + A COFF object or executable. + + The exact description of these different formats is available in +documentation from Microsoft. + + When `windres' converts from the `rc' format to the `res' format, it +is acting like the Windows Resource Compiler. When `windres' converts +from the `res' format to the `coff' format, it is acting like the +Windows `CVTRES' program. + + When `windres' generates an `rc' file, the output is similar but not +identical to the format expected for the input. When an input `rc' +file refers to an external filename, an output `rc' file will instead +include the file contents. + + If the input or output format is not specified, `windres' will guess +based on the file name, or, for the input file, the file contents. A +file with an extension of `.rc' will be treated as an `rc' file, a file +with an extension of `.res' will be treated as a `res' file, and a file +with an extension of `.o' or `.exe' will be treated as a `coff' file. + + If no output file is specified, `windres' will print the resources +in `rc' format to standard output. + + The normal use is for you to write an `rc' file, use `windres' to +convert it to a COFF object file, and then link the COFF file into your +application. This will make the resources described in the `rc' file +available to Windows. + +`-i FILENAME' +`--input FILENAME' + The name of the input file. If this option is not used, then + `windres' will use the first non-option argument as the input file + name. If there are no non-option arguments, then `windres' will + read from standard input. `windres' can not read a COFF file from + standard input. + +`-o FILENAME' +`--output FILENAME' + The name of the output file. If this option is not used, then + `windres' will use the first non-option argument, after any used + for the input file name, as the output file name. If there is no + non-option argument, then `windres' will write to standard output. + `windres' can not write a COFF file to standard output. + +`-I FORMAT' +`--input-format FORMAT' + The input format to read. FORMAT may be `res', `rc', or `coff'. + If no input format is specified, `windres' will guess, as + described above. + +`-O FORMAT' +`--output-format FORMAT' + The output format to generate. FORMAT may be `res', `rc', or + `coff'. If no output format is specified, `windres' will guess, + as described above. + +`-F TARGET' +`--target TARGET' + Specify the BFD format to use for a COFF file as input or output. + This is a BFD target name; you can use the `--help' option to see + a list of supported targets. Normally `windres' will use the + default format, which is the first one listed by the `--help' + option. *Note Target Selection::. + +`--preprocessor PROGRAM' + When `windres' reads an `rc' file, it runs it through the C + preprocessor first. This option may be used to specify the + preprocessor to use, including any leading arguments. The default + preprocessor argument is `gcc -E -xc-header -DRC_INVOKED'. + +`--include-dir DIRECTORY' + Specify an include directory to use when reading an `rc' file. + `windres' will pass this to the preprocessor as an `-I' option. + `windres' will also search this directory when looking for files + named in the `rc' file. + +`--define SYM[=VAL]' + Specify a `-D' option to pass to the preprocessor when reading an + `rc' file. + +`--language VAL' + Specify the default language to use when reading an `rc' file. + VAL should be a hexadecimal language code. The low eight bits are + the language, and the high eight bits are the sublanguage. + +`--help' + Prints a usage summary. + +`--version' + Prints the version number for `windres'. + +`--yydebug' + If `windres' is compiled with `YYDEBUG' defined as `1', this will + turn on parser debugging. + + +File: binutils.info, Node: Selecting The Target System, Next: Reporting Bugs, Prev: windres, Up: Top Selecting the target system *************************** @@ -512,7 +631,7 @@ organization, we recommend you contact that organization first. individuals in the file `etc/SERVICE' in the GNU Emacs distribution. In any event, we also recommend that you send bug reports for the -binary utilities to `bug-gnu-utils@prep.ai.mit.edu'. +binary utilities to `bug-gnu-utils@gnu.org'. The fundamental principle of reporting bugs usefully is this: *report all the facts*. If you are not sure whether to state a fact or @@ -656,116 +775,117 @@ Index * Menu: -* .stab: objdump. -* ar compatibility: ar. -* nm compatibility: nm. -* nm format: nm. -* size display format: size. -* size number format: size. -* addr2line: addr2line. -* address to file name and line number: addr2line. -* all header information, object file: objdump. -* ar: ar. -* architecture: objdump. -* architectures available: objdump. -* archive contents: ranlib. -* archive headers: objdump. -* archives: ar. -* bug criteria: Bug Criteria. -* bug reports: Bug Reporting. -* bugs: Reporting Bugs. -* bugs, reporting: Bug Reporting. -* c++filt: c++filt. -* collections of files: ar. -* compatibility, ar: ar. -* contents of archive: ar cmdline. -* crash: Bug Criteria. -* creating archives: ar cmdline. -* dates in archive: ar cmdline. -* debug symbols: objdump. -* debugging symbols: nm. -* deleting from archive: ar cmdline. -* demangling C++ symbols: c++filt. -* demangling in nm: nm. -* demangling in objdump <1>: objdump. -* demangling in objdump: addr2line. -* disassembling object code: objdump. -* disassembly architecture: objdump. -* disassembly endianness: objdump. -* disassembly, with source: objdump. -* discarding symbols: strip. +* .stab: objdump. +* addr2line: addr2line. +* address to file name and line number: addr2line. +* all header information, object file: objdump. +* ar: ar. +* ar compatibility: ar. +* architecture: objdump. +* architectures available: objdump. +* archive contents: ranlib. +* archive headers: objdump. +* archives: ar. +* bug criteria: Bug Criteria. +* bug reports: Bug Reporting. +* bugs: Reporting Bugs. +* bugs, reporting: Bug Reporting. +* c++filt: c++filt. +* collections of files: ar. +* compatibility, ar: ar. +* contents of archive: ar cmdline. +* crash: Bug Criteria. +* creating archives: ar cmdline. +* dates in archive: ar cmdline. +* debug symbols: objdump. +* debugging symbols: nm. +* deleting from archive: ar cmdline. +* demangling C++ symbols: c++filt. +* demangling in nm: nm. +* demangling in objdump <1>: objdump. +* demangling in objdump: addr2line. +* disassembling object code: objdump. +* disassembly architecture: objdump. +* disassembly endianness: objdump. +* disassembly, with source: objdump. +* discarding symbols: strip. * dynamic relocation entries, in object file: objdump. * dynamic symbol table entries, printing: objdump. -* dynamic symbols: nm. -* ELF object file format: objdump. -* endianness: objdump. -* error on valid input: Bug Criteria. -* external symbols: nm. -* extract from archive: ar cmdline. -* fatal signal: Bug Criteria. -* file name: nm. -* header information, all: objdump. -* input file name: nm. -* libraries: ar. -* listings strings: strings. -* machine instructions: objdump. -* moving in archive: ar cmdline. -* MRI compatibility, ar: ar scripts. -* name duplication in archive: ar cmdline. -* name length: ar. -* nm: nm. -* objdump: objdump. -* object code format <1>: objdump. -* object code format <2>: strings. -* object code format <3>: nm. -* object code format <4>: size. -* object code format: addr2line. -* object file header: objdump. -* object file information: objdump. -* object file sections: objdump. -* object formats available: objdump. -* operations on archive: ar cmdline. -* printing from archive: ar cmdline. -* printing strings: strings. -* quick append to archive: ar cmdline. -* radix for section sizes: size. -* ranlib: ranlib. -* relative placement in archive: ar cmdline. -* relocation entries, in object file: objdump. -* removing symbols: strip. -* repeated names in archive: ar cmdline. -* replacement in archive: ar cmdline. -* reporting bugs: Reporting Bugs. -* scripts, ar: ar scripts. -* section addresses in objdump: objdump. -* section headers: objdump. -* section information: objdump. -* section sizes: size. -* sections, full contents: objdump. -* size: size. -* sorting symbols: nm. -* source disassembly: objdump. -* source file name: nm. -* source filenames for object files: objdump. -* stab: objdump. -* start-address: objdump. -* stop-address: objdump. -* strings: strings. -* strings, printing: strings. -* strip: strip. -* symbol index <1>: ranlib. -* symbol index: ar. -* symbol index, listing: nm. -* symbol line numbers: nm. -* symbol table entries, printing: objdump. -* symbols: nm. -* symbols, discarding: strip. -* undefined symbols: nm. -* Unix compatibility, ar: ar cmdline. -* updating an archive: ar cmdline. -* version: Top. -* VMA in objdump: objdump. -* wide output, printing: objdump. -* writing archive index: ar cmdline. +* dynamic symbols: nm. +* ELF object file format: objdump. +* endianness: objdump. +* error on valid input: Bug Criteria. +* external symbols: nm. +* extract from archive: ar cmdline. +* fatal signal: Bug Criteria. +* file name: nm. +* header information, all: objdump. +* input file name: nm. +* libraries: ar. +* listings strings: strings. +* machine instructions: objdump. +* moving in archive: ar cmdline. +* MRI compatibility, ar: ar scripts. +* name duplication in archive: ar cmdline. +* name length: ar. +* nm: nm. +* nm compatibility: nm. +* nm format: nm. +* not writing archive index: ar cmdline. +* objdump: objdump. +* object code format <1>: objdump. +* object code format <2>: addr2line. +* object code format <3>: nm. +* object code format <4>: size. +* object code format: strings. +* object file header: objdump. +* object file information: objdump. +* object file sections: objdump. +* object formats available: objdump. +* operations on archive: ar cmdline. +* printing from archive: ar cmdline. +* printing strings: strings. +* quick append to archive: ar cmdline. +* radix for section sizes: size. +* ranlib: ranlib. +* relative placement in archive: ar cmdline. +* relocation entries, in object file: objdump. +* removing symbols: strip. +* repeated names in archive: ar cmdline. +* replacement in archive: ar cmdline. +* reporting bugs: Reporting Bugs. +* scripts, ar: ar scripts. +* section addresses in objdump: objdump. +* section headers: objdump. +* section information: objdump. +* section sizes: size. +* sections, full contents: objdump. +* size: size. +* size display format: size. +* size number format: size. +* sorting symbols: nm. +* source disassembly: objdump. +* source file name: nm. +* source filenames for object files: objdump. +* stab: objdump. +* start-address: objdump. +* stop-address: objdump. +* strings: strings. +* strings, printing: strings. +* strip: strip. +* symbol index <1>: ar. +* symbol index: ranlib. +* symbol index, listing: nm. +* symbol line numbers: nm. +* symbol table entries, printing: objdump. +* symbols: nm. +* symbols, discarding: strip. +* undefined symbols: nm. +* Unix compatibility, ar: ar cmdline. +* updating an archive: ar cmdline. +* version: Top. +* VMA in objdump: objdump. +* wide output, printing: objdump. +* writing archive index: ar cmdline. diff --git a/gnu/dist/binutils/binutils.texi b/gnu/dist/binutils/binutils.texi index c2891195b53..ff6ecd3a773 100644 --- a/gnu/dist/binutils/binutils.texi +++ b/gnu/dist/binutils/binutils.texi @@ -13,7 +13,7 @@ END-INFO-DIR-ENTRY @end ifinfo @ifinfo -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -41,7 +41,7 @@ into another language, under the above conditions for modified versions. @c This file documents the GNU binary utilities "ar", "ld", "objcopy", @c "objdump", "nm", "size", "strings", "strip", and "ranlib". @c -@c Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. +@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. @c @c This text may be freely distributed under the terms of the GNU @c General Public License. @@ -66,7 +66,7 @@ into another language, under the above conditions for modified versions. @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -122,6 +122,9 @@ Convert addresses into file names and line numbers @item nlmconv Convert object code into a Netware Loadable Module + +@item windres +Manipulate Windows resources @end table @end iftex @@ -137,6 +140,7 @@ Convert object code into a Netware Loadable Module * c++filt:: Filter to demangle encoded C++ symbols * addr2line:: Convert addresses to file and line * nlmconv:: Converts object code into an NLM +* windres:: Manipulate Windows resources * Selecting The Target System:: How these utilities determine the target. * Reporting Bugs:: Reporting Bugs * Index:: Index @@ -263,7 +267,7 @@ printed. @item q @cindex quick append to archive -@emph{Quick append}; add the files @var{member}@dots{} to the end of +@emph{Quick append}; Historically, add the files @var{member}@dots{} to the end of @var{archive}, without checking for replacement. The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this @@ -275,6 +279,9 @@ Since the point of this operation is speed, the archive's symbol table index is not updated, even if it already existed; you can use @samp{ar s} or @code{ranlib} explicitly to update the symbol table index. +However, too many different systems assume quick append rebuilds the +index, so GNU ar implements @code{q} as a synonym for @code{r}. + @item r @cindex replacement in archive Insert the files @var{member}@dots{} into @var{archive} (with @@ -381,6 +388,14 @@ even if no other change is made to the archive. You may use this modifier flag either with any operation, or alone. Running @samp{ar s} on an archive is equivalent to running @samp{ranlib} on it. +@item S +@cindex not writing archive index +Do not generate an archive symbol table. This can speed up building a +large library in several steps. The resulting archive can not be used +with the linker. In order to build a symbol table, you must omit the +@samp{S} modifier on the last execution of @samp{ar}, or you must run +@samp{ranlib} on the archive. + @item u @cindex updating an archive Normally, @samp{ar r}@dots{} inserts all files @@ -809,6 +824,8 @@ objcopy [ -F @var{bfdname} | --target=@var{bfdname} ] [ -S | --strip-all ] [ -g | --strip-debug ] [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] + [ -L @var{symbolname} | --localize-symbol=@var{symbolname} ] + [ -W @var{symbolname} | --weaken-symbol=@var{symbolname} ] [ -x | --discard-all ] [ -X | --discard-locals ] [ -b @var{byte} | --byte=@var{byte} ] [ -i @var{interleave} | --interleave=@var{interleave} ] @@ -903,8 +920,16 @@ be given more than once. @item -N @var{symbolname} @itemx --strip-symbol=@var{symbolname} Do not copy symbol @var{symbolname} from the source file. This option -may be given more than once, and may be combined with strip options -other than @code{-K}. +may be given more than once. + +@item -L @var{symbolname} +@itemx --localize-symbol=@var{symbolname} +Make symbol @var{symbolname} local to the file, so that it is not +visible externally. This option may be given more than once. + +@item -W @var{symbolname} +@itemx --weaken-symbol=@var{symbolname} +Make symbol @var{symbolname} weak. This option may be given more than once. @item -x @itemx --discard-all @@ -943,12 +968,13 @@ because only certain debugging formats are supported, and the conversion process can be time consuming. @item --gap-fill @var{val} -Fill gaps between sections with @var{val}. This is done by increasing +Fill gaps between sections with @var{val}. This operation applies to +the @emph{load address} (LMA) of the sections. It is done by increasing the size of the section with the lower address, and filling in the extra space created with @var{val}. @item --pad-to @var{address} -Pad the output file up to the virtual address @var{address}. This is +Pad the output file up to the load address @var{address}. This is done by increasing the size of the last section. The extra space is filled in with the value specified by @samp{--gap-fill} (default zero). @@ -987,9 +1013,12 @@ the named section does not exist. @item --set-section-flags @var{section}=@var{flags} Set the flags for the named section. The @var{flags} argument is a comma separated string of flag names. The recognized names are -@samp{alloc}, @samp{load}, @samp{readonly}, @samp{code}, @samp{data}, -and @samp{rom}. Not all flags are meaningful for all object file -formats. +@samp{alloc}, @samp{contents}, @samp{load}, @samp{readonly}, +@samp{code}, @samp{data}, and @samp{rom}. You can set the +@samp{contents} flag for a section which does not have contents, but it +is not meaningful to clear the @samp{contents} flag of a section which +does have contents--just remove the section instead. Not all flags are +meaningful for all object file formats. @item --add-section @var{sectionname}=@var{filename} Add a new section named @var{sectionname} while copying the file. The @@ -1297,7 +1326,7 @@ relocation entries. Using @samp{-x} is equivalent to specifying all of @samp{-a -f -h -r -t}. @item -w -@item --wide +@itemx --wide @cindex wide output, printing Format some lines for output devices that have more than 80 columns. @end table @@ -1343,7 +1372,7 @@ Show the version number of @code{ranlib}. size [ -A | -B | --format=@var{compatibility} ] [ --help ] [ -d | -o | -x | --radix=@var{number} ] [ --target=@var{bfdname} ] [ -V | --version ] - @var{objfile}@dots{} + [ @var{objfile}@dots{} ] @end smallexample The @sc{gnu} @code{size} utility lists the section sizes---and the total @@ -1352,6 +1381,7 @@ argument list. By default, one line of output is generated for each object file or each module in an archive. @var{objfile}@dots{} are the object files to be examined. +If none are specified, the file @code{a.out} will be used. The command line options have the following meanings: @@ -1466,8 +1496,8 @@ Print the name of the file before each string. @item --help Print a summary of the program usage on the standard output and exit. -@itemx -@var{min-len} -@item -n @var{min-len} +@item -@var{min-len} +@itemx -n @var{min-len} @itemx --bytes=@var{min-len} Print sequences of characters that are at least @var{min-len} characters long, instead of the default 4. @@ -1502,7 +1532,7 @@ Print the program version number on the standard output and exit. @cindex symbols, discarding @smallexample -strip [ -F @var{bfdname} | --target=@var{bfdname} | --target=@var{bfdname} ] +strip [ -F @var{bfdname} | --target=@var{bfdname} ] [ -I @var{bfdname} | --input-target=@var{bfdname} ] [ -O @var{bfdname} | --output-target=@var{bfdname} ] [ -s | --strip-all ] [ -S | -g | --strip-debug ] @@ -1849,6 +1879,131 @@ Prints a usage summary. Prints the version number for @code{nlmconv}. @end table +@node windres +@chapter windres + +@code{windres} may be used to manipulate Windows resources. + +@quotation +@emph{Warning:} @code{windres} is not always built as part of the binary +utilities, since it is only useful for Windows targets. +@end quotation + +@smallexample +windres [options] [input-file] [output-file] +@end smallexample + +@code{windres} reads resources from an input file and copies them into +an output file. Either file may be in one of three formats: + +@table @code +@item rc +A text format read by the Resource Compiler. + +@item res +A binary format generated by the Resource Compiler. + +@item coff +A COFF object or executable. +@end table + +The exact description of these different formats is available in +documentation from Microsoft. + +When @code{windres} converts from the @code{rc} format to the @code{res} +format, it is acting like the Windows Resource Compiler. When +@code{windres} converts from the @code{res} format to the @code{coff} +format, it is acting like the Windows @code{CVTRES} program. + +When @code{windres} generates an @code{rc} file, the output is similar +but not identical to the format expected for the input. When an input +@code{rc} file refers to an external filename, an output @code{rc} file +will instead include the file contents. + +If the input or output format is not specified, @code{windres} will +guess based on the file name, or, for the input file, the file contents. +A file with an extension of @file{.rc} will be treated as an @code{rc} +file, a file with an extension of @file{.res} will be treated as a +@code{res} file, and a file with an extension of @file{.o} or +@file{.exe} will be treated as a @code{coff} file. + +If no output file is specified, @code{windres} will print the resources +in @code{rc} format to standard output. + +The normal use is for you to write an @code{rc} file, use @code{windres} +to convert it to a COFF object file, and then link the COFF file into +your application. This will make the resources described in the +@code{rc} file available to Windows. + +@table @code +@item -i @var{filename} +@itemx --input @var{filename} +The name of the input file. If this option is not used, then +@code{windres} will use the first non-option argument as the input file +name. If there are no non-option arguments, then @code{windres} will +read from standard input. @code{windres} can not read a COFF file from +standard input. + +@item -o @var{filename} +@itemx --output @var{filename} +The name of the output file. If this option is not used, then +@code{windres} will use the first non-option argument, after any used +for the input file name, as the output file name. If there is no +non-option argument, then @code{windres} will write to standard output. +@code{windres} can not write a COFF file to standard output. + +@item -I @var{format} +@itemx --input-format @var{format} +The input format to read. @var{format} may be @samp{res}, @samp{rc}, or +@samp{coff}. If no input format is specified, @code{windres} will +guess, as described above. + +@item -O @var{format} +@itemx --output-format @var{format} +The output format to generate. @var{format} may be @samp{res}, +@samp{rc}, or @samp{coff}. If no output format is specified, +@code{windres} will guess, as described above. + +@item -F @var{target} +@itemx --target @var{target} +Specify the BFD format to use for a COFF file as input or output. This +is a BFD target name; you can use the @code{--help} option to see a list +of supported targets. Normally @code{windres} will use the default +format, which is the first one listed by the @code{--help} option. +@ref{Target Selection}. + +@item --preprocessor @var{program} +When @code{windres} reads an @code{rc} file, it runs it through the C +preprocessor first. This option may be used to specify the preprocessor +to use, including any leading arguments. The default preprocessor +argument is @code{gcc -E -xc-header -DRC_INVOKED}. + +@item --include-dir @var{directory} +Specify an include directory to use when reading an @code{rc} file. +@code{windres} will pass this to the preprocessor as an @code{-I} +option. @code{windres} will also search this directory when looking for +files named in the @code{rc} file. + +@item --define @var{sym[=val]} +Specify a @code{-D} option to pass to the preprocessor when reading an +@code{rc} file. + +@item --language @var{val} +Specify the default language to use when reading an @code{rc} file. +@var{val} should be a hexadecimal language code. The low eight bits are +the language, and the high eight bits are the sublanguage. + +@item --help +Prints a usage summary. + +@item --version +Prints the version number for @code{windres}. + +@item --yydebug +If @code{windres} is compiled with @code{YYDEBUG} defined as @code{1}, +this will turn on parser debugging. +@end table + @node Selecting The Target System @chapter Selecting the target system @@ -2162,7 +2317,7 @@ individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs distribution. In any event, we also recommend that you send bug reports for the binary -utilities to @samp{bug-gnu-utils@@prep.ai.mit.edu}. +utilities to @samp{bug-gnu-utils@@gnu.org}. The fundamental principle of reporting bugs usefully is this: @strong{report all the facts}. If you are not sure whether to state a diff --git a/gnu/dist/binutils/coffgrok.c b/gnu/dist/binutils/coffgrok.c index 07259863488..8c4e6c9c98e 100644 --- a/gnu/dist/binutils/coffgrok.c +++ b/gnu/dist/binutils/coffgrok.c @@ -1,5 +1,5 @@ /* coffgrok.c - Copyright (C) 1994, 95, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 97, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -142,7 +142,7 @@ do_sections_p1 (head) head->sections[i].data = section->flags & SEC_DATA; if (strcmp (section->name, ".bss") == 0) head->sections[i].data = 1; - head->sections[i].address = section->vma; + head->sections[i].address = section->lma; head->sections[i].size = section->_raw_size; head->sections[i].number = idx; head->sections[i].nrelocs = section->reloc_count; @@ -166,7 +166,8 @@ do_sections_p2 (head) asection *section; for (section = abfd->sections; section; section = section->next) { - int j; + unsigned int j; + for (j = 0; j < section->reloc_count; j++) { int idx; @@ -248,7 +249,8 @@ do_lines (i, name) { struct coff_line *res = (struct coff_line *) xcalloc (sizeof (struct coff_line), 1); asection *s; - int l; + unsigned int l; + /* Find out if this function has any line numbers in the table */ for (s = abfd->sections; s; s = s->next) { diff --git a/gnu/dist/binutils/config.in b/gnu/dist/binutils/config.in index 0aa5a6471ea..a9f38eb99f1 100644 --- a/gnu/dist/binutils/config.in +++ b/gnu/dist/binutils/config.in @@ -1,5 +1,14 @@ /* config.in. Generated automatically from configure.in by autoheader. */ +/* Name of package. */ +#undef PACKAGE + +/* Version of package. */ +#undef VERSION + +/* Configured target name. */ +#undef TARGET + /* Whether strstr must be declared even if <string.h> is included. */ #undef NEED_DECLARATION_STRSTR @@ -28,12 +37,6 @@ /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H -/* Define if you have <vfork.h>. */ -#undef HAVE_VFORK_H - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef pid_t - /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. @@ -43,11 +46,8 @@ */ #undef STACK_DIRECTION -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define vfork as fork if vfork does not work. */ -#undef vfork +/* Define if lex declares yytext as a char * by default, not a char[]. */ +#undef YYTEXT_POINTER /* Is the type time_t defined in <time.h>? */ #undef HAVE_TIME_T_IN_TIME_H diff --git a/gnu/dist/binutils/config.texi b/gnu/dist/binutils/config.texi index bdcc312838d..d40699c4cdf 100644 --- a/gnu/dist/binutils/config.texi +++ b/gnu/dist/binutils/config.texi @@ -1 +1 @@ -@set VERSION 2.8.1 +@set VERSION 2.9.1 diff --git a/gnu/dist/binutils/configure b/gnu/dist/binutils/configure index c80280cdfe4..740ec6fe2f6 100644 --- a/gnu/dist/binutils/configure +++ b/gnu/dist/binutils/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 +# Generated automatically using autoconf version 2.12.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -12,11 +12,22 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --enable-targets alternative target configurations" + --enable-shared build shared libraries [default=yes] + --enable-shared=PKGS only build shared libraries if the current package + appears as an element in the PKGS list" +ac_help="$ac_help + --enable-static build static libraries [default=yes] + --enable-static=PKGS only build shared libraries if the current package + appears as an element in the PKGS list" ac_help="$ac_help - --enable-shared build shared BFD library" + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --enable-targets alternative target configurations" ac_help="$ac_help --enable-commonbfdlib build shared BFD/opcodes/libiberty library" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -55,6 +66,7 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -338,7 +350,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.12.1" exit 0 ;; -with-* | --with-*) @@ -525,43 +537,8 @@ fi -# Check whether --enable-targets or --disable-targets was given. -if test "${enable_targets+set}" = set; then - enableval="$enable_targets" - case "${enableval}" in - yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac -fi -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - case "${enableval}" in - yes) shared=true shared_bfd=true shared_opcodes=true ;; - no) shared=false ;; - *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;; - *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;; - *bfd*) shared=true shared_bfd=true ;; - *opcodes*) shared=true shared_opcodes=true ;; - *) shared=false ;; -esac -fi -# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. -if test "${enable_commonbfdlib+set}" = set; then - enableval="$enable_commonbfdlib" - case "${enableval}" in - yes) commonbfdlib=true ;; - no) commonbfdlib=false ;; - *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; -esac -fi - - - ac_aux_dir= -for ac_dir in `cd $srcdir/..; pwd` $srcdir/`cd $srcdir/..; pwd`; do +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -573,7 +550,7 @@ for ac_dir in `cd $srcdir/..; pwd` $srcdir/`cd $srcdir/..; pwd`; do fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir/..; pwd` $srcdir/`cd $srcdir/..; pwd`" 1>&2; exit 1; } + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub @@ -602,33 +579,33 @@ esac # Make sure we can run config.sub. -if $ac_config_sub sun4 >/dev/null 2>&1; then : +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:611: checking host system type" >&5 +echo "configure:588: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) - if host_alias=`$ac_config_guess`; then : + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac -host=`$ac_config_sub $host_alias` +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:632: checking target system type" >&5 +echo "configure:609: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -639,14 +616,14 @@ NONE) esac ;; esac -target=`$ac_config_sub $target_alias` +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:650: checking build system type" >&5 +echo "configure:627: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -657,7 +634,7 @@ NONE) esac ;; esac -build=`$ac_config_sub $build_alias` +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` @@ -668,12 +645,110 @@ test "$host_alias" != "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- -if test -z "$target" ; then - { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:662: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + fi -if test -z "$host" ; then - { echo "configure: error: Unrecognized host system type; please check config.sub." 1>&2; exit 1; } + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:716: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 if test "$program_transform_name" = s,x,x,; then program_transform_name= else @@ -693,18 +768,198 @@ test "$program_suffix" != NONE && # sed with no file args requires a program. test "$program_transform_name" = "" && program_transform_name="s,x,x," +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:773: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi -# host-specific stuff: -HDEFINES= -HLDFLAGS= -HLDENV= -RPATH_ENVVAR=LD_LIBRARY_PATH +PACKAGE=binutils + +VERSION=2.9.1 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >> confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + + + +missing_dir=`cd $ac_aux_dir && pwd` +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +echo "configure:819: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:832: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:845: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:858: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:871: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:934: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:708: checking for $ac_word" >&5 +echo "configure:963: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -733,7 +988,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:737: checking for $ac_word" >&5 +echo "configure:992: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -781,7 +1036,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1040: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -791,11 +1046,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 795 "configure" +#line 1050 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -815,12 +1070,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:819: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1074: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:824: checking whether we are using GNU C" >&5 +echo "configure:1079: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -829,7 +1084,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -844,7 +1099,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:848: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1103: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -871,165 +1126,511 @@ else test "${CFLAGS+set}" = set || CFLAGS="-g" fi +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi -. ${srcdir}/../bfd/configure.host +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1143: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + /* | [A-Za-z]:\\*) + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1161: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1164: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$ac_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1200: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi +fi +echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 -AR=${AR-ar} +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1216: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$NM" in +/* | [A-Za-z]:\\*) + ac_cv_path_NM="$NM" # Let the user override the test with a path. + ;; +*) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + else + ac_cv_path_NM="$ac_dir/nm" + fi + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm + ;; +esac +fi -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 +NM="$ac_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1253: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Check for any special flags to pass to ltconfig. +libtool_flags= +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$silent" = yes && libtool_flags="$libtool_flags --silent" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$host" in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 1289 "configure"' > conftest.$ac_ext + if { (eval echo configure:1290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + CFLAGS="$CFLAGS -belf" + ;; +esac + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + + +# Check whether --enable-targets or --disable-targets was given. +if test "${enable_targets+set}" = set; then + enableval="$enable_targets" + case "${enableval}" in + yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } + ;; + no) enable_targets= ;; + *) enable_targets=$enableval ;; +esac +fi +# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +if test "${enable_commonbfdlib+set}" = set; then + enableval="$enable_commonbfdlib" + case "${enableval}" in + yes) commonbfdlib=true ;; + no) commonbfdlib=false ;; + *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; +esac +fi + + + + + +if test -z "$target" ; then + { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } +fi +if test -z "$host" ; then + { echo "configure: error: Unrecognized host system type; please check config.sub." 1>&2; exit 1; } +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:887: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +echo "configure:1354: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" + ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:924: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1383: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi done - IFS="$ac_save_IFS" + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1431: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <<EOF +#line 1441 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +if { (eval echo configure:1445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" + ac_cv_prog_cc_cross=yes fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no fi -echo "$ac_t""$INSTALL" 1>&6 +rm -fr conftest* -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1465: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1470: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1494: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* -# For most hosts we can use a simple definition to pick up the BFD and -# opcodes libraries. However, if we are building shared libraries, we -# need to handle some hosts specially. -BFDLIB='-L../bfd -lbfd' -OPCODES='-L../opcodes -lopcodes' +fi -case "${host}" in -*-*-sunos*) - # On SunOS, we must link against the name we are going to install, - # not -lbfd, since SunOS does not support SONAME. - if test "${shared_bfd}" = "true"; then - BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' - fi - if test "${shared_opcodes}" = "true"; then - OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`' - fi - ;; -alpha*-*-osf*) - # On Alpha OSF/1, the native linker searches all the -L - # directories for any LIB.so files, and only then searches for any - # LIB.a files. That means that if there is an installed - # libbfd.so, but this build is not done with --enable-shared, the - # link will wind up being against the install libbfd.so rather - # than the newly built libbfd. To avoid this, we must explicitly - # link against libbfd.a when --enable-shared is not used. - if test "${shared_bfd}" != "true"; then - BFDLIB='../bfd/libbfd.a' - fi - if test "${shared_opcodes}" != "true"; then - OPCODES='../opcodes/libopcodes.a' +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi - ;; -esac +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi -if test "${commonbfdlib}" = "true"; then - # when a shared libbfd is built with --enable-commonbfdlib, - # all of libopcodes is available in libbfd.so. Unfortunately, on - # HP/UX, when using gcc -g, the linker does a static link, so we - # need to continue linking against opcodes on that platform. - case "${host}" in - *-*-hpux*) ;; - *) OPCODES= ;; - esac + +for ac_prog in 'bison -y' byacc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1527: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 +else + echo "$ac_t""no" 1>&6 fi +test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" +# Extract the first word of "flex", so it can be a program name with args. +set dummy flex; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1559: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LEX="flex" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +if test -z "$LEXLIB" +then + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 +echo "configure:1592: checking for yywrap in -l$ac_lib" >&5 +ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$ac_lib $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1600 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap(); -# Put a plausible default for CC_FOR_BUILD in Makefile. -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - CC_FOR_BUILD=gcc - fi +int main() { +yywrap() +; return 0; } +EOF +if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi +rm -f conftest* +LIBS="$ac_save_LIBS" +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LEXLIB="-l$ac_lib" +else + echo "$ac_t""no" 1>&6 +fi + +fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1033: checking how to run the C preprocessor" >&5 +echo "configure:1634: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1044,13 +1645,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1048 "configure" +#line 1649 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1655: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1061,13 +1662,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1065 "configure" +#line 1666 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1089,21 +1690,264 @@ else fi echo "$ac_t""$CPP" 1>&6 +echo $ac_n "checking lex output file root""... $ac_c" 1>&6 +echo "configure:1695: checking lex output file root" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } +fi +fi + +echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 +echo "configure:1716: checking whether yytext is a pointer" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS="$LIBS" +LIBS="$LIBS $LEXLIB" +cat > conftest.$ac_ext <<EOF +#line 1728 "configure" +#include "confdefs.h" +`cat $LEX_OUTPUT_ROOT.c` +int main() { + +; return 0; } +EOF +if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_prog_lex_yytext_pointer=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +LIBS="$ac_save_LIBS" +rm -f "${LEX_OUTPUT_ROOT}.c" + +fi + +echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + cat >> confdefs.h <<\EOF +#define YYTEXT_POINTER 1 +EOF + +fi + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1758: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test $USE_MAINTAINER_MODE = yes; then + MAINT= + else + MAINT='#M#' + fi + + +echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6 +echo "configure:1776: checking for Cygwin32 environment" >&5 +if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1781 "configure" +#include "confdefs.h" + +int main() { +return __CYGWIN32__; +; return 0; } +EOF +if { (eval echo configure:1788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_cygwin32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_cygwin32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$am_cv_cygwin32" 1>&6 +CYGWIN32= +test "$am_cv_cygwin32" = yes && CYGWIN32=yes +echo $ac_n "checking for Mingw32 environment""... $ac_c" 1>&6 +echo "configure:1805: checking for Mingw32 environment" >&5 +if eval "test \"`echo '$''{'am_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1810 "configure" +#include "confdefs.h" + +int main() { +return __MINGW32__; +; return 0; } +EOF +if { (eval echo configure:1817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$am_cv_mingw32" 1>&6 +MINGW32= +test "$am_cv_mingw32" = yes && MINGW32=yes + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1836: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then +am_cv_exeext=.exe +else +cat > am_c_test.c << 'EOF' +int main() { +/* Nothing needed here */ +} +EOF +${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5 +am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` +rm -f am_c_test* +fi + +test x"${am_cv_exeext}" = x && am_cv_exeext=no +fi +EXEEXT="" +test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext} +echo "$ac_t""${am_cv_exeext}" 1>&6 + + +# host-specific stuff: + +HDEFINES= + +. ${srcdir}/../bfd/configure.host + + +AR=${AR-ar} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1872: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + + +# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + CC_FOR_BUILD=gcc + fi +fi + +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' +else + echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 +echo "configure:1916: checking for build system executable suffix" >&5 +if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > ac_c_test.c << 'EOF' +int main() { +/* Nothing needed here */ +} +EOF + ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5 + bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//` + rm -f ac_c_test* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no +fi + +echo "$ac_t""$bfd_cv_build_exeext" 1>&6 + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi + + for ac_hdr in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1097: checking for $ac_hdr" >&5 +echo "configure:1941: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1102 "configure" +#line 1946 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1130,12 +1974,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1134: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1978: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1139 "configure" +#line 1983 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -1151,7 +1995,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1174,19 +2018,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1178: checking for working alloca.h" >&5 +echo "configure:2022: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1183 "configure" +#line 2027 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1207,12 +2051,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1211: checking for alloca" >&5 +echo "configure:2055: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1216 "configure" +#line 2060 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1235,7 +2079,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1267,12 +2111,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1271: checking whether alloca needs Cray hooks" >&5 +echo "configure:2115: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1276 "configure" +#line 2120 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1297,12 +2141,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1301: checking for $ac_func" >&5 +echo "configure:2145: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1306 "configure" +#line 2150 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1325,7 +2169,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1352,7 +2196,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1356: checking stack direction for C alloca" >&5 +echo "configure:2200: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1360,7 +2204,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1364 "configure" +#line 2208 "configure" #include "confdefs.h" find_stack_direction () { @@ -1379,7 +2223,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:1383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1403,12 +2247,12 @@ fi for ac_func in sbrk utimes do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1407: checking for $ac_func" >&5 +echo "configure:2251: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1412 "configure" +#line 2256 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1431,7 +2275,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1455,422 +2299,21 @@ else fi done -if test "x$cross_compiling" = "xno"; then - echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1461: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1466 "configure" -#include "confdefs.h" -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1491 "configure" -#include "confdefs.h" -#include <string.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1509 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext <<EOF -#line 1530 "configure" -#include "confdefs.h" -#include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:1541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1565: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1570 "configure" -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_pid_t=yes -else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF -#define pid_t int -EOF - -fi - -ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:1599: checking for vfork.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1604 "configure" -#include "confdefs.h" -#include <vfork.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VFORK_H 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:1634: checking for working vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:1640: checking for vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1645 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vfork(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vfork(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vfork) || defined (__stub___vfork) -choke me -#else -vfork(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func_vfork=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vfork=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -fi - -else - cat > conftest.$ac_ext <<EOF -#line 1689 "configure" -#include "confdefs.h" -/* Thanks to Paul Eggert for this test. */ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_VFORK_H -#include <vfork.h> -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. - The compiler is told about this with #include <vfork.h>, - but some compilers (e.g. gcc -O) don't grok <vfork.h>. - Test for this by using a static variable whose address - is put into a register that is clobbered by the vfork. */ -static -#ifdef __cplusplus -sparc_address_test (int arg) -#else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} -main() { - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. - This test uses lots of local variables, at least - as many local variables as main has allocated so far - including compiler temporaries. 4 locals are enough for - gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. - A buggy compiler should reuse the register of parent - for one of the local variables, since it will think that - parent can't possibly be used any more in this routine. - Assigning to the local variable will thus munge parent - in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), - vfork doesn't separate parent from child file descriptors. - If the child closes a descriptor before it execs or exits, - this munges the parent's descriptor as well. - Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - exit( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -EOF -if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_func_vfork_works=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_vfork_works=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 -if test $ac_cv_func_vfork_works = no; then - cat >> confdefs.h <<\EOF -#define vfork fork -EOF - -fi - -else - echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:1808: checking for vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1813 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vfork(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vfork(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vfork) || defined (__stub___vfork) -choke me -#else -vfork(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func_vfork=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vfork=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define vfork fork -EOF - -fi - -fi echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6 -echo "configure:1862: checking for time_t in time.h" >&5 +echo "configure:2305: checking for time_t in time.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1867 "configure" +#line 2310 "configure" #include "confdefs.h" #include <time.h> int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:1874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_time_h=yes else @@ -1891,19 +2334,19 @@ EOF fi echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1895: checking for time_t in sys/types.h" >&5 +echo "configure:2338: checking for time_t in sys/types.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1900 "configure" +#line 2343 "configure" #include "confdefs.h" #include <sys/types.h> int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:1907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_types_h=yes else @@ -1926,12 +2369,12 @@ fi # Under Next 3.2 <utime.h> apparently does not define struct utimbuf # by default. echo $ac_n "checking for utime.h""... $ac_c" 1>&6 -echo "configure:1930: checking for utime.h" >&5 +echo "configure:2373: checking for utime.h" >&5 if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1935 "configure" +#line 2378 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_TIME_H @@ -1942,7 +2385,7 @@ int main() { struct utimbuf s; ; return 0; } EOF -if { (eval echo configure:1946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_header_utime_h=yes else @@ -1963,12 +2406,12 @@ EOF fi echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6 -echo "configure:1967: checking whether fprintf must be declared" >&5 +echo "configure:2410: checking whether fprintf must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1972 "configure" +#line 2415 "configure" #include "confdefs.h" #include <stdio.h> @@ -1989,7 +2432,7 @@ int main() { char *(*pfn) = (char *(*)) fprintf ; return 0; } EOF -if { (eval echo configure:1993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_fprintf=no else @@ -2011,12 +2454,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:2015: checking whether strstr must be declared" >&5 +echo "configure:2458: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2020 "configure" +#line 2463 "configure" #include "confdefs.h" #include <stdio.h> @@ -2037,7 +2480,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:2041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -2059,12 +2502,12 @@ EOF fi echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6 -echo "configure:2063: checking whether sbrk must be declared" >&5 +echo "configure:2506: checking whether sbrk must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2068 "configure" +#line 2511 "configure" #include "confdefs.h" #include <stdio.h> @@ -2085,7 +2528,7 @@ int main() { char *(*pfn) = (char *(*)) sbrk ; return 0; } EOF -if { (eval echo configure:2089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_sbrk=no else @@ -2107,12 +2550,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:2111: checking whether getenv must be declared" >&5 +echo "configure:2554: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2116 "configure" +#line 2559 "configure" #include "confdefs.h" #include <stdio.h> @@ -2133,7 +2576,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:2137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -2157,7 +2600,7 @@ fi case "${host}" in -i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32 | *-*-windows) +i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows) cat >> confdefs.h <<\EOF #define USE_BINARY_FOPEN 1 EOF @@ -2186,48 +2629,52 @@ NLMCONV_DEFS= BUILD_SRCONV= BUILD_DLLTOOL= DLLTOOL_DEFS= +BUILD_WINDRES= for targ in $target $canon_targets do if test "x$targ" = "xall"; then all_targets=true - BUILD_NLMCONV='$(NLMCONV_PROG)' - BUILD_SRCONV='$(SRCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' + BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" else case $targ in i[3456]86*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" ;; alpha*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" ;; powerpc*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" ;; sparc*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" ;; esac case $targ in - *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; + *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' ;; esac case $targ in arm-*pe*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)' + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - i[3-6]86-*pe* | i[3-6]86-*-cygwin32) - BUILD_DLLTOOL='$(DLLTOOL_PROG)' + i[3-6]86-*pe* | i[3-6]86-*-cygwin32* | i[3-6]86-*-mingw32*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; powerpc*-*-*pe* | powerpc*-*-cygwin32) - BUILD_DLLTOOL='$(DLLTOOL_PROG)' + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; esac fi @@ -2239,6 +2686,12 @@ done + +cat >> confdefs.h <<EOF +#define TARGET "${target}" +EOF + + targ=$target . $srcdir/../bfd/config.bfd if test "x$targ_underscore" = "xyes"; then @@ -2271,7 +2724,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set) 2>&1 | grep ac_space` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -2338,7 +2791,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2358,6 +2811,7 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g @@ -2394,25 +2848,41 @@ s%@build_alias@%$build_alias%g s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@RANLIB@%$RANLIB%g s%@CC@%$CC%g +s%@LD@%$LD%g +s%@NM@%$NM%g +s%@LN_S@%$LN_S%g +s%@LIBTOOL@%$LIBTOOL%g +s%@YACC@%$YACC%g +s%@LEX@%$LEX%g +s%@LEXLIB@%$LEXLIB%g +s%@CPP@%$CPP%g +s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g +s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g s%@HDEFINES@%$HDEFINES%g -s%@HLDFLAGS@%$HLDFLAGS%g -s%@HLDENV@%$HLDENV%g -s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@BFDLIB@%$BFDLIB%g -s%@OPCODES@%$OPCODES%g s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@CPP@%$CPP%g +s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g s%@ALLOCA@%$ALLOCA%g s%@NLMCONV_DEFS@%$NLMCONV_DEFS%g s%@BUILD_NLMCONV@%$BUILD_NLMCONV%g s%@BUILD_SRCONV@%$BUILD_SRCONV%g s%@BUILD_DLLTOOL@%$BUILD_DLLTOOL%g s%@DLLTOOL_DEFS@%$DLLTOOL_DEFS%g +s%@BUILD_WINDRES@%$BUILD_WINDRES%g s%@UNDERSCORE@%$UNDERSCORE%g CEOF @@ -2624,9 +3094,11 @@ fi; done EOF cat >> $CONFIG_STATUS <<EOF + EOF cat >> $CONFIG_STATUS <<\EOF -case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + exit 0 EOF chmod +x $CONFIG_STATUS diff --git a/gnu/dist/binutils/configure.com b/gnu/dist/binutils/configure.com index 9e35c766297..5127318914f 100644 --- a/gnu/dist/binutils/configure.com +++ b/gnu/dist/binutils/configure.com @@ -32,7 +32,7 @@ $ create []config.h /* Do we need to use the b modifier when opening binary files? */ /* #undef USE_BINARY_FOPEN */ /* Define if you have the sbrk function. */ -#define HAVE_SBRK 1 +/* #undef HAVE_SBRK 1 */ /* Define if you have the utimes function. */ #define HAVE_UTIMES 1 /* Define if you have the <fcntl.h> header file. */ diff --git a/gnu/dist/binutils/configure.in b/gnu/dist/binutils/configure.in index c8d5432f100..8b6dbfb264e 100644 --- a/gnu/dist/binutils/configure.in +++ b/gnu/dist/binutils/configure.in @@ -3,6 +3,12 @@ dnl AC_PREREQ(2.5) AC_INIT(ar.c) +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(binutils, 2.9.1) + +AM_PROG_LIBTOOL + AC_ARG_ENABLE(targets, [ --enable-targets alternative target configurations], [case "${enableval}" in @@ -11,17 +17,6 @@ AC_ARG_ENABLE(targets, no) enable_targets= ;; *) enable_targets=$enableval ;; esac])dnl -AC_ARG_ENABLE(shared, -[ --enable-shared build shared BFD library], -[case "${enableval}" in - yes) shared=true shared_bfd=true shared_opcodes=true ;; - no) shared=false ;; - *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;; - *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;; - *bfd*) shared=true shared_bfd=true ;; - *opcodes*) shared=true shared_opcodes=true ;; - *) shared=false ;; -esac])dnl AC_ARG_ENABLE(commonbfdlib, [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], [case "${enableval}" in @@ -30,85 +25,36 @@ AC_ARG_ENABLE(commonbfdlib, *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; esac])dnl -AC_CONFIG_HEADER(config.h:config.in) +AM_CONFIG_HEADER(config.h:config.in) -AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`) -AC_CANONICAL_SYSTEM if test -z "$target" ; then AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) fi if test -z "$host" ; then AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) fi -AC_ARG_PROGRAM + +AC_PROG_CC + +AC_PROG_YACC +AC_PROG_LEX +AC_DECL_YYTEXT + +AM_MAINTAINER_MODE +AM_CYGWIN32 +AM_EXEEXT # host-specific stuff: HDEFINES= -HLDFLAGS= -HLDENV= -RPATH_ENVVAR=LD_LIBRARY_PATH - -AC_PROG_CC . ${srcdir}/../bfd/configure.host AC_SUBST(HDEFINES) -AC_SUBST(HLDFLAGS) -AC_SUBST(HLDENV) -AC_SUBST(RPATH_ENVVAR) AR=${AR-ar} AC_SUBST(AR) AC_PROG_RANLIB -AC_PROG_INSTALL - -# For most hosts we can use a simple definition to pick up the BFD and -# opcodes libraries. However, if we are building shared libraries, we -# need to handle some hosts specially. -BFDLIB='-L../bfd -lbfd' -OPCODES='-L../opcodes -lopcodes' - -case "${host}" in -*-*-sunos*) - # On SunOS, we must link against the name we are going to install, - # not -lbfd, since SunOS does not support SONAME. - if test "${shared_bfd}" = "true"; then - BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' - fi - if test "${shared_opcodes}" = "true"; then - OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`' - fi - ;; -alpha*-*-osf*) - # On Alpha OSF/1, the native linker searches all the -L - # directories for any LIB.so files, and only then searches for any - # LIB.a files. That means that if there is an installed - # libbfd.so, but this build is not done with --enable-shared, the - # link will wind up being against the install libbfd.so rather - # than the newly built libbfd. To avoid this, we must explicitly - # link against libbfd.a when --enable-shared is not used. - if test "${shared_bfd}" != "true"; then - BFDLIB='../bfd/libbfd.a' - fi - if test "${shared_opcodes}" != "true"; then - OPCODES='../opcodes/libopcodes.a' - fi - ;; -esac - -if test "${commonbfdlib}" = "true"; then - # when a shared libbfd is built with --enable-commonbfdlib, - # all of libopcodes is available in libbfd.so. Unfortunately, on - # HP/UX, when using gcc -g, the linker does a static link, so we - # need to continue linking against opcodes on that platform. - case "${host}" in - *-*-hpux*) ;; - *) OPCODES= ;; - esac -fi - -AC_SUBST(BFDLIB) -AC_SUBST(OPCODES) +AM_PROG_INSTALL BFD_CC_FOR_BUILD @@ -116,13 +62,6 @@ AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) AC_HEADER_SYS_WAIT AC_FUNC_ALLOCA AC_CHECK_FUNCS(sbrk utimes) -dnl Temporary workaround for bug in autoconf 2.12. When the bug is -dnl fixed, we can just call AC_FUNC_VFORK in all cases. -if test "x$cross_compiling" = "xno"; then - AC_FUNC_VFORK -else - AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork)) -fi AC_MSG_CHECKING(for time_t in time.h) AC_CACHE_VAL(bu_cv_decl_time_t_time_h, @@ -187,52 +126,56 @@ NLMCONV_DEFS= BUILD_SRCONV= BUILD_DLLTOOL= DLLTOOL_DEFS= +BUILD_WINDRES= for targ in $target $canon_targets do if test "x$targ" = "xall"; then all_targets=true - BUILD_NLMCONV='$(NLMCONV_PROG)' - BUILD_SRCONV='$(SRCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' + BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" else case $targ in changequote(,)dnl i[3456]86*-*-netware*) changequote([,])dnl - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" ;; alpha*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" ;; powerpc*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" ;; sparc*-*-netware*) - BUILD_NLMCONV='$(NLMCONV_PROG)' + BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" ;; esac case $targ in - *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; + *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' ;; esac case $targ in arm-*pe*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)' + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; changequote(,)dnl - i[3-6]86-*pe* | i[3-6]86-*-cygwin32) + i[3-6]86-*pe* | i[3-6]86-*-cygwin32* | i[3-6]86-*-mingw32*) changequote([,])dnl - BUILD_DLLTOOL='$(DLLTOOL_PROG)' + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; powerpc*-*-*pe* | powerpc*-*-cygwin32) - BUILD_DLLTOOL='$(DLLTOOL_PROG)' + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; esac fi @@ -243,6 +186,9 @@ AC_SUBST(BUILD_NLMCONV) AC_SUBST(BUILD_SRCONV) AC_SUBST(BUILD_DLLTOOL) AC_SUBST(DLLTOOL_DEFS) +AC_SUBST(BUILD_WINDRES) + +AC_DEFINE_UNQUOTED(TARGET, "${target}") targ=$target . $srcdir/../bfd/config.bfd @@ -253,5 +199,4 @@ else fi AC_SUBST(UNDERSCORE) -AC_OUTPUT(Makefile, -[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) +AC_OUTPUT(Makefile) diff --git a/gnu/dist/binutils/deflex.l b/gnu/dist/binutils/deflex.l index 6ce50adb260..e7fa3626394 100644 --- a/gnu/dist/binutils/deflex.l +++ b/gnu/dist/binutils/deflex.l @@ -1,7 +1,6 @@ -%{ -/* deflex.l - Lexer for .def files */ +%{/* deflex.l - Lexer for .def files */ -/* Copyright (C) 1995 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -25,8 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ */ #define DONTDECLARE_MALLOC +#include "libiberty.h" #include "defparse.h" -extern char *strdup(); +#include "dlltool.h" + int linenumber; %} @@ -41,7 +42,7 @@ int linenumber; "SECTIONS" { return SECTIONS;} "EXPORTS" { return EXPORTS;} "IMPORTS" { return IMPORTS;} -"VERSION" { return VERSION;} +"VERSION" { return VERSIONK;} "BASE" { return BASE;} "CONSTANT" { return CONSTANT; } "NONAME" { return NONAME; } @@ -53,19 +54,19 @@ int linenumber; [0-9][x0-9A-Fa-f]* { yylval.number = strtol (yytext,0,0); return NUMBER; } -[A-Za-z$:\-\_][A-Za-z0-9/$:\-\_@]+ { - yylval.id = strdup(yytext); +[A-Za-z$:\-\_?][A-Za-z0-9/$:\-\_@?]+ { + yylval.id = xstrdup (yytext); return ID; } "\""[^\"]*"\"" { - yylval.id = strdup (yytext+1); + yylval.id = xstrdup (yytext+1); yylval.id[yyleng-2] = 0; return ID; } "\'"[^\']*"\'" { - yylval.id = strdup (yytext+1); + yylval.id = xstrdup (yytext+1); yylval.id[yyleng-2] = 0; return ID; } diff --git a/gnu/dist/binutils/defparse.c b/gnu/dist/binutils/defparse.c new file mode 100644 index 00000000000..1212c6b932c --- /dev/null +++ b/gnu/dist/binutils/defparse.c @@ -0,0 +1,1056 @@ + +/* A Bison parser, made from /5g/ian/binutils/release/copy/binutils/defparse.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define NAME 258 +#define LIBRARY 259 +#define DESCRIPTION 260 +#define STACKSIZE 261 +#define HEAPSIZE 262 +#define CODE 263 +#define DATA 264 +#define SECTIONS 265 +#define EXPORTS 266 +#define IMPORTS 267 +#define VERSIONK 268 +#define BASE 269 +#define CONSTANT 270 +#define READ 271 +#define WRITE 272 +#define EXECUTE 273 +#define SHARED 274 +#define NONAME 275 +#define ID 276 +#define NUMBER 277 + +#line 1 "/5g/ian/binutils/release/copy/binutils/defparse.y" + /* defparse.y - parser for .def files */ + +/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program 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 of the License, or +(at your option) any later version. + +This program 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 this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "bucomm.h" +#include "dlltool.h" + +#line 26 "/5g/ian/binutils/release/copy/binutils/defparse.y" +typedef union { + char *id; + int number; +} YYSTYPE; +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 75 +#define YYFLAG -32768 +#define YYNTBASE 27 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 277 ? yytranslate[x] : 46) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 25, 2, 23, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 24, 2, 2, 26, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 3, 5, 9, 13, 16, 19, 23, 27, 30, + 33, 36, 39, 42, 47, 48, 50, 53, 60, 63, + 65, 71, 75, 78, 80, 83, 87, 89, 91, 92, + 95, 96, 98, 100, 102, 104, 106, 107, 109, 110, + 112, 113, 115, 116, 119, 120, 123, 124, 128 +}; + +static const short yyrhs[] = { 27, + 28, 0, 28, 0, 3, 42, 45, 0, 4, 42, + 45, 0, 11, 29, 0, 5, 21, 0, 6, 22, + 37, 0, 7, 22, 37, 0, 8, 35, 0, 9, + 35, 0, 10, 33, 0, 12, 31, 0, 13, 22, + 0, 13, 22, 23, 22, 0, 0, 30, 0, 29, + 30, 0, 21, 44, 43, 40, 39, 41, 0, 31, + 32, 0, 32, 0, 21, 24, 21, 23, 21, 0, + 21, 23, 21, 0, 33, 34, 0, 34, 0, 21, + 35, 0, 35, 36, 38, 0, 38, 0, 25, 0, + 0, 25, 22, 0, 0, 16, 0, 17, 0, 18, + 0, 19, 0, 15, 0, 0, 20, 0, 0, 9, + 0, 0, 21, 0, 0, 26, 22, 0, 0, 24, + 21, 0, 0, 14, 24, 22, 0, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 42, 43, 46, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 62, 64, 65, 68, 72, 74, + 77, 79, 81, 83, 86, 90, 92, 95, 97, 99, + 100, 103, 105, 106, 107, 110, 112, 115, 117, 120, + 122, 125, 126, 129, 131, 134, 136, 139, 140 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","NAME","LIBRARY", +"DESCRIPTION","STACKSIZE","HEAPSIZE","CODE","DATA","SECTIONS","EXPORTS","IMPORTS", +"VERSIONK","BASE","CONSTANT","READ","WRITE","EXECUTE","SHARED","NONAME","ID", +"NUMBER","'.'","'='","','","'@'","start","command","explist","expline","implist", +"impline","seclist","secline","attr_list","opt_comma","opt_number","attr","opt_CONSTANT", +"opt_NONAME","opt_DATA","opt_name","opt_ordinal","opt_equal_name","opt_base", NULL +}; +#endif + +static const short yyr1[] = { 0, + 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 29, 29, 29, 30, 31, 31, + 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, + 37, 38, 38, 38, 38, 39, 39, 40, 40, 41, + 41, 42, 42, 43, 43, 44, 44, 45, 45 +}; + +static const short yyr2[] = { 0, + 2, 1, 3, 3, 2, 2, 3, 3, 2, 2, + 2, 2, 2, 4, 0, 1, 2, 6, 2, 1, + 5, 3, 2, 1, 2, 3, 1, 1, 0, 2, + 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, + 0, 1, 0, 2, 0, 2, 0, 3, 0 +}; + +static const short yydefact[] = { 0, + 43, 43, 0, 0, 0, 0, 0, 0, 15, 0, + 0, 0, 2, 42, 49, 49, 6, 31, 31, 32, + 33, 34, 35, 9, 27, 10, 0, 11, 24, 47, + 5, 16, 0, 12, 20, 13, 1, 0, 3, 4, + 0, 7, 8, 28, 0, 25, 23, 0, 45, 17, + 0, 0, 19, 0, 0, 30, 26, 46, 0, 39, + 22, 0, 14, 48, 44, 38, 37, 0, 36, 41, + 21, 40, 18, 0, 0 +}; + +static const short yydefgoto[] = { 12, + 13, 31, 32, 34, 35, 28, 29, 24, 45, 42, + 25, 70, 67, 73, 15, 60, 49, 39 +}; + +static const short yypact[] = { 18, + -2, -2, 15, 17, 20, -1, -1, 19, 22, 23, + 24, 1,-32768,-32768, 31, 31,-32768, 12, 12,-32768, +-32768,-32768,-32768, 16,-32768, 16, -1, 19,-32768, 14, + 22,-32768, -21, 23,-32768, 25,-32768, 26,-32768,-32768, + 27,-32768,-32768,-32768, -1, 16,-32768, 30, 21,-32768, + 32, 33,-32768, 34, 35,-32768,-32768,-32768, 36, 39, +-32768, 29,-32768,-32768,-32768,-32768, 40, 41,-32768, 51, +-32768,-32768,-32768, 61,-32768 +}; + +static const short yypgoto[] = {-32768, + 52,-32768, 37,-32768, 38,-32768, 42, -7,-32768, 44, + 28,-32768,-32768,-32768, 63,-32768,-32768, 50 +}; + + +#define YYLAST 73 + + +static const short yytable[] = { 26, + 74, 51, 52, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 20, 21, 22, 23, 14, 46, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -29, -29, -29, -29, 17, 41, 48, 18, 27, + 44, 19, 30, 33, 38, 36, 59, 54, 56, 55, + 58, 68, 61, 62, 69, 63, 64, 65, 66, 72, + 75, 71, 43, 37, 16, 40, 0, 50, 0, 47, + 0, 53, 57 +}; + +static const short yycheck[] = { 7, + 0, 23, 24, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 16, 17, 18, 19, 21, 27, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 16, 17, 18, 19, 21, 25, 24, 22, 21, + 25, 22, 21, 21, 14, 22, 26, 23, 22, 24, + 21, 23, 21, 21, 15, 22, 22, 22, 20, 9, + 0, 21, 19, 12, 2, 16, -1, 31, -1, 28, + -1, 34, 45 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/cygnus/progressive-97r2/share/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include <alloca.h> +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include <malloc.h> +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include <malloc.h> + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 196 "/usr/cygnus/progressive-97r2/share/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 3: +#line 47 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_name (yyvsp[-1].id, yyvsp[0].number); ; + break;} +case 4: +#line 48 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_library (yyvsp[-1].id, yyvsp[0].number); ; + break;} +case 6: +#line 50 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_description (yyvsp[0].id);; + break;} +case 7: +#line 51 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_stacksize (yyvsp[-1].number, yyvsp[0].number);; + break;} +case 8: +#line 52 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_heapsize (yyvsp[-1].number, yyvsp[0].number);; + break;} +case 9: +#line 53 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_code (yyvsp[0].number);; + break;} +case 10: +#line 54 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_data (yyvsp[0].number);; + break;} +case 13: +#line 57 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_version (yyvsp[0].number,0);; + break;} +case 14: +#line 58 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_version (yyvsp[-2].number,yyvsp[0].number);; + break;} +case 18: +#line 70 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_exports (yyvsp[-5].id, yyvsp[-4].id, yyvsp[-3].number, yyvsp[-2].number, yyvsp[-1].number, yyvsp[0].number);; + break;} +case 21: +#line 78 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_import (yyvsp[-4].id,yyvsp[-2].id,yyvsp[0].id);; + break;} +case 22: +#line 79 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_import (0, yyvsp[-2].id,yyvsp[0].id);; + break;} +case 25: +#line 87 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ def_section (yyvsp[-1].id,yyvsp[0].number);; + break;} +case 30: +#line 99 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=yyvsp[0].number;; + break;} +case 31: +#line 100 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=-1;; + break;} +case 32: +#line 104 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number = 1;; + break;} +case 33: +#line 105 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number = 2;; + break;} +case 34: +#line 106 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=4;; + break;} +case 35: +#line 107 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=8;; + break;} +case 36: +#line 111 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{yyval.number=1;; + break;} +case 37: +#line 112 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{yyval.number=0;; + break;} +case 38: +#line 116 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{yyval.number=1;; + break;} +case 39: +#line 117 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{yyval.number=0;; + break;} +case 40: +#line 121 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number = 1; ; + break;} +case 41: +#line 122 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number = 0; ; + break;} +case 42: +#line 125 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.id =yyvsp[0].id; ; + break;} +case 43: +#line 126 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.id=""; ; + break;} +case 44: +#line 130 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=yyvsp[0].number;; + break;} +case 45: +#line 131 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=-1;; + break;} +case 46: +#line 135 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.id = yyvsp[0].id; ; + break;} +case 47: +#line 136 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.id = 0; ; + break;} +case 48: +#line 139 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number= yyvsp[0].number;; + break;} +case 49: +#line 140 "/5g/ian/binutils/release/copy/binutils/defparse.y" +{ yyval.number=-1;; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 498 "/usr/cygnus/progressive-97r2/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 145 "/5g/ian/binutils/release/copy/binutils/defparse.y" diff --git a/gnu/dist/binutils/defparse.h b/gnu/dist/binutils/defparse.h new file mode 100644 index 00000000000..fa35fb025b3 --- /dev/null +++ b/gnu/dist/binutils/defparse.h @@ -0,0 +1,27 @@ +typedef union { + char *id; + int number; +} YYSTYPE; +#define NAME 258 +#define LIBRARY 259 +#define DESCRIPTION 260 +#define STACKSIZE 261 +#define HEAPSIZE 262 +#define CODE 263 +#define DATA 264 +#define SECTIONS 265 +#define EXPORTS 266 +#define IMPORTS 267 +#define VERSIONK 268 +#define BASE 269 +#define CONSTANT 270 +#define READ 271 +#define WRITE 272 +#define EXECUTE 273 +#define SHARED 274 +#define NONAME 275 +#define ID 276 +#define NUMBER 277 + + +extern YYSTYPE yylval; diff --git a/gnu/dist/binutils/defparse.y b/gnu/dist/binutils/defparse.y index 8a0f844458e..713b5d71c0c 100644 --- a/gnu/dist/binutils/defparse.y +++ b/gnu/dist/binutils/defparse.y @@ -1,6 +1,6 @@ -/* defparse.y - parser for .def files */ +%{ /* defparse.y - parser for .def files */ -/* Copyright (C) 1995 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -18,6 +18,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "bfd.h" +#include "bucomm.h" +#include "dlltool.h" +%} %union { char *id; @@ -25,11 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ }; %token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA -%token SECTIONS, EXPORTS, IMPORTS, VERSION, BASE, CONSTANT +%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT %token READ WRITE EXECUTE SHARED NONAME %token <id> ID %token <number> NUMBER -%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT attr attr_list opt_number +%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA +%type <number> attr attr_list opt_number %type <id> opt_name opt_equal_name %% @@ -49,19 +54,20 @@ command: | DATA attr_list { def_data ($2);} | SECTIONS seclist | IMPORTS implist - | VERSION NUMBER { def_version ($2,0);} - | VERSION NUMBER '.' NUMBER { def_version ($2,$4);} + | VERSIONK NUMBER { def_version ($2,0);} + | VERSIONK NUMBER '.' NUMBER { def_version ($2,$4);} ; explist: - explist expline + /* EMPTY */ | expline + | explist expline ; expline: - ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT - { def_exports ($1, $2, $3, $4, $5);} + ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA + { def_exports ($1, $2, $3, $4, $5, $6);} ; implist: implist impline @@ -105,11 +111,17 @@ opt_CONSTANT: CONSTANT {$$=1;} | {$$=0;} ; + opt_NONAME: NONAME {$$=1;} | {$$=0;} ; +opt_DATA: + DATA { $$ = 1; } + | { $$ = 0; } + ; + opt_name: ID { $$ =$1; } | { $$=""; } ; diff --git a/gnu/dist/binutils/dep-in.sed b/gnu/dist/binutils/dep-in.sed index 278f2534068..f61921a4828 100644 --- a/gnu/dist/binutils/dep-in.sed +++ b/gnu/dist/binutils/dep-in.sed @@ -5,6 +5,7 @@ s!@INCDIR@!$(INCDIR)!g s!@BFDDIR@!$(BFDDIR)!g s!@SRCDIR@/!!g +s!@OBJDIR@/!!g s/\\\n */ /g diff --git a/gnu/dist/binutils/dlltool.c b/gnu/dist/binutils/dlltool.c index c5530bd1d5f..1253f9f17ad 100644 --- a/gnu/dist/binutils/dlltool.c +++ b/gnu/dist/binutils/dlltool.c @@ -1,5 +1,5 @@ /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright (C) 1995, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 96, 97, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* @@ -46,7 +47,7 @@ LIBRARY <name> [ , <base> ] The result is going to be <name>.DLL - EXPORTS ( <name1> [ = <name2> ] [ @ <integer> ] [ NONAME ] [CONSTANT] ) * + EXPORTS ( <name1> [ = <name2> ] [ @ <integer> ] [ NONAME ] [CONSTANT] [DATA] ) * Declares name1 as an exported symbol from the DLL, with optional ordinal number <integer> @@ -201,7 +202,6 @@ */ /* AIX requires this to be the first thing in the file. */ -/* AIX requires this to be the first thing in the file. */ #ifndef __GNUC__ # ifdef _AIX #pragma alloca @@ -217,10 +217,15 @@ #include "bucomm.h" #include "getopt.h" #include "demangle.h" +#include "dlltool.h" + #include <ctype.h> +#include <time.h> + #ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> -#else +#else /* ! HAVE_SYS_WAIT_H */ +#if ! defined (_WIN32) || defined (__CYGWIN32__) #ifndef WIFEXITED #define WIFEXITED(w) (((w)&0377) == 0) #endif @@ -233,13 +238,23 @@ #ifndef WEXITSTATUS #define WEXITSTATUS(w) (((w) >> 8) & 0377) #endif +#else /* defined (_WIN32) && ! defined (__CYGWIN32__) */ +#ifndef WIFEXITED +#define WIFEXITED(w) (((w) & 0xff) == 0) #endif - -#ifdef HAVE_VFORK_H -#include <vfork.h> +#ifndef WIFSIGNALED +#define WIFSIGNALED(w) (((w) & 0xff) != 0 && ((w) & 0xff) != 0x7f) +#endif +#ifndef WTERMSIG +#define WTERMSIG(w) ((w) & 0x7f) #endif +#ifndef WEXITSTATUS +#define WEXITSTATUS(w) (((w) & 0xff00) >> 8) +#endif +#endif /* defined (_WIN32) && ! defined (__CYGWIN32__) */ +#endif /* ! HAVE_SYS_WAIT_H */ -char *as_name = "as"; +static char *as_name = "as"; static int no_idata4; static int no_idata5; @@ -253,49 +268,50 @@ static int add_indirect = 0; static int add_underscore = 0; static int dontdeltemps = 0; -int yyparse(); -int yydebug; static char *def_file; static char *program_name; -char *strrchr (); -char *strdup (); static int machine; -int killat; +static int killat; static int verbose; -FILE *output_def; -FILE *base_file; +static FILE *output_def; +static FILE *base_file; #ifdef DLLTOOL_ARM -static char *mname = "arm"; +static const char *mname = "arm"; #endif #ifdef DLLTOOL_I386 -static char *mname = "i386"; +static const char *mname = "i386"; #endif #ifdef DLLTOOL_PPC -static char *mname = "ppc"; +static const char *mname = "ppc"; #endif #define PATHMAX 250 /* What's the right name for this ? */ /* This bit of assemly does jmp * .... s set how_jtab_roff to mark where the 32bit abs branch should go */ -unsigned char i386_jtab[] = { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90}; - +static const unsigned char i386_jtab[] = +{ + 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 +}; -unsigned char arm_jtab[] = { 0x00, 0xc0, 0x9f, 0xe5, - 0x00, 0xf0, 0x9c, 0xe5, - 0, 0, 0, 0}; +static const unsigned char arm_jtab[] = +{ + 0x00, 0xc0, 0x9f, 0xe5, + 0x00, 0xf0, 0x9c, 0xe5, + 0, 0, 0, 0 +}; /* This is the glue sequence for PowerPC PE. There is a */ /* tocrel16-tocdefn reloc against the first instruction. */ /* We also need a IMGLUE reloc against the glue function */ /* to restore the toc saved by the third instruction in */ /* the glue. */ -unsigned char ppc_jtab[] = +static const unsigned char ppc_jtab[] = { 0x00, 0x00, 0x62, 0x81, /* lwz r11,0(r2) */ /* Reloc TOCREL16 __imp_xxx */ @@ -306,33 +322,35 @@ unsigned char ppc_jtab[] = 0x20, 0x04, 0x80, 0x4E /* bctr */ }; +#ifdef DLLTOOL_PPC /* the glue instruction, picks up the toc from the stw in */ /* the above code: "lwz r2,4(r1)" */ -bfd_vma ppc_glue_insn = 0x80410004; +static bfd_vma ppc_glue_insn = 0x80410004; +#endif +static char outfile[PATHMAX]; -char outfile[PATHMAX]; struct mac { - char *type; - char *how_byte; - char *how_short; - char *how_long; - char *how_asciz; - char *how_comment; - char *how_jump; - char *how_global; - char *how_space; - char *how_align_short; - char *how_align_long; - char *how_bfd_target; + const char *type; + const char *how_byte; + const char *how_short; + const char *how_long; + const char *how_asciz; + const char *how_comment; + const char *how_jump; + const char *how_global; + const char *how_space; + const char *how_align_short; + const char *how_align_long; + const char *how_bfd_target; enum bfd_architecture how_bfd_arch; - unsigned char *how_jtab; + const unsigned char *how_jtab; int how_jtab_size; /* size of the jtab entry */ int how_jtab_roff; /* offset into it for the ind 32 reloc into idata 5 */ - } -mtable[] -= + }; + +static const struct mac mtable[] = { { #define MARM 0 @@ -357,8 +375,56 @@ mtable[] { 0} }; +typedef struct dlist +{ + char *text; + struct dlist *next; +} +dlist_type; + +typedef struct export + { + const char *name; + const char *internal_name; + int ordinal; + int constant; + int noname; + int data; + int hint; + struct export *next; + } +export_type; -char * +static const char *rvaafter PARAMS ((int)); +static const char *rvabefore PARAMS ((int)); +static const char *asm_prefix PARAMS ((int)); +static void run PARAMS ((const char *, char *)); +static void basenames PARAMS ((bfd *)); +static void scan_open_obj_file PARAMS ((bfd *)); +static void scan_obj_file PARAMS ((const char *)); +static void dump_def_info PARAMS ((FILE *)); +static int sfunc PARAMS ((const void *, const void *)); +static void flush_page PARAMS ((FILE *, long *, int, int)); +static void gen_def_file PARAMS ((void)); +static void gen_exp_file PARAMS ((void)); +static const char *xlate PARAMS ((const char *)); +static void dump_iat PARAMS ((FILE *, export_type *)); +static char *make_label PARAMS ((const char *, const char *)); +static bfd *make_one_lib_file PARAMS ((export_type *, int)); +static bfd *make_head PARAMS ((void)); +static bfd *make_tail PARAMS ((void)); +static void gen_lib_file PARAMS ((void)); +static int pfunc PARAMS ((const void *, const void *)); +static int nfunc PARAMS ((const void *, const void *)); +static void remove_null_names PARAMS ((export_type **)); +static void dtab PARAMS ((export_type **)); +static void process_duplicates PARAMS ((export_type **)); +static void fill_ordinals PARAMS ((export_type **)); +static int alphafunc PARAMS ((const void *, const void *)); +static void mangle_defs PARAMS ((void)); +static void usage PARAMS ((FILE *, int)); + +static const char * rvaafter (machine) int machine; { @@ -371,10 +437,10 @@ rvaafter (machine) case MPPC: return ""; } -return ""; + return ""; } -char * +static const char * rvabefore (machine) int machine; { @@ -387,12 +453,12 @@ rvabefore (machine) case MPPC: return ".rva\t"; } -return ""; + return ""; } -char * +static const char * asm_prefix (machine) -int machine; + int machine; { switch (machine) { @@ -403,8 +469,9 @@ int machine; case MPPC: return ""; } -return ""; + return ""; } + #define ASM_BYTE mtable[machine].how_byte #define ASM_SHORT mtable[machine].how_short #define ASM_LONG mtable[machine].how_long @@ -425,12 +492,9 @@ return ""; #define HOW_JTAB_ROFF mtable[machine].how_jtab_roff static char **oav; - -FILE *yyin; /* communications with flex */ -extern int linenumber; void process_def_file (name) - char *name; + const char *name; { FILE *f = fopen (name, FOPEN_RT); if (!f) @@ -448,27 +512,7 @@ process_def_file (name) /* Communications with the parser */ - -typedef struct dlist -{ - char *text; - struct dlist *next; -} -dlist_type; - -typedef struct export - { - char *name; - char *internal_name; - int ordinal; - int constant; - int noname; - int hint; - struct export *next; - } -export_type; - -static char *d_name; /* Arg to NAME or LIBRARY */ +static const char *d_name; /* Arg to NAME or LIBRARY */ static int d_nfuncs; /* Number of functions exported */ static int d_named_nfuncs; /* Number of named functions exported */ static int d_low_ord; /* Lowest ordinal index */ @@ -482,7 +526,8 @@ static int d_is_dll; static int d_is_exe; int -yyerror () +yyerror (err) + const char *err; { fprintf (stderr, "%s: Syntax error in def file %s:%d\n", program_name, def_file, linenumber); @@ -490,12 +535,13 @@ yyerror () } void -def_exports (name, internal_name, ordinal, noname, constant) - char *name; - char *internal_name; +def_exports (name, internal_name, ordinal, noname, constant, data) + const char *name; + const char *internal_name; int ordinal; int noname; int constant; + int data; { struct export *p = (struct export *) xmalloc (sizeof (*p)); @@ -504,15 +550,15 @@ def_exports (name, internal_name, ordinal, noname, constant) p->ordinal = ordinal; p->constant = constant; p->noname = noname; + p->data = data; p->next = d_exports; d_exports = p; d_nfuncs++; } - void def_name (name, base) - char *name; + const char *name; int base; { if (verbose) @@ -527,7 +573,7 @@ def_name (name, base) void def_library (name, base) - char *name; + const char *name; int base; { if (verbose) @@ -542,10 +588,10 @@ def_library (name, base) void def_description (desc) - char *desc; + const char *desc; { dlist_type *d = (dlist_type *) xmalloc (sizeof (dlist_type)); - d->text = strdup (desc); + d->text = xstrdup (desc); d->next = d_list; d_list = d; } @@ -555,7 +601,7 @@ new_directive (dir) char *dir; { dlist_type *d = (dlist_type *) xmalloc (sizeof (dlist_type)); - d->text = strdup (dir); + d->text = xstrdup (dir); d->next = a_list; a_list = d; } @@ -570,7 +616,7 @@ def_stacksize (reserve, commit) sprintf (b, "-stack 0x%x,0x%x ", reserve, commit); else sprintf (b, "-stack 0x%x ", reserve); - new_directive (strdup (b)); + new_directive (xstrdup (b)); } void @@ -583,15 +629,14 @@ def_heapsize (reserve, commit) sprintf (b, "-heap 0x%x,0x%x ", reserve, commit); else sprintf (b, "-heap 0x%x ", reserve); - new_directive (strdup (b)); + new_directive (xstrdup (b)); } - void def_import (internal, module, entry) - char *internal; - char *module; - char *entry; + const char *internal; + const char *module; + const char *entry; { if (verbose) fprintf (stderr, "%s: IMPORTS are ignored", program_name); @@ -599,16 +644,15 @@ def_import (internal, module, entry) void def_version (major, minor) -int major; -int minor; + int major; + int minor; { printf ("VERSION %d.%d\n", major, minor); } - void def_section (name, attr) - char *name; + const char *name; int attr; { char buf[200]; @@ -625,8 +669,9 @@ def_section (name, attr) *d++ = 'S'; *d++ = 0; sprintf (buf, "-attr %s %s", name, atts); - new_directive (strdup (buf)); + new_directive (xstrdup (buf)); } + void def_code (attr) int attr; @@ -642,19 +687,20 @@ def_data (attr) def_section ("DATA", attr); } - /**********************************************************************/ -void +static void run (what, args) - char *what; + const char *what; char *args; { char *s; - int pid; + int pid, wait_status; int i; - char **argv; - extern char **environ; + const char **argv; + char *errmsg_fmt, *errmsg_arg; + char *temp_base = choose_temp_base (); + if (verbose) fprintf (stderr, "%s %s\n", what, args); @@ -677,44 +723,41 @@ run (what, args) break; *s++ = 0; } - argv[i++] = 0; + argv[i++] = NULL; + pid = pexecute (argv[0], (char * const *) argv, program_name, temp_base, + &errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH); - pid = vfork (); + if (pid == -1) + { + int errno_val = errno; - if (pid == 0) + fprintf (stderr, "%s: ", program_name); + fprintf (stderr, errmsg_fmt, errmsg_arg); + fprintf (stderr, ": %s\n", strerror (errno_val)); + exit (1); + } + + pid = pwait (pid, &wait_status, 0); + if (pid == -1) { - execvp (what, argv); - fprintf (stderr, "%s: can't exec %s\n", program_name, what); + fprintf (stderr, "%s: wait: %s\n", program_name, strerror (errno)); exit (1); } - else if (pid == -1) + else if (WIFSIGNALED (wait_status)) { - extern int errno; - fprintf (stderr, "%s: vfork failed, %d\n", program_name, errno); + fprintf (stderr, "%s: subprocess got fatal signal %d\n", + program_name, WTERMSIG (wait_status)); exit (1); } - else + else if (WIFEXITED (wait_status)) { - int status; - waitpid (pid, &status, 0); - if (status) - { - if (WIFSIGNALED (status)) - { - fprintf (stderr, "%s: %s %s terminated with signal %d\n", - program_name, what, args, WTERMSIG (status)); - exit (1); - } - - if (WIFEXITED (status)) - { - fprintf (stderr, "%s: %s %s terminated with exit status %d\n", - program_name, what, args, WEXITSTATUS (status)); - exit (1); - } - } + if (WEXITSTATUS (wait_status) != 0) + fprintf (stderr, "%s: %s exited with status %d\n", + program_name, what, WEXITSTATUS (wait_status)); } + else + abort (); } /* read in and block out the base relocations */ @@ -722,13 +765,9 @@ static void basenames (abfd) bfd *abfd; { - - - - } -void +static void scan_open_obj_file (abfd) bfd *abfd; { @@ -766,7 +805,7 @@ scan_open_obj_file (abfd) /* FIXME: The 5th arg is for the `constant' field. What should it be? Not that it matters since it's not currently useful. */ - def_exports (c, 0, -1, 0, 0); + def_exports (c, 0, -1, 0, 0, 0); } else p++; @@ -781,10 +820,9 @@ scan_open_obj_file (abfd) program_name); } - -void +static void scan_obj_file (filename) - char *filename; + const char *filename; { bfd *f = bfd_openr (filename, 0); @@ -816,9 +854,7 @@ scan_obj_file (filename) /**********************************************************************/ - - -void +static void dump_def_info (f) FILE *f; { @@ -830,32 +866,32 @@ dump_def_info (f) fprintf (f, "\n"); for (i = 0, exp = d_exports; exp; i++, exp = exp->next) { - fprintf (f, "%s %d = %s %s @ %d %s%s\n", + fprintf (f, "%s %d = %s %s @ %d %s%s%s\n", ASM_C, i, exp->name, exp->internal_name, exp->ordinal, exp->noname ? "NONAME " : "", - exp->constant ? "CONSTANT" : ""); + exp->constant ? "CONSTANT" : "", + exp->data ? "DATA" : ""); } } + /* Generate the .exp file */ -int +static int sfunc (a, b) - long *a; - long *b; + const void *a; + const void *b; { - return *a - *b; + return *(const long *) a - *(const long *) b; } - - static void flush_page (f, need, page_addr, on_page) FILE *f; - int *need; + long *need; int page_addr; int on_page; { @@ -872,16 +908,14 @@ flush_page (f, need, page_addr, on_page) ASM_C); for (i = 0; i < on_page; i++) { - fprintf (f, "\t%s\t0x%x\n", ASM_SHORT, (need[i] - page_addr) | 0x3000); + fprintf (f, "\t%s\t0x%lx\n", ASM_SHORT, (need[i] - page_addr) | 0x3000); } /* And padding */ if (on_page & 1) fprintf (f, "\t%s\t0x%x\n", ASM_SHORT, 0 | 0x0000); - } - -void +static void gen_def_file () { int i; @@ -896,16 +930,18 @@ gen_def_file () for (i = 0, exp = d_exports; exp; i++, exp = exp->next) { char *quote = strchr (exp->name, '.') ? "\"" : ""; - fprintf (output_def, "\t%s%s%s @ %d%s ; %s\n", + fprintf (output_def, "\t%s%s%s @ %d%s%s ; %s\n", quote, exp->name, quote, exp->ordinal, exp->noname ? " NONAME" : "", + exp->data ? " DATA" : "", cplus_demangle (exp->internal_name, DMGL_ANSI | DMGL_PARAMS)); } } -void + +static void gen_exp_file () { FILE *f; @@ -937,7 +973,8 @@ gen_exp_file () { fprintf (f, "\t.section .edata\n\n"); fprintf (f, "\t%s 0 %s Allways 0\n", ASM_LONG, ASM_C); - fprintf (f, "\t%s 0x%x %s Time and date\n", ASM_LONG, time(0),ASM_C); + fprintf (f, "\t%s 0x%lx %s Time and date\n", ASM_LONG, (long) time(0), + ASM_C); fprintf (f, "\t%s 0 %s Major and Minor version\n", ASM_LONG, ASM_C); fprintf (f, "\t%sname%s %s Ptr to name of dll\n", ASM_RVA_BEFORE, ASM_RVA_AFTER, ASM_C); fprintf (f, "\t%s %d %s Starting ordinal of exports\n", ASM_LONG, d_low_ord, ASM_C); @@ -1060,8 +1097,13 @@ gen_exp_file () for (i = 0, exp = d_exports; exp; i++, exp = exp->next) if (!exp->noname || show_allnames) { + /* We use a single underscore for MS compatibility, and a + double underscore for backward compatibility with old + cygwin releases. */ fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name); + fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name); fprintf (f, "__imp_%s:\n", exp->name); + fprintf (f, "_imp__%s:\n", exp->name); fprintf (f, "\t%s\t%s\n", ASM_LONG, exp->name); } } @@ -1091,7 +1133,6 @@ gen_exp_file () fprintf (f, "\t.section\t.reloc\n"); if (num_entries) { - int src; int dst = 0; int last = -1; @@ -1135,8 +1176,9 @@ gen_exp_file () } } -static char * -xlate (char *name) +static const char * +xlate (name) + const char *name; { if (add_underscore) { @@ -1158,9 +1200,10 @@ xlate (char *name) /**********************************************************************/ -static void dump_iat (f, exp) -FILE *f; -export_type *exp; +static void +dump_iat (f, exp) + FILE *f; + export_type *exp; { if (exp->noname && !show_allnames ) { @@ -1176,8 +1219,6 @@ export_type *exp; } } - - typedef struct { int id; @@ -1191,7 +1232,6 @@ typedef struct unsigned char *data; } sinfo; - #ifndef DLLTOOL_PPC #define TEXT 0 @@ -1201,12 +1241,9 @@ typedef struct #define IDATA5 4 #define IDATA4 5 #define IDATA6 6 -#define PDATA 7 -#define RDATA 8 #define NSECS 7 - static sinfo secdata[NSECS] = { { TEXT, ".text", SEC_CODE | SEC_HAS_CONTENTS, 2}, @@ -1250,7 +1287,8 @@ static sinfo secdata[NSECS] = #endif /* -This is what we're trying to make +This is what we're trying to make. We generate the imp symbols with +both single and double underscores, for compatibility. .text .global _GetFileVersionInfoSizeW@8 @@ -1314,6 +1352,7 @@ make_one_lib_file (exp, i) fprintf (f, "\t.text\n"); fprintf (f, "\t%s\t%s%s\n", ASM_GLOBAL, ASM_PREFIX, exp->name); fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name); + fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name); fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX, exp->name, ASM_JUMP, exp->name); @@ -1325,6 +1364,7 @@ make_one_lib_file (exp, i) fprintf (f, "\t.section .idata$5\n"); fprintf (f, "__imp_%s:\n", exp->name); + fprintf (f, "_imp__%s:\n", exp->name); dump_iat (f, exp); @@ -1355,7 +1395,7 @@ make_one_lib_file (exp, i) bfd *abfd; asymbol *exp_label; - asymbol *iname; + asymbol *iname, *iname2; asymbol *iname_lab; asymbol **iname_lab_pp; asymbol **iname_pp; @@ -1367,13 +1407,12 @@ make_one_lib_file (exp, i) #define EXTRA 0 #endif - asymbol *function_name; /* ".." functionName */ +#ifdef DLLTOOL_PPC asymbol **fn_pp; - asymbol *toc_symbol; /* The .toc symbol */ asymbol **toc_pp; +#endif - /* one symbol for each section, 2 extra + a null */ - asymbol *ptrs[NSECS+3+EXTRA+1]; + asymbol *ptrs[NSECS + 4 + EXTRA + 1]; char *outname = xmalloc (10); int oidx = 0; @@ -1410,33 +1449,48 @@ make_one_lib_file (exp, i) si->sym->value = 0; ptrs[oidx] = si->sym; si->sympp = ptrs + oidx; + si->size = 0; + si->data = NULL; oidx++; } - exp_label = bfd_make_empty_symbol(abfd); - exp_label->name = make_label ("",exp->name); + if (! exp->data) + { + exp_label = bfd_make_empty_symbol (abfd); + exp_label->name = make_label ("", exp->name); - /* On PowerPC, the function name points to a descriptor in the - rdata section, the first element of which is a pointer to the - code (..function_name), and the second points to the .toc - */ - if (machine == MPPC) - exp_label->section = secdata[RDATA].sec; - else - exp_label->section = secdata[TEXT].sec; + /* On PowerPC, the function name points to a descriptor in + the rdata section, the first element of which is a + pointer to the code (..function_name), and the second + points to the .toc */ +#ifdef DLLTOOL_PPC + if (machine == MPPC) + exp_label->section = secdata[RDATA].sec; + else +#endif + exp_label->section = secdata[TEXT].sec; - exp_label->flags = BSF_GLOBAL; - exp_label->value = 0; + exp_label->flags = BSF_GLOBAL; + exp_label->value = 0; - ptrs[oidx++] = exp_label; + ptrs[oidx++] = exp_label; + } + /* Generate imp symbols with one underscore for Microsoft + compatibility, and with two underscores for backward + compatibility with old versions of cygwin. */ iname = bfd_make_empty_symbol(abfd); iname->name = make_label ("__imp_", exp->name); iname->section = secdata[IDATA5].sec; iname->flags = BSF_GLOBAL; iname->value = 0; + iname2 = bfd_make_empty_symbol(abfd); + iname2->name = make_label ("_imp__", exp->name); + iname2->section = secdata[IDATA5].sec; + iname2->flags = BSF_GLOBAL; + iname2->value = 0; iname_lab = bfd_make_empty_symbol(abfd); @@ -1448,30 +1502,39 @@ make_one_lib_file (exp, i) iname_pp = ptrs + oidx; ptrs[oidx++] = iname; + ptrs[oidx++] = iname2; iname_lab_pp = ptrs + oidx; ptrs[oidx++] = iname_lab; #ifdef DLLTOOL_PPC /* The symbol refering to the code (.text) */ - function_name = bfd_make_empty_symbol(abfd); - function_name->name = make_label ("..", exp->name); - function_name->section = secdata[TEXT].sec; - function_name->flags = BSF_GLOBAL; - function_name->value = 0; + { + asymbol *function_name; - fn_pp = ptrs + oidx; - ptrs[oidx++] = function_name; + function_name = bfd_make_empty_symbol(abfd); + function_name->name = make_label ("..", exp->name); + function_name->section = secdata[TEXT].sec; + function_name->flags = BSF_GLOBAL; + function_name->value = 0; + + fn_pp = ptrs + oidx; + ptrs[oidx++] = function_name; + } /* The .toc symbol */ - toc_symbol = bfd_make_empty_symbol(abfd); - toc_symbol->name = make_label (".", "toc"); - toc_symbol->section = (asection *)&bfd_und_section; - toc_symbol->flags = BSF_GLOBAL; - toc_symbol->value = 0; - - toc_pp = ptrs + oidx; - ptrs[oidx++] = toc_symbol; + { + asymbol *toc_symbol; /* The .toc symbol */ + + toc_symbol = bfd_make_empty_symbol(abfd); + toc_symbol->name = make_label (".", "toc"); + toc_symbol->section = (asection *)&bfd_und_section; + toc_symbol->flags = BSF_GLOBAL; + toc_symbol->value = 0; + + toc_pp = ptrs + oidx; + ptrs[oidx++] = toc_symbol; + } #endif ptrs[oidx] = 0; @@ -1486,31 +1549,34 @@ make_one_lib_file (exp, i) switch (i) { case TEXT: - si->size = HOW_JTAB_SIZE; - si->data = xmalloc (HOW_JTAB_SIZE); - memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE); + if (! exp->data) + { + si->size = HOW_JTAB_SIZE; + si->data = xmalloc (HOW_JTAB_SIZE); + memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE); - /* add the reloc into idata$5 */ - rel = xmalloc (sizeof (arelent)); - rpp = xmalloc (sizeof (arelent *) * 2); - rpp[0] = rel; - rpp[1] = 0; - rel->address = HOW_JTAB_ROFF; - rel->addend = 0; + /* add the reloqc into idata$5 */ + rel = xmalloc (sizeof (arelent)); + rpp = xmalloc (sizeof (arelent *) * 2); + rpp[0] = rel; + rpp[1] = 0; + rel->address = HOW_JTAB_ROFF; + rel->addend = 0; - if (machine == MPPC) - { - rel->howto = bfd_reloc_type_lookup (abfd, - BFD_RELOC_16_GOTOFF); - rel->sym_ptr_ptr = iname_pp; - } - else - { - rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - rel->sym_ptr_ptr = secdata[IDATA5].sympp; + if (machine == MPPC) + { + rel->howto = bfd_reloc_type_lookup (abfd, + BFD_RELOC_16_GOTOFF); + rel->sym_ptr_ptr = iname_pp; + } + else + { + rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + rel->sym_ptr_ptr = secdata[IDATA5].sympp; + } + sec->orelocation = rpp; + sec->reloc_count = 1; } - sec->orelocation = rpp; - sec->reloc_count = 1; break; case IDATA4: case IDATA5: @@ -1547,7 +1613,10 @@ make_one_lib_file (exp, i) case IDATA6: if (!exp->noname) { - int idx = exp->hint + 1; + /* This used to add 1 to exp->hint. I don't know + why it did that, and it does not match what I see + in programs compiled with the MS tools. */ + int idx = exp->hint; si->size = strlen (xlate (exp->name)) + 3; si->data = xmalloc (si->size); si->data[0] = idx & 0xff; @@ -1570,6 +1639,7 @@ make_one_lib_file (exp, i) sec->reloc_count = 1; break; +#ifdef DLLTOOL_PPC case PDATA: { /* The .pdata section is 5 words long. */ @@ -1655,7 +1725,7 @@ make_one_lib_file (exp, i) */ si->size = 8; - si->data =xmalloc(8); + si->data = xmalloc (8); memset (si->data, 0, si->size); rpp = xmalloc (sizeof (arelent *) * 3); @@ -1678,6 +1748,7 @@ make_one_lib_file (exp, i) sec->orelocation = rpp; sec->reloc_count = 2; break; +#endif /* DLLTOOL_PPC */ } } @@ -1718,9 +1789,8 @@ make_one_lib_file (exp, i) } - static bfd * -make_head() +make_head () { FILE * f = fopen ("dh.s", FOPEN_WT); @@ -1772,7 +1842,7 @@ make_head() } static bfd * -make_tail() +make_tail () { FILE * f = fopen ("dt.s", FOPEN_WT); @@ -1866,8 +1936,17 @@ gen_lib_file () ar_tail->next = ar_head; head = ar_tail; - bfd_set_archive_head (outarch, head); - bfd_close (outarch); + if (! bfd_set_archive_head (outarch, head)) + bfd_fatal ("bfd_set_archive_head"); + if (! bfd_close (outarch)) + bfd_fatal (imp_name); + + while (head != NULL) + { + bfd *n = head->next; + bfd_close (head); + head = n; + } /* Delete all the temp files */ @@ -1884,21 +1963,25 @@ gen_lib_file () } if (dontdeltemps < 2) - for (i = 0, exp = d_exports; exp; i++, exp = exp->next) - { - sprintf (outfile, "ds%d.o",i); - unlink (outfile); - } - + { + for (i = 0, exp = d_exports; exp; i++, exp = exp->next) + { + sprintf (outfile, "ds%d.o",i); + if (unlink (outfile) < 0) + fprintf (stderr, "%s: cannot delete %s: %s\n", program_name, + outfile, strerror (errno)); + } + } } + /**********************************************************************/ /* Run through the information gathered from the .o files and the .def file and work out the best stuff */ -int +static int pfunc (a, b) - void *a; - void *b; + const void *a; + const void *b; { export_type *ap = *(export_type **) a; export_type *bp = *(export_type **) b; @@ -1913,11 +1996,10 @@ pfunc (a, b) return (ap->ordinal - bp->ordinal); } - -int +static int nfunc (a, b) - void *a; - void *b; + const void *a; + const void *b; { export_type *ap = *(export_type **) a; export_type *bp = *(export_type **) b; @@ -1925,8 +2007,7 @@ nfunc (a, b) return (strcmp (ap->name, bp->name)); } -static -void +static void remove_null_names (ptr) export_type **ptr; { @@ -1953,10 +2034,11 @@ dtab (ptr) { if (ptr[i]) { - printf ("%d %s @ %d %s%s\n", + printf ("%d %s @ %d %s%s%s\n", i, ptr[i]->name, ptr[i]->ordinal, ptr[i]->noname ? "NONAME " : "", - ptr[i]->constant ? "CONSTANT" : ""); + ptr[i]->constant ? "CONSTANT" : "", + ptr[i]->data ? "DATA" : ""); } else printf ("empty\n"); @@ -2005,6 +2087,7 @@ process_duplicates (d_export_vec) b->ordinal = a->ordinal > 0 ? a->ordinal : b->ordinal; b->constant |= a->constant; b->noname |= a->noname; + b->data |= a->data; d_export_vec[i] = 0; } @@ -2101,17 +2184,18 @@ fill_ordinals (d_export_vec) } } -int alphafunc(av,bv) -void *av; -void *bv; +static int +alphafunc (av,bv) + const void *av; + const void *bv; { - export_type **a = av; - export_type **b = bv; + const export_type **a = (const export_type **) av; + const export_type **b = (const export_type **) bv; return strcmp ((*a)->name, (*b)->name); } -void +static void mangle_defs () { /* First work out the minimum ordinal chosen */ @@ -2160,14 +2244,9 @@ mangle_defs () } - - - - - /**********************************************************************/ -void +static void usage (file, status) FILE *file; int status; @@ -2193,7 +2272,7 @@ usage (file, status) #define OPTION_NO_IDATA4 'x' #define OPTION_NO_IDATA5 'c' -static struct option long_options[] = +static const struct option long_options[] = { {"nodelete", no_argument, NULL, 'n'}, {"dllname", required_argument, NULL, 'D'}, @@ -2213,8 +2292,6 @@ static struct option long_options[] = {0} }; - - int main (ac, av) int ac; @@ -2270,7 +2347,11 @@ main (ac, av) verbose = 1; break; case 'y': +#if 0 + /* We don't currently define YYDEBUG when building + defparse.y. */ yydebug = 1; +#endif break; case 'U': add_underscore = 1; @@ -2342,8 +2423,9 @@ main (ac, av) { /* Make imp_name safe for use as a label. */ char *p; - imp_name_lab = strdup (imp_name); - for (p = imp_name_lab; *p; *p++) + + imp_name_lab = xstrdup (imp_name); + for (p = imp_name_lab; *p; p++) { if (!isalpha (*p) && !isdigit (*p)) *p = '_'; diff --git a/gnu/dist/binutils/dlltool.h b/gnu/dist/binutils/dlltool.h new file mode 100644 index 00000000000..d9c7abe8c37 --- /dev/null +++ b/gnu/dist/binutils/dlltool.h @@ -0,0 +1,41 @@ +/* dlltool.h -- header file for dlltool + Copyright (C) 1997 Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include "ansidecl.h" +#include <stdio.h> + +extern void def_code PARAMS ((int)); +extern void def_data PARAMS ((int)); +extern void def_description PARAMS ((const char *)); +extern void def_exports + PARAMS ((const char *, const char *, int, int, int, int)); +extern void def_heapsize PARAMS ((int, int)); +extern void def_import PARAMS ((const char *, const char *, const char *)); +extern void def_library PARAMS ((const char *, int)); +extern void def_name PARAMS ((const char *, int)); +extern void def_section PARAMS ((const char *, int)); +extern void def_stacksize PARAMS ((int, int)); +extern void def_version PARAMS ((int, int)); +extern int yyparse PARAMS ((void)); +extern int yyerror PARAMS ((const char *)); +extern int yydebug; +extern int yylex PARAMS ((void)); +extern FILE *yyin; +extern int linenumber; diff --git a/gnu/dist/binutils/nlmconv.c b/gnu/dist/binutils/nlmconv.c index df993f85424..489f6978243 100644 --- a/gnu/dist/binutils/nlmconv.c +++ b/gnu/dist/binutils/nlmconv.c @@ -1,5 +1,5 @@ /* nlmconv.c -- NLM conversion program - Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -43,10 +43,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <assert.h> #include <getopt.h> -#ifdef HAVE_VFORK_H -#include <vfork.h> -#endif - /* Internal BFD NLM header. */ #include "libnlm.h" #include "nlmconv.h" @@ -138,7 +134,6 @@ static void default_mangle_relocs PARAMS ((bfd *, asection *, arelent ***, long *, char *, bfd_size_type)); static char *link_inputs PARAMS ((struct string_list *, char *)); -static int pexecute PARAMS ((char *, char *[])); #ifdef NLMCONV_I386 static void i386_mangle_relocs PARAMS ((bfd *, asection *, arelent ***, @@ -191,12 +186,25 @@ main (argc, argv) char inlead, outlead; boolean gotstart, gotexit, gotcheck; struct stat st; - FILE *custom_data, *help_data, *message_data, *rpc_data, *shared_data; - size_t custom_size, help_size, message_size, module_size, rpc_size; - asection *custom_section, *help_section, *message_section, *module_section; - asection *rpc_section, *shared_section; + FILE *custom_data = NULL; + FILE *help_data = NULL; + FILE *message_data = NULL; + FILE *rpc_data = NULL; + FILE *shared_data = NULL; + size_t custom_size = 0; + size_t help_size = 0; + size_t message_size = 0; + size_t module_size = 0; + size_t rpc_size = 0; + asection *custom_section = NULL; + asection *help_section = NULL; + asection *message_section = NULL; + asection *module_section = NULL; + asection *rpc_section = NULL; + asection *shared_section = NULL; bfd *sharedbfd; - size_t shared_offset, shared_size; + size_t shared_offset = 0; + size_t shared_size = 0; Nlm_Internal_Fixed_Header sharedhdr; int len; char *modname; @@ -839,15 +847,15 @@ main (argc, argv) program_name, sharelib_file); } shared_offset = st.st_size; - if (shared_offset > sharedhdr.codeImageOffset) + if (shared_offset > (size_t) sharedhdr.codeImageOffset) shared_offset = sharedhdr.codeImageOffset; - if (shared_offset > sharedhdr.dataImageOffset) + if (shared_offset > (size_t) sharedhdr.dataImageOffset) shared_offset = sharedhdr.dataImageOffset; - if (shared_offset > sharedhdr.relocationFixupOffset) + if (shared_offset > (size_t) sharedhdr.relocationFixupOffset) shared_offset = sharedhdr.relocationFixupOffset; - if (shared_offset > sharedhdr.externalReferencesOffset) + if (shared_offset > (size_t) sharedhdr.externalReferencesOffset) shared_offset = sharedhdr.externalReferencesOffset; - if (shared_offset > sharedhdr.publicsOffset) + if (shared_offset > (size_t) sharedhdr.publicsOffset) shared_offset = sharedhdr.publicsOffset; shared_size = st.st_size - shared_offset; shared_section = bfd_make_section (outbfd, ".nlmshared"); @@ -1079,7 +1087,7 @@ main (argc, argv) for (modname = nlm_fixed_header (outbfd)->moduleName; *modname != '\0'; modname++) - if (islower (*modname)) + if (islower ((unsigned char) *modname)) *modname = toupper (*modname); strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG", @@ -1124,7 +1132,7 @@ Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n\ [in-file [out-file]]\n", program_name); if (status == 0) - fprintf (file, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); + fprintf (file, "Report bugs to bug-gnu-utils@gnu.org\n"); exit (status); } @@ -1668,7 +1676,7 @@ alpha_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr, contents, { register bfd_size_type i; - for (i = 0; i < old_reloc_count; i++, relocs++) + for (i = 0; i < (bfd_size_type) old_reloc_count; i++, relocs++) (*relocs)->address += insec->output_offset; } } @@ -2116,6 +2124,8 @@ link_inputs (inputs, ld) size_t i; int pid; int status; + char *errfmt; + char *errarg; c = 0; for (q = inputs; q != NULL; q = q->next) @@ -2168,127 +2178,29 @@ link_inputs (inputs, ld) fprintf (stderr, "\n"); } - pid = pexecute (ld, argv); - - if (waitpid (pid, &status, 0) < 0) + pid = pexecute (ld, argv, program_name, (char *) NULL, &errfmt, &errarg, + PEXECUTE_SEARCH | PEXECUTE_ONE); + if (pid == -1) { - perror ("waitpid"); + fprintf (stderr, "%s: execution of %s failed: ", program_name, ld); + fprintf (stderr, errfmt, errarg); unlink (unlink_on_exit); exit (1); } - if (status != 0) + if (pwait (pid, &status, 0) < 0) { - fprintf (stderr, "%s: Execution of %s failed\n", program_name, ld); + perror ("pwait"); unlink (unlink_on_exit); exit (1); } - return unlink_on_exit; -} - -/* Execute a job. Stolen from gcc.c. */ - -#ifndef OS2 -#ifdef __MSDOS__ - -static int -pexecute (program, argv) - char *program; - char *argv[]; -{ - char *scmd, *rf; - FILE *argfile; - int i; - - scmd = (char *) xmalloc (strlen (program) + strlen (temp_filename) + 10); - rf = scmd + strlen(program) + 2 + el; - sprintf (scmd, "%s.exe @%s.gp", program, temp_filename); - argfile = fopen (rf, "w"); - if (argfile == 0) - pfatal_with_name (rf); - - for (i=1; argv[i]; i++) - { - char *cp; - for (cp = argv[i]; *cp; cp++) - { - if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp)) - fputc ('\\', argfile); - fputc (*cp, argfile); - } - fputc ('\n', argfile); - } - fclose (argfile); - - i = system (scmd); - - remove (rf); - - if (i == -1) - { - perror (program); - return MIN_FATAL_STATUS << 8; - } - - return i << 8; -} - -#else /* not __MSDOS__ */ - -static int -pexecute (program, argv) - char *program; - char *argv[]; -{ - int pid; - int retries, sleep_interval; - - /* Fork a subprocess; wait and retry if it fails. */ - sleep_interval = 1; - for (retries = 0; retries < 4; retries++) - { - pid = vfork (); - if (pid >= 0) - break; - sleep (sleep_interval); - sleep_interval *= 2; - } - - switch (pid) + if (status != 0) { - case -1: -#ifdef vfork - perror ("fork"); -#else - perror ("vfork"); -#endif - exit (1); - /* NOTREACHED */ - return 0; - - case 0: /* child */ - /* Exec the program. */ - execvp (program, argv); - perror (program); + fprintf (stderr, "%s: Execution of %s failed\n", program_name, ld); + unlink (unlink_on_exit); exit (1); - /* NOTREACHED */ - return 0; - - default: - /* Return child's process number. */ - return pid; } -} - -#endif /* not __MSDOS__ */ -#else /* not OS2 */ -static int -pexecute (program, argv) - char *program; - char *argv[]; -{ - return spawnvp (1, program, argv); + return unlink_on_exit; } -#endif /* not OS2 */ diff --git a/gnu/dist/binutils/nlmheader.h b/gnu/dist/binutils/nlmheader.h new file mode 100644 index 00000000000..6ad3e189e26 --- /dev/null +++ b/gnu/dist/binutils/nlmheader.h @@ -0,0 +1,43 @@ +typedef union +{ + char *string; + struct string_list *list; +} YYSTYPE; +#define CHECK 258 +#define CODESTART 259 +#define COPYRIGHT 260 +#define CUSTOM 261 +#define DATE 262 +#define DEBUG 263 +#define DESCRIPTION 264 +#define EXIT 265 +#define EXPORT 266 +#define FLAG_ON 267 +#define FLAG_OFF 268 +#define FULLMAP 269 +#define HELP 270 +#define IMPORT 271 +#define INPUT 272 +#define MAP 273 +#define MESSAGES 274 +#define MODULE 275 +#define MULTIPLE 276 +#define OS_DOMAIN 277 +#define OUTPUT 278 +#define PSEUDOPREEMPTION 279 +#define REENTRANT 280 +#define SCREENNAME 281 +#define SHARELIB 282 +#define STACK 283 +#define START 284 +#define SYNCHRONIZE 285 +#define THREADNAME 286 +#define TYPE 287 +#define VERBOSE 288 +#define VERSIONK 289 +#define XDCDATA 290 +#define STRING 291 +#define QUOTED_STRING 292 + + +extern YYSTYPE yylval; diff --git a/gnu/dist/binutils/nlmheader.y b/gnu/dist/binutils/nlmheader.y index 4a92dbfdc5a..8e43733369f 100644 --- a/gnu/dist/binutils/nlmheader.y +++ b/gnu/dist/binutils/nlmheader.y @@ -1,5 +1,5 @@ %{/* nlmheader.y - parse NLM header specification keywords. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 97, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -121,7 +121,7 @@ static char *xstrdup PARAMS ((const char *)); %token EXPORT FLAG_ON FLAG_OFF FULLMAP HELP IMPORT INPUT MAP MESSAGES %token MODULE MULTIPLE OS_DOMAIN OUTPUT PSEUDOPREEMPTION REENTRANT %token SCREENNAME SHARELIB STACK START SYNCHRONIZE -%token THREADNAME TYPE VERBOSE VERSION XDCDATA +%token THREADNAME TYPE VERBOSE VERSIONK XDCDATA /* Arguments. */ @@ -367,7 +367,7 @@ command: { verbose = true; } - | VERSION STRING STRING STRING + | VERSIONK STRING STRING STRING { long val; @@ -391,7 +391,7 @@ command: free ($3); free ($4); } - | VERSION STRING STRING + | VERSIONK STRING STRING { long val; @@ -623,7 +623,7 @@ struct keyword_tokens_struct keyword_tokens[] = { "THREADNAME", THREADNAME }, { "TYPE", TYPE }, { "VERBOSE", VERBOSE }, - { "VERSION", VERSION }, + { "VERSION", VERSIONK }, { "XDCDATA", XDCDATA } }; @@ -773,7 +773,7 @@ tail_recurse: } else { - int i; + unsigned int i; for (i = 0; i < KEYWORD_COUNT; i++) { diff --git a/gnu/dist/binutils/nm.c b/gnu/dist/binutils/nm.c index 1f5d1c756b2..27ae40084bd 100644 --- a/gnu/dist/binutils/nm.c +++ b/gnu/dist/binutils/nm.c @@ -1,5 +1,5 @@ /* nm.c -- Describe symbol table of a rel file. - Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -247,9 +247,11 @@ static int print_radix = 16; static char other_format[] = "%02x"; static char desc_format[] = "%04x"; -/* IMPORT */ -extern char *program_name; -extern char *target; +static char *target = NULL; + +/* Used to cache the line numbers for a BFD. */ +static bfd *lineno_cache_bfd; +static bfd *lineno_cache_rel_bfd; static struct option long_options[] = { @@ -297,7 +299,7 @@ Usage: %s [-aABCDglnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]\n\ program_name); list_supported_targets (program_name, stream); if (status == 0) - fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); + fprintf (stream, "Report bugs to bug-gnu-utils@gnu.org\n"); exit (status); } @@ -530,12 +532,20 @@ display_archive (file) } if (last_arfile != NULL) - bfd_close (last_arfile); + { + bfd_close (last_arfile); + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; + } last_arfile = arfile; } if (last_arfile != NULL) - bfd_close (last_arfile); + { + bfd_close (last_arfile); + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; + } } static boolean @@ -576,6 +586,9 @@ display_file (filename) if (bfd_close (file) == false) bfd_fatal (filename); + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; + return retval; } @@ -779,7 +792,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp) { struct size_sym *symsizes; bfd_byte *from, *fromend; - asymbol *sym; + asymbol *sym = NULL; asymbol *store_sym, *store_next; qsort (minisyms, symcount, size, size_forward1); @@ -1124,7 +1137,6 @@ print_symbol (abfd, sym, archive_bfd) if (line_numbers) { - static bfd *cache_bfd; static asymbol **syms; static long symcount; const char *filename, *functionname; @@ -1133,7 +1145,7 @@ print_symbol (abfd, sym, archive_bfd) /* We need to get the canonical symbols in order to call bfd_find_nearest_line. This is inefficient, but, then, you don't have to use --line-numbers. */ - if (abfd != cache_bfd && syms != NULL) + if (abfd != lineno_cache_bfd && syms != NULL) { free (syms); syms = NULL; @@ -1149,24 +1161,22 @@ print_symbol (abfd, sym, archive_bfd) symcount = bfd_canonicalize_symtab (abfd, syms); if (symcount < 0) bfd_fatal (bfd_get_filename (abfd)); - cache_bfd = abfd; + lineno_cache_bfd = abfd; } if (bfd_is_und_section (bfd_get_section (sym))) { - static bfd *cache_rel_bfd; static asection **secs; static arelent ***relocs; static long *relcount; - unsigned int seccount, i; + static unsigned int seccount; + unsigned int i; const char *symname; /* For an undefined symbol, we try to find a reloc for the symbol, and print the line number of the reloc. */ - seccount = bfd_count_sections (abfd); - - if (abfd != cache_rel_bfd && relocs != NULL) + if (abfd != lineno_cache_rel_bfd && relocs != NULL) { for (i = 0; i < seccount; i++) if (relocs[i] != NULL) @@ -1183,6 +1193,8 @@ print_symbol (abfd, sym, archive_bfd) { struct get_relocs_info info; + seccount = bfd_count_sections (abfd); + secs = (asection **) xmalloc (seccount * sizeof *secs); relocs = (arelent ***) xmalloc (seccount * sizeof *relocs); relcount = (long *) xmalloc (seccount * sizeof *relcount); @@ -1192,13 +1204,13 @@ print_symbol (abfd, sym, archive_bfd) info.relcount = relcount; info.syms = syms; bfd_map_over_sections (abfd, get_relocs, (PTR) &info); - cache_rel_bfd = abfd; + lineno_cache_rel_bfd = abfd; } symname = bfd_asymbol_name (sym); for (i = 0; i < seccount; i++) { - unsigned int j; + long j; for (j = 0; j < relcount[i]; j++) { diff --git a/gnu/dist/binutils/objcopy.1 b/gnu/dist/binutils/objcopy.1 index d3b8bb37256..6c98df8d32a 100644 --- a/gnu/dist/binutils/objcopy.1 +++ b/gnu/dist/binutils/objcopy.1 @@ -24,6 +24,8 @@ objcopy \- copy and translate object files .RB "[\|" \-\-strip\-unneeded\fR "\|]" .RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]" .RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]" +.RB "[\|" \-L\ \fIsymbolname\fR\ |\ \fB\-\-localize\-symbol=\fIsymbolname\fR "\|]" +.RB "[\|" \-W\ \fIsymbolname\fR\ |\ \fB\-\-weaken\-symbol=\fIsymbolname\fR "\|]" .RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all\fR "\|]" .RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals\fR "\|]" .RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]" @@ -139,8 +141,14 @@ may be given more than once. .TP .B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname Do not copy symbol \fIsymbolname\fP from the source file. This option -may be given more than once, and may be combined with strip options -other than \fB\-K\fR. +may be given more than once. +.TP +.B \-L \fIsymbolname\fR, \fB\-\-localize\-symbol=\fIsymbolname +Make symbol \fIsymbolname\fP local to the file, so that it is not +visible externally. This option may be given more than once. +.TP +.B \-W \fIsymbolname\fR, \fB\-\-weaken\-symbol=\fIsymbolname +Make symbol \fIsymbolname\fP weak. This option may be given more than once. .TP .B \-x\fR, \fB \-\-discard\-all Do not copy non-global symbols from the source file. @@ -170,12 +178,13 @@ because only certain debugging formats are supported, and the conversion process can be time consuming. .TP .B \-\-gap\-fill=\fIval -Fill gaps between sections with \fIval\fP. This is done by increasing +Fill gaps between sections with \fIval\fP. This operation applies to +the \fIload address\fP (LMA) of the sections. It is done by increasing the size of the section with the lower address, and filling in the extra space created with \fIval\fP. .TP .B \-\-pad\-to=\fIaddress -Pad the output file up to the virtual address \fIaddress\fP. This is +Pad the output file up to the load address \fIaddress\fP. This is done by increasing the size of the last section. The extra space is filled in with the value specified by \fB\-\-gap\-fill\fP (default zero). diff --git a/gnu/dist/binutils/objdump.1 b/gnu/dist/binutils/objdump.1 index 6c155310bd6..69217b9d410 100644 --- a/gnu/dist/binutils/objdump.1 +++ b/gnu/dist/binutils/objdump.1 @@ -254,7 +254,7 @@ Only useful with \fB\-d\fP, \fB\-D\fP, or \fB\-r\fP. .TP .BI "\-\-architecture=" "machine" Specify the architecture to use when disassembling object files. This -can be useful when disasembling object files which do not describe +can be useful when disassembling object files which do not describe architecture information, such as S-records. You can list the available architectures with the \fB\-i\fP option. diff --git a/gnu/dist/binutils/rclex.c b/gnu/dist/binutils/rclex.c new file mode 100644 index 00000000000..dc0b9ad713c --- /dev/null +++ b/gnu/dist/binutils/rclex.c @@ -0,0 +1,2526 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /cvsroot/src/gnu/dist/binutils/Attic/rclex.c,v 1.1.1.1 1999/02/02 19:52:33 tv Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include <stdio.h> + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include <stdlib.h> +#include <unistd.h> + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 86 +#define YY_END_OF_BUFFER 87 +static yyconst short int yy_accept[470] = + { 0, + 0, 0, 87, 85, 84, 83, 85, 78, 80, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 2, 4, 84, + 0, 81, 78, 80, 79, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 81, 0, 82, 11, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + + 82, 82, 82, 82, 82, 3, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 76, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 41, 82, 82, + 82, 53, 42, 82, 82, 82, 82, 82, 82, 82, + 46, 82, 82, 82, 82, 82, 82, 71, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + + 82, 82, 82, 7, 82, 82, 82, 38, 1, 82, + 82, 82, 82, 82, 18, 82, 82, 25, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 70, + 82, 82, 39, 40, 82, 82, 82, 82, 82, 30, + 82, 82, 82, 82, 82, 82, 50, 82, 82, 82, + 82, 82, 34, 82, 82, 9, 82, 82, 19, 82, + 68, 82, 82, 82, 82, 82, 82, 12, 0, 82, + 82, 82, 82, 82, 82, 82, 13, 82, 14, 82, + 82, 82, 82, 65, 82, 82, 82, 52, 82, 72, + 82, 82, 82, 82, 82, 82, 47, 82, 82, 82, + + 82, 82, 82, 82, 82, 82, 58, 82, 82, 36, + 82, 82, 82, 82, 82, 82, 82, 82, 0, 82, + 0, 77, 17, 82, 82, 51, 82, 10, 82, 82, + 82, 82, 16, 82, 82, 82, 82, 82, 82, 82, + 29, 82, 82, 82, 82, 82, 82, 82, 73, 82, + 31, 82, 82, 82, 82, 82, 82, 45, 6, 82, + 82, 82, 82, 77, 82, 23, 24, 82, 15, 82, + 27, 82, 82, 66, 82, 28, 54, 43, 82, 82, + 82, 48, 82, 69, 8, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + + 64, 82, 82, 82, 82, 56, 82, 82, 82, 82, + 35, 49, 82, 82, 82, 82, 20, 82, 82, 82, + 82, 82, 82, 82, 82, 74, 82, 82, 82, 32, + 82, 82, 37, 82, 82, 82, 82, 82, 82, 75, + 82, 67, 61, 82, 82, 82, 33, 59, 60, 5, + 21, 82, 82, 82, 82, 55, 57, 82, 82, 82, + 26, 63, 82, 82, 82, 62, 22, 44, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 7, 1, 1, 1, 8, 8, 8, + 9, 8, 8, 8, 8, 8, 8, 1, 1, 1, + 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 19, 26, 27, 28, 29, 30, 19, 31, 32, 19, + 1, 1, 1, 1, 1, 1, 33, 33, 33, 33, + + 33, 33, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 33, + 19, 19, 34, 1, 35, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[36] = + { 0, + 1, 2, 3, 2, 1, 4, 2, 5, 5, 5, + 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, + 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 5, 1, 1 + } ; + +static yyconst short int yy_base[476] = + { 0, + 0, 0, 515, 516, 34, 516, 509, 0, 492, 25, + 26, 45, 25, 28, 24, 486, 497, 49, 0, 40, + 43, 486, 51, 66, 67, 482, 35, 516, 516, 81, + 503, 84, 0, 486, 516, 0, 494, 477, 492, 475, + 74, 474, 477, 475, 46, 489, 69, 484, 471, 481, + 55, 477, 481, 466, 67, 469, 83, 83, 467, 477, + 464, 478, 464, 459, 475, 470, 74, 453, 81, 457, + 86, 76, 468, 467, 465, 452, 452, 458, 95, 461, + 453, 447, 446, 106, 466, 456, 0, 451, 444, 449, + 448, 443, 452, 435, 436, 449, 433, 448, 430, 426, + + 429, 430, 433, 441, 424, 0, 423, 436, 435, 420, + 415, 417, 427, 419, 420, 424, 412, 428, 423, 410, + 424, 405, 406, 407, 419, 409, 0, 402, 409, 416, + 414, 410, 408, 415, 393, 399, 412, 406, 392, 401, + 397, 391, 387, 388, 386, 392, 394, 103, 383, 387, + 399, 388, 389, 396, 385, 377, 379, 376, 373, 376, + 370, 374, 387, 368, 363, 98, 381, 0, 379, 367, + 363, 0, 0, 362, 363, 360, 358, 375, 361, 356, + 105, 373, 372, 351, 355, 355, 349, 0, 366, 352, + 347, 346, 352, 346, 343, 356, 346, 354, 356, 352, + + 347, 344, 349, 0, 335, 344, 350, 0, 0, 334, + 115, 334, 345, 119, 0, 345, 331, 0, 328, 326, + 336, 325, 336, 328, 327, 320, 317, 313, 330, 0, + 330, 331, 0, 0, 327, 322, 329, 314, 314, 0, + 114, 305, 307, 318, 322, 318, 0, 321, 318, 107, + 318, 318, 0, 306, 316, 0, 316, 308, 0, 294, + 0, 298, 307, 294, 291, 304, 304, 0, 132, 137, + 293, 287, 290, 300, 288, 290, 0, 293, 295, 295, + 276, 292, 295, 0, 293, 278, 276, 0, 277, 0, + 270, 283, 267, 285, 270, 281, 0, 280, 279, 271, + + 265, 277, 261, 257, 259, 257, 0, 274, 256, 0, + 255, 254, 258, 248, 269, 268, 265, 258, 270, 143, + 269, 149, 0, 259, 241, 0, 240, 0, 259, 238, + 258, 239, 0, 250, 237, 250, 236, 231, 247, 246, + 0, 249, 247, 247, 234, 227, 240, 225, 0, 222, + 0, 223, 222, 239, 224, 237, 218, 227, 0, 216, + 215, 222, 217, 235, 213, 0, 0, 209, 0, 226, + 0, 209, 203, 0, 216, 0, 0, 0, 212, 206, + 211, 0, 220, 0, 0, 215, 204, 199, 200, 199, + 213, 199, 199, 197, 206, 208, 207, 199, 188, 194, + + 192, 188, 188, 190, 196, 0, 198, 182, 184, 182, + 0, 0, 184, 181, 188, 176, 0, 177, 171, 172, + 170, 183, 186, 181, 171, 0, 183, 171, 164, 0, + 167, 175, 0, 164, 160, 155, 157, 156, 159, 0, + 155, 0, 0, 160, 165, 156, 0, 0, 0, 0, + 0, 141, 150, 141, 139, 0, 0, 128, 122, 126, + 0, 0, 109, 91, 79, 0, 0, 0, 516, 156, + 161, 65, 166, 171, 176 + } ; + +static yyconst short int yy_def[476] = + { 0, + 469, 1, 469, 469, 469, 469, 470, 471, 472, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 469, 469, 469, + 470, 469, 471, 472, 469, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 469, 470, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 469, 474, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 475, 474, + 475, 474, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 475, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 0, 469, + 469, 469, 469, 469, 469 + } ; + +static yyconst short int yy_nxt[552] = + { 0, + 4, 5, 6, 5, 7, 8, 4, 9, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 20, 21, 22, 19, 23, 24, 25, 19, 26, 27, + 19, 19, 19, 28, 29, 30, 37, 30, 50, 41, + 52, 55, 51, 42, 81, 38, 43, 56, 82, 63, + 53, 39, 83, 40, 44, 95, 67, 64, 54, 96, + 59, 45, 60, 65, 103, 46, 68, 66, 47, 34, + 61, 62, 48, 49, 70, 73, 71, 74, 76, 72, + 77, 104, 30, 78, 30, 84, 90, 108, 85, 91, + 98, 99, 111, 75, 79, 113, 123, 109, 126, 129, + + 124, 131, 132, 114, 139, 468, 112, 84, 127, 130, + 85, 205, 225, 467, 206, 241, 269, 269, 242, 270, + 140, 226, 243, 295, 227, 228, 141, 229, 207, 273, + 304, 466, 274, 269, 269, 305, 319, 465, 321, 296, + 321, 322, 36, 321, 321, 464, 321, 322, 36, 321, + 321, 463, 321, 322, 36, 321, 31, 31, 462, 31, + 31, 33, 33, 461, 33, 33, 36, 460, 459, 36, + 36, 320, 320, 458, 320, 320, 321, 321, 457, 456, + 321, 455, 454, 453, 452, 451, 450, 449, 448, 447, + 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, + + 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, + 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, + 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, + 406, 405, 404, 403, 402, 401, 400, 399, 398, 364, + 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, + 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, + 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, + 367, 366, 365, 364, 364, 363, 362, 361, 360, 359, + 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, + 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, + + 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, + 328, 327, 326, 325, 324, 323, 318, 317, 316, 315, + 314, 313, 312, 311, 310, 309, 308, 307, 306, 303, + 302, 301, 300, 299, 298, 297, 294, 293, 292, 291, + 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, + 280, 279, 278, 277, 276, 275, 272, 271, 268, 267, + 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, + 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, + 246, 245, 244, 240, 239, 238, 237, 236, 235, 234, + 233, 232, 231, 230, 224, 223, 222, 221, 220, 219, + + 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, + 208, 204, 203, 202, 201, 200, 199, 198, 197, 196, + 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, + 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, + 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, + 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, + 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, + 32, 145, 144, 143, 142, 138, 137, 136, 135, 134, + 133, 128, 125, 122, 121, 120, 119, 118, 117, 116, + 115, 110, 107, 106, 105, 102, 101, 100, 97, 94, + + 93, 92, 89, 88, 87, 86, 35, 32, 80, 69, + 58, 57, 35, 32, 469, 3, 469, 469, 469, 469, + 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + 469 + } ; + +static yyconst short int yy_chk[552] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 5, 10, 5, 13, 11, + 14, 15, 13, 11, 27, 10, 11, 15, 27, 20, + 14, 10, 27, 10, 12, 45, 21, 20, 14, 45, + 18, 12, 18, 20, 51, 12, 21, 20, 12, 472, + 18, 18, 12, 12, 23, 24, 23, 24, 25, 23, + 25, 51, 30, 25, 30, 32, 41, 55, 32, 41, + 47, 47, 57, 24, 25, 58, 67, 55, 69, 71, + + 67, 72, 72, 58, 79, 465, 57, 84, 69, 71, + 84, 148, 166, 464, 148, 181, 211, 211, 181, 211, + 79, 166, 181, 241, 166, 166, 79, 166, 148, 214, + 250, 463, 214, 269, 269, 250, 269, 460, 270, 241, + 270, 270, 270, 270, 320, 459, 320, 320, 320, 320, + 322, 458, 322, 322, 322, 322, 470, 470, 455, 470, + 470, 471, 471, 454, 471, 471, 473, 453, 452, 473, + 473, 474, 474, 446, 474, 474, 475, 475, 445, 444, + 475, 441, 439, 438, 437, 436, 435, 434, 432, 431, + 429, 428, 427, 425, 424, 423, 422, 421, 420, 419, + + 418, 416, 415, 414, 413, 410, 409, 408, 407, 405, + 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, + 394, 393, 392, 391, 390, 389, 388, 387, 386, 383, + 381, 380, 379, 375, 373, 372, 370, 368, 365, 364, + 363, 362, 361, 360, 358, 357, 356, 355, 354, 353, + 352, 350, 348, 347, 346, 345, 344, 343, 342, 340, + 339, 338, 337, 336, 335, 334, 332, 331, 330, 329, + 327, 325, 324, 321, 319, 318, 317, 316, 315, 314, + 313, 312, 311, 309, 308, 306, 305, 304, 303, 302, + 301, 300, 299, 298, 296, 295, 294, 293, 292, 291, + + 289, 287, 286, 285, 283, 282, 281, 280, 279, 278, + 276, 275, 274, 273, 272, 271, 267, 266, 265, 264, + 263, 262, 260, 258, 257, 255, 254, 252, 251, 249, + 248, 246, 245, 244, 243, 242, 239, 238, 237, 236, + 235, 232, 231, 229, 228, 227, 226, 225, 224, 223, + 222, 221, 220, 219, 217, 216, 213, 212, 210, 207, + 206, 205, 203, 202, 201, 200, 199, 198, 197, 196, + 195, 194, 193, 192, 191, 190, 189, 187, 186, 185, + 184, 183, 182, 180, 179, 178, 177, 176, 175, 174, + 171, 170, 169, 167, 165, 164, 163, 162, 161, 160, + + 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, + 149, 147, 146, 145, 144, 143, 142, 141, 140, 139, + 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, + 128, 126, 125, 124, 123, 122, 121, 120, 119, 118, + 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, + 107, 105, 104, 103, 102, 101, 100, 99, 98, 97, + 96, 95, 94, 93, 92, 91, 90, 89, 88, 86, + 85, 83, 82, 81, 80, 78, 77, 76, 75, 74, + 73, 70, 68, 66, 65, 64, 63, 62, 61, 60, + 59, 56, 54, 53, 52, 50, 49, 48, 46, 44, + + 43, 42, 40, 39, 38, 37, 34, 31, 26, 22, + 17, 16, 9, 7, 3, 469, 469, 469, 469, 469, + 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, + 469 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +char *yytext; +#line 1 "/5g/ian/binutils/release/copy/binutils/rclex.l" +#define INITIAL 0 +#line 2 "/5g/ian/binutils/release/copy/binutils/rclex.l" +/* Copyright 1997, 1998 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This is a lex input file which generates a lexer used by the + Windows rc file parser. It basically just recognized a bunch of + keywords. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" +#include "rcparse.h" + +#include <ctype.h> +#include <assert.h> + +/* Whether we are in rcdata mode, in which we returns the lengths of + strings. */ + +static int rcdata_mode; + +/* List of allocated strings. */ + +struct alloc_string +{ + struct alloc_string *next; + char *s; +}; + +static struct alloc_string *strings; + +/* Local functions. */ + +static void cpp_line PARAMS ((const char *)); +static char *handle_quotes PARAMS ((const char *, unsigned long *)); +static char *get_string PARAMS ((int)); + +#line 691 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 58 "/5g/ian/binutils/release/copy/binutils/rclex.l" + + +#line 841 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 470 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 516 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 60 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return BEG; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 61 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return BEG; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 62 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return END; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 63 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return END; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 64 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return ACCELERATORS; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 65 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return VIRTKEY; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 66 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return ASCII; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 67 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return NOINVERT; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 68 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return SHIFT; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 69 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CONTROL; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 70 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return ALT; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 71 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return BITMAP; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 72 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CURSOR; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 73 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return DIALOG; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 74 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return DIALOGEX; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 75 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return EXSTYLE; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 76 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CAPTION; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 77 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CLASS; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 78 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return STYLE; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 79 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return AUTO3STATE; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 80 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return AUTOCHECKBOX; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 81 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return AUTORADIOBUTTON; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 82 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CHECKBOX; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 83 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return COMBOBOX; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 84 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CTEXT; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 85 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return DEFPUSHBUTTON; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 86 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return EDITTEXT; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 87 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return GROUPBOX; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 88 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return LISTBOX; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 89 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return LTEXT; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 90 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return PUSHBOX; } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 91 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return PUSHBUTTON; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 92 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return RADIOBUTTON; } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 93 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return RTEXT; } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 94 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return SCROLLBAR; } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 95 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return STATE3; } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 96 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return USERBUTTON; } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 97 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return BEDIT; } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 98 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return HEDIT; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 99 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return IEDIT; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 100 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FONT; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 101 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return ICON; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 102 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return LANGUAGE; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 103 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CHARACTERISTICS; } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 104 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return VERSIONK; } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 105 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MENU; } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 106 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MENUEX; } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 107 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MENUITEM; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 108 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return SEPARATOR; } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 109 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return POPUP; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 110 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return CHECKED; } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 111 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return GRAYED; } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 112 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return HELP; } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 113 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return INACTIVE; } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 114 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MENUBARBREAK; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 115 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MENUBREAK; } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 116 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MESSAGETABLE; } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 117 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return RCDATA; } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 118 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return STRINGTABLE; } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 119 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return VERSIONINFO; } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 120 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FILEVERSION; } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 121 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return PRODUCTVERSION; } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 122 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FILEFLAGSMASK; } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 123 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FILEFLAGS; } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 124 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FILEOS; } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 125 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FILETYPE; } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 126 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FILESUBTYPE; } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 127 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return VALUE; } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 128 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return MOVEABLE; } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 129 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return FIXED; } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 130 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return PURE; } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 131 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return IMPURE; } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 132 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return PRELOAD; } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 133 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return LOADONCALL; } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 134 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return DISCARDABLE; } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 135 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return NOT; } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 137 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ + char *s, *send; + + /* This is a hack to let us parse version + information easily. */ + + s = strchr (yytext, '"'); + ++s; + send = strchr (s, '"'); + if (strncmp (s, "StringFileInfo", + sizeof "StringFileInfo" - 1) == 0 + && s + sizeof "StringFileInfo" - 1 == send) + return BLOCKSTRINGFILEINFO; + else if (strncmp (s, "VarFileInfo", + sizeof "VarFileInfo" - 1) == 0 + && s + sizeof "VarFileInfo" - 1 == send) + return BLOCKVARFILEINFO; + else + { + char *r; + + r = get_string (send - s + 1); + strncpy (r, s, send - s); + r[send - s] = '\0'; + yylval.s = r; + return BLOCK; + } + } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 166 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ + cpp_line (yytext); + } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 170 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ + yylval.i.val = strtoul (yytext, 0, 0); + yylval.i.dword = 1; + return NUMBER; + } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 176 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ + yylval.i.val = strtoul (yytext, 0, 0); + yylval.i.dword = 0; + return NUMBER; + } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 182 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ + char *s; + unsigned long length; + + s = handle_quotes (yytext, &length); + if (! rcdata_mode) + { + yylval.s = s; + return QUOTEDSTRING; + } + else + { + yylval.ss.length = length; + yylval.ss.s = s; + return SIZEDSTRING; + } + } + YY_BREAK +case 82: +YY_RULE_SETUP +#line 200 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ + char *s; + + /* I rejected comma in a string in order to + handle VIRTKEY, CONTROL in an accelerator + resource. This means that an unquoted + file name can not contain a comma. I + don't know what rc permits. */ + + s = get_string (strlen (yytext) + 1); + strcpy (s, yytext); + yylval.s = s; + return STRING; + } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 215 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ ++rc_lineno; } + YY_BREAK +case 84: +YY_RULE_SETUP +#line 216 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ /* ignore whitespace */ } + YY_BREAK +case 85: +YY_RULE_SETUP +#line 217 "/5g/ian/binutils/release/copy/binutils/rclex.l" +{ return *yytext; } + YY_BREAK +case 86: +YY_RULE_SETUP +#line 219 "/5g/ian/binutils/release/copy/binutils/rclex.l" +ECHO; + YY_BREAK +#line 1420 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 470 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 470 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 469); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +yyconst char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 219 "/5g/ian/binutils/release/copy/binutils/rclex.l" + +#ifndef yywrap +/* This is needed for some versions of lex. */ +int yywrap () +{ + return 1; +} +#endif + +/* Handle a C preprocessor line. */ + +static void +cpp_line (s) + const char *s; +{ + int line; + char *send, *fn; + + ++s; + while (isspace (*s)) + ++s; + + line = strtol (s, &send, 0); + if (*send != '\0' && ! isspace (*send)) + return; + + /* Subtract 1 because we are about to count the newline. */ + rc_lineno = line - 1; + + s = send; + while (isspace (*s)) + ++s; + + if (*s != '"') + return; + + ++s; + send = strchr (s, '"'); + if (send == NULL) + return; + + fn = (char *) xmalloc (send - s + 1); + strncpy (fn, s, send - s); + fn[send - s] = '\0'; + + free (rc_filename); + rc_filename = fn; +} + +/* Handle a quoted string. The quotes are stripped. A pair of quotes + in a string are turned into a single quote. Adjacent strings are + merged separated by whitespace are merged, as in C. */ + +static char * +handle_quotes (input, len) + const char *input; + unsigned long *len; +{ + char *ret, *s; + const char *t; + int ch; + + ret = get_string (strlen (input) + 1); + + s = ret; + t = input; + if (*t == '"') + ++t; + while (*t != '\0') + { + if (*t == '\\') + { + ++t; + switch (*t) + { + case '\0': + rcparse_warning ("backslash at end of string"); + break; + + case '\"': + rcparse_warning ("use \"\" to put \" in a string"); + break; + + case 'a': + *s++ = ESCAPE_A; + ++t; + break; + + case 'b': + *s++ = ESCAPE_B; + ++t; + break; + + case 'f': + *s++ = ESCAPE_F; + ++t; + break; + + case 'n': + *s++ = ESCAPE_N; + ++t; + break; + + case 'r': + *s++ = ESCAPE_R; + ++t; + break; + + case 't': + *s++ = ESCAPE_T; + ++t; + break; + + case 'v': + *s++ = ESCAPE_V; + ++t; + break; + + case '\\': + *s++ = *t++; + break; + + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + ch = *t - '0'; + ++t; + if (*t >= '0' && *t <= '7') + { + ch = (ch << 3) | (*t - '0'); + ++t; + if (*t >= '0' && *t <= '7') + { + ch = (ch << 3) | (*t - '0'); + ++t; + } + } + *s++ = ch; + break; + + case 'x': + ++t; + ch = 0; + while (1) + { + if (*t >= '0' && *t <= '9') + ch = (ch << 4) | (*t - '0'); + else if (*t >= 'a' && *t <= 'f') + ch = (ch << 4) | (*t - 'a'); + else if (*t >= 'A' && *t <= 'F') + ch = (ch << 4) | (*t - 'A'); + else + break; + ++t; + } + *s++ = ch; + break; + + default: + rcparse_warning ("unrecognized escape sequence"); + *s++ = '\\'; + *s++ = *t++; + break; + } + } + else if (*t != '"') + *s++ = *t++; + else if (t[1] == '\0') + break; + else if (t[1] == '"') + { + *s++ = '"'; + t += 2; + } + else + { + ++t; + assert (isspace (*t)); + while (isspace (*t)) + ++t; + if (*t == '\0') + break; + assert (*t == '"'); + ++t; + } + } + + *s = '\0'; + + *len = s - ret; + + return ret; +} + +/* Allocate a string of a given length. */ + +static char * +get_string (len) + int len; +{ + struct alloc_string *as; + + as = (struct alloc_string *) xmalloc (sizeof *as); + as->s = xmalloc (len); + + as->next = strings; + strings = as->next; + + return as->s; +} + +/* Discard all the strings we have allocated. The parser calls this + when it no longer needs them. */ + +void +rcparse_discard_strings () +{ + struct alloc_string *as; + + as = strings; + while (as != NULL) + { + struct alloc_string *n; + + free (as->s); + n = as->next; + free (as); + as = n; + } + + strings = NULL; +} + +/* Enter rcdata mode. */ + +void +rcparse_rcdata () +{ + rcdata_mode = 1; +} + +/* Go back to normal mode from rcdata mode. */ + +void +rcparse_normal () +{ + rcdata_mode = 0; +} diff --git a/gnu/dist/binutils/rclex.l b/gnu/dist/binutils/rclex.l new file mode 100644 index 00000000000..50ef185d8ed --- /dev/null +++ b/gnu/dist/binutils/rclex.l @@ -0,0 +1,465 @@ +%{ /* rclex.l -- lexer for Windows rc files parser */ +/* Copyright 1997, 1998 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This is a lex input file which generates a lexer used by the + Windows rc file parser. It basically just recognized a bunch of + keywords. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" +#include "rcparse.h" + +#include <ctype.h> +#include <assert.h> + +/* Whether we are in rcdata mode, in which we returns the lengths of + strings. */ + +static int rcdata_mode; + +/* List of allocated strings. */ + +struct alloc_string +{ + struct alloc_string *next; + char *s; +}; + +static struct alloc_string *strings; + +/* Local functions. */ + +static void cpp_line PARAMS ((const char *)); +static char *handle_quotes PARAMS ((const char *, unsigned long *)); +static char *get_string PARAMS ((int)); + +%} + +%% + +"BEGIN" { return BEG; } +"{" { return BEG; } +"END" { return END; } +"}" { return END; } +"ACCELERATORS" { return ACCELERATORS; } +"VIRTKEY" { return VIRTKEY; } +"ASCII" { return ASCII; } +"NOINVERT" { return NOINVERT; } +"SHIFT" { return SHIFT; } +"CONTROL" { return CONTROL; } +"ALT" { return ALT; } +"BITMAP" { return BITMAP; } +"CURSOR" { return CURSOR; } +"DIALOG" { return DIALOG; } +"DIALOGEX" { return DIALOGEX; } +"EXSTYLE" { return EXSTYLE; } +"CAPTION" { return CAPTION; } +"CLASS" { return CLASS; } +"STYLE" { return STYLE; } +"AUTO3STATE" { return AUTO3STATE; } +"AUTOCHECKBOX" { return AUTOCHECKBOX; } +"AUTORADIOBUTTON" { return AUTORADIOBUTTON; } +"CHECKBOX" { return CHECKBOX; } +"COMBOBOX" { return COMBOBOX; } +"CTEXT" { return CTEXT; } +"DEFPUSHBUTTON" { return DEFPUSHBUTTON; } +"EDITTEXT" { return EDITTEXT; } +"GROUPBOX" { return GROUPBOX; } +"LISTBOX" { return LISTBOX; } +"LTEXT" { return LTEXT; } +"PUSHBOX" { return PUSHBOX; } +"PUSHBUTTON" { return PUSHBUTTON; } +"RADIOBUTTON" { return RADIOBUTTON; } +"RTEXT" { return RTEXT; } +"SCROLLBAR" { return SCROLLBAR; } +"STATE3" { return STATE3; } +"USERBUTTON" { return USERBUTTON; } +"BEDIT" { return BEDIT; } +"HEDIT" { return HEDIT; } +"IEDIT" { return IEDIT; } +"FONT" { return FONT; } +"ICON" { return ICON; } +"LANGUAGE" { return LANGUAGE; } +"CHARACTERISTICS" { return CHARACTERISTICS; } +"VERSION" { return VERSIONK; } +"MENU" { return MENU; } +"MENUEX" { return MENUEX; } +"MENUITEM" { return MENUITEM; } +"SEPARATOR" { return SEPARATOR; } +"POPUP" { return POPUP; } +"CHECKED" { return CHECKED; } +"GRAYED" { return GRAYED; } +"HELP" { return HELP; } +"INACTIVE" { return INACTIVE; } +"MENUBARBREAK" { return MENUBARBREAK; } +"MENUBREAK" { return MENUBREAK; } +"MESSAGETABLE" { return MESSAGETABLE; } +"RCDATA" { return RCDATA; } +"STRINGTABLE" { return STRINGTABLE; } +"VERSIONINFO" { return VERSIONINFO; } +"FILEVERSION" { return FILEVERSION; } +"PRODUCTVERSION" { return PRODUCTVERSION; } +"FILEFLAGSMASK" { return FILEFLAGSMASK; } +"FILEFLAGS" { return FILEFLAGS; } +"FILEOS" { return FILEOS; } +"FILETYPE" { return FILETYPE; } +"FILESUBTYPE" { return FILESUBTYPE; } +"VALUE" { return VALUE; } +"MOVEABLE" { return MOVEABLE; } +"FIXED" { return FIXED; } +"PURE" { return PURE; } +"IMPURE" { return IMPURE; } +"PRELOAD" { return PRELOAD; } +"LOADONCALL" { return LOADONCALL; } +"DISCARDABLE" { return DISCARDABLE; } +"NOT" { return NOT; } + +"BLOCK"[ \t\n]*"\""[^\#\n]*"\"" { + char *s, *send; + + /* This is a hack to let us parse version + information easily. */ + + s = strchr (yytext, '"'); + ++s; + send = strchr (s, '"'); + if (strncmp (s, "StringFileInfo", + sizeof "StringFileInfo" - 1) == 0 + && s + sizeof "StringFileInfo" - 1 == send) + return BLOCKSTRINGFILEINFO; + else if (strncmp (s, "VarFileInfo", + sizeof "VarFileInfo" - 1) == 0 + && s + sizeof "VarFileInfo" - 1 == send) + return BLOCKVARFILEINFO; + else + { + char *r; + + r = get_string (send - s + 1); + strncpy (r, s, send - s); + r[send - s] = '\0'; + yylval.s = r; + return BLOCK; + } + } + +"#"[^\n]* { + cpp_line (yytext); + } + +[0-9][x0-9A-Fa-f]*L { + yylval.i.val = strtoul (yytext, 0, 0); + yylval.i.dword = 1; + return NUMBER; + } + +[0-9][x0-9A-Fa-f]* { + yylval.i.val = strtoul (yytext, 0, 0); + yylval.i.dword = 0; + return NUMBER; + } + +("\""[^\"\n]*"\""[ \t]*)+ { + char *s; + unsigned long length; + + s = handle_quotes (yytext, &length); + if (! rcdata_mode) + { + yylval.s = s; + return QUOTEDSTRING; + } + else + { + yylval.ss.length = length; + yylval.ss.s = s; + return SIZEDSTRING; + } + } + +[A-Za-z][^ ,\t\r\n]* { + char *s; + + /* I rejected comma in a string in order to + handle VIRTKEY, CONTROL in an accelerator + resource. This means that an unquoted + file name can not contain a comma. I + don't know what rc permits. */ + + s = get_string (strlen (yytext) + 1); + strcpy (s, yytext); + yylval.s = s; + return STRING; + } + +[\n] { ++rc_lineno; } +[ \t\r]+ { /* ignore whitespace */ } +. { return *yytext; } + +%% +#ifndef yywrap +/* This is needed for some versions of lex. */ +int yywrap () +{ + return 1; +} +#endif + +/* Handle a C preprocessor line. */ + +static void +cpp_line (s) + const char *s; +{ + int line; + char *send, *fn; + + ++s; + while (isspace (*s)) + ++s; + + line = strtol (s, &send, 0); + if (*send != '\0' && ! isspace (*send)) + return; + + /* Subtract 1 because we are about to count the newline. */ + rc_lineno = line - 1; + + s = send; + while (isspace (*s)) + ++s; + + if (*s != '"') + return; + + ++s; + send = strchr (s, '"'); + if (send == NULL) + return; + + fn = (char *) xmalloc (send - s + 1); + strncpy (fn, s, send - s); + fn[send - s] = '\0'; + + free (rc_filename); + rc_filename = fn; +} + +/* Handle a quoted string. The quotes are stripped. A pair of quotes + in a string are turned into a single quote. Adjacent strings are + merged separated by whitespace are merged, as in C. */ + +static char * +handle_quotes (input, len) + const char *input; + unsigned long *len; +{ + char *ret, *s; + const char *t; + int ch; + + ret = get_string (strlen (input) + 1); + + s = ret; + t = input; + if (*t == '"') + ++t; + while (*t != '\0') + { + if (*t == '\\') + { + ++t; + switch (*t) + { + case '\0': + rcparse_warning ("backslash at end of string"); + break; + + case '\"': + rcparse_warning ("use \"\" to put \" in a string"); + break; + + case 'a': + *s++ = ESCAPE_A; + ++t; + break; + + case 'b': + *s++ = ESCAPE_B; + ++t; + break; + + case 'f': + *s++ = ESCAPE_F; + ++t; + break; + + case 'n': + *s++ = ESCAPE_N; + ++t; + break; + + case 'r': + *s++ = ESCAPE_R; + ++t; + break; + + case 't': + *s++ = ESCAPE_T; + ++t; + break; + + case 'v': + *s++ = ESCAPE_V; + ++t; + break; + + case '\\': + *s++ = *t++; + break; + + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + ch = *t - '0'; + ++t; + if (*t >= '0' && *t <= '7') + { + ch = (ch << 3) | (*t - '0'); + ++t; + if (*t >= '0' && *t <= '7') + { + ch = (ch << 3) | (*t - '0'); + ++t; + } + } + *s++ = ch; + break; + + case 'x': + ++t; + ch = 0; + while (1) + { + if (*t >= '0' && *t <= '9') + ch = (ch << 4) | (*t - '0'); + else if (*t >= 'a' && *t <= 'f') + ch = (ch << 4) | (*t - 'a'); + else if (*t >= 'A' && *t <= 'F') + ch = (ch << 4) | (*t - 'A'); + else + break; + ++t; + } + *s++ = ch; + break; + + default: + rcparse_warning ("unrecognized escape sequence"); + *s++ = '\\'; + *s++ = *t++; + break; + } + } + else if (*t != '"') + *s++ = *t++; + else if (t[1] == '\0') + break; + else if (t[1] == '"') + { + *s++ = '"'; + t += 2; + } + else + { + ++t; + assert (isspace (*t)); + while (isspace (*t)) + ++t; + if (*t == '\0') + break; + assert (*t == '"'); + ++t; + } + } + + *s = '\0'; + + *len = s - ret; + + return ret; +} + +/* Allocate a string of a given length. */ + +static char * +get_string (len) + int len; +{ + struct alloc_string *as; + + as = (struct alloc_string *) xmalloc (sizeof *as); + as->s = xmalloc (len); + + as->next = strings; + strings = as->next; + + return as->s; +} + +/* Discard all the strings we have allocated. The parser calls this + when it no longer needs them. */ + +void +rcparse_discard_strings () +{ + struct alloc_string *as; + + as = strings; + while (as != NULL) + { + struct alloc_string *n; + + free (as->s); + n = as->next; + free (as); + as = n; + } + + strings = NULL; +} + +/* Enter rcdata mode. */ + +void +rcparse_rcdata () +{ + rcdata_mode = 1; +} + +/* Go back to normal mode from rcdata mode. */ + +void +rcparse_normal () +{ + rcdata_mode = 0; +} diff --git a/gnu/dist/binutils/rcparse.c b/gnu/dist/binutils/rcparse.c new file mode 100644 index 00000000000..767dbcfe230 --- /dev/null +++ b/gnu/dist/binutils/rcparse.c @@ -0,0 +1,2993 @@ + +/* A Bison parser, made from /5g/ian/binutils/release/copy/binutils/rcparse.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define BEG 258 +#define END 259 +#define ACCELERATORS 260 +#define VIRTKEY 261 +#define ASCII 262 +#define NOINVERT 263 +#define SHIFT 264 +#define CONTROL 265 +#define ALT 266 +#define BITMAP 267 +#define CURSOR 268 +#define DIALOG 269 +#define DIALOGEX 270 +#define EXSTYLE 271 +#define CAPTION 272 +#define CLASS 273 +#define STYLE 274 +#define AUTO3STATE 275 +#define AUTOCHECKBOX 276 +#define AUTORADIOBUTTON 277 +#define CHECKBOX 278 +#define COMBOBOX 279 +#define CTEXT 280 +#define DEFPUSHBUTTON 281 +#define EDITTEXT 282 +#define GROUPBOX 283 +#define LISTBOX 284 +#define LTEXT 285 +#define PUSHBOX 286 +#define PUSHBUTTON 287 +#define RADIOBUTTON 288 +#define RTEXT 289 +#define SCROLLBAR 290 +#define STATE3 291 +#define USERBUTTON 292 +#define BEDIT 293 +#define HEDIT 294 +#define IEDIT 295 +#define FONT 296 +#define ICON 297 +#define LANGUAGE 298 +#define CHARACTERISTICS 299 +#define VERSIONK 300 +#define MENU 301 +#define MENUEX 302 +#define MENUITEM 303 +#define SEPARATOR 304 +#define POPUP 305 +#define CHECKED 306 +#define GRAYED 307 +#define HELP 308 +#define INACTIVE 309 +#define MENUBARBREAK 310 +#define MENUBREAK 311 +#define MESSAGETABLE 312 +#define RCDATA 313 +#define STRINGTABLE 314 +#define VERSIONINFO 315 +#define FILEVERSION 316 +#define PRODUCTVERSION 317 +#define FILEFLAGSMASK 318 +#define FILEFLAGS 319 +#define FILEOS 320 +#define FILETYPE 321 +#define FILESUBTYPE 322 +#define BLOCKSTRINGFILEINFO 323 +#define BLOCKVARFILEINFO 324 +#define VALUE 325 +#define BLOCK 326 +#define MOVEABLE 327 +#define FIXED 328 +#define PURE 329 +#define IMPURE 330 +#define PRELOAD 331 +#define LOADONCALL 332 +#define DISCARDABLE 333 +#define NOT 334 +#define QUOTEDSTRING 335 +#define STRING 336 +#define NUMBER 337 +#define SIZEDSTRING 338 +#define NEG 339 + +#line 1 "/5g/ian/binutils/release/copy/binutils/rcparse.y" + /* rcparse.y -- parser for Windows rc files + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This is a parser for Windows rc files. It is based on the parser + by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" + +#include <ctype.h> + +/* The current language. */ + +static unsigned short language; + +/* The resource information during a sub statement. */ + +static struct res_res_info sub_res_info; + +/* Dialog information. This is built by the nonterminals styles and + controls. */ + +static struct dialog dialog; + +/* This is used when building a style. It is modified by the + nonterminal styleexpr. */ + +static unsigned long style; + +/* These are used when building a control. They are set before using + control_params. */ + +static unsigned long base_style; +static unsigned long default_style; +static unsigned long class; + + +#line 59 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +typedef union +{ + struct accelerator acc; + struct accelerator *pacc; + struct dialog_control *dialog_control; + struct menuitem *menuitem; + struct + { + struct rcdata_item *first; + struct rcdata_item *last; + } rcdata; + struct rcdata_item *rcdata_item; + struct stringtable_data *stringtable; + struct fixed_versioninfo *fixver; + struct ver_info *verinfo; + struct ver_stringinfo *verstring; + struct ver_varinfo *vervar; + struct res_id id; + struct res_res_info res_info; + struct + { + unsigned short on; + unsigned short off; + } memflags; + struct + { + unsigned long val; + /* Nonzero if this number was explicitly specified as long. */ + int dword; + } i; + unsigned long il; + unsigned short is; + const char *s; + struct + { + unsigned long length; + const char *s; + } ss; +} YYSTYPE; +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 462 +#define YYFLAG -32768 +#define YYNTBASE 98 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 339 ? yytranslate[x] : 188) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 91, 86, 2, 96, + 97, 89, 87, 94, 88, 2, 90, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 95, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 85, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 84, 2, 92, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 93 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 1, 5, 9, 13, 17, 21, 25, 29, 33, + 37, 41, 45, 49, 53, 57, 58, 65, 66, 69, + 72, 77, 79, 81, 83, 87, 90, 92, 94, 96, + 98, 100, 102, 107, 112, 113, 127, 128, 142, 143, + 158, 159, 163, 164, 168, 172, 173, 178, 182, 188, + 196, 200, 204, 209, 213, 214, 217, 218, 222, 223, + 227, 228, 232, 233, 237, 238, 242, 243, 247, 259, + 272, 273, 277, 278, 282, 283, 287, 288, 292, 293, + 297, 304, 315, 327, 328, 332, 333, 337, 338, 342, + 343, 347, 348, 352, 353, 357, 358, 362, 363, 367, + 368, 372, 373, 390, 398, 408, 419, 420, 423, 424, + 428, 429, 433, 434, 438, 439, 443, 448, 453, 457, + 464, 465, 468, 473, 476, 483, 484, 488, 491, 493, + 495, 497, 499, 501, 503, 510, 511, 514, 517, 521, + 527, 533, 540, 548, 558, 563, 570, 571, 574, 575, + 577, 579, 581, 585, 589, 590, 597, 598, 602, 607, + 614, 619, 626, 627, 634, 641, 645, 649, 653, 657, + 661, 662, 671, 679, 680, 686, 687, 691, 693, 695, + 696, 699, 703, 708, 712, 713, 716, 717, 720, 722, + 724, 726, 728, 730, 732, 734, 736, 738, 740, 743, + 747, 752, 754, 758, 759, 761, 764, 766, 768, 772, + 775, 778, 782, 786, 790, 794, 798, 802, 806, 810, + 813, 815, 817, 821, 824, 828, 832, 836, 840, 844, + 848, 852 +}; + +static const short yyrhs[] = { -1, + 98, 99, 100, 0, 98, 99, 106, 0, 98, 99, + 107, 0, 98, 99, 108, 0, 98, 99, 147, 0, + 98, 99, 148, 0, 98, 99, 149, 0, 98, 99, + 150, 0, 98, 99, 155, 0, 98, 99, 158, 0, + 98, 99, 159, 0, 98, 99, 164, 0, 98, 99, + 167, 0, 98, 99, 168, 0, 0, 173, 5, 174, + 3, 101, 4, 0, 0, 101, 102, 0, 103, 185, + 0, 103, 185, 94, 104, 0, 80, 0, 186, 0, + 105, 0, 104, 94, 105, 0, 104, 105, 0, 6, + 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, + 0, 173, 12, 176, 178, 0, 173, 13, 175, 178, + 0, 0, 173, 14, 176, 112, 186, 182, 182, 182, + 109, 113, 3, 115, 4, 0, 0, 173, 15, 176, + 112, 186, 182, 182, 182, 110, 113, 3, 115, 4, + 0, 0, 173, 15, 176, 112, 186, 182, 182, 182, + 182, 111, 113, 3, 115, 4, 0, 0, 16, 95, + 183, 0, 0, 113, 17, 80, 0, 113, 18, 173, + 0, 0, 113, 19, 114, 179, 0, 113, 16, 183, + 0, 113, 41, 183, 94, 80, 0, 113, 41, 183, + 94, 80, 182, 182, 0, 113, 46, 173, 0, 113, + 44, 183, 0, 113, 43, 183, 182, 0, 113, 45, + 183, 0, 0, 115, 116, 0, 0, 20, 117, 138, + 0, 0, 21, 118, 138, 0, 0, 22, 119, 138, + 0, 0, 38, 120, 138, 0, 0, 23, 121, 138, + 0, 0, 24, 122, 138, 0, 10, 139, 183, 182, + 141, 182, 182, 182, 182, 181, 140, 0, 10, 139, + 183, 182, 141, 182, 182, 182, 182, 182, 182, 140, + 0, 0, 25, 123, 138, 0, 0, 26, 124, 138, + 0, 0, 27, 125, 138, 0, 0, 28, 126, 138, + 0, 0, 39, 127, 138, 0, 42, 139, 183, 182, + 182, 140, 0, 42, 139, 183, 182, 182, 182, 182, + 143, 181, 140, 0, 42, 139, 183, 182, 182, 182, + 182, 143, 182, 182, 140, 0, 0, 40, 128, 138, + 0, 0, 29, 129, 138, 0, 0, 30, 130, 138, + 0, 0, 31, 131, 138, 0, 0, 32, 132, 138, + 0, 0, 33, 133, 138, 0, 0, 34, 134, 138, + 0, 0, 35, 135, 138, 0, 0, 36, 136, 138, + 0, 0, 37, 80, 94, 183, 94, 183, 94, 183, + 94, 183, 94, 183, 94, 137, 179, 181, 0, 139, + 183, 182, 182, 182, 182, 140, 0, 139, 183, 182, + 182, 182, 182, 145, 181, 140, 0, 139, 183, 182, + 182, 182, 182, 145, 182, 182, 140, 0, 0, 80, + 94, 0, 0, 3, 160, 4, 0, 0, 94, 142, + 179, 0, 0, 94, 144, 179, 0, 0, 94, 146, + 179, 0, 173, 41, 175, 178, 0, 173, 42, 175, + 178, 0, 43, 183, 182, 0, 173, 46, 174, 3, + 151, 4, 0, 0, 151, 152, 0, 48, 80, 182, + 153, 0, 48, 49, 0, 50, 80, 153, 3, 151, + 4, 0, 0, 153, 94, 154, 0, 153, 154, 0, + 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, + 56, 0, 173, 47, 174, 3, 156, 4, 0, 0, + 156, 157, 0, 48, 80, 0, 48, 80, 182, 0, + 48, 80, 182, 182, 181, 0, 50, 80, 3, 156, + 4, 0, 50, 80, 182, 3, 156, 4, 0, 50, + 80, 182, 182, 3, 156, 4, 0, 50, 80, 182, + 182, 182, 181, 3, 156, 4, 0, 173, 57, 176, + 178, 0, 173, 58, 174, 3, 160, 4, 0, 0, + 161, 162, 0, 0, 163, 0, 83, 0, 184, 0, + 163, 94, 83, 0, 163, 94, 184, 0, 0, 59, + 174, 3, 165, 166, 4, 0, 0, 166, 183, 80, + 0, 166, 183, 94, 80, 0, 173, 173, 174, 3, + 160, 4, 0, 173, 173, 174, 178, 0, 173, 60, + 169, 3, 170, 4, 0, 0, 169, 61, 183, 182, + 182, 182, 0, 169, 62, 183, 182, 182, 182, 0, + 169, 63, 183, 0, 169, 64, 183, 0, 169, 65, + 183, 0, 169, 66, 183, 0, 169, 67, 183, 0, + 0, 170, 68, 3, 71, 3, 171, 4, 4, 0, + 170, 69, 3, 70, 80, 172, 4, 0, 0, 171, + 70, 80, 94, 80, 0, 0, 172, 182, 182, 0, + 186, 0, 81, 0, 0, 174, 177, 0, 174, 44, + 183, 0, 174, 43, 183, 182, 0, 174, 45, 183, + 0, 0, 175, 177, 0, 0, 175, 177, 0, 72, + 0, 73, 0, 74, 0, 75, 0, 76, 0, 77, + 0, 78, 0, 80, 0, 81, 0, 180, 0, 79, + 180, 0, 179, 84, 180, 0, 179, 84, 79, 180, + 0, 82, 0, 96, 183, 97, 0, 0, 182, 0, + 94, 183, 0, 184, 0, 82, 0, 96, 184, 97, + 0, 92, 184, 0, 88, 184, 0, 184, 89, 184, + 0, 184, 90, 184, 0, 184, 91, 184, 0, 184, + 87, 184, 0, 184, 88, 184, 0, 184, 86, 184, + 0, 184, 85, 184, 0, 184, 84, 184, 0, 94, + 186, 0, 187, 0, 82, 0, 96, 184, 97, 0, + 92, 184, 0, 187, 89, 184, 0, 187, 90, 184, + 0, 187, 91, 184, 0, 187, 87, 184, 0, 187, + 88, 184, 0, 187, 86, 184, 0, 187, 85, 184, + 0, 187, 84, 184, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 154, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 172, 181, 188, 193, 213, + 219, 230, 252, 261, 266, 271, 277, 282, 287, 291, + 295, 299, 307, 316, 325, 343, 347, 366, 370, 390, + 396, 401, 407, 409, 413, 417, 420, 423, 427, 433, + 446, 450, 454, 458, 464, 466, 476, 484, 487, 494, + 497, 504, 507, 514, 520, 527, 530, 537, 540, 551, + 560, 567, 570, 577, 580, 587, 590, 597, 600, 607, + 613, 624, 636, 646, 653, 659, 666, 669, 676, 679, + 686, 689, 696, 699, 706, 709, 716, 719, 726, 729, + 736, 739, 742, 756, 769, 780, 791, 796, 802, 807, + 815, 819, 821, 825, 827, 831, 835, 844, 854, 863, + 870, 875, 891, 896, 900, 906, 911, 915, 921, 926, + 930, 934, 938, 942, 950, 957, 962, 978, 983, 987, + 991, 995, 999, 1003, 1012, 1021, 1031, 1036, 1042, 1048, + 1054, 1063, 1071, 1080, 1093, 1096, 1099, 1101, 1105, 1114, + 1119, 1127, 1134, 1141, 1147, 1153, 1158, 1163, 1168, 1173, + 1186, 1191, 1195, 1201, 1206, 1212, 1217, 1225, 1231, 1248, + 1256, 1262, 1267, 1272, 1281, 1288, 1298, 1305, 1316, 1322, + 1327, 1332, 1337, 1342, 1347, 1356, 1361, 1377, 1382, 1386, + 1390, 1396, 1401, 1409, 1414, 1422, 1431, 1440, 1445, 1449, + 1454, 1459, 1464, 1469, 1474, 1479, 1484, 1489, 1494, 1504, + 1513, 1524, 1529, 1533, 1538, 1543, 1548, 1553, 1558, 1563, + 1568, 1573 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","BEG","END", +"ACCELERATORS","VIRTKEY","ASCII","NOINVERT","SHIFT","CONTROL","ALT","BITMAP", +"CURSOR","DIALOG","DIALOGEX","EXSTYLE","CAPTION","CLASS","STYLE","AUTO3STATE", +"AUTOCHECKBOX","AUTORADIOBUTTON","CHECKBOX","COMBOBOX","CTEXT","DEFPUSHBUTTON", +"EDITTEXT","GROUPBOX","LISTBOX","LTEXT","PUSHBOX","PUSHBUTTON","RADIOBUTTON", +"RTEXT","SCROLLBAR","STATE3","USERBUTTON","BEDIT","HEDIT","IEDIT","FONT","ICON", +"LANGUAGE","CHARACTERISTICS","VERSIONK","MENU","MENUEX","MENUITEM","SEPARATOR", +"POPUP","CHECKED","GRAYED","HELP","INACTIVE","MENUBARBREAK","MENUBREAK","MESSAGETABLE", +"RCDATA","STRINGTABLE","VERSIONINFO","FILEVERSION","PRODUCTVERSION","FILEFLAGSMASK", +"FILEFLAGS","FILEOS","FILETYPE","FILESUBTYPE","BLOCKSTRINGFILEINFO","BLOCKVARFILEINFO", +"VALUE","BLOCK","MOVEABLE","FIXED","PURE","IMPURE","PRELOAD","LOADONCALL","DISCARDABLE", +"NOT","QUOTEDSTRING","STRING","NUMBER","SIZEDSTRING","'|'","'^'","'&'","'+'", +"'-'","'*'","'/'","'%'","'~'","NEG","','","'='","'('","')'","input","newcmd", +"accelerator","acc_entries","acc_entry","acc_event","acc_options","acc_option", +"bitmap","cursor","dialog","@1","@2","@3","exstyle","styles","@4","controls", +"control","@5","@6","@7","@8","@9","@10","@11","@12","@13","@14","@15","@16", +"@17","@18","@19","@20","@21","@22","@23","@24","@25","control_params","optstringc", +"opt_control_data","control_styleexpr","@26","icon_styleexpr","@27","control_params_styleexpr", +"@28","font","icon","language","menu","menuitems","menuitem","menuitem_flags", +"menuitem_flag","menuex","menuexitems","menuexitem","messagetable","rcdata", +"optrcdata_data","@29","optrcdata_data_int","rcdata_data","stringtable","@30", +"string_data","user","versioninfo","fixedverinfo","verblocks","vervals","vertrans", +"id","suboptions","memflags_move_discard","memflags_move","memflag","file_name", +"styleexpr","parennumber","optcnumexpr","cnumexpr","numexpr","sizednumexpr", +"cposnumexpr","posnumexpr","sizedposnumexpr", NULL +}; +#endif + +static const short yyr1[] = { 0, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 99, 100, 101, 101, 102, + 102, 103, 103, 104, 104, 104, 105, 105, 105, 105, + 105, 105, 106, 107, 109, 108, 110, 108, 111, 108, + 112, 112, 113, 113, 113, 114, 113, 113, 113, 113, + 113, 113, 113, 113, 115, 115, 117, 116, 118, 116, + 119, 116, 120, 116, 121, 116, 122, 116, 116, 116, + 123, 116, 124, 116, 125, 116, 126, 116, 127, 116, + 116, 116, 116, 128, 116, 129, 116, 130, 116, 131, + 116, 132, 116, 133, 116, 134, 116, 135, 116, 136, + 116, 137, 116, 138, 138, 138, 139, 139, 140, 140, + 142, 141, 144, 143, 146, 145, 147, 148, 149, 150, + 151, 151, 152, 152, 152, 153, 153, 153, 154, 154, + 154, 154, 154, 154, 155, 156, 156, 157, 157, 157, + 157, 157, 157, 157, 158, 159, 161, 160, 162, 162, + 163, 163, 163, 163, 165, 164, 166, 166, 166, 167, + 167, 168, 169, 169, 169, 169, 169, 169, 169, 169, + 170, 170, 170, 171, 171, 172, 172, 173, 173, 174, + 174, 174, 174, 174, 175, 175, 176, 176, 177, 177, + 177, 177, 177, 177, 177, 178, 178, 179, 179, 179, + 179, 180, 180, 181, 181, 182, 183, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, + 186, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187 +}; + +static const short yyr2[] = { 0, + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 0, 6, 0, 2, 2, + 4, 1, 1, 1, 3, 2, 1, 1, 1, 1, + 1, 1, 4, 4, 0, 13, 0, 13, 0, 14, + 0, 3, 0, 3, 3, 0, 4, 3, 5, 7, + 3, 3, 4, 3, 0, 2, 0, 3, 0, 3, + 0, 3, 0, 3, 0, 3, 0, 3, 11, 12, + 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, + 6, 10, 11, 0, 3, 0, 3, 0, 3, 0, + 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, + 3, 0, 16, 7, 9, 10, 0, 2, 0, 3, + 0, 3, 0, 3, 0, 3, 4, 4, 3, 6, + 0, 2, 4, 2, 6, 0, 3, 2, 1, 1, + 1, 1, 1, 1, 6, 0, 2, 2, 3, 5, + 5, 6, 7, 9, 4, 6, 0, 2, 0, 1, + 1, 1, 3, 3, 0, 6, 0, 3, 4, 6, + 4, 6, 0, 6, 6, 3, 3, 3, 3, 3, + 0, 8, 7, 0, 5, 0, 3, 1, 1, 0, + 2, 3, 4, 3, 0, 2, 0, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 1, 3, 0, 1, 2, 1, 1, 3, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, + 1, 1, 3, 2, 3, 3, 3, 3, 3, 3, + 3, 3 +}; + +static const short yydefact[] = { 1, + 16, 0, 0, 180, 179, 222, 0, 0, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 0, 178, 221, 208, 0, 0, 0, 0, + 207, 0, 224, 0, 180, 185, 185, 185, 185, 185, + 185, 180, 180, 185, 180, 163, 180, 0, 0, 0, + 0, 0, 0, 0, 0, 211, 210, 0, 0, 119, + 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, + 0, 0, 189, 190, 191, 192, 193, 194, 195, 181, + 223, 0, 0, 0, 0, 41, 41, 0, 0, 0, + 0, 0, 0, 0, 0, 232, 231, 230, 228, 229, + 225, 226, 227, 209, 206, 219, 218, 217, 215, 216, + 212, 213, 214, 157, 0, 182, 184, 18, 186, 196, + 197, 33, 186, 34, 0, 0, 0, 117, 118, 121, + 136, 145, 147, 171, 0, 0, 0, 0, 0, 0, + 0, 147, 161, 0, 183, 0, 0, 0, 0, 0, + 0, 0, 149, 0, 0, 0, 166, 167, 168, 169, + 170, 0, 156, 0, 17, 22, 19, 0, 23, 42, + 0, 0, 120, 0, 0, 122, 135, 0, 0, 137, + 146, 151, 148, 150, 152, 162, 0, 0, 0, 0, + 160, 158, 0, 0, 20, 0, 0, 124, 0, 126, + 138, 0, 0, 0, 0, 0, 0, 159, 220, 0, + 35, 37, 126, 0, 139, 136, 0, 153, 154, 0, + 0, 164, 165, 27, 28, 29, 30, 31, 32, 21, + 24, 43, 43, 39, 123, 121, 129, 130, 131, 132, + 133, 134, 0, 128, 204, 0, 136, 0, 174, 176, + 0, 26, 0, 0, 43, 0, 127, 140, 205, 141, + 0, 136, 204, 0, 0, 25, 55, 0, 0, 0, + 46, 0, 0, 0, 0, 0, 55, 0, 125, 142, + 0, 0, 0, 0, 173, 0, 0, 48, 44, 45, + 0, 0, 0, 52, 54, 51, 0, 55, 143, 136, + 172, 0, 177, 36, 107, 57, 59, 61, 65, 67, + 71, 73, 75, 77, 86, 88, 90, 92, 94, 96, + 98, 100, 0, 63, 79, 84, 107, 56, 0, 202, + 0, 47, 198, 0, 53, 38, 0, 0, 0, 0, + 0, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 0, 107, + 107, 107, 0, 199, 0, 0, 49, 40, 144, 175, + 108, 0, 58, 0, 60, 62, 66, 68, 72, 74, + 76, 78, 87, 89, 91, 93, 95, 97, 99, 101, + 0, 64, 80, 85, 0, 203, 0, 200, 0, 0, + 0, 0, 0, 201, 50, 111, 0, 0, 0, 109, + 0, 0, 0, 0, 147, 81, 0, 112, 0, 0, + 0, 0, 0, 0, 109, 0, 110, 113, 204, 204, + 115, 104, 204, 0, 0, 109, 205, 109, 205, 0, + 109, 205, 0, 114, 82, 109, 69, 109, 116, 105, + 109, 0, 83, 70, 106, 0, 102, 0, 204, 103, + 0, 0 +}; + +static const short yydefgoto[] = { 1, + 2, 9, 146, 167, 168, 230, 231, 10, 11, 12, + 232, 233, 255, 126, 253, 291, 287, 328, 342, 343, + 344, 360, 345, 346, 347, 348, 349, 350, 361, 362, + 351, 352, 353, 354, 355, 356, 357, 358, 458, 373, + 374, 416, 407, 411, 429, 435, 433, 440, 13, 14, + 15, 16, 150, 176, 214, 244, 17, 151, 180, 18, + 19, 152, 153, 183, 184, 20, 114, 144, 21, 22, + 94, 154, 264, 265, 23, 32, 83, 84, 80, 122, + 332, 333, 258, 259, 30, 31, 195, 24, 25 +}; + +static const short yypact[] = {-32768, + 41, 97, 496,-32768,-32768,-32768, 496, 496,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 149,-32768, 419,-32768, 496, 496, 496, -49, + 456, 214,-32768, 533,-32768, -75,-32768, -12, -12,-32768, +-32768,-32768,-32768, -75,-32768,-32768,-32768, 496, 496, 496, + 496, 496, 496, 496, 496,-32768,-32768, 547, 496,-32768, + 496, 496, 496, 496, 496, 496, 496, 496,-32768, 496, + 496, 496,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, 234, 583, 2, 573, 95, 95, 573, 573, 257, + 277, 2, 341, 295, 195, 577, 366, 538, 163, 163, +-32768,-32768,-32768,-32768,-32768, 577, 366, 538, 163, 163, +-32768,-32768,-32768,-32768, -49,-32768,-32768,-32768, 53,-32768, +-32768,-32768,-32768,-32768, 33, 123, 123,-32768,-32768,-32768, +-32768,-32768,-32768,-32768, 496, 496, 496, 496, 496, 496, + 496,-32768,-32768, 14,-32768, 17, 496, -49, -49, 38, + 100, 127, 231, 55, -49, -49,-32768,-32768,-32768,-32768, +-32768, 132,-32768, -77,-32768,-32768,-32768, 45,-32768,-32768, + -49, -49,-32768, 66, 63,-32768,-32768, 64, 67,-32768, +-32768,-32768,-32768, 76, 456,-32768, 171, 180, -49, -49, +-32768,-32768, 106, 123, 98, -49, -49,-32768, -49,-32768, + -49, 6, 309, 128, 131, -49, -49,-32768,-32768, 663, +-32768, -49,-32768, 20, -49,-32768, 9,-32768, 456, 205, + 136,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 26, +-32768,-32768,-32768,-32768, 376,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 624,-32768, -49, 125,-32768, 13,-32768,-32768, + 663,-32768, 405, 417,-32768, 154,-32768,-32768,-32768,-32768, + 164,-32768, -49, 7, 11,-32768,-32768, 496, 144, 169, +-32768, 496, 496, 496, 496, 169,-32768, 423,-32768,-32768, + 184, 230, 232, 162,-32768, -49, 455,-32768,-32768,-32768, + -39, 153, -49,-32768,-32768,-32768, 492,-32768,-32768,-32768, +-32768, 168,-32768,-32768, 186,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 201,-32768,-32768,-32768, 186,-32768, 34,-32768, + 496, 159,-32768, 202,-32768,-32768, 529, 196, 203, 170, + 496, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 190, 186, + 186, 186, 496,-32768, 151, 115, -49,-32768,-32768,-32768, +-32768, -49,-32768, 496,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 496,-32768,-32768,-32768, -49,-32768, 34,-32768, -49, 200, + -49, 209, -49,-32768,-32768,-32768, -49, -49, 496, 27, + -39, -49, -49, 210,-32768,-32768, -49, 159, -49, -49, + 496, 301, 221, -49, 28, 222,-32768,-32768, -49, -49, +-32768,-32768, -49, 496, -39, 296, -49, 296, -49, -39, + 296, -49, 224, 159,-32768, 296,-32768, 296, 159,-32768, + 296, 496,-32768,-32768,-32768, 244,-32768, -39, -38,-32768, + 324,-32768 +}; + +static const short yypgoto[] = {-32768, +-32768,-32768,-32768,-32768,-32768,-32768, -172,-32768,-32768,-32768, +-32768,-32768,-32768, 238, -211,-32768, -160,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 254, + -267, 145,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 90,-32768, 134, 105,-32768, -135,-32768,-32768, +-32768, -141,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768, -21, 178, 256, 113, 491, 251, + -303, -319, -249, -30, -46, 0,-32768, -107,-32768 +}; + + +#define YYLAST 680 + + +static const short yytable[] = { 60, + 162, 47, 192, -187, -187, -187, 33, 34, 216, 364, + 283, 247, 105, 282, 285, 262, 193, 163, 148, 149, + 165, 254, 236, 115, 116, 117, 56, 57, 58, 415, + 415, 224, 225, 226, 227, 228, 229, 341, 169, 329, + 461, 173, 330, 278, 59, 366, 398, 96, 97, 98, + 99, 100, 101, 102, 103, 59, 331, 252, 186, 363, + 106, 107, 108, 109, 110, 111, 112, 113, -188, -187, + 237, 238, 239, 240, 241, 242, 284, 404, 266, -187, + 246, 120, 121, -187, 145, 174, 209, 175, 155, 156, + 157, 158, 159, 160, 161, 26, 166, 164, 6, 59, + 170, 27, 59, 177, 59, 28, 59, 418, 7, 29, + 125, 261, 8, 243, 198, 330, 297, 171, 172, 251, + 59, 431, 187, 188, 189, 190, 281, 147, 260, 331, + 181, 444, -188, -188, -188, 191, 449, 337, 194, 3, + 196, 197, 200, 201, -188, 199, 202, 178, -188, 179, + 86, 87, 185, 35, 459, 4, 92, 279, 206, 207, + 36, 37, 38, 39, 338, 211, 212, 280, 213, 203, + 215, 217, 178, 204, 179, 222, 223, 5, 6, 436, + 438, 234, 205, 441, 245, 208, 248, 299, 7, 40, + 41, 210, 8, 397, 42, 43, 330, 142, 220, 369, + 221, 174, 219, 175, 6, 44, 45, 249, 46, 460, + 331, 178, 82, 179, 7, 250, 69, 263, 8, 90, + 91, 288, 93, 289, 95, 292, 293, 294, 295, 5, + 6, 178, 300, 179, 286, 301, 118, 70, 71, 72, + 7, 302, 366, 178, 8, 179, 334, 396, 290, 5, + 6, 66, 67, 68, 296, 303, 70, 71, 72, 130, + 7, 339, 335, 371, 8, 340, 73, 74, 75, 76, + 77, 78, 79, 422, 120, 121, 70, 71, 72, 131, + 359, 367, 370, 391, 365, 73, 74, 75, 76, 77, + 78, 79, 85, 406, 372, 88, 89, 134, 415, 70, + 71, 72, 409, 421, 427, 73, 74, 75, 76, 77, + 78, 79, 26, 182, 428, 434, 395, 452, 27, 70, + 71, 72, 28, 462, 127, 256, 29, 401, 73, 74, + 75, 76, 77, 78, 79, 124, 399, 457, 128, 129, + 0, 400, 132, 133, 402, 143, 235, 257, 73, 74, + 75, 76, 77, 78, 79, 135, 136, 137, 138, 139, + 140, 141, 414, 0, 403, 0, 0, 0, 405, 0, + 408, 0, 410, 0, 426, 0, 412, 413, 0, 417, + 0, 419, 420, 70, 71, 72, 423, 443, 424, 425, + 26, 218, 0, 430, 0, 0, 27, 0, 437, 439, + 28, 0, 442, 0, 29, 456, 446, 267, 448, 0, + 0, 451, 73, 74, 75, 76, 77, 78, 79, 277, + 268, 269, 270, 271, 0, 298, 237, 238, 239, 240, + 241, 242, 268, 269, 270, 271, 0, 0, 268, 269, + 270, 271, 0, 0, 0, 272, 0, 273, 274, 275, + 276, 63, 64, 65, 66, 67, 68, 272, 304, 273, + 274, 275, 276, 272, 305, 273, 274, 275, 276, 243, + 0, 0, 0, 0, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 336, 327, 0, 0, 0, + 0, 305, 48, 49, 50, 51, 52, 53, 54, 55, + 0, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 368, 327, 0, 0, 0, 0, 305, 61, + 62, 63, 64, 65, 66, 67, 68, 0, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 432, + 327, 0, 0, 119, 0, 123, 0, 26, 123, 123, + 445, 0, 447, 27, 0, 450, 0, 28, 0, 0, + 453, 29, 454, 0, 0, 455, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, + 389, 390, 0, 392, 393, 394, 61, 62, 63, 64, + 65, 66, 67, 68, 64, 65, 66, 67, 68, 81, + 61, 62, 63, 64, 65, 66, 67, 68, 0, 0, + 0, 0, 0, 104, 73, 74, 75, 76, 77, 78, + 79, 0, 120, 121, 73, 74, 75, 76, 77, 78, + 79, 62, 63, 64, 65, 66, 67, 68, 224, 225, + 226, 227, 228, 229, 237, 238, 239, 240, 241, 242 +}; + +static const short yycheck[] = { 30, + 142, 23, 80, 16, 80, 81, 7, 8, 3, 329, + 4, 3, 59, 263, 4, 3, 94, 4, 126, 127, + 4, 233, 3, 70, 71, 72, 27, 28, 29, 3, + 3, 6, 7, 8, 9, 10, 11, 305, 146, 79, + 0, 4, 82, 255, 94, 84, 366, 48, 49, 50, + 51, 52, 53, 54, 55, 94, 96, 230, 4, 327, + 61, 62, 63, 64, 65, 66, 67, 68, 16, 82, + 51, 52, 53, 54, 55, 56, 70, 397, 251, 92, + 216, 80, 81, 96, 115, 48, 194, 50, 135, 136, + 137, 138, 139, 140, 141, 82, 80, 144, 82, 94, + 147, 88, 94, 4, 94, 92, 94, 411, 92, 96, + 16, 247, 96, 94, 49, 82, 277, 148, 149, 94, + 94, 94, 68, 69, 155, 156, 262, 95, 4, 96, + 4, 435, 80, 81, 82, 4, 440, 298, 94, 43, + 171, 172, 80, 80, 92, 80, 80, 48, 96, 50, + 38, 39, 153, 5, 458, 59, 44, 4, 189, 190, + 12, 13, 14, 15, 300, 196, 197, 4, 199, 94, + 201, 202, 48, 3, 50, 206, 207, 81, 82, 429, + 430, 212, 3, 433, 215, 80, 217, 4, 92, 41, + 42, 94, 96, 79, 46, 47, 82, 3, 71, 4, + 70, 48, 203, 50, 82, 57, 58, 3, 60, 459, + 96, 48, 35, 50, 92, 80, 3, 248, 96, 42, + 43, 268, 45, 80, 47, 272, 273, 274, 275, 81, + 82, 48, 3, 50, 265, 4, 3, 43, 44, 45, + 92, 80, 84, 48, 96, 50, 94, 97, 270, 81, + 82, 89, 90, 91, 276, 286, 43, 44, 45, 3, + 92, 94, 293, 94, 96, 80, 72, 73, 74, 75, + 76, 77, 78, 415, 80, 81, 43, 44, 45, 3, + 80, 80, 80, 94, 331, 72, 73, 74, 75, 76, + 77, 78, 37, 94, 341, 40, 41, 3, 3, 43, + 44, 45, 94, 94, 4, 72, 73, 74, 75, 76, + 77, 78, 82, 83, 94, 94, 363, 94, 88, 43, + 44, 45, 92, 0, 87, 236, 96, 374, 72, 73, + 74, 75, 76, 77, 78, 85, 367, 94, 88, 89, + -1, 372, 92, 3, 391, 95, 213, 243, 72, 73, + 74, 75, 76, 77, 78, 61, 62, 63, 64, 65, + 66, 67, 409, -1, 395, -1, -1, -1, 399, -1, + 401, -1, 403, -1, 421, -1, 407, 408, -1, 410, + -1, 412, 413, 43, 44, 45, 417, 434, 419, 420, + 82, 83, -1, 424, -1, -1, 88, -1, 429, 430, + 92, -1, 433, -1, 96, 452, 437, 3, 439, -1, + -1, 442, 72, 73, 74, 75, 76, 77, 78, 3, + 16, 17, 18, 19, -1, 3, 51, 52, 53, 54, + 55, 56, 16, 17, 18, 19, -1, -1, 16, 17, + 18, 19, -1, -1, -1, 41, -1, 43, 44, 45, + 46, 86, 87, 88, 89, 90, 91, 41, 4, 43, + 44, 45, 46, 41, 10, 43, 44, 45, 46, 94, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 4, 42, -1, -1, -1, + -1, 10, 84, 85, 86, 87, 88, 89, 90, 91, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 4, 42, -1, -1, -1, -1, 10, 84, + 85, 86, 87, 88, 89, 90, 91, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 425, + 42, -1, -1, 83, -1, 85, -1, 82, 88, 89, + 436, -1, 438, 88, -1, 441, -1, 92, -1, -1, + 446, 96, 448, -1, -1, 451, 343, 344, 345, 346, + 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + 357, 358, -1, 360, 361, 362, 84, 85, 86, 87, + 88, 89, 90, 91, 87, 88, 89, 90, 91, 97, + 84, 85, 86, 87, 88, 89, 90, 91, -1, -1, + -1, -1, -1, 97, 72, 73, 74, 75, 76, 77, + 78, -1, 80, 81, 72, 73, 74, 75, 76, 77, + 78, 85, 86, 87, 88, 89, 90, 91, 6, 7, + 8, 9, 10, 11, 51, 52, 53, 54, 55, 56 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/cygnus/progressive-97r2/share/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include <alloca.h> +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include <malloc.h> +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include <malloc.h> + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 196 "/usr/cygnus/progressive-97r2/share/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 16: +#line 174 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + rcparse_discard_strings (); + ; + break;} +case 17: +#line 183 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_accelerator (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].pacc); + ; + break;} +case 18: +#line 190 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.pacc = NULL; + ; + break;} +case 19: +#line 194 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + struct accelerator *a; + + a = (struct accelerator *) res_alloc (sizeof *a); + *a = yyvsp[0].acc; + if (yyvsp[-1].pacc == NULL) + yyval.pacc = a; + else + { + struct accelerator **pp; + + for (pp = &yyvsp[-1].pacc->next; *pp != NULL; pp = &(*pp)->next) + ; + *pp = a; + yyval.pacc = yyvsp[-1].pacc; + } + ; + break;} +case 20: +#line 215 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.acc = yyvsp[-1].acc; + yyval.acc.id = yyvsp[0].il; + ; + break;} +case 21: +#line 220 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.acc = yyvsp[-3].acc; + yyval.acc.id = yyvsp[-2].il; + yyval.acc.flags |= yyvsp[0].is; + if ((yyval.acc.flags & ACC_VIRTKEY) == 0 + && (yyval.acc.flags & (ACC_SHIFT | ACC_CONTROL | ACC_ALT)) != 0) + rcparse_warning ("inappropriate modifiers for non-VIRTKEY"); + ; + break;} +case 22: +#line 232 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + const char *s = yyvsp[0].s; + char ch; + + yyval.acc.next = NULL; + yyval.acc.id = 0; + ch = *s; + if (ch != '^') + yyval.acc.flags = 0; + else + { + yyval.acc.flags = ACC_CONTROL | ACC_VIRTKEY; + ++s; + ch = *s; + ch = toupper ((unsigned char) ch); + } + yyval.acc.key = ch; + if (s[1] != '\0') + rcparse_warning ("accelerator should only be one character"); + ; + break;} +case 23: +#line 253 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.acc.next = NULL; + yyval.acc.flags = 0; + yyval.acc.id = 0; + yyval.acc.key = yyvsp[0].il; + ; + break;} +case 24: +#line 263 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = yyvsp[0].is; + ; + break;} +case 25: +#line 267 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = yyvsp[-2].is | yyvsp[0].is; + ; + break;} +case 26: +#line 272 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = yyvsp[-1].is | yyvsp[0].is; + ; + break;} +case 27: +#line 279 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = ACC_VIRTKEY; + ; + break;} +case 28: +#line 283 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + /* This is just the absence of VIRTKEY. */ + yyval.is = 0; + ; + break;} +case 29: +#line 288 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = ACC_NOINVERT; + ; + break;} +case 30: +#line 292 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = ACC_SHIFT; + ; + break;} +case 31: +#line 296 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = ACC_CONTROL; + ; + break;} +case 32: +#line 300 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = ACC_ALT; + ; + break;} +case 33: +#line 309 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_bitmap (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + ; + break;} +case 34: +#line 318 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_cursor (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + ; + break;} +case 35: +#line 328 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + memset (&dialog, 0, sizeof dialog); + dialog.x = yyvsp[-3].il; + dialog.y = yyvsp[-2].il; + dialog.width = yyvsp[-1].il; + dialog.height = yyvsp[0].il; + dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU; + dialog.exstyle = yyvsp[-4].il; + dialog.menu.named = 1; + dialog.class.named = 1; + dialog.font = NULL; + dialog.ex = NULL; + dialog.controls = NULL; + sub_res_info = yyvsp[-5].res_info; + ; + break;} +case 36: +#line 344 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_dialog (yyvsp[-12].id, &sub_res_info, &dialog); + ; + break;} +case 37: +#line 349 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + memset (&dialog, 0, sizeof dialog); + dialog.x = yyvsp[-3].il; + dialog.y = yyvsp[-2].il; + dialog.width = yyvsp[-1].il; + dialog.height = yyvsp[0].il; + dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU; + dialog.exstyle = yyvsp[-4].il; + dialog.menu.named = 1; + dialog.class.named = 1; + dialog.font = NULL; + dialog.ex = ((struct dialog_ex *) + res_alloc (sizeof (struct dialog_ex))); + memset (dialog.ex, 0, sizeof (struct dialog_ex)); + dialog.controls = NULL; + sub_res_info = yyvsp[-5].res_info; + ; + break;} +case 38: +#line 367 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_dialog (yyvsp[-12].id, &sub_res_info, &dialog); + ; + break;} +case 39: +#line 372 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + memset (&dialog, 0, sizeof dialog); + dialog.x = yyvsp[-4].il; + dialog.y = yyvsp[-3].il; + dialog.width = yyvsp[-2].il; + dialog.height = yyvsp[-1].il; + dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU; + dialog.exstyle = yyvsp[-5].il; + dialog.menu.named = 1; + dialog.class.named = 1; + dialog.font = NULL; + dialog.ex = ((struct dialog_ex *) + res_alloc (sizeof (struct dialog_ex))); + memset (dialog.ex, 0, sizeof (struct dialog_ex)); + dialog.ex->help = yyvsp[0].il; + dialog.controls = NULL; + sub_res_info = yyvsp[-6].res_info; + ; + break;} +case 40: +#line 391 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_dialog (yyvsp[-13].id, &sub_res_info, &dialog); + ; + break;} +case 41: +#line 398 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = 0; + ; + break;} +case 42: +#line 402 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].il; + ; + break;} +case 44: +#line 410 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + unicode_from_ascii ((int *) NULL, &dialog.caption, yyvsp[0].s); + ; + break;} +case 45: +#line 414 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + dialog.class = yyvsp[0].id; + ; + break;} +case 46: +#line 418 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ style = dialog.style; ; + break;} +case 47: +#line 420 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + dialog.style = style; + ; + break;} +case 48: +#line 424 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + dialog.exstyle = yyvsp[0].il; + ; + break;} +case 49: +#line 428 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + dialog.style |= DS_SETFONT; + dialog.pointsize = yyvsp[-2].il; + unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[0].s); + ; + break;} +case 50: +#line 434 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + dialog.style |= DS_SETFONT; + dialog.pointsize = yyvsp[-4].il; + unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-2].s); + if (dialog.ex == NULL) + rcparse_warning ("extended FONT requires DIALOGEX"); + else + { + dialog.ex->weight = yyvsp[-1].il; + dialog.ex->italic = yyvsp[0].il; + } + ; + break;} +case 51: +#line 447 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + dialog.menu = yyvsp[0].id; + ; + break;} +case 52: +#line 451 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + sub_res_info.characteristics = yyvsp[0].il; + ; + break;} +case 53: +#line 455 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + sub_res_info.language = yyvsp[-1].il | (yyvsp[0].il << 8); + ; + break;} +case 54: +#line 459 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + sub_res_info.version = yyvsp[0].il; + ; + break;} +case 56: +#line 467 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + struct dialog_control **pp; + + for (pp = &dialog.controls; *pp != NULL; pp = &(*pp)->next) + ; + *pp = yyvsp[0].dialog_control; + ; + break;} +case 57: +#line 478 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_AUTO3STATE | WS_TABSTOP; + base_style = BS_AUTO3STATE; + class = CTL_BUTTON; + ; + break;} +case 58: +#line 484 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 59: +#line 488 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_AUTOCHECKBOX | WS_TABSTOP; + base_style = BS_AUTOCHECKBOX; + class = CTL_BUTTON; + ; + break;} +case 60: +#line 494 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 61: +#line 498 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_AUTORADIOBUTTON | WS_TABSTOP; + base_style = BS_AUTORADIOBUTTON; + class = CTL_BUTTON; + ; + break;} +case 62: +#line 504 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 63: +#line 508 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + ; + break;} +case 64: +#line 514 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + if (dialog.ex == NULL) + rcparse_warning ("IEDIT requires DIALOGEX"); + res_string_to_id (&yyval.dialog_control->class, "BEDIT"); + ; + break;} +case 65: +#line 521 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_CHECKBOX | WS_TABSTOP; + base_style = BS_CHECKBOX | WS_TABSTOP; + class = CTL_BUTTON; + ; + break;} +case 66: +#line 527 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 67: +#line 531 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = CBS_SIMPLE | WS_TABSTOP; + base_style = 0; + class = CTL_COMBOBOX; + ; + break;} +case 68: +#line 537 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 69: +#line 542 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-7].il, style, yyvsp[-1].il); + if (yyvsp[0].rcdata_item != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + yyval.dialog_control->data = yyvsp[0].rcdata_item; + } + ; + break;} +case 70: +#line 553 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-8].il, style, yyvsp[-2].il); + if (dialog.ex == NULL) + rcparse_warning ("help ID requires DIALOGEX"); + yyval.dialog_control->help = yyvsp[-1].il; + yyval.dialog_control->data = yyvsp[0].rcdata_item; + ; + break;} +case 71: +#line 561 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = SS_CENTER | WS_GROUP; + base_style = SS_CENTER; + class = CTL_STATIC; + ; + break;} +case 72: +#line 567 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 73: +#line 571 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_DEFPUSHBUTTON | WS_TABSTOP; + base_style = BS_DEFPUSHBUTTON | WS_TABSTOP; + class = CTL_BUTTON; + ; + break;} +case 74: +#line 577 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 75: +#line 581 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + ; + break;} +case 76: +#line 587 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 77: +#line 591 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_GROUPBOX; + base_style = BS_GROUPBOX; + class = CTL_BUTTON; + ; + break;} +case 78: +#line 597 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 79: +#line 601 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + ; + break;} +case 80: +#line 607 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + if (dialog.ex == NULL) + rcparse_warning ("IEDIT requires DIALOGEX"); + res_string_to_id (&yyval.dialog_control->class, "HEDIT"); + ; + break;} +case 81: +#line 614 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-4].s, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, 0, 0, CTL_STATIC, + SS_ICON | WS_CHILD | WS_VISIBLE, 0); + if (yyvsp[0].rcdata_item != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + yyval.dialog_control->data = yyvsp[0].rcdata_item; + } + ; + break;} +case 82: +#line 626 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-8].s, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, CTL_STATIC, + style, yyvsp[-1].il); + if (yyvsp[0].rcdata_item != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + yyval.dialog_control->data = yyvsp[0].rcdata_item; + } + ; + break;} +case 83: +#line 638 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, CTL_STATIC, + style, yyvsp[-2].il); + if (dialog.ex == NULL) + rcparse_warning ("help ID requires DIALOGEX"); + yyval.dialog_control->help = yyvsp[-1].il; + yyval.dialog_control->data = yyvsp[0].rcdata_item; + ; + break;} +case 84: +#line 647 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + ; + break;} +case 85: +#line 653 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + if (dialog.ex == NULL) + rcparse_warning ("IEDIT requires DIALOGEX"); + res_string_to_id (&yyval.dialog_control->class, "IEDIT"); + ; + break;} +case 86: +#line 660 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = LBS_NOTIFY | WS_BORDER; + base_style = LBS_NOTIFY | WS_BORDER; + class = CTL_LISTBOX; + ; + break;} +case 87: +#line 666 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 88: +#line 670 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = SS_LEFT | WS_GROUP; + base_style = SS_LEFT; + class = CTL_STATIC; + ; + break;} +case 89: +#line 676 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 90: +#line 680 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_PUSHBOX | WS_TABSTOP; + base_style = BS_PUSHBOX; + class = CTL_BUTTON; + ; + break;} +case 91: +#line 686 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 92: +#line 690 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_PUSHBUTTON | WS_TABSTOP; + base_style = BS_PUSHBUTTON | WS_TABSTOP; + class = CTL_BUTTON; + ; + break;} +case 93: +#line 696 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 94: +#line 700 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_RADIOBUTTON | WS_TABSTOP; + base_style = BS_RADIOBUTTON; + class = CTL_BUTTON; + ; + break;} +case 95: +#line 706 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 96: +#line 710 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = SS_RIGHT | WS_GROUP; + base_style = SS_RIGHT; + class = CTL_STATIC; + ; + break;} +case 97: +#line 716 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 98: +#line 720 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = SBS_HORZ; + base_style = 0; + class = CTL_SCROLLBAR; + ; + break;} +case 99: +#line 726 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 100: +#line 730 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + default_style = BS_3STATE | WS_TABSTOP; + base_style = BS_3STATE; + class = CTL_BUTTON; + ; + break;} +case 101: +#line 736 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = yyvsp[0].dialog_control; + ; + break;} +case 102: +#line 741 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ style = WS_CHILD | WS_VISIBLE; ; + break;} +case 103: +#line 743 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-14].s, yyvsp[-12].il, yyvsp[-10].il, yyvsp[-8].il, yyvsp[-6].il, yyvsp[-4].il, CTL_BUTTON, + style, yyvsp[0].il); + ; + break;} +case 104: +#line 759 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-6].s, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, class, + default_style | WS_CHILD | WS_VISIBLE, 0); + if (yyvsp[0].rcdata_item != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + yyval.dialog_control->data = yyvsp[0].rcdata_item; + } + ; + break;} +case 105: +#line 771 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-8].s, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, class, style, yyvsp[-1].il); + if (yyvsp[0].rcdata_item != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + yyval.dialog_control->data = yyvsp[0].rcdata_item; + } + ; + break;} +case 106: +#line 782 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, class, style, yyvsp[-2].il); + if (dialog.ex == NULL) + rcparse_warning ("help ID requires DIALOGEX"); + yyval.dialog_control->help = yyvsp[-1].il; + yyval.dialog_control->data = yyvsp[0].rcdata_item; + ; + break;} +case 107: +#line 793 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.s = NULL; + ; + break;} +case 108: +#line 797 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.s = yyvsp[-1].s; + ; + break;} +case 109: +#line 804 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.rcdata_item = NULL; + ; + break;} +case 110: +#line 808 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.rcdata_item = yyvsp[-1].rcdata.first; + ; + break;} +case 111: +#line 817 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ style = WS_CHILD | WS_VISIBLE; ; + break;} +case 113: +#line 823 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ style = SS_ICON | WS_CHILD | WS_VISIBLE; ; + break;} +case 115: +#line 829 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ style = base_style | WS_CHILD | WS_VISIBLE; ; + break;} +case 117: +#line 837 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_font (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + ; + break;} +case 118: +#line 846 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_icon (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + ; + break;} +case 119: +#line 856 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + language = yyvsp[-1].il | (yyvsp[0].il << 8); + ; + break;} +case 120: +#line 865 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem); + ; + break;} +case 121: +#line 872 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = NULL; + ; + break;} +case 122: +#line 876 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + if (yyvsp[-1].menuitem == NULL) + yyval.menuitem = yyvsp[0].menuitem; + else + { + struct menuitem **pp; + + for (pp = &yyvsp[-1].menuitem->next; *pp != NULL; pp = &(*pp)->next) + ; + *pp = yyvsp[0].menuitem; + yyval.menuitem = yyvsp[-1].menuitem; + } + ; + break;} +case 123: +#line 893 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-2].s, yyvsp[-1].il, yyvsp[0].is, 0, 0, NULL); + ; + break;} +case 124: +#line 897 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL); + ; + break;} +case 125: +#line 901 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-4].s, 0, yyvsp[-3].is, 0, 0, yyvsp[-1].menuitem); + ; + break;} +case 126: +#line 908 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = 0; + ; + break;} +case 127: +#line 912 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = yyvsp[-2].is | yyvsp[0].is; + ; + break;} +case 128: +#line 916 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = yyvsp[-1].is | yyvsp[0].is; + ; + break;} +case 129: +#line 923 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = MENUITEM_CHECKED; + ; + break;} +case 130: +#line 927 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = MENUITEM_GRAYED; + ; + break;} +case 131: +#line 931 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = MENUITEM_HELP; + ; + break;} +case 132: +#line 935 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = MENUITEM_INACTIVE; + ; + break;} +case 133: +#line 939 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = MENUITEM_MENUBARBREAK; + ; + break;} +case 134: +#line 943 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.is = MENUITEM_MENUBREAK; + ; + break;} +case 135: +#line 952 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem); + ; + break;} +case 136: +#line 959 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = NULL; + ; + break;} +case 137: +#line 963 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + if (yyvsp[-1].menuitem == NULL) + yyval.menuitem = yyvsp[0].menuitem; + else + { + struct menuitem **pp; + + for (pp = &yyvsp[-1].menuitem->next; *pp != NULL; pp = &(*pp)->next) + ; + *pp = yyvsp[0].menuitem; + yyval.menuitem = yyvsp[-1].menuitem; + } + ; + break;} +case 138: +#line 980 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[0].s, 0, 0, 0, 0, NULL); + ; + break;} +case 139: +#line 984 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-1].s, yyvsp[0].il, 0, 0, 0, NULL); + ; + break;} +case 140: +#line 988 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-3].s, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].il, 0, NULL); + ; + break;} +case 141: +#line 992 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-3].s, 0, 0, 0, 0, yyvsp[-1].menuitem); + ; + break;} +case 142: +#line 996 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-4].s, yyvsp[-3].il, 0, 0, 0, yyvsp[-1].menuitem); + ; + break;} +case 143: +#line 1000 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-5].s, yyvsp[-4].il, yyvsp[-3].il, 0, 0, yyvsp[-1].menuitem); + ; + break;} +case 144: +#line 1005 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.menuitem = define_menuitem (yyvsp[-7].s, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-1].menuitem); + ; + break;} +case 145: +#line 1014 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_messagetable (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + ; + break;} +case 146: +#line 1023 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_rcdata (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first); + ; + break;} +case 147: +#line 1032 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + rcparse_rcdata (); + ; + break;} +case 148: +#line 1036 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + rcparse_normal (); + yyval.rcdata = yyvsp[0].rcdata; + ; + break;} +case 149: +#line 1044 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.rcdata.first = NULL; + yyval.rcdata.last = NULL; + ; + break;} +case 150: +#line 1049 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.rcdata = yyvsp[0].rcdata; + ; + break;} +case 151: +#line 1056 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + struct rcdata_item *ri; + + ri = define_rcdata_string (yyvsp[0].ss.s, yyvsp[0].ss.length); + yyval.rcdata.first = ri; + yyval.rcdata.last = ri; + ; + break;} +case 152: +#line 1064 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + struct rcdata_item *ri; + + ri = define_rcdata_number (yyvsp[0].i.val, yyvsp[0].i.dword); + yyval.rcdata.first = ri; + yyval.rcdata.last = ri; + ; + break;} +case 153: +#line 1072 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + struct rcdata_item *ri; + + ri = define_rcdata_string (yyvsp[0].ss.s, yyvsp[0].ss.length); + yyval.rcdata.first = yyvsp[-2].rcdata.first; + yyvsp[-2].rcdata.last->next = ri; + yyval.rcdata.last = ri; + ; + break;} +case 154: +#line 1081 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + struct rcdata_item *ri; + + ri = define_rcdata_number (yyvsp[0].i.val, yyvsp[0].i.dword); + yyval.rcdata.first = yyvsp[-2].rcdata.first; + yyvsp[-2].rcdata.last->next = ri; + yyval.rcdata.last = ri; + ; + break;} +case 155: +#line 1095 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ sub_res_info = yyvsp[-1].res_info; ; + break;} +case 158: +#line 1102 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_stringtable (&sub_res_info, yyvsp[-1].il, yyvsp[0].s); + ; + break;} +case 159: +#line 1106 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_stringtable (&sub_res_info, yyvsp[-2].il, yyvsp[0].s); + ; + break;} +case 160: +#line 1116 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_user_data (yyvsp[-5].id, yyvsp[-4].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first); + ; + break;} +case 161: +#line 1120 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_user_file (yyvsp[-3].id, yyvsp[-2].id, &yyvsp[-1].res_info, yyvsp[0].s); + ; + break;} +case 162: +#line 1129 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + define_versioninfo (yyvsp[-5].id, language, yyvsp[-3].fixver, yyvsp[-1].verinfo); + ; + break;} +case 163: +#line 1136 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.fixver = ((struct fixed_versioninfo *) + res_alloc (sizeof (struct fixed_versioninfo))); + memset (yyval.fixver, 0, sizeof (struct fixed_versioninfo)); + ; + break;} +case 164: +#line 1142 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-5].fixver->file_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il; + yyvsp[-5].fixver->file_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il; + yyval.fixver = yyvsp[-5].fixver; + ; + break;} +case 165: +#line 1148 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-5].fixver->product_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il; + yyvsp[-5].fixver->product_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il; + yyval.fixver = yyvsp[-5].fixver; + ; + break;} +case 166: +#line 1154 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-2].fixver->file_flags_mask = yyvsp[0].il; + yyval.fixver = yyvsp[-2].fixver; + ; + break;} +case 167: +#line 1159 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-2].fixver->file_flags = yyvsp[0].il; + yyval.fixver = yyvsp[-2].fixver; + ; + break;} +case 168: +#line 1164 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-2].fixver->file_os = yyvsp[0].il; + yyval.fixver = yyvsp[-2].fixver; + ; + break;} +case 169: +#line 1169 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-2].fixver->file_type = yyvsp[0].il; + yyval.fixver = yyvsp[-2].fixver; + ; + break;} +case 170: +#line 1174 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyvsp[-2].fixver->file_subtype = yyvsp[0].il; + yyval.fixver = yyvsp[-2].fixver; + ; + break;} +case 171: +#line 1188 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.verinfo = NULL; + ; + break;} +case 172: +#line 1192 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.verinfo = append_ver_stringfileinfo (yyvsp[-7].verinfo, yyvsp[-4].s, yyvsp[-2].verstring); + ; + break;} +case 173: +#line 1196 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.verinfo = append_ver_varfileinfo (yyvsp[-6].verinfo, yyvsp[-2].s, yyvsp[-1].vervar); + ; + break;} +case 174: +#line 1203 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.verstring = NULL; + ; + break;} +case 175: +#line 1207 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.verstring = append_verval (yyvsp[-4].verstring, yyvsp[-2].s, yyvsp[0].s); + ; + break;} +case 176: +#line 1214 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.vervar = NULL; + ; + break;} +case 177: +#line 1218 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.vervar = append_vertrans (yyvsp[-2].vervar, yyvsp[-1].il, yyvsp[0].il); + ; + break;} +case 178: +#line 1227 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.id.named = 0; + yyval.id.u.id = yyvsp[0].il; + ; + break;} +case 179: +#line 1232 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + char *copy, *s; + + /* It seems that resource ID's are forced to upper case. */ + copy = xstrdup (yyvsp[0].s); + for (s = copy; *s != '\0'; s++) + if (islower (*s)) + *s = toupper (*s); + res_string_to_id (&yyval.id, copy); + free (copy); + ; + break;} +case 180: +#line 1250 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + memset (&yyval.res_info, 0, sizeof (struct res_res_info)); + yyval.res_info.language = language; + /* FIXME: Is this the right default? */ + yyval.res_info.memflags = MEMFLAG_MOVEABLE; + ; + break;} +case 181: +#line 1257 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.res_info = yyvsp[-1].res_info; + yyval.res_info.memflags |= yyvsp[0].memflags.on; + yyval.res_info.memflags &=~ yyvsp[0].memflags.off; + ; + break;} +case 182: +#line 1263 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.res_info = yyvsp[-2].res_info; + yyval.res_info.characteristics = yyvsp[0].il; + ; + break;} +case 183: +#line 1268 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.res_info = yyvsp[-3].res_info; + yyval.res_info.language = yyvsp[-1].il | (yyvsp[0].il << 8); + ; + break;} +case 184: +#line 1273 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.res_info = yyvsp[-2].res_info; + yyval.res_info.version = yyvsp[0].il; + ; + break;} +case 185: +#line 1283 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + memset (&yyval.res_info, 0, sizeof (struct res_res_info)); + yyval.res_info.language = language; + yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE; + ; + break;} +case 186: +#line 1289 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.res_info = yyvsp[-1].res_info; + yyval.res_info.memflags |= yyvsp[0].memflags.on; + yyval.res_info.memflags &=~ yyvsp[0].memflags.off; + ; + break;} +case 187: +#line 1300 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + memset (&yyval.res_info, 0, sizeof (struct res_res_info)); + yyval.res_info.language = language; + yyval.res_info.memflags = MEMFLAG_MOVEABLE; + ; + break;} +case 188: +#line 1306 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.res_info = yyvsp[-1].res_info; + yyval.res_info.memflags |= yyvsp[0].memflags.on; + yyval.res_info.memflags &=~ yyvsp[0].memflags.off; + ; + break;} +case 189: +#line 1318 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = MEMFLAG_MOVEABLE; + yyval.memflags.off = 0; + ; + break;} +case 190: +#line 1323 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = 0; + yyval.memflags.off = MEMFLAG_MOVEABLE; + ; + break;} +case 191: +#line 1328 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = MEMFLAG_PURE; + yyval.memflags.off = 0; + ; + break;} +case 192: +#line 1333 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = 0; + yyval.memflags.off = MEMFLAG_PURE; + ; + break;} +case 193: +#line 1338 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = MEMFLAG_PRELOAD; + yyval.memflags.off = 0; + ; + break;} +case 194: +#line 1343 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = 0; + yyval.memflags.off = MEMFLAG_PRELOAD; + ; + break;} +case 195: +#line 1348 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.memflags.on = MEMFLAG_DISCARDABLE; + yyval.memflags.off = 0; + ; + break;} +case 196: +#line 1358 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.s = yyvsp[0].s; + ; + break;} +case 197: +#line 1362 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.s = yyvsp[0].s; + ; + break;} +case 198: +#line 1379 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + style |= yyvsp[0].il; + ; + break;} +case 199: +#line 1383 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + style &=~ yyvsp[0].il; + ; + break;} +case 200: +#line 1387 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + style |= yyvsp[0].il; + ; + break;} +case 201: +#line 1391 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + style &=~ yyvsp[0].il; + ; + break;} +case 202: +#line 1398 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].i.val; + ; + break;} +case 203: +#line 1402 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[-1].il; + ; + break;} +case 204: +#line 1411 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = 0; + ; + break;} +case 205: +#line 1415 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].il; + ; + break;} +case 206: +#line 1424 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].il; + ; + break;} +case 207: +#line 1433 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].i.val; + ; + break;} +case 208: +#line 1442 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i = yyvsp[0].i; + ; + break;} +case 209: +#line 1446 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i = yyvsp[-1].i; + ; + break;} +case 210: +#line 1450 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = ~ yyvsp[0].i.val; + yyval.i.dword = yyvsp[0].i.dword; + ; + break;} +case 211: +#line 1455 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = - yyvsp[0].i.val; + yyval.i.dword = yyvsp[0].i.dword; + ; + break;} +case 212: +#line 1460 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 213: +#line 1465 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 214: +#line 1470 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 215: +#line 1475 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 216: +#line 1480 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 217: +#line 1485 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 218: +#line 1490 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 219: +#line 1495 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 220: +#line 1506 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].il; + ; + break;} +case 221: +#line 1515 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.il = yyvsp[0].i.val; + ; + break;} +case 222: +#line 1526 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i = yyvsp[0].i; + ; + break;} +case 223: +#line 1530 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i = yyvsp[-1].i; + ; + break;} +case 224: +#line 1534 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = ~ yyvsp[0].i.val; + yyval.i.dword = yyvsp[0].i.dword; + ; + break;} +case 225: +#line 1539 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 226: +#line 1544 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 227: +#line 1549 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 228: +#line 1554 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 229: +#line 1559 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 230: +#line 1564 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 231: +#line 1569 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +case 232: +#line 1574 "/5g/ian/binutils/release/copy/binutils/rcparse.y" +{ + yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val; + yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 498 "/usr/cygnus/progressive-97r2/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 1580 "/5g/ian/binutils/release/copy/binutils/rcparse.y" + + +/* Set the language from the command line. */ + +void +rcparse_set_language (lang) + int lang; +{ + language = lang; +} diff --git a/gnu/dist/binutils/rcparse.h b/gnu/dist/binutils/rcparse.h new file mode 100644 index 00000000000..dbf9c59509c --- /dev/null +++ b/gnu/dist/binutils/rcparse.h @@ -0,0 +1,124 @@ +typedef union +{ + struct accelerator acc; + struct accelerator *pacc; + struct dialog_control *dialog_control; + struct menuitem *menuitem; + struct + { + struct rcdata_item *first; + struct rcdata_item *last; + } rcdata; + struct rcdata_item *rcdata_item; + struct stringtable_data *stringtable; + struct fixed_versioninfo *fixver; + struct ver_info *verinfo; + struct ver_stringinfo *verstring; + struct ver_varinfo *vervar; + struct res_id id; + struct res_res_info res_info; + struct + { + unsigned short on; + unsigned short off; + } memflags; + struct + { + unsigned long val; + /* Nonzero if this number was explicitly specified as long. */ + int dword; + } i; + unsigned long il; + unsigned short is; + const char *s; + struct + { + unsigned long length; + const char *s; + } ss; +} YYSTYPE; +#define BEG 258 +#define END 259 +#define ACCELERATORS 260 +#define VIRTKEY 261 +#define ASCII 262 +#define NOINVERT 263 +#define SHIFT 264 +#define CONTROL 265 +#define ALT 266 +#define BITMAP 267 +#define CURSOR 268 +#define DIALOG 269 +#define DIALOGEX 270 +#define EXSTYLE 271 +#define CAPTION 272 +#define CLASS 273 +#define STYLE 274 +#define AUTO3STATE 275 +#define AUTOCHECKBOX 276 +#define AUTORADIOBUTTON 277 +#define CHECKBOX 278 +#define COMBOBOX 279 +#define CTEXT 280 +#define DEFPUSHBUTTON 281 +#define EDITTEXT 282 +#define GROUPBOX 283 +#define LISTBOX 284 +#define LTEXT 285 +#define PUSHBOX 286 +#define PUSHBUTTON 287 +#define RADIOBUTTON 288 +#define RTEXT 289 +#define SCROLLBAR 290 +#define STATE3 291 +#define USERBUTTON 292 +#define BEDIT 293 +#define HEDIT 294 +#define IEDIT 295 +#define FONT 296 +#define ICON 297 +#define LANGUAGE 298 +#define CHARACTERISTICS 299 +#define VERSIONK 300 +#define MENU 301 +#define MENUEX 302 +#define MENUITEM 303 +#define SEPARATOR 304 +#define POPUP 305 +#define CHECKED 306 +#define GRAYED 307 +#define HELP 308 +#define INACTIVE 309 +#define MENUBARBREAK 310 +#define MENUBREAK 311 +#define MESSAGETABLE 312 +#define RCDATA 313 +#define STRINGTABLE 314 +#define VERSIONINFO 315 +#define FILEVERSION 316 +#define PRODUCTVERSION 317 +#define FILEFLAGSMASK 318 +#define FILEFLAGS 319 +#define FILEOS 320 +#define FILETYPE 321 +#define FILESUBTYPE 322 +#define BLOCKSTRINGFILEINFO 323 +#define BLOCKVARFILEINFO 324 +#define VALUE 325 +#define BLOCK 326 +#define MOVEABLE 327 +#define FIXED 328 +#define PURE 329 +#define IMPURE 330 +#define PRELOAD 331 +#define LOADONCALL 332 +#define DISCARDABLE 333 +#define NOT 334 +#define QUOTEDSTRING 335 +#define STRING 336 +#define NUMBER 337 +#define SIZEDSTRING 338 +#define NEG 339 + + +extern YYSTYPE yylval; diff --git a/gnu/dist/binutils/rcparse.y b/gnu/dist/binutils/rcparse.y new file mode 100644 index 00000000000..7b2b06e2682 --- /dev/null +++ b/gnu/dist/binutils/rcparse.y @@ -0,0 +1,1589 @@ +%{ /* rcparse.y -- parser for Windows rc files + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This is a parser for Windows rc files. It is based on the parser + by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" + +#include <ctype.h> + +/* The current language. */ + +static unsigned short language; + +/* The resource information during a sub statement. */ + +static struct res_res_info sub_res_info; + +/* Dialog information. This is built by the nonterminals styles and + controls. */ + +static struct dialog dialog; + +/* This is used when building a style. It is modified by the + nonterminal styleexpr. */ + +static unsigned long style; + +/* These are used when building a control. They are set before using + control_params. */ + +static unsigned long base_style; +static unsigned long default_style; +static unsigned long class; + +%} + +%union +{ + struct accelerator acc; + struct accelerator *pacc; + struct dialog_control *dialog_control; + struct menuitem *menuitem; + struct + { + struct rcdata_item *first; + struct rcdata_item *last; + } rcdata; + struct rcdata_item *rcdata_item; + struct stringtable_data *stringtable; + struct fixed_versioninfo *fixver; + struct ver_info *verinfo; + struct ver_stringinfo *verstring; + struct ver_varinfo *vervar; + struct res_id id; + struct res_res_info res_info; + struct + { + unsigned short on; + unsigned short off; + } memflags; + struct + { + unsigned long val; + /* Nonzero if this number was explicitly specified as long. */ + int dword; + } i; + unsigned long il; + unsigned short is; + const char *s; + struct + { + unsigned long length; + const char *s; + } ss; +}; + +%token BEG END +%token ACCELERATORS VIRTKEY ASCII NOINVERT SHIFT CONTROL ALT +%token BITMAP +%token CURSOR +%token DIALOG DIALOGEX EXSTYLE CAPTION CLASS STYLE +%token AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON CHECKBOX COMBOBOX CTEXT +%token DEFPUSHBUTTON EDITTEXT GROUPBOX LISTBOX LTEXT PUSHBOX PUSHBUTTON +%token RADIOBUTTON RTEXT SCROLLBAR STATE3 USERBUTTON +%token BEDIT HEDIT IEDIT +%token FONT +%token ICON +%token LANGUAGE CHARACTERISTICS VERSIONK +%token MENU MENUEX MENUITEM SEPARATOR POPUP CHECKED GRAYED HELP INACTIVE +%token MENUBARBREAK MENUBREAK +%token MESSAGETABLE +%token RCDATA +%token STRINGTABLE +%token VERSIONINFO FILEVERSION PRODUCTVERSION FILEFLAGSMASK FILEFLAGS +%token FILEOS FILETYPE FILESUBTYPE BLOCKSTRINGFILEINFO BLOCKVARFILEINFO +%token VALUE +%token <s> BLOCK +%token MOVEABLE FIXED PURE IMPURE PRELOAD LOADONCALL DISCARDABLE +%token NOT +%token <s> QUOTEDSTRING STRING +%token <i> NUMBER +%token <ss> SIZEDSTRING + +%type <pacc> acc_entries +%type <acc> acc_entry acc_event +%type <dialog_control> control control_params +%type <menuitem> menuitems menuitem menuexitems menuexitem +%type <rcdata> optrcdata_data optrcdata_data_int rcdata_data +%type <rcdata_item> opt_control_data +%type <fixver> fixedverinfo +%type <verinfo> verblocks +%type <verstring> vervals +%type <vervar> vertrans +%type <res_info> suboptions memflags_move_discard memflags_move +%type <memflags> memflag +%type <id> id +%type <il> exstyle parennumber +%type <il> numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr +%type <is> acc_options acc_option menuitem_flags menuitem_flag +%type <s> optstringc file_name +%type <i> sizednumexpr sizedposnumexpr + +%left '|' +%left '^' +%left '&' +%left '+' '-' +%left '*' '/' '%' +%right '~' NEG + +%% + +input: + /* empty */ + | input newcmd accelerator + | input newcmd bitmap + | input newcmd cursor + | input newcmd dialog + | input newcmd font + | input newcmd icon + | input newcmd language + | input newcmd menu + | input newcmd menuex + | input newcmd messagetable + | input newcmd rcdata + | input newcmd stringtable + | input newcmd user + | input newcmd versioninfo + ; + +newcmd: + /* empty */ + { + rcparse_discard_strings (); + } + ; + +/* Accelerator resources. */ + +accelerator: + id ACCELERATORS suboptions BEG acc_entries END + { + define_accelerator ($1, &$3, $5); + } + ; + +acc_entries: + /* empty */ + { + $$ = NULL; + } + | acc_entries acc_entry + { + struct accelerator *a; + + a = (struct accelerator *) res_alloc (sizeof *a); + *a = $2; + if ($1 == NULL) + $$ = a; + else + { + struct accelerator **pp; + + for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next) + ; + *pp = a; + $$ = $1; + } + } + ; + +acc_entry: + acc_event cposnumexpr + { + $$ = $1; + $$.id = $2; + } + | acc_event cposnumexpr ',' acc_options + { + $$ = $1; + $$.id = $2; + $$.flags |= $4; + if (($$.flags & ACC_VIRTKEY) == 0 + && ($$.flags & (ACC_SHIFT | ACC_CONTROL | ACC_ALT)) != 0) + rcparse_warning ("inappropriate modifiers for non-VIRTKEY"); + } + ; + +acc_event: + QUOTEDSTRING + { + const char *s = $1; + char ch; + + $$.next = NULL; + $$.id = 0; + ch = *s; + if (ch != '^') + $$.flags = 0; + else + { + $$.flags = ACC_CONTROL | ACC_VIRTKEY; + ++s; + ch = *s; + ch = toupper ((unsigned char) ch); + } + $$.key = ch; + if (s[1] != '\0') + rcparse_warning ("accelerator should only be one character"); + } + | posnumexpr + { + $$.next = NULL; + $$.flags = 0; + $$.id = 0; + $$.key = $1; + } + ; + +acc_options: + acc_option + { + $$ = $1; + } + | acc_options ',' acc_option + { + $$ = $1 | $3; + } + /* I've had one report that the comma is optional. */ + | acc_options acc_option + { + $$ = $1 | $2; + } + ; + +acc_option: + VIRTKEY + { + $$ = ACC_VIRTKEY; + } + | ASCII + { + /* This is just the absence of VIRTKEY. */ + $$ = 0; + } + | NOINVERT + { + $$ = ACC_NOINVERT; + } + | SHIFT + { + $$ = ACC_SHIFT; + } + | CONTROL + { + $$ = ACC_CONTROL; + } + | ALT + { + $$ = ACC_ALT; + } + ; + +/* Bitmap resources. */ + +bitmap: + id BITMAP memflags_move file_name + { + define_bitmap ($1, &$3, $4); + } + ; + +/* Cursor resources. */ + +cursor: + id CURSOR memflags_move_discard file_name + { + define_cursor ($1, &$3, $4); + } + ; + +/* Dialog resources. */ + +dialog: + id DIALOG memflags_move exstyle posnumexpr cnumexpr cnumexpr + cnumexpr + { + memset (&dialog, 0, sizeof dialog); + dialog.x = $5; + dialog.y = $6; + dialog.width = $7; + dialog.height = $8; + dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU; + dialog.exstyle = $4; + dialog.menu.named = 1; + dialog.class.named = 1; + dialog.font = NULL; + dialog.ex = NULL; + dialog.controls = NULL; + sub_res_info = $3; + } + styles BEG controls END + { + define_dialog ($1, &sub_res_info, &dialog); + } + | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr + cnumexpr + { + memset (&dialog, 0, sizeof dialog); + dialog.x = $5; + dialog.y = $6; + dialog.width = $7; + dialog.height = $8; + dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU; + dialog.exstyle = $4; + dialog.menu.named = 1; + dialog.class.named = 1; + dialog.font = NULL; + dialog.ex = ((struct dialog_ex *) + res_alloc (sizeof (struct dialog_ex))); + memset (dialog.ex, 0, sizeof (struct dialog_ex)); + dialog.controls = NULL; + sub_res_info = $3; + } + styles BEG controls END + { + define_dialog ($1, &sub_res_info, &dialog); + } + | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr + cnumexpr cnumexpr + { + memset (&dialog, 0, sizeof dialog); + dialog.x = $5; + dialog.y = $6; + dialog.width = $7; + dialog.height = $8; + dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU; + dialog.exstyle = $4; + dialog.menu.named = 1; + dialog.class.named = 1; + dialog.font = NULL; + dialog.ex = ((struct dialog_ex *) + res_alloc (sizeof (struct dialog_ex))); + memset (dialog.ex, 0, sizeof (struct dialog_ex)); + dialog.ex->help = $9; + dialog.controls = NULL; + sub_res_info = $3; + } + styles BEG controls END + { + define_dialog ($1, &sub_res_info, &dialog); + } + ; + +exstyle: + /* empty */ + { + $$ = 0; + } + | EXSTYLE '=' numexpr + { + $$ = $3; + } + ; + +styles: + /* empty */ + | styles CAPTION QUOTEDSTRING + { + unicode_from_ascii ((int *) NULL, &dialog.caption, $3); + } + | styles CLASS id + { + dialog.class = $3; + } + | styles STYLE + { style = dialog.style; } + styleexpr + { + dialog.style = style; + } + | styles EXSTYLE numexpr + { + dialog.exstyle = $3; + } + | styles FONT numexpr ',' QUOTEDSTRING + { + dialog.style |= DS_SETFONT; + dialog.pointsize = $3; + unicode_from_ascii ((int *) NULL, &dialog.font, $5); + } + | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr + { + dialog.style |= DS_SETFONT; + dialog.pointsize = $3; + unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex == NULL) + rcparse_warning ("extended FONT requires DIALOGEX"); + else + { + dialog.ex->weight = $6; + dialog.ex->italic = $7; + } + } + | styles MENU id + { + dialog.menu = $3; + } + | styles CHARACTERISTICS numexpr + { + sub_res_info.characteristics = $3; + } + | styles LANGUAGE numexpr cnumexpr + { + sub_res_info.language = $3 | ($4 << 8); + } + | styles VERSIONK numexpr + { + sub_res_info.version = $3; + } + ; + +controls: + /* empty */ + | controls control + { + struct dialog_control **pp; + + for (pp = &dialog.controls; *pp != NULL; pp = &(*pp)->next) + ; + *pp = $2; + } + ; + +control: + AUTO3STATE + { + default_style = BS_AUTO3STATE | WS_TABSTOP; + base_style = BS_AUTO3STATE; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | AUTOCHECKBOX + { + default_style = BS_AUTOCHECKBOX | WS_TABSTOP; + base_style = BS_AUTOCHECKBOX; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | AUTORADIOBUTTON + { + default_style = BS_AUTORADIOBUTTON | WS_TABSTOP; + base_style = BS_AUTORADIOBUTTON; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | BEDIT + { + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + } + control_params + { + $$ = $3; + if (dialog.ex == NULL) + rcparse_warning ("IEDIT requires DIALOGEX"); + res_string_to_id (&$$->class, "BEDIT"); + } + | CHECKBOX + { + default_style = BS_CHECKBOX | WS_TABSTOP; + base_style = BS_CHECKBOX | WS_TABSTOP; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | COMBOBOX + { + default_style = CBS_SIMPLE | WS_TABSTOP; + base_style = 0; + class = CTL_COMBOBOX; + } + control_params + { + $$ = $3; + } + | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr + cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data + { + $$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10); + if ($11 != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + $$->data = $11; + } + } + | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr + cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data + { + $$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10); + if (dialog.ex == NULL) + rcparse_warning ("help ID requires DIALOGEX"); + $$->help = $11; + $$->data = $12; + } + | CTEXT + { + default_style = SS_CENTER | WS_GROUP; + base_style = SS_CENTER; + class = CTL_STATIC; + } + control_params + { + $$ = $3; + } + | DEFPUSHBUTTON + { + default_style = BS_DEFPUSHBUTTON | WS_TABSTOP; + base_style = BS_DEFPUSHBUTTON | WS_TABSTOP; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | EDITTEXT + { + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + } + control_params + { + $$ = $3; + } + | GROUPBOX + { + default_style = BS_GROUPBOX; + base_style = BS_GROUPBOX; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | HEDIT + { + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + } + control_params + { + $$ = $3; + if (dialog.ex == NULL) + rcparse_warning ("IEDIT requires DIALOGEX"); + res_string_to_id (&$$->class, "HEDIT"); + } + | ICON optstringc numexpr cnumexpr cnumexpr opt_control_data + { + $$ = define_control ($2, $3, $4, $5, 0, 0, CTL_STATIC, + SS_ICON | WS_CHILD | WS_VISIBLE, 0); + if ($6 != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + $$->data = $6; + } + } + | ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + icon_styleexpr optcnumexpr opt_control_data + { + $$ = define_control ($2, $3, $4, $5, $6, $7, CTL_STATIC, + style, $9); + if ($10 != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + $$->data = $10; + } + } + | ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + icon_styleexpr cnumexpr cnumexpr opt_control_data + { + $$ = define_control ($2, $3, $4, $5, $6, $7, CTL_STATIC, + style, $9); + if (dialog.ex == NULL) + rcparse_warning ("help ID requires DIALOGEX"); + $$->help = $10; + $$->data = $11; + } + | IEDIT + { + default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; + class = CTL_EDIT; + } + control_params + { + $$ = $3; + if (dialog.ex == NULL) + rcparse_warning ("IEDIT requires DIALOGEX"); + res_string_to_id (&$$->class, "IEDIT"); + } + | LISTBOX + { + default_style = LBS_NOTIFY | WS_BORDER; + base_style = LBS_NOTIFY | WS_BORDER; + class = CTL_LISTBOX; + } + control_params + { + $$ = $3; + } + | LTEXT + { + default_style = SS_LEFT | WS_GROUP; + base_style = SS_LEFT; + class = CTL_STATIC; + } + control_params + { + $$ = $3; + } + | PUSHBOX + { + default_style = BS_PUSHBOX | WS_TABSTOP; + base_style = BS_PUSHBOX; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | PUSHBUTTON + { + default_style = BS_PUSHBUTTON | WS_TABSTOP; + base_style = BS_PUSHBUTTON | WS_TABSTOP; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | RADIOBUTTON + { + default_style = BS_RADIOBUTTON | WS_TABSTOP; + base_style = BS_RADIOBUTTON; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | RTEXT + { + default_style = SS_RIGHT | WS_GROUP; + base_style = SS_RIGHT; + class = CTL_STATIC; + } + control_params + { + $$ = $3; + } + | SCROLLBAR + { + default_style = SBS_HORZ; + base_style = 0; + class = CTL_SCROLLBAR; + } + control_params + { + $$ = $3; + } + | STATE3 + { + default_style = BS_3STATE | WS_TABSTOP; + base_style = BS_3STATE; + class = CTL_BUTTON; + } + control_params + { + $$ = $3; + } + | USERBUTTON QUOTEDSTRING ',' numexpr ',' numexpr ',' numexpr ',' + numexpr ',' numexpr ',' + { style = WS_CHILD | WS_VISIBLE; } + styleexpr optcnumexpr + { + $$ = define_control ($2, $4, $6, $8, $10, $12, CTL_BUTTON, + style, $16); + } + ; + +/* Parameters for a control. The static variables DEFAULT_STYLE, + BASE_STYLE, and CLASS must be initialized before this nonterminal + is used. DEFAULT_STYLE is the style to use if no style expression + is specified. BASE_STYLE is the base style to use if a style + expression is specified; the style expression modifies the base + style. CLASS is the class of the control. */ + +control_params: + optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + opt_control_data + { + $$ = define_control ($1, $2, $3, $4, $5, $6, class, + default_style | WS_CHILD | WS_VISIBLE, 0); + if ($7 != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + $$->data = $7; + } + } + | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + control_params_styleexpr optcnumexpr opt_control_data + { + $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8); + if ($9 != NULL) + { + if (dialog.ex == NULL) + rcparse_warning ("control data requires DIALOGEX"); + $$->data = $9; + } + } + | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + control_params_styleexpr cnumexpr cnumexpr opt_control_data + { + $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8); + if (dialog.ex == NULL) + rcparse_warning ("help ID requires DIALOGEX"); + $$->help = $9; + $$->data = $10; + } + ; + +optstringc: + /* empty */ + { + $$ = NULL; + } + | QUOTEDSTRING ',' + { + $$ = $1; + } + ; + +opt_control_data: + /* empty */ + { + $$ = NULL; + } + | BEG optrcdata_data END + { + $$ = $2.first; + } + ; + +/* These only exist to parse a reduction out of a common case. */ + +control_styleexpr: + ',' + { style = WS_CHILD | WS_VISIBLE; } + styleexpr + ; + +icon_styleexpr: + ',' + { style = SS_ICON | WS_CHILD | WS_VISIBLE; } + styleexpr + ; + +control_params_styleexpr: + ',' + { style = base_style | WS_CHILD | WS_VISIBLE; } + styleexpr + ; + +/* Font resources. */ + +font: + id FONT memflags_move_discard file_name + { + define_font ($1, &$3, $4); + } + ; + +/* Icon resources. */ + +icon: + id ICON memflags_move_discard file_name + { + define_icon ($1, &$3, $4); + } + ; + +/* Language command. This changes the static variable language, which + affects all subsequent resources. */ + +language: + LANGUAGE numexpr cnumexpr + { + language = $2 | ($3 << 8); + } + ; + +/* Menu resources. */ + +menu: + id MENU suboptions BEG menuitems END + { + define_menu ($1, &$3, $5); + } + ; + +menuitems: + /* empty */ + { + $$ = NULL; + } + | menuitems menuitem + { + if ($1 == NULL) + $$ = $2; + else + { + struct menuitem **pp; + + for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next) + ; + *pp = $2; + $$ = $1; + } + } + ; + +menuitem: + MENUITEM QUOTEDSTRING cnumexpr menuitem_flags + { + $$ = define_menuitem ($2, $3, $4, 0, 0, NULL); + } + | MENUITEM SEPARATOR + { + $$ = define_menuitem (NULL, 0, 0, 0, 0, NULL); + } + | POPUP QUOTEDSTRING menuitem_flags BEG menuitems END + { + $$ = define_menuitem ($2, 0, $3, 0, 0, $5); + } + ; + +menuitem_flags: + /* empty */ + { + $$ = 0; + } + | menuitem_flags ',' menuitem_flag + { + $$ = $1 | $3; + } + | menuitem_flags menuitem_flag + { + $$ = $1 | $2; + } + ; + +menuitem_flag: + CHECKED + { + $$ = MENUITEM_CHECKED; + } + | GRAYED + { + $$ = MENUITEM_GRAYED; + } + | HELP + { + $$ = MENUITEM_HELP; + } + | INACTIVE + { + $$ = MENUITEM_INACTIVE; + } + | MENUBARBREAK + { + $$ = MENUITEM_MENUBARBREAK; + } + | MENUBREAK + { + $$ = MENUITEM_MENUBREAK; + } + ; + +/* Menuex resources. */ + +menuex: + id MENUEX suboptions BEG menuexitems END + { + define_menu ($1, &$3, $5); + } + ; + +menuexitems: + /* empty */ + { + $$ = NULL; + } + | menuexitems menuexitem + { + if ($1 == NULL) + $$ = $2; + else + { + struct menuitem **pp; + + for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next) + ; + *pp = $2; + $$ = $1; + } + } + ; + +menuexitem: + MENUITEM QUOTEDSTRING + { + $$ = define_menuitem ($2, 0, 0, 0, 0, NULL); + } + | MENUITEM QUOTEDSTRING cnumexpr + { + $$ = define_menuitem ($2, $3, 0, 0, 0, NULL); + } + | MENUITEM QUOTEDSTRING cnumexpr cnumexpr optcnumexpr + { + $$ = define_menuitem ($2, $3, $4, $5, 0, NULL); + } + | POPUP QUOTEDSTRING BEG menuexitems END + { + $$ = define_menuitem ($2, 0, 0, 0, 0, $4); + } + | POPUP QUOTEDSTRING cnumexpr BEG menuexitems END + { + $$ = define_menuitem ($2, $3, 0, 0, 0, $5); + } + | POPUP QUOTEDSTRING cnumexpr cnumexpr BEG menuexitems END + { + $$ = define_menuitem ($2, $3, $4, 0, 0, $6); + } + | POPUP QUOTEDSTRING cnumexpr cnumexpr cnumexpr optcnumexpr + BEG menuexitems END + { + $$ = define_menuitem ($2, $3, $4, $5, $6, $8); + } + ; + +/* Messagetable resources. */ + +messagetable: + id MESSAGETABLE memflags_move file_name + { + define_messagetable ($1, &$3, $4); + } + ; + +/* Rcdata resources. */ + +rcdata: + id RCDATA suboptions BEG optrcdata_data END + { + define_rcdata ($1, &$3, $5.first); + } + ; + +/* We use a different lexing algorithm, because rcdata strings may + contain embedded null bytes, and we need to know the length to use. */ + +optrcdata_data: + { + rcparse_rcdata (); + } + optrcdata_data_int + { + rcparse_normal (); + $$ = $2; + } + ; + +optrcdata_data_int: + /* empty */ + { + $$.first = NULL; + $$.last = NULL; + } + | rcdata_data + { + $$ = $1; + } + ; + +rcdata_data: + SIZEDSTRING + { + struct rcdata_item *ri; + + ri = define_rcdata_string ($1.s, $1.length); + $$.first = ri; + $$.last = ri; + } + | sizednumexpr + { + struct rcdata_item *ri; + + ri = define_rcdata_number ($1.val, $1.dword); + $$.first = ri; + $$.last = ri; + } + | rcdata_data ',' SIZEDSTRING + { + struct rcdata_item *ri; + + ri = define_rcdata_string ($3.s, $3.length); + $$.first = $1.first; + $1.last->next = ri; + $$.last = ri; + } + | rcdata_data ',' sizednumexpr + { + struct rcdata_item *ri; + + ri = define_rcdata_number ($3.val, $3.dword); + $$.first = $1.first; + $1.last->next = ri; + $$.last = ri; + } + ; + +/* Stringtable resources. */ + +stringtable: + STRINGTABLE suboptions BEG + { sub_res_info = $2; } + string_data END + ; + +string_data: + /* empty */ + | string_data numexpr QUOTEDSTRING + { + define_stringtable (&sub_res_info, $2, $3); + } + | string_data numexpr ',' QUOTEDSTRING + { + define_stringtable (&sub_res_info, $2, $4); + } + ; + +/* User defined resources. We accept general suboptions in the + file_name case to keep the parser happy. */ + +user: + id id suboptions BEG optrcdata_data END + { + define_user_data ($1, $2, &$3, $5.first); + } + | id id suboptions file_name + { + define_user_file ($1, $2, &$3, $4); + } + ; + +/* Versioninfo resources. */ + +versioninfo: + id VERSIONINFO fixedverinfo BEG verblocks END + { + define_versioninfo ($1, language, $3, $5); + } + ; + +fixedverinfo: + /* empty */ + { + $$ = ((struct fixed_versioninfo *) + res_alloc (sizeof (struct fixed_versioninfo))); + memset ($$, 0, sizeof (struct fixed_versioninfo)); + } + | fixedverinfo FILEVERSION numexpr cnumexpr cnumexpr cnumexpr + { + $1->file_version_ms = ($3 << 16) | $4; + $1->file_version_ls = ($5 << 16) | $6; + $$ = $1; + } + | fixedverinfo PRODUCTVERSION numexpr cnumexpr cnumexpr cnumexpr + { + $1->product_version_ms = ($3 << 16) | $4; + $1->product_version_ls = ($5 << 16) | $6; + $$ = $1; + } + | fixedverinfo FILEFLAGSMASK numexpr + { + $1->file_flags_mask = $3; + $$ = $1; + } + | fixedverinfo FILEFLAGS numexpr + { + $1->file_flags = $3; + $$ = $1; + } + | fixedverinfo FILEOS numexpr + { + $1->file_os = $3; + $$ = $1; + } + | fixedverinfo FILETYPE numexpr + { + $1->file_type = $3; + $$ = $1; + } + | fixedverinfo FILESUBTYPE numexpr + { + $1->file_subtype = $3; + $$ = $1; + } + ; + +/* To handle verblocks successfully, the lexer handles BLOCK + specially. A BLOCK "StringFileInfo" is returned as + BLOCKSTRINGFILEINFO. A BLOCK "VarFileInfo" is returned as + BLOCKVARFILEINFO. A BLOCK with some other string returns BLOCK + with the string as the value. */ + +verblocks: + /* empty */ + { + $$ = NULL; + } + | verblocks BLOCKSTRINGFILEINFO BEG BLOCK BEG vervals END END + { + $$ = append_ver_stringfileinfo ($1, $4, $6); + } + | verblocks BLOCKVARFILEINFO BEG VALUE QUOTEDSTRING vertrans END + { + $$ = append_ver_varfileinfo ($1, $5, $6); + } + ; + +vervals: + /* empty */ + { + $$ = NULL; + } + | vervals VALUE QUOTEDSTRING ',' QUOTEDSTRING + { + $$ = append_verval ($1, $3, $5); + } + ; + +vertrans: + /* empty */ + { + $$ = NULL; + } + | vertrans cnumexpr cnumexpr + { + $$ = append_vertrans ($1, $2, $3); + } + ; + +/* A resource ID. */ + +id: + posnumexpr + { + $$.named = 0; + $$.u.id = $1; + } + | STRING + { + char *copy, *s; + + /* It seems that resource ID's are forced to upper case. */ + copy = xstrdup ($1); + for (s = copy; *s != '\0'; s++) + if (islower (*s)) + *s = toupper (*s); + res_string_to_id (&$$, copy); + free (copy); + } + ; + +/* Generic suboptions. These may appear before the BEGIN in any + multiline statement. */ + +suboptions: + /* empty */ + { + memset (&$$, 0, sizeof (struct res_res_info)); + $$.language = language; + /* FIXME: Is this the right default? */ + $$.memflags = MEMFLAG_MOVEABLE; + } + | suboptions memflag + { + $$ = $1; + $$.memflags |= $2.on; + $$.memflags &=~ $2.off; + } + | suboptions CHARACTERISTICS numexpr + { + $$ = $1; + $$.characteristics = $3; + } + | suboptions LANGUAGE numexpr cnumexpr + { + $$ = $1; + $$.language = $3 | ($4 << 8); + } + | suboptions VERSIONK numexpr + { + $$ = $1; + $$.version = $3; + } + ; + +/* Memory flags which default to MOVEABLE and DISCARDABLE. */ + +memflags_move_discard: + /* empty */ + { + memset (&$$, 0, sizeof (struct res_res_info)); + $$.language = language; + $$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE; + } + | memflags_move_discard memflag + { + $$ = $1; + $$.memflags |= $2.on; + $$.memflags &=~ $2.off; + } + ; + +/* Memory flags which default to MOVEABLE. */ + +memflags_move: + /* empty */ + { + memset (&$$, 0, sizeof (struct res_res_info)); + $$.language = language; + $$.memflags = MEMFLAG_MOVEABLE; + } + | memflags_move_discard memflag + { + $$ = $1; + $$.memflags |= $2.on; + $$.memflags &=~ $2.off; + } + ; + +/* Memory flags. This returns a struct with two integers, because we + sometimes want to set bits and we sometimes want to clear them. */ + +memflag: + MOVEABLE + { + $$.on = MEMFLAG_MOVEABLE; + $$.off = 0; + } + | FIXED + { + $$.on = 0; + $$.off = MEMFLAG_MOVEABLE; + } + | PURE + { + $$.on = MEMFLAG_PURE; + $$.off = 0; + } + | IMPURE + { + $$.on = 0; + $$.off = MEMFLAG_PURE; + } + | PRELOAD + { + $$.on = MEMFLAG_PRELOAD; + $$.off = 0; + } + | LOADONCALL + { + $$.on = 0; + $$.off = MEMFLAG_PRELOAD; + } + | DISCARDABLE + { + $$.on = MEMFLAG_DISCARDABLE; + $$.off = 0; + } + ; + +/* A file name. */ + +file_name: + QUOTEDSTRING + { + $$ = $1; + } + | STRING + { + $$ = $1; + } + ; + +/* A style expression. This changes the static variable STYLE. We do + it this way because rc appears to permit a style to be set to + something like + WS_GROUP | NOT WS_TABSTOP + to mean that a default of WS_TABSTOP should be removed. Anything + which wants to accept a style must first set STYLE to the default + value. The styleexpr nonterminal will change STYLE as specified by + the user. Note that we do not accept arbitrary expressions here, + just numbers separated by '|'. */ + +styleexpr: + parennumber + { + style |= $1; + } + | NOT parennumber + { + style &=~ $2; + } + | styleexpr '|' parennumber + { + style |= $3; + } + | styleexpr '|' NOT parennumber + { + style &=~ $4; + } + ; + +parennumber: + NUMBER + { + $$ = $1.val; + } + | '(' numexpr ')' + { + $$ = $2; + } + ; + +/* An optional expression with a leading comma. */ + +optcnumexpr: + /* empty */ + { + $$ = 0; + } + | cnumexpr + { + $$ = $1; + } + ; + +/* An expression with a leading comma. */ + +cnumexpr: + ',' numexpr + { + $$ = $2; + } + ; + +/* A possibly negated numeric expression. */ + +numexpr: + sizednumexpr + { + $$ = $1.val; + } + ; + +/* A possibly negated expression with a size. */ + +sizednumexpr: + NUMBER + { + $$ = $1; + } + | '(' sizednumexpr ')' + { + $$ = $2; + } + | '~' sizednumexpr %prec '~' + { + $$.val = ~ $2.val; + $$.dword = $2.dword; + } + | '-' sizednumexpr %prec NEG + { + $$.val = - $2.val; + $$.dword = $2.dword; + } + | sizednumexpr '*' sizednumexpr + { + $$.val = $1.val * $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '/' sizednumexpr + { + $$.val = $1.val / $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '%' sizednumexpr + { + $$.val = $1.val % $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '+' sizednumexpr + { + $$.val = $1.val + $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '-' sizednumexpr + { + $$.val = $1.val - $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '&' sizednumexpr + { + $$.val = $1.val & $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '^' sizednumexpr + { + $$.val = $1.val ^ $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '|' sizednumexpr + { + $$.val = $1.val | $3.val; + $$.dword = $1.dword || $3.dword; + } + ; + +/* An expression with a leading comma which does not use unary + negation. */ + +cposnumexpr: + ',' posnumexpr + { + $$ = $2; + } + ; + +/* An expression which does not use unary negation. */ + +posnumexpr: + sizedposnumexpr + { + $$ = $1.val; + } + ; + +/* An expression which does not use unary negation. We separate unary + negation to avoid parsing conflicts when two numeric expressions + appear consecutively. */ + +sizedposnumexpr: + NUMBER + { + $$ = $1; + } + | '(' sizednumexpr ')' + { + $$ = $2; + } + | '~' sizednumexpr %prec '~' + { + $$.val = ~ $2.val; + $$.dword = $2.dword; + } + | sizedposnumexpr '*' sizednumexpr + { + $$.val = $1.val * $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '/' sizednumexpr + { + $$.val = $1.val / $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '%' sizednumexpr + { + $$.val = $1.val % $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '+' sizednumexpr + { + $$.val = $1.val + $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '-' sizednumexpr + { + $$.val = $1.val - $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '&' sizednumexpr + { + $$.val = $1.val & $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '^' sizednumexpr + { + $$.val = $1.val ^ $3.val; + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '|' sizednumexpr + { + $$.val = $1.val | $3.val; + $$.dword = $1.dword || $3.dword; + } + ; + +%% + +/* Set the language from the command line. */ + +void +rcparse_set_language (lang) + int lang; +{ + language = lang; +} diff --git a/gnu/dist/binutils/resbin.c b/gnu/dist/binutils/resbin.c new file mode 100644 index 00000000000..6f87a775d10 --- /dev/null +++ b/gnu/dist/binutils/resbin.c @@ -0,0 +1,2376 @@ +/* resbin.c -- manipulate the Windows binary resource format. + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This file contains functions to convert between the binary resource + format and the internal structures that we want to use. The same + binary resource format is used in both res and COFF files. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" + +/* Macros to swap in values. */ + +#define get_16(be, s) ((be) ? bfd_getb16 (s) : bfd_getl16 (s)) +#define get_32(be, s) ((be) ? bfd_getb32 (s) : bfd_getl32 (s)) + +/* Local functions. */ + +static void toosmall PARAMS ((const char *)); +static unichar *get_unicode + PARAMS ((const unsigned char *, unsigned long, int, int *)); +static int get_resid + PARAMS ((struct res_id *, const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_generic + PARAMS ((enum res_type, const unsigned char *, unsigned long)); +static struct res_resource *bin_to_res_cursor + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_menu + PARAMS ((const unsigned char *, unsigned long, int)); +static struct menuitem *bin_to_res_menuitems + PARAMS ((const unsigned char *, unsigned long, int, int *)); +static struct menuitem *bin_to_res_menuexitems + PARAMS ((const unsigned char *, unsigned long, int, int *)); +static struct res_resource *bin_to_res_dialog + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_string + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_fontdir + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_accelerators + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_rcdata + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_group_cursor + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_group_icon + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_version + PARAMS ((const unsigned char *, unsigned long, int)); +static struct res_resource *bin_to_res_userdata + PARAMS ((const unsigned char *, unsigned long, int)); + +/* Given a resource type ID, a pointer to data, a length, return a + res_resource structure which represents that resource. The caller + is responsible for initializing the res_info and coff_info fields + of the returned structure. */ + +struct res_resource * +bin_to_res (type, data, length, big_endian) + struct res_id type; + const unsigned char *data; + unsigned long length; + int big_endian; +{ + if (type.named) + return bin_to_res_userdata (data, length, big_endian); + else + { + switch (type.u.id) + { + default: + return bin_to_res_userdata (data, length, big_endian); + case RT_CURSOR: + return bin_to_res_cursor (data, length, big_endian); + case RT_BITMAP: + return bin_to_res_generic (RES_TYPE_BITMAP, data, length); + case RT_ICON: + return bin_to_res_generic (RES_TYPE_ICON, data, length); + case RT_MENU: + return bin_to_res_menu (data, length, big_endian); + case RT_DIALOG: + return bin_to_res_dialog (data, length, big_endian); + case RT_STRING: + return bin_to_res_string (data, length, big_endian); + case RT_FONTDIR: + return bin_to_res_fontdir (data, length, big_endian); + case RT_FONT: + return bin_to_res_generic (RES_TYPE_FONT, data, length); + case RT_ACCELERATORS: + return bin_to_res_accelerators (data, length, big_endian); + case RT_RCDATA: + return bin_to_res_rcdata (data, length, big_endian); + case RT_MESSAGETABLE: + return bin_to_res_generic (RES_TYPE_MESSAGETABLE, data, length); + case RT_GROUP_CURSOR: + return bin_to_res_group_cursor (data, length, big_endian); + case RT_GROUP_ICON: + return bin_to_res_group_icon (data, length, big_endian); + case RT_VERSION: + return bin_to_res_version (data, length, big_endian); + } + } +} + +/* Give an error if the binary data is too small. */ + +static void +toosmall (msg) + const char *msg; +{ + fatal ("%s: not enough binary data", msg); +} + +/* Swap in a NULL terminated unicode string. */ + +static unichar * +get_unicode (data, length, big_endian, retlen) + const unsigned char *data; + unsigned long length; + int big_endian; + int *retlen; +{ + int c, i; + unichar *ret; + + c = 0; + while (1) + { + if (length < c * 2 + 2) + toosmall ("null terminated unicode string"); + if (get_16 (big_endian, data + c * 2) == 0) + break; + ++c; + } + + ret = (unichar *) res_alloc ((c + 1) * sizeof (unichar)); + + for (i = 0; i < c; i++) + ret[i] = get_16 (big_endian, data + i * 2); + ret[i] = 0; + + if (retlen != NULL) + *retlen = c; + + return ret; +} + +/* Get a resource identifier. This returns the number of bytes used. */ + +static int +get_resid (id, data, length, big_endian) + struct res_id *id; + const unsigned char *data; + unsigned long length; + int big_endian; +{ + int first; + + if (length < 2) + toosmall ("resource ID"); + + first = get_16 (big_endian, data); + if (first == 0xffff) + { + if (length < 4) + toosmall ("resource ID"); + id->named = 0; + id->u.id = get_16 (big_endian, data + 2); + return 4; + } + else + { + id->named = 1; + id->u.n.name = get_unicode (data, length, big_endian, &id->u.n.length); + return id->u.n.length * 2 + 2; + } +} + +/* Convert a resource which just stores uninterpreted data from + binary. */ + +struct res_resource * +bin_to_res_generic (type, data, length) + enum res_type type; + const unsigned char *data; + unsigned long length; +{ + struct res_resource *r; + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = type; + r->u.data.data = data; + r->u.data.length = length; + + return r; +} + +/* Convert a cursor resource from binary. */ + +struct res_resource * +bin_to_res_cursor (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + struct cursor *c; + struct res_resource *r; + + if (length < 4) + toosmall ("cursor"); + + c = (struct cursor *) res_alloc (sizeof *c); + c->xhotspot = get_16 (big_endian, data); + c->yhotspot = get_16 (big_endian, data + 2); + c->length = length - 4; + c->data = data + 4; + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_CURSOR; + r->u.cursor = c; + + return r; +} + +/* Convert a menu resource from binary. */ + +struct res_resource * +bin_to_res_menu (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + struct res_resource *r; + struct menu *m; + int version, read; + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_MENU; + + m = (struct menu *) res_alloc (sizeof *m); + r->u.menu = m; + + if (length < 2) + toosmall ("menu header"); + + version = get_16 (big_endian, data); + + if (version == 0) + { + if (length < 4) + toosmall ("menu header"); + m->help = 0; + m->items = bin_to_res_menuitems (data + 4, length - 4, big_endian, + &read); + } + else if (version == 1) + { + int offset; + + if (length < 8) + toosmall ("menuex header"); + m->help = get_32 (big_endian, data + 4); + offset = get_16 (big_endian, data + 2); + if (offset + 4 >= length) + toosmall ("menuex offset"); + m->items = bin_to_res_menuexitems (data + 4 + offset, + length - (4 + offset), + big_endian, + &read); + } + else + fatal ("unsupported menu version %d", version); + + return r; +} + +/* Convert menu items from binary. */ + +static struct menuitem * +bin_to_res_menuitems (data, length, big_endian, read) + const unsigned char *data; + unsigned long length; + int big_endian; + int *read; +{ + struct menuitem *first, **pp; + + first = NULL; + pp = &first; + + *read = 0; + + while (length > 0) + { + int flags, stroff, slen, itemlen; + struct menuitem *mi; + + if (length < 4) + toosmall ("menuitem header"); + + mi = (struct menuitem *) res_alloc (sizeof *mi); + mi->state = 0; + mi->help = 0; + + flags = get_16 (big_endian, data); + mi->type = flags &~ (MENUITEM_POPUP | MENUITEM_ENDMENU); + + if ((flags & MENUITEM_POPUP) == 0) + stroff = 4; + else + stroff = 2; + + if (length < stroff + 2) + toosmall ("menuitem header"); + + if (get_16 (big_endian, data + stroff) == 0) + { + slen = 0; + mi->text = NULL; + } + else + mi->text = get_unicode (data + stroff, length - stroff, big_endian, + &slen); + + itemlen = stroff + slen * 2 + 2; + + if ((flags & MENUITEM_POPUP) == 0) + { + mi->popup = NULL; + mi->id = get_16 (big_endian, data + 2); + } + else + { + int subread; + + mi->id = 0; + mi->popup = bin_to_res_menuitems (data + itemlen, length - itemlen, + big_endian, &subread); + itemlen += subread; + } + + mi->next = NULL; + *pp = mi; + pp = &mi->next; + + data += itemlen; + length -= itemlen; + *read += itemlen; + + if ((flags & MENUITEM_ENDMENU) != 0) + return first; + } + + return first; +} + +/* Convert menuex items from binary. */ + +static struct menuitem * +bin_to_res_menuexitems (data, length, big_endian, read) + const unsigned char *data; + unsigned long length; + int big_endian; + int *read; +{ + struct menuitem *first, **pp; + + first = NULL; + pp = &first; + + *read = 0; + + while (length > 0) + { + int flags, slen, itemlen; + struct menuitem *mi; + + if (length < 14) + toosmall ("menuitem header"); + + mi = (struct menuitem *) res_alloc (sizeof *mi); + mi->type = get_32 (big_endian, data); + mi->state = get_32 (big_endian, data + 4); + mi->id = get_16 (big_endian, data + 8); + + flags = get_16 (big_endian, data + 10); + + if (get_16 (big_endian, data + 12) == 0) + { + slen = 0; + mi->text = NULL; + } + else + mi->text = get_unicode (data + 12, length - 12, big_endian, &slen); + + itemlen = 12 + slen * 2 + 2; + itemlen = (itemlen + 3) &~ 3; + + if ((flags & 1) == 0) + { + mi->popup = NULL; + mi->help = 0; + } + else + { + int subread; + + if (length < itemlen + 4) + toosmall ("menuitem"); + mi->help = get_32 (big_endian, data + itemlen); + itemlen += 4; + + mi->popup = bin_to_res_menuexitems (data + itemlen, + length - itemlen, + big_endian, &subread); + itemlen += subread; + } + + mi->next = NULL; + *pp = mi; + pp = &mi->next; + + data += itemlen; + length -= itemlen; + *read += itemlen; + + if ((flags & 0x80) != 0) + return first; + } + + return first; +} + +/* Convert a dialog resource from binary. */ + +static struct res_resource * +bin_to_res_dialog (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + int version; + struct dialog *d; + int c, sublen, off, i; + struct dialog_control **pp; + struct res_resource *r; + + if (length < 18) + toosmall ("dialog header"); + + d = (struct dialog *) res_alloc (sizeof *d); + + version = get_16 (big_endian, data); + if (version != 0xffff) + { + d->ex = NULL; + d->style = get_32 (big_endian, data); + d->exstyle = get_32 (big_endian, data + 4); + off = 8; + } + else + { + int signature; + + signature = get_16 (big_endian, data + 2); + if (signature != 1) + fatal ("unexpected dialog signature %d", signature); + + d->ex = (struct dialog_ex *) res_alloc (sizeof (struct dialog_ex)); + d->ex->help = get_32 (big_endian, data + 4); + d->exstyle = get_32 (big_endian, data + 8); + d->style = get_32 (big_endian, data + 12); + off = 16; + } + + if (length < off + 10) + toosmall ("dialog header"); + + c = get_16 (big_endian, data + off); + d->x = get_16 (big_endian, data + off + 2); + d->y = get_16 (big_endian, data + off + 4); + d->width = get_16 (big_endian, data + off + 6); + d->height = get_16 (big_endian, data + off + 8); + + off += 10; + + sublen = get_resid (&d->menu, data + off, length - off, big_endian); + off += sublen; + + sublen = get_resid (&d->class, data + off, length - off, big_endian); + off += sublen; + + d->caption = get_unicode (data + off, length - off, big_endian, &sublen); + off += sublen * 2 + 2; + + if ((d->style & DS_SETFONT) == 0) + { + d->pointsize = 0; + d->font = NULL; + if (d->ex != NULL) + { + d->ex->weight = 0; + d->ex->italic = 0; + } + } + else + { + if (length < off + 2) + toosmall ("dialog font point size"); + + d->pointsize = get_16 (big_endian, data + off); + off += 2; + + if (d->ex != NULL) + { + if (length < off + 4) + toosmall ("dialogex font information"); + d->ex->weight = get_16 (big_endian, data + off); + d->ex->italic = get_16 (big_endian, data + off + 2); + off += 4; + } + + d->font = get_unicode (data + off, length - off, big_endian, &sublen); + off += sublen * 2 + 2; + } + + d->controls = NULL; + pp = &d->controls; + + for (i = 0; i < c; i++) + { + struct dialog_control *dc; + int datalen; + + off = (off + 3) &~ 3; + + dc = (struct dialog_control *) res_alloc (sizeof *dc); + + if (d->ex == NULL) + { + if (length < off + 8) + toosmall ("dialog control"); + + dc->style = get_32 (big_endian, data + off); + dc->exstyle = get_32 (big_endian, data + off + 4); + dc->help = 0; + off += 8; + } + else + { + if (length < off + 12) + toosmall ("dialogex control"); + dc->help = get_32 (big_endian, data + off); + dc->exstyle = get_32 (big_endian, data + off + 4); + dc->style = get_32 (big_endian, data + off + 18); + off += 12; + } + + if (length < off + 10) + toosmall ("dialog control"); + + dc->x = get_16 (big_endian, data + off); + dc->y = get_16 (big_endian, data + off + 2); + dc->width = get_16 (big_endian, data + off + 4); + dc->height = get_16 (big_endian, data + off + 6); + dc->id = get_16 (big_endian, data + off + 8); + + off += 10; + + sublen = get_resid (&dc->class, data + off, length - off, big_endian); + off += sublen; + + sublen = get_resid (&dc->text, data + off, length - off, big_endian); + off += sublen; + + if (length < off + 2) + toosmall ("dialog control end"); + + datalen = get_16 (big_endian, data + off); + off += 2; + + if (datalen == 0) + dc->data = NULL; + else + { + off = (off + 3) &~ 3; + + if (length < off + datalen) + toosmall ("dialog control data"); + + dc->data = ((struct rcdata_item *) + res_alloc (sizeof (struct rcdata_item))); + dc->data->next = NULL; + dc->data->type = RCDATA_BUFFER; + dc->data->u.buffer.length = datalen; + dc->data->u.buffer.data = data + off; + + off += datalen; + } + + dc->next = NULL; + *pp = dc; + pp = &dc->next; + } + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_DIALOG; + r->u.dialog = d; + + return r; +} + +/* Convert a stringtable resource from binary. */ + +static struct res_resource * +bin_to_res_string (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + struct stringtable *st; + int i; + struct res_resource *r; + + st = (struct stringtable *) res_alloc (sizeof *st); + + for (i = 0; i < 16; i++) + { + int slen; + + if (length < 2) + toosmall ("stringtable string length"); + slen = get_16 (big_endian, data); + st->strings[i].length = slen; + + if (slen > 0) + { + unichar *s; + int j; + + if (length < 2 + 2 * slen) + toosmall ("stringtable string"); + + s = (unichar *) res_alloc (slen * sizeof (unichar)); + st->strings[i].string = s; + + for (j = 0; j < slen; j++) + s[j] = get_16 (big_endian, data + 2 + j * 2); + } + + data += 2 + 2 * slen; + length -= 2 + 2 * slen; + } + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_STRINGTABLE; + r->u.stringtable = st; + + return r; +} + +/* Convert a fontdir resource from binary. */ + +static struct res_resource * +bin_to_res_fontdir (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + int c, i; + struct fontdir *first, **pp; + struct res_resource *r; + + if (length < 2) + toosmall ("fontdir header"); + + c = get_16 (big_endian, data); + + first = NULL; + pp = &first; + + for (i = 0; i < c; i++) + { + struct fontdir *fd; + int off; + + if (length < 56) + toosmall ("fontdir"); + + fd = (struct fontdir *) res_alloc (sizeof *fd); + fd->index = get_16 (big_endian, data); + + /* To work out the length of the fontdir data, we must get the + length of the device name and face name strings, even though + we don't store them in the fontdir structure. The + documentation says that these are NULL terminated char + strings, not Unicode strings. */ + + off = 56; + + while (off < length && data[off] != '\0') + ++off; + if (off >= length) + toosmall ("fontdir device name"); + ++off; + + while (off < length && data[off] != '\0') + ++off; + if (off >= length) + toosmall ("fontdir face name"); + ++off; + + fd->length = off; + fd->data = data; + + fd->next = NULL; + *pp = fd; + pp = &fd->next; + + /* The documentation does not indicate that any rounding is + required. */ + + data += off; + length -= off; + } + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_FONTDIR; + r->u.fontdir = first; + + return r; +} + +/* Convert an accelerators resource from binary. */ + +static struct res_resource * +bin_to_res_accelerators (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + struct accelerator *first, **pp; + struct res_resource *r; + + first = NULL; + pp = &first; + + while (1) + { + struct accelerator *a; + + if (length < 8) + toosmall ("accelerator"); + + a = (struct accelerator *) res_alloc (sizeof *a); + + a->flags = get_16 (big_endian, data); + a->key = get_16 (big_endian, data + 2); + a->id = get_16 (big_endian, data + 4); + + a->next = NULL; + *pp = a; + pp = &a->next; + + if ((a->flags & ACC_LAST) != 0) + break; + + data += 8; + length -= 8; + } + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_ACCELERATOR; + r->u.acc = first; + + return r; +} + +/* Convert an rcdata resource from binary. */ + +static struct res_resource * +bin_to_res_rcdata (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + struct rcdata_item *ri; + struct res_resource *r; + + ri = (struct rcdata_item *) res_alloc (sizeof *ri); + + ri->next = NULL; + ri->type = RCDATA_BUFFER; + ri->u.buffer.length = length; + ri->u.buffer.data = data; + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_RCDATA; + r->u.rcdata = ri; + + return r; +} + +/* Convert a group cursor resource from binary. */ + +static struct res_resource * +bin_to_res_group_cursor (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + int type, c, i; + struct group_cursor *first, **pp; + struct res_resource *r; + + if (length < 6) + toosmall ("group cursor header"); + + type = get_16 (big_endian, data + 2); + if (type != 2) + fatal ("unexpected group cursor type %d", type); + + c = get_16 (big_endian, data + 4); + + data += 6; + length -= 6; + + first = NULL; + pp = &first; + + for (i = 0; i < c; i++) + { + struct group_cursor *gc; + + if (length < 14) + toosmall ("group cursor"); + + gc = (struct group_cursor *) res_alloc (sizeof *gc); + + gc->width = get_16 (big_endian, data); + gc->height = get_16 (big_endian, data + 2); + gc->planes = get_16 (big_endian, data + 4); + gc->bits = get_16 (big_endian, data + 6); + gc->bytes = get_32 (big_endian, data + 8); + gc->index = get_16 (big_endian, data + 12); + + gc->next = NULL; + *pp = gc; + pp = &gc->next; + + data += 14; + length -= 14; + } + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_GROUP_CURSOR; + r->u.group_cursor = first; + + return r; +} + +/* Convert a group icon resource from binary. */ + +static struct res_resource * +bin_to_res_group_icon (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + int type, c, i; + struct group_icon *first, **pp; + struct res_resource *r; + + if (length < 6) + toosmall ("group icon header"); + + type = get_16 (big_endian, data + 2); + if (type != 1) + fatal ("unexpected group icon type %d", type); + + c = get_16 (big_endian, data + 4); + + data += 6; + length -= 6; + + first = NULL; + pp = &first; + + for (i = 0; i < c; i++) + { + struct group_icon *gi; + + if (length < 14) + toosmall ("group icon"); + + gi = (struct group_icon *) res_alloc (sizeof *gi); + + gi->width = data[0]; + gi->height = data[1]; + gi->colors = data[2]; + gi->planes = get_16 (big_endian, data + 4); + gi->bits = get_16 (big_endian, data + 6); + gi->bytes = get_32 (big_endian, data + 8); + gi->index = get_16 (big_endian, data + 12); + + gi->next = NULL; + *pp = gi; + pp = &gi->next; + + data += 14; + length -= 14; + } + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_GROUP_ICON; + r->u.group_icon = first; + + return r; +} + +/* Extract data from a version header. If KEY is not NULL, then the + key must be KEY; otherwise, the key is returned in *PKEY. This + sets *LEN to the total length, *VALLEN to the value length, *TYPE + to the type, and *OFF to the offset to the children. */ + +static void +get_version_header (data, length, big_endian, key, pkey, len, vallen, type, + off) + const unsigned char *data; + unsigned long length; + int big_endian; + const char *key; + unichar **pkey; + int *len; + int *vallen; + int *type; + int *off; +{ + if (length < 8) + toosmall (key); + + *len = get_16 (big_endian, data); + *vallen = get_16 (big_endian, data + 2); + *type = get_16 (big_endian, data + 4); + + *off = 6; + + length -= 6; + data += 6; + + if (key == NULL) + { + int sublen; + + *pkey = get_unicode (data, length, big_endian, &sublen); + *off += sublen * 2 + 2; + } + else + { + while (1) + { + if (length < 2) + toosmall (key); + if (get_16 (big_endian, data) != *key) + fatal ("unexpected version string"); + + *off += 2; + length -= 2; + data += 2; + + if (*key == '\0') + break; + + ++key; + } + } + + *off = (*off + 3) &~ 3; +} + +/* Convert a version resource from binary. */ + +static struct res_resource * +bin_to_res_version (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + int verlen, vallen, type, off; + struct fixed_versioninfo *fi; + struct ver_info *first, **pp; + struct versioninfo *v; + struct res_resource *r; + + get_version_header (data, length, big_endian, "VS_VERSION_INFO", + (unichar *) NULL, &verlen, &vallen, &type, &off); + + if (verlen != length) + fatal ("version length %d does not match resource length %lu", + verlen, length); + + if (type != 0) + fatal ("unexpected version type %d", type); + + data += off; + length -= off; + + if (vallen == 0) + fi = NULL; + else + { + unsigned long signature, fiv; + + if (vallen != 52) + fatal ("unexpected fixed version information length %d", vallen); + + if (length < 52) + toosmall ("fixed version info"); + + signature = get_32 (big_endian, data); + if (signature != 0xfeef04bd) + fatal ("unexpected fixed version signature %lu", signature); + + fiv = get_32 (big_endian, data + 4); + if (fiv != 0 && fiv != 0x10000) + fatal ("unexpected fixed version info version %lu", fiv); + + fi = (struct fixed_versioninfo *) res_alloc (sizeof *fi); + + fi->file_version_ms = get_32 (big_endian, data + 8); + fi->file_version_ls = get_32 (big_endian, data + 12); + fi->product_version_ms = get_32 (big_endian, data + 16); + fi->product_version_ls = get_32 (big_endian, data + 20); + fi->file_flags_mask = get_32 (big_endian, data + 24); + fi->file_flags = get_32 (big_endian, data + 28); + fi->file_os = get_32 (big_endian, data + 32); + fi->file_type = get_32 (big_endian, data + 36); + fi->file_subtype = get_32 (big_endian, data + 40); + fi->file_date_ms = get_32 (big_endian, data + 44); + fi->file_date_ls = get_32 (big_endian, data + 48); + + data += 52; + length -= 52; + } + + first = NULL; + pp = &first; + + while (length > 0) + { + struct ver_info *vi; + int ch; + + if (length < 8) + toosmall ("version var info"); + + vi = (struct ver_info *) res_alloc (sizeof *vi); + + ch = get_16 (big_endian, data + 6); + + if (ch == 'S') + { + struct ver_stringinfo **ppvs; + + vi->type = VERINFO_STRING; + + get_version_header (data, length, big_endian, "StringFileInfo", + (unichar *) NULL, &verlen, &vallen, &type, + &off); + + if (vallen != 0) + fatal ("unexpected stringfileinfo value length %d", vallen); + + data += off; + length -= off; + + get_version_header (data, length, big_endian, (const char *) NULL, + &vi->u.string.language, &verlen, &vallen, + &type, &off); + + if (vallen != 0) + fatal ("unexpected version stringtable value length %d", vallen); + + data += off; + length -= off; + verlen -= off; + + vi->u.string.strings = NULL; + ppvs = &vi->u.string.strings; + + /* It's convenient to round verlen to a 4 byte alignment, + since we round the subvariables in the loop. */ + verlen = (verlen + 3) &~ 3; + + while (verlen > 0) + { + struct ver_stringinfo *vs; + int subverlen, vslen, valoff; + + vs = (struct ver_stringinfo *) res_alloc (sizeof *vs); + + get_version_header (data, length, big_endian, + (const char *) NULL, &vs->key, &subverlen, + &vallen, &type, &off); + + subverlen = (subverlen + 3) &~ 3; + + data += off; + length -= off; + + vs->value = get_unicode (data, length, big_endian, &vslen); + valoff = vslen * 2 + 2; + valoff = (valoff + 3) &~ 3; + + if (off + valoff != subverlen) + fatal ("unexpected version string length %d != %d + %d", + subverlen, off, valoff); + + vs->next = NULL; + *ppvs = vs; + ppvs = &vs->next; + + data += valoff; + length -= valoff; + + if (verlen < subverlen) + fatal ("unexpected version string length %d < %d", + verlen, subverlen); + + verlen -= subverlen; + } + } + else if (ch == 'V') + { + struct ver_varinfo **ppvv; + + vi->type = VERINFO_VAR; + + get_version_header (data, length, big_endian, "VarFileInfo", + (unichar *) NULL, &verlen, &vallen, &type, + &off); + + if (vallen != 0) + fatal ("unexpected varfileinfo value length %d", vallen); + + data += off; + length -= off; + + get_version_header (data, length, big_endian, (const char *) NULL, + &vi->u.var.key, &verlen, &vallen, &type, &off); + + data += off; + length -= off; + + vi->u.var.var = NULL; + ppvv = &vi->u.var.var; + + while (vallen > 0) + { + struct ver_varinfo *vv; + + if (length < 4) + toosmall ("version varfileinfo"); + + vv = (struct ver_varinfo *) res_alloc (sizeof *vv); + + vv->language = get_16 (big_endian, data); + vv->charset = get_16 (big_endian, data + 2); + + vv->next = NULL; + *ppvv = vv; + ppvv = &vv->next; + + data += 4; + length -= 4; + + if (vallen < 4) + fatal ("unexpected version value length %d", vallen); + + vallen -= 4; + } + } + else + fatal ("unexpected version string"); + + vi->next = NULL; + *pp = vi; + pp = &vi->next; + } + + v = (struct versioninfo *) res_alloc (sizeof *v); + v->fixed = fi; + v->var = first; + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_VERSIONINFO; + r->u.versioninfo = v; + + return r; +} + +/* Convert an arbitrary user defined resource from binary. */ + +static struct res_resource * +bin_to_res_userdata (data, length, big_endian) + const unsigned char *data; + unsigned long length; + int big_endian; +{ + struct rcdata_item *ri; + struct res_resource *r; + + ri = (struct rcdata_item *) res_alloc (sizeof *ri); + + ri->next = NULL; + ri->type = RCDATA_BUFFER; + ri->u.buffer.length = length; + ri->u.buffer.data = data; + + r = (struct res_resource *) res_alloc (sizeof *r); + r->type = RES_TYPE_USERDATA; + r->u.rcdata = ri; + + return r; +} + +/* Macros to swap out values. */ + +#define put_16(be, v, s) ((be) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s))) +#define put_32(be, v, s) ((be) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s))) + +/* Local functions used to convert resources to binary format. */ + +static void dword_align_bin PARAMS ((struct bindata ***, unsigned long *)); +static struct bindata *resid_to_bin PARAMS ((struct res_id, int)); +static struct bindata *unicode_to_bin PARAMS ((const unichar *, int)); +static struct bindata *res_to_bin_accelerator + PARAMS ((const struct accelerator *, int)); +static struct bindata *res_to_bin_cursor + PARAMS ((const struct cursor *, int)); +static struct bindata *res_to_bin_group_cursor + PARAMS ((const struct group_cursor *, int)); +static struct bindata *res_to_bin_dialog + PARAMS ((const struct dialog *, int)); +static struct bindata *res_to_bin_fontdir + PARAMS ((const struct fontdir *, int)); +static struct bindata *res_to_bin_group_icon + PARAMS ((const struct group_icon *, int)); +static struct bindata *res_to_bin_menu + PARAMS ((const struct menu *, int)); +static struct bindata *res_to_bin_menuitems + PARAMS ((const struct menuitem *, int)); +static struct bindata *res_to_bin_menuexitems + PARAMS ((const struct menuitem *, int)); +static struct bindata *res_to_bin_rcdata + PARAMS ((const struct rcdata_item *, int)); +static struct bindata *res_to_bin_stringtable + PARAMS ((const struct stringtable *, int)); +static struct bindata *string_to_unicode_bin PARAMS ((const char *, int)); +static struct bindata *res_to_bin_versioninfo + PARAMS ((const struct versioninfo *, int)); +static struct bindata *res_to_bin_generic + PARAMS ((unsigned long, const unsigned char *)); + +/* Convert a resource to binary. */ + +struct bindata * +res_to_bin (res, big_endian) + const struct res_resource *res; + int big_endian; +{ + switch (res->type) + { + default: + abort (); + case RES_TYPE_BITMAP: + case RES_TYPE_FONT: + case RES_TYPE_ICON: + case RES_TYPE_MESSAGETABLE: + return res_to_bin_generic (res->u.data.length, res->u.data.data); + case RES_TYPE_ACCELERATOR: + return res_to_bin_accelerator (res->u.acc, big_endian); + case RES_TYPE_CURSOR: + return res_to_bin_cursor (res->u.cursor, big_endian); + case RES_TYPE_GROUP_CURSOR: + return res_to_bin_group_cursor (res->u.group_cursor, big_endian); + case RES_TYPE_DIALOG: + return res_to_bin_dialog (res->u.dialog, big_endian); + case RES_TYPE_FONTDIR: + return res_to_bin_fontdir (res->u.fontdir, big_endian); + case RES_TYPE_GROUP_ICON: + return res_to_bin_group_icon (res->u.group_icon, big_endian); + case RES_TYPE_MENU: + return res_to_bin_menu (res->u.menu, big_endian); + case RES_TYPE_RCDATA: + return res_to_bin_rcdata (res->u.rcdata, big_endian); + case RES_TYPE_STRINGTABLE: + return res_to_bin_stringtable (res->u.stringtable, big_endian); + case RES_TYPE_USERDATA: + return res_to_bin_rcdata (res->u.rcdata, big_endian); + case RES_TYPE_VERSIONINFO: + return res_to_bin_versioninfo (res->u.versioninfo, big_endian); + } +} + +/* Align to a 32 bit boundary. PPP points to the of a list of bindata + structures. LENGTH points to the length of the structures. If + necessary, this adds a new bindata to bring length up to a 32 bit + boundary. It updates *PPP and *LENGTH. */ + +static void +dword_align_bin (ppp, length) + struct bindata ***ppp; + unsigned long *length; +{ + int add; + struct bindata *d; + + if ((*length & 3) == 0) + return; + + add = 4 - (*length & 3); + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = add; + d->data = (unsigned char *) reswr_alloc (add); + memset (d->data, 0, add); + + d->next = NULL; + **ppp = d; + *ppp = &(**ppp)->next; + + *length += add; +} + +/* Convert a resource ID to binary. This always returns exactly one + bindata structure. */ + +static struct bindata * +resid_to_bin (id, big_endian) + struct res_id id; + int big_endian; +{ + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + + if (! id.named) + { + d->length = 4; + d->data = (unsigned char *) reswr_alloc (4); + put_16 (big_endian, 0xffff, d->data); + put_16 (big_endian, id.u.id, d->data + 2); + } + else + { + int i; + + d->length = id.u.n.length * 2 + 2; + d->data = (unsigned char *) reswr_alloc (d->length); + for (i = 0; i < id.u.n.length; i++) + put_16 (big_endian, id.u.n.name[i], d->data + i * 2); + put_16 (big_endian, 0, d->data + i * 2); + } + + d->next = NULL; + + return d; +} + +/* Convert a null terminated unicode string to binary. This always + returns exactly one bindata structure. */ + +static struct bindata * +unicode_to_bin (str, big_endian) + const unichar *str; + int big_endian; +{ + int len; + struct bindata *d; + + len = 0; + if (str != NULL) + { + const unichar *s; + + for (s = str; *s != 0; s++) + ++len; + } + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = len * 2 + 2; + d->data = (unsigned char *) reswr_alloc (d->length); + + if (str == NULL) + put_16 (big_endian, 0, d->data); + else + { + const unichar *s; + int i; + + for (s = str, i = 0; *s != 0; s++, i++) + put_16 (big_endian, *s, d->data + i * 2); + put_16 (big_endian, 0, d->data + i * 2); + } + + d->next = NULL; + + return d; +} + +/* Convert an accelerator resource to binary. */ + +static struct bindata * +res_to_bin_accelerator (accelerators, big_endian) + const struct accelerator *accelerators; + int big_endian; +{ + struct bindata *first, **pp; + const struct accelerator *a; + + first = NULL; + pp = &first; + + for (a = accelerators; a != NULL; a = a->next) + { + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 8; + d->data = (unsigned char *) reswr_alloc (8); + + put_16 (big_endian, + a->flags | (a->next != NULL ? 0 : ACC_LAST), + d->data); + put_16 (big_endian, a->key, d->data + 2); + put_16 (big_endian, a->id, d->data + 4); + put_16 (big_endian, 0, d->data + 8); + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + return first; +} + +/* Convert a cursor resource to binary. */ + +static struct bindata * +res_to_bin_cursor (c, big_endian) + const struct cursor *c; + int big_endian; +{ + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 4; + d->data = (unsigned char *) reswr_alloc (4); + + put_16 (big_endian, c->xhotspot, d->data); + put_16 (big_endian, c->yhotspot, d->data + 2); + + d->next = (struct bindata *) reswr_alloc (sizeof *d); + d->next->length = c->length; + d->next->data = (unsigned char *) c->data; + d->next->next = NULL; + + return d; +} + +/* Convert a group cursor resource to binary. */ + +static struct bindata * +res_to_bin_group_cursor (group_cursors, big_endian) + const struct group_cursor *group_cursors; + int big_endian; +{ + struct bindata *first, **pp; + int c; + const struct group_cursor *gc; + + first = (struct bindata *) reswr_alloc (sizeof *first); + first->length = 6; + first->data = (unsigned char *) reswr_alloc (6); + + put_16 (big_endian, 0, first->data); + put_16 (big_endian, 2, first->data + 2); + + first->next = NULL; + pp = &first->next; + + c = 0; + for (gc = group_cursors; gc != NULL; gc = gc->next) + { + struct bindata *d; + + ++c; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 14; + d->data = (unsigned char *) reswr_alloc (14); + + put_16 (big_endian, gc->width, d->data); + put_16 (big_endian, gc->height, d->data + 2); + put_16 (big_endian, gc->planes, d->data + 4); + put_16 (big_endian, gc->bits, d->data + 6); + put_32 (big_endian, gc->bytes, d->data + 8); + put_16 (big_endian, gc->index, d->data + 12); + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + put_16 (big_endian, c, first->data + 4); + + return first; +} + +/* Convert a dialog resource to binary. */ + +static struct bindata * +res_to_bin_dialog (dialog, big_endian) + const struct dialog *dialog; + int big_endian; +{ + int dialogex; + struct bindata *first, **pp; + unsigned long length; + int off, c; + struct dialog_control *dc; + + dialogex = extended_dialog (dialog); + + first = (struct bindata *) reswr_alloc (sizeof *first); + first->length = dialogex ? 26 : 18; + first->data = (unsigned char *) reswr_alloc (first->length); + + length = first->length; + + if (! dialogex) + { + put_32 (big_endian, dialog->style, first->data); + put_32 (big_endian, dialog->exstyle, first->data + 4); + off = 8; + } + else + { + put_16 (big_endian, 0xffff, first->data); + put_16 (big_endian, 1, first->data + 2); + if (dialog->ex == NULL) + put_32 (big_endian, 0, first->data + 4); + else + put_32 (big_endian, dialog->ex->help, first->data + 4); + put_32 (big_endian, dialog->exstyle, first->data + 8); + put_32 (big_endian, dialog->style, first->data + 12); + off = 16; + } + + put_16 (big_endian, dialog->x, first->data + off + 2); + put_16 (big_endian, dialog->y, first->data + off + 4); + put_16 (big_endian, dialog->width, first->data + off + 6); + put_16 (big_endian, dialog->height, first->data + off + 8); + + pp = &first->next; + + *pp = resid_to_bin (dialog->menu, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + *pp = resid_to_bin (dialog->class, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + *pp = unicode_to_bin (dialog->caption, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + if ((dialog->style & DS_SETFONT) != 0) + { + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = dialogex ? 6 : 2; + d->data = (unsigned char *) reswr_alloc (d->length); + + length += d->length; + + put_16 (big_endian, dialog->pointsize, d->data); + + if (dialogex) + { + if (dialog->ex == NULL) + { + put_16 (big_endian, 0, d->data + 2); + put_16 (big_endian, 0, d->data + 4); + } + else + { + put_16 (big_endian, dialog->ex->weight, d->data + 2); + put_16 (big_endian, dialog->ex->italic, d->data + 4); + } + } + + *pp = d; + pp = &d->next; + + *pp = unicode_to_bin (dialog->font, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + } + + c = 0; + for (dc = dialog->controls; dc != NULL; dc = dc->next) + { + struct bindata *d; + int dcoff; + + ++c; + + dword_align_bin (&pp, &length); + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = dialogex ? 22 : 18; + d->data = (unsigned char *) reswr_alloc (d->length); + + length += d->length; + + if (! dialogex) + { + put_32 (big_endian, dc->style, d->data); + put_32 (big_endian, dc->exstyle, d->data + 4); + dcoff = 8; + } + else + { + put_32 (big_endian, dc->help, d->data); + put_32 (big_endian, dc->exstyle, d->data + 4); + put_32 (big_endian, dc->style, d->data + 8); + dcoff = 12; + } + + put_16 (big_endian, dc->x, d->data + dcoff); + put_16 (big_endian, dc->y, d->data + dcoff + 2); + put_16 (big_endian, dc->width, d->data + dcoff + 4); + put_16 (big_endian, dc->height, d->data + dcoff + 6); + put_16 (big_endian, dc->id, d->data + dcoff + 8); + + *pp = d; + pp = &d->next; + + *pp = resid_to_bin (dc->class, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + *pp = resid_to_bin (dc->text, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 2; + d->data = (unsigned char *) reswr_alloc (2); + + length += 2; + + d->next = NULL; + *pp = d; + pp = &d->next; + + if (dc->data == NULL) + put_16 (big_endian, 0, d->data); + else + { + unsigned long sublen; + + dword_align_bin (&pp, &length); + + *pp = res_to_bin_rcdata (dc->data, big_endian); + sublen = 0; + while (*pp != NULL) + { + sublen += (*pp)->length; + pp = &(*pp)->next; + } + + put_16 (big_endian, sublen, d->data); + + length += sublen; + } + } + + put_16 (big_endian, c, first->data + off); + + return first; +} + +/* Convert a fontdir resource to binary. */ + +static struct bindata * +res_to_bin_fontdir (fontdirs, big_endian) + const struct fontdir *fontdirs; + int big_endian; +{ + struct bindata *first, **pp; + int c; + const struct fontdir *fd; + + first = (struct bindata *) reswr_alloc (sizeof *first); + first->length = 2; + first->data = (unsigned char *) reswr_alloc (2); + + first->next = NULL; + pp = &first->next; + + c = 0; + for (fd = fontdirs; fd != NULL; fd = fd->next) + { + struct bindata *d; + + ++c; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 2; + d->data = (unsigned char *) reswr_alloc (2); + + put_16 (big_endian, fd->index, d->data); + + *pp = d; + pp = &d->next; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = fd->length; + d->data = (unsigned char *) fd->data; + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + put_16 (big_endian, c, first->data); + + return first; +} + +/* Convert a group icon resource to binary. */ + +static struct bindata * +res_to_bin_group_icon (group_icons, big_endian) + const struct group_icon *group_icons; + int big_endian; +{ + struct bindata *first, **pp; + int c; + const struct group_icon *gi; + + first = (struct bindata *) reswr_alloc (sizeof *first); + first->length = 6; + first->data = (unsigned char *) reswr_alloc (6); + + put_16 (big_endian, 0, first->data); + put_16 (big_endian, 1, first->data + 2); + + first->next = NULL; + pp = &first->next; + + c = 0; + for (gi = group_icons; gi != NULL; gi = gi->next) + { + struct bindata *d; + + ++c; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 14; + d->data = (unsigned char *) reswr_alloc (14); + + d->data[0] = gi->width; + d->data[1] = gi->height; + d->data[2] = gi->colors; + d->data[3] = 0; + put_16 (big_endian, gi->planes, d->data + 4); + put_16 (big_endian, gi->bits, d->data + 6); + put_32 (big_endian, gi->bytes, d->data + 8); + put_16 (big_endian, gi->index, d->data + 12); + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + put_16 (big_endian, c, first->data + 4); + + return first; +} + +/* Convert a menu resource to binary. */ + +static struct bindata * +res_to_bin_menu (menu, big_endian) + const struct menu *menu; + int big_endian; +{ + int menuex; + struct bindata *d; + + menuex = extended_menu (menu); + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = menuex ? 8 : 4; + d->data = (unsigned char *) reswr_alloc (d->length); + + if (! menuex) + { + put_16 (big_endian, 0, d->data); + put_16 (big_endian, 0, d->data + 2); + + d->next = res_to_bin_menuitems (menu->items, big_endian); + } + else + { + put_16 (big_endian, 1, d->data); + put_16 (big_endian, 4, d->data + 2); + put_32 (big_endian, menu->help, d->data + 4); + + d->next = res_to_bin_menuexitems (menu->items, big_endian); + } + + return d; +} + +/* Convert menu items to binary. */ + +static struct bindata * +res_to_bin_menuitems (items, big_endian) + const struct menuitem *items; + int big_endian; +{ + struct bindata *first, **pp; + const struct menuitem *mi; + + first = NULL; + pp = &first; + + for (mi = items; mi != NULL; mi = mi->next) + { + struct bindata *d; + int flags; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = mi->popup == NULL ? 4 : 2; + d->data = (unsigned char *) reswr_alloc (d->length); + + flags = mi->type; + if (mi->next == NULL) + flags |= MENUITEM_ENDMENU; + if (mi->popup != NULL) + flags |= MENUITEM_POPUP; + + put_16 (big_endian, flags, d->data); + + if (mi->popup == NULL) + put_16 (big_endian, mi->id, d->data + 2); + + *pp = d; + pp = &d->next; + + *pp = unicode_to_bin (mi->text, big_endian); + pp = &(*pp)->next; + + if (mi->popup != NULL) + { + *pp = res_to_bin_menuitems (mi->popup, big_endian); + while (*pp != NULL) + pp = &(*pp)->next; + } + } + + return first; +} + +/* Convert menuex items to binary. */ + +static struct bindata * +res_to_bin_menuexitems (items, big_endian) + const struct menuitem *items; + int big_endian; +{ + struct bindata *first, **pp; + unsigned long length; + const struct menuitem *mi; + + first = NULL; + pp = &first; + + length = 0; + + for (mi = items; mi != NULL; mi = mi->next) + { + struct bindata *d; + int flags; + + dword_align_bin (&pp, &length); + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 12; + d->data = (unsigned char *) reswr_alloc (12); + + length += 12; + + put_32 (big_endian, mi->type, d->data); + put_32 (big_endian, mi->state, d->data + 4); + put_16 (big_endian, mi->id, d->data + 8); + + flags = 0; + if (mi->next == NULL) + flags |= 0x80; + if (mi->popup != NULL) + flags |= 1; + put_16 (big_endian, flags, d->data + 10); + + *pp = d; + pp = &d->next; + + *pp = unicode_to_bin (mi->text, big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + if (mi->popup != NULL) + { + dword_align_bin (&pp, &length); + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 4; + d->data = (unsigned char *) reswr_alloc (4); + + put_32 (big_endian, mi->help, d->data); + + *pp = d; + pp = &d->next; + + *pp = res_to_bin_menuexitems (mi->popup, big_endian); + while (*pp != NULL) + { + length += (*pp)->length; + pp = &(*pp)->next; + } + } + } + + return first; +} + +/* Convert an rcdata resource to binary. This is also used to convert + other information which happens to be stored in rcdata_item lists + to binary. */ + +static struct bindata * +res_to_bin_rcdata (items, big_endian) + const struct rcdata_item *items; + int big_endian; +{ + struct bindata *first, **pp; + const struct rcdata_item *ri; + + first = NULL; + pp = &first; + + for (ri = items; ri != NULL; ri = ri->next) + { + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + + switch (ri->type) + { + default: + abort (); + + case RCDATA_WORD: + d->length = 2; + d->data = (unsigned char *) reswr_alloc (2); + put_16 (big_endian, ri->u.word, d->data); + break; + + case RCDATA_DWORD: + d->length = 4; + d->data = (unsigned char *) reswr_alloc (4); + put_32 (big_endian, ri->u.dword, d->data); + break; + + case RCDATA_STRING: + d->length = ri->u.string.length; + d->data = (unsigned char *) ri->u.string.s; + break; + + case RCDATA_WSTRING: + { + unsigned long i; + + d->length = ri->u.wstring.length * 2; + d->data = (unsigned char *) reswr_alloc (d->length); + for (i = 0; i < ri->u.wstring.length; i++) + put_16 (big_endian, ri->u.wstring.w[i], d->data + i * 2); + break; + } + + case RCDATA_BUFFER: + d->length = ri->u.buffer.length; + d->data = (unsigned char *) ri->u.buffer.data; + break; + } + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + return first; +} + +/* Convert a stringtable resource to binary. */ + +static struct bindata * +res_to_bin_stringtable (st, big_endian) + const struct stringtable *st; + int big_endian; +{ + struct bindata *first, **pp; + int i; + + first = NULL; + pp = &first; + + for (i = 0; i < 16; i++) + { + int slen, j; + struct bindata *d; + unichar *s; + + slen = st->strings[i].length; + s = st->strings[i].string; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 2 + slen * 2; + d->data = (unsigned char *) reswr_alloc (d->length); + + put_16 (big_endian, slen, d->data); + + for (j = 0; j < slen; j++) + put_16 (big_endian, s[j], d->data + 2 + j * 2); + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + return first; +} + +/* Convert an ASCII string to a unicode binary string. This always + returns exactly one bindata structure. */ + +static struct bindata * +string_to_unicode_bin (s, big_endian) + const char *s; + int big_endian; +{ + size_t len, i; + struct bindata *d; + + len = strlen (s); + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = len * 2 + 2; + d->data = (unsigned char *) reswr_alloc (d->length); + + for (i = 0; i < len; i++) + put_16 (big_endian, s[i], d->data + i * 2); + put_16 (big_endian, 0, d->data + i * 2); + + d->next = NULL; + + return d; +} + +/* Convert a versioninfo resource to binary. */ + +static struct bindata * +res_to_bin_versioninfo (versioninfo, big_endian) + const struct versioninfo *versioninfo; + int big_endian; +{ + struct bindata *first, **pp; + unsigned long length; + struct ver_info *vi; + + first = (struct bindata *) reswr_alloc (sizeof *first); + first->length = 6; + first->data = (unsigned char *) reswr_alloc (6); + + length = 6; + + if (versioninfo->fixed == NULL) + put_16 (big_endian, 0, first->data + 2); + else + put_16 (big_endian, 52, first->data + 2); + + put_16 (big_endian, 0, first->data + 4); + + pp = &first->next; + + *pp = string_to_unicode_bin ("VS_VERSION_INFO", big_endian); + length += (*pp)->length; + pp = &(*pp)->next; + + dword_align_bin (&pp, &length); + + if (versioninfo->fixed != NULL) + { + const struct fixed_versioninfo *fi; + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = 52; + d->data = (unsigned char *) reswr_alloc (52); + + length += 52; + + fi = versioninfo->fixed; + + put_32 (big_endian, 0xfeef04bd, d->data); + put_32 (big_endian, 0x10000, d->data + 4); + put_32 (big_endian, fi->file_version_ms, d->data + 8); + put_32 (big_endian, fi->file_version_ls, d->data + 12); + put_32 (big_endian, fi->product_version_ms, d->data + 16); + put_32 (big_endian, fi->product_version_ls, d->data + 20); + put_32 (big_endian, fi->file_flags_mask, d->data + 24); + put_32 (big_endian, fi->file_flags, d->data + 28); + put_32 (big_endian, fi->file_os, d->data + 32); + put_32 (big_endian, fi->file_type, d->data + 36); + put_32 (big_endian, fi->file_subtype, d->data + 40); + put_32 (big_endian, fi->file_date_ms, d->data + 44); + put_32 (big_endian, fi->file_date_ls, d->data + 48); + + d->next = NULL; + *pp = d; + pp = &d->next; + } + + for (vi = versioninfo->var; vi != NULL; vi = vi->next) + { + struct bindata *vid; + unsigned long vilen; + + dword_align_bin (&pp, &length); + + vid = (struct bindata *) reswr_alloc (sizeof *vid); + vid->length = 6; + vid->data = (unsigned char *) reswr_alloc (6); + + length += 6; + vilen = 6; + + put_16 (big_endian, 0, vid->data + 2); + put_16 (big_endian, 0, vid->data + 4); + + *pp = vid; + pp = &vid->next; + + switch (vi->type) + { + default: + abort (); + + case VERINFO_STRING: + { + unsigned long hold, vslen; + struct bindata *vsd; + const struct ver_stringinfo *vs; + + *pp = string_to_unicode_bin ("StringFileInfo", big_endian); + length += (*pp)->length; + vilen += (*pp)->length; + pp = &(*pp)->next; + + hold = length; + dword_align_bin (&pp, &length); + vilen += length - hold; + + vsd = (struct bindata *) reswr_alloc (sizeof *vsd); + vsd->length = 6; + vsd->data = (unsigned char *) reswr_alloc (6); + + length += 6; + vilen += 6; + vslen = 6; + + put_16 (big_endian, 0, vsd->data + 2); + put_16 (big_endian, 0, vsd->data + 4); + + *pp = vsd; + pp = &vsd->next; + + *pp = unicode_to_bin (vi->u.string.language, big_endian); + length += (*pp)->length; + vilen += (*pp)->length; + vslen += (*pp)->length; + pp = &(*pp)->next; + + for (vs = vi->u.string.strings; vs != NULL; vs = vs->next) + { + struct bindata *vssd; + unsigned long vsslen; + + hold = length; + dword_align_bin (&pp, &length); + vilen += length - hold; + vslen += length - hold; + + vssd = (struct bindata *) reswr_alloc (sizeof *vssd); + vssd->length = 6; + vssd->data = (unsigned char *) reswr_alloc (6); + + length += 6; + vilen += 6; + vslen += 6; + vsslen = 6; + + put_16 (big_endian, 0, vssd->data + 2); + put_16 (big_endian, 1, vssd->data + 4); + + *pp = vssd; + pp = &vssd->next; + + *pp = unicode_to_bin (vs->key, big_endian); + length += (*pp)->length; + vilen += (*pp)->length; + vslen += (*pp)->length; + vsslen += (*pp)->length; + pp = &(*pp)->next; + + hold = length; + dword_align_bin (&pp, &length); + vilen += length - hold; + vslen += length - hold; + vsslen += length - hold; + + *pp = unicode_to_bin (vs->value, big_endian); + length += (*pp)->length; + vilen += (*pp)->length; + vslen += (*pp)->length; + vsslen += (*pp)->length; + pp = &(*pp)->next; + + put_16 (big_endian, vsslen, vssd->data); + } + + put_16 (big_endian, vslen, vsd->data); + + break; + } + + case VERINFO_VAR: + { + unsigned long hold, vvlen, vvvlen; + struct bindata *vvd; + const struct ver_varinfo *vv; + + *pp = string_to_unicode_bin ("VarFileInfo", big_endian); + length += (*pp)->length; + vilen += (*pp)->length; + pp = &(*pp)->next; + + hold = length; + dword_align_bin (&pp, &length); + vilen += length - hold; + + vvd = (struct bindata *) reswr_alloc (sizeof *vvd); + vvd->length = 6; + vvd->data = (unsigned char *) reswr_alloc (6); + + length += 6; + vilen += 6; + vvlen = 6; + + put_16 (big_endian, 0, vvd->data + 4); + + *pp = vvd; + pp = &vvd->next; + + *pp = unicode_to_bin (vi->u.var.key, big_endian); + length += (*pp)->length; + vilen += (*pp)->length; + vvlen += (*pp)->length; + pp = &(*pp)->next; + + hold = length; + dword_align_bin (&pp, &length); + vilen += length - hold; + vvlen += length - hold; + + vvvlen = 0; + + for (vv = vi->u.var.var; vv != NULL; vv = vv->next) + { + struct bindata *vvsd; + + vvsd = (struct bindata *) reswr_alloc (sizeof *vvsd); + vvsd->length = 4; + vvsd->data = (unsigned char *) reswr_alloc (4); + + length += 4; + vilen += 4; + vvlen += 4; + vvvlen += 4; + + put_16 (big_endian, vv->language, vvsd->data); + put_16 (big_endian, vv->charset, vvsd->data + 2); + + vvsd->next = NULL; + *pp = vvsd; + pp = &vvsd->next; + } + + put_16 (big_endian, vvlen, vvd->data); + put_16 (big_endian, vvvlen, vvd->data + 2); + + break; + } + } + + put_16 (big_endian, vilen, vid->data); + } + + put_16 (big_endian, length, first->data); + + return first; +} + +/* Convert a generic resource to binary. */ + +static struct bindata * +res_to_bin_generic (length, data) + unsigned long length; + const unsigned char *data; +{ + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + d->length = length; + d->data = (unsigned char *) data; + + d->next = NULL; + + return d; +} diff --git a/gnu/dist/binutils/rescoff.c b/gnu/dist/binutils/rescoff.c new file mode 100644 index 00000000000..b7fd9c3fe83 --- /dev/null +++ b/gnu/dist/binutils/rescoff.c @@ -0,0 +1,776 @@ +/* rescoff.c -- read and write resources in Windows COFF files. + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This file contains function that read and write Windows resources + in COFF files. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" + +#include <assert.h> + +/* In order to use the address of a resource data entry, we need to + get the image base of the file. Right now we extract it from + internal BFD information. FIXME. */ + +#include "coff/internal.h" +#include "libcoff.h" + +/* Information we extract from the file. */ + +struct coff_file_info +{ + /* File name. */ + const char *filename; + /* Data read from the file. */ + const bfd_byte *data; + /* End of data read from file. */ + const bfd_byte *data_end; + /* Address of the resource section minus the image base of the file. */ + bfd_vma secaddr; + /* Non-zero if the file is big endian. */ + int big_endian; +}; + +/* A resource directory table in a COFF file. */ + +struct extern_res_directory +{ + /* Characteristics. */ + bfd_byte characteristics[4]; + /* Time stamp. */ + bfd_byte time[4]; + /* Major version number. */ + bfd_byte major[2]; + /* Minor version number. */ + bfd_byte minor[2]; + /* Number of named directory entries. */ + bfd_byte name_count[2]; + /* Number of directory entries with IDs. */ + bfd_byte id_count[2]; +}; + +/* A resource directory entry in a COFF file. */ + +struct extern_res_entry +{ + /* Name or ID. */ + bfd_byte name[4]; + /* Address of resource entry or subdirectory. */ + bfd_byte rva[4]; +}; + +/* A resource data entry in a COFF file. */ + +struct extern_res_data +{ + /* Address of resource data. This is apparently a file relative + address, rather than a section offset. */ + bfd_byte rva[4]; + /* Size of resource data. */ + bfd_byte size[4]; + /* Code page. */ + bfd_byte codepage[4]; + /* Reserved. */ + bfd_byte reserved[4]; +}; + +/* Macros to swap in values. */ + +#define getfi_16(fi, s) ((fi)->big_endian ? bfd_getb16 (s) : bfd_getl16 (s)) +#define getfi_32(fi, s) ((fi)->big_endian ? bfd_getb32 (s) : bfd_getl32 (s)) + +/* Local functions. */ + +static void overrun PARAMS ((const struct coff_file_info *, const char *)); +static struct res_directory *read_coff_res_dir + PARAMS ((const bfd_byte *, const struct coff_file_info *, + const struct res_id *, int)); +static struct res_resource *read_coff_data_entry + PARAMS ((const bfd_byte *, const struct coff_file_info *, + const struct res_id *)); + +/* Read the resources in a COFF file. */ + +struct res_directory * +read_coff_rsrc (filename, target) + const char *filename; + const char *target; +{ + bfd *abfd; + char **matching; + asection *sec; + bfd_size_type size; + bfd_byte *data; + struct coff_file_info finfo; + + if (filename == NULL) + fatal ("filename required for COFF input"); + + abfd = bfd_openr (filename, target); + if (abfd == NULL) + bfd_fatal (filename); + + if (! bfd_check_format_matches (abfd, bfd_object, &matching)) + { + bfd_nonfatal (bfd_get_filename (abfd)); + if (bfd_get_error () == bfd_error_file_ambiguously_recognized) + list_matching_formats (matching); + xexit (1); + } + + sec = bfd_get_section_by_name (abfd, ".rsrc"); + if (sec == NULL) + { + fprintf (stderr, "%s: %s: no resource section\n", program_name, + filename); + xexit (1); + } + + size = bfd_section_size (abfd, sec); + data = (bfd_byte *) res_alloc (size); + + if (! bfd_get_section_contents (abfd, sec, data, 0, size)) + bfd_fatal ("can't read resource section"); + + finfo.filename = filename; + finfo.data = data; + finfo.data_end = data + size; + finfo.secaddr = (bfd_get_section_vma (abfd, sec) + - pe_data (abfd)->pe_opthdr.ImageBase); + finfo.big_endian = bfd_big_endian (abfd); + + bfd_close (abfd); + + /* Now just read in the top level resource directory. Note that we + don't free data, since we create resource entries that point into + it. If we ever want to free up the resource information we read, + this will have to be cleaned up. */ + + return read_coff_res_dir (data, &finfo, (const struct res_id *) NULL, 0); +} + +/* Give an error if we are out of bounds. */ + +static void +overrun (finfo, msg) + const struct coff_file_info *finfo; + const char *msg; +{ + fatal ("%s: %s: address out of bounds", finfo->filename, msg); +} + +/* Read a resource directory. */ + +static struct res_directory * +read_coff_res_dir (data, finfo, type, level) + const bfd_byte *data; + const struct coff_file_info *finfo; + const struct res_id *type; + int level; +{ + const struct extern_res_directory *erd; + struct res_directory *rd; + int name_count, id_count, i; + struct res_entry **pp; + const struct extern_res_entry *ere; + + if (finfo->data_end - data < sizeof (struct extern_res_directory)) + overrun (finfo, "directory"); + + erd = (const struct extern_res_directory *) data; + + rd = (struct res_directory *) res_alloc (sizeof *rd); + rd->characteristics = getfi_32 (finfo, erd->characteristics); + rd->time = getfi_32 (finfo, erd->time); + rd->major = getfi_16 (finfo, erd->major); + rd->minor = getfi_16 (finfo, erd->minor); + rd->entries = NULL; + + name_count = getfi_16 (finfo, erd->name_count); + id_count = getfi_16 (finfo, erd->id_count); + + pp = &rd->entries; + + /* The resource directory entries immediately follow the directory + table. */ + ere = (const struct extern_res_entry *) (erd + 1); + + for (i = 0; i < name_count; i++, ere++) + { + unsigned long name, rva; + struct res_entry *re; + const bfd_byte *ers; + int length, j; + + if ((const bfd_byte *) ere >= finfo->data_end) + overrun (finfo, "named directory entry"); + + name = getfi_32 (finfo, ere->name); + rva = getfi_32 (finfo, ere->rva); + + /* For some reason the high bit in NAME is set. */ + name &=~ 0x80000000; + + if (name > finfo->data_end - finfo->data) + overrun (finfo, "directory entry name"); + + ers = finfo->data + name; + + re = (struct res_entry *) res_alloc (sizeof *re); + re->next = NULL; + re->id.named = 1; + length = getfi_16 (finfo, ers); + re->id.u.n.length = length; + re->id.u.n.name = (unichar *) res_alloc (length * sizeof (unichar)); + for (j = 0; j < length; j++) + re->id.u.n.name[j] = getfi_16 (finfo, ers + j * 2 + 2); + + if (level == 0) + type = &re->id; + + if ((rva & 0x80000000) != 0) + { + rva &=~ 0x80000000; + if (rva >= finfo->data_end - finfo->data) + overrun (finfo, "named subdirectory"); + re->subdir = 1; + re->u.dir = read_coff_res_dir (finfo->data + rva, finfo, type, + level + 1); + } + else + { + if (rva >= finfo->data_end - finfo->data) + overrun (finfo, "named resource"); + re->subdir = 0; + re->u.res = read_coff_data_entry (finfo->data + rva, finfo, type); + } + + *pp = re; + pp = &re->next; + } + + for (i = 0; i < id_count; i++, ere++) + { + unsigned long name, rva; + struct res_entry *re; + + if ((const bfd_byte *) ere >= finfo->data_end) + overrun (finfo, "ID directory entry"); + + name = getfi_32 (finfo, ere->name); + rva = getfi_32 (finfo, ere->rva); + + re = (struct res_entry *) res_alloc (sizeof *re); + re->next = NULL; + re->id.named = 0; + re->id.u.id = name; + + if (level == 0) + type = &re->id; + + if ((rva & 0x80000000) != 0) + { + rva &=~ 0x80000000; + if (rva >= finfo->data_end - finfo->data) + overrun (finfo, "ID subdirectory"); + re->subdir = 1; + re->u.dir = read_coff_res_dir (finfo->data + rva, finfo, type, + level + 1); + } + else + { + if (rva >= finfo->data_end - finfo->data) + overrun (finfo, "ID resource"); + re->subdir = 0; + re->u.res = read_coff_data_entry (finfo->data + rva, finfo, type); + } + + *pp = re; + pp = &re->next; + } + + return rd; +} + +/* Read a resource data entry. */ + +static struct res_resource * +read_coff_data_entry (data, finfo, type) + const bfd_byte *data; + const struct coff_file_info *finfo; + const struct res_id *type; +{ + const struct extern_res_data *erd; + struct res_resource *r; + unsigned long size, rva; + const bfd_byte *resdata; + + if (type == NULL) + fatal ("resource type unknown"); + + if (finfo->data_end - data < sizeof (struct extern_res_data)) + overrun (finfo, "data entry"); + + erd = (const struct extern_res_data *) data; + + size = getfi_32 (finfo, erd->size); + rva = getfi_32 (finfo, erd->rva); + if (rva < finfo->secaddr + || rva - finfo->secaddr >= finfo->data_end - finfo->data) + overrun (finfo, "resource data"); + + resdata = finfo->data + (rva - finfo->secaddr); + + if (size > finfo->data_end - resdata) + overrun (finfo, "resource data size"); + + r = bin_to_res (*type, resdata, size, finfo->big_endian); + + memset (&r->res_info, 0, sizeof (struct res_res_info)); + r->coff_info.codepage = getfi_32 (finfo, erd->codepage); + r->coff_info.reserved = getfi_32 (finfo, erd->reserved); + + return r; +} + +/* This structure is used to build a list of bindata structures. */ + +struct bindata_build +{ + /* The data. */ + struct bindata *d; + /* The last structure we have added to the list. */ + struct bindata *last; + /* The size of the list as a whole. */ + unsigned long length; +}; + +/* This structure keeps track of information as we build the directory + tree. */ + +struct coff_write_info +{ + /* These fields are based on the BFD. */ + /* The BFD itself. */ + bfd *abfd; + /* Non-zero if the file is big endian. */ + int big_endian; + /* Pointer to section symbol used to build RVA relocs. */ + asymbol **sympp; + + /* These fields are computed initially, and then not changed. */ + /* Length of directory tables and entries. */ + unsigned long dirsize; + /* Length of directory entry strings. */ + unsigned long dirstrsize; + /* Length of resource data entries. */ + unsigned long dataentsize; + + /* These fields are updated as we add data. */ + /* Directory tables and entries. */ + struct bindata_build dirs; + /* Directory entry strings. */ + struct bindata_build dirstrs; + /* Resource data entries. */ + struct bindata_build dataents; + /* Actual resource data. */ + struct bindata_build resources; + /* Relocations. */ + arelent **relocs; + /* Number of relocations. */ + unsigned int reloc_count; +}; + +/* Macros to swap out values. */ + +#define putcwi_16(cwi, v, s) \ + ((cwi->big_endian) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s))) +#define putcwi_32(cwi, v, s) \ + ((cwi->big_endian) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s))) + +static void coff_bin_sizes + PARAMS ((const struct res_directory *, struct coff_write_info *)); +static unsigned char *coff_alloc PARAMS ((struct bindata_build *, size_t)); +static void coff_to_bin + PARAMS ((const struct res_directory *, struct coff_write_info *)); +static void coff_res_to_bin + PARAMS ((const struct res_resource *, struct coff_write_info *)); + +/* Write resources to a COFF file. RESOURCES should already be + sorted. + + Right now we always create a new file. Someday we should also + offer the ability to merge resources into an existing file. This + would require doing the basic work of objcopy, just modifying or + adding the .rsrc section. */ + +void +write_coff_file (filename, target, resources) + const char *filename; + const char *target; + const struct res_directory *resources; +{ + bfd *abfd; + asection *sec; + struct coff_write_info cwi; + struct bindata *d; + unsigned long length, offset; + + if (filename == NULL) + fatal ("filename required for COFF output"); + + abfd = bfd_openw (filename, target); + if (abfd == NULL) + bfd_fatal (filename); + + if (! bfd_set_format (abfd, bfd_object)) + bfd_fatal ("bfd_set_format"); + + /* FIXME: This is obviously i386 specific. */ + if (! bfd_set_arch_mach (abfd, bfd_arch_i386, 0)) + bfd_fatal ("bfd_set_arch_mach"); + + if (! bfd_set_file_flags (abfd, HAS_SYMS | HAS_RELOC)) + bfd_fatal ("bfd_set_file_flags"); + + sec = bfd_make_section (abfd, ".rsrc"); + if (sec == NULL) + bfd_fatal ("bfd_make_section"); + + if (! bfd_set_section_flags (abfd, sec, + (SEC_HAS_CONTENTS | SEC_ALLOC + | SEC_LOAD | SEC_DATA))) + bfd_fatal ("bfd_set_section_flags"); + + if (! bfd_set_symtab (abfd, sec->symbol_ptr_ptr, 1)) + bfd_fatal ("bfd_set_symtab"); + + /* Requiring this is probably a bug in BFD. */ + sec->output_section = sec; + + /* The order of data in the .rsrc section is + resource directory tables and entries + resource directory strings + resource data entries + actual resource data + + We build these different types of data in different lists. */ + + cwi.abfd = abfd; + cwi.big_endian = bfd_big_endian (abfd); + cwi.sympp = sec->symbol_ptr_ptr; + cwi.dirsize = 0; + cwi.dirstrsize = 0; + cwi.dataentsize = 0; + cwi.dirs.d = NULL; + cwi.dirs.last = NULL; + cwi.dirs.length = 0; + cwi.dirstrs.d = NULL; + cwi.dirstrs.last = NULL; + cwi.dirstrs.length = 0; + cwi.dataents.d = NULL; + cwi.dataents.last = NULL; + cwi.dataents.length = 0; + cwi.resources.d = NULL; + cwi.resources.last = NULL; + cwi.resources.length = 0; + cwi.relocs = NULL; + cwi.reloc_count = 0; + + /* Work out the sizes of the resource directory entries, so that we + know the various offsets we will need. */ + coff_bin_sizes (resources, &cwi); + + /* Force the directory strings to be 32 bit aligned. Every other + structure is 32 bit aligned anyhow. */ + cwi.dirstrsize = (cwi.dirstrsize + 3) &~ 3; + + /* Actually convert the resources to binary. */ + coff_to_bin (resources, &cwi); + + /* Add another 2 bytes to the directory strings if needed for + alignment. */ + if ((cwi.dirstrs.length & 3) != 0) + { + unsigned char *ex; + + ex = coff_alloc (&cwi.dirstrs, 2); + ex[0] = 0; + ex[1] = 0; + } + + /* Make sure that the data we built came out to the same size as we + calculated initially. */ + assert (cwi.dirs.length == cwi.dirsize); + assert (cwi.dirstrs.length == cwi.dirstrsize); + assert (cwi.dataents.length == cwi.dataentsize); + + length = (cwi.dirsize + + cwi.dirstrsize + + cwi.dataentsize + + cwi.resources.length); + + if (! bfd_set_section_size (abfd, sec, length)) + bfd_fatal ("bfd_set_section_size"); + + bfd_set_reloc (abfd, sec, cwi.relocs, cwi.reloc_count); + + offset = 0; + for (d = cwi.dirs.d; d != NULL; d = d->next) + { + if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length)) + bfd_fatal ("bfd_set_section_contents"); + offset += d->length; + } + for (d = cwi.dirstrs.d; d != NULL; d = d->next) + { + if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length)) + bfd_fatal ("bfd_set_section_contents"); + offset += d->length; + } + for (d = cwi.dataents.d; d != NULL; d = d->next) + { + if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length)) + bfd_fatal ("bfd_set_section_contents"); + offset += d->length; + } + for (d = cwi.resources.d; d != NULL; d = d->next) + { + if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length)) + bfd_fatal ("bfd_set_section_contents"); + offset += d->length; + } + + assert (offset == length); + + if (! bfd_close (abfd)) + bfd_fatal ("bfd_close"); + + /* We allocated the relocs array using malloc. */ + free (cwi.relocs); +} + +/* Work out the sizes of the various fixed size resource directory + entries. This updates fields in CWI. */ + +static void +coff_bin_sizes (resdir, cwi) + const struct res_directory *resdir; + struct coff_write_info *cwi; +{ + const struct res_entry *re; + + cwi->dirsize += sizeof (struct extern_res_directory); + + for (re = resdir->entries; re != NULL; re = re->next) + { + cwi->dirsize += sizeof (struct extern_res_entry); + + if (re->id.named) + cwi->dirstrsize += re->id.u.n.length * 2 + 2; + + if (re->subdir) + coff_bin_sizes (re->u.dir, cwi); + else + cwi->dataentsize += sizeof (struct extern_res_data); + } +} + +/* Allocate data for a particular list. */ + +static unsigned char * +coff_alloc (bb, size) + struct bindata_build *bb; + size_t size; +{ + struct bindata *d; + + d = (struct bindata *) reswr_alloc (sizeof *d); + + d->next = NULL; + d->data = (unsigned char *) reswr_alloc (size); + d->length = size; + + if (bb->d == NULL) + bb->d = d; + else + bb->last->next = d; + bb->last = d; + bb->length += size; + + return d->data; +} + +/* Convert the resource directory RESDIR to binary. */ + +static void +coff_to_bin (resdir, cwi) + const struct res_directory *resdir; + struct coff_write_info *cwi; +{ + struct extern_res_directory *erd; + int ci, cn; + const struct res_entry *e; + struct extern_res_entry *ere; + + /* Write out the directory table. */ + + erd = ((struct extern_res_directory *) + coff_alloc (&cwi->dirs, sizeof (*erd))); + + putcwi_32 (cwi, resdir->characteristics, erd->characteristics); + putcwi_32 (cwi, resdir->time, erd->time); + putcwi_16 (cwi, resdir->major, erd->major); + putcwi_16 (cwi, resdir->minor, erd->minor); + + ci = 0; + cn = 0; + for (e = resdir->entries; e != NULL; e = e->next) + { + if (e->id.named) + ++cn; + else + ++ci; + } + + putcwi_16 (cwi, cn, erd->name_count); + putcwi_16 (cwi, ci, erd->id_count); + + /* Write out the data entries. Note that we allocate space for all + the entries before writing them out. That permits a recursive + call to work correctly when writing out subdirectories. */ + + ere = ((struct extern_res_entry *) + coff_alloc (&cwi->dirs, (ci + cn) * sizeof (*ere))); + for (e = resdir->entries; e != NULL; e = e->next, ere++) + { + if (! e->id.named) + putcwi_32 (cwi, e->id.u.id, ere->name); + else + { + unsigned char *str; + int i; + + /* For some reason existing files seem to have the high bit + set on the address of the name, although that is not + documented. */ + putcwi_32 (cwi, + 0x80000000 | (cwi->dirsize + cwi->dirstrs.length), + ere->name); + + str = coff_alloc (&cwi->dirstrs, e->id.u.n.length * 2 + 2); + putcwi_16 (cwi, e->id.u.n.length, str); + for (i = 0; i < e->id.u.n.length; i++) + putcwi_16 (cwi, e->id.u.n.name[i], str + i * 2 + 2); + } + + if (e->subdir) + { + putcwi_32 (cwi, 0x80000000 | cwi->dirs.length, ere->rva); + coff_to_bin (e->u.dir, cwi); + } + else + { + putcwi_32 (cwi, + cwi->dirsize + cwi->dirstrsize + cwi->dataents.length, + ere->rva); + + coff_res_to_bin (e->u.res, cwi); + } + } +} + +/* Convert the resource RES to binary. */ + +static void +coff_res_to_bin (res, cwi) + const struct res_resource *res; + struct coff_write_info *cwi; +{ + arelent *r; + struct extern_res_data *erd; + struct bindata *d; + unsigned long length; + + /* For some reason, although every other address is a section + offset, the address of the resource data itself is an RVA. That + means that we need to generate a relocation for it. We allocate + the relocs array using malloc so that we can use realloc. FIXME: + This relocation handling is correct for the i386, but probably + not for any other target. */ + + r = (arelent *) reswr_alloc (sizeof (arelent)); + r->sym_ptr_ptr = cwi->sympp; + r->address = cwi->dirsize + cwi->dirstrsize + cwi->dataents.length; + r->addend = 0; + r->howto = bfd_reloc_type_lookup (cwi->abfd, BFD_RELOC_RVA); + if (r->howto == NULL) + bfd_fatal ("can't get BFD_RELOC_RVA relocation type"); + + cwi->relocs = xrealloc (cwi->relocs, + (cwi->reloc_count + 2) * sizeof (arelent *)); + cwi->relocs[cwi->reloc_count] = r; + cwi->relocs[cwi->reloc_count + 1] = NULL; + ++cwi->reloc_count; + + erd = (struct extern_res_data *) coff_alloc (&cwi->dataents, sizeof (*erd)); + + putcwi_32 (cwi, + (cwi->dirsize + + cwi->dirstrsize + + cwi->dataentsize + + cwi->resources.length), + erd->rva); + putcwi_32 (cwi, res->coff_info.codepage, erd->codepage); + putcwi_32 (cwi, res->coff_info.reserved, erd->reserved); + + d = res_to_bin (res, cwi->big_endian); + + if (cwi->resources.d == NULL) + cwi->resources.d = d; + else + cwi->resources.last->next = d; + + length = 0; + for (; d->next != NULL; d = d->next) + length += d->length; + length += d->length; + cwi->resources.last = d; + cwi->resources.length += length; + + putcwi_32 (cwi, length, erd->size); + + /* Force the next resource to have 32 bit alignment. */ + + if ((length & 3) != 0) + { + int add; + unsigned char *ex; + + add = 4 - (length & 3); + + ex = coff_alloc (&cwi->resources, add); + memset (ex, 0, add); + } +} diff --git a/gnu/dist/binutils/resrc.c b/gnu/dist/binutils/resrc.c new file mode 100644 index 00000000000..a836780107c --- /dev/null +++ b/gnu/dist/binutils/resrc.c @@ -0,0 +1,2260 @@ +/* resrc.c -- read and write Windows rc files. + Copyright 1997, 1998 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This file contains functions that read and write Windows rc files. + These are text files that represent resources. */ + +#include "bfd.h" +#include "bucomm.h" +#include "libiberty.h" +#include "windres.h" + +#include <assert.h> +#include <ctype.h> +#include <sys/stat.h> + +#if defined (_WIN32) && ! defined (__CYGWIN32__) +#define popen _popen +#define pclose _pclose +#endif + +/* The default preprocessor. */ + +#define DEFAULT_PREPROCESSOR "gcc -E -xc-header -DRC_INVOKED" + +/* We read the directory entries in a cursor or icon file into + instances of this structure. */ + +struct icondir +{ + /* Width of image. */ + unsigned char width; + /* Height of image. */ + unsigned char height; + /* Number of colors in image. */ + unsigned char colorcount; + union + { + struct + { + /* Color planes. */ + unsigned short planes; + /* Bits per pixel. */ + unsigned short bits; + } icon; + struct + { + /* X coordinate of hotspot. */ + unsigned short xhotspot; + /* Y coordinate of hotspot. */ + unsigned short yhotspot; + } cursor; + } u; + /* Bytes in image. */ + unsigned long bytes; + /* File offset of image. */ + unsigned long offset; +}; + +/* The name of the rc file we are reading. */ + +char *rc_filename; + +/* The line number in the rc file. */ + +int rc_lineno; + +/* The pipe we are reading from, so that we can close it if we exit. */ + +static FILE *cpp_pipe; + +/* As we read the rc file, we attach information to this structure. */ + +static struct res_directory *resources; + +/* The number of cursor resources we have written out. */ + +static int cursors; + +/* The number of font resources we have written out. */ + +static int fonts; + +/* Font directory information. */ + +struct fontdir *fontdirs; + +/* Resource info to use for fontdirs. */ + +struct res_res_info fontdirs_resinfo; + +/* The number of icon resources we have written out. */ + +static int icons; + +/* Local functions. */ + +static void close_pipe PARAMS ((void)); +static void unexpected_eof PARAMS ((const char *)); +static int get_word PARAMS ((FILE *, const char *)); +static unsigned long get_long PARAMS ((FILE *, const char *)); +static void get_data + PARAMS ((FILE *, unsigned char *, unsigned long, const char *)); +static void define_fontdirs PARAMS ((void)); + +/* Read an rc file. */ + +struct res_directory * +read_rc_file (filename, preprocessor, preprocargs, language) + const char *filename; + const char *preprocessor; + const char *preprocargs; + int language; +{ + char *cmd; + + if (preprocessor == NULL) + preprocessor = DEFAULT_PREPROCESSOR; + + if (preprocargs == NULL) + preprocargs = ""; + if (filename == NULL) + filename = "-"; + + cmd = xmalloc (strlen (preprocessor) + + strlen (preprocargs) + + strlen (filename) + + 10); + sprintf (cmd, "%s %s %s", preprocessor, preprocargs, filename); + + cpp_pipe = popen (cmd, FOPEN_RT); + if (cpp_pipe == NULL) + fatal ("can't popen `%s': %s", cmd, strerror (errno)); + free (cmd); + + xatexit (close_pipe); + + rc_filename = xstrdup (filename); + rc_lineno = 1; + if (language != -1) + rcparse_set_language (language); + yyin = cpp_pipe; + yyparse (); + + if (pclose (cpp_pipe) != 0) + fprintf (stderr, "%s: warning: preprocessor failed\n", program_name); + cpp_pipe = NULL; + + if (fontdirs != NULL) + define_fontdirs (); + + free (rc_filename); + rc_filename = NULL; + + return resources; +} + +/* Close the pipe if it is open. This is called via xatexit. */ + +void +close_pipe () +{ + if (cpp_pipe != NULL) + pclose (cpp_pipe); +} + +/* Report an error while reading an rc file. */ + +void +yyerror (msg) + const char *msg; +{ + fatal ("%s:%d: %s", rc_filename, rc_lineno, msg); +} + +/* Issue a warning while reading an rc file. */ + +void +rcparse_warning (msg) + const char *msg; +{ + fprintf (stderr, "%s:%d: %s\n", rc_filename, rc_lineno, msg); +} + +/* Die if we get an unexpected end of file. */ + +static void +unexpected_eof (msg) + const char *msg; +{ + fatal ("%s: unexpected EOF", msg); +} + +/* Read a 16 bit word from a file. The data is assumed to be little + endian. */ + +static int +get_word (e, msg) + FILE *e; + const char *msg; +{ + int b1, b2; + + b1 = getc (e); + b2 = getc (e); + if (feof (e)) + unexpected_eof (msg); + return ((b2 & 0xff) << 8) | (b1 & 0xff); +} + +/* Read a 32 bit word from a file. The data is assumed to be little + endian. */ + +static unsigned long +get_long (e, msg) + FILE *e; + const char *msg; +{ + int b1, b2, b3, b4; + + b1 = getc (e); + b2 = getc (e); + b3 = getc (e); + b4 = getc (e); + if (feof (e)) + unexpected_eof (msg); + return (((((((b4 & 0xff) << 8) + | (b3 & 0xff)) << 8) + | (b2 & 0xff)) << 8) + | (b1 & 0xff)); +} + +/* Read data from a file. This is a wrapper to do error checking. */ + +static void +get_data (e, p, c, msg) + FILE *e; + unsigned char *p; + unsigned long c; + const char *msg; +{ + unsigned long got; + + got = fread (p, 1, c, e); + if (got == c) + return; + + fatal ("%s: read of %lu returned %lu", msg, c, got); +} + +/* Define an accelerator resource. */ + +void +define_accelerator (id, resinfo, data) + struct res_id id; + const struct res_res_info *resinfo; + struct accelerator *data; +{ + struct res_resource *r; + + r = define_standard_resource (&resources, RT_ACCELERATORS, id, + resinfo->language, 0); + r->type = RES_TYPE_ACCELERATOR; + r->u.acc = data; + r->res_info = *resinfo; +} + +/* Define a bitmap resource. Bitmap data is stored in a file. The + first 14 bytes of the file are a standard header, which is not + included in the resource data. */ + +#define BITMAP_SKIP (14) + +void +define_bitmap (id, resinfo, filename) + struct res_id id; + const struct res_res_info *resinfo; + const char *filename; +{ + FILE *e; + char *real_filename; + struct stat s; + unsigned char *data; + int i; + struct res_resource *r; + + e = open_file_search (filename, FOPEN_RB, "bitmap file", &real_filename); + + if (stat (real_filename, &s) < 0) + fatal ("stat failed on bitmap file `%s': %s", real_filename, + strerror (errno)); + + data = (unsigned char *) res_alloc (s.st_size - BITMAP_SKIP); + + for (i = 0; i < BITMAP_SKIP; i++) + getc (e); + + get_data (e, data, s.st_size - BITMAP_SKIP, real_filename); + + fclose (e); + free (real_filename); + + r = define_standard_resource (&resources, RT_BITMAP, id, + resinfo->language, 0); + + r->type = RES_TYPE_BITMAP; + r->u.data.length = s.st_size - BITMAP_SKIP; + r->u.data.data = data; + r->res_info = *resinfo; +} + +/* Define a cursor resource. A cursor file may contain a set of + bitmaps, each representing the same cursor at various different + resolutions. They each get written out with a different ID. The + real cursor resource is then a group resource which can be used to + select one of the actual cursors. */ + +void +define_cursor (id, resinfo, filename) + struct res_id id; + const struct res_res_info *resinfo; + const char *filename; +{ + FILE *e; + char *real_filename; + int type, count, i; + struct icondir *icondirs; + int first_cursor; + struct res_resource *r; + struct group_cursor *first, **pp; + + e = open_file_search (filename, FOPEN_RB, "cursor file", &real_filename); + + /* A cursor file is basically an icon file. The start of the file + is a three word structure. The first word is ignored. The + second word is the type of data. The third word is the number of + entries. */ + + get_word (e, real_filename); + type = get_word (e, real_filename); + count = get_word (e, real_filename); + if (type != 2) + fatal ("cursor file `%s' does not contain cursor data", real_filename); + + /* Read in the icon directory entries. */ + + icondirs = (struct icondir *) xmalloc (count * sizeof *icondirs); + + for (i = 0; i < count; i++) + { + icondirs[i].width = getc (e); + icondirs[i].height = getc (e); + icondirs[i].colorcount = getc (e); + getc (e); + icondirs[i].u.cursor.xhotspot = get_word (e, real_filename); + icondirs[i].u.cursor.yhotspot = get_word (e, real_filename); + icondirs[i].bytes = get_long (e, real_filename); + icondirs[i].offset = get_long (e, real_filename); + + if (feof (e)) + unexpected_eof (real_filename); + } + + /* Define each cursor as a unique resource. */ + + first_cursor = cursors; + + for (i = 0; i < count; i++) + { + unsigned char *data; + struct res_id name; + struct cursor *c; + + if (fseek (e, icondirs[i].offset, SEEK_SET) != 0) + fatal ("%s: fseek to %lu failed: %s", real_filename, + icondirs[i].offset, strerror (errno)); + + data = (unsigned char *) res_alloc (icondirs[i].bytes); + + get_data (e, data, icondirs[i].bytes, real_filename); + + c = (struct cursor *) res_alloc (sizeof *c); + c->xhotspot = icondirs[i].u.cursor.xhotspot; + c->yhotspot = icondirs[i].u.cursor.yhotspot; + c->length = icondirs[i].bytes; + c->data = data; + + ++cursors; + + name.named = 0; + name.u.id = cursors; + + r = define_standard_resource (&resources, RT_CURSOR, name, + resinfo->language, 0); + r->type = RES_TYPE_CURSOR; + r->u.cursor = c; + r->res_info = *resinfo; + } + + fclose (e); + free (real_filename); + + /* Define a cursor group resource. */ + + first = NULL; + pp = &first; + for (i = 0; i < count; i++) + { + struct group_cursor *cg; + + cg = (struct group_cursor *) res_alloc (sizeof *cg); + cg->next = NULL; + cg->width = icondirs[i].width; + cg->height = 2 * icondirs[i].height; + + /* FIXME: What should these be set to? */ + cg->planes = 1; + cg->bits = 1; + + cg->bytes = icondirs[i].bytes + 4; + cg->index = first_cursor + i + 1; + + *pp = cg; + pp = &(*pp)->next; + } + + free (icondirs); + + r = define_standard_resource (&resources, RT_GROUP_CURSOR, id, + resinfo->language, 0); + r->type = RES_TYPE_GROUP_CURSOR; + r->u.group_cursor = first; + r->res_info = *resinfo; +} + +/* Define a dialog resource. */ + +void +define_dialog (id, resinfo, dialog) + struct res_id id; + const struct res_res_info *resinfo; + const struct dialog *dialog; +{ + struct dialog *copy; + struct res_resource *r; + + copy = (struct dialog *) res_alloc (sizeof *copy); + *copy = *dialog; + + r = define_standard_resource (&resources, RT_DIALOG, id, + resinfo->language, 0); + r->type = RES_TYPE_DIALOG; + r->u.dialog = copy; + r->res_info = *resinfo; +} + +/* Define a dialog control. This does not define a resource, but + merely allocates and fills in a structure. */ + +struct dialog_control * +define_control (text, id, x, y, width, height, class, style, exstyle) + const char *text; + unsigned long id; + unsigned long x; + unsigned long y; + unsigned long width; + unsigned long height; + unsigned long class; + unsigned long style; + unsigned long exstyle; +{ + struct dialog_control *n; + + n = (struct dialog_control *) res_alloc (sizeof *n); + n->next = NULL; + n->id = id; + n->style = style; + n->exstyle = exstyle; + n->x = x; + n->y = y; + n->width = width; + n->height = height; + n->class.named = 0; + n->class.u.id = class; + if (text != NULL) + res_string_to_id (&n->text, text); + else + { + n->text.named = 0; + n->text.u.id = 0; + } + n->data = NULL; + n->help = 0; + + return n; +} + +/* Define a font resource. */ + +void +define_font (id, resinfo, filename) + struct res_id id; + const struct res_res_info *resinfo; + const char *filename; +{ + FILE *e; + char *real_filename; + struct stat s; + unsigned char *data; + struct res_resource *r; + long offset; + long fontdatalength; + unsigned char *fontdata; + struct fontdir *fd; + const char *device, *face; + struct fontdir **pp; + + e = open_file_search (filename, FOPEN_RB, "font file", &real_filename); + + if (stat (real_filename, &s) < 0) + fatal ("stat failed on bitmap file `%s': %s", real_filename, + strerror (errno)); + + data = (unsigned char *) res_alloc (s.st_size); + + get_data (e, data, s.st_size, real_filename); + + fclose (e); + free (real_filename); + + r = define_standard_resource (&resources, RT_FONT, id, + resinfo->language, 0); + + r->type = RES_TYPE_FONT; + r->u.data.length = s.st_size; + r->u.data.data = data; + r->res_info = *resinfo; + + /* For each font resource, we must add an entry in the FONTDIR + resource. The FONTDIR resource includes some strings in the font + file. To find them, we have to do some magic on the data we have + read. */ + + offset = ((((((data[47] << 8) + | data[46]) << 8) + | data[45]) << 8) + | data[44]); + if (offset > 0 && offset < s.st_size) + device = (char *) data + offset; + else + device = ""; + + offset = ((((((data[51] << 8) + | data[50]) << 8) + | data[49]) << 8) + | data[48]); + if (offset > 0 && offset < s.st_size) + face = (char *) data + offset; + else + face = ""; + + ++fonts; + + fontdatalength = 58 + strlen (device) + strlen (face); + fontdata = (unsigned char *) res_alloc (fontdatalength); + memcpy (fontdata, data, 56); + strcpy ((char *) fontdata + 56, device); + strcpy ((char *) fontdata + 57 + strlen (device), face); + + fd = (struct fontdir *) res_alloc (sizeof *fd); + fd->next = NULL; + fd->index = fonts; + fd->length = fontdatalength; + fd->data = fontdata; + + for (pp = &fontdirs; *pp != NULL; pp = &(*pp)->next) + ; + *pp = fd; + + /* For the single fontdirs resource, we always use the resource + information of the last font. I don't know what else to do. */ + fontdirs_resinfo = *resinfo; +} + +/* Define the fontdirs resource. This is called after the entire rc + file has been parsed, if any font resources were seen. */ + +static void +define_fontdirs () +{ + struct res_resource *r; + struct res_id id; + + id.named = 0; + id.u.id = 1; + + r = define_standard_resource (&resources, RT_FONTDIR, id, 0x409, 0); + + r->type = RES_TYPE_FONTDIR; + r->u.fontdir = fontdirs; + r->res_info = fontdirs_resinfo; +} + +/* Define an icon resource. An icon file may contain a set of + bitmaps, each representing the same icon at various different + resolutions. They each get written out with a different ID. The + real icon resource is then a group resource which can be used to + select one of the actual icon bitmaps. */ + +void +define_icon (id, resinfo, filename) + struct res_id id; + const struct res_res_info *resinfo; + const char *filename; +{ + FILE *e; + char *real_filename; + int type, count, i; + struct icondir *icondirs; + int first_icon; + struct res_resource *r; + struct group_icon *first, **pp; + + e = open_file_search (filename, FOPEN_RB, "icon file", &real_filename); + + /* The start of an icon file is a three word structure. The first + word is ignored. The second word is the type of data. The third + word is the number of entries. */ + + get_word (e, real_filename); + type = get_word (e, real_filename); + count = get_word (e, real_filename); + if (type != 1) + fatal ("icon file `%s' does not contain icon data", real_filename); + + /* Read in the icon directory entries. */ + + icondirs = (struct icondir *) xmalloc (count * sizeof *icondirs); + + for (i = 0; i < count; i++) + { + icondirs[i].width = getc (e); + icondirs[i].height = getc (e); + icondirs[i].colorcount = getc (e); + getc (e); + icondirs[i].u.icon.planes = get_word (e, real_filename); + icondirs[i].u.icon.bits = get_word (e, real_filename); + icondirs[i].bytes = get_long (e, real_filename); + icondirs[i].offset = get_long (e, real_filename); + + if (feof (e)) + unexpected_eof (real_filename); + } + + /* Define each icon as a unique resource. */ + + first_icon = icons; + + for (i = 0; i < count; i++) + { + unsigned char *data; + struct res_id name; + + if (fseek (e, icondirs[i].offset, SEEK_SET) != 0) + fatal ("%s: fseek to %lu failed: %s", real_filename, + icondirs[i].offset, strerror (errno)); + + data = (unsigned char *) res_alloc (icondirs[i].bytes); + + get_data (e, data, icondirs[i].bytes, real_filename); + + ++icons; + + name.named = 0; + name.u.id = icons; + + r = define_standard_resource (&resources, RT_ICON, name, + resinfo->language, 0); + r->type = RES_TYPE_ICON; + r->u.data.length = icondirs[i].bytes; + r->u.data.data = data; + r->res_info = *resinfo; + } + + fclose (e); + free (real_filename); + + /* Define an icon group resource. */ + + first = NULL; + pp = &first; + for (i = 0; i < count; i++) + { + struct group_icon *cg; + + /* For some reason, at least in some files the planes and bits + are zero. We instead set them from the color. This is + copied from rcl. */ + + cg = (struct group_icon *) res_alloc (sizeof *cg); + cg->next = NULL; + cg->width = icondirs[i].width; + cg->height = icondirs[i].height; + cg->colors = icondirs[i].colorcount; + + cg->planes = 1; + cg->bits = 0; + while ((1 << cg->bits) < cg->colors) + ++cg->bits; + + cg->bytes = icondirs[i].bytes; + cg->index = first_icon + i + 1; + + *pp = cg; + pp = &(*pp)->next; + } + + free (icondirs); + + r = define_standard_resource (&resources, RT_GROUP_ICON, id, + resinfo->language, 0); + r->type = RES_TYPE_GROUP_ICON; + r->u.group_icon = first; + r->res_info = *resinfo; +} + +/* Define a menu resource. */ + +void +define_menu (id, resinfo, menuitems) + struct res_id id; + const struct res_res_info *resinfo; + struct menuitem *menuitems; +{ + struct menu *m; + struct res_resource *r; + + m = (struct menu *) res_alloc (sizeof *m); + m->items = menuitems; + m->help = 0; + + r = define_standard_resource (&resources, RT_MENU, id, resinfo->language, 0); + r->type = RES_TYPE_MENU; + r->u.menu = m; + r->res_info = *resinfo; +} + +/* Define a menu item. This does not define a resource, but merely + allocates and fills in a structure. */ + +struct menuitem * +define_menuitem (text, menuid, type, state, help, menuitems) + const char *text; + int menuid; + unsigned long type; + unsigned long state; + unsigned long help; + struct menuitem *menuitems; +{ + struct menuitem *mi; + + mi = (struct menuitem *) res_alloc (sizeof *mi); + mi->next = NULL; + mi->type = type; + mi->state = state; + mi->id = menuid; + if (text == NULL) + mi->text = NULL; + else + unicode_from_ascii ((int *) NULL, &mi->text, text); + mi->help = help; + mi->popup = menuitems; + return mi; +} + +/* Define a messagetable resource. */ + +void +define_messagetable (id, resinfo, filename) + struct res_id id; + const struct res_res_info *resinfo; + const char *filename; +{ + FILE *e; + char *real_filename; + struct stat s; + unsigned char *data; + struct res_resource *r; + + e = open_file_search (filename, FOPEN_RB, "messagetable file", + &real_filename); + + if (stat (real_filename, &s) < 0) + fatal ("stat failed on bitmap file `%s': %s", real_filename, + strerror (errno)); + + data = (unsigned char *) res_alloc (s.st_size); + + get_data (e, data, s.st_size, real_filename); + + fclose (e); + free (real_filename); + + r = define_standard_resource (&resources, RT_MESSAGETABLE, id, + resinfo->language, 0); + + r->type = RES_TYPE_MESSAGETABLE; + r->u.data.length = s.st_size; + r->u.data.data = data; + r->res_info = *resinfo; +} + +/* Define an rcdata resource. */ + +void +define_rcdata (id, resinfo, data) + struct res_id id; + const struct res_res_info *resinfo; + struct rcdata_item *data; +{ + struct res_resource *r; + + r = define_standard_resource (&resources, RT_RCDATA, id, + resinfo->language, 0); + r->type = RES_TYPE_RCDATA; + r->u.rcdata = data; + r->res_info = *resinfo; +} + +/* Create an rcdata item holding a string. */ + +struct rcdata_item * +define_rcdata_string (string, len) + const char *string; + unsigned long len; +{ + struct rcdata_item *ri; + char *s; + + ri = (struct rcdata_item *) res_alloc (sizeof *ri); + ri->next = NULL; + ri->type = RCDATA_STRING; + ri->u.string.length = len; + s = (char *) res_alloc (len); + memcpy (s, string, len); + ri->u.string.s = s; + + return ri; +} + +/* Create an rcdata item holding a number. */ + +struct rcdata_item * +define_rcdata_number (val, dword) + unsigned long val; + int dword; +{ + struct rcdata_item *ri; + + ri = (struct rcdata_item *) res_alloc (sizeof *ri); + ri->next = NULL; + ri->type = dword ? RCDATA_DWORD : RCDATA_WORD; + ri->u.word = val; + + return ri; +} + +/* Define a stringtable resource. This is called for each string + which appears in a STRINGTABLE statement. */ + +void +define_stringtable (resinfo, stringid, string) + const struct res_res_info *resinfo; + unsigned long stringid; + const char *string; +{ + struct res_id id; + struct res_resource *r; + + id.named = 0; + id.u.id = (stringid >> 4) + 1; + r = define_standard_resource (&resources, RT_STRING, id, + resinfo->language, 1); + + if (r->type == RES_TYPE_UNINITIALIZED) + { + int i; + + r->type = RES_TYPE_STRINGTABLE; + r->u.stringtable = ((struct stringtable *) + res_alloc (sizeof (struct stringtable))); + for (i = 0; i < 16; i++) + { + r->u.stringtable->strings[i].length = 0; + r->u.stringtable->strings[i].string = NULL; + } + + r->res_info = *resinfo; + } + + unicode_from_ascii (&r->u.stringtable->strings[stringid & 0xf].length, + &r->u.stringtable->strings[stringid & 0xf].string, + string); +} + +/* Define a user data resource where the data is in the rc file. */ + +void +define_user_data (id, type, resinfo, data) + struct res_id id; + struct res_id type; + const struct res_res_info *resinfo; + struct rcdata_item *data; +{ + struct res_id ids[3]; + struct res_resource *r; + + ids[0] = type; + ids[1] = id; + ids[2].named = 0; + ids[2].u.id = resinfo->language; + + r = define_resource (&resources, 3, ids, 0); + r->type = RES_TYPE_USERDATA; + r->u.userdata = data; + r->res_info = *resinfo; +} + +/* Define a user data resource where the data is in a file. */ + +void +define_user_file (id, type, resinfo, filename) + struct res_id id; + struct res_id type; + const struct res_res_info *resinfo; + const char *filename; +{ + FILE *e; + char *real_filename; + struct stat s; + unsigned char *data; + struct res_id ids[3]; + struct res_resource *r; + + e = open_file_search (filename, FOPEN_RB, "font file", &real_filename); + + if (stat (real_filename, &s) < 0) + fatal ("stat failed on bitmap file `%s': %s", real_filename, + strerror (errno)); + + data = (unsigned char *) res_alloc (s.st_size); + + get_data (e, data, s.st_size, real_filename); + + fclose (e); + free (real_filename); + + ids[0] = type; + ids[1] = id; + ids[2].named = 0; + ids[2].u.id = resinfo->language; + + r = define_resource (&resources, 3, ids, 0); + r->type = RES_TYPE_USERDATA; + r->u.userdata = ((struct rcdata_item *) + res_alloc (sizeof (struct rcdata_item))); + r->u.userdata->next = NULL; + r->u.userdata->type = RCDATA_BUFFER; + r->u.userdata->u.buffer.length = s.st_size; + r->u.userdata->u.buffer.data = data; + r->res_info = *resinfo; +} + +/* Define a versioninfo resource. */ + +void +define_versioninfo (id, language, fixedverinfo, verinfo) + struct res_id id; + int language; + struct fixed_versioninfo *fixedverinfo; + struct ver_info *verinfo; +{ + struct res_resource *r; + + r = define_standard_resource (&resources, RT_VERSION, id, language, 0); + r->type = RES_TYPE_VERSIONINFO; + r->u.versioninfo = ((struct versioninfo *) + res_alloc (sizeof (struct versioninfo))); + r->u.versioninfo->fixed = fixedverinfo; + r->u.versioninfo->var = verinfo; + r->res_info.language = language; +} + +/* Add string version info to a list of version information. */ + +struct ver_info * +append_ver_stringfileinfo (verinfo, language, strings) + struct ver_info *verinfo; + const char *language; + struct ver_stringinfo *strings; +{ + struct ver_info *vi, **pp; + + vi = (struct ver_info *) res_alloc (sizeof *vi); + vi->next = NULL; + vi->type = VERINFO_STRING; + unicode_from_ascii ((int *) NULL, &vi->u.string.language, language); + vi->u.string.strings = strings; + + for (pp = &verinfo; *pp != NULL; pp = &(*pp)->next) + ; + *pp = vi; + + return verinfo; +} + +/* Add variable version info to a list of version information. */ + +struct ver_info * +append_ver_varfileinfo (verinfo, key, var) + struct ver_info *verinfo; + const char *key; + struct ver_varinfo *var; +{ + struct ver_info *vi, **pp; + + vi = (struct ver_info *) res_alloc (sizeof *vi); + vi->next = NULL; + vi->type = VERINFO_VAR; + unicode_from_ascii ((int *) NULL, &vi->u.var.key, key); + vi->u.var.var = var; + + for (pp = &verinfo; *pp != NULL; pp = &(*pp)->next) + ; + *pp = vi; + + return verinfo; +} + +/* Append version string information to a list. */ + +struct ver_stringinfo * +append_verval (strings, key, value) + struct ver_stringinfo *strings; + const char *key; + const char *value; +{ + struct ver_stringinfo *vs, **pp; + + vs = (struct ver_stringinfo *) res_alloc (sizeof *vs); + vs->next = NULL; + unicode_from_ascii ((int *) NULL, &vs->key, key); + unicode_from_ascii ((int *) NULL, &vs->value, value); + + for (pp = &strings; *pp != NULL; pp = &(*pp)->next) + ; + *pp = vs; + + return strings; +} + +/* Append version variable information to a list. */ + +struct ver_varinfo * +append_vertrans (var, language, charset) + struct ver_varinfo *var; + unsigned long language; + unsigned long charset; +{ + struct ver_varinfo *vv, **pp; + + vv = (struct ver_varinfo *) res_alloc (sizeof *vv); + vv->next = NULL; + vv->language = language; + vv->charset = charset; + + for (pp = &var; *pp != NULL; pp = &(*pp)->next) + ; + *pp = vv; + + return var; +} + +/* Local functions used to write out an rc file. */ + +static void indent PARAMS ((FILE *, int)); +static void write_rc_directory + PARAMS ((FILE *, const struct res_directory *, const struct res_id *, + const struct res_id *, int *, int)); +static void write_rc_subdir + PARAMS ((FILE *, const struct res_entry *, const struct res_id *, + const struct res_id *, int *, int)); +static void write_rc_resource + PARAMS ((FILE *, const struct res_id *, const struct res_id *, + const struct res_resource *, int *)); +static void write_rc_accelerators + PARAMS ((FILE *, const struct accelerator *)); +static void write_rc_cursor PARAMS ((FILE *, const struct cursor *)); +static void write_rc_group_cursor + PARAMS ((FILE *, const struct group_cursor *)); +static void write_rc_dialog PARAMS ((FILE *, const struct dialog *)); +static void write_rc_dialog_control + PARAMS ((FILE *, const struct dialog_control *)); +static void write_rc_fontdir PARAMS ((FILE *, const struct fontdir *)); +static void write_rc_group_icon PARAMS ((FILE *, const struct group_icon *)); +static void write_rc_menu PARAMS ((FILE *, const struct menu *, int)); +static void write_rc_menuitems + PARAMS ((FILE *, const struct menuitem *, int, int)); +static void write_rc_rcdata PARAMS ((FILE *, const struct rcdata_item *, int)); +static void write_rc_stringtable + PARAMS ((FILE *, const struct res_id *, const struct stringtable *)); +static void write_rc_versioninfo PARAMS ((FILE *, const struct versioninfo *)); +static void write_rc_filedata + PARAMS ((FILE *, unsigned long, const unsigned char *)); + +/* Indent a given number of spaces. */ + +static void +indent (e, c) + FILE *e; + int c; +{ + int i; + + for (i = 0; i < c; i++) + putc (' ', e); +} + +/* Dump the resources we have read in the format of an rc file. + + Actually, we don't use the format of an rc file, because it's way + too much of a pain--for example, we'd have to write icon resources + into a file and refer to that file. We just generate a readable + format that kind of looks like an rc file, and is useful for + understanding the contents of a resource file. Someday we may want + to generate an rc file which the rc compiler can read; if that day + comes, this code will have to be fixed up. */ + +void +write_rc_file (filename, resources) + const char *filename; + const struct res_directory *resources; +{ + FILE *e; + int language; + + if (filename == NULL) + e = stdout; + else + { + e = fopen (filename, FOPEN_WT); + if (e == NULL) + fatal ("can't open `%s' for output: %s", filename, strerror (errno)); + } + + language = -1; + write_rc_directory (e, resources, (const struct res_id *) NULL, + (const struct res_id *) NULL, &language, 1); +} + +/* Write out a directory. E is the file to write to. RD is the + directory. TYPE is a pointer to the level 1 ID which serves as the + resource type. NAME is a pointer to the level 2 ID which serves as + an individual resource name. LANGUAGE is a pointer to the current + language. LEVEL is the level in the tree. */ + +static void +write_rc_directory (e, rd, type, name, language, level) + FILE *e; + const struct res_directory *rd; + const struct res_id *type; + const struct res_id *name; + int *language; + int level; +{ + const struct res_entry *re; + + /* Print out some COFF information that rc files can't represent. */ + + if (rd->time != 0) + fprintf (e, "// Time stamp: %lu\n", rd->time); + if (rd->characteristics != 0) + fprintf (e, "// Characteristics: %lu\n", rd->characteristics); + if (rd->major != 0 || rd->minor != 0) + fprintf (e, "// Version: %d %d\n", rd->major, rd->minor); + + for (re = rd->entries; re != NULL; re = re->next) + { + switch (level) + { + case 1: + /* If we're at level 1, the key of this resource is the + type. This normally duplicates the information we have + stored with the resource itself, but we need to remember + the type if this is a user define resource type. */ + type = &re->id; + break; + + case 2: + /* If we're at level 2, the key of this resource is the name + we are going to use in the rc printout. */ + name = &re->id; + break; + + case 3: + /* If we're at level 3, then this key represents a language. + Use it to update the current language. */ + if (! re->id.named + && re->id.u.id != *language + && (re->id.u.id & 0xffff) == re->id.u.id) + { + fprintf (e, "LANGUAGE %lu, %lu\n", + re->id.u.id & 0xff, (re->id.u.id >> 8) & 0xff); + *language = re->id.u.id; + } + break; + + default: + break; + } + + if (re->subdir) + write_rc_subdir (e, re, type, name, language, level); + else + { + if (level == 3) + { + /* This is the normal case: the three levels are + TYPE/NAME/LANGUAGE. NAME will have been set at level + 2, and represents the name to use. We probably just + set LANGUAGE, and it will probably match what the + resource itself records if anything. */ + write_rc_resource (e, type, name, re->u.res, language); + } + else + { + fprintf (e, "// Resource at unexpected level %d\n", level); + write_rc_resource (e, type, (struct res_id *) NULL, re->u.res, + language); + } + } + } +} + +/* Write out a subdirectory entry. E is the file to write to. RE is + the subdirectory entry. TYPE and NAME are pointers to higher level + IDs, or NULL. LANGUAGE is a pointer to the current language. + LEVEL is the level in the tree. */ + +static void +write_rc_subdir (e, re, type, name, language, level) + FILE *e; + const struct res_entry *re; + const struct res_id *type; + const struct res_id *name; + int *language; + int level; +{ + fprintf (e, "\n"); + switch (level) + { + case 1: + fprintf (e, "// Type: "); + if (re->id.named) + res_id_print (e, re->id, 1); + else + { + const char *s; + + switch (re->id.u.id) + { + case RT_CURSOR: s = "cursor"; break; + case RT_BITMAP: s = "bitmap"; break; + case RT_ICON: s = "icon"; break; + case RT_MENU: s = "menu"; break; + case RT_DIALOG: s = "dialog"; break; + case RT_STRING: s = "stringtable"; break; + case RT_FONTDIR: s = "fontdir"; break; + case RT_FONT: s = "font"; break; + case RT_ACCELERATORS: s = "accelerators"; break; + case RT_RCDATA: s = "rcdata"; break; + case RT_MESSAGETABLE: s = "messagetable"; break; + case RT_GROUP_CURSOR: s = "group cursor"; break; + case RT_GROUP_ICON: s = "group icon"; break; + case RT_VERSION: s = "version"; break; + case RT_DLGINCLUDE: s = "dlginclude"; break; + case RT_PLUGPLAY: s = "plugplay"; break; + case RT_VXD: s = "vxd"; break; + case RT_ANICURSOR: s = "anicursor"; break; + case RT_ANIICON: s = "aniicon"; break; + default: s = NULL; break; + } + + if (s != NULL) + fprintf (e, "%s", s); + else + res_id_print (e, re->id, 1); + } + fprintf (e, "\n"); + break; + + case 2: + fprintf (e, "// Name: "); + res_id_print (e, re->id, 1); + fprintf (e, "\n"); + break; + + case 3: + fprintf (e, "// Language: "); + res_id_print (e, re->id, 1); + fprintf (e, "\n"); + break; + + default: + fprintf (e, "// Level %d: ", level); + res_id_print (e, re->id, 1); + fprintf (e, "\n"); + } + + write_rc_directory (e, re->u.dir, type, name, language, level + 1); +} + +/* Write out a single resource. E is the file to write to. TYPE is a + pointer to the type of the resource. NAME is a pointer to the name + of the resource; it will be NULL if there is a level mismatch. RES + is the resource data. LANGUAGE is a pointer to the current + language. */ + +static void +write_rc_resource (e, type, name, res, language) + FILE *e; + const struct res_id *type; + const struct res_id *name; + const struct res_resource *res; + int *language; +{ + const char *s; + int rt; + int menuex = 0; + + fprintf (e, "\n"); + + switch (res->type) + { + default: + abort (); + + case RES_TYPE_ACCELERATOR: + s = "ACCELERATOR"; + rt = RT_ACCELERATORS; + break; + + case RES_TYPE_BITMAP: + s = "BITMAP"; + rt = RT_BITMAP; + break; + + case RES_TYPE_CURSOR: + s = "CURSOR"; + rt = RT_CURSOR; + break; + + case RES_TYPE_GROUP_CURSOR: + s = "GROUP_CURSOR"; + rt = RT_GROUP_CURSOR; + break; + + case RES_TYPE_DIALOG: + if (extended_dialog (res->u.dialog)) + s = "DIALOGEX"; + else + s = "DIALOG"; + rt = RT_DIALOG; + break; + + case RES_TYPE_FONT: + s = "FONT"; + rt = RT_FONT; + break; + + case RES_TYPE_FONTDIR: + s = "FONTDIR"; + rt = RT_FONTDIR; + break; + + case RES_TYPE_ICON: + s = "ICON"; + rt = RT_ICON; + break; + + case RES_TYPE_GROUP_ICON: + s = "GROUP_ICON"; + rt = RT_GROUP_ICON; + break; + + case RES_TYPE_MENU: + if (extended_menu (res->u.menu)) + { + s = "MENUEX"; + menuex = 1; + } + else + { + s = "MENU"; + menuex = 0; + } + rt = RT_MENU; + break; + + case RES_TYPE_MESSAGETABLE: + s = "MESSAGETABLE"; + rt = RT_MESSAGETABLE; + break; + + case RES_TYPE_RCDATA: + s = "RCDATA"; + rt = RT_RCDATA; + break; + + case RES_TYPE_STRINGTABLE: + s = "STRINGTABLE"; + rt = RT_STRING; + break; + + case RES_TYPE_USERDATA: + s = NULL; + rt = 0; + break; + + case RES_TYPE_VERSIONINFO: + s = "VERSIONINFO"; + rt = RT_VERSION; + break; + } + + if (rt != 0 + && type != NULL + && (type->named || type->u.id != rt)) + { + fprintf (e, "// Unexpected resource type mismatch: "); + res_id_print (e, *type, 1); + fprintf (e, " != %d", rt); + } + + if (res->coff_info.codepage != 0) + fprintf (e, "// Code page: %lu\n", res->coff_info.codepage); + if (res->coff_info.reserved != 0) + fprintf (e, "// COFF reserved value: %lu\n", res->coff_info.reserved); + + if (name != NULL) + res_id_print (e, *name, 0); + else + fprintf (e, "??Unknown-Name??"); + + fprintf (e, " "); + if (s != NULL) + fprintf (e, "%s", s); + else if (type != NULL) + res_id_print (e, *type, 0); + else + fprintf (e, "??Unknown-Type??"); + + if (res->res_info.memflags != 0) + { + if ((res->res_info.memflags & MEMFLAG_MOVEABLE) != 0) + fprintf (e, " MOVEABLE"); + if ((res->res_info.memflags & MEMFLAG_PURE) != 0) + fprintf (e, " PURE"); + if ((res->res_info.memflags & MEMFLAG_PRELOAD) != 0) + fprintf (e, " PRELOAD"); + if ((res->res_info.memflags & MEMFLAG_DISCARDABLE) != 0) + fprintf (e, " DISCARDABLE"); + } + + if (res->type == RES_TYPE_DIALOG) + { + fprintf (e, " %d, %d, %d, %d", res->u.dialog->x, res->u.dialog->y, + res->u.dialog->width, res->u.dialog->height); + if (res->u.dialog->ex != NULL + && res->u.dialog->ex->help != 0) + fprintf (e, ", %lu", res->u.dialog->ex->help); + } + + fprintf (e, "\n"); + + if ((res->res_info.language != 0 && res->res_info.language != *language) + || res->res_info.characteristics != 0 + || res->res_info.version != 0) + { + int modifiers; + + switch (res->type) + { + case RES_TYPE_ACCELERATOR: + case RES_TYPE_DIALOG: + case RES_TYPE_MENU: + case RES_TYPE_RCDATA: + case RES_TYPE_STRINGTABLE: + modifiers = 1; + break; + + default: + modifiers = 0; + break; + } + + if (res->res_info.language != 0 && res->res_info.language != *language) + fprintf (e, "%sLANGUAGE %d, %d\n", + modifiers ? "// " : "", + res->res_info.language & 0xff, + (res->res_info.language >> 8) & 0xff); + if (res->res_info.characteristics != 0) + fprintf (e, "%sCHARACTERISTICS %lu\n", + modifiers ? "// " : "", + res->res_info.characteristics); + if (res->res_info.version != 0) + fprintf (e, "%sVERSION %lu\n", + modifiers ? "// " : "", + res->res_info.version); + } + + switch (res->type) + { + default: + abort (); + + case RES_TYPE_ACCELERATOR: + write_rc_accelerators (e, res->u.acc); + break; + + case RES_TYPE_CURSOR: + write_rc_cursor (e, res->u.cursor); + break; + + case RES_TYPE_GROUP_CURSOR: + write_rc_group_cursor (e, res->u.group_cursor); + break; + + case RES_TYPE_DIALOG: + write_rc_dialog (e, res->u.dialog); + break; + + case RES_TYPE_FONTDIR: + write_rc_fontdir (e, res->u.fontdir); + break; + + case RES_TYPE_GROUP_ICON: + write_rc_group_icon (e, res->u.group_icon); + break; + + case RES_TYPE_MENU: + write_rc_menu (e, res->u.menu, menuex); + break; + + case RES_TYPE_RCDATA: + write_rc_rcdata (e, res->u.rcdata, 0); + break; + + case RES_TYPE_STRINGTABLE: + write_rc_stringtable (e, name, res->u.stringtable); + break; + + case RES_TYPE_USERDATA: + write_rc_rcdata (e, res->u.userdata, 0); + break; + + case RES_TYPE_VERSIONINFO: + write_rc_versioninfo (e, res->u.versioninfo); + break; + + case RES_TYPE_BITMAP: + case RES_TYPE_FONT: + case RES_TYPE_ICON: + case RES_TYPE_MESSAGETABLE: + write_rc_filedata (e, res->u.data.length, res->u.data.data); + break; + } +} + +/* Write out accelerator information. */ + +static void +write_rc_accelerators (e, accelerators) + FILE *e; + const struct accelerator *accelerators; +{ + const struct accelerator *acc; + + fprintf (e, "BEGIN\n"); + for (acc = accelerators; acc != NULL; acc = acc->next) + { + int printable; + + fprintf (e, " "); + + if ((acc->key & 0x7f) == acc->key + && isprint ((unsigned char) acc->key) + && (acc->flags & ACC_VIRTKEY) == 0) + { + fprintf (e, "\"%c\"", acc->key); + printable = 1; + } + else + { + fprintf (e, "%d", acc->key); + printable = 0; + } + + fprintf (e, ", %d", acc->id); + + if (! printable) + { + if ((acc->flags & ACC_VIRTKEY) != 0) + fprintf (e, ", VIRTKEY"); + else + fprintf (e, ", ASCII"); + } + + if ((acc->flags & ACC_SHIFT) != 0) + fprintf (e, ", SHIFT"); + if ((acc->flags & ACC_CONTROL) != 0) + fprintf (e, ", CONTROL"); + if ((acc->flags & ACC_ALT) != 0) + fprintf (e, ", ALT"); + + fprintf (e, "\n"); + } + + fprintf (e, "END\n"); +} + +/* Write out cursor information. This would normally be in a separate + file, which the rc file would include. */ + +static void +write_rc_cursor (e, cursor) + FILE *e; + const struct cursor *cursor; +{ + fprintf (e, "// Hotspot: x: %d; y: %d\n", cursor->xhotspot, + cursor->yhotspot); + write_rc_filedata (e, cursor->length, cursor->data); +} + +/* Write out group cursor data. This would normally be built from the + cursor data. */ + +static void +write_rc_group_cursor (e, group_cursor) + FILE *e; + const struct group_cursor *group_cursor; +{ + const struct group_cursor *gc; + + for (gc = group_cursor; gc != NULL; gc = gc->next) + { + fprintf (e, "// width: %d; height %d; planes %d; bits %d\n", + gc->width, gc->height, gc->planes, gc->bits); + fprintf (e, "// data bytes: %lu; index: %d\n", + gc->bytes, gc->index); + } +} + +/* Write dialog data. */ + +static void +write_rc_dialog (e, dialog) + FILE *e; + const struct dialog *dialog; +{ + const struct dialog_control *control; + + if (dialog->style != 0) + fprintf (e, "STYLE 0x%lx\n", dialog->style); + if (dialog->exstyle != 0) + fprintf (e, "EXSTYLE 0x%lx\n", dialog->exstyle); + if ((dialog->class.named && dialog->class.u.n.length > 0) + || dialog->class.u.id != 0) + { + fprintf (e, "CLASS "); + res_id_print (e, dialog->class, 0); + fprintf (e, "\n"); + } + if (dialog->caption != NULL) + { + fprintf (e, "CAPTION \""); + unicode_print (e, dialog->caption, -1); + fprintf (e, "\"\n"); + } + if ((dialog->menu.named && dialog->menu.u.n.length > 0) + || dialog->menu.u.id != 0) + { + fprintf (e, "MENU "); + res_id_print (e, dialog->menu, 0); + fprintf (e, "\n"); + } + if (dialog->font != NULL) + { + fprintf (e, "FONT %d, \"", dialog->pointsize); + unicode_print (e, dialog->font, -1); + fprintf (e, "\""); + if (dialog->ex != NULL + && (dialog->ex->weight != 0 || dialog->ex->italic != 0)) + fprintf (e, ", %d, %d", dialog->ex->weight, dialog->ex->italic); + fprintf (e, "\n"); + } + + fprintf (e, "BEGIN\n"); + + for (control = dialog->controls; control != NULL; control = control->next) + write_rc_dialog_control (e, control); + + fprintf (e, "END\n"); +} + +/* For each predefined control keyword, this table provides the class + and the style. */ + +struct control_info +{ + const char *name; + unsigned short class; + unsigned long style; +}; + +static const struct control_info control_info[] = +{ + { "AUTO3STATE", CTL_BUTTON, BS_AUTO3STATE }, + { "AUTOCHECKBOX", CTL_BUTTON, BS_AUTOCHECKBOX }, + { "AUTORADIOBUTTON", CTL_BUTTON, BS_AUTORADIOBUTTON }, + { "CHECKBOX", CTL_BUTTON, BS_CHECKBOX }, + { "COMBOBOX", CTL_COMBOBOX, (unsigned long) -1 }, + { "CTEXT", CTL_STATIC, SS_CENTER }, + { "DEFPUSHBUTTON", CTL_BUTTON, BS_DEFPUSHBUTTON }, + { "EDITTEXT", CTL_EDIT, (unsigned long) -1 }, + { "GROUPBOX", CTL_BUTTON, BS_GROUPBOX }, + { "ICON", CTL_STATIC, SS_ICON }, + { "LISTBOX", CTL_LISTBOX, (unsigned long) -1 }, + { "LTEXT", CTL_STATIC, SS_LEFT }, + { "PUSHBOX", CTL_BUTTON, BS_PUSHBOX }, + { "PUSHBUTTON", CTL_BUTTON, BS_PUSHBUTTON }, + { "RADIOBUTTON", CTL_BUTTON, BS_RADIOBUTTON }, + { "RTEXT", CTL_STATIC, SS_RIGHT }, + { "SCROLLBAR", CTL_SCROLLBAR, (unsigned long) -1 }, + { "STATE3", CTL_BUTTON, BS_3STATE }, + /* It's important that USERBUTTON come after all the other button + types, so that it won't be matched too early. */ + { "USERBUTTON", CTL_BUTTON, (unsigned long) -1 }, + { NULL, 0, 0 } +}; + +/* Write a dialog control. */ + +static void +write_rc_dialog_control (e, control) + FILE *e; + const struct dialog_control *control; +{ + const struct control_info *ci; + + fprintf (e, " "); + + if (control->class.named) + ci = NULL; + else + { + for (ci = control_info; ci->name != NULL; ++ci) + if (ci->class == control->class.u.id + && (ci->style == (unsigned long) -1 + || ci->style == (control->style & 0xff))) + break; + } + + if (ci->name != NULL) + fprintf (e, "%s", ci->name); + else + fprintf (e, "CONTROL"); + + if (control->text.named || control->text.u.id != 0) + { + fprintf (e, " "); + res_id_print (e, control->text, 1); + fprintf (e, ","); + } + + fprintf (e, " %d, ", control->id); + + if (ci->name == NULL) + { + res_id_print (e, control->class, 0); + fprintf (e, ", 0x%lx, ", control->style); + } + + fprintf (e, "%d, %d", control->x, control->y); + + if (control->style != SS_ICON + || control->exstyle != 0 + || control->width != 0 + || control->height != 0 + || control->help != 0) + { + fprintf (e, ", %d, %d", control->width, control->height); + + /* FIXME: We don't need to print the style if it is the default. + More importantly, in certain cases we actually need to turn + off parts of the forced style, by using NOT. */ + fprintf (e, ", 0x%lx", control->style); + + if (control->exstyle != 0 || control->help != 0) + fprintf (e, ", 0x%lx, %lu", control->exstyle, control->help); + } + + fprintf (e, "\n"); + + if (control->data != NULL) + write_rc_rcdata (e, control->data, 2); +} + +/* Write out font directory data. This would normally be built from + the font data. */ + +static void +write_rc_fontdir (e, fontdir) + FILE *e; + const struct fontdir *fontdir; +{ + const struct fontdir *fc; + + for (fc = fontdir; fc != NULL; fc = fc->next) + { + fprintf (e, "// Font index: %d\n", fc->index); + write_rc_filedata (e, fc->length, fc->data); + } +} + +/* Write out group icon data. This would normally be built from the + icon data. */ + +static void +write_rc_group_icon (e, group_icon) + FILE *e; + const struct group_icon *group_icon; +{ + const struct group_icon *gi; + + for (gi = group_icon; gi != NULL; gi = gi->next) + { + fprintf (e, "// width: %d; height %d; colors: %d; planes %d; bits %d\n", + gi->width, gi->height, gi->colors, gi->planes, gi->bits); + fprintf (e, "// data bytes: %lu; index: %d\n", + gi->bytes, gi->index); + } +} + +/* Write out a menu resource. */ + +static void +write_rc_menu (e, menu, menuex) + FILE *e; + const struct menu *menu; + int menuex; +{ + if (menu->help != 0) + fprintf (e, "// Help ID: %lu\n", menu->help); + write_rc_menuitems (e, menu->items, menuex, 0); +} + +/* Write out menuitems. */ + +static void +write_rc_menuitems (e, menuitems, menuex, ind) + FILE *e; + const struct menuitem *menuitems; + int menuex; + int ind; +{ + const struct menuitem *mi; + + indent (e, ind); + fprintf (e, "BEGIN\n"); + + for (mi = menuitems; mi != NULL; mi = mi->next) + { + indent (e, ind + 2); + + if (mi->popup == NULL) + fprintf (e, "MENUITEM"); + else + fprintf (e, "POPUP"); + + if (! menuex + && mi->popup == NULL + && mi->text == NULL + && mi->type == 0 + && mi->id == 0) + { + fprintf (e, " SEPARATOR\n"); + continue; + } + + if (mi->text == NULL) + fprintf (e, " \"\""); + else + { + fprintf (e, " \""); + unicode_print (e, mi->text, -1); + fprintf (e, "\""); + } + + if (! menuex) + { + if (mi->popup == NULL) + fprintf (e, ", %d", mi->id); + + if ((mi->type & MENUITEM_CHECKED) != 0) + fprintf (e, ", CHECKED"); + if ((mi->type & MENUITEM_GRAYED) != 0) + fprintf (e, ", GRAYED"); + if ((mi->type & MENUITEM_HELP) != 0) + fprintf (e, ", HELP"); + if ((mi->type & MENUITEM_INACTIVE) != 0) + fprintf (e, ", INACTIVE"); + if ((mi->type & MENUITEM_MENUBARBREAK) != 0) + fprintf (e, ", MENUBARBREAK"); + if ((mi->type & MENUITEM_MENUBREAK) != 0) + fprintf (e, ", MENUBREAK"); + } + else + { + if (mi->id != 0 || mi->type != 0 || mi->state != 0 || mi->help != 0) + { + fprintf (e, ", %d", mi->id); + if (mi->type != 0 || mi->state != 0 || mi->help != 0) + { + fprintf (e, ", %lu", mi->type); + if (mi->state != 0 || mi->help != 0) + { + fprintf (e, ", %lu", mi->state); + if (mi->help != 0) + fprintf (e, ", %lu", mi->help); + } + } + } + } + + fprintf (e, "\n"); + + if (mi->popup != NULL) + write_rc_menuitems (e, mi->popup, menuex, ind + 2); + } + + indent (e, ind); + fprintf (e, "END\n"); +} + +/* Write out an rcdata resource. This is also used for other types of + resources that need to print arbitrary data. */ + +static void +write_rc_rcdata (e, rcdata, ind) + FILE *e; + const struct rcdata_item *rcdata; + int ind; +{ + const struct rcdata_item *ri; + + indent (e, ind); + fprintf (e, "BEGIN\n"); + + for (ri = rcdata; ri != NULL; ri = ri->next) + { + if (ri->type == RCDATA_BUFFER && ri->u.buffer.length == 0) + continue; + + indent (e, ind + 2); + + switch (ri->type) + { + default: + abort (); + + case RCDATA_WORD: + fprintf (e, "%d", ri->u.word); + break; + + case RCDATA_DWORD: + fprintf (e, "%luL", ri->u.dword); + break; + + case RCDATA_STRING: + { + const char *s; + unsigned long i; + + fprintf (e, "\""); + s = ri->u.string.s; + for (i = 0; i < ri->u.string.length; i++) + { + if (isprint (*s)) + putc (*s, e); + else + fprintf (e, "\\%03o", *s); + } + fprintf (e, "\""); + break; + } + + case RCDATA_WSTRING: + fprintf (e, "L\""); + unicode_print (e, ri->u.wstring.w, ri->u.wstring.length); + fprintf (e, "\""); + break; + + case RCDATA_BUFFER: + { + unsigned long i; + int first; + + /* Assume little endian data. */ + + first = 1; + for (i = 0; i + 3 < ri->u.buffer.length; i += 4) + { + unsigned long l; + + l = ((((((ri->u.buffer.data[i + 3] << 8) + | ri->u.buffer.data[i + 2]) << 8) + | ri->u.buffer.data[i + 1]) << 8) + | ri->u.buffer.data[i]); + if (first) + first = 0; + else + { + fprintf (e, ",\n"); + indent (e, ind + 2); + } + fprintf (e, "%luL", l); + } + + if (i + 1 < ri->u.buffer.length) + { + int i; + + i = (ri->u.buffer.data[i + 1] << 8) | ri->u.buffer.data[i]; + if (first) + first = 0; + else + { + fprintf (e, ",\n"); + indent (e, ind + 2); + } + fprintf (e, "%d", i); + i += 2; + } + + if (i < ri->u.buffer.length) + { + if (first) + first = 0; + else + { + fprintf (e, ",\n"); + indent (e, ind + 2); + } + if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i] + && isprint (ri->u.buffer.data[i])) + fprintf (e, "\"%c\"", ri->u.buffer.data[i]); + else + fprintf (e, "\"\%03o\"", ri->u.buffer.data[i]); + } + + break; + } + } + + if (ri->next != NULL) + fprintf (e, ","); + fprintf (e, "\n"); + } + + indent (e, ind); + fprintf (e, "END\n"); +} + +/* Write out a stringtable resource. */ + +static void +write_rc_stringtable (e, name, stringtable) + FILE *e; + const struct res_id *name; + const struct stringtable *stringtable; +{ + unsigned long offset; + int i; + + if (name != NULL && ! name->named) + offset = (name->u.id - 1) << 4; + else + { + fprintf (e, "// %s string table name\n", + name == NULL ? "Missing" : "Invalid"); + offset = 0; + } + + fprintf (e, "BEGIN\n"); + + for (i = 0; i < 16; i++) + { + if (stringtable->strings[i].length != 0) + { + fprintf (e, " %lu, \"", offset + i); + unicode_print (e, stringtable->strings[i].string, + stringtable->strings[i].length); + fprintf (e, "\"\n"); + } + } + + fprintf (e, "END\n"); +} + +/* Write out a versioninfo resource. */ + +static void +write_rc_versioninfo (e, versioninfo) + FILE *e; + const struct versioninfo *versioninfo; +{ + const struct fixed_versioninfo *f; + const struct ver_info *vi; + + f = versioninfo->fixed; + if (f->file_version_ms != 0 || f->file_version_ls != 0) + fprintf (e, " FILEVERSION %lu, %lu, %lu, %lu\n", + (f->file_version_ms >> 16) & 0xffff, + f->file_version_ms & 0xffff, + (f->file_version_ls >> 16) & 0xffff, + f->file_version_ls & 0xffff); + if (f->product_version_ms != 0 || f->product_version_ls != 0) + fprintf (e, " PRODUCTVERSION %lu, %lu, %lu, %lu\n", + (f->product_version_ms >> 16) & 0xffff, + f->product_version_ms & 0xffff, + (f->product_version_ls >> 16) & 0xffff, + f->product_version_ls & 0xffff); + if (f->file_flags_mask != 0) + fprintf (e, " FILEFLAGSMASK 0x%lx\n", f->file_flags_mask); + if (f->file_flags != 0) + fprintf (e, " FILEFLAGS 0x%lx\n", f->file_flags); + if (f->file_os != 0) + fprintf (e, " FILEOS 0x%lx\n", f->file_os); + if (f->file_type != 0) + fprintf (e, " FILETYPE 0x%lx\n", f->file_type); + if (f->file_subtype != 0) + fprintf (e, " FILESUBTYPE 0x%lx\n", f->file_subtype); + if (f->file_date_ms != 0 || f->file_date_ls != 0) + fprintf (e, "// Date: %lu, %lu\n", f->file_date_ms, f->file_date_ls); + + fprintf (e, "BEGIN\n"); + + for (vi = versioninfo->var; vi != NULL; vi = vi->next) + { + switch (vi->type) + { + case VERINFO_STRING: + { + const struct ver_stringinfo *vs; + + fprintf (e, " BLOCK \"StringFileInfo\"\n"); + fprintf (e, " BEGIN\n"); + fprintf (e, " BLOCK \""); + unicode_print (e, vi->u.string.language, -1); + fprintf (e, "\"\n"); + fprintf (e, " BEGIN\n"); + + for (vs = vi->u.string.strings; vs != NULL; vs = vs->next) + { + fprintf (e, " VALUE \""); + unicode_print (e, vs->key, -1); + fprintf (e, "\", \""); + unicode_print (e, vs->value, -1); + fprintf (e, "\"\n"); + } + + fprintf (e, " END\n"); + fprintf (e, " END\n"); + break; + } + + case VERINFO_VAR: + { + const struct ver_varinfo *vv; + + fprintf (e, " BLOCK \"VarFileInfo\"\n"); + fprintf (e, " BEGIN\n"); + fprintf (e, " VALUE \""); + unicode_print (e, vi->u.var.key, -1); + fprintf (e, "\""); + + for (vv = vi->u.var.var; vv != NULL; vv = vv->next) + fprintf (e, ", 0x%x, %d", (unsigned int) vv->language, + vv->charset); + + fprintf (e, "\n END\n"); + + break; + } + } + } + + fprintf (e, "END\n"); +} + +/* Write out data which would normally be read from a file. */ + +static void +write_rc_filedata (e, length, data) + FILE *e; + unsigned long length; + const unsigned char *data; +{ + unsigned long i; + + for (i = 0; i + 15 < length; i += 16) + { + fprintf (e, "// %4lx: ", i); + fprintf (e, "%02x %02x %02x %02x %02x %02x %02x %02x ", + data[i + 0], data[i + 1], data[i + 2], data[i + 3], + data[i + 4], data[i + 5], data[i + 6], data[i + 7]); + fprintf (e, "%02x %02x %02x %02x %02x %02x %02x %02x\n", + data[i + 8], data[i + 9], data[i + 10], data[i + 11], + data[i + 12], data[i + 13], data[i + 14], data[i + 15]); + } + + if (i < length) + { + fprintf (e, "// %4lx:", i); + while (i < length) + { + fprintf (e, " %02x", data[i]); + ++i; + } + fprintf (e, "\n"); + } +} diff --git a/gnu/dist/binutils/srconv.c b/gnu/dist/binutils/srconv.c index f378edab75a..930005ff655 100644 --- a/gnu/dist/binutils/srconv.c +++ b/gnu/dist/binutils/srconv.c @@ -1,5 +1,5 @@ /* srconv.c -- Sysroff conversion program - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 96, 1998 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* Written by Steve Chamberlain (sac@cygnus.com) @@ -37,8 +38,10 @@ #define PROGRAM_VERSION "1.5" /*#define FOOP1 1 */ -static int sh; -static int h8300; +static int addrsize; +static char *toolname; +static char **rnames; + static void wr_cs (); static void walk_tree_scope (); static void wr_globals (); @@ -171,12 +174,7 @@ writeINT (n, ptr, idx, size, file) int byte = *idx / 8; if (size == -2) - { - if (sh) - size = 4; - else if (h8300) - size = 2; - } + size = addrsize; else if (size == -1) size = 0; @@ -319,7 +317,7 @@ wr_un (ptr, sfile, first, nsecs) un.spare1 = 0; - if (abfd->flags & EXEC_P) + if (bfd_get_file_flags (abfd) & EXEC_P) un.format = FORMAT_LM; else un.format = FORMAT_OM; @@ -349,10 +347,7 @@ wr_un (ptr, sfile, first, nsecs) un.nextrefs++; } } - if (sh) - un.tool = "C_SH"; - else if (h8300) - un.tool = "C_H8/300H"; + un.tool = toolname; un.tcd = DATE; un.linker = "L_GX00"; un.lcd = DATE; @@ -368,7 +363,7 @@ wr_hd (p) struct IT_hd hd; hd.spare1 = 0; - if (abfd->flags & EXEC_P) + if (bfd_get_file_flags (abfd) & EXEC_P) { hd.mt = MTYPE_ABS_LM; } @@ -381,17 +376,38 @@ wr_hd (p) hd.nu = p->nsources; /* Always one unit */ hd.code = 0; /* Always ASCII */ hd.ver = "0200"; /* Version 2.00 */ - switch (abfd->arch_info->arch) + switch (bfd_get_arch (abfd)) { case bfd_arch_h8300: hd.au = 8; hd.si = 0; - hd.afl = 2; hd.spcsz = 32; hd.segsz = 0; hd.segsh = 0; - hd.cpu = "H8300H"; - h8300 = 1; + switch (bfd_get_mach (abfd)) + { + case bfd_mach_h8300: + hd.cpu = "H8300"; + hd.afl = 2; + addrsize = 2; + toolname = "C_H8/300"; + break; + case bfd_mach_h8300h: + hd.cpu = "H8300H"; + hd.afl = 4; + addrsize = 4; + toolname = "C_H8/300H"; + break; + case bfd_mach_h8300s: + hd.cpu = "H8300S"; + hd.afl = 4; + addrsize = 4; + toolname = "C_H8/300S"; + break; + default: + abort(); + } + rnames = rname_h8300; break; case bfd_arch_sh: hd.au = 8; @@ -401,13 +417,15 @@ wr_hd (p) hd.segsz = 0; hd.segsh = 0; hd.cpu = "SH"; - sh = 1; + addrsize = 4; + toolname = "C_SH"; + rnames = rname_sh; break; default: abort (); } - if (!abfd->flags & EXEC_P) + if (! bfd_get_file_flags(abfd) & EXEC_P) { hd.ep = 0; } @@ -422,8 +440,7 @@ wr_hd (p) hd.os = ""; hd.sys = ""; - hd.mn = strip_suffix (abfd->filename); - + hd.mn = strip_suffix (bfd_get_filename (abfd)); sysroff_swap_hd_out (file, &hd); } @@ -449,7 +466,7 @@ wr_ob (p, section) struct coff_ofile *p; struct coff_section *section; { - int i; + bfd_size_type i; int first = 1; unsigned char stuff[200]; @@ -465,7 +482,7 @@ wr_ob (p, section) if (first) { ob.saf = 1; - if (abfd->flags & EXEC_P) + if (bfd_get_file_flags (abfd) & EXEC_P) ob.address = section->address; else ob.address = 0; @@ -485,12 +502,12 @@ wr_ob (p, section) i += todo; } /* Now fill the rest with blanks */ - while (i < section->size) + while (i < (bfd_size_type) section->size) { struct IT_ob ob; int todo = 200; /* Copy in 200 byte lumps */ ob.spare = 0; - if (i + todo > section->size) + if (i + todo > (bfd_size_type) section->size) todo = section->size - i; ob.saf = 0; @@ -959,7 +976,7 @@ walk_tree_symbol (sfile, section, symbol, nest) { struct IT_dsy dsy; - dsy.spare2 = 0; + memset(&dsy, 0, sizeof(dsy)); dsy.nesting = nest; switch (symbol->type->type) @@ -1116,12 +1133,7 @@ walk_tree_symbol (sfile, section, symbol, nest) } if (symbol->where->where == coff_where_register) - { - if (sh) - dsy.reg = rname_sh[symbol->where->offset]; - else if (h8300) - dsy.reg = rname_h8300[symbol->where->offset]; - } + dsy.reg = rnames[symbol->where->offset]; switch (symbol->visible->type) { @@ -1230,7 +1242,7 @@ wr_du (p, sfile, n) int j; unsigned int *lowest = (unsigned *) nints (p->nsections); unsigned int *highest = (unsigned *) nints (p->nsections); - du.format = abfd->flags & EXEC_P ? 0 : 1; + du.format = bfd_get_file_flags (abfd) & EXEC_P ? 0 : 1; du.optimized = 0; du.stackfrmt = 0; du.spare = 0; @@ -1276,7 +1288,7 @@ wr_du (p, sfile, n) } du.san[used] = i; du.length[used] = highest[i] - lowest[i]; - du.address[used] = abfd->flags & EXEC_P ? lowest[i] : 0; + du.address[used] = bfd_get_file_flags (abfd) & EXEC_P ? lowest[i] : 0; if (debug) { printf (" section %6s 0x%08x..0x%08x\n", @@ -1665,14 +1677,14 @@ int scount = 0; { /* Don't have a symbol set aside for this section, which means that nothing in this file does anything for the section. */ - sc.format = !(abfd->flags & EXEC_P); + sc.format = !(bfd_get_file_flags (abfd) & EXEC_P); sc.addr = 0; sc.length = 0; name = info[i].sec->name; } else { - if (abfd->flags & EXEC_P) + if (bfd_get_file_flags (abfd) & EXEC_P) { sc.format = 0; sc.addr = symbol->where->offset; diff --git a/gnu/dist/binutils/stabs.c b/gnu/dist/binutils/stabs.c index db2df7a081e..ce85bfed179 100644 --- a/gnu/dist/binutils/stabs.c +++ b/gnu/dist/binutils/stabs.c @@ -1,5 +1,5 @@ /* stabs.c -- Parse stabs debugging information - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>. This file is part of GNU Binutils. @@ -2944,7 +2944,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, tagname, *pphysname = physname; } - if (*argtypes == '\0') + if (*argtypes == '\0' || is_destructor) { args = (debug_type *) xmalloc (sizeof *args); *args = NULL; diff --git a/gnu/dist/binutils/stamp-h.in b/gnu/dist/binutils/stamp-h.in new file mode 100644 index 00000000000..9788f70238c --- /dev/null +++ b/gnu/dist/binutils/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/gnu/dist/binutils/strings.c b/gnu/dist/binutils/strings.c index a5780dfd3ca..d6a011b4bdc 100644 --- a/gnu/dist/binutils/strings.c +++ b/gnu/dist/binutils/strings.c @@ -1,5 +1,5 @@ /* strings -- print the strings of printable characters in files - Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -503,6 +503,6 @@ Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n\ program_name); list_supported_targets (program_name, stream); if (status == 0) - fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n"); + fprintf (stream, "Report bugs to bug-gnu-utils@gnu.org\n"); exit (status); } diff --git a/gnu/dist/binutils/sysdump.c b/gnu/dist/binutils/sysdump.c index 5f158e9b99e..870857c9c23 100644 --- a/gnu/dist/binutils/sysdump.c +++ b/gnu/dist/binutils/sysdump.c @@ -1,21 +1,22 @@ /* Sysroff object format dumper. - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 1998 Free Software Foundation, Inc. -This file is part of GNU Binutils. + This file is part of GNU Binutils. -This program 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 of the License, or -(at your option) any later version. + This program 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 of the License, or + (at your option) any later version. -This program 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. + This program 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 this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* Written by Steve Chamberlain <sac@cygnus.com>. @@ -33,11 +34,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysroff.h" #define PROGRAM_VERSION "1.0" -static int h8300; -static int sh; + static int dump = 1; static int segmented_p; static int code; +static int addrsize = 4; static FILE *file; static char * @@ -171,7 +172,7 @@ getINT (ptr, idx, size, max) return 0; } if (size == -2) - size = 4; + size = addrsize; if (size == -1) size = 0; switch (size) @@ -195,14 +196,17 @@ getINT (ptr, idx, size, max) } int -getBITS (ptr, idx, size) +getBITS (ptr, idx, size, max) char *ptr; int *idx; - int size; + int size, max; { int byte = *idx / 8; int bit = *idx % 8; + if (byte >= max) + return 0; + *idx += size; return (ptr[byte] >> (8 - bit - size)) & ((1 << size) - 1); @@ -308,6 +312,7 @@ getone (type) { struct IT_hd dummy; sysroff_swap_hd_in (&dummy); + addrsize = dummy.afl; sysroff_print_hd_out (&dummy); } break; @@ -487,6 +492,10 @@ opt (x) return getone (x); } +#if 0 + +/* This is no longer used. */ + static void unit_info_list () { @@ -505,6 +514,12 @@ unit_info_list () } } +#endif + +#if 0 + +/* This is no longer used. */ + static void object_body_list () { @@ -517,6 +532,8 @@ object_body_list () } } +#endif + static void must (x) int x; @@ -612,6 +629,10 @@ derived_type () tab (-1, ""); } +#if 0 + +/* This is no longer used. */ + static void program_structure () { @@ -626,6 +647,12 @@ program_structure () tab (-1, ""); } +#endif + +#if 0 + +/* This is no longer used. */ + static void debug_list () { @@ -639,6 +666,8 @@ debug_list () tab (-1, ""); } +#endif + static void module () { diff --git a/gnu/dist/binutils/sysinfo.y b/gnu/dist/binutils/sysinfo.y index 0e0141aff0f..0aa87375dd6 100644 --- a/gnu/dist/binutils/sysinfo.y +++ b/gnu/dist/binutils/sysinfo.y @@ -406,8 +406,10 @@ if (writecode == 'd') return 0; } -int yyerror(s) +int +yyerror(s) char *s; { fprintf(stderr, "%s\n" , s); + return 0; } diff --git a/gnu/dist/binutils/windres.c b/gnu/dist/binutils/windres.c new file mode 100644 index 00000000000..95e9e0a6ca3 --- /dev/null +++ b/gnu/dist/binutils/windres.c @@ -0,0 +1,1060 @@ +/* windres.c -- a program to manipulate Windows resources + Copyright 1997, 1998 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This program can read and write Windows resources in various + formats. In particular, it can act like the rc resource compiler + program, and it can act like the cvtres res to COFF conversion + program. + + It is based on information taken from the following sources: + + * Microsoft documentation. + + * The rcl program, written by Gunther Ebert + <gunther.ebert@ixos-leipzig.de>. + + * The res2coff program, written by Pedro A. Aranda <paag@tid.es>. + + */ + +#include "bfd.h" +#include "getopt.h" +#include "bucomm.h" +#include "libiberty.h" +#include "obstack.h" +#include "windres.h" + +#include <assert.h> +#include <ctype.h> +#include <time.h> + +/* An enumeration of format types. */ + +enum res_format +{ + /* Unknown format. */ + RES_FORMAT_UNKNOWN, + /* Textual RC file. */ + RES_FORMAT_RC, + /* Binary RES file. */ + RES_FORMAT_RES, + /* COFF file. */ + RES_FORMAT_COFF +}; + +/* A structure used to map between format types and strings. */ + +struct format_map +{ + const char *name; + enum res_format format; +}; + +/* A mapping between names and format types. */ + +static const struct format_map format_names[] = +{ + { "rc", RES_FORMAT_RC }, + { "res", RES_FORMAT_RES }, + { "coff", RES_FORMAT_COFF }, + { NULL, RES_FORMAT_UNKNOWN } +}; + +/* A mapping from file extensions to format types. */ + +static const struct format_map format_fileexts[] = +{ + { "rc", RES_FORMAT_RC }, + { "res", RES_FORMAT_RES }, + { "exe", RES_FORMAT_COFF }, + { "obj", RES_FORMAT_COFF }, + { "o", RES_FORMAT_COFF }, + { NULL, RES_FORMAT_UNKNOWN } +}; + +/* A list of include directories. */ + +struct include_dir +{ + struct include_dir *next; + char *dir; +}; + +static struct include_dir *include_dirs; + +/* Long options. */ + +/* 150 isn't special; it's just an arbitrary non-ASCII char value. */ + +#define OPTION_DEFINE 150 +#define OPTION_HELP (OPTION_DEFINE + 1) +#define OPTION_INCLUDE_DIR (OPTION_HELP + 1) +#define OPTION_LANGUAGE (OPTION_INCLUDE_DIR + 1) +#define OPTION_PREPROCESSOR (OPTION_LANGUAGE + 1) +#define OPTION_VERSION (OPTION_PREPROCESSOR + 1) +#define OPTION_YYDEBUG (OPTION_VERSION + 1) + +static const struct option long_options[] = +{ + {"define", required_argument, 0, OPTION_DEFINE}, + {"help", no_argument, 0, OPTION_HELP}, + {"include-dir", required_argument, 0, OPTION_INCLUDE_DIR}, + {"input-format", required_argument, 0, 'I'}, + {"language", required_argument, 0, OPTION_LANGUAGE}, + {"output-format", required_argument, 0, 'O'}, + {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR}, + {"target", required_argument, 0, 'F'}, + {"version", no_argument, 0, OPTION_VERSION}, + {"yydebug", no_argument, 0, OPTION_YYDEBUG}, + {0, no_argument, 0, 0} +}; + +/* Static functions. */ + +static void res_init PARAMS ((void)); +static int extended_menuitems PARAMS ((const struct menuitem *)); +static enum res_format format_from_name PARAMS ((const char *)); +static enum res_format format_from_filename PARAMS ((const char *, int)); +static void usage PARAMS ((FILE *, int)); +static int cmp_res_entry PARAMS ((const PTR, const PTR)); +static struct res_directory *sort_resources PARAMS ((struct res_directory *)); + +/* When we are building a resource tree, we allocate everything onto + an obstack, so that we can free it all at once if we want. */ + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + +/* The resource building obstack. */ + +static struct obstack res_obstack; + +/* Initialize the resource building obstack. */ + +static void +res_init () +{ + obstack_init (&res_obstack); +} + +/* Allocate space on the resource building obstack. */ + +PTR +res_alloc (bytes) + size_t bytes; +{ + return (PTR) obstack_alloc (&res_obstack, bytes); +} + +/* We also use an obstack to save memory used while writing out a set + of resources. */ + +static struct obstack reswr_obstack; + +/* Initialize the resource writing obstack. */ + +static void +reswr_init () +{ + obstack_init (&reswr_obstack); +} + +/* Allocate space on the resource writing obstack. */ + +PTR +reswr_alloc (bytes) + size_t bytes; +{ + return (PTR) obstack_alloc (&reswr_obstack, bytes); +} + +/* Open a file using the include directory search list. */ + +FILE * +open_file_search (filename, mode, errmsg, real_filename) + const char *filename; + const char *mode; + const char *errmsg; + char **real_filename; +{ + FILE *e; + struct include_dir *d; + + e = fopen (filename, mode); + if (e != NULL) + { + *real_filename = xstrdup (filename); + return e; + } + + if (errno == ENOENT) + { + for (d = include_dirs; d != NULL; d = d->next) + { + char *n; + + n = (char *) xmalloc (strlen (d->dir) + strlen (filename) + 2); + sprintf (n, "%s/%s", d->dir, filename); + e = fopen (n, mode); + if (e != NULL) + { + *real_filename = n; + return e; + } + + if (errno != ENOENT) + break; + } + } + + fatal ("can't open %s `%s': %s", errmsg, filename, strerror (errno)); + + /* Return a value to avoid a compiler warning. */ + return NULL; +} + +/* Unicode support. */ + +/* Convert an ASCII string to a unicode string. We just copy it, + expanding chars to shorts, rather than doing something intelligent. */ + +void +unicode_from_ascii (length, unicode, ascii) + int *length; + unichar **unicode; + const char *ascii; +{ + int len; + const char *s; + unsigned short *w; + + len = strlen (ascii); + + if (length != NULL) + *length = len; + + *unicode = ((unichar *) res_alloc ((len + 1) * sizeof (unichar))); + + for (s = ascii, w = *unicode; *s != '\0'; s++, w++) + *w = *s & 0xff; + *w = 0; +} + +/* Print the unicode string UNICODE to the file E. LENGTH is the + number of characters to print, or -1 if we should print until the + end of the string. */ + +void +unicode_print (e, unicode, length) + FILE *e; + const unichar *unicode; + int length; +{ + while (1) + { + unichar ch; + + if (length == 0) + return; + if (length > 0) + --length; + + ch = *unicode; + + if (ch == 0 && length < 0) + return; + + ++unicode; + + if ((ch & 0x7f) == ch) + { + if (ch == '\\') + fputs ("\\", e); + else if (isprint (ch)) + putc (ch, e); + else + { + switch (ch) + { + case ESCAPE_A: + fputs ("\\a", e); + break; + + case ESCAPE_B: + fputs ("\\b", e); + break; + + case ESCAPE_F: + fputs ("\\f", e); + break; + + case ESCAPE_N: + fputs ("\\n", e); + break; + + case ESCAPE_R: + fputs ("\\r", e); + break; + + case ESCAPE_T: + fputs ("\\t", e); + break; + + case ESCAPE_V: + fputs ("\\v", e); + break; + + default: + fprintf (e, "\\%03o", (unsigned int) ch); + break; + } + } + } + else if ((ch & 0xff) == ch) + fprintf (e, "\\%03o", (unsigned int) ch); + else + fprintf (e, "\\x%x", (unsigned int) ch); + } +} + +/* Compare two resource ID's. We consider name entries to come before + numeric entries, because that is how they appear in the COFF .rsrc + section. */ + +int +res_id_cmp (a, b) + struct res_id a; + struct res_id b; +{ + if (! a.named) + { + if (b.named) + return 1; + if (a.u.id > b.u.id) + return 1; + else if (a.u.id < b.u.id) + return -1; + else + return 0; + } + else + { + unichar *as, *ase, *bs, *bse; + + if (! b.named) + return -1; + + as = a.u.n.name; + ase = as + a.u.n.length; + bs = b.u.n.name; + bse = bs + b.u.n.length; + + while (as < ase) + { + int i; + + if (bs >= bse) + return 1; + i = (int) *as - (int) *bs; + if (i != 0) + return i; + ++as; + ++bs; + } + + if (bs < bse) + return -1; + + return 0; + } +} + +/* Print a resource ID. */ + +void +res_id_print (stream, id, quote) + FILE *stream; + struct res_id id; + int quote; +{ + if (! id.named) + fprintf (stream, "%lu", id.u.id); + else + { + if (quote) + putc ('"', stream); + unicode_print (stream, id.u.n.name, id.u.n.length); + if (quote) + putc ('"', stream); + } +} + +/* Print a list of resource ID's. */ + +void +res_ids_print (stream, cids, ids) + FILE *stream; + int cids; + const struct res_id *ids; +{ + int i; + + for (i = 0; i < cids; i++) + { + res_id_print (stream, ids[i], 1); + if (i + 1 < cids) + fprintf (stream, ": "); + } +} + +/* Convert an ASCII string to a resource ID. */ + +void +res_string_to_id (res_id, string) + struct res_id *res_id; + const char *string; +{ + res_id->named = 1; + unicode_from_ascii (&res_id->u.n.length, &res_id->u.n.name, string); +} + +/* Define a resource. The arguments are the resource tree, RESOURCES, + and the location at which to put it in the tree, CIDS and IDS. + This returns a newly allocated res_resource structure, which the + caller is expected to initialize. If DUPOK is non-zero, then if a + resource with this ID exists, it is returned. Otherwise, a warning + is issued, and a new resource is created replacing the existing + one. */ + +struct res_resource * +define_resource (resources, cids, ids, dupok) + struct res_directory **resources; + int cids; + const struct res_id *ids; + int dupok; +{ + struct res_entry *re = NULL; + int i; + + assert (cids > 0); + for (i = 0; i < cids; i++) + { + struct res_entry **pp; + + if (*resources == NULL) + { + static unsigned long timeval; + + /* Use the same timestamp for every resource created in a + single run. */ + if (timeval == 0) + timeval = time (NULL); + + *resources = ((struct res_directory *) + res_alloc (sizeof **resources)); + (*resources)->characteristics = 0; + (*resources)->time = timeval; + (*resources)->major = 0; + (*resources)->minor = 0; + (*resources)->entries = NULL; + } + + for (pp = &(*resources)->entries; *pp != NULL; pp = &(*pp)->next) + if (res_id_cmp ((*pp)->id, ids[i]) == 0) + break; + + if (*pp != NULL) + re = *pp; + else + { + re = (struct res_entry *) res_alloc (sizeof *re); + re->next = NULL; + re->id = ids[i]; + if ((i + 1) < cids) + { + re->subdir = 1; + re->u.dir = NULL; + } + else + { + re->subdir = 0; + re->u.res = NULL; + } + + *pp = re; + } + + if ((i + 1) < cids) + { + if (! re->subdir) + { + fprintf (stderr, "%s: ", program_name); + res_ids_print (stderr, i, ids); + fprintf (stderr, ": expected to be a directory\n"); + xexit (1); + } + + resources = &re->u.dir; + } + } + + if (re->subdir) + { + fprintf (stderr, "%s: ", program_name); + res_ids_print (stderr, cids, ids); + fprintf (stderr, ": expected to be a leaf\n"); + xexit (1); + } + + if (re->u.res != NULL) + { + if (dupok) + return re->u.res; + + fprintf (stderr, "%s: warning: ", program_name); + res_ids_print (stderr, cids, ids); + fprintf (stderr, ": duplicate value\n"); + } + + re->u.res = ((struct res_resource *) + res_alloc (sizeof (struct res_resource))); + + re->u.res->type = RES_TYPE_UNINITIALIZED; + memset (&re->u.res->res_info, 0, sizeof (struct res_res_info)); + memset (&re->u.res->coff_info, 0, sizeof (struct res_coff_info)); + + return re->u.res; +} + +/* Define a standard resource. This is a version of define_resource + that just takes type, name, and language arguments. */ + +struct res_resource * +define_standard_resource (resources, type, name, language, dupok) + struct res_directory **resources; + int type; + struct res_id name; + int language; + int dupok; +{ + struct res_id a[3]; + + a[0].named = 0; + a[0].u.id = type; + a[1] = name; + a[2].named = 0; + a[2].u.id = language; + return define_resource (resources, 3, a, dupok); +} + +/* Comparison routine for resource sorting. */ + +static int +cmp_res_entry (p1, p2) + const PTR p1; + const PTR p2; +{ + const struct res_entry **re1, **re2; + + re1 = (const struct res_entry **) p1; + re2 = (const struct res_entry **) p2; + return res_id_cmp ((*re1)->id, (*re2)->id); +} + +/* Sort the resources. */ + +static struct res_directory * +sort_resources (resdir) + struct res_directory *resdir; +{ + int c, i; + struct res_entry *re; + struct res_entry **a; + + if (resdir->entries == NULL) + return resdir; + + c = 0; + for (re = resdir->entries; re != NULL; re = re->next) + ++c; + + /* This is a recursive routine, so using xmalloc is probably better + than alloca. */ + a = (struct res_entry **) xmalloc (c * sizeof (struct res_entry *)); + + for (i = 0, re = resdir->entries; re != NULL; re = re->next, i++) + a[i] = re; + + qsort (a, c, sizeof (struct res_entry *), cmp_res_entry); + + resdir->entries = a[0]; + for (i = 0; i < c - 1; i++) + a[i]->next = a[i + 1]; + a[i]->next = NULL; + + free (a); + + /* Now sort the subdirectories. */ + + for (re = resdir->entries; re != NULL; re = re->next) + if (re->subdir) + re->u.dir = sort_resources (re->u.dir); + + return resdir; +} + +/* Return whether the dialog resource DIALOG is a DIALOG or a + DIALOGEX. */ + +int +extended_dialog (dialog) + const struct dialog *dialog; +{ + const struct dialog_control *c; + + if (dialog->ex != NULL) + return 1; + + for (c = dialog->controls; c != NULL; c = c->next) + if (c->data != NULL || c->help != 0) + return 1; + + return 0; +} + +/* Return whether MENUITEMS are a MENU or a MENUEX. */ + +int +extended_menu (menu) + const struct menu *menu; +{ + return extended_menuitems (menu->items); +} + +static int +extended_menuitems (menuitems) + const struct menuitem *menuitems; +{ + const struct menuitem *mi; + + for (mi = menuitems; mi != NULL; mi = mi->next) + { + if (mi->help != 0 || mi->state != 0) + return 1; + if (mi->popup != NULL && mi->id != 0) + return 1; + if ((mi->type + & ~ (MENUITEM_CHECKED + | MENUITEM_GRAYED + | MENUITEM_HELP + | MENUITEM_INACTIVE + | MENUITEM_MENUBARBREAK + | MENUITEM_MENUBREAK)) + != 0) + return 1; + if (mi->popup != NULL) + { + if (extended_menuitems (mi->popup)) + return 1; + } + } + + return 0; +} + +/* Convert a string to a format type, or exit if it can't be done. */ + +static enum res_format +format_from_name (name) + const char *name; +{ + const struct format_map *m; + + for (m = format_names; m->name != NULL; m++) + if (strcasecmp (m->name, name) == 0) + break; + + if (m->name == NULL) + { + fprintf (stderr, "%s: unknown format type `%s'\n", program_name, name); + fprintf (stderr, "%s: supported formats:", program_name); + for (m = format_names; m->name != NULL; m++) + fprintf (stderr, " %s", m->name); + fprintf (stderr, "\n"); + xexit (1); + } + + return m->format; +} + +/* Work out a format type given a file name. If INPUT is non-zero, + it's OK to look at the file itself. */ + +static enum res_format +format_from_filename (filename, input) + const char *filename; + int input; +{ + const char *ext; + FILE *e; + unsigned char b1, b2, b3, b4, b5; + int magic; + + /* If we have an extension, see if we recognize it as implying a + particular format. */ + ext = strrchr (filename, '.'); + if (ext != NULL) + { + const struct format_map *m; + + ++ext; + for (m = format_fileexts; m->name != NULL; m++) + if (strcasecmp (m->name, ext) == 0) + return m->format; + } + + /* If we don't recognize the name of an output file, assume it's a + COFF file. */ + + if (! input) + return RES_FORMAT_COFF; + + /* Read the first few bytes of the file to see if we can guess what + it is. */ + + e = fopen (filename, FOPEN_RB); + if (e == NULL) + fatal ("%s: %s", filename, strerror (errno)); + + b1 = getc (e); + b2 = getc (e); + b3 = getc (e); + b4 = getc (e); + b5 = getc (e); + + fclose (e); + + /* A PE executable starts with 0x4d 0x5a. */ + if (b1 == 0x4d && b2 == 0x5a) + return RES_FORMAT_COFF; + + /* A COFF .o file starts with a COFF magic number. */ + magic = (b2 << 8) | b1; + switch (magic) + { + case 0x14c: /* i386 */ + case 0x166: /* MIPS */ + case 0x184: /* Alpha */ + case 0x268: /* 68k */ + case 0x1f0: /* PowerPC */ + case 0x290: /* PA */ + return RES_FORMAT_COFF; + } + + /* A RES file starts with 0x0 0x0 0x0 0x0 0x20 0x0 0x0 0x0. */ + if (b1 == 0 && b2 == 0 && b3 == 0 && b4 == 0 && b5 == 0x20) + return RES_FORMAT_RES; + + /* If every character is printable or space, assume it's an RC file. */ + if ((isprint (b1) || isspace (b1)) + && (isprint (b2) || isspace (b2)) + && (isprint (b3) || isspace (b3)) + && (isprint (b4) || isspace (b4)) + && (isprint (b5) || isspace (b5))) + return RES_FORMAT_RC; + + /* Otherwise, we give up. */ + fatal ("can not determine type of file `%s'; use the -I option", + filename); + + /* Return something to silence the compiler warning. */ + return RES_FORMAT_UNKNOWN; +} + +/* Print a usage message and exit. */ + +static void +usage (stream, status) + FILE *stream; + int status; +{ + fprintf (stream, "Usage: %s [options] [input-file] [output-file]\n", + program_name); + fprintf (stream, "\ +Options:\n\ + -i FILE, --input FILE Name input file\n\ + -o FILE, --output FILE Name output file\n\ + -I FORMAT, --input-format FORMAT\n\ + Specify input format\n\ + -O FORMAT, --output-format FORMAT\n\ + Specify output format\n\ + -F TARGET, --target TARGET Specify COFF target\n\ + --preprocessor PROGRAM Program to use to preprocess rc file\n\ + --include-dir DIR Include directory when preprocessing rc file\n\ + --define SYM[=VAL] Define SYM when preprocessing rc file\n\ + --language VAL Set language when reading rc file\n"); +#ifdef YYDEBUG + fprintf (stream, "\ + --yydebug Turn on parser debugging\n"); +#endif + fprintf (stream, "\ + --help Print this help message\n\ + --version Print version information\n"); + fprintf (stream, "\ +FORMAT is one of rc, res, or coff, and is deduced from the file name\n\ +extension if not specified. A single file name is an input file.\n\ +No input-file is stdin, default rc. No output-file is stdout, default rc.\n"); + list_supported_targets (program_name, stream); + if (status == 0) + fprintf (stream, "Report bugs to bug-gnu-utils@gnu.org\n"); + exit (status); +} + +/* The main function. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + char *input_filename; + char *output_filename; + enum res_format input_format; + enum res_format output_format; + char *target; + char *preprocessor; + char *preprocargs; + int language; + struct res_directory *resources; + + program_name = argv[0]; + xmalloc_set_program_name (program_name); + + bfd_init (); + set_default_bfd_target (); + + res_init (); + + input_filename = NULL; + output_filename = NULL; + input_format = RES_FORMAT_UNKNOWN; + output_format = RES_FORMAT_UNKNOWN; + target = NULL; + preprocessor = NULL; + preprocargs = NULL; + language = -1; + + while ((c = getopt_long (argc, argv, "i:o:I:O:F:", long_options, + (int *) 0)) != EOF) + { + switch (c) + { + case 'i': + input_filename = optarg; + break; + + case 'o': + output_filename = optarg; + break; + + case 'I': + input_format = format_from_name (optarg); + break; + + case 'O': + output_format = format_from_name (optarg); + break; + + case 'F': + target = optarg; + break; + + case OPTION_PREPROCESSOR: + preprocessor = optarg; + break; + + case OPTION_DEFINE: + if (preprocargs == NULL) + { + preprocargs = xmalloc (strlen (optarg) + 3); + sprintf (preprocargs, "-D%s", optarg); + } + else + { + char *n; + + n = xmalloc (strlen (preprocargs) + strlen (optarg) + 4); + sprintf (n, "%s -D%s", preprocargs, optarg); + free (preprocargs); + preprocargs = n; + } + break; + + case OPTION_INCLUDE_DIR: + if (preprocargs == NULL) + { + preprocargs = xmalloc (strlen (optarg) + 3); + sprintf (preprocargs, "-I%s", optarg); + } + else + { + char *n; + + n = xmalloc (strlen (preprocargs) + strlen (optarg) + 4); + sprintf (n, "%s -I%s", preprocargs, optarg); + free (preprocargs); + preprocargs = n; + } + + { + struct include_dir *n, **pp; + + n = (struct include_dir *) xmalloc (sizeof *n); + n->next = NULL; + n->dir = optarg; + + for (pp = &include_dirs; *pp != NULL; pp = &(*pp)->next) + ; + *pp = n; + } + + break; + + case OPTION_LANGUAGE: + language = strtol (optarg, (char **) NULL, 16); + break; + +#ifdef YYDEBUG + case OPTION_YYDEBUG: + yydebug = 1; + break; +#endif + + case OPTION_HELP: + usage (stdout, 0); + break; + + case OPTION_VERSION: + print_version ("windres"); + break; + + default: + usage (stderr, 1); + break; + } + } + + if (input_filename == NULL && optind < argc) + { + input_filename = argv[optind]; + ++optind; + } + + if (output_filename == NULL && optind < argc) + { + output_filename = argv[optind]; + ++optind; + } + + if (argc != optind) + usage (stderr, 1); + + if (input_format == RES_FORMAT_UNKNOWN) + { + if (input_filename == NULL) + input_format = RES_FORMAT_RC; + else + input_format = format_from_filename (input_filename, 1); + } + + if (output_format == RES_FORMAT_UNKNOWN) + { + if (output_filename == NULL) + output_format = RES_FORMAT_RC; + else + output_format = format_from_filename (output_filename, 0); + } + + /* Read the input file. */ + + switch (input_format) + { + default: + abort (); + case RES_FORMAT_RC: + resources = read_rc_file (input_filename, preprocessor, preprocargs, + language); + break; + case RES_FORMAT_RES: + resources = read_res_file (input_filename); + break; + case RES_FORMAT_COFF: + resources = read_coff_rsrc (input_filename, target); + break; + } + + if (resources == NULL) + fatal ("no resources"); + + /* Sort the resources. This is required for COFF, convenient for + rc, and unimportant for res. */ + + resources = sort_resources (resources); + + /* Write the output file. */ + + reswr_init (); + + switch (output_format) + { + default: + abort (); + case RES_FORMAT_RC: + write_rc_file (output_filename, resources); + break; + case RES_FORMAT_RES: + write_res_file (output_filename, resources); + break; + case RES_FORMAT_COFF: + write_coff_file (output_filename, target, resources); + break; + } + + xexit (0); + return 0; +} + +struct res_directory * +read_res_file (filename) + const char *filename; +{ + fatal ("read_res_file unimplemented"); + return NULL; +} + +void +write_res_file (filename, resources) + const char *filename; + const struct res_directory *resources; +{ + fatal ("write_res_file unimplemented"); +} diff --git a/gnu/dist/binutils/windres.h b/gnu/dist/binutils/windres.h new file mode 100644 index 00000000000..12994e755f7 --- /dev/null +++ b/gnu/dist/binutils/windres.h @@ -0,0 +1,865 @@ +/* windres.h -- header file for windres program. + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include <ansidecl.h> + +/* This is the header file for the windres program. It defines + structures and declares functions used within the program. */ + +/* We use this type to hold a unicode character. */ + +typedef unsigned short unichar; + +/* We represent resources internally as a tree, similar to the tree + used in the .rsrc section of a COFF file. The root is a + res_directory structure. */ + +struct res_directory +{ + /* Resource flags. According to the MS docs, this is currently + always zero. */ + unsigned long characteristics; + /* Time/date stamp. */ + unsigned long time; + /* Major version number. */ + unsigned short major; + /* Minor version number. */ + unsigned short minor; + /* Directory entries. */ + struct res_entry *entries; +}; + +/* A resource ID is stored in a res_id structure. */ + +struct res_id +{ + /* Non-zero if this entry has a name rather than an ID. */ + unsigned int named : 1; + union + { + /* If the named field is non-zero, this is the name. */ + struct + { + /* Length of the name. */ + int length; + /* Pointer to the name, which is a Unicode string. */ + unichar *name; + } n; + /* If the named field is zero, this is the ID. */ + unsigned long id; + } u; +}; + +/* Each entry in the tree is a res_entry structure. We mix + directories and resources because in a COFF file all entries in a + directory are sorted together, whether the entries are + subdirectories or resources. */ + +struct res_entry +{ + /* Next entry. */ + struct res_entry *next; + /* Resource ID. */ + struct res_id id; + /* Non-zero if this entry is a subdirectory rather than a leaf. */ + unsigned int subdir : 1; + union + { + /* If the subdir field is non-zero, this is a pointer to the + subdirectory. */ + struct res_directory *dir; + /* If the subdir field is zero, this is a pointer to the resource + data. */ + struct res_resource *res; + } u; +}; + +/* Types of resources. */ + +enum res_type +{ + RES_TYPE_UNINITIALIZED, + RES_TYPE_ACCELERATOR, + RES_TYPE_BITMAP, + RES_TYPE_CURSOR, + RES_TYPE_GROUP_CURSOR, + RES_TYPE_DIALOG, + RES_TYPE_FONT, + RES_TYPE_FONTDIR, + RES_TYPE_ICON, + RES_TYPE_GROUP_ICON, + RES_TYPE_MENU, + RES_TYPE_MESSAGETABLE, + RES_TYPE_RCDATA, + RES_TYPE_STRINGTABLE, + RES_TYPE_USERDATA, + RES_TYPE_VERSIONINFO +}; + +/* A res file and a COFF file store information differently. The + res_info structures holds data which in a res file is stored with + each resource, but in a COFF file is stored elsewhere. */ + +struct res_res_info +{ + /* Language. In a COFF file, the third level of the directory is + keyed by the language, so the language of a resource is defined + by its location in the resource tree. */ + unsigned short language; + /* Characteristics of the resource. Entirely user defined. In a + COFF file, the res_directory structure has a characteristics + field, but I don't know if it's related to the one in the res + file. */ + unsigned long characteristics; + /* Version of the resource. Entirely user defined. In a COFF file, + the res_directory structure has a characteristics field, but I + don't know if it's related to the one in the res file. */ + unsigned long version; + /* Memory flags. This is a combination of the MEMFLAG values + defined below. Most of these values are historical, and are not + meaningful for win32. I don't think there is any way to store + this information in a COFF file. */ + unsigned short memflags; +}; + +/* Each resource in a COFF file has some information which can does + not appear in a res file. */ + +struct res_coff_info +{ + /* The code page used for the data. I don't really know what this + should be. */ + unsigned long codepage; + /* A resource entry in a COFF file has a reserved field, which we + record here when reading a COFF file. When writing a COFF file, + we set this field to zero. */ + unsigned long reserved; +}; + +/* Resource data is stored in a res_resource structure. */ + +struct res_resource +{ + /* The type of resource. */ + enum res_type type; + /* The data for the resource. */ + union + { + struct + { + unsigned long length; + const unsigned char *data; + } data; + struct accelerator *acc; + struct cursor *cursor; + struct group_cursor *group_cursor; + struct dialog *dialog; + struct fontdir *fontdir; + struct group_icon *group_icon; + struct menu *menu; + struct rcdata_item *rcdata; + struct stringtable *stringtable; + struct rcdata_item *userdata; + struct versioninfo *versioninfo; + } u; + /* Information from a res file. */ + struct res_res_info res_info; + /* Information from a COFF file. */ + struct res_coff_info coff_info; +}; + +/* Memory flags in the memflags field of a struct res_resource. */ + +#define MEMFLAG_MOVEABLE 0x10 +#define MEMFLAG_PURE 0x20 +#define MEMFLAG_PRELOAD 0x40 +#define MEMFLAG_DISCARDABLE 0x1000 + +/* Standard resource type codes. These are used in the ID field of a + res_entry structure. */ + +#define RT_CURSOR 1 +#define RT_BITMAP 2 +#define RT_ICON 3 +#define RT_MENU 4 +#define RT_DIALOG 5 +#define RT_STRING 6 +#define RT_FONTDIR 7 +#define RT_FONT 8 +#define RT_ACCELERATORS 9 +#define RT_RCDATA 10 +#define RT_MESSAGETABLE 11 +#define RT_GROUP_CURSOR 12 +#define RT_GROUP_ICON 14 +#define RT_VERSION 16 +#define RT_DLGINCLUDE 17 +#define RT_PLUGPLAY 18 +#define RT_VXD 19 +#define RT_ANICURSOR 21 +#define RT_ANIICON 22 + +/* An accelerator resource is a linked list of these structures. */ + +struct accelerator +{ + /* Next accelerator. */ + struct accelerator *next; + /* Flags. A combination of the ACC values defined below. */ + unsigned short flags; + /* Key value. */ + unsigned short key; + /* Resource ID. */ + unsigned short id; +}; + +/* Accelerator flags in the flags field of a struct accelerator. + These are the same values that appear in a res file. I hope. */ + +#define ACC_VIRTKEY 0x01 +#define ACC_NOINVERT 0x02 +#define ACC_SHIFT 0x04 +#define ACC_CONTROL 0x08 +#define ACC_ALT 0x10 +#define ACC_LAST 0x80 + +/* A cursor resource. */ + +struct cursor +{ + /* X coordinate of hotspot. */ + short xhotspot; + /* Y coordinate of hotspot. */ + short yhotspot; + /* Length of bitmap data. */ + unsigned long length; + /* Data. */ + const unsigned char *data; +}; + +/* A group_cursor resource is a list of group_cursor structures. */ + +struct group_cursor +{ + /* Next cursor in group. */ + struct group_cursor *next; + /* Width. */ + unsigned short width; + /* Height. */ + unsigned short height; + /* Planes. */ + unsigned short planes; + /* Bits per pixel. */ + unsigned short bits; + /* Number of bytes in cursor resource. */ + unsigned long bytes; + /* Index of cursor resource. */ + unsigned short index; +}; + +/* A dialog resource. */ + +struct dialog +{ + /* Basic window style. */ + unsigned long style; + /* Extended window style. */ + unsigned long exstyle; + /* X coordinate. */ + unsigned short x; + /* Y coordinate. */ + unsigned short y; + /* Width. */ + unsigned short width; + /* Height. */ + unsigned short height; + /* Menu name. */ + struct res_id menu; + /* Class name. */ + struct res_id class; + /* Caption. */ + unichar *caption; + /* Font point size. */ + unsigned short pointsize; + /* Font name. */ + unichar *font; + /* Extended information for a dialogex. */ + struct dialog_ex *ex; + /* Controls. */ + struct dialog_control *controls; +}; + +/* An extended dialog has additional information. */ + +struct dialog_ex +{ + /* Help ID. */ + unsigned long help; + /* Font weight. */ + unsigned short weight; + /* Whether the font is italic. */ + unsigned short italic; +}; + +/* Window style flags, from the winsup Defines.h header file. These + can appear in the style field of a struct dialog or a struct + dialog_control. */ + +#define CW_USEDEFAULT (0x80000000) +#define WS_BORDER (0x800000L) +#define WS_CAPTION (0xc00000L) +#define WS_CHILD (0x40000000L) +#define WS_CHILDWINDOW (0x40000000L) +#define WS_CLIPCHILDREN (0x2000000L) +#define WS_CLIPSIBLINGS (0x4000000L) +#define WS_DISABLED (0x8000000L) +#define WS_DLGFRAME (0x400000L) +#define WS_GROUP (0x20000L) +#define WS_HSCROLL (0x100000L) +#define WS_ICONIC (0x20000000L) +#define WS_MAXIMIZE (0x1000000L) +#define WS_MAXIMIZEBOX (0x10000L) +#define WS_MINIMIZE (0x20000000L) +#define WS_MINIMIZEBOX (0x20000L) +#define WS_OVERLAPPED (0L) +#define WS_OVERLAPPEDWINDOW (0xcf0000L) +#define WS_POPUP (0x80000000L) +#define WS_POPUPWINDOW (0x80880000L) +#define WS_SIZEBOX (0x40000L) +#define WS_SYSMENU (0x80000L) +#define WS_TABSTOP (0x10000L) +#define WS_THICKFRAME (0x40000L) +#define WS_TILED (0L) +#define WS_TILEDWINDOW (0xcf0000L) +#define WS_VISIBLE (0x10000000L) +#define WS_VSCROLL (0x200000L) +#define MDIS_ALLCHILDSTYLES (0x1) +#define BS_3STATE (0x5L) +#define BS_AUTO3STATE (0x6L) +#define BS_AUTOCHECKBOX (0x3L) +#define BS_AUTORADIOBUTTON (0x9L) +#define BS_BITMAP (0x80L) +#define BS_BOTTOM (0x800L) +#define BS_CENTER (0x300L) +#define BS_CHECKBOX (0x2L) +#define BS_DEFPUSHBUTTON (0x1L) +#define BS_GROUPBOX (0x7L) +#define BS_ICON (0x40L) +#define BS_LEFT (0x100L) +#define BS_LEFTTEXT (0x20L) +#define BS_MULTILINE (0x2000L) +#define BS_NOTIFY (0x4000L) +#define BS_OWNERDRAW (0xbL) +#define BS_PUSHBOX (0xcL) /* FIXME! What should this be? */ +#define BS_PUSHBUTTON (0L) +#define BS_PUSHLIKE (0x1000L) +#define BS_RADIOBUTTON (0x4L) +#define BS_RIGHT (0x200L) +#define BS_RIGHTBUTTON (0x20L) +#define BS_TEXT (0L) +#define BS_TOP (0x400L) +#define BS_USERBUTTON (0x8L) +#define BS_VCENTER (0xc00L) +#define CBS_AUTOHSCROLL (0x40L) +#define CBS_DISABLENOSCROLL (0x800L) +#define CBS_DROPDOWN (0x2L) +#define CBS_DROPDOWNLIST (0x3L) +#define CBS_HASSTRINGS (0x200L) +#define CBS_LOWERCASE (0x4000L) +#define CBS_NOINTEGRALHEIGHT (0x400L) +#define CBS_OEMCONVERT (0x80L) +#define CBS_OWNERDRAWFIXED (0x10L) +#define CBS_OWNERDRAWVARIABLE (0x20L) +#define CBS_SIMPLE (0x1L) +#define CBS_SORT (0x100L) +#define CBS_UPPERCASE (0x2000L) +#define ES_AUTOHSCROLL (0x80L) +#define ES_AUTOVSCROLL (0x40L) +#define ES_CENTER (0x1L) +#define ES_LEFT (0L) +#define ES_LOWERCASE (0x10L) +#define ES_MULTILINE (0x4L) +#define ES_NOHIDESEL (0x100L) +#define ES_NUMBER (0x2000L) +#define ES_OEMCONVERT (0x400L) +#define ES_PASSWORD (0x20L) +#define ES_READONLY (0x800L) +#define ES_RIGHT (0x2L) +#define ES_UPPERCASE (0x8L) +#define ES_WANTRETURN (0x1000L) +#define LBS_DISABLENOSCROLL (0x1000L) +#define LBS_EXTENDEDSEL (0x800L) +#define LBS_HASSTRINGS (0x40L) +#define LBS_MULTICOLUMN (0x200L) +#define LBS_MULTIPLESEL (0x8L) +#define LBS_NODATA (0x2000L) +#define LBS_NOINTEGRALHEIGHT (0x100L) +#define LBS_NOREDRAW (0x4L) +#define LBS_NOSEL (0x4000L) +#define LBS_NOTIFY (0x1L) +#define LBS_OWNERDRAWFIXED (0x10L) +#define LBS_OWNERDRAWVARIABLE (0x20L) +#define LBS_SORT (0x2L) +#define LBS_STANDARD (0xa00003L) +#define LBS_USETABSTOPS (0x80L) +#define LBS_WANTKEYBOARDINPUT (0x400L) +#define SBS_BOTTOMALIGN (0x4L) +#define SBS_HORZ (0L) +#define SBS_LEFTALIGN (0x2L) +#define SBS_RIGHTALIGN (0x4L) +#define SBS_SIZEBOX (0x8L) +#define SBS_SIZEBOXBOTTOMRIGHTALIGN (0x4L) +#define SBS_SIZEBOXTOPLEFTALIGN (0x2L) +#define SBS_SIZEGRIP (0x10L) +#define SBS_TOPALIGN (0x2L) +#define SBS_VERT (0x1L) +#define SS_BITMAP (0xeL) +#define SS_BLACKFRAME (0x7L) +#define SS_BLACKRECT (0x4L) +#define SS_CENTER (0x1L) +#define SS_CENTERIMAGE (0x200L) +#define SS_ENHMETAFILE (0xfL) +#define SS_ETCHEDFRAME (0x12L) +#define SS_ETCHEDHORZ (0x10L) +#define SS_ETCHEDVERT (0x11L) +#define SS_GRAYFRAME (0x8L) +#define SS_GRAYRECT (0x5L) +#define SS_ICON (0x3L) +#define SS_LEFT (0L) +#define SS_LEFTNOWORDWRAP (0xcL) +#define SS_NOPREFIX (0x80L) +#define SS_NOTIFY (0x100L) +#define SS_OWNERDRAW (0xdL) +#define SS_REALSIZEIMAGE (0x800L) +#define SS_RIGHT (0x2L) +#define SS_RIGHTJUST (0x400L) +#define SS_SIMPLE (0xbL) +#define SS_SUNKEN (0x1000L) +#define SS_USERITEM (0xaL) +#define SS_WHITEFRAME (0x9L) +#define SS_WHITERECT (0x6L) +#define DS_3DLOOK (0x4L) +#define DS_ABSALIGN (0x1L) +#define DS_CENTER (0x800L) +#define DS_CENTERMOUSE (0x1000L) +#define DS_CONTEXTHELP (0x2000L) +#define DS_CONTROL (0x400L) +#define DS_FIXEDSYS (0x8L) +#define DS_LOCALEDIT (0x20L) +#define DS_MODALFRAME (0x80L) +#define DS_NOFAILCREATE (0x10L) +#define DS_NOIDLEMSG (0x100L) +#define DS_SETFONT (0x40L) +#define DS_SETFOREGROUND (0x200L) +#define DS_SYSMODAL (0x2L) + +/* A dialog control. */ + +struct dialog_control +{ + /* Next control. */ + struct dialog_control *next; + /* ID. */ + unsigned short id; + /* Style. */ + unsigned long style; + /* Extended style. */ + unsigned long exstyle; + /* X coordinate. */ + unsigned short x; + /* Y coordinate. */ + unsigned short y; + /* Width. */ + unsigned short width; + /* Height. */ + unsigned short height; + /* Class name. */ + struct res_id class; + /* Associated text. */ + struct res_id text; + /* Extra data for the window procedure. */ + struct rcdata_item *data; + /* Help ID. Only used in an extended dialog. */ + unsigned long help; +}; + +/* Control classes. These can be used as the ID field in a struct + dialog_control. */ + +#define CTL_BUTTON 0x80 +#define CTL_EDIT 0x81 +#define CTL_STATIC 0x82 +#define CTL_LISTBOX 0x83 +#define CTL_SCROLLBAR 0x84 +#define CTL_COMBOBOX 0x85 + +/* A fontdir resource is a list of fontdir structures. */ + +struct fontdir +{ + struct fontdir *next; + /* Index of font entry. */ + short index; + /* Length of font information. */ + unsigned long length; + /* Font information. */ + const unsigned char *data; +}; + +/* A group_icon resource is a list of group_icon structures. */ + +struct group_icon +{ + /* Next icon in group. */ + struct group_icon *next; + /* Width. */ + unsigned char width; + /* Height. */ + unsigned char height; + /* Color count. */ + unsigned char colors; + /* Planes. */ + unsigned short planes; + /* Bits per pixel. */ + unsigned short bits; + /* Number of bytes in cursor resource. */ + unsigned long bytes; + /* Index of cursor resource. */ + unsigned short index; +}; + +/* A menu resource. */ + +struct menu +{ + /* List of menuitems. */ + struct menuitem *items; + /* Help ID. I don't think there is any way to set this in an rc + file, but it can appear in the binary format. */ + unsigned long help; +}; + +/* A menu resource is a list of menuitem structures. */ + +struct menuitem +{ + /* Next menuitem. */ + struct menuitem *next; + /* Type. In a normal menu, rather than a menuex, this is the flags + field. */ + unsigned long type; + /* State. This is only used in a menuex. */ + unsigned long state; + /* Id. */ + unsigned short id; + /* Unicode text. */ + unichar *text; + /* Popup menu items for a popup. */ + struct menuitem *popup; + /* Help ID. This is only used in a menuex. */ + unsigned long help; +}; + +/* Menu item flags. These can appear in the flags field of a struct + menuitem. */ + +#define MENUITEM_GRAYED 0x001 +#define MENUITEM_INACTIVE 0x002 +#define MENUITEM_BITMAP 0x004 +#define MENUITEM_OWNERDRAW 0x100 +#define MENUITEM_CHECKED 0x008 +#define MENUITEM_POPUP 0x010 +#define MENUITEM_MENUBARBREAK 0x020 +#define MENUITEM_MENUBREAK 0x040 +#define MENUITEM_ENDMENU 0x080 +#define MENUITEM_HELP 0x4000 + +/* An rcdata resource is a pointer to a list of rcdata_item + structures. */ + +struct rcdata_item +{ + /* Next data item. */ + struct rcdata_item *next; + /* Type of data. */ + enum + { + RCDATA_WORD, + RCDATA_DWORD, + RCDATA_STRING, + RCDATA_WSTRING, + RCDATA_BUFFER + } type; + union + { + unsigned int word; + unsigned long dword; + struct + { + unsigned long length; + const char *s; + } string; + struct + { + unsigned long length; + const unichar *w; + } wstring; + struct + { + unsigned long length; + const unsigned char *data; + } buffer; + } u; +}; + +/* A stringtable resource is a pointer to a stringtable structure. */ + +struct stringtable +{ + /* Each stringtable resource is a list of 16 unicode strings. */ + struct + { + /* Length of string. */ + int length; + /* String data if length > 0. */ + unichar *string; + } strings[16]; +}; + +/* A versioninfo resource points to a versioninfo structure. */ + +struct versioninfo +{ + /* Fixed version information. */ + struct fixed_versioninfo *fixed; + /* Variable version information. */ + struct ver_info *var; +}; + +/* The fixed portion of a versioninfo resource. */ + +struct fixed_versioninfo +{ + /* The file version, which is two 32 bit integers. */ + unsigned long file_version_ms; + unsigned long file_version_ls; + /* The product version, which is two 32 bit integers. */ + unsigned long product_version_ms; + unsigned long product_version_ls; + /* The file flags mask. */ + unsigned long file_flags_mask; + /* The file flags. */ + unsigned long file_flags; + /* The OS type. */ + unsigned long file_os; + /* The file type. */ + unsigned long file_type; + /* The file subtype. */ + unsigned long file_subtype; + /* The date, which in Windows is two 32 bit integers. */ + unsigned long file_date_ms; + unsigned long file_date_ls; +}; + +/* A list of variable version information. */ + +struct ver_info +{ + /* Next item. */ + struct ver_info *next; + /* Type of data. */ + enum { VERINFO_STRING, VERINFO_VAR } type; + union + { + /* StringFileInfo data. */ + struct + { + /* Language. */ + unichar *language; + /* Strings. */ + struct ver_stringinfo *strings; + } string; + /* VarFileInfo data. */ + struct + { + /* Key. */ + unichar *key; + /* Values. */ + struct ver_varinfo *var; + } var; + } u; +}; + +/* A list of string version information. */ + +struct ver_stringinfo +{ + /* Next string. */ + struct ver_stringinfo *next; + /* Key. */ + unichar *key; + /* Value. */ + unichar *value; +}; + +/* A list of variable version information. */ + +struct ver_varinfo +{ + /* Next item. */ + struct ver_varinfo *next; + /* Language ID. */ + unsigned short language; + /* Character set ID. */ + unsigned short charset; +}; + +/* This structure is used when converting resource information to + binary. */ + +struct bindata +{ + /* Next data. */ + struct bindata *next; + /* Length of data. */ + unsigned long length; + /* Data. */ + unsigned char *data; +}; + +/* Escape character translations. */ + +#define ESCAPE_A (007) +#define ESCAPE_B (010) +#define ESCAPE_F (014) +#define ESCAPE_N (012) +#define ESCAPE_R (015) +#define ESCAPE_T (011) +#define ESCAPE_V (013) + +/* Function declarations. */ + +extern struct res_directory *read_rc_file + PARAMS ((const char *, const char *, const char *, int)); +extern struct res_directory *read_res_file PARAMS ((const char *)); +extern struct res_directory *read_coff_rsrc + PARAMS ((const char *, const char *)); +extern void write_rc_file + PARAMS ((const char *, const struct res_directory *)); +extern void write_res_file + PARAMS ((const char *, const struct res_directory *)); +extern void write_coff_file + PARAMS ((const char *, const char *, const struct res_directory *)); + +extern struct res_resource *bin_to_res + PARAMS ((struct res_id, const unsigned char *, unsigned long, int)); +extern struct bindata *res_to_bin PARAMS ((const struct res_resource *, int)); + +extern FILE *open_file_search + PARAMS ((const char *, const char *, const char *, char **)); + +extern PTR res_alloc PARAMS ((size_t)); +extern PTR reswr_alloc PARAMS ((size_t)); + +/* Resource ID handling. */ + +extern int res_id_cmp PARAMS ((struct res_id, struct res_id)); +extern void res_id_print PARAMS ((FILE *, struct res_id, int)); +extern void res_ids_print PARAMS ((FILE *, int, const struct res_id *)); +extern void res_string_to_id PARAMS ((struct res_id *, const char *)); + +/* Unicode support. */ + +extern void unicode_from_ascii + PARAMS ((int *, unichar **, const char *)); +extern void unicode_print PARAMS ((FILE *, const unichar *, int)); + +/* Manipulation of the resource tree. */ + +extern struct res_resource *define_resource + PARAMS ((struct res_directory **, int, const struct res_id *, int)); +extern struct res_resource *define_standard_resource + PARAMS ((struct res_directory **, int, struct res_id, int, int)); + +extern int extended_dialog PARAMS ((const struct dialog *)); +extern int extended_menu PARAMS ((const struct menu *)); + +/* Communication between the rc file support and the parser and lexer. */ + +extern int yydebug; +extern FILE *yyin; +extern char *rc_filename; +extern int rc_lineno; +extern int yyparse PARAMS ((void)); +extern int yylex PARAMS ((void)); +extern void yyerror PARAMS ((const char *)); +extern void rcparse_warning PARAMS ((const char *)); +extern void rcparse_set_language PARAMS ((int)); +extern void rcparse_discard_strings PARAMS ((void)); +extern void rcparse_rcdata PARAMS ((void)); +extern void rcparse_normal PARAMS ((void)); + +extern void define_accelerator + PARAMS ((struct res_id, const struct res_res_info *, struct accelerator *)); +extern void define_bitmap + PARAMS ((struct res_id, const struct res_res_info *, const char *)); +extern void define_cursor + PARAMS ((struct res_id, const struct res_res_info *, const char *)); +extern void define_dialog + PARAMS ((struct res_id, const struct res_res_info *, const struct dialog *)); +extern struct dialog_control *define_control + PARAMS ((const char *, unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long)); +extern void define_font + PARAMS ((struct res_id, const struct res_res_info *, const char *)); +extern void define_icon + PARAMS ((struct res_id, const struct res_res_info *, const char *)); +extern void define_menu + PARAMS ((struct res_id, const struct res_res_info *, struct menuitem *)); +extern struct menuitem *define_menuitem + PARAMS ((const char *, int, unsigned long, unsigned long, unsigned long, + struct menuitem *)); +extern void define_messagetable + PARAMS ((struct res_id, const struct res_res_info *, const char *)); +extern void define_rcdata + PARAMS ((struct res_id, const struct res_res_info *, struct rcdata_item *)); +extern struct rcdata_item *define_rcdata_string + PARAMS ((const char *, unsigned long)); +extern struct rcdata_item *define_rcdata_number PARAMS ((unsigned long, int)); +extern void define_stringtable + PARAMS ((const struct res_res_info *, unsigned long, const char *)); +extern void define_user_data + PARAMS ((struct res_id, struct res_id, const struct res_res_info *, + struct rcdata_item *)); +extern void define_user_file + PARAMS ((struct res_id, struct res_id, const struct res_res_info *, + const char *)); +extern void define_versioninfo + PARAMS ((struct res_id, int, struct fixed_versioninfo *, + struct ver_info *)); +extern struct ver_info *append_ver_stringfileinfo + PARAMS ((struct ver_info *, const char *, struct ver_stringinfo *)); +extern struct ver_info *append_ver_varfileinfo + PARAMS ((struct ver_info *, const char *, struct ver_varinfo *)); +extern struct ver_stringinfo *append_verval + PARAMS ((struct ver_stringinfo *, const char *, const char *)); +extern struct ver_varinfo *append_vertrans + PARAMS ((struct ver_varinfo *, unsigned long, unsigned long)); diff --git a/gnu/dist/binutils/wrstabs.c b/gnu/dist/binutils/wrstabs.c index b771ab587a7..9c1f91dbfa2 100644 --- a/gnu/dist/binutils/wrstabs.c +++ b/gnu/dist/binutils/wrstabs.c @@ -1,5 +1,5 @@ /* wrstabs.c -- Output stabs debugging information - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>. This file is part of GNU Binutils. @@ -552,8 +552,8 @@ write_stabs_in_sections_debugging_info (abfd, dhandle, psyms, psymsize, *p++ = '\0'; for (h = info.strings; h != NULL; h = h->next) { - strcpy (p, h->root.string); - p += strlen (p) + 1; + strcpy ((char *) p, h->root.string); + p += strlen ((char *) p) + 1; } return true; @@ -915,14 +915,14 @@ stab_modify_type (info, mod, size, cache, cache_alloc) } else { - if (targindex >= *cache_alloc) + if ((size_t) targindex >= *cache_alloc) { size_t alloc; alloc = *cache_alloc; if (alloc == 0) alloc = 10; - while (targindex >= alloc) + while ((size_t) targindex >= alloc) alloc *= 2; *cache = (long *) xrealloc (*cache, alloc * sizeof (long)); memset (*cache + *cache_alloc, 0, @@ -1884,7 +1884,7 @@ stab_end_class_type (p) { struct stab_write_handle *info = (struct stab_write_handle *) p; size_t len; - unsigned int i; + unsigned int i = 0; char *buf; assert (info->type_stack != NULL && info->type_stack->fields != NULL); @@ -2173,7 +2173,7 @@ stab_variable (p, name, kind, val) kindstr = ""; /* Make sure that this is a type reference or definition. */ - if (! isdigit (*s)) + if (! isdigit ((unsigned char) *s)) { char *n; long index; |
