Class HeidenhainSubProgramCallSyntax
- Namespace
- Hi.NcParsers.EvaluationSyntaxs.Heidenhain
- Assembly
- HiMech.dll
Consumes the Parsing.CALL record captured by
HeidenhainCallSyntax and executes the three klartext
call mechanisms over the shared M98 inline machinery:
CALL LBL n/CALL LBL "name"(subprogram): the host file is re-segmented through the runner's own segmenter (SegmenterDependency), scanned for the matchingLBLdefinition with LabelScanUtil and the LabelProbeSyntaxes, truncated at the first followingLBL 0(inclusive — its consumption pops the frame), and prepended intolayers[0]with a pushed CallStack frame. A subprogram withoutLBL 0is a structured safe-skip (inlining to EOF would double-execute the file tail).CALL LBL n REP m(program-section repeat — TNC semantics: the section fromLBL nup to, not including, the call line runs m extra times): m fresh re-segmentation passes of that slice are prepended. A loop, not a call — no new CallStack frame is pushed, but the host block's stack propagates onto the repeated pieces so nested calls inside the section still accumulate depth against the rail; the repeat count itself is a literal bound. AnyLBL 0passed inside the section is a no-op for the return syntax (null-safe pop).CALL PGM name: resolved through InternalFolder with the FilePatterns chain ({0}.h→{0}.H→{0}) and inlined whole — the SiemensSubProgramCallSyntax mechanism verbatim, including resolve-miss safe-skip (HeidenhainCall--Skipped). The callee'sEND PGMpops the frame via HeidenhainSubProgramReturnSyntax; a unit switch inside the callee is not restored on return (recorded limitation).
Recursion rail: like the Siemens call path, a self-recursive
CALL LBL/CALL PGM would splice forever; a call whose
host block already carries MaxCallDepth
CallStack frames is consumed as a safe-skip with
HeidenhainCall--DepthLimitExceeded. No MacroFrame
is stamped — klartext subprograms share the caller's Q scope.
Evaluation bundle
(the Fanuc discipline — call/inline ahead of all variable machinery).
public class HeidenhainSubProgramCallSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
HeidenhainSubProgramCallSyntax
- Implements
- Inherited Members
- Extension Methods
Constructors
HeidenhainSubProgramCallSyntax()
Parameterless instance with default settings.
public HeidenhainSubProgramCallSyntax()
HeidenhainSubProgramCallSyntax(XElement, string, IProgress<IMessage>)
Loads FilePatterns, MaxCallDepth and LabelProbeSyntaxes from XML produced by MakeXmlSource(string, string, bool); absent elements fall back to defaults.
public HeidenhainSubProgramCallSyntax(XElement src, string baseDirectory, IProgress<IMessage> progress)
Parameters
srcXElementRoot element named XName.
baseDirectorystringProject base directory propagated to child XFactory calls.
progressIProgress<IMessage>Diagnostic sink propagated to child factories.
Fields
DefaultMaxCallDepth
Default for MaxCallDepth — the Siemens call-path value; the TNC itself nests far lower (8 levels).
public const int DefaultMaxCallDepth = 32
Field Value
FrameKindKey
Key of the frame-kind marker on a CallFrame entry.
public const string FrameKindKey = "Kind"
Field Value
MaxRepetitions
TNC's own repeat-count ceiling. A larger literal is a corrupt or hostile file; without the cap the O(rep × file size) re-scan loop is a single-input denial of service.
public const int MaxRepetitions = 65534
Field Value
Properties
FilePatterns
Filename-resolution fallback chain for CALL PGM, formatted
with the callee name as the only positional arg. Case-insensitive
match is delegated to the host filesystem (the .h/.H
pair matters on Linux).
public List<string> FilePatterns { get; set; }
Property Value
LabelProbeSyntaxes
Ordered probe syntaxes run on each candidate block during label
scans, before the name predicate fires. Defaults match the
Heidenhain Parsing bundle head (; tail comments, bare
klartext block numbers, the LBL statement parser).
Swappable via XML — the
LabelProbeSyntaxes pattern.
public List<ISituNcSyntax> LabelProbeSyntaxes { get; set; }
Property Value
MaxCallDepth
Recursion rail for the call path (no iteration watchdog covers it); see the class remarks.
public int MaxCallDepth { get; set; }
Property Value
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
XName
XML element name used to register this syntax with XFactory.
public static string XName { get; }
Property Value
Methods
Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)
Build syntax arrangement into the
syntaxPieceNode in-place.
public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)
Parameters
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory