- buf = xmalloc (len + 3);
- strcpy (&buf[1], h->fn);
- buf[0] = buf[len + 1] = '"';
- buf[len + 2] = 0;
- return buf;
- }
- return h->name;
-}
-
-/* Closes the stdio FILE associated with handle H. Frees internal
- buffers associated with that file. Does *not* destroy the file
- handle H. (File handles are permanent during a session.) */
-void
-fh_close_handle (struct file_handle *h)
-{
- if (h == NULL)
- return;
-
- debug_printf (("Closing %s%s.\n", fh_handle_name (h),
- h->class == NULL ? " (already closed)" : ""));
-
- if (h->class)
- h->class->close (h);
- h->class = NULL;
- h->ext = NULL;
-}
-
-/* Hashes the name of file handle H. */
-static unsigned
-hash_file_handle (const void *handle_, void *param UNUSED)
-{
- const struct file_handle *handle = handle_;
-
- return hsh_hash_string (handle->name);
-}
-
-/* Compares names of file handles A and B. */
-static int
-cmp_file_handle (const void *a_, const void *b_, void *foo UNUSED)
-{
- const struct file_handle *a = a_;
- const struct file_handle *b = b_;
-
- return strcmp (a->name, b->name);
-}
-
-/* Initialize the hash of file handles; inserts the "inline file"
- inline_file. */
-void
-fh_init_files (void)
-{
- /* Create hash. */
- files = hsh_create (4, cmp_file_handle, hash_file_handle, NULL, NULL);
-
- /* Insert inline file. */
- inline_file = xmalloc (sizeof *inline_file);
- init_file_handle (inline_file);
- inline_file->name = "INLINE";
- inline_file->where.filename
- = inline_file->fn = inline_file->norm_fn = (char *) _("<Inline File>");
- inline_file->where.line_number = 0;
- hsh_force_insert (files, inline_file);
-}