/* CCL (Code Conversion Language) interpreter.
- Copyright (C) 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2011 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010
+ 2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H14PRO021
Copyright (C) 2003
Lisp_Object Qccl, Qcclp;
-/* This contains all code conversion map available to CCL. */
-Lisp_Object Vcode_conversion_map_vector;
-
-/* Alist of fontname patterns vs corresponding CCL program. */
-Lisp_Object Vfont_ccl_encoder_alist;
-
/* This symbol is a property which associates with ccl program vector.
Ex: (get 'ccl-big5-encoder 'ccl-program) returns ccl program vector. */
-Lisp_Object Qccl_program;
+static Lisp_Object Qccl_program;
/* These symbols are properties which associate with code conversion
map and their ID respectively. */
-Lisp_Object Qcode_conversion_map;
-Lisp_Object Qcode_conversion_map_id;
+static Lisp_Object Qcode_conversion_map;
+static Lisp_Object Qcode_conversion_map_id;
/* Symbols of ccl program have this property, a value of the property
is an index for Vccl_protram_table. */
-Lisp_Object Qccl_program_idx;
+static Lisp_Object Qccl_program_idx;
/* Table of registered CCL programs. Each element is a vector of
NAME, CCL_PROG, RESOLVEDP, and UPDATEDP, where NAME (symbol) is the
was once used. */
Lisp_Object Vccl_program_table;
-/* Vector of registered hash tables for translation. */
-Lisp_Object Vtranslation_hash_table_vector;
-
/* Return a hash table of id number ID. */
#define GET_HASH_TABLE(id) \
(XHASH_TABLE (XCDR(XVECTOR(Vtranslation_hash_table_vector)->contents[(id)])))
Therefore, the instruction code range is 0..16384(0x3fff).
*/
-/* Read a multibyte characeter.
+/* Read a multibyte character.
A code point is stored into reg[rrr]. A charset ID is stored into
reg[RRR]. */
buffer. */
#define CCL_WRITE_STRING(len) \
do { \
- int i; \
+ int ccli; \
if (!dst) \
CCL_INVALID_CMD; \
else if (dst + len <= dst_end) \
{ \
if (XFASTINT (ccl_prog[ic]) & 0x1000000) \
- for (i = 0; i < len; i++) \
- *dst++ = XFASTINT (ccl_prog[ic + i]) & 0xFFFFFF; \
+ for (ccli = 0; ccli < len; ccli++) \
+ *dst++ = XFASTINT (ccl_prog[ic + ccli]) & 0xFFFFFF; \
else \
- for (i = 0; i < len; i++) \
- *dst++ = ((XFASTINT (ccl_prog[ic + (i / 3)])) \
- >> ((2 - (i % 3)) * 8)) & 0xFF; \
+ for (ccli = 0; ccli < len; ccli++) \
+ *dst++ = ((XFASTINT (ccl_prog[ic + (ccli / 3)])) \
+ >> ((2 - (ccli % 3)) * 8)) & 0xFF; \
} \
else \
CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \
#define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \
do { \
- unsigned code; \
+ unsigned ncode; \
\
- charset = char_charset ((c), (charset_list), &code); \
+ charset = char_charset ((c), (charset_list), &ncode); \
if (! charset && ! NILP (charset_list)) \
- charset = char_charset ((c), Qnil, &code); \
+ charset = char_charset ((c), Qnil, &ncode); \
if (charset) \
{ \
(id) = CHARSET_ID (charset); \
- (encoded) = code; \
+ (encoded) = ncode; \
} \
} while (0)
}
-DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0,
+DEFUE ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0,
doc: /* Return t if OBJECT is a CCL program name or a compiled CCL program code.
See the documentation of `define-ccl-program' for the detail of CCL program. */)
(Lisp_Object object)
If IC is nil, it is initialized to head of the CCL program.
If optional 4th arg CONTINUE is non-nil, keep IC on read operation
-when read buffer is exausted, else, IC is always set to the end of
+when read buffer is exhausted, else, IC is always set to the end of
CCL-PROGRAM on exit.
It returns the contents of write buffer as a string,
Lisp_Object val;
struct ccl_program ccl;
int i;
- int outbufsize;
+ EMACS_INT outbufsize;
unsigned char *outbuf, *outp;
- int str_chars, str_bytes;
+ EMACS_INT str_chars, str_bytes;
#define CCL_EXECUTE_BUF_SIZE 1024
int source[CCL_EXECUTE_BUF_SIZE], destination[CCL_EXECUTE_BUF_SIZE];
- int consumed_chars, consumed_bytes, produced_chars;
+ EMACS_INT consumed_chars, consumed_bytes, produced_chars;
if (setup_ccl_program (&ccl, ccl_prog) < 0)
error ("Invalid CCL program");
{
const unsigned char *p = SDATA (str) + consumed_bytes;
const unsigned char *endp = SDATA (str) + str_bytes;
- int i = 0;
+ int j = 0;
int *src, src_size;
if (endp - p == str_chars - consumed_chars)
- while (i < CCL_EXECUTE_BUF_SIZE && p < endp)
- source[i++] = *p++;
+ while (j < CCL_EXECUTE_BUF_SIZE && p < endp)
+ source[j++] = *p++;
else
- while (i < CCL_EXECUTE_BUF_SIZE && p < endp)
- source[i++] = STRING_CHAR_ADVANCE (p);
- consumed_chars += i;
+ while (j < CCL_EXECUTE_BUF_SIZE && p < endp)
+ source[j++] = STRING_CHAR_ADVANCE (p);
+ consumed_chars += j;
consumed_bytes = p - SDATA (str);
if (consumed_bytes == str_bytes)
ccl.last_block = NILP (contin);
src = source;
- src_size = i;
+ src_size = j;
while (1)
{
ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE,
if (outp - outbuf + MAX_MULTIBYTE_LENGTH * ccl.produced
> outbufsize)
{
- int offset = outp - outbuf;
+ EMACS_INT offset = outp - outbuf;
outbufsize += MAX_MULTIBYTE_LENGTH * ccl.produced;
outbuf = (unsigned char *) xrealloc (outbuf, outbufsize);
outp = outbuf + offset;
}
- for (i = 0; i < ccl.produced; i++)
- CHAR_STRING_ADVANCE (destination[i], outp);
+ for (j = 0; j < ccl.produced; j++)
+ CHAR_STRING_ADVANCE (destination[j], outp);
}
else
{
if (outp - outbuf + ccl.produced > outbufsize)
{
- int offset = outp - outbuf;
+ EMACS_INT offset = outp - outbuf;
outbufsize += ccl.produced;
outbuf = (unsigned char *) xrealloc (outbuf, outbufsize);
outp = outbuf + offset;
}
- for (i = 0; i < ccl.produced; i++)
- *outp++ = destination[i];
+ for (j = 0; j < ccl.produced; j++)
+ *outp++ = destination[j];
}
src += ccl.consumed;
src_size -= ccl.consumed;
{
int len = ASIZE (Vcode_conversion_map_vector);
int i;
- Lisp_Object index;
+ Lisp_Object idx;
CHECK_SYMBOL (symbol);
CHECK_VECTOR (map);
if (EQ (symbol, XCAR (slot)))
{
- index = make_number (i);
+ idx = make_number (i);
XSETCDR (slot, map);
Fput (symbol, Qcode_conversion_map, map);
- Fput (symbol, Qcode_conversion_map_id, index);
- return index;
+ Fput (symbol, Qcode_conversion_map_id, idx);
+ return idx;
}
}
Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector,
len * 2, Qnil);
- index = make_number (i);
+ idx = make_number (i);
Fput (symbol, Qcode_conversion_map, map);
- Fput (symbol, Qcode_conversion_map_id, index);
+ Fput (symbol, Qcode_conversion_map_id, idx);
ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map));
- return index;
+ return idx;
}
Qcode_conversion_map_id = intern_c_string ("code-conversion-map-id");
staticpro (&Qcode_conversion_map_id);
- DEFVAR_LISP ("code-conversion-map-vector", &Vcode_conversion_map_vector,
+ DEFVAR_LISP ("code-conversion-map-vector", Vcode_conversion_map_vector,
doc: /* Vector of code conversion maps. */);
Vcode_conversion_map_vector = Fmake_vector (make_number (16), Qnil);
- DEFVAR_LISP ("font-ccl-encoder-alist", &Vfont_ccl_encoder_alist,
+ DEFVAR_LISP ("font-ccl-encoder-alist", Vfont_ccl_encoder_alist,
doc: /* Alist of fontname patterns vs corresponding CCL program.
Each element looks like (REGEXP . CCL-CODE),
where CCL-CODE is a compiled CCL program.
If the font is single-byte font, the register R2 is not used. */);
Vfont_ccl_encoder_alist = Qnil;
- DEFVAR_LISP ("translation-hash-table-vector", &Vtranslation_hash_table_vector,
+ DEFVAR_LISP ("translation-hash-table-vector", Vtranslation_hash_table_vector,
doc: /* Vector containing all translation hash tables ever defined.
Comprises pairs (SYMBOL . TABLE) where SYMBOL and TABLE were set up by calls
to `define-translation-hash-table'. The vector is indexed by the table id
defsubr (&Sregister_ccl_program);
defsubr (&Sregister_code_conversion_map);
}
-
-/* arch-tag: bb9a37be-68ce-4576-8d3d-15d750e4a860
- (do not change this comment) */