home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!auvm!UBVM.CC.BUFFALO.EDU!TKSSTEVE
- Organization: State University of New York at Buffalo
- Message-ID: <CMSPIP-L%93012609424790@VM.MARIST.EDU>
- Newsgroups: bit.listserv.cmspip-l
- Date: Tue, 26 Jan 1993 09:40:50 EST
- Sender: VM/SP CMS Pipelines Discussion List <CMSPIP-L@MARIST.BITNET>
- From: "Steven P. Roder" <TKSSTEVE@UBVM.CC.BUFFALO.EDU>
- Subject: Re: DEBLOCK 1-byte length
- In-Reply-To: Message of Mon, 25 Jan 1993 17:19:31 LCL from <PIPER@VNET>
- Lines: 53
-
- On Mon, 25 Jan 1993 17:19:31 LCL John P. Hartmann said:
- > RE: DEBLOCK 1-byte length
- >
- > I cannot see how to cajole the existing functions into doing this one.
- >
- > DEBLOCK NETDATA uses a one-byte inclusive length, but the following
- > byte must have both highorder bits on, and presumably you cannot
- > guarantee this.
- >
- Many thanks to Christian Reichetzeder for his q&d filter to accomplish this.
- The only problem with the filter was when a record spanned "buffers", it
- was not being written, thereby misalligning the remainder of the file.
- I added a few lines, and it works perfectly now, and real fast too ! It
- out performed the same function in pure REXX by a factor of 5 for CPU time.
- (same number of I/O's, since in the REXX routine I piped the file into a
- STEM).
-
- For anyone who is interested, here is the filter:
-
- /* Deblock with 1-byte length fields */
- /* Sample, q&d hacked from similar */
- /* filters ... use at your own risk, */
- /* debug it, thrash it or whatever */
- buffer = ''
- 'peekto in'
- buffer = buffer||in
- Do While rc = 0
- Do Until length(buffer) < 1
- Parse var buffer len+1 buffer
- r_len = c2d(len)
- If r_len = 0 Then Exit 12
- If length(buffer) >= r_len Then Do
- outrec = substr(buffer,1,r_len)
- 'output' outrec
- If rc ^= 0 Then Signal OutGone
- buffer = substr(buffer,r_len+1)
- End
- Else Leave
- End
- 'readto'
- 'peekto in'
- buffer = buffer||in
- 'output' substr(buffer,1,r_len)
- If rc ^= 0 Then Signal OutGone
- buffer = substr(buffer,r_len+1)
- End
- OutGone:
- Exit rc*(rc^=12)
- /* you can ask if you need help .. Christian */
-
-
- Steve Roder
- (tkssteve@ubvm.bitnet | tkssteve@ubvm.cc.buffalo.edu | (716)645-3564
-