[texworks] Error with Lua version

Alain Delmotte esperanto at swing.be
Tue Jul 21 09:56:59 CEST 2009


Hi,

Thanks for the fix!

Alain

Stefan Löffler a écrit :
> Hi,
>
> I can confirm now that this problem also happens on Linux (though Tw
> doesn't crash, it just becomes unresponsive until killed). However, my
> recent speculations turned out to be incorrect.
>
> On 2009-07-20 17:16, Alain Delmotte wrote:
>   
>> Stefan Löffler a écrit :
>>     
>>> 2) If not: could you send me the version of your log parser with which
>>> the crash occurs?
>>>   
>>>       
>> Hummm! This is industry secret :-)) (well attached)
>>     
>
> Then I'm going to save your company some trouble. You think they'll pay
> me for it? :P
>
> It turned out that the lua implementation was working correctly. The
> problem is that the log is not terminated by a newline character. Since
> your TrouverLigne was only looking for newline characters (and not
> checking if you've reached the end of the string), it never stopped.
> Whether the result was a crash or a hanging application seems to be
> system dependent.
>
> Anyway, attached you should find a corrected version of the script.
>
> Regards
> Stefan
>
> PS: One suggestion: I'd prefer the error/warning/boxes tabs to only pop
> up if they are actually displaying something. That way I as a user would
> have immediate feedback whether there were errors etc. or not.
>   
> ------------------------------------------------------------------------
>
> --[[TeXworksScript
> Title: Parse LaTeX Log (Example)
> Description: Gives examples of how to modify the output log of a LaTeX run
> Author: Alain Delmotte
> Version: 0.1
> Date: 2009-06-07
> Script-Type: hook
> Hook: AfterTypeset
> ]]
>
> local errors = ""
> local badboxes = ""
> local warnings = ""
> local place = 1
> local chaine = ""
> local log
>
> function TrouverLigne ()
> 	local suite = ""
> 	repeat
> 		suite = suite .. string.sub(log,place,place)
> 		place = place + 1
> 	until string.byte(string.sub(log,place,place)) == 10 or place >= string.len(log)
> 	return suite
> end
>
> if type(output) == "string" then
> 	do
> 		log = output
> 		chaine = TrouverLigne()
> 		while place < string.len(log) do
> 			if (string.find(chaine,"Overfull") ~= nil) or (string.find(chaine,"Underfull") ~= nil) then
> 				badboxes = badboxes .. chaine
> 			elseif string.find(chaine,"LaTeX Warning") ~= nil then
> 				warnings = warnings .. chaine
> 			elseif string.find(chaine,"! ") ~= nil then
> 				errors = errors .. chaine
> 			end
> 			chaine = TrouverLigne()
> 		end
> 		output = {}
> 		output[1] = { ["label"] = "Errors"; ["type"] = 1; ["data"] = errors }
> 		output[2] = { ["label"] = "Warnings"; ["type"] = 1; ["data"] = warnings }
> 		output[3] = { ["label"] = "Bad boxes"; ["type"] = 1; ["data"] = badboxes }
> 	end
> end
>
>   



More information about the texworks mailing list