gd_parser_callback(3)
π gd_parser_callback β bestie edition π
okay so. you're deep in the GetData β¨cinematic universeβ¨ (that's section 3 of the manual, GETDATA, iykyk) and you need to know about gd_parser_callback(3). pull up a chair, grab a strawberry π, this one's short but it's important.
πΈ NAME πΈ
gd_parser_callback β set the syntax error callback handler for a Dirfile. that's it, that's the job. she sets the handler. she's an icon, she's a legend, and she IS the moment. π
π SYNOPSIS π
#include <getdata.h>
void gd_parser_callback(DIRFILE *dirfile, gd_parser_callback_t
sehandler, void *extra);
like. look at her. three little arguments. no notes. π
β¨ DESCRIPTION β¨
so what does gd_parser_callback() actually DO, bestie? she takes your DIRFILE object β the one you lovingly call dirfile β and she swaps out its syntax error callback function to be sehandler, and she sets the caller-supplied extra pointer that gets handed to the handler to be extra. and the way she does it?? she just. discards. ποΈ any syntax error handler and extra pointer that were previously registered for this DIRFILE. no goodbye, no ceremony, gone. main character energy only.
and listen β if sehandler is NULL?? then the existing handler gets removed entirely and the default behaviour comes back: abort on error. so if you're like "nah I don't want my custom handler anymore" you literally just pass NULL and it's handled. slay.
if you wanna know what the requirements for the syntax handler actually are, go read gd_cbopen(3). she has the lore. π
now here's the thing that lowkey trips people up, and honestly it's giving "read the fine print": parsing of an existing format specification happens when the DIRFILE object is created β which is, like, before you can even call this function. so by the time you're here, that ship has sailed. β΅
which means this function is only useful for one specific vibe: setting or modifying a callback function, or its caller data, before you call gd_include(3). because gd_include(3) is the one that will invoke your callback function if it finds syntax errors in the included fragment. so it's giving "set the trap before the plot twist." πͺ€
and the best part?? this function always succeeds, and she has no return value. no error checking, no errno drama, no "did it work" anxiety. she just works. periodt. π
π¦ HISTORY π¦
- the
dirfile_parser_callback()function appeared in GetData-0.5.0. baby's first era. π± - in GetData-0.7.0, this function was renamed to
gd_parser_callback(). glow-up era. β¨
π SEE ALSO π
gd_cbopen(3)β the handler requirements deep-dive π«Άgd_include(3)β the one that actually invokes your callback πdirfile(5)β the format spec itself, the whole world πΊοΈ
and that's the whole page, bestie!! go forth and register your syntax error handlers responsibly π
this has been Version 0.10.0, dated 25 December 2016, of the GetData manual. mwah. π π
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2008, 2009, 2010, 2016 D.V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms