/* FH_REF_FILE only. */
char *file_name; /* File name as provided by user. */
enum fh_mode mode; /* File mode. */
+ enum legacy_encoding encoding;/* File encoding. */
/* FH_REF_FILE and FH_REF_INLINE only. */
size_t record_width; /* Length of fixed-format records. */
handle->mode = properties->mode;
handle->record_width = properties->record_width;
handle->tab_width = properties->tab_width;
+ handle->encoding = properties->encoding;
return handle;
}
fh_default_properties (void)
{
static const struct fh_properties default_properties
- = {FH_MODE_TEXT, 1024, 4};
+ = {FH_MODE_TEXT, 1024, 4, LEGACY_NATIVE};
return &default_properties;
}
return handle->tab_width;
}
+/* Returns the encoding of characters read from HANDLE. */
+enum legacy_encoding
+fh_get_legacy_encoding (const struct file_handle *handle)
+{
+ assert (handle->referent & (FH_REF_FILE | FH_REF_INLINE));
+ return (handle->referent == FH_REF_FILE ? handle->encoding : LEGACY_NATIVE);
+}
+
/* Returns the scratch file handle associated with HANDLE.
Applicable to only FH_REF_SCRATCH files. */
struct scratch_handle *
and similarly for writing. If successful, a reference to TYPE
is retained, so it should probably be a string literal.
+ TYPE should be marked with N_() in the caller: that is, the
+ caller should not translate it with gettext, but fh_lock will
+ do so.
+
ACCESS specifies whether the lock is for reading or writing.
EXCLUSIVE is true to require exclusive access, false to allow
sharing with other accessors. Exclusive read access precludes