Skip to content

Commit

Permalink
[net] TransitionEntry -- has optional task -- with any async call…
Browse files Browse the repository at this point in the history
…back function
  • Loading branch information
xieyuheng committed Nov 17, 2023
1 parent 4733070 commit fa0271b
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 3 deletions.
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# net

[net] use vue `reactive` primitives
[net] `fireTransitionEntry` -- try to fire one transition entry

[net] `react`
[net] `run`

- when we add a data into a place,
all the neighboring transitions are checked for preparedness,
Expand Down
32 changes: 32 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"dependencies": {
"@cicada-lang/framework": "^0.1.6",
"@cicada-lang/partech": "^0.2.5",
"@vue/runtime-core": "^3.3.8",
"@xieyuheng/command-line": "^0.0.13",
"@xieyuheng/ty": "^0.1.26",
"events": "^3.3.0",
"picocolors": "^1.0.0",
"vitest": "^0.34.6"
},
Expand Down
2 changes: 2 additions & 0 deletions src/lang/net/Net.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Parameter } from "../parameter"
import { Task } from "../task"
import { Value } from "../value"

/*
Expand All @@ -24,6 +25,7 @@ export type TransitionEntry = {
outputParameters: Array<Parameter>
inputPlaceEntries: Array<PlaceEntry>
outputPlaceEntries: Array<PlaceEntry>
task?: Task
}

export type PlaceEntry = {
Expand Down
8 changes: 8 additions & 0 deletions src/lang/net/fireTransitionEntry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Net, TransitionEntry } from "./Net"

export async function fireTransitionEntry(
net: Net,
transitionEntry: TransitionEntry,
) {
//
}
1 change: 1 addition & 0 deletions src/lang/net/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./Net"
export * from "./fireTransitionEntry"
export * from "./createNet"
export * from "./addPlace"
export * from "./addTransition"
Expand Down
3 changes: 2 additions & 1 deletion src/lang/react/react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { reactive } from "@vue/runtime-core"
import { Net } from "../net"

export function react(net: Net): void {
//
reactive
}
5 changes: 5 additions & 0 deletions src/lang/task/Task.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type TaskFunction = (...args: Array<any>) => Promise<Array<any>>

export type Task = {
fn: TaskFunction
}
1 change: 1 addition & 0 deletions src/lang/task/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./Task"

0 comments on commit fa0271b

Please sign in to comment.