]> git.eshelyaron.com Git - emacs.git/commitdiff
(ENCODE_FILE): Moved from fileio.c. Use
authorKenichi Handa <handa@m17n.org>
Tue, 3 Mar 1998 07:18:46 +0000 (07:18 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 3 Mar 1998 07:18:46 +0000 (07:18 +0000)
default-file-name-coding-system if file-name-coding-system is nil.
(DECODE_FILE): New macro.

src/coding.h

index 61b4402a902968b5e75d2cb3d5454b9e45caa16a..1c1e3f798dee269fe4c6e76f0d6b36a10cbda83d 100644 (file)
@@ -487,6 +487,28 @@ struct coding_system
       s2 = c2 + 0x7E;                                  \
   } while (0)
 
+/* Encode the file name NAME using the specified coding system
+   for file names, if any.  */
+#define ENCODE_FILE(name)                                                 \
+  (! NILP (Vfile_name_coding_system)                                      \
+   && XFASTINT (Vfile_name_coding_system) != 0                            \
+   ? Fencode_coding_string (name, Vfile_name_coding_system, Qt)                   \
+   : (! NILP (Vdefault_file_name_coding_system)                                   \
+      && XFASTINT (Vdefault_file_name_coding_system)                      \
+      ? Fencode_coding_string (name, Vdefault_file_name_coding_system, Qt) \
+      : name))
+
+/* Decode the file name NAME using the specified coding system
+   for file names, if any.  */
+#define DECODE_FILE(name)                                                 \
+  (! NILP (Vfile_name_coding_system)                                      \
+   && XFASTINT (Vfile_name_coding_system) != 0                            \
+   ? Fdecode_coding_string (name, Vfile_name_coding_system, Qt)                   \
+   : (! NILP (Vdefault_file_name_coding_system)                                   \
+      && XFASTINT (Vdefault_file_name_coding_system)                      \
+      ? Fdecode_coding_string (name, Vdefault_file_name_coding_system, Qt) \
+      : name))
+
 /* Extern declarations.  */
 extern int decode_coding P_ ((struct coding_system *, unsigned char *,
                              unsigned char *, int, int));