## misc

misc — Miscellaneous stuff

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #define             IPATCH_ERROR
    enum                IpatchError;
    #define             ipatch_code_error                   (...)
    extern              char *ipatch_application_name;
    void                ipatch_init                         (void);
    void                ipatch_set_application_name         (const char *name);
    GQuark              ipatch_error_quark                  (void);
    const char *        ipatch_gerror_message               (GError *err);
    void                ipatch_strconcat_num                (const char *src,
                                                             int num,
                                                             char *dest,
                                                             int size);
    void                ipatch_dump_object                  (GObject *object,
                                                             gboolean recursive,
                                                             FILE *file);

## Description

## Details

### IPATCH_ERROR

    #define IPATCH_ERROR  ipatch_error_quark()

### enum IpatchError

    typedef enum
    {
      IPATCH_ERROR_FAIL,		/* a general failure */
      IPATCH_ERROR_IO,		/* I/O error (file operations, etc) */
      IPATCH_ERROR_PROGRAM,		/* a programming error */
      IPATCH_ERROR_INVALID,		/* invalid parameter or data */
      IPATCH_ERROR_CORRUPT,		/* corrupted data */
      IPATCH_ERROR_NOMEM,		/* out of memory error */
      IPATCH_ERROR_UNSUPPORTED,	/* unsupported feature */
      IPATCH_ERROR_UNEXPECTED_EOF,	/* unexpected end of file */
      IPATCH_ERROR_UNHANDLED_CONVERSION	/* unhandled object conversion */
    } IpatchError;

### ipatch_code_error()

    #define             ipatch_code_error(...)

### ipatch_application_name

    extern char *ipatch_application_name;

### ipatch_init ()

    void                ipatch_init                         (void);

Initialize libInstPatch library. Should be called before any other libInstPatch related functions.

### ipatch_set_application_name ()

    void                ipatch_set_application_name         (const char *name);

Set the global application name string which is used as the software string written to patch files. This string should contain the name of the application, and its version, that is using libInstPatch. The libInstPatch version will also be output where appropriate, so the software string written to a SoundFont for example would look something like "swami 1.0 (libInstPatch 1.0)".

`name` : | Application name and version (example: "swami 1.0") or `NULL` to unset application name

### ipatch_error_quark ()

    GQuark              ipatch_error_quark                  (void);

### ipatch_gerror_message ()

    const char *        ipatch_gerror_message               (GError *err);

A utility function to check if a GError is set and return the GError's message field if it is, or a string explaining that there isn't any error info if `err` is `NULL`.

`err` : | A GError object or `NULL`
Returns : | The GError's message or a "<No detailed error information>" string.

### ipatch_strconcat_num ()

    void                ipatch_strconcat_num                (const char *src,
                                                             int num,
                                                             char *dest,
                                                             int size);

Creates a string with a number appended to it but ensures that it is of the specified `size` (including NULL termination). Characters in the middle of the string are removed and a ".." is inserted, if necessary.

`src` : | Source string
`num` : | Number to concatenate
`dest` : | Destination buffer
`size` : | Size of destination buffer

### ipatch_dump_object ()

    void                ipatch_dump_object                  (GObject *object,
                                                             gboolean recursive,
                                                             FILE *file);

Dumps object info to a file for debugging purposes.

`object` : | Object to dump
`recursive` : | Set to `TRUE` to recurse the `object` children (if its a IpatchContainer derived object).
`file` : | File to dump to or `NULL` for stdout