Hi, I noticed two problems with the mplib `get_...` family of functions: - First there seems to be a LuaTeX specific documentation bug: In the LuaTeX manual these functions are listed as `getboolean`, `getnumeric`, `getstring`and `getpath`, but in the actual implementation the names contain a underscore. - If `get_numeric` is called while two nested loops are in effect in MetaPost, an endless loop is triggered when MetaPost tries to iterate through the current loops. I attached a patch fixing both problems. The second point also applies to the standalone mplib. Best regards Marcel Krüger
On Wed, Sep 12, 2018 at 12:16 PM Marcel Krüger
Hi,
I noticed two problems with the mplib `get_...` family of functions:
- First there seems to be a LuaTeX specific documentation bug: In the LuaTeX manual these functions are listed as `getboolean`, `getnumeric`, `getstring`and `getpath`, but in the actual implementation the names contain a underscore.
- If `get_numeric` is called while two nested loops are in effect in MetaPost, an endless loop is triggered when MetaPost tries to iterate through the current loops.
I attached a patch fixing both problems. The second point also applies to the standalone mplib.
Thank you for the patches. Do you have an example where the get_numeric fails ? -- luigi
---- On Wed, 12 Sep 2018 13:07:36 +0200 luigi scarso
On Wed, Sep 12, 2018 at 12:16 PM Marcel Krüger
wrote: Hi, I noticed two problems with the mplib `get_...` family of functions:
- First there seems to be a LuaTeX specific documentation bug: In the LuaTeX manual these functions are listed as `getboolean`, `getnumeric`, `getstring`and `getpath`, but in the actual implementation the names contain a underscore.
- If `get_numeric` is called while two nested loops are in effect in MetaPost, an endless loop is triggered when MetaPost tries to iterate through the current loops.
I attached a patch fixing both problems. The second point also applies to the standalone mplib.
Thank you for the patches.Do you have an example where the get_numeric fails ? --
A plain LuaTeX example: \directlua{ local mp mp = mplib.new{ extensions = 1, run_script = function(script) print('The value:', mp:get_numeric'mynumeric') return "" end } mp:execute[[ mynumeric = 1; myother = for i=1,2: for j=1,2: i+j+runscript"something" endfor endfor 1; ]] } \bye This prints `The value: 1.0` with the patch and freezes without it. Best regards Marcel
On Wed, Sep 12, 2018 at 1:38 PM Marcel Krüger
---- On Wed, 12 Sep 2018 13:07:36 +0200 luigi scarso < luigi.scarso@gmail.com> wrote ----
On Wed, Sep 12, 2018 at 12:16 PM Marcel Krüger
wrote: Hi, I noticed two problems with the mplib `get_...` family of functions:
- First there seems to be a LuaTeX specific documentation bug: In the LuaTeX manual these functions are listed as `getboolean`, `getnumeric`, `getstring`and `getpath`, but in the actual implementation the names contain a underscore.
- If `get_numeric` is called while two nested loops are in effect in
MetaPost,
an endless loop is triggered when MetaPost tries to iterate through the current loops.
I attached a patch fixing both problems. The second point also applies to the standalone mplib.
Thank you for the patches.Do you have an example where the get_numeric fails ? --
A plain LuaTeX example:
\directlua{ local mp mp = mplib.new{ extensions = 1, run_script = function(script) print('The value:', mp:get_numeric'mynumeric') return "" end } mp:execute[[ mynumeric = 1; myother = for i=1,2: for j=1,2: i+j+runscript"something" endfor endfor 1; ]] } \bye
This prints `The value: 1.0` with the patch and freezes without it.
Best regards Marcel
OK, thank you very much.
-- luigi
On Wed, Sep 12, 2018 at 1:51 PM luigi scarso
On Wed, Sep 12, 2018 at 1:38 PM Marcel Krüger
wrote: ---- On Wed, 12 Sep 2018 13:07:36 +0200 luigi scarso < luigi.scarso@gmail.com> wrote ----
On Wed, Sep 12, 2018 at 12:16 PM Marcel Krüger
wrote:
Hi,
I noticed two problems with the mplib `get_...` family of functions:
- First there seems to be a LuaTeX specific documentation bug: In the LuaTeX manual these functions are listed as `getboolean`, `getnumeric`, `getstring`and `getpath`, but in the actual implementation the names contain a underscore.
- If `get_numeric` is called while two nested loops are in effect in MetaPost, an endless loop is triggered when MetaPost tries to iterate through the current loops.
I attached a patch fixing both problems. The second point also applies to the standalone mplib.
Thank you for the patches.Do you have an example where the get_numeric fails ? --
A plain LuaTeX example:
\directlua{ local mp mp = mplib.new{ extensions = 1, run_script = function(script) print('The value:', mp:get_numeric'mynumeric') return "" end } mp:execute[[ mynumeric = 1; myother = for i=1,2: for j=1,2: i+j+runscript"something" endfor endfor 1; ]] } \bye
This prints `The value: 1.0` with the patch and freezes without it.
Best regards Marcel
OK, thank you very much.
-- luigi
patched applied -- revision 6978. -- luigi
participants (2)
-
luigi scarso
-
Marcel Krüger