gd_entry_type(3)

πŸ’– gd_entry_type(3) β€” the GETDATA glow-up πŸ’–

okay bestie, pull up a chair because we're about to find out exactly what kind of field you're dealing with, and honestly? it's giving detective energy πŸ•΅οΈβ™€οΈβœ¨


✨ NAME ✨

gd_entry_type β€” retrieve the type of a dirfile field πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <getdata.h>

gd_entype_t gd_entry_type(const DIRFILE *dirfile, const char *field_code);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the gd_entry_type() function slides into a dirfile(5) database β€” that's the one you passed in as dirfile β€” and it's gonna tell you the field type of whatever field you named in field_code. no cap, that's the whole vibe. 🌸

and here's a lil detail that matters: if field_code has a valid representation suffix on it, bestie, it gets ignored. like, completely. don't even worry about it, it's not invited to the party. πŸ™ˆ

now, the gd_entype_t type? it's an enumerated type, which is fancy speak for "it can only be one of these specific things." and the things are:

GD_BIT_ENTRY, GD_CARRAY_ENTRY, GD_CONST_ENTRY, GD_DIVIDE_ENTRY,
GD_INDEX_ENTRY, GD_INDIR_ENTRY, GD_LINCOM_ENTRY,
GD_LINTERP_ENTRY, GD_MPLEX_ENTRY, GD_MULTIPLY_ENTRY,
GD_PHASE_ENTRY, GD_POLYNOM_ENTRY, GD_RAW_ENTRY, GD_RECIP_ENTRY,
GD_SARRAY_ENTRY, GD_SBIT_ENTRY, GD_SINDIR_ENTRY, GD_STRING_ENTRY,
GD_WINDOW_ENTRY.

nineteen little icons, all with main character energy. it's giving a whole roster. πŸ‘‘


πŸ’œ RETURN VALUE πŸ’œ

when everything goes right? gd_entry_type() hands you the field type of the field you asked about. iconic. slay. 🫢

but when it goes wrong β€” and bestie, sometimes it goes wrong β€” gd_entry_type() returns GD_NO_ENTRY and tucks a negative-valued error code into the DIRFILE object. you can get that lil guy back later by calling gd_error(3). the possible error codes are:

  • GD_E_BAD_DIRFILE β€” the dirfile you handed over was invalid. not it. πŸ’€
  • GD_E_BAD_CODE β€” the field you named in field_code? not found in the database. it's simply not there, fr fr. 😭

and if you want an actual descriptive error string instead of just a code, go call gd_error_string(3). she'll explain everything. 🌈


🌟 HISTORY 🌟

the get_entry_type() function first appeared in GetData-0.5.0. throwback era.

then in GetData-0.7.0, it got renamed to gd_entry_type(). glow-up complete, new name, same energy. ✨


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie!! πŸ’– this was Version 0.10.0, dated 25 December 2016 β€” a lil holiday gift from the GETDATA manual, gd_entry_type(3) section. go forth and type-check those fields, you absolute legend. πŸŽ€πŸ¦‹πŸŒΈπŸ’