From 677e2fd893ab2ea2fc96c120acf8d6b6b531177d Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Sat, 19 Nov 2022 12:11:44 -0500 Subject: Archive some virtual programs that we already printed --- virtual-programs/archive/hello-name.folk | 12 ++++++++++++ virtual-programs/archive/image.folk | 32 ++++++++++++++++++++++++++++++++ virtual-programs/archive/metrics.folk | 7 +++---- 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 virtual-programs/archive/hello-name.folk create mode 100644 virtual-programs/archive/image.folk (limited to 'virtual-programs/archive') diff --git a/virtual-programs/archive/hello-name.folk b/virtual-programs/archive/hello-name.folk new file mode 100644 index 00000000..bef035e2 --- /dev/null +++ b/virtual-programs/archive/hello-name.folk @@ -0,0 +1,12 @@ +Wish $this has filename "hello-name.folk" +Wish $this is outlined blue + +When someone claims /firstName/ is /text/ { + Wish $this is outlined blue + Wish $this is labelled " + + + + +Hi $text!" +} \ No newline at end of file diff --git a/virtual-programs/archive/image.folk b/virtual-programs/archive/image.folk new file mode 100644 index 00000000..a011c09c --- /dev/null +++ b/virtual-programs/archive/image.folk @@ -0,0 +1,32 @@ +Wish $this has filename "image.folk" + +namespace eval ::image { + proc width {im} { dict get $im width } + proc height {im} { dict get $im height } + proc subimage {im x y subwidth subheight} { + dict with im { + set x [expr {int($x)}] + set y [expr {int($y)}] + set subdata [expr {$data + ($y * $width + $x) * $components}] + dict create \ + width $subwidth height $subheight \ + components $components \ + bytesPerRow $bytesPerRow \ + data [format 0x%x $subdata] + } + } + namespace export * + namespace ensemble create +} + +When the camera frame is /f/ { + When $this has region /r/ { + lassign [projectorToCamera [lindex $r 0 0]] x0 y0 + lassign [projectorToCamera [lindex $r 0 2]] x1 y1 + set thisimage [image subimage $f \ + [expr {min($x0,$x1)}] [expr {min($y0,$y1)}] \ + [expr {int(abs($x1-$x0))}] [expr {int(abs($y1-$y0))}]] + Wish display runs [list Display::image {*}[lindex $r 0 0] $thisimage] + } +} +Wish $this is outlined red diff --git a/virtual-programs/archive/metrics.folk b/virtual-programs/archive/metrics.folk index 71ad66be..cd01e289 100644 --- a/virtual-programs/archive/metrics.folk +++ b/virtual-programs/archive/metrics.folk @@ -4,11 +4,10 @@ When $::nodename has step count /c/ { Wish $this is labelled [string trim " step count: $c step time: $::stepTime -camera time: [expr {[namespace exists Camera] ? [lindex [lindex $Camera::statements 0] end] : {none}}] +camera time: [expr {[namespace exists Camera] ? [lindex $Camera::statements 0 end] : {none}}] +display time: $Display::displayTime statement count: [Statements::size] logsize: $::logsize "] - Wish $this is highlighted green -# puts "$::nodename statement count: [Statements::size]" -# puts "$::nodename statement sets-of-parents count: [Statements::countSetsOfParents]" } +Wish $this is outlined green \ No newline at end of file -- cgit v1.2.3