[NTG-pdftex] Synchronization
Taco Hoekwater
taco at elvenkind.com
Sat Feb 9 09:43:59 CET 2008
Hi Jérôme,
LAURENS Jérôme wrote:
>>
>> * how does this patch relate to the --src-specials switch from web2c,
>
> No common code
> better design
> stronger design
> better result
Does that mean that eventually we may get rid of --src-specials
completely? (That would be good). Right now, we will probably have
both at the same time and I was a little worried that they might
interfere with eachother. From you long explanation below, I now
understand that they don't.
>> and what editor/previewer combinations understand your files format?
>> (and/or are likely to start doing that in the future)
>
> I understand your question: you are wondering if this feature would be
> used by a viewer or an editor.
> Anyone who ever used synchronization does not ask this question
> because he knows that such a synchronization is a "must have".
Thanks for the long technical answer as well. So far, I have never
really used editor synchronization tools in my TeX work. Personally,
I always found that the semi-automatic window changes were very
distracting. I have never been much of a fan of integrated TeX systems
either, for much the same reason (this is a matter of personal taste,
so don't take it as a critique on your patch).
>> This will result in more lines of web changes, but it will be easier
>> to maintain the code by someone that is not you.
>
> If you are talking about code design, I would follow you if you could
> explain what kind of extensions you are thinking of.
You made a convincing argument, so just leave it as is.
To give you an idea of what I am talking about, here is the list of
nodes that have size>3 already even without your patch in luatex
(you could consider luatex an extension to pdftex):
Core output nodes: disc, box, rule, glyph, margin_kern
Whatits that are output: pdf_refxform, pdf_refximage,
pdf_annot, pdf_dest, pdf_thread,
Internal stream nodes: ins_node, page_ins_node
Internal whatsits: dir, open, local_par, pdf_colorstack,
user_defined
Temporary math objects: style, radical_noad, accent_noad,
(about everything) fraction_noad, noad
Alignment stack entries: align_stack
Paragraph breaking: hyphenated, unhyphenated, passive, delta
Weird ones: shape, pseudo_line
(variable size)
Some of those are candidates for synchronization, but many are not.
A whole bunch of them is never written to the output at all.
Like I said, leave your code as is. But I want to show you how
it would also have been possible (luatex pascal web, not pdftex,
but it does not really matter):
--
@d box_node_size=8+synchronization_field_size
{number of words to allocate for a box node}
--
@p function new_null_box:pointer; {creates a new box node}
var p:pointer; {the new node}
begin p:=new_node(hlist_node,min_quarterword);
+ @<Initialize |list_node| synchronization fields@>;
new_null_box:=p;
end;
--
@p function new_kern(@!w:scaled):pointer;
var p:pointer; {the new node}
begin p:=new_node(kern_node,normal);
width(p):=w;
+ @<Initialize |medium_node| synchronization fields@>;
new_kern:=p;
end;
--
... etc
--
+ glue_node: begin
+ @<Synchronization dvi hook: output glue info@>;
+ @<Move right or output leaders@>;
+ end;
--
+ @ All synchronization stuff is handled in this section
+
+ @d synchronization_field_size==2
+
+ @<Initialize |list_node| synchronization fields@>=
+ begin
+ mem[p+box_node_size].int := synctag;
+ mem[p+box_node_size+1].int := line;
+ end
+ ....
+
+ @ @<Synchronization dvi hook: output glue info@>=
+ sync_glue(p);
+ ...
The main advantages:
* a person changing new_null_nox() can immediately see there
is something going on with synchronization
* all the actual synchronization code is bundled together,
allowing better documentation
* there may be a bit more code, but less initialization
instructions are actually executed by the application.
>> * you licensed the C file as GPL2, yes?
>
> Open source, whether GPL2 or something else, I don't know for sure
> because I was not given any hint about pdftex development rules.
GPL2 is fine, just making sure.
>> * the attachments seem missing in sarovar.org at the moment
>
> All the attachments have been removed, there might be a good reason,
> should I upload once again?
I don't know why they were removed in the first place. Martin,
is that something you did?
Best wishes,
Taco
More information about the ntg-pdftex
mailing list