Parameter modifier of ":" -- documented?

More
20 Dec 2017 03:11 - 20 Dec 2017 03:12 #103375 by GaryLa
The files move.ngc and line.ngc have a parameter format I've not seen before. Chapter 3 of the documentation doesn't mention this format either.

Is it a "member" modifier allowing a variable to have members like structures have? If so, what declarations (if any) are necessary?

Or, is it just to reference a local var from another function? If so, then why does move reference its own locals this way?

BTW, the format is #<variable:mystery> and used as:

#<variable:mystery> = value
Last edit: 20 Dec 2017 03:12 by GaryLa.

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

More
20 Dec 2017 03:40 #103377 by dgarrett
The use of global names like #<_line:len>,
#<_move:phi> is just a convention used for
communication of results in some of the provided
ngcgui examples and for handling of entry boxes.


From the docs:
While input global named parameters are
discouraged, linuxCNC subroutines must use global
named parameters for returning results. Since
ngcgui-compatible subfiles are aimed at gui usage,
return values are not a common requirement.
However, ngcgui is useful as a testing tool for
subroutines which do return global named
parameters and it is common for ngcgui-compatible
subfiles to call utility subroutine files that
return results with global named parameters.

To support these usages, ngcgui ignores global
named parameters that include a colon (:)
character in their name.  Use of the colon (:) in
the name prevents ngcgui from making entryboxes
for these parameters.

Ref: linuxcnc.org/docs/2.7/html/gui/ngcgui.html

The source file text gives some more background:
# The linuxcnc gcode language does not provide a
# mechanism for returning results so subroutines
# must set global parameters for results.  Within
# ngcgui, _globals with names that contain a colon
# (:) character are ignored in the creation of
# entry boxes.  For example, a subroutine called
# from a Subfile named o<line> returns results in
# globals like: #<_line:theta>, $<_line:length>,
# etc.  This feature can be used to hide globals
# from entry boxes for any purpose or for
# communication between routines

Ref: github.com/LinuxCNC/linuxcnc/blob/2.7/tcl/ngcgui.tcl#L89
The following user(s) said Thank You: GaryLa

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

Time to create page: 0.077 seconds
Powered by Kunena Forum