Header menu logo issie

SymbolUpdate Module

Types

Type Description

Rectangle

Functions and values

Function or value Description

ChangeGate (compId, gateType, numInputs) model

Full Usage: ChangeGate (compId, gateType, numInputs) model

Parameters:
Returns: Model
compId : ComponentId
gateType : GateComponentType
numInputs : int
model : Model
Returns: Model

ChangeMergeN (compId, numInputs) model

Full Usage: ChangeMergeN (compId, numInputs) model

Parameters:
Returns: Model
compId : ComponentId
numInputs : int
model : Model
Returns: Model

ChangeSplitN (compId, numInputs, widths, lsbs) model

Full Usage: ChangeSplitN (compId, numInputs, widths, lsbs) model

Parameters:
    compId : ComponentId
    numInputs : int
    widths : int list
    lsbs : int list
    model : Model

Returns: Model
compId : ComponentId
numInputs : int
widths : int list
lsbs : int list
model : Model
Returns: Model

addSymbol ldcs model pos compType lbl

Full Usage: addSymbol ldcs model pos compType lbl

Parameters:
Returns: Model * ComponentId

Creates and adds a symbol into model, returns the updated model and the component id

ldcs : LoadedComponent list
model : Model
pos : XYPos
compType : ComponentType
lbl : string
Returns: Model * ComponentId

changeLabel model sId newLabel

Full Usage: changeLabel model sId newLabel

Parameters:
Returns: Model
Modifiers: inline

Given a model, a symbol id and a new label changes the label of the symbol to the new label and returns the updated model.

model : Model
sId : ComponentId
newLabel : string
Returns: Model

checkSymbolIntegrity sym

Full Usage: checkSymbolIntegrity sym

Parameters:
Returns: 'a
sym : Symbol
Returns: 'a

colorSymbols model compList colour

Full Usage: colorSymbols model compList colour

Parameters:
Returns: Model
Modifiers: inline
Type parameters: 'a

Given a model, a component id list and a color, updates the color of the specified symbols and returns the updated model.

model : Model
compList : ComponentId list
colour : 'a
Returns: Model

copySymbols model compIds

Full Usage: copySymbols model compIds

Parameters:
Returns: Model

Given a model and a list of component ids copies the specified components and returns the updated model

model : Model
compIds : ComponentId list
Returns: Model

createAnnotation theme a pos

Full Usage: createAnnotation theme a pos

Parameters:
Returns: Symbol

Create a new annotation symbol and add it to the map of symbols. pos: for RotateButtons: position of annotation on screen - middle of box (NOT top-left) pos: for ScaleButton: top-right of the box annotation always has moving true because we want the symbol to be drawn last so it is always on top of other not moving symbols

theme : ThemeType
a : Annotation
pos : XYPos
Returns: Symbol

createDummyComponent pos h w

Full Usage: createDummyComponent pos h w

Parameters:
    pos : XYPos
    h : float
    w : float

Returns: Component

Create a new dummy component which can be used in an annotation. pos: for RotateButtons: position of annotation on screen - middle of box (NOT top-left) pos: for ScaleButton: top-right of the box

pos : XYPos
h : float
w : float
Returns: Component

createSymbol ldcs theme prevSymbols comp

Full Usage: createSymbol ldcs theme prevSymbols comp

Parameters:
Returns: Map<ComponentId, Symbol>

Given a map of current symbols and a component, initialises a symbol containing the component and returns the updated symbol map containing the new symbol

ldcs : LoadedComponent list
theme : ThemeType
prevSymbols : Map<ComponentId, Symbol>
comp : Component
Returns: Map<ComponentId, Symbol>

createSymbolRecord ldcs theme comp

Full Usage: createSymbolRecord ldcs theme comp

Parameters:
Returns: Symbol

Initialises a symbol containing the component and returns the updated symbol map containing the new symbol

ldcs : LoadedComponent list
theme : ThemeType
comp : Component
Returns: Symbol

deleteSymbols model compIds

Full Usage: deleteSymbols model compIds

Parameters:
Returns: Model
Modifiers: inline

Given a model and a list of component ids deletes the specified components from the model and returns the updated model

model : Model
compIds : ComponentId list
Returns: Model

errorSymbols model (errorCompList, selectCompList, isDragAndDrop)

Full Usage: errorSymbols model (errorCompList, selectCompList, isDragAndDrop)

Parameters:
Returns: Model
Modifiers: inline

Given a model, an error component list, a selected component id list, it updates the selected symbols' color to green if they are not selected, and changes the symbols with errors to red. It returns the updated model.

model : Model
errorCompList : ComponentId list
selectCompList : ComponentId list
isDragAndDrop : bool
Returns: Model

extractComponent symModel sId

Full Usage: extractComponent symModel sId

Parameters:
Returns: Component
symModel : Model
sId : ComponentId
Returns: Component

extractComponents symModel

Full Usage: extractComponents symModel

Parameters:
Returns: Component list
symModel : Model
Returns: Component list

extractIOPrefix str charLst

Full Usage: extractIOPrefix str charLst

Parameters:
    str : string
    charLst : char list

Returns: string * int
str : string
charLst : char list
Returns: string * int

generateCopiedLabel model oldSymbol compType

Full Usage: generateCopiedLabel model oldSymbol compType

Parameters:
Returns: string
model : Model
oldSymbol : Symbol
compType : ComponentType
Returns: string

generateIOLabel model compType name

Full Usage: generateIOLabel model compType name

Parameters:
Returns: string
model : Model
compType : ComponentType
name : string
Returns: string

generateLabel model compType

Full Usage: generateLabel model compType

Parameters:
Returns: string

Generates the label for a component type

model : Model
compType : ComponentType
Returns: string

generateLabelNumber listSymbols compType

Full Usage: generateLabelNumber listSymbols compType

Parameters:
Returns: string

Generates the label number for compType (i.e. the number 1 in IN1 or ADDER16.1) in a string format

listSymbols : Symbol list
compType : ComponentType
Returns: string

getCopiedSymbol model portId

Full Usage: getCopiedSymbol model portId

Parameters:
    model : Model
    portId : string

Returns: Symbol

Returns the symbol containing the given portId in the model's CopiedSymbols map

model : Model
portId : string
Returns: Symbol

getEquivalentCopiedPorts model copiedIds pastedIds (arg4, arg5)

Full Usage: getEquivalentCopiedPorts model copiedIds pastedIds (arg4, arg5)

Parameters:
Returns: (string * string) option

Given two componentId list of same length and input / output ports that are in list 1, return the equivalent ports in list 2. ComponentIds at same index in both list 1 and list 2 need to be of the same ComponentType. CompIds1 need to be in model.CopiedSymbols. Assumes ports are in the same order in equivalent symbols

model : Model
copiedIds : ComponentId list
pastedIds : ComponentId list
arg3 : InputPortId
arg4 : OutputPortId
Returns: (string * string) option

getLabelNumber str

Full Usage: getLabelNumber str

Parameters:
    str : string

Returns: int

Returns the number of the component label (i.e. the number 1 from IN1 or ADDER16.1)

str : string
Returns: int

getLayoutInfoFromSymbol symbol

Full Usage: getLayoutInfoFromSymbol symbol

Parameters:
Returns: SymbolInfo

Obtain all layout info on symbol that needs to be saved. It is saved in extra SymbolInfo type and corresp field in Component.

symbol : Symbol
Returns: SymbolInfo

getPortHostId model portId

Full Usage: getPortHostId model portId

Parameters:
    model : Model
    portId : string

Returns: string

Returns the hostId of the port in model

model : Model
portId : string
Returns: string

getPortIds input output

Full Usage: getPortIds input output

Parameters:
Returns: string list * string list

Returns a tuple of the list of input ports of a given input symbol, and list of output ports of a given output symbol

input : Symbol
output : Symbol
Returns: string list * string list

getX pos

Full Usage: getX pos

Parameters:
Returns: float
Modifiers: inline
pos : XYPos
Returns: float

getY pos

Full Usage: getY pos

Parameters:
Returns: float
Modifiers: inline
pos : XYPos
Returns: float

initCopiedPorts oldSymbol newComp

Full Usage: initCopiedPorts oldSymbol newComp

Parameters:
Returns: PortMaps

Initialises and returns the PortMaps of a pasted symbol

oldSymbol : Symbol
newComp : Component
Returns: PortMaps

loadComponents loadedComponents model comps

Full Usage: loadComponents loadedComponents model comps

Parameters:
Returns: Model

Given a model and a list of components, it creates and adds the symbols containing the specified components and returns the updated model.

loadedComponents : LoadedComponent list
model : Model
comps : Component list
Returns: Model

mergeOptions (arg1, arg2)

Full Usage: mergeOptions (arg1, arg2)

Parameters:
    arg0 : 'a option
    arg1 : 'b option

Returns: ('a * 'b) option

Given a tuple of options, returns an Some (v1, v2) if both tuple elements are some, else None

arg0 : 'a option
arg1 : 'b option
Returns: ('a * 'b) option

moveSymbols model compList offset

Full Usage: moveSymbols model compList offset

Parameters:
Returns: Model

Given a model, a component id list and an offset, moves the components by offset and returns the updated model

model : Model
compList : ComponentId list
offset : XYPos
Returns: Model

pasteSymbols model wireMap newBasePos

Full Usage: pasteSymbols model wireMap newBasePos

Parameters:
Returns: Model * ComponentId list

Interface function to paste symbols. Is a function instead of a message because we want an output. Currently drag-and-drop. Pastes a list of symbols into the model and returns the new model and the id of the pasted modules.

model : Model
wireMap : Map<ConnectionId, Wire>
newBasePos : XYPos
Returns: Model * ComponentId list

rectanglesIntersect rect1 rect2

Full Usage: rectanglesIntersect rect1 rect2

Parameters:
Returns: bool

Checks if 2 rectangles intersect

rect1 : Rectangle
rect2 : Rectangle
Returns: bool

replaceSymbol model newSymbol compId

Full Usage: replaceSymbol model newSymbol compId

Parameters:
Returns: Model
Modifiers: inline
model : Model
newSymbol : Symbol
compId : ComponentId
Returns: Model

selectSymbols model compList

Full Usage: selectSymbols model compList

Parameters:
Returns: Model
Modifiers: inline

Given a model and a component id list, it updates the specified symbols' colour to green with max opacity, and every other symbols' colour to gray

model : Model
compList : ComponentId list
Returns: Model

storeLayoutInfoInComponent arg1 symbol

Full Usage: storeLayoutInfoInComponent arg1 symbol

Parameters:
Returns: Symbol

Return a symbol with its embedded component correctly updated with symbol layout info. Should be called just before saving a component.

arg0 : 'a
symbol : Symbol
Returns: Symbol

symbolsHaveError model compList

Full Usage: symbolsHaveError model compList

Parameters:
Returns: Model
Modifiers: inline

Given a model and a component id list, sets the color of the sepcified symbols to red and every other symbol's color to gray

model : Model
compList : ComponentId list
Returns: Model

transformSymbols transform model compList

Full Usage: transformSymbols transform model compList

Parameters:
Returns: Model
Modifiers: inline
transform : Symbol -> Symbol
model : Model
compList : ComponentId list
Returns: Model

tryGetPastedEl copiedIds pastedIds target

Full Usage: tryGetPastedEl copiedIds pastedIds target

Parameters:
    copiedIds : 'a list
    pastedIds : 'b list
    target : 'a

Returns: 'b option

Tries to find the target in copiedIds, and tries to return the item at the same index in pastedIds. Returns Some if there is exactly one element in copiedIds matching the target AND if there is an element in pastedIds at that same index, None otherwise.

copiedIds : 'a list
pastedIds : 'b list
target : 'a
Returns: 'b option

update msg model

Full Usage: update msg model

Parameters:
Returns: Model * Cmd<'a>

Update function which displays symbols

msg : Msg
model : Model
Returns: Model * Cmd<'a>

updateMemory model compId updateFn

Full Usage: updateMemory model compId updateFn

Parameters:
Returns: Model
Modifiers: inline

Given a model, a component Id and a memory component type, updates the type of the component to the specified memory and returns the updated model.

model : Model
compId : ComponentId
updateFn : Memory1 -> Memory1
Returns: Model

updateSymbol updateFn compId model

Full Usage: updateSymbol updateFn compId model

Parameters:
Returns: Model
Modifiers: inline
updateFn : Symbol -> Symbol
compId : ComponentId
model : Model
Returns: Model

writeMemoryLine model (compId, addr, value)

Full Usage: writeMemoryLine model (compId, addr, value)

Parameters:
Returns: Model
Modifiers: inline

Given a model, a component id, an address and a value it updates the data in the component and returns the new model.

model : Model
compId : ComponentId
addr : bigint
value : bigint
Returns: Model

writeMemoryType model compId memory

Full Usage: writeMemoryType model compId memory

Parameters:
Returns: Model
Modifiers: inline

Given a model, a component Id and a memory component type, updates the type of the component to the specified memory type and returns the updated model.

model : Model
compId : ComponentId
memory : ComponentType
Returns: Model

Type something to start searching.