Header menu logo issie

CustomCompPorts Module

Types

Type Description

IODirection

Instance

One instance of the current sheet placed on another sheet: where it is, the signature it has, and the signature it OUGHT to have - the sheet inside it resolved at this instance's own parameter bindings. The two differ exactly when the instance needs updating.

Match

PortChange

PortInfo

ReportedChange

A change to the sheet's ports as the dialog reports it: a port added, deleted or renamed. Widths are deliberately left out - see the module comment - so that one row describes what happened to every instance, however many different widths those instances have.

Signature

Names and widths of ports, ordered. Input ports, Output ports. CanvasExtractor owns this type, because it is what signatureOfInstance answers with.

Functions and values

Function or value Description

changeInstance comp change

Full Usage: changeInstance comp change

Parameters:
Returns: Component

Return updated custom component with ports changed as per change If a port is deleted any corresponding connections must be deleted to keep the CanvasState consistent. That is done elsewhere, since deleting not fully connected connections is a straightforward operation on CanvasState, as done by deleteIncompleteConnections

comp : Component
change : PortChange
Returns: Component

checkCanvasStateIsOk model

Full Usage: checkCanvasStateIsOk model

Parameters:
Returns: bool
model : Model
Returns: bool

deleteIncompleteConnections (arg1, arg2)

Full Usage: deleteIncompleteConnections (arg1, arg2)

Parameters:
Returns: Component list * Connection list

Return canvasState updated with bad connections that have lost either of their connecting components deleted

arg0 : Component list
arg1 : Connection list
Returns: Component list * Connection list

getCorrectFileName project

Full Usage: getCorrectFileName project

Parameters:
Returns: string
project : Project
Returns: string

getIOMatchFromSig (inputs, outputs)

Full Usage: getIOMatchFromSig (inputs, outputs)

Parameters:
    inputs : (string * int) list
    outputs : (string * int) list

Returns: Match list
inputs : (string * int) list
outputs : (string * int) list
Returns: Match list

getInstancesOfCurrentSheet model

Full Usage: getInstancesOfCurrentSheet model

Parameters:
Returns: Instance list

Every instance of the current sheet, with the signature it has and the one it should have. An instance's bindings are expressions in the parameters of the sheet it SITS ON - and may be overridden there by a CustomCompParam slot, exactly as in elaboration - so the parent sheet is where they are evaluated. ParameterAnalysis.instanceBindingExprs is the same merge the properties pane and the simulator make.

model : Model
Returns: Instance list

getOutOfDateDependents model

Full Usage: getOutOfDateDependents model

Parameters:
Returns: Instance list

The instances of the current sheet that no longer match what their own bindings give them.

model : Model
Returns: Instance list

guessAtRenamedPorts matches

Full Usage: guessAtRenamedPorts matches

Parameters:
Returns: PortChange array
matches : PortChange seq
Returns: PortChange array

instanceIsOutOfDate inst

Full Usage: instanceIsOutOfDate inst

Parameters:
Returns: bool

Whether one instance is out of step with what its own bindings give it: it has a port the sheet does not, lacks one the sheet has, or holds one at the wrong width. The ORDER of the ports is deliberately not compared. An instance's ports are matched to the sheet's Input and Output components by LABEL - by FastCreate when a simulation is elaborated, by SynchronousUtils, and by CanvasStateAnalyser.checkCustomComponentForOkIOs, which compares sets when it decides whether a design is legal - and each port is drawn where the symbol's own saved PortOrder puts it, keyed by port id. So an instance whose ports are in a different order from the sheet's is a correct instance, and reordering it would change nothing that can be seen or simulated. Requiring the orders to match raised this dialog on four of the five shipped demos, whose instances were placed before the I/O components were moved about on their sheets, and described the difference as a width change - which is what the dialog says when nothing structural happened.

inst : Instance
Returns: bool

ioCompareSigs (arg1, arg2) (arg3, arg4)

Full Usage: ioCompareSigs (arg1, arg2) (arg3, arg4)

Parameters:
    arg0 : (string * int) list
    arg1 : (string * int) list
    arg2 : (string * int) list
    arg3 : (string * int) list

Returns: PortChange seq

compare two I/O signature lists

arg0 : (string * int) list
arg1 : (string * int) list
arg2 : (string * int) list
arg3 : (string * int) list
Returns: PortChange seq

listUpdate uPred uFunc lst

Full Usage: listUpdate uPred uFunc lst

Parameters:
    uPred : 'a -> bool
    uFunc : 'a -> 'a
    lst : 'a list

Returns: 'a list

Change the items x in lst where uPred x with x -> uFunc x. Useful to replace one item of a list

uPred : 'a -> bool
uFunc : 'a -> 'a
lst : 'a list
Returns: 'a list

markProjectSaved p

Full Usage: markProjectSaved p

Parameters:
Returns: Project

Every sheet has just been written to disk from memory, so none of them has unsaved changes. updateInstance flags each sheet it changes so that the change reaches disk; once it has, the flag has done its job. Left set it made every later "close without saving?" dialog name sheets whose files were already correct, and left the user no way to clear it: the Save button follows the OPEN sheet alone, and an instance is by construction never on that sheet.

p : Project
Returns: Project

optCurrentSheetDependentsPopup model

Full Usage: optCurrentSheetDependentsPopup model

Parameters:
Returns: ((Msg -> Unit) -> Model -> ReactElement) option

returns a popup function to show the dependents update dialog if this is needed this dialog drives all subsequent work changing custom component instances

model : Model
Returns: ((Msg -> Unit) -> Model -> ReactElement) option

reportedChanges instances

Full Usage: reportedChanges instances

Parameters:
Returns: ReportedChange list * Instance list

What the user is being asked to confirm, gathered from every out-of-date instance: the ports that came and went, and which instances change only in width. The structural changes are taken over all instances rather than from a representative one. Instances of a parameterised sheet may be at different widths, so a rename can be guessed for one and not for another; the union is what the sheet's ports actually did.

instances : Instance list
Returns: ReportedChange list * Instance list

syncLoadedComponentsToDisk newProj oldProj

Full Usage: syncLoadedComponentsToDisk newProj oldProj

Parameters:

Save any changed sheets to disk in the project directory

newProj : Project
oldProj : Project

updateDependents instances p

Full Usage: updateDependents instances p

Parameters:
Returns: Project

Bring every one of these instances to the signature its own parameter bindings give it.

instances : Instance list
p : Project
Returns: Project

updateInstance inst p

Full Usage: updateInstance inst p

Parameters:
Returns: Project

Bring one instance to the signature its own parameter bindings give it.

inst : Instance
p : Project
Returns: Project

updateProjectFiles saveToDisk update model

Full Usage: updateProjectFiles saveToDisk update model

Parameters:
Returns: Model

Return new model with project updated as per update function. If p.LoadedComponents data is changed, for each sheet that is different the sheet will be saved to disk. This function should be used consistently to keep disk and project data correct.

saveToDisk : bool
update : Project -> Project
model : Model
Returns: Model

Type something to start searching.