diff options
Diffstat (limited to 'Tools/schnitt/schnittcommon.pli')
-rwxr-xr-x | Tools/schnitt/schnittcommon.pli | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Tools/schnitt/schnittcommon.pli b/Tools/schnitt/schnittcommon.pli new file mode 100755 index 0000000..f221f41 --- /dev/null +++ b/Tools/schnitt/schnittcommon.pli @@ -0,0 +1,64 @@ +sub nextI + { + if (!$size) + { + $size = -s INDEX; + } + local ($a,$b,$c,$dummy); + $cond = 0; + seek (INDEX,$index * 8,0); + + while ($cond == 0) + { + &readnext; + if ($frame == 1) + { + $cond = 1; + } + else + { + $index++; + if ($index > ($size/8-1)) + { + $index = $size/8-1; + &prevI; + print "$index\n"; + exit 1; + } + } + } + } + +sub readnext + { + read (INDEX,$a,4); + read (INDEX,$b,1); + read (INDEX,$c,1); + read (INDEX,$dummy,2); + $offset = unpack ("L",$a); + $frame = unpack ("C",$b); + $file = unpack ("C",$c); + } + +sub prevI + { + local ($a,$b,$c,$dummy); + $cond = 0; + seek (INDEX,$index * 8,0); + + while ($cond == 0) + { + &readnext; + if ($frame == 1) + { + $cond = 1; + } + else + { + $index--; + seek (INDEX,$index * 8,0); + } + } + } + +1; |