Check-in [a5f8fcd325]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added mrtest as a separately buildable package.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:a5f8fcd32546621eda4e4f75f7604ae06cc805770d7e357b8bc04dacd6184e72
User & Date: dkf 2018-04-28 08:36:22
Context
2018-04-29
17:21
Fix native code generation when building DLLs check-in: 412811a9f7 user: dkf tags: trunk
2018-04-28
08:36
Added mrtest as a separately buildable package. check-in: a5f8fcd325 user: dkf tags: trunk
2018-04-17
00:09
Finish expunging the uses of 'uniqueUndef' in constructing phis. check-in: f71cdfbdae user: kbk tags: trunk
Changes

Added demos/pkgs/mrtest.tcl.









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
namespace eval mrtest {
    namespace export calc integer plus minus times quotient fibo rfib
    proc calc {x} {
	switch -exact -- [lindex $x 0] {
	    "i" {
		set result [integer [lindex $x 1]]
	    }
	    "+" {
		set result [plus [lindex $x 1] [lindex $x 2]]
	    }
	    "-" {
		set result [minus [lindex $x 1] [lindex $x 2]]
	    }
	    "*" {
		set result [times [lindex $x 1] [lindex $x 2]]
	    }
	    "/" {
		set result [quotient [lindex $x 1] [lindex $x 2]]
	    }
	    "f" {
		set result [fibo [lindex $x 1]]
	    }
	}
	return $result
    }
    proc integer {x} {
	expr {int($x)}
    }
    proc plus {x y} {
	expr {[calc $x] + [calc $y]}
    }
    proc minus {x y} {
	expr {[calc $x] - [calc $y]}
    }
    proc times {x y} {
	expr {[calc $x] * [calc $y]}
    }
    proc quotient {x y} {
	expr {[calc $x] / [calc $y]}
    }
    proc fibo {x} {
	return [rfib [calc $x]]
    }
    proc rfib {x} {
	if {$x <= 1} {
	    return 1
	} else {
	    return [expr {[rfib [expr {$x - 1}]] + [rfib [expr {$x - 2}]]}]
	}
    }
}
package provide mrtest 0.1

Changes to demos/pkgs/pkgIndex.tcl.

1
2
3
4

package ifneeded cosdemo 0.1 [list source [file join $dir cosdemo.tcl]]
package ifneeded tricky 0.1 [list source [file join $dir trickypkg.tcl]]
package ifneeded bonus 0.1 [list source [file join $dir bonus.tcl]]
package ifneeded wordcount 0.1 [list source [file join $dir wordcount.tcl]]





>
1
2
3
4
5
package ifneeded cosdemo 0.1 [list source [file join $dir cosdemo.tcl]]
package ifneeded tricky 0.1 [list source [file join $dir trickypkg.tcl]]
package ifneeded bonus 0.1 [list source [file join $dir bonus.tcl]]
package ifneeded wordcount 0.1 [list source [file join $dir wordcount.tcl]]
package ifneeded mrtest 0.1 [list source [file join $dir mrtest.tcl]]