X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcasewriter-translator.c;h=c630b44cda397dfffccd980c9d3ecb65255e91dc;hb=c1e28f93006b3151c30c6f5e77d88f177960e6d4;hp=526bba34900b8b0d239a52e279923cdb4a52076a;hpb=130ced32165dc409b1be560d3d7a581a7ba3c5ee;p=pspp-builds.git diff --git a/src/data/casewriter-translator.c b/src/data/casewriter-translator.c index 526bba34..c630b44c 100644 --- a/src/data/casewriter-translator.c +++ b/src/data/casewriter-translator.c @@ -29,18 +29,29 @@ struct casewriter_translator { struct casewriter *subwriter; - void (*translate) (const struct ccase *input, struct ccase *output, - void *aux); + void (*translate) (struct ccase *input, struct ccase *output, void *aux); bool (*destroy) (void *aux); void *aux; }; -static struct casewriter_class casewriter_translator_class; +static const struct casewriter_class casewriter_translator_class; +/* Creates and returns a new casewriter whose cases are passed + through TRANSLATE, which must create case OUTPUT, with + OUTPUT_VALUE_CNT values, and populate it based on INPUT and + auxiliary data AUX. The translated cases are then written to + SUBWRITER. TRANSLATE must also destroy INPUT. + + When the translating casewriter is destroyed, DESTROY will be + called to allow any state maintained by TRANSLATE to be freed. + + After this function is called, SUBWRITER must not ever again + be referenced directly. It will be destroyed automatically + when the translating casewriter is destroyed. */ struct casewriter * casewriter_create_translator (struct casewriter *subwriter, size_t translated_value_cnt, - void (*translate) (const struct ccase *input, + void (*translate) (struct ccase *input, struct ccase *output, void *aux), bool (*destroy) (void *aux), @@ -90,7 +101,7 @@ casewriter_translator_convert_to_reader (struct casewriter *writer UNUSED, return reader; } -static struct casewriter_class casewriter_translator_class = +static const struct casewriter_class casewriter_translator_class = { casewriter_translator_write, casewriter_translator_destroy,