Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ doubled, as `getfullname` writes it. The three rules are exported for a host tha
indexes parse results itself — `blockKey(name, sid)`, `blockLabel(name, sid)` and
`joinBlockPath(parentPath, label)`.

Not every block parameter is reported: only those that *can* name data. A value that
is a number, a non-finite, `on`/`off` or has no identifier in it at all is not a
reference, and neither is a parameter whose value space is a fixed option list — a Math
block's `Operator = square` reads like a variable and is one of fifteen menu choices
Simulink enforces. That table is keyed on the `(BlockType, parameter)` pair and measured
from MATLAB rather than hand-written, because the same name can be a menu on one block
and an expression on another; the few free-text parameters that measurably never name
data (a Bus Selector's `OutputSignals`, a Model block's file name) are excluded the same
way. A block type the tables do not know is judged on its value alone, so a toolbox
block is never silently reduced to fewer rows than it has.

A reported parameter can still resolve to nothing — `linkTarget: ''` with nulls
throughout — and that is an answer, not an absence: the name may be defined in a file the
caller did not hand over, or in the MATLAB base workspace, which is a live session and not
a file. Render the value, without a link.

A `srcId` is the caller's own key for a file and is never parsed; the `filename`
is what decides the kind. Resolution follows MATLAB: the mask workspaces the block
sits inside shadow the model workspace, which shadows a linked dictionary, which
Expand Down
2 changes: 1 addition & 1 deletion dist/datamodel/parser/MdlParser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/datamodel/parser/MdlParser.js.map

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions dist/datamodel/parser/SlxParser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,19 @@ export declare function normalizeBlockName(name: string): string;
*/
export declare function valueReferencesData(value: string): boolean;
/**
* Does `propName = value` on a block count as a reference to named data?
* Does `propName = value` on a block of type `blockType` count as a reference to named data?
*
* The one gate both model formats go through, so a `.mdl` and the `.slx` of the
* SAME diagram surface the same rows. Exported for MdlParser, which reads the
* classic nested-brace flavour and has no `<P>` elements to work from.
*
* `blockType` narrows the two pair-keyed tables and nothing else, so a block type neither
* table knows — every toolbox block, and every masked library link, which a file records
* as `Reference` — is judged exactly as before. That is the safe direction: an unlisted
* pair is admitted, and admitting a spare row costs less than hiding a real reference
* (issue #9). An EMPTY blockType, which a hand-made file can have, matches no table.
*/
export declare function isParamReference(propName: string, value: string): boolean;
export declare function isParamReference(blockType: string, propName: string, value: string): boolean;
/**
* Does a mask parameter of this TYPE hold an expression? Exported for MdlParser, which
* reads the same fact out of a classic `.mdl`'s `MaskStyleString` and must reach the same
Expand Down
2 changes: 1 addition & 1 deletion dist/datamodel/parser/SlxParser.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 68 additions & 3 deletions dist/datamodel/parser/SlxParser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/datamodel/parser/SlxParser.js.map

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions dist/datamodel/parser/enumBlockParams.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Parameters whose dialog restricts the value to a fixed option list, per BlockType.
*
* A value drawn from an option list never names data, however much it may LOOK like a
* variable: a Math block's `Operator` reads `square`, and crediting that would put the
* block on the Usage cell of any variable spelled the same way. Simulink itself enforces
* the option list, so no loadable model can hold a reference here.
*
* Keyed on the (BlockType, parameter) PAIR rather than the bare name, because the same
* name can be an option list on one block and an expression on another — `Format`,
* `SimulateUsing`, `TriggerType`, `OutDataTypeStr` and `IntermediateResultsDataTypeStr`
* are each measured both ways. A name-keyed table would suppress the expression too.
*/
export declare const ENUM_BLOCK_PARAMS: Readonly<Record<string, readonly string[]>>;
//# sourceMappingURL=enumBlockParams.d.ts.map
1 change: 1 addition & 0 deletions dist/datamodel/parser/enumBlockParams.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading