X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=src%2Fdata%2Fsys-file-private.h;h=1eee77950fb7acd892f7f737c8e802f9367b27ef;hb=dc29c57e7908b0bdc6ab84f8aa4b7cb8a780026c;hp=7170f9f4ad279e99d1db81a7dbefd05d2b60c490;hpb=6999c6d125665923b52ae15cbad83d06c92a8875;p=pspp
diff --git a/src/data/sys-file-private.h b/src/data/sys-file-private.h
index 7170f9f4ad..1eee77950f 100644
--- a/src/data/sys-file-private.h
+++ b/src/data/sys-file-private.h
@@ -1,5 +1,5 @@
/* PSPP - a program for statistical analysis.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2009, 2010 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
@@ -14,15 +14,63 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+/* Infrastructure common to system file reader and writer.
+
+ Old versions of SPSS limited string variables to a width of
+ 255 bytes. For backward compatibility with these older
+ versions, the system file format represents a string longer
+ than 255 bytes, called a "very long string", as a collection
+ of strings no longer than 255 bytes each. The strings
+ concatenated to make a very long string are called its
+ "segments"; for consistency, variables other than very long
+ strings are considered to have a single segment.
+
+ The interfaces in this file primarily provide support for
+ dealing with very long strings. */
+
#ifndef DATA_SYS_FILE_PRIVATE_H
#define DATA_SYS_FILE_PRIVATE_H 1
-/* This nonsense is required for SPSS compatibility. */
+#include
+
+struct dictionary;
+
+/* 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.
-#define MIN_VERY_LONG_STRING 256
-#define EFFECTIVE_LONG_STRING_LENGTH (MIN_VERY_LONG_STRING - 4)
+ 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_width_to_bytes (int width);
+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;
+ };
+
+extern struct sys_encoding sys_codepage_number_to_name[];
+extern struct sys_encoding sys_codepage_name_to_number[];
+
+int sys_get_codepage_from_encoding (const char *);
+const char *sys_get_encoding_from_codepage (int);
+
#endif /* data/sys-file-private.h */