[pdftex] Experiment with a new TeX primitive

Nagy Bence tipogral at freemail.hu
Sat Jan 31 12:03:25 CET 2004


Dear developers,

I made a small experiment to understand better how web2c works
(calling pascal<->C codes), so i defined a new TeX primitive
(\experiment). It calls an external C-function to print out its
parameter, and this function gives back a new string (like a search and
replace engine).

The code from the C-file:

strnumber experiment(integer t)
{
    tex_printf("<%s>",makecstring(tokenstostring(t)));
    return maketexstring("apple");
}

The main inserted code from pdftex.ch:

@ @<Implement \.{\\experiment}@>= 
begin
    call_func(scan_toks(false, true));
    back_list(link(experiment(def_ref)));
    delete_token_ref(def_ref);
end

All works fine except that I can not put back the new string ("apple")
to the token list. The function back_list causes a segmentation
fault, but it should work like the \lowercase or \uppercase primitive
(the experiment C-function gives back an integer value well). What is
wrong?

Greetings,

Bence


More information about the pdftex mailing list