File: test.tcl

package info (click to toggle)
nbdkit 1.46.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,504 kB
  • sloc: ansic: 63,658; sh: 18,717; makefile: 6,814; python: 1,848; cpp: 1,143; perl: 504; ml: 504; tcl: 62
file content (28 lines) | stat: -rw-r--r-- 615 bytes parent folder | download | duplicates (5)
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
# XXX This actually creates a Unicode (UCS-2) array.  It's also rather
# slow to run.  It's possible we should be using a list instead.
set disk [string repeat "\u0000" [expr 1024*1024]]

proc plugin_open {readonly} {
    return 1
}

proc get_size {h} {
    global disk

    return [string length $disk]
}

proc pread {h count offset} {
    global disk

    set last [expr $offset+$count-1]
    return [string range $disk $offset $last]
}

proc pwrite {h buf offset} {
    global disk

    set count [string length $buf]
    set last [expr $offset+$count-1]
    set disk [string replace $disk $offset $last $buf]
}