Modified walker with pre/post walk callbacks and a carry_out/carry_in ptr that can be used to transfer data from pre to post.

This commit is contained in:
2022-09-06 16:03:45 +10:00
parent ed613db39e
commit e9798984ff
2 changed files with 134 additions and 72 deletions

View File

@@ -175,6 +175,12 @@ extern "C" {
uint8_t day;
};
struct walker_callbacks {
void (*pre)(Node n, void *data, void **carry_out);
void (*post)(Node n, void *data, void **carry_in);
void *data;
};
//
// === BINARY DATA OVERLAYS ===
//
@@ -260,7 +266,7 @@ extern "C" {
* Data is walked sequentially. Nodes passed to `cb` will be strictly increasing
* in terms of memory location within the buffer.
*/
void espr_walk(char *data, size_t size, void (*cb)(Node n, void *pt), void *pt);
void espr_walk(char *data, size_t size, struct walker_callbacks cb);
/* `espr_print` prints the header of every group and record in the given
* esp/esm binary data.