+
+/* Returns the scratch file handle associated with HANDLE.
+ Applicable to only FH_REF_SCRATCH files. */
+struct scratch_handle *
+fh_get_scratch_handle (struct file_handle *handle)
+{
+ assert (handle->referent == FH_REF_SCRATCH);
+ return handle->sh;
+}
+
+/* Sets SH to be the scratch file handle associated with HANDLE.
+ Applicable to only FH_REF_SCRATCH files. */
+void
+fh_set_scratch_handle (struct file_handle *handle, struct scratch_handle *sh)
+{
+ assert (handle->referent == FH_REF_SCRATCH);
+ handle->sh = sh;
+}
+
+/* Returns the current default handle. */
+struct file_handle *
+fh_get_default_handle (void)
+{
+ return default_handle ? default_handle : fh_inline_file ();
+}
+
+/* Sets NEW_DEFAULT_HANDLE as the default handle. */
+void
+fh_set_default_handle (struct file_handle *new_default_handle)
+{
+ assert (new_default_handle == NULL
+ || (new_default_handle->referent & (FH_REF_INLINE | FH_REF_FILE)));
+ default_handle = new_default_handle;
+}