X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcasewriter-translator.c;h=c750c7c73b21f69cdfd852bebfb4b7d3de39d40e;hb=81579d9e9f994fb2908f50af41c3eb033d216e58;hp=a19533d65d330b6f443b308522e88d61b25687f6;hpb=7fbfc32fc3c636959b0a25b3e76609f86519e84a;p=pspp-builds.git diff --git a/src/data/casewriter-translator.c b/src/data/casewriter-translator.c index a19533d6..c750c7c7 100644 --- a/src/data/casewriter-translator.c +++ b/src/data/casewriter-translator.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,14 +16,14 @@ #include -#include -#include +#include "data/casewriter.h" +#include "data/casewriter-provider.h" #include -#include +#include "libpspp/taint.h" -#include "xalloc.h" +#include "gl/xalloc.h" struct casewriter_translator { @@ -37,11 +37,12 @@ struct casewriter_translator static const struct casewriter_class casewriter_translator_class; /* Creates and returns a new casewriter whose cases are passed - through TRANSLATE, which must return a case with - OUTPUT_VALUE_CNT values, based on INPUT and auxiliary data - AUX. (TRANSLATE may also return a null pointer, in which case - no case is written to the output.) The translated cases are - then written to SUBWRITER. + through TRANSLATE, based on INPUT and auxiliary data AUX. + (TRANSLATE may also return a null pointer, in which case no + case is written to the output.) The translated cases are then + written to SUBWRITER. + + The cases returned by TRANSLATE must match OUTPUT_PROTO. TRANSLATE takes ownership of each case passed to it. Thus, it should either unref each case and return a new case, or @@ -55,7 +56,7 @@ static const struct casewriter_class casewriter_translator_class; when the translating casewriter is destroyed. */ struct casewriter * casewriter_create_translator (struct casewriter *subwriter, - size_t translated_value_cnt, + const struct caseproto *translated_proto, struct ccase *(*translate) (struct ccase *, void *aux), bool (*destroy) (void *aux), @@ -67,7 +68,7 @@ casewriter_create_translator (struct casewriter *subwriter, ct->translate = translate; ct->destroy = destroy; ct->aux = aux; - writer = casewriter_create (translated_value_cnt, + writer = casewriter_create (translated_proto, &casewriter_translator_class, ct); taint_propagate (casewriter_get_taint (ct->subwriter), casewriter_get_taint (writer));