Tk Library Source Code

View Ticket
Login
Ticket UUID: 530056
Title: Misleading error message in expander
Type: Bug Version: None
Submitter: andreas_kupries Created on: 2002-03-14 21:07:25
Subsystem: textutil Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-02-12 09:55:18
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2003-02-12 02:55:18
Description:
When a user of the expander does not pop all the 
contexts it pushed during the expansion process the 
core expander will access the wrong context when 
trying to restore bracket information of an outer 
invocation. The generated error message refers to the 
lb variable, telling us that it is missing. But the 
root cause is that there are still user contexts open.

Change the expander to check that before/after levels 
of contexts are the same and generate a better error 
message if the levels are not the same. Maybe even 
name the contexts which were not popped.
User Comments: andreas_kupries added on 2003-02-12 09:55:18:
Logged In: YES 
user_id=75003

Having looked deeper I see no way to decouple things without
introducing a major headache in how to actually handle file
crossing context. The reason being that method [expand]
opens its own context not only to save state (brackets), but
also to capture the output so that it can return it as its
own result. Any way of getting rid of that context implies
complexification of the rules who determine which output
goes where when and why.

Closing for good. Thinking about different methods of
implementing file inclusion than using [expand].

andreas_kupries added on 2003-02-12 07:55:44:
Logged In: YES 
user_id=75003

Reopening. The current solution for the problem has the 
drawback that the context stack is used both by the 
expander itself to store internal information regarding the 
nesting of 'expand', and by the macros in the input language. 
This means that no language with an macro which uses 
expand (like an 'include file') is able to open a context in one 
file and close in a different one. Closing the expand level kills 
all user context it generated.

Better solution: decouple internal usage form macro context. 
Store data in a separate stack. Have the outermost expand 
check that the context nesting is done right.


stack used by macro

andreas_kupries added on 2002-03-15 14:34:45:
Logged In: YES 
user_id=75003

Patch committed to head.

andreas_kupries added on 2002-03-15 05:49:58:

File Added - 19374: 530056.diff

Logged In: YES 
user_id=75003

Here is a patch.

andreas_kupries added on 2002-03-15 04:09:08:
Logged In: YES 
user_id=75003

This message is a followup on the investigation
to determine the cause of

    "[528392] Missing commands in nroff format".

Attachments: