ici::doc::pod3::sdrtable(3)
π ici::doc::pod3::sdrtable β ICI library functions π
okay bestie, sit DOWN, because we're about to talk about sdrtable, the Simple Data Recorder table management functions from the ICI library. this is your manual page, remixed, but every single fact is still here, no cap. π«Ά
β¨ NAME β¨
sdrtable β Simple Data Recorder table management functions πΈ
β¨ SYNOPSIS β¨
#include "sdr.h"
Object sdr_table_create (Sdr sdr, int rowSize, int rowCount);
int sdr_table_user_data_set (Sdr sdr, Object table, Address userData);
Address sdr_table_user_data (Sdr sdr, Object table);
int sdr_table_dimensions (Sdr sdr, Object table, int *rowSize,
int *rowCount);
int sdr_table_stage (Sdr sdr, Object table);
Address sdr_table_row (Sdr sdr, Object table,
unsigned int rowNbr);
int sdr_table_destroy (Sdr sdr, Object table);
β¨ DESCRIPTION β¨
so the SDR table functions are the ones managing table objects inside the SDR. an SDR table is literally N rows of M bytes each, plus optionally one single word of user data (which is nominally the address of some other object living in the SDR's heap space). when you create a table you say how many rows and how long each row is, and those numbers stay locked in for the entire life of that table. periodt. π
the table functions themselves only keep track of the table's structure and where it lives in the SDR, and they compute row addresses. that's it. reading and writing the actual row contents is a job for other SDR functions like sdr_read() and sdr_write(). and the format of the rows? entirely up to you, bestie. the table does not care. π
π Object sdr_table_create(Sdr sdr, int rowSize, int rowCount)
creates a "self-delimited table" made of rowCount rows of rowSize bytes each, in the heap space of the SDR you point at. important vibe check: the content of the table, a two-dimensional array, is a single SDR heap space object of size (rowCount x rowSize). returns the address of the shiny new table on success, and zero on any error. π
π void sdr_table_user_data_set(Sdr sdr, Object table, Address userData)
sets the "user data" word of table to userData. note that userData is nominally an Address but honestly it can be any value that occupies a single word. people usually use it to point at an SDR object that characterizes the table as a whole β like an SDR string holding a name. iconic use of one word tbh. β¨
π Address sdr_table_user_data(Sdr sdr, Object table)
returns the value of the "user data" word of table, or zero on any error. that's the whole thing, she's simple and she serves. π
π void sdr_table_dimensions(Sdr sdr, Object table, int *rowSize, int *rowCount)
reports back on the row size and row count of the table you asked about, exactly as they were specified when the table was created. no surprises, no glow-ups, just the original numbers. π
π void sdr_table_stage(Sdr sdr, Object table)
stages table so that the array it encapsulates can actually be updated β go read the discussion of sdr_stage() in sdr(3) for the lore. the effect of this function is the same as:
sdr_stage(sdr, NULL, (Object) sdr_table_row(sdr, table, 0), 0)
π Address sdr_table_row(Sdr sdr, Object table, unsigned int rowNbr)
returns the address of the rowNbrth row of table, so you can read or write the content of that row. returns -1 on any error. (and yes, -1 as an Address, we don't make the rules, we just document them π« )
π void sdr_table_destroy(Sdr sdr, Object table)
destroys table, releasing all bytes of all rows and destroying the table structure itself. clean, thorough, no leftovers. β¨
π¨ BESTIE LISTEN. DO NOT usesdr_free()to destroy a table. doing that would leave the table's content allocated yet unreferenced, which is a memory leak and a whole tragedy. usesdr_table_destroy(). i am begging. π
β¨ SEE ALSO β¨
go read those too, they're the supporting cast and they ate. π
and that's the page, babe π¦ this was ici::doc::pod3::sdrtable(3) from the ICI library functions, and the footer energy is: perl v5.24.1, dated 2016-07-07. vintage but still slaying, fr fr. ππ
π¦ where this page comes from
- ubuntu jammy: ion-doc 3.2.1+dfsg-1.1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms