Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/include/libiberty.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Function declarations for libiberty.
    22
    3    Copyright 2001 Free Software Foundation, Inc.
     3   Copyright 2001, 2002 Free Software Foundation, Inc.
    44   
    55   Note - certain prototypes declared in this header file are for
     
    5252   malloc.  Use freeargv to free the vector.  */
    5353
    54 extern char **buildargv PARAMS ((char *)) ATTRIBUTE_MALLOC;
     54extern char **buildargv PARAMS ((const char *)) ATTRIBUTE_MALLOC;
    5555
    5656/* Free a vector returned by buildargv.  */
     
    7474   to find the declaration so provide a fully prototyped one.  If it
    7575   is 1, we found it so don't provide any declaration at all.  */
    76 #if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || (defined (HAVE_DECL_BASENAME) && !HAVE_DECL_BASENAME)
     76#if !HAVE_DECL_BASENAME
     77#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (HAVE_DECL_BASENAME)
    7778extern char *basename PARAMS ((const char *));
    7879#else
    79 # if !defined (HAVE_DECL_BASENAME)
    8080extern char *basename ();
    81 # endif
    82 #endif
    83 
    84 /* Concatenate an arbitrary number of strings, up to (char *) NULL.
    85    Allocates memory using xmalloc.  */
     81#endif
     82#endif
     83
     84/* A well-defined basename () that is always compiled in.  */
     85
     86extern const char *lbasename PARAMS ((const char *));
     87
     88/* A well-defined realpath () that is always compiled in.  */
     89
     90extern char *lrealpath PARAMS ((const char *));
     91
     92/* Concatenate an arbitrary number of strings.  You must pass NULL as
     93   the last argument of this function, to terminate the list of
     94   strings.  Allocates memory using xmalloc.  */
    8695
    8796extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC;
     97
     98/* Concatenate an arbitrary number of strings.  You must pass NULL as
     99   the last argument of this function, to terminate the list of
     100   strings.  Allocates memory using xmalloc.  The first argument is
     101   not one of the strings to be concatenated, but if not NULL is a
     102   pointer to be freed after the new string is created, similar to the
     103   way xrealloc works.  */
     104
     105extern char *reconcat PARAMS ((char *, const char *, ...)) ATTRIBUTE_MALLOC;
     106
     107/* Determine the length of concatenating an arbitrary number of
     108   strings.  You must pass NULL as the last argument of this function,
     109   to terminate the list of strings.  */
     110
     111extern unsigned long concat_length PARAMS ((const char *, ...));
     112
     113/* Concatenate an arbitrary number of strings into a SUPPLIED area of
     114   memory.  You must pass NULL as the last argument of this function,
     115   to terminate the list of strings.  The supplied memory is assumed
     116   to be large enough.  */
     117
     118extern char *concat_copy PARAMS ((char *, const char *, ...));
     119
     120/* Concatenate an arbitrary number of strings into a GLOBAL area of
     121   memory.  You must pass NULL as the last argument of this function,
     122   to terminate the list of strings.  The supplied memory is assumed
     123   to be large enough.  */
     124
     125extern char *concat_copy2 PARAMS ((const char *, ...));
     126
     127/* This is the global area used by concat_copy2.  */
     128
     129extern char *libiberty_concat_ptr;
     130
     131/* Concatenate an arbitrary number of strings.  You must pass NULL as
     132   the last argument of this function, to terminate the list of
     133   strings.  Allocates memory using alloca.  The arguments are
     134   evaluated twice!  */
     135#define ACONCAT(ACONCAT_PARAMS) \
     136  (libiberty_concat_ptr = alloca (concat_length ACONCAT_PARAMS + 1), \
     137   concat_copy2 ACONCAT_PARAMS)
    88138
    89139/* Check whether two file descriptors refer to the same file.  */
     
    99149
    100150extern long get_run_time PARAMS ((void));
     151
     152/* Generate a relocated path to some installation directory.  Allocates
     153   return value using malloc.  */
     154
     155extern char *make_relative_prefix PARAMS ((const char *, const char *,
     156                                           const char *));
    101157
    102158/* Choose a temporary directory to use for scratch files.  */
     
    191247extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)) ATTRIBUTE_MALLOC;
    192248
     249/* Physical memory routines.  Return values are in BYTES.  */
     250extern double physmem_total PARAMS ((void));
     251extern double physmem_available PARAMS ((void));
     252
    193253/* hex character manipulation routines */
    194254
    195255#define _hex_array_size 256
    196256#define _hex_bad        99
    197 extern char _hex_value[_hex_array_size];
     257extern const char _hex_value[_hex_array_size];
    198258extern void hex_init PARAMS ((void));
    199259#define hex_p(c)        (hex_value (c) != _hex_bad)
     
    219279extern int pwait PARAMS ((int, int *, int));
    220280
     281#if !HAVE_DECL_ASPRINTF
    221282/* Like sprintf but provides a pointer to malloc'd storage, which must
    222283   be freed by the caller.  */
    223284
    224285extern int asprintf PARAMS ((char **, const char *, ...)) ATTRIBUTE_PRINTF_2;
    225 
     286#endif
     287
     288#if !HAVE_DECL_VASPRINTF
    226289/* Like vsprintf but provides a pointer to malloc'd storage, which
    227290   must be freed by the caller.  */
     
    229292extern int vasprintf PARAMS ((char **, const char *, va_list))
    230293  ATTRIBUTE_PRINTF(2,0);
     294#endif
    231295
    232296#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
     297
     298/* Drastically simplified alloca configurator.  If we're using GCC,
     299   we use __builtin_alloca; otherwise we use the C alloca.  The C
     300   alloca is always available.  You can override GCC by defining
     301   USE_C_ALLOCA yourself.  The canonical autoconf macro C_ALLOCA is
     302   also set/unset as it is often used to indicate whether code needs
     303   to call alloca(0).  */
     304extern PTR C_alloca PARAMS ((size_t)) ATTRIBUTE_MALLOC;
     305#undef alloca
     306#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
     307# define alloca(x) __builtin_alloca(x)
     308# undef C_ALLOCA
     309# define ASTRDUP(X) \
     310  (__extension__ ({ const char *const libiberty_optr = (X); \
     311   const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \
     312   char *const libiberty_nptr = alloca (libiberty_len); \
     313   (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
     314#else
     315# define alloca(x) C_alloca(x)
     316# undef USE_C_ALLOCA
     317# define USE_C_ALLOCA 1
     318# undef C_ALLOCA
     319# define C_ALLOCA 1
     320extern const char *libiberty_optr;
     321extern char *libiberty_nptr;
     322extern unsigned long libiberty_len;
     323# define ASTRDUP(X) \
     324  (libiberty_optr = (X), \
     325   libiberty_len = strlen (libiberty_optr) + 1, \
     326   libiberty_nptr = alloca (libiberty_len), \
     327   (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len))
     328#endif
    233329
    234330#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.