-/* Allocate the pointer TEXT and fill it with text representing the
- long variable name buffer. SIZE will contain the size of TEXT.
- TEXT must be freed by the caller when no longer required.
-*/
-void
-dict_get_varname_block(const struct dictionary *dict, char **text, int *size)
-{
- char *buf = 0;
- int bufsize = 0;
- struct hsh_iterator hi;
- struct name_table_entry *nte;
- short first = 1;
-
- for ( nte = hsh_first(dict->long_name_tab, &hi);
- nte;
- nte = hsh_next(dict->long_name_tab, &hi))
- {
- bufsize += strlen(nte->name) + strlen(nte->longname) + 2;
- buf = xrealloc(buf, bufsize + 1);
- if ( first )
- strcpy(buf, "");
- first = 0;
-
- strcat(buf, nte->name);
- strcat(buf, "=");
- strcat(buf, nte->longname);
- strcat(buf, "\t");
- }
-
- if ( bufsize > 0 )
- {
- /* Loose the final delimiting TAB */
- buf[bufsize]='\0';
- bufsize--;
- }
-
- *text = buf;
- *size = bufsize;
-}
-
-/* Add a new entry into the dictionary's long name table, and update the
- corresponding variable with the relevant long name.
-*/
-void
-dict_add_longvar_entry(struct dictionary *d,
- const char *name,
- const char *longname)
-{
- struct variable *v;
- assert ( name ) ;
- assert ( longname );
- struct name_table_entry *nte = xmalloc (sizeof (struct name_table_entry));
- nte->longname = strdup(longname);
- nte->name = strdup(name);
-
- /* Look up the name in name_tab */
- v = hsh_find ( d->name_tab, name);
- if ( !v )
- {
- msg (FE, _("The entry \"%s\" in the variable name map, has no corresponding variable"), name);
- return ;
- }
- assert ( 0 == strcmp(v->name, name) );
- v->longname = nte->longname;
-
- hsh_insert(d->long_name_tab, nte);
-}
-
-/* Destroy and free up an nte */
-void
-free_nte(struct name_table_entry *nte)
-{
- assert(nte);
- free(nte->longname);
- free(nte->name);
- free(nte);
-}
-
-