binemul.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Binutils emulation layer.
  2. Copyright (C) 2002-2022 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 bool ar_emul_append (bfd **, char *, const char *, bool, bool);
  25. extern bool ar_emul_append_bfd (bfd **, bfd *, bool, bool);
  26. extern bool ar_emul_default_append (bfd **, bfd *, bool, bool);
  27. extern bool do_ar_emul_append (bfd **, bfd *, bool, bool, bool (*)(bfd *));
  28. extern bool ar_emul_replace (bfd **, char *, const char *, bool);
  29. extern bool ar_emul_replace_bfd (bfd **, bfd *, bool);
  30. extern bool ar_emul_default_replace (bfd **, bfd *, bool);
  31. extern bool ar_emul_parse_arg (char *);
  32. extern bool ar_emul_default_parse_arg (char *);
  33. /* Macros for common output. */
  34. #define AR_EMUL_USAGE_PRINT_OPTION_HEADER(fp) \
  35. /* xgettext:c-format */ \
  36. fprintf (fp, _(" emulation options: \n"))
  37. #define AR_EMUL_ELEMENT_CHECK(abfd, file_name) \
  38. do { if ((abfd) == NULL) bfd_fatal (file_name); } while (0)
  39. #define AR_EMUL_APPEND_PRINT_VERBOSE(verbose, file_name) \
  40. do { if (verbose) printf ("a - %s\n", file_name); } while (0)
  41. #define AR_EMUL_REPLACE_PRINT_VERBOSE(verbose, file_name) \
  42. do { if (verbose) printf ("r - %s\n", file_name); } while (0)
  43. typedef struct bin_emulation_xfer_struct
  44. {
  45. /* Print out the extra options. */
  46. void (*ar_usage) (FILE *fp);
  47. bool (*ar_append) (bfd **, bfd *, bool, bool);
  48. bool (*ar_replace) (bfd **, bfd *, bool);
  49. bool (*ar_parse_arg) (char *);
  50. }
  51. bin_emulation_xfer_type;
  52. #endif