home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / bit / listserv / cmspipl / 796 < prev    next >
Encoding:
Text File  |  1993-01-27  |  2.3 KB  |  66 lines

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