Function: register-ccl-program
register-ccl-program is a function defined in ccl.c.
Signature
(register-ccl-program NAME CCL-PROG)
Documentation
Register CCL program CCL-PROG as NAME in ccl-program-table.
CCL-PROG should be a compiled CCL program (vector), or nil. If it is nil, just reserve NAME as a CCL program name. Return index number of the registered CCL program.
Source Code
// Defined in /usr/src/emacs/src/ccl.c
{
ptrdiff_t len = ASIZE (Vccl_program_table);
ptrdiff_t idx;
Lisp_Object resolved;
CHECK_SYMBOL (name);
resolved = Qnil;
if (!NILP (ccl_prog))
{
CHECK_VECTOR (ccl_prog);
resolved = resolve_symbol_ccl_program (ccl_prog);
if (NILP (resolved))
error ("Error in CCL program");
if (VECTORP (resolved))
{
ccl_prog = resolved;
resolved = Qt;
}
else
resolved = Qnil;
}
for (idx = 0; idx < len; idx++)
{
Lisp_Object slot;
slot = AREF (Vccl_program_table, idx);
if (!VECTORP (slot))
/* This is the first unused slot. Register NAME here. */
break;
if (EQ (name, AREF (slot, 0)))
{
/* Update this slot. */
ASET (slot, 1, ccl_prog);
ASET (slot, 2, resolved);
ASET (slot, 3, Qt);
return make_fixnum (idx);
}
}
if (idx == len)
/* Extend the table. */
Vccl_program_table = larger_vector (Vccl_program_table, 1, -1);
ASET (Vccl_program_table, idx,
CALLN (Fvector, name, ccl_prog, resolved, Qt));
Fput (name, Qccl_program_idx, make_fixnum (idx));
return make_fixnum (idx);
}