ARIF_CTX_CREATE(3) ARIF User Manual ARIF_CTX_CREATE(3)

arif_ctx_create - create input context

#include <arif/arif.h>
struct arif_ctx *
arif_ctx_create (
    struct arif_opts const *options
);

The arif_ctx_create() function creates an input context with options. Operations on separate input contexts do not affect each other.

If the input context is no longer in use, it should be destroyed with arif_ctx_destroy().

The struct arif_opts type is defined as:

struct arif_opts {
    arif_cand_disp_func *disp_cand;
    int                  page_size;
};

Member disp_cand is the function to generate the text to display for a given candidate. If NULL, a default function (which prepends a bracket-enclosed index number to the text) will be used.

Member page_size is the number of candidates per page.

The arif_cand_disp_func type is defined as:

typedef char *(arif_cand_disp_func) (
    char *text,
    int   len,
    int   idx,
    int  *display_len_ptr
);

Argument text is the candidate's text to replace the original text, and len is its length in bytes.

Argument idx is the candidate's index for the current page, starting at 1.

The function should return a malloc()'ed pointer to the text to display for the candidate, and store its length (in bytes) to display_len_ptr.

Returns an opaque pointer to the new input context. On failure, returns NULL.

Copyright (C) 2023 CismonX <admin@cismon.net>

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

You should have received a copy of the license along with this document. If not, see <https://www.gnu.org/licenses/fdl-1.3.html>.

arif_ctx_destroy(3)

January 2, 2023 0.1.0