+#include <stddef.h>
+
+struct dictionary;
+
+/* Magic numbers.
+
+ Both of these are actually $FL2 in the respective character set. The "FL2"
+ part is invariant among national variants of each character set, but "$" has
+ different encodings, so it is safer to write them as hexadecimal. */
+#define ASCII_MAGIC "\x24\x46\x4c\x32"
+#define EBCDIC_MAGIC "\x5b\xc6\xd3\xf2"
+
+/* A variable in a system file. */
+struct sfm_var
+ {
+ int var_width; /* Variable width (0 to 32767). */
+ int segment_width; /* Segment width (0 to 255). */
+ int case_index; /* Index into case. */
+
+ /* The following members are interesting only for string
+ variables (width != 0). For numeric variables (width ==
+ 0) their values are always 0.
+
+ Note: width + padding is always a multiple of 8. */
+ int offset; /* Offset within string variable in case. */
+ int padding; /* Number of padding bytes following data. */
+ };
+
+int sfm_dictionary_to_sfm_vars (const struct dictionary *,
+ struct sfm_var **, size_t *);
+
+int sfm_width_to_octs (int width);
+int sfm_width_to_segments (int width);
+
+int sfm_segment_effective_offset (int width, int segment);
+int sfm_segment_alloc_width (int width, int segment);
+
+/* A mapping between an encoding name and a Windows codepage. */
+struct sys_encoding
+ {
+ int number;
+ const char *name;
+ };