# vim: set ft=c:

MPI_Info_create:
    .desc: Creates a new info object
    .skip: initcheck
{
    MPIR_Info *info_ptr = NULL;
    mpi_errno = MPIR_Info_alloc(&info_ptr);
    MPIR_ERR_CHECK(mpi_errno);

    *info = info_ptr->handle;
    /* (info_ptr)->cookie = MPIR_INFO_COOKIE; */
    /* this is the first structure in this linked list. it is
     * always kept empty. new (key,value) pairs are added after it. */
}

MPI_Info_delete:
    .desc: Deletes a (key,value) pair from info
    .skip: initcheck
    .extra: NotThreadSafe
{ -- error_check --
    MPIR_ERR_CHKANDJUMP((info == MPI_INFO_ENV), mpi_errno, MPI_ERR_INFO,
                        "**infoenv");
}

MPI_Info_dup:
    .desc: Returns a duplicate of the info object
    .skip: initcheck

MPI_Info_free:
    .desc: Frees an info object
    .skip: initcheck
{ -- error_check --
    MPIR_ERR_CHKANDJUMP((*info == MPI_INFO_ENV), mpi_errno, MPI_ERR_INFO,
                        "**infoenv");
}

MPI_Info_get:
    .desc: Retrieves the value associated with a key
    .skip: initcheck
/*
.N Deprecated
   'MPI_Info_get_string' should be used instead of this routine.
*/

MPI_Info_get_nkeys:
    .desc: Returns the number of currently defined keys in info
    .skip: initcheck

MPI_Info_get_nthkey:
    .desc: Returns the nth defined key in info
    .skip: initcheck

MPI_Info_get_valuelen:
    .desc: Retrieves the length of the value associated with a key
    .skip: initcheck
/*
.N Deprecated
   'MPI_Info_get_string' should be used instead of this routine.
*/

MPI_Info_set:
    .desc: Adds a (key,value) pair to info
    .skip: initcheck
    .docnotes: NotThreadSafe
{ -- error_check --
    MPIR_ERR_CHKANDJUMP((info == MPI_INFO_ENV), mpi_errno, MPI_ERR_INFO,
                        "**infoenv");
    MPIR_ERR_CHKANDJUMP((strlen(value) > MPI_MAX_INFO_VAL), mpi_errno, MPI_ERR_INFO_VALUE,
                        "**infovallong");
}

MPI_Info_get_string:
    .desc: Retrieves the value associated with a key
    .skip: initcheck
{ -- error_check -- value
    if (*buflen > 0) {
        MPIR_ERRTEST_ARGNULL(value, "value", mpi_errno);
    }
}

MPI_Info_create_env:
    .desc: Creates an info object containing information about the application
    .skip: initcheck, validate-ARGUMENT_COUNT, validate-ARGUMENT_LIST
/*
    Notes for C:
        'MPI_Info_create_env' accepts NULL as input parameters. Doing so impacts
        the returned value.

    Notes for Fortran:
        The Fortran binding for 'MPI_Info_create_env' does not take argc and argv.
        .vb
            subroutine MPI_INFO_CREATE_ENV(info, ierr)
            integer info, ierr
        .ve
*/

MPIX_Info_set_hex:
    info: INFO, direction=in, [info object]
    key: STRING, constant=True, [key]
    value: BUFFER, constant=True, [value]
    value_size: INFO_VALUE_LENGTH, [size of value]
