Table of Contents

Class FanucMacroCallSyntax

Namespace
Hi.NcParsers.EvaluationSyntaxs.Fanuc
Assembly
HiMech.dll

Inlines a Fanuc Custom Macro B one-shot call (G65 P_ L_ [letter value …]) into the source layer and binds the call-line argument letters to Vars.Local #1-#26 per the Type-I map (see FanucMacroArgumentMap). Every inlined block carries the binding dict, a clone of the FanucMacroCall diagnostic record, and a MacroFrame id stamp — so LocalVariableLookup resolves arg references in a single-block lookup, a cache dump landing on any block immediately shows which call it belongs to, and downstream FanucLocalVariableReadingSyntax carries body-internal #1-#33 writes forward only within the same frame. The host block itself records FanucMacroCall but stays in the caller's frame (no MacroFrame stamp) and emits no motion act; after the macro body's last inlined block the pipeline continues naturally into the caller's next block (the inlined pieces sit ahead of the host block's successor in layers[0]).

Frame isolation works on two layers. Statically, caller blocks have no MacroFrame stamp (frame id 0 by Get(JsonObject)), so the inlined frame ids (allocated fresh per L-repetition) never collide with main. Dynamically, LocalVariableLookup and FanucLocalVariableReadingSyntax compare frame ids before carrying any Vars.Local entry across a block boundary — a macro body's body-internal writes therefore stay inside the macro and never leak back into the caller's frame.

Filename lookup mirrors SubProgramCallSyntax: O{P:D4}.NC, O{P}.NC, O{P:D4}, O{P}, {P:D4}.NC, {P}.NC — first match wins. The lookup root is InternalFolder (G65 has no "external storage" variant; M198's external root is M98/M198-only).

L > 1 inlines the same macro L times in series. Each repetition is a fresh segmentation pass (so each block gets its own SyntaxPiece JSON object — the downstream pipeline mutates JSON in place and would clobber sibling repetitions if instances were shared) and gets a fresh FileIndex (so (FileIndex, LineIndex) pairs stay unique across the L-copies of the same source lines).

Pipeline placement: ahead of SubProgramCallSyntax inside the Fanuc Evaluation BundleSyntax so a hypothetical G65 P_ + M98 P_ on the same block expands the G65 macro first (would be an unusual but legal composition). Detection is on the Parsing.G65 sub-object written by G65Syntax (a ParameterizedFlagSyntax) — the keyword "G65" never reaches Parsing.Flags because the parameterized match has already consumed the text by the time NumberedFlagSyntax runs.

public class FanucMacroCallSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
FanucMacroCallSyntax
Implements
Inherited Members
Extension Methods

Constructors

FanucMacroCallSyntax()

Parameterless instance for bundle composition (no XML state).

public FanucMacroCallSyntax()

FanucMacroCallSyntax(XElement)

XML ctor (no child elements; reserved for forward compatibility).

public FanucMacroCallSyntax(XElement src)

Parameters

src XElement

Root element named XName.

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

XName

XML element name used to register this syntax with XFactory.

public static string XName { get; }

Property Value

string

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

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>
ncDiagnosticProgress NcDiagnosticProgress

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

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if 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

factory XFactory