Skip to content

Commit

Permalink
ambr netConnect netConnectPorts
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jul 29, 2023
1 parent 11b2835 commit 1b97df4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[maybe] quit using `ActiveEdge`

use new syntax

`Node` with optionally named port
Expand All @@ -12,6 +10,8 @@ use new syntax

change the `render` command to simple `run` command

[maybe] quit using `ActiveEdge`

# the paper

phase space and monoid -- understand the model theory of linear logic
Expand Down
4 changes: 2 additions & 2 deletions src/lang/definitions/NodeDefinition.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Definition } from "../definition"
import { Net, Node, createNode } from "../graph"
import { netConnect } from "../graph/netConnect"
import { netConnectPorts } from "../graph/netConnectPorts"
import { Mod } from "../mod"
import { Type } from "../type"

Expand Down Expand Up @@ -31,7 +31,7 @@ export class NodeDefinition implements Definition {
throw new Error(`I expect a port on top of the stack`)
}

netConnect(net, top, port)
netConnectPorts(net, top, port)
}

net.portStack.push(...node.output)
Expand Down
4 changes: 2 additions & 2 deletions src/lang/graph/interact.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { InternalError } from "../errors"
import { ActiveEdge, Net, Node, Port } from "../graph"
import { Mod } from "../mod"
import { netConnect } from "./netConnect"
import { netConnectPorts } from "./netConnectPorts"
import { netRemoveEdge } from "./netRemoveEdge"
import { netRemoveNode } from "./netRemoveNode"

Expand Down Expand Up @@ -86,6 +86,6 @@ function reconnectOutput(net: Net, output: Array<Port>): void {
while (net.portStack.length > 0) {
const start = net.portStack.pop() as Port
const end = output.pop() as Port
netConnect(net, start, end)
netConnectPorts(net, start, end)
}
}
4 changes: 2 additions & 2 deletions src/lang/graph/netCleanUpWires.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Net } from "./Net"
import { netConnect } from "./netConnect"
import { netConnectPorts } from "./netConnectPorts"
import { netRemoveEdge } from "./netRemoveEdge"
import { netRemoveNode } from "./netRemoveNode"

Expand All @@ -12,7 +12,7 @@ export function netCleanUpWires(net: Net): void {
netRemoveNode(net, wire.start.node)
netRemoveNode(net, wire.end.node)

netConnect(net, wire.start.connection.port, wire.end.connection.port)
netConnectPorts(net, wire.start.connection.port, wire.end.connection.port)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Net, Port, createEdge } from "../graph"
import { Net, Port, createEdge } from "."
import { lookupRuleByPorts } from "../mod/lookupRuleByPorts"
import { createActiveEdge } from "./createActiveEdge"

export function netConnect(net: Net, start: Port, end: Port): void {
export function netConnectPorts(net: Net, start: Port, end: Port): void {
const rule = lookupRuleByPorts(net.mod, start, end)

if (rule) {
Expand Down
4 changes: 2 additions & 2 deletions src/lang/mod/defineBuiltInOperators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Port, createNode } from "../graph"
import { netConnect } from "../graph/netConnect"
import { netConnectPorts } from "../graph/netConnectPorts"
import { Mod } from "../mod"
import { createTrivialTypes } from "../type"
import { defineOperator } from "./defineOperator"
Expand All @@ -21,7 +21,7 @@ export function defineBuiltInOperators(mod: Mod): void {
defineOperator(mod, "connect", (net) => {
const start = net.portStack.pop() as Port
const end = net.portStack.pop() as Port
netConnect(net, start, end)
netConnectPorts(net, start, end)
})

defineOperator(mod, "wire", (net) => {
Expand Down

0 comments on commit 1b97df4

Please sign in to comment.