339 lines
16 KiB
HTML
339 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Class MacroInlineUtil | HiAPI-C# 2025 </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Class MacroInlineUtil | HiAPI-C# 2025 ">
|
|
|
|
<meta name="description" content="Shared inline mechanism for Fanuc Custom Macro B body expansion — used by both (one-shot) and 's expansion phase (modal trigger). Both callers do the same three things on every produced : stamp a clone, stamp a fresh 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 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 &gt; 0 and never collide with main.">
|
|
<link rel="icon" href="../img/HiAPI.favicon.ico">
|
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
|
<link rel="stylesheet" href="../public/main.css">
|
|
<meta name="docfx:navrel" content="../toc.html">
|
|
<meta name="docfx:tocrel" content="toc.html">
|
|
|
|
<meta name="docfx:rel" content="../">
|
|
|
|
|
|
|
|
<meta name="loc:inThisArticle" content="In this article">
|
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<meta name="loc:tocFilter" content="Filter by title">
|
|
<meta name="loc:nextArticle" content="Next">
|
|
<meta name="loc:prevArticle" content="Previous">
|
|
<meta name="loc:themeLight" content="Light">
|
|
<meta name="loc:themeDark" content="Dark">
|
|
<meta name="loc:themeAuto" content="Auto">
|
|
<meta name="loc:changeTheme" content="Change theme">
|
|
<meta name="loc:copy" content="Copy">
|
|
<meta name="loc:downloadPdf" content="Download PDF">
|
|
|
|
<script type="module" src="./../public/docfx.min.js"></script>
|
|
|
|
<script>
|
|
const theme = localStorage.getItem('theme') || 'auto'
|
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
|
<header class="bg-body border-bottom">
|
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
|
<div class="container-xxl flex-nowrap">
|
|
<a class="navbar-brand" href="../index.html">
|
|
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
|
|
|
|
</a>
|
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
|
<i class="bi bi-three-dots"></i>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navpanel">
|
|
<div id="navbar">
|
|
<form class="search" role="search" id="search">
|
|
<i class="bi bi-search"></i>
|
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container-xxl">
|
|
<div class="toc-offcanvas">
|
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<nav class="toc" id="toc"></nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<div class="actionbar">
|
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
|
|
<nav id="breadcrumb"></nav>
|
|
</div>
|
|
|
|
<article data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil">
|
|
|
|
|
|
|
|
<h1 id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil" class="text-break">
|
|
Class MacroInlineUtil
|
|
</h1>
|
|
|
|
<div class="facts text-secondary">
|
|
<dl><dt>Namespace</dt><dd><a class="xref" href="Hi.html">Hi</a>.<a class="xref" href="Hi.NcParsers.html">NcParsers</a>.<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.html">EvaluationSyntaxs</a></dd></dl>
|
|
<dl><dt>Assembly</dt><dd>HiMech.dll</dd></dl>
|
|
</div>
|
|
|
|
<div class="markdown summary"><p>Shared inline mechanism for Fanuc Custom Macro B body expansion —
|
|
used by both <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucMacroCallSyntax.html">FanucMacroCallSyntax</a> (one-shot) and
|
|
<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.Fanuc.FanucModalMacroSyntax.html">FanucModalMacroSyntax</a>'s expansion phase (modal trigger). Both
|
|
callers do the same three things on every produced
|
|
<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a>: stamp a <a class="xref" href="Hi.NcParsers.Keywords.FanucMacroCall.html">FanucMacroCall</a>
|
|
clone, stamp a fresh <a class="xref" href="Hi.NcParsers.Keywords.MacroFrame.html">MacroFrame</a> id, and stamp
|
|
argument bindings into <code>Vars.Local</code>. Centralising lets the two
|
|
call sites stay in lock-step — frame allocation, file-index
|
|
allocation, and the inline-piece JSON shape are guaranteed
|
|
identical.</p>
|
|
<p>
|
|
Frame ids share the same <a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.FileIndexCounterDependency.html">FileIndexCounterDependency</a>
|
|
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.
|
|
</p>
|
|
</div>
|
|
<div class="markdown conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static class MacroInlineUtil</code></pre>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<dl class="typelist inheritance">
|
|
<dt>Inheritance</dt>
|
|
<dd>
|
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
|
<div><span class="xref">MacroInlineUtil</span></div>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<dl class="typelist inheritedMembers">
|
|
<dt>Inherited Members</dt>
|
|
<dd>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 class="section" id="methods">Methods
|
|
</h2>
|
|
|
|
|
|
<a id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil_ApplyLocalBindings_" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.ApplyLocalBindings*"></a>
|
|
|
|
<h3 id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil_ApplyLocalBindings_System_Text_Json_Nodes_JsonObject_System_Collections_Generic_IReadOnlyDictionary_System_String_System_Double__" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.ApplyLocalBindings(System.Text.Json.Nodes.JsonObject,System.Collections.Generic.IReadOnlyDictionary{System.String,System.Double})">
|
|
ApplyLocalBindings(JsonObject, IReadOnlyDictionary<string, double>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Writes the resolved <code>#N → value</code> bindings into
|
|
<code>Vars.Local</code> on the given block. No-op when
|
|
<code class="paramref">bindings</code> is empty. Always overwrites any
|
|
pre-existing <code>Vars.Local</code> on the block — for inlined macro
|
|
bodies this is a fresh stamp.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static void ApplyLocalBindings(JsonObject json, IReadOnlyDictionary<string, double> bindings)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>json</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">JsonObject</a></dt>
|
|
<dd></dd>
|
|
<dt><code>bindings</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary-2">IReadOnlyDictionary</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil_BuildInlinedPieces_" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.BuildInlinedPieces*"></a>
|
|
|
|
<h3 id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil_BuildInlinedPieces_Hi_NcParsers_EvaluationSyntaxs_MacroFileResolver_ResolvedFile_System_Int32_System_Collections_Generic_IReadOnlyDictionary_System_String_System_Double__System_Text_Json_Nodes_JsonObject_System_Text_Json_Nodes_JsonObject_Hi_NcParsers_Dependencys_SystemWired_FileIndexCounterDependency_Hi_NcParsers_Segmenters_ISegmenter_System_Int32_Hi_NcParsers_NcDiagnosticProgress_" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.BuildInlinedPieces(Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile,System.Int32,System.Collections.Generic.IReadOnlyDictionary{System.String,System.Double},System.Text.Json.Nodes.JsonObject,System.Text.Json.Nodes.JsonObject,Hi.NcParsers.Dependencys.SystemWired.FileIndexCounterDependency,Hi.NcParsers.Segmenters.ISegmenter,System.Int32,Hi.NcParsers.NcDiagnosticProgress)">
|
|
BuildInlinedPieces(ResolvedFile, int, IReadOnlyDictionary<string, double>, JsonObject, JsonObject, FileIndexCounterDependency, ISegmenter, int, NcDiagnosticProgress)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Yields <code>L</code> repetitions of the macro body as inline-ready
|
|
<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a> entries. Each repetition gets its own
|
|
freshly-allocated <code>FileIndex</code> and <a class="xref" href="Hi.NcParsers.Keywords.MacroFrame.html">MacroFrame</a>
|
|
id; every yielded piece is stamped with a deep clone of
|
|
<code class="paramref">callRecord</code>, the frame id, and the resolved
|
|
<code>#N → value</code> <code class="paramref">bindings</code>. The caller passes
|
|
the result to LazyLinkedList<T>.PrependSource on
|
|
the source layer.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IEnumerable<SyntaxPiece> BuildInlinedPieces(MacroFileResolver.ResolvedFile resolvedFile, int l, IReadOnlyDictionary<string, double> bindings, JsonObject callRecord, JsonObject pushedCallStack, FileIndexCounterDependency counterDep, ISegmenter segmenter, int sentenceIndexBegin, NcDiagnosticProgress ncDiagnosticProgress)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>resolvedFile</code> <a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.html">MacroFileResolver</a>.<a class="xref" href="Hi.NcParsers.EvaluationSyntaxs.MacroFileResolver.ResolvedFile.html">ResolvedFile</a></dt>
|
|
<dd></dd>
|
|
<dt><code>l</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd></dd>
|
|
<dt><code>bindings</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary-2">IReadOnlyDictionary</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>></dt>
|
|
<dd></dd>
|
|
<dt><code>callRecord</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">JsonObject</a></dt>
|
|
<dd></dd>
|
|
<dt><code>pushedCallStack</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">JsonObject</a></dt>
|
|
<dd></dd>
|
|
<dt><code>counterDep</code> <a class="xref" href="Hi.NcParsers.Dependencys.SystemWired.FileIndexCounterDependency.html">FileIndexCounterDependency</a></dt>
|
|
<dd></dd>
|
|
<dt><code>segmenter</code> <a class="xref" href="Hi.NcParsers.Segmenters.ISegmenter.html">ISegmenter</a></dt>
|
|
<dd></dd>
|
|
<dt><code>sentenceIndexBegin</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd></dd>
|
|
<dt><code>ncDiagnosticProgress</code> <a class="xref" href="Hi.NcParsers.NcDiagnosticProgress.html">NcDiagnosticProgress</a></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a>></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil_BuildLocalBindings_" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.BuildLocalBindings*"></a>
|
|
|
|
<h3 id="Hi_NcParsers_EvaluationSyntaxs_MacroInlineUtil_BuildLocalBindings_System_Text_Json_Nodes_JsonObject_" data-uid="Hi.NcParsers.EvaluationSyntaxs.MacroInlineUtil.BuildLocalBindings(System.Text.Json.Nodes.JsonObject)">
|
|
BuildLocalBindings(JsonObject)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Translates the argument-letter map captured by the host call
|
|
(<code>{ “A”: 1.5, “B”: 2.0, ... }</code>) into the <code>#N → value</code>
|
|
bindings the macro body's expression evaluator will read off
|
|
<code>Vars.Local</code>. Skips non-numeric (string) args silently —
|
|
those are unresolved variable references that the evaluator's
|
|
own <code>VariableExpression–Unevaluated</code> diagnostic will
|
|
surface; writing a string into <code>Vars.Local</code> would just
|
|
propagate the residue.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static Dictionary<string, double> BuildLocalBindings(JsonObject args)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>args</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">JsonObject</a></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2">Dictionary</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
<div class="contribution d-print-none">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="affix">
|
|
<nav id="affix"></nav>
|
|
</div>
|
|
</main>
|
|
|
|
<div class="container-xxl search-results" id="search-results"></div>
|
|
|
|
<footer class="border-top text-secondary">
|
|
<div class="container-xxl">
|
|
<div class="flex-fill">
|
|
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|