halcompile: support HALCOMPILE_MAX_NAMES

as an environmental variable.

Users request increased quantity of names= items when
using many components with twopass processing.

Example usage:
  $ HALCOMPILE_MAX_NAMES=20 halcompile ...

Note: current default names= limit is set in halcompile.g as
      MAX_NAMES_DEFAULT = 16
This commit is contained in:
Dewey Garrett 2019-01-31 18:42:56 -07:00
parent 645d249a11
commit dab2a76f8c
3 changed files with 42 additions and 5 deletions

View file

@ -41,6 +41,14 @@ halcompile \- Build, compile and install LinuxCNC HAL components
\fIsudo\fR \fBhalcompile\fR \fB\-\-install\fR \fB\-\-userspace\fR cfile... \fIsudo\fR \fBhalcompile\fR \fB\-\-install\fR \fB\-\-userspace\fR cfile...
.PP .PP
\fIsudo\fR \fBhalcompile\fR \fB\-\-install\fR \fB\-\-userspace\fR pyfile... \fIsudo\fR \fBhalcompile\fR \fB\-\-install\fR \fB\-\-userspace\fR pyfile...
.PP
By default, the maximum number of names= items is 16.
To alter this limit, set the environmental variable \fBHALCOMPILE_MAX_NAMES\fR.
Example:
[sudo] \fBHALCOMPILE_MAX_NAMES\fR=20 \fBhalcompile\fR ...
.PD .PD
.SH DESCRIPTION .SH DESCRIPTION
\fBhalcompile\fR performs many different functions: \fBhalcompile\fR performs many different functions:

View file

@ -93,6 +93,14 @@ many numbered instances are created. If 'count' is not specified, the
If neither 'count' nor 'names' is specified, a single numbered instance If neither 'count' nor 'names' is specified, a single numbered instance
is created. is created.
[NOTE}
By default, the maximum number of 'names' items is 16. To alter this
limit, set the environmental variable HALCOMPILE_MAX_NAMES to a positive
integer value.
Example:
[sudo] HALCOMPILE_MAX_NAMES=20 halcompile ...
== Implicit Parameters == Implicit Parameters
Functions are implicitly passed the 'period' parameter which is the time in Functions are implicitly passed the 'period' parameter which is the time in
@ -492,9 +500,15 @@ in a single step, placing 'rtexample.ko' in the LinuxCNC realtime
module directory: module directory:
---- ----
halcompile --install rtexample.comp [sudo] halcompile --install rtexample.comp
---- ----
[NOTE]
sudo (for root permission) is needed when using LinuxCNC from
a deb package install. When using a Run-In-Place (RIP) build,
root privileges should not be needed.
Or, it can process and compile in one step, leaving 'example.ko' (or Or, it can process and compile in one step, leaving 'example.ko' (or
'example.so' for the simulator) in the current directory: 'example.so' for the simulator) in the current directory:
@ -512,7 +526,7 @@ halcompile rtexample.comp
the '--install' and '--compile' options shown above: the '--install' and '--compile' options shown above:
---- ----
halcompile --install rtexample2.c [sudo] halcompile --install rtexample2.c
---- ----
man-format documentation can also be created from the information in man-format documentation can also be created from the information in
@ -537,7 +551,7 @@ or copied to a standard location for manual pages.
---- ----
halcompile usrexample.comp halcompile usrexample.comp
halcompile --compile usrexample.comp halcompile --compile usrexample.comp
halcompile --install usrexample.comp [sudo] halcompile --install usrexample.comp
halcompile --document usrexample.comp halcompile --document usrexample.comp
---- ----

View file

@ -21,7 +21,17 @@ import os, sys, tempfile, shutil, getopt, time
BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")) BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
sys.path.insert(0, os.path.join(BASE, "lib", "python")) sys.path.insert(0, os.path.join(BASE, "lib", "python"))
MAX_NAMES = 16 MAX_NAMES_DEFAULT = 16
try:
MAX_NAMES = int(os.environ['HALCOMPILE_MAX_NAMES'])
print("halcompile: HALCOMPILE_MAX_NAMES=",MAX_NAMES)
except ValueError, detail:
print("halcompile: HALCOMPILE_MAX_NAMES\n ",detail)
MAX_NAMES = MAX_NAMES_DEFAULT
print(" Using MAX_NAMES=",MAX_NAMES)
except KeyError, detail:
MAX_NAMES = MAX_NAMES_DEFAULT
MAX_PERSONALITIES = MAX_NAMES MAX_PERSONALITIES = MAX_NAMES
%% %%
@ -1028,7 +1038,12 @@ Usage:
[sudo] %(name)s --install --userspace cfile... [sudo] %(name)s --install --userspace cfile...
[sudo] %(name)s --install --userspace pyfile... [sudo] %(name)s --install --userspace pyfile...
%(name)s --print-modinc %(name)s --print-modinc
""" % {'name': os.path.basename(sys.argv[0])})
By default, the maximum number of names= items is %(dflt)d.
To alter this limit, set the environmental variable HALCOMPILE_MAX_NAMES.
Example:
[sudo] HALCOMPILE_MAX_NAMES=20 %(name)s ...
""" % {'name': os.path.basename(sys.argv[0]),'dflt': MAX_NAMES_DEFAULT})
raise SystemExit(exitval) raise SystemExit(exitval)
def main(): def main():