Beispiel #1
0
void print_cs(int p)
{
str_number t= cs_text(p);
if(p<hash_base){

if(p==null_cs){
tprint_esc("csname");
tprint_esc("endcsname");
print_char(' ');
}else{
tprint_esc("IMPOSSIBLE.");
}
}else if((p>=undefined_control_sequence)&&
((p<=eqtb_size)||p> eqtb_size+hash_extra)){
tprint_esc("IMPOSSIBLE.");
}else if(t>=str_ptr){
tprint_esc("NONEXISTENT.");
}else{
if(is_active_cs(t)){
print(active_cs_value(t));
}else{
print_esc(t);
if(single_letter(t)){
if(get_cat_code(cat_code_table_par,pool_to_unichar(str_string(t)))==letter_cmd)
print_char(' ');
}else{
print_char(' ');
}
}
}
}
Beispiel #2
0
static int run_build(lua_State * L)
{
    if (lua_type(L, 1) == LUA_TNUMBER) {
        int cs = 0;
        int chr = (int) lua_tointeger(L, 1);
        int cmd = (int) luaL_optinteger(L, 2, get_cat_code(cat_code_table_par,chr));
        if (cmd == 0 || cmd == 9 || cmd == 14 || cmd == 15) {
            formatted_warning("token lib","not a good token, catcode %i can not be returned, so 12 will be used",(int) cmd);
            cmd = 12;
        } else if (cmd == 13) {
            cs = active_to_cs(chr, false);
            cmd = eq_type(cs);
            chr = equiv(cs);
        }
        make_new_token(L, cmd, chr, cs);
        return 1;
    } else {
        return run_lookup(L);
    }
}