-static int write_header (struct sfm_write_info *inf);
-static int bufwrite (struct file_handle *h, const void *buf, size_t nbytes);
-static int write_variable (struct sfm_write_info *inf, struct variable *v);
-static int write_value_labels (struct sfm_write_info *inf, struct variable * s, int index);
-static int write_rec_7_34 (struct sfm_write_info *inf);
-static int write_documents (struct sfm_write_info *inf);
-
-/* Writes the dictionary INF->dict to system file INF->h. The system
- file is compressed if INF->compress is nonzero. INF->case_size is
- set to the number of flt64 elements in a single case. Returns
- nonzero only if successful. */
-int
-sfm_write_dictionary (struct sfm_write_info *inf)
+static int write_header (struct sfm_writer *, const struct dictionary *);
+static int buf_write (struct sfm_writer *, const void *, size_t);
+static int write_variable (struct sfm_writer *, struct variable *);
+static int write_value_labels (struct sfm_writer *,
+ struct variable *, int idx);
+static int write_rec_7_34 (struct sfm_writer *);
+
+static int write_longvar_table (struct sfm_writer *w,
+ const struct dictionary *dict);
+
+static int write_variable_display_parameters (struct sfm_writer *w,
+ const struct dictionary *dict);
+
+
+static int write_documents (struct sfm_writer *, const struct dictionary *);
+static int does_dict_need_translation (const struct dictionary *);
+
+static inline int
+var_flt64_cnt (const struct variable *v)
+{
+ return v->type == NUMERIC ? 1 : DIV_RND_UP (v->width, sizeof (flt64));
+}
+
+/* Opens the system file designated by file handle FH for writing
+ cases from dictionary D. If COMPRESS is nonzero, the
+ system file will be compressed. If OMIT_LONG_NAMES is nonzero, the
+ long name table will be omitted.
+
+ No reference to D is retained, so it may be modified or
+ destroyed at will after this function returns. D is not
+ modified by this function, except to assign short names. */
+struct sfm_writer *
+sfm_open_writer (struct file_handle *fh,
+ struct dictionary *d, int compress,
+ short omit_long_names)