* callint.c (read_file_name): ... convert to static here.
* lisp.h (Fread_file_name): Do not EXFUN it.
* composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ...
(char_composable_p): ... static function. All users changed.
+2014-06-17 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * fileio.c (Fread_file_name): Do not pass redundant args and ...
+ * callint.c (read_file_name): ... convert to static here.
+ * lisp.h (Fread_file_name): Do not EXFUN it.
+ * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ...
+ (char_composable_p): ... static function. All users changed.
+
2014-06-16 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.in (ns-app): Fix typo that broke build on OS X.
}
}
+/* Helper function to call `read-file-name' from C. */
+
+static Lisp_Object
+read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch,
+ Lisp_Object initial, Lisp_Object predicate)
+{
+ struct gcpro gcpro1;
+ Lisp_Object args[7];
+
+ GCPRO1 (default_filename);
+ args[0] = intern ("read-file-name");
+ args[1] = callint_message;
+ args[2] = Qnil;
+ args[3] = default_filename;
+ args[4] = mustmatch;
+ args[5] = initial;
+ args[6] = predicate;
+ RETURN_UNGCPRO (Ffuncall (7, args));
+}
+
/* BEWARE: Calling this directly from C would defeat the purpose! */
DEFUN ("funcall-interactively", Ffuncall_interactively, Sfuncall_interactively,
1, MANY, 0, doc: /* Like `funcall' but marks the call as interactive.
break;
case 'D': /* Directory name. */
- args[i] = Fread_file_name (callint_message, Qnil,
- BVAR (current_buffer, directory), Qlambda, Qnil,
- Qfile_directory_p);
+ args[i] = read_file_name (BVAR (current_buffer, directory), Qlambda, Qnil,
+ Qfile_directory_p);
break;
case 'f': /* Existing file name. */
- args[i] = Fread_file_name (callint_message,
- Qnil, Qnil, Qlambda, Qnil, Qnil);
+ args[i] = read_file_name (Qnil, Qlambda, Qnil, Qnil);
break;
case 'F': /* Possibly nonexistent file name. */
- args[i] = Fread_file_name (callint_message,
- Qnil, Qnil, Qnil, Qnil, Qnil);
+ args[i] = read_file_name (Qnil, Qnil, Qnil, Qnil);
break;
case 'G': /* Possibly nonexistent file name,
default to directory alone. */
- args[i] = Fread_file_name (callint_message,
- Qnil, Qnil, Qnil, empty_unibyte_string, Qnil);
+ args[i] = read_file_name (Qnil, Qnil, empty_unibyte_string, Qnil);
break;
case 'i': /* Ignore an argument -- Does not do I/O. */
return unbind_to (count, lgstring);
}
-static Lisp_Object _work_val;
-
/* 1 iff the character C is composable. Characters of general
category Z? or C? are not composable except for ZWNJ and ZWJ. */
-#define CHAR_COMPOSABLE_P(C) \
- ((C) > ' ' \
- && ((C) == 0x200C || (C) == 0x200D \
- || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \
- (INTEGERP (_work_val) \
- && (XINT (_work_val) <= UNICODE_CATEGORY_So)))))
+static bool
+char_composable_p (int c)
+{
+ Lisp_Object val;
+ return (c > ' '
+ && (c == 0x200C || c == 0x200D
+ || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
+ (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
+}
/* Update cmp_it->stop_pos to the next position after CHARPOS (and
BYTEPOS) where character composition may happen. If BYTEPOS is
p = SDATA (string) + bytepos;
c = STRING_CHAR_AND_LENGTH (p, len);
limit = bytepos + len;
- while (CHAR_COMPOSABLE_P (c))
+ while (char_composable_p (c))
{
val = CHAR_TABLE_REF (Vcomposition_function_table, c);
if (! NILP (val))
/* Skip all uncomposable characters. */
if (NILP (string))
{
- while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c))
+ while (charpos - 1 > endpos && ! char_composable_p (c))
{
DEC_BOTH (charpos, bytepos);
c = FETCH_MULTIBYTE_CHAR (bytepos);
}
else
{
- while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c))
+ while (charpos - 1 > endpos && ! char_composable_p (c))
{
p--;
while (! CHAR_HEAD_P (*p))
|-B-|-C-|--D--|
Here, it is known that characters after positions 1 and 9 can
- never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and
+ never be composed (i.e. ! char_composable_p (CH)), and
composition A is an invalid one because it's partially covered by
the valid composition C. And to know whether a composition is
valid or not, the only way is to start searching forward from a
while (1)
{
c = STRING_CHAR (cur.p);
- if (! CHAR_COMPOSABLE_P (c))
+ if (! char_composable_p (c))
{
if (limit <= pos) /* case (1) */
{
return 0;
BACKWARD_CHAR (cur, stop);
c = STRING_CHAR (cur.p);
- } while (! CHAR_COMPOSABLE_P (c));
+ } while (! char_composable_p (c));
fore_check_limit = cur.pos + 1;
}
else /* case (2) */
prev = cur;
BACKWARD_CHAR (cur, stop);
c = STRING_CHAR (cur.p);
- if (! CHAR_COMPOSABLE_P (c))
+ if (! char_composable_p (c))
{
cur = prev;
break;
return Qnil;
}
-Lisp_Object
-Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate)
-{
- struct gcpro gcpro1;
- Lisp_Object args[7];
-
- GCPRO1 (default_filename);
- args[0] = intern ("read-file-name");
- args[1] = prompt;
- args[2] = dir;
- args[3] = default_filename;
- args[4] = mustmatch;
- args[5] = initial;
- args[6] = predicate;
- RETURN_UNGCPRO (Ffuncall (7, args));
-}
-
-\f
void
init_fileio (void)
{
extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object, int);
-EXFUN (Fread_file_name, 6); /* Not a normal DEFUN. */
extern void close_file_unwind (int);
extern void fclose_unwind (void *);
extern void restore_point_unwind (Lisp_Object);