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

[REBOL] Re: Selling REBOL scripts - Scott's Distributed Licence - tm

From: sunandadh:aol at: 8-Jan-2002 17:19

Hi Volker,
> if thats the problem, how about distributing your scripts compressed? > one has to use some tricks (select the compressed 64#{..} and store it > to a file using write %file.r #{..}). > thats similar effort as compiling?
Yes indeed. I've experimented with that too. Here's the outline of code to compress a script: foreach script-name [Main utilities Recovery gui-tools] [ Script-file: read/binary to-file join script-name [".r"] ;; Loads of embarrassing early code omitted (I was ;; learning the basics back then) ;; 1. remove all comments (I should have used 'mold) ;; 2. obsfucate and shorten variable names ;; 3. strip multiple spaces and all newlines write/binary to-file join script-name [".rll"] compress script-file ] ;for where each script (main.r etc) is an object full of functions. Then to execute the code (ie make the objects available for use): if error? try [do decompress read/binary %main.rll] [print "Corrupt script. re-install, or panic now" halt] etc the application I wrote the "compressor" is just over 211K of scripts (including comments, loads of spaced out code). the "compiled" version is just under 40K I chose RLL as an homage to DLL But this sort of "safe" distribution technology can easily be built into Rebol. It'll be safer (my compressed files are easily uncompressed by anyone with a modicum of Rebol). And it'll be standard and secure, and give us all loads of additional advantages. Sunanda.