binemul.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Binutils emulation layer.
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. Written by Tom Rix, Red Hat Inc.
  4. This file is part of GNU Binutils.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  16. MA 02110-1301, USA. */
  17. #ifndef BINEMUL_H
  18. #define BINEMUL_H
  19. #include "sysdep.h"
  20. #include "bfd.h"
  21. #include "bucomm.h"
  22. extern void ar_emul_usage (FILE *);
  23. extern void ar_emul_default_usage (FILE *);
  24. extern bfd_boolean ar_emul_append (bfd **, char *, const char *,
  25. bfd_boolean, bfd_boolean);
  26. extern bfd_boolean ar_emul_default_append (bfd **, char *, const char *,
  27. bfd_boolean, bfd_boolean);
  28. extern bfd_boolean do_ar_emul_append (bfd **, bfd *,
  29. bfd_boolean, bfd_boolean,
  30. bfd_boolean (*)(bfd *));
  31. extern bfd_boolean ar_emul_replace (bfd **, char *, const char *,
  32. bfd_boolean);
  33. extern bfd_boolean ar_emul_default_replace (bfd **, char *,
  34. const char *, bfd_boolean);
  35. extern bfd_boolean ar_emul_parse_arg (char *);
  36. extern bfd_boolean ar_emul_default_parse_arg (char *);
  37. /* Macros for common output. */
  38. #define AR_EMUL_USAGE_PRINT_OPTION_HEADER(fp) \
  39. /* xgettext:c-format */ \
  40. fprintf (fp, _(" emulation options: \n"))
  41. #define AR_EMUL_ELEMENT_CHECK(abfd, file_name) \
  42. do { if ((abfd) == NULL) bfd_fatal (file_name); } while (0)
  43. #define AR_EMUL_APPEND_PRINT_VERBOSE(verbose, file_name) \
  44. do { if (verbose) printf ("a - %s\n", file_name); } while (0)
  45. #define AR_EMUL_REPLACE_PRINT_VERBOSE(verbose, file_name) \
  46. do { if (verbose) printf ("r - %s\n", file_name); } while (0)
  47. typedef struct bin_emulation_xfer_struct
  48. {
  49. /* Print out the extra options. */
  50. void (* ar_usage) (FILE *fp);
  51. bfd_boolean (* ar_append) (bfd **, char *, const char *, bfd_boolean,
  52. bfd_boolean);
  53. bfd_boolean (* ar_replace) (bfd **, char *, const char *, bfd_boolean);
  54. bfd_boolean (* ar_parse_arg) (char *);
  55. }
  56. bin_emulation_xfer_type;
  57. #endif