Skip to content

ini: Fix Tcl interaction, fix missing updates and some improvements#3988

Open
BsAtHome wants to merge 1 commit intoLinuxCNC:masterfrom
BsAtHome:fix_ini-tcl
Open

ini: Fix Tcl interaction, fix missing updates and some improvements#3988
BsAtHome wants to merge 1 commit intoLinuxCNC:masterfrom
BsAtHome:fix_ini-tcl

Conversation

@BsAtHome
Copy link
Copy Markdown
Contributor

This PR addresses the problem with the ini-parser and Tcl interaction. The Tcl side now maps onto the new ini-parser and gets the data from the same parser and data pool as all other parts of linuxCNC. There is no longer a necessity to predigest the ini-file. This PR fixes #3972.

There is a need to get rid of some Tcl code that uses the parse_ini method to add sections/variables to the global Tcl scope as associative arrays. But that can wait for another time because the fallout would be larger than a simple update. It works now by reading the data from the new parser instead of trying to read the ini-file manually.

LinuxCNC pre-flight config check got an update. A new ini-file checker was written in python, linuxcnc_check_ini, to replace the old Tcl version (check_config.tcl). Checks have been greatly expanded, it performs better and uses the new ini-parser for all reading.
The new pre-flight check tests all ini-file variables that are known to be boolean to be valid if they are present in the ini-file. It also tests known enumerations and some integer variables with known numerical limits. This PR fixes #3863.

The python interface now exposes conversion routines for some commonly used enumerations (linear/angular units and joint type). This way no reimplementations are necessary and they will be handled consistently.

A previously missed python based user interface (gscreen.py) has been updated to use the proper typed conversions.

The values in ini-files can now again have comments on the line where they are defined. You can embed both # and ; characters by escaping them (\# and \;) or using hex escapes. There we actually ini-files in the config directory using comments on a variable definition line. These should work properly now. There were not detected any strings that embed the comment characters. However, if some were missed, they are easily fixed.

The documentation has been updated.

ini: Expose enum mapping functions in python
ini: Improve linuxcnc pre-run ini-file check
ini: Reintroduce to remove comments in values
@c-morley
Copy link
Copy Markdown
Collaborator

c-morley commented May 1, 2026

How would an INI line like this be interpreted?
Note it uses semicolons, not to designate comments.

MDI_COMMAND_MACRO0 = G0 Z25;X0 Y0;Z0, Goto\nUser\nZero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linuxcnc config folder is polluted with a 'ini expanded' file when a config is run Boolean INI values are parsed inconsistently

2 participants