Class MacroInlineUtil
- Namespace
- Hi.NcParsers.EvaluationSyntaxs
- Assembly
- HiMech.dll
Shared inline mechanism for Fanuc Custom Macro B body expansion —
used by both FanucMacroCallSyntax (one-shot) and
FanucModalMacroSyntax's expansion phase (modal trigger). Both
callers do the same three things on every produced
SyntaxPiece: stamp a FanucMacroCall
clone, stamp a fresh MacroFrame id, and stamp
argument bindings into Vars.Local. Centralising lets the two
call sites stay in lock-step — frame allocation, file-index
allocation, and the inline-piece JSON shape are guaranteed
identical.
Frame ids share the same FileIndexCounterDependency counter as file indices — both just need within-session uniqueness and the counter is rewound on session start in lock-step with the pipeline. The main NC file is allocated index 0 first, so all inline frame ids land at > 0 and never collide with main.
public static class MacroInlineUtil
- Inheritance
-
MacroInlineUtil
- Inherited Members
Methods
ApplyLocalBindings(JsonObject, IReadOnlyDictionary<string, double>)
Writes the resolved #N → value bindings into
Vars.Local on the given block. No-op when
bindings is empty. Always overwrites any
pre-existing Vars.Local on the block — for inlined macro
bodies this is a fresh stamp.
public static void ApplyLocalBindings(JsonObject json, IReadOnlyDictionary<string, double> bindings)
Parameters
jsonJsonObjectbindingsIReadOnlyDictionary<string, double>
BuildInlinedPieces(ResolvedFile, int, IReadOnlyDictionary<string, double>, JsonObject, JsonObject, FileIndexCounterDependency, ISegmenter, List<INcDependency>, int, NcDiagnosticProgress)
Yields L repetitions of the macro body as inline-ready
SyntaxPiece entries. Each repetition gets its own
freshly-allocated FileIndex and MacroFrame
id; every yielded piece is stamped with a deep clone of
callRecord, the frame id, and the resolved
#N → value bindings. The caller passes
the result to PrependSource(IEnumerable<T>) on
the source layer.
public static IEnumerable<SyntaxPiece> BuildInlinedPieces(MacroFileResolver.ResolvedFile resolvedFile, int l, IReadOnlyDictionary<string, double> bindings, JsonObject callRecord, JsonObject pushedCallStack, FileIndexCounterDependency counterDep, ISegmenter segmenter, List<INcDependency> ncDependencyList, int sentenceIndexBegin, NcDiagnosticProgress ncDiagnosticProgress)
Parameters
resolvedFileMacroFileResolver.ResolvedFilelintbindingsIReadOnlyDictionary<string, double>callRecordJsonObjectpushedCallStackJsonObjectcounterDepFileIndexCounterDependencysegmenterISegmenterncDependencyListList<INcDependency>sentenceIndexBeginintncDiagnosticProgressNcDiagnosticProgress
Returns
BuildLocalBindings(JsonObject)
Translates the argument-letter map captured by the host call
({ “A”: 1.5, “B”: 2.0, ... }) into the #N → value
bindings the macro body's expression evaluator will read off
Vars.Local. Skips non-numeric (string) args silently —
those are unresolved variable references that the evaluator's
own VariableExpression–Unevaluated diagnostic will
surface; writing a string into Vars.Local would just
propagate the residue.
public static Dictionary<string, double> BuildLocalBindings(JsonObject args)
Parameters
argsJsonObject