File: test.tcl

package info (click to toggle)
nbdkit 1.42.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,696 kB
  • sloc: ansic: 59,224; sh: 16,793; makefile: 6,463; python: 1,837; cpp: 1,116; ml: 504; perl: 502; 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]
}