compose SUBROUTINE_PATH from different include files

More
03 Nov 2022 11:53 #255835 by seuchato
Hi all
I am currently reworking my router. Just about everything standard. Ceaser seemed to have a saying: divide and conquer. So I split my ini in different files just like in the example "/usr/share/doc/linuxcnc/examples/sample-configs/sim/axis/ini_with_includes".

The manual V2.8.4 dated 22-09-29 says in 8.2.24 [RS274NGC] section

 SUBROUTINE_PATH = ncsubroutines:/tmp/testsubs:lathesubs:millsubs - Specifies a colon (:) separated list of up to 10 di-
rectories to be searched when single-file subroutines are specified in gcode. These directories are searched after searching
[DISPLAY]PROGRAM_PREFIX (if it is specified) and before searching [WIZARD]WIZARD_ROOT (if specified). The
paths are searched in the order that they are listed. The first matching subroutine file found in the search is used. Directo-
ries are specified relative to the current directory for the ini file or as absolute paths. The list must contain no intervening
whitespace.

What i'd like to do, if it was in bash would be adding successively to the path variable about like this
path="$path:nextpath"
I could not find such a mechanism for "SUBROUTINE_PATH".
Is this possible at all? if, how?

greez
chris
 

Please Log in or Create an account to join the conversation.

More
03 Nov 2022 23:39 #255878 by andypugh
I think that there can probably only be one [RS274NGC] section. (I might be wrong, though)

#INCLUDE generally inserts a whole file at that point, it doesn't interleave and combine sections.

So the INI find system will look for SUBROUTINE_PATH in the first [RS274NGC] that it sees and use that.

So I don't think that it is as easy as having a reference to the current path, I just don't think that it will find the second and third stanzas.

Please Log in or Create an account to join the conversation.

More
04 Nov 2022 09:31 #255890 by seuchato
Thanks Andy
So its a double no go. Thought, it would be a nice feature.
greez
chris

Please Log in or Create an account to join the conversation.

More
11 Nov 2022 19:59 #256458 by seuchato
I checked on /usr/bin/linuxcnc. It is basically a bash file. Are there any strong points in adding a loop over all the include files to compose the desired path composition?

What I'd like to try in "function handle_includes () " is roughly:
  1. compose a list of all include files that contain a string like "SUBROUTINE_PATH ="
  2. add all the paths following the  string "SUBROUTINE_PATH +=" say in "composed-path" variable
  3. eliminate double occurances and then count the elements separated by ":", as we seem to be limited to 10 subdirs or 9 ":". If 9 ":" are exceeded, throw a corresponding message and abort (side note: why is the limit 10?)
  4. proceed with the composition of all include files
  5. revisit the part with string "SUBROUTINE_PATH = xyz" and replace "xyz" with "composed-path"
I believe, it's doable. Main advantage: we could have a directory for say "tool length measurement" or "TLM", containing all that's needed to add the feature. There could be files like ~/TLM/TLM-DISPLAY.inc, ... ~/TLM/TLM-RS274NGC.inc etc. The linuxcnc script already parses these in the sequence they are placed in the ini file. My suggested approach only adds composition of "SUBROUTINE_PATH".

Any objections?

greez
chris

Please Log in or Create an account to join the conversation.

More
12 Nov 2022 23:22 #256549 by andypugh
Maybe accept SUBROUTINE_PATH_APPEND?

Please Log in or Create an account to join the conversation.

More
13 Nov 2022 03:51 #256560 by seuchato
Not sure what you want to tell me with this. Based on the excerpt below, I guess your suggestion is to use "SUBROUTINE_PATH_APPEND" as new keyword in the ini files?
cat[color=#000000] /usr/share/doc/linuxcnc/examples/sample-configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange.ini[/color]

...
[PYTHON]
# where to find Python code
# code specific for this configuration
PATH_PREPEND= ./python
# generic support code
PATH_APPEND= ../../nc_files/remap_lib/python-stdglue
...

Here I see the keywords "PATH_PREPEND" and "PATH_APPEND". I have to dig in the source code to see how it's done. I guess the very code could be inspiring :-)
greez
chris

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum