gd_spf(3)

πŸ’– gd_spf β€” bestie edition πŸ’–

okay so you're in the gd_spf(3) page of the GETDATA manual, and honestly? it's giving "short but mighty". let's get into it 🫢


✨ NAME ✨

gd_spf β€” returns the samples per frame for a field in a dirfile 🌸


✨ SYNOPSIS ✨

#include <getdata.h>

unsigned int gd_spf(DIRFILE *dirfile, const char *field_code);

✨ DESCRIPTION ✨

so like, gd_spf() goes and asks a dirfile(5) database β€” the one you point at with dirfile β€” how many samples per frame the field field_code has. that's it. that's the whole job. πŸ’…

fun fact tho: this same info is also available from gd_entry(3), so if you're already hanging out over there you don't gotta double-dip. iykyk.

and bestie, real talk: the dirfile argument must point to a valid DIRFILE object that you made earlier with a call to gd_open(3). no fake ones, no half-baked ones. it's gotta be the real deal or nothing. πŸŽ€


✨ RETURN VALUE ✨

when it works? it's a positive integer, periodt β€” the number of samples per frame for the field you asked about. slay. πŸ‘‘

when it doesn't work? it returns zero and stashes a negative-valued error code in the DIRFILE object, which you can scoop up later with gd_error(3). the possible error codes are:

  • GD_E_BAD_CODE β€” the field you named in field_code? not found in the database. it's not there. it never was. 😭
  • GD_E_BAD_DIRFILE β€” the dirfile you handed over was invalid. red flag, block them.
  • GD_E_DIMENSION β€” a scalar field showed up where a vector field was expected. awkward!! wrong vibe entirely. πŸ™ˆ
  • GD_E_INTERNAL_ERROR β€” something broke inside the library while it was doing the task. this means there's a bug in the library, and you should please report the incident to the maintainer. not your fault, fr fr. πŸ’€
  • GD_E_RECURSE_LEVEL β€” too many levels of recursion got hit while trying to resolve field_code. usually this means there's a circular dependency in the field specification in the dirfile. it's a loop. it's always been a loop. πŸ”₯

and if you want an actual human-readable description of whatever went wrong, hit up gd_error_string(3) β€” it'll spill the whole story. πŸ¦‹


✨ HISTORY ✨

the lore, bestie, is important:

  • get_spf() first appeared way back in GetData-0.3.0 β€” vintage.
  • in GetData-0.7.0 it got renamed to gd_spf(). glow-up era. ✨
  • in GetData-0.10.0 the error return changed from -1 to a negative-valued error code. she evolved. 🌈

✨ SEE ALSO ✨

gd_entry(3), gd_error(3), gd_error_string(3), gd_open(3), dirfile(5)


and that's the whole page, bestie β€” this was Version 0.10.0, dated 25 December 2016. a lil holiday gift from the GETDATA girlies πŸŽ€πŸ’œ go forth and count your samples per frame, you absolute icon ⭐