HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* doc/misc/cl.texi (Organization): More details on cl-lib.el versus cl.el.
[bpt/emacs.git]
/
src
/
casetab.c
diff --git
a/src/casetab.c
b/src/casetab.c
index
eed6e22
..
a84bc92
100644
(file)
--- a/
src/casetab.c
+++ b/
src/casetab.c
@@
-1,6
+1,5
@@
/* GNU Emacs routines to deal with case tables.
/* GNU Emacs routines to deal with case tables.
- Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc.
Author: Howard Gayle
Author: Howard Gayle
@@
-20,19
+19,16
@@
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "lisp.h"
-#include "buffer.h"
#include "character.h"
#include "character.h"
+#include "buffer.h"
-Lisp_Object Qcase_table_p, Qcase_table;
-Lisp_Object Vascii_downcase_table, Vascii_upcase_table;
-Lisp_Object Vascii_canon_table, Vascii_eqv_table;
-
-/* Used as a temporary in DOWNCASE and other macros in lisp.h. No
- need to mark it, since it is used only very temporarily. */
-int case_temp1;
-Lisp_Object case_temp2;
+static Lisp_Object Qcase_table_p, Qcase_table;
+Lisp_Object Vascii_downcase_table;
+static Lisp_Object Vascii_upcase_table;
+Lisp_Object Vascii_canon_table;
+static Lisp_Object Vascii_eqv_table;
static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt);
static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt);
static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt);
static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt);
@@
-72,7
+68,7
@@
DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0,
doc: /* Return the case table of the current buffer. */)
(void)
{
doc: /* Return the case table of the current buffer. */)
(void)
{
- return
current_buffer->downcase_table
;
+ return
BVAR (current_buffer, downcase_table)
;
}
DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0,
}
DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0,
@@
-83,7
+79,7
@@
This is the one used for new buffers. */)
return Vascii_downcase_table;
}
return Vascii_downcase_table;
}
-static Lisp_Object set_case_table (Lisp_Object
table, int standard
);
+static Lisp_Object set_case_table (Lisp_Object
, bool
);
DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0,
doc: /* Select a new case table for the current buffer.
DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0,
doc: /* Select a new case table for the current buffer.
@@
-99,7
+95,7
@@
CANONICALIZE maps each character to a canonical equivalent;
any two characters that are related by case-conversion have the same
canonical equivalent character; it may be nil, in which case it is
deduced from DOWNCASE and UPCASE.
any two characters that are related by case-conversion have the same
canonical equivalent character; it may be nil, in which case it is
deduced from DOWNCASE and UPCASE.
-EQUIVALENCES is a map that cyclicly permutes each equivalence class
+EQUIVALENCES is a map that cyclic
al
ly permutes each equivalence class
(of characters with the same canonical equivalent); it may be nil,
in which case it is deduced from CANONICALIZE. */)
(Lisp_Object table)
(of characters with the same canonical equivalent); it may be nil,
in which case it is deduced from CANONICALIZE. */)
(Lisp_Object table)
@@
-107,7
+103,8
@@
EQUIVALENCES is a map that cyclicly permutes each equivalence class
return set_case_table (table, 0);
}
return set_case_table (table, 0);
}
-DEFUN ("set-standard-case-table", Fset_standard_case_table, Sset_standard_case_table, 1, 1, 0,
+DEFUN ("set-standard-case-table", Fset_standard_case_table,
+ Sset_standard_case_table, 1, 1, 0,
doc: /* Select a new standard case table for new buffers.
See `set-case-table' for more info on case tables. */)
(Lisp_Object table)
doc: /* Select a new standard case table for new buffers.
See `set-case-table' for more info on case tables. */)
(Lisp_Object table)
@@
-116,7
+113,7
@@
See `set-case-table' for more info on case tables. */)
}
static Lisp_Object
}
static Lisp_Object
-set_case_table (Lisp_Object table,
int
standard)
+set_case_table (Lisp_Object table,
bool
standard)
{
Lisp_Object up, canon, eqv;
{
Lisp_Object up, canon, eqv;
@@
-131,13
+128,13
@@
set_case_table (Lisp_Object table, int standard)
up = Fmake_char_table (Qcase_table, Qnil);
map_char_table (set_identity, Qnil, table, up);
map_char_table (shuffle, Qnil, table, up);
up = Fmake_char_table (Qcase_table, Qnil);
map_char_table (set_identity, Qnil, table, up);
map_char_table (shuffle, Qnil, table, up);
-
XCHAR_TABLE (table)->extras[0] = up
;
+
set_char_table_extras (table, 0, up)
;
}
if (NILP (canon))
{
canon = Fmake_char_table (Qcase_table, Qnil);
}
if (NILP (canon))
{
canon = Fmake_char_table (Qcase_table, Qnil);
-
XCHAR_TABLE (table)->extras[1] = canon
;
+
set_char_table_extras (table, 1, canon)
;
map_char_table (set_canon, Qnil, table, table);
}
map_char_table (set_canon, Qnil, table, table);
}
@@
-146,11
+143,11
@@
set_case_table (Lisp_Object table, int standard)
eqv = Fmake_char_table (Qcase_table, Qnil);
map_char_table (set_identity, Qnil, canon, eqv);
map_char_table (shuffle, Qnil, canon, eqv);
eqv = Fmake_char_table (Qcase_table, Qnil);
map_char_table (set_identity, Qnil, canon, eqv);
map_char_table (shuffle, Qnil, canon, eqv);
-
XCHAR_TABLE (table)->extras[2] = eqv
;
+
set_char_table_extras (table, 2, eqv)
;
}
/* This is so set_image_of_range_1 in regex.c can find the EQV table. */
}
/* This is so set_image_of_range_1 in regex.c can find the EQV table. */
-
XCHAR_TABLE (canon)->extras[2] = eqv
;
+
set_char_table_extras (canon, 2, eqv)
;
if (standard)
{
if (standard)
{
@@
-161,10
+158,10
@@
set_case_table (Lisp_Object table, int standard)
}
else
{
}
else
{
-
current_buffer->downcase_table = table
;
-
current_buffer->upcase_table = up
;
-
current_buffer->case_canon_table = canon
;
-
current_buffer->case_eqv_table = eqv
;
+
bset_downcase_table (current_buffer, table)
;
+
bset_upcase_table (current_buffer, up)
;
+
bset_case_canon_table (current_buffer, canon)
;
+
bset_case_eqv_table (current_buffer, eqv)
;
}
return table;
}
return table;
@@
-206,7
+203,10
@@
set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
}
else
from = to = XINT (c);
}
else
from = to = XINT (c);
- for (; from <= to; from++)
+
+ to++;
+ lint_assume (to <= MAX_CHAR + 1);
+ for (; from < to; from++)
CHAR_TABLE_SET (table, from, make_number (from));
}
}
CHAR_TABLE_SET (table, from, make_number (from));
}
}
@@
-231,7
+231,9
@@
shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
else
from = to = XINT (c);
else
from = to = XINT (c);
- for (; from <= to; from++)
+ to++;
+ lint_assume (to <= MAX_CHAR + 1);
+ for (; from < to; from++)
{
Lisp_Object tem = Faref (table, elt);
Faset (table, elt, make_number (from));
{
Lisp_Object tem = Faref (table, elt);
Faset (table, elt, make_number (from));
@@
-245,8
+247,7
@@
init_casetab_once (void)
{
register int i;
Lisp_Object down, up;
{
register int i;
Lisp_Object down, up;
- Qcase_table = intern_c_string ("case-table");
- staticpro (&Qcase_table);
+ DEFSYM (Qcase_table, "case-table");
/* Intern this now in case it isn't already done.
Setting this variable twice is harmless.
/* Intern this now in case it isn't already done.
Setting this variable twice is harmless.
@@
-259,7
+260,7
@@
init_casetab_once (void)
down = Fmake_char_table (Qcase_table, Qnil);
Vascii_downcase_table = down;
down = Fmake_char_table (Qcase_table, Qnil);
Vascii_downcase_table = down;
-
XCHAR_TABLE (down)->purpose = Qcase_table
;
+
set_char_table_purpose (down, Qcase_table)
;
for (i = 0; i < 128; i++)
{
for (i = 0; i < 128; i++)
{
@@
-267,10
+268,10
@@
init_casetab_once (void)
CHAR_TABLE_SET (down, i, make_number (c));
}
CHAR_TABLE_SET (down, i, make_number (c));
}
-
XCHAR_TABLE (down)->extras[1] = Fcopy_sequence (down
);
+
set_char_table_extras (down, 1, Fcopy_sequence (down)
);
up = Fmake_char_table (Qcase_table, Qnil);
up = Fmake_char_table (Qcase_table, Qnil);
-
XCHAR_TABLE (down)->extras[0] = up
;
+
set_char_table_extras (down, 0, up)
;
for (i = 0; i < 128; i++)
{
for (i = 0; i < 128; i++)
{
@@
-280,7
+281,7
@@
init_casetab_once (void)
CHAR_TABLE_SET (up, i, make_number (c));
}
CHAR_TABLE_SET (up, i, make_number (c));
}
-
XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up
);
+
set_char_table_extras (down, 2, Fcopy_sequence (up)
);
/* Fill in what isn't filled in. */
set_case_table (down, 1);
/* Fill in what isn't filled in. */
set_case_table (down, 1);
@@
-289,8
+290,7
@@
init_casetab_once (void)
void
syms_of_casetab (void)
{
void
syms_of_casetab (void)
{
- Qcase_table_p = intern_c_string ("case-table-p");
- staticpro (&Qcase_table_p);
+ DEFSYM (Qcase_table_p, "case-table-p");
staticpro (&Vascii_canon_table);
staticpro (&Vascii_downcase_table);
staticpro (&Vascii_canon_table);
staticpro (&Vascii_downcase_table);
@@
-303,6
+303,3
@@
syms_of_casetab (void)
defsubr (&Sset_case_table);
defsubr (&Sset_standard_case_table);
}
defsubr (&Sset_case_table);
defsubr (&Sset_standard_case_table);
}
-
-/* arch-tag: e06388ad-99fe-40ec-ba67-9d010fcc4916
- (do not change this comment) */