1104834Sobrien/* Binutils emulation layer.
2218822Sdim   Copyright 2002, 2003, 2007 Free Software Foundation, Inc.
3218822Sdim   Written by Tom Rix, Red Hat Inc.
4104834Sobrien
5104834Sobrien   This file is part of GNU Binutils.
6104834Sobrien
7104834Sobrien   This program is free software; you can redistribute it and/or modify
8104834Sobrien   it under the terms of the GNU General Public License as published by
9104834Sobrien   the Free Software Foundation; either version 2 of the License, or
10104834Sobrien   (at your option) any later version.
11104834Sobrien
12104834Sobrien   This program is distributed in the hope that it will be useful,
13104834Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
14104834Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15104834Sobrien   GNU General Public License for more details.
16104834Sobrien
17104834Sobrien   You should have received a copy of the GNU General Public License
18104834Sobrien   along with this program; if not, write to the Free Software
19218822Sdim   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20104834Sobrien
21104834Sobrien#ifndef BINEMUL_H
22104834Sobrien#define BINEMUL_H
23104834Sobrien
24218822Sdim#include "sysdep.h"
25104834Sobrien#include "bfd.h"
26104834Sobrien#include "bucomm.h"
27104834Sobrien
28130561Sobrienextern void ar_emul_usage (FILE *);
29130561Sobrienextern void ar_emul_default_usage (FILE *);
30130561Sobrienextern bfd_boolean ar_emul_append (bfd **, char *, bfd_boolean);
31130561Sobrienextern bfd_boolean ar_emul_default_append (bfd **, char *, bfd_boolean);
32130561Sobrienextern bfd_boolean ar_emul_replace (bfd **, char *, bfd_boolean);
33130561Sobrienextern bfd_boolean ar_emul_default_replace (bfd **, char *, bfd_boolean);
34130561Sobrienextern bfd_boolean ar_emul_parse_arg (char *);
35130561Sobrienextern bfd_boolean ar_emul_default_parse_arg (char *);
36104834Sobrien
37104834Sobrien/* Macros for common output.  */
38104834Sobrien
39104834Sobrien#define AR_EMUL_USAGE_PRINT_OPTION_HEADER(fp) \
40104834Sobrien  /* xgettext:c-format */                     \
41104834Sobrien  fprintf (fp, _(" emulation options: \n"))
42104834Sobrien
43104834Sobrien#define AR_EMUL_ELEMENT_CHECK(abfd, file_name) \
44218822Sdim  do { if ((abfd) == NULL) bfd_fatal (file_name); } while (0)
45104834Sobrien
46104834Sobrien#define AR_EMUL_APPEND_PRINT_VERBOSE(verbose, file_name) \
47104834Sobrien  do { if (verbose) printf ("a - %s\n", file_name); } while (0)
48104834Sobrien
49104834Sobrien#define AR_EMUL_REPLACE_PRINT_VERBOSE(verbose, file_name) \
50104834Sobrien  do { if (verbose) printf ("r - %s\n", file_name); } while (0)
51104834Sobrien
52104834Sobrientypedef struct bin_emulation_xfer_struct
53104834Sobrien{
54104834Sobrien  /* Print out the extra options.  */
55130561Sobrien  void (* ar_usage) (FILE *fp);
56130561Sobrien  bfd_boolean (* ar_append) (bfd **, char *, bfd_boolean);
57130561Sobrien  bfd_boolean (* ar_replace) (bfd **, char *, bfd_boolean);
58130561Sobrien  bfd_boolean (* ar_parse_arg) (char *);
59104834Sobrien}
60104834Sobrienbin_emulation_xfer_type;
61104834Sobrien
62104834Sobrien#endif
63