Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Efficient techniques to parse binary files ?

From: jasonic::panix::com at: 14-Nov-2001 1:22

hmm.. having fun exploring binary PNG files to detect specific characters, chunks and strings. Using an external tool, TweakPNG I have embedded a REBOL test script inside the image. What are some recommended techniques for doing this efficiently? Looking for general REBOL guidance, but examples are always welcome.. buddha: read/binary %buddha.png file-length: length? buddha ; == 292962 ; starting at position: 292858 here is the test script I want: { tEXtScript REBOL [] message: "hello from rebol png!" send [jasonic--nomadics--org] message } So I have been writing mickey-mouse functions with iterations to check values via to-char buddha/:position till I find what looks like the begining of text chunk, then store it in 'chunk and test if chunk = "tEXt" etc Feels like there must be better way[s].. is sloow too Here the Problem: 1: Scan through a binary file looking for a chunk = "tEXt" 2: When I do find one, then check if there is special keyword string Script following it 3: Check if the next string = "REBOL [" if it then bingo! I want that script for however long it is... else keep looking for another chunk = "tEXt" any suggestions ? thanks - Jason