+ return map->proto;
+}
+
+/* Creates and returns a new casereader whose cases are produced
+ by reading from SUBREADER and executing the actions of MAP.
+ The casereader will have as many `union value's as MAP. When
+ the new casereader is destroyed, MAP will be destroyed too.
+
+ After this function is called, SUBREADER must not ever again
+ be referenced directly. It will be destroyed automatically
+ when the returned casereader is destroyed. */
+struct casereader *
+case_map_create_input_translator (struct case_map *map,
+ struct casereader *subreader)
+{
+ return casereader_create_translator (subreader,
+ case_map_get_proto (map),
+ translate_case,
+ destroy_case_map,
+ map);
+}
+
+/* Creates and returns a new casewriter. Cases written to the
+ new casewriter will be passed through MAP and written to
+ SUBWRITER. The casewriter will have as many `union value's as
+ MAP. When the new casewriter is destroyed, MAP will be
+ destroyed too.
+
+ After this function is called, SUBWRITER must not ever again
+ be referenced directly. It will be destroyed automatically
+ when the returned casewriter is destroyed. */
+struct casewriter *
+case_map_create_output_translator (struct case_map *map,
+ struct casewriter *subwriter)
+{
+ return casewriter_create_translator (subwriter,
+ case_map_get_proto (map),
+ translate_case,
+ destroy_case_map,
+ map);
+}
+
+/* Casereader/casewriter translation callback. */
+static struct ccase *
+translate_case (struct ccase *input, void *map_)
+{
+ struct case_map *map = map_;
+ return case_map_execute (map, input);
+}
+
+/* Casereader/casewriter destruction callback. */
+static bool
+destroy_case_map (void *map_)
+{
+ struct case_map *map = map_;
+ case_map_destroy (map);
+ return true;