ARIF_FETCH(3)

πŸ“¦ version 0.3.0, in alpine 3.24

πŸ’– ARIF_FETCH(3) β€” fetch candidates πŸ’–

okay bestie, welcome to the ARIF User Manual page for arif_fetch(3). This function is lowkey the candidate-fetching main character, and we're gonna get you comfy with it. No cap. 🫢

πŸ’… NAME πŸ’…

arif_fetch β€” fetch candidates. That's the whole job description, and it ate. ✨

🌸 SYNOPSIS 🌸

#include <arif.h>

int
arif_fetch (
    struct arif_ctx         *ctx,
    struct arif_cand const **candidates_ptr
);

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the arif_fetch() function fetches all candidates from the current page of the input context ctx into an array of struct arif_cand, and stores a pointer to that array into candidates_ptr. The array is valid until the next time arif_query(3) is called with new input text. So like, it's giving borrowed-pointer era β€” don't keep staring at it after the next query, bestie. 😭

πŸ’« Candidates πŸ’«

A candidate is a piece of text generated by an IME that is meant to replace part of the original input text. Tiny replacement text with main character energy, honestly.

The struct arif_cand type is defined as:

struct arif_cand {
    char const *text;
    int         text_len;
    int         replace_start;
    int         replace_len;
    char const *transform;
    int         transform_len;
    char const *display;
    int         display_len;
};
  • text β€” the actual text of the candidate, and len is its length in bytes. (Yes, the page says len here β€” I'm not gonna gaslight you.)
  • replace_len β€” the number of leading bytes of the original text that are meant to be replaced by the candidate, starting from byte offset replace_start. Byte math, but make it fashion πŸ’….
  • transform β€” should the original text passed to arif_query(3) be transformed into another text when selecting this candidate, the resulting text is put into transform, and transform_len is its length in bytes. Otherwise, transform value is NULL. No transform, no problem.
  • display β€” the text to display when listing candidates for the user to choose. display_len is its length in bytes. This is the candidate's little outfit for the UI πŸŽ€.

πŸ“ RETURN VALUES πŸ“

Returns the number of items in the array stored to candidates_ptr. That's it, that's the number. Count 'em, bestie. πŸ”₯

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.

🌈 SEE ALSO 🌈


kisses and byte-aligned dreams πŸ’– this page is from version 0.1.0, dated Jan 02, 2023. ARIF_FETCH(3) out. πŸŽ€

πŸ“¦ where this page comes from