## gva-mame-common gva-mame-common — Functions common to all MAME backends |

## Synopsis

                        GvaMameAsyncData;
    GvaMameAsyncData *  gva_mame_async_data_new             (GvaMameCallback callback,
                                                             gpointer user_data);
    void                gva_mame_async_data_free            (GvaMameAsyncData *data);
    gint                gva_mame_command                    (const gchar *arguments,
                                                             gchar ***stdout_lines,
                                                             gchar ***stderr_lines,
                                                             GError **error);

## Description

These functions are common to all supported MAME implementations.

## Details

### GvaMameAsyncData

    typedef struct {
            GvaMameCallback callback;
            gpointer user_data;
    } GvaMameAsyncData;

This structure is used to pass callback information to asynchronous operations.

GvaMameCallback `callback`; | callback function
gpointer `user_data`; | user data to pass to the callback function

### gva_mame_async_data_new ()

    GvaMameAsyncData *  gva_mame_async_data_new             (GvaMameCallback callback,
                                                             gpointer user_data);

Creates a new GvaMameAsyncData structure and populates it with `callback` and `user_data`. Call `gva_mame_async_data_free()` to free it.

`callback` : | callback function
`user_data` : | user data to pass to the callback function
Returns : | a new GvaMameAsyncData

### gva_mame_async_data_free ()

    void                gva_mame_async_data_free            (GvaMameAsyncData *data);

Frees `data`.

`data` : | a GvaMameAsyncData

### gva_mame_command ()

    gint                gva_mame_command                    (const gchar *arguments,
                                                             gchar ***stdout_lines,
                                                             gchar ***stderr_lines,
                                                             GError **error);

Spawns MAME with `arguments` and blocks until the child process exits. The line-based output from the stdout and stderr pipes are written to `stdout_lines` and `stderr_lines`, respectively, as `NULL`-terminated string arrays. The function returns the exit status of the child process, or -1 if an error occurred while spawning the process.

`arguments` : | command line arguments
`stdout_lines` : | return location for stdout lines, or `NULL`
`stderr_lines` : | return location for stderr lines, or `NULL`
`error` : | return locations for a GError, or `NULL`
Returns : | exit status of the child process or -1 if an error occurred