Fix problems with uniqueness of short names in system files with very
authorBen Pfaff <blp@gnu.org>
Mon, 23 Jul 2007 05:05:45 +0000 (05:05 +0000)
committerBen Pfaff <blp@gnu.org>
Mon, 23 Jul 2007 05:05:45 +0000 (05:05 +0000)
commit6999c6d125665923b52ae15cbad83d06c92a8875
tree1a6d8bde0f6d76a0fae1789ff987682051d990f1
parent24a954d1a4faa977d763421136881378f4dd092c
Fix problems with uniqueness of short names in system files with very
long string variables.  Now a variable may have multiple short names.

* automake.mk (src_data_libdata_a_SOURCES): Add new files
short-names.c, short-names.h.

* dictionary.c (dict_clone): Clone all the short names.
(compare_strings): Move into short-names.c.
(hash_strings): Ditto.
(set_var_short_name_suffix): Ditto.
(dict_assign_short_names): Ditto, rename short_names_assign,
change to assign all short names.

* por-file-writer.c (write_variables): Use short_names_assign
instead of dict_assign_short_names.

* short-names.c: New file.

* short-names.h: New file.

* sys-file-private.c (sfm_width_to_segments): New function.

* sys-file-reader.c (read_long_var_name_map): Save and restore all
the short names, not just the first one.

* sys-file-writer.c (cont_var_name): Removed.
(sfm_open_writer): Use short_names_assign instead of
dict_assign_short_names.  Use unique short names assigned by
short_names_assign instead of those generated by cont_var_name.

* variable.c (struct variable): Remove `short_name' member,
replace by `short_names' and `short_name_cnt'.
(var_create) Initialize new members.
(var_get_short_name_cnt): New function.
(var_get_short_name): Now takes an index argument.  Changed most
callers to pass 0.
(var_set_short_name): Ditto.
(var_clear_short_name): Renamed var_clear_short_names, changed to
clear all short names.
13 files changed:
src/data/ChangeLog
src/data/automake.mk
src/data/dictionary.c
src/data/dictionary.h
src/data/por-file-writer.c
src/data/short-names.c [new file with mode: 0644]
src/data/short-names.h [new file with mode: 0644]
src/data/sys-file-private.c
src/data/sys-file-private.h
src/data/sys-file-reader.c
src/data/sys-file-writer.c
src/data/variable.c
src/data/variable.h