[racket] why zip and base64 encode an algol60 module?
For people to stumble into it and have a little fun. :)
Robby
On Mon, Jul 12, 2010 at 8:03 AM, Stephen De Gabrielle
<spdegabrielle at gmail.com> wrote:
> I was looking at the Algol 60 code while looking at use of the tool phases,
> and found this (prefix bd: "bd-tool.ss")).
>
> What surprised me was that is pointed to this:
>
>
> #lang s-exp framework/private/decode
> bVTbjtsgEP2VqatIdlWyadSLtFIv6lOf+wErgZkYthi8gJPN33cAO3GyfonjM2fOXDi49vgy
> ao9QGy2g6j3KbQhV+Vc1E9waHkLCZ2C0Oi7fo3Om5EkfWoU9Vg3FJB60RfBOiDMTkp9/Eh8j
> 1LWEOmDrrAzsh+SR6rej92gjm+CmSQLcEvE7CRGF9c5GBbKBb80VJNEE7Qt/Kih0x0Rf0m+K
> 9/wfMieesY1Eij0fNlCLURvJBk7ideuMoaB2tgAVN50zX3c0aSXk9nnoqptKRsdocL0YTfqB
> Rk2x1boPaQeUNHXbYWQnLaNq4HOzGlWoOxVTOHfQruky2W5A9JmR84kWKDe03CDstvsv+WcR
> lZ6fWEmei+1gd5c+xd8fmll88O6oJUI6+l+XhbDkjIJBrfvB+QizJR4T/ERUfH2LswKGp+tu
> B8UDfoKj0/IO3N+BZQ8WT7k8O3je4wbCOKDfECvbd3qlrqxCT02mjYoxxnzUFk2aOFGYtiFy
> G3W25dJVmZwErvGCbdI1uBhhRdjwnkyRrJYl8BibxU1YnqLU3LhuA9UfPgxn+K19VGSnj/A3
> WetdlY4g9bTM6TEE3tHE0/HJu/jc5J3mRVIuGgS8nDwE5U65HtQvo0vbEM5L9AtzTZxYLkWI
> ZzLZTJZIE6Jsmit/ZTet4rZD1iq6hPQBuLaS9kafgjDv3UxCJ0Wsm4t2MRKpP+BrpEqP5bHw
> A6x6JG/zPw==
>
>
> which gets deflated and unencoded into a module, (AFAICT) via;
>
> #lang scheme/base
> (require (for-syntax scheme/base file/gunzip net/base64))
> (provide (except-out (all-from-out scheme/base) #%module-begin)
> (rename-out [module-begin #%module-begin]))
>
> (define-syntax (module-begin stx)
> (syntax-case stx ()
> [(_ x ...)
> (andmap (lambda (x) (or (identifier? x) (integer? (syntax-e x))))
> (syntax->list #'(x ...)))
> (let* ([data (format "~a" (syntax->datum #'(x ...)))]
> [data (substring data 1 (sub1 (string-length data)))]
> [data (string->bytes/utf-8 data)]
> [in (open-input-bytes (base64-decode data))]
> [out (open-output-string)]
> [out (begin (inflate in out) (get-output-string out))]
> [exprs (read (open-input-string (string-append "(" out ")")))]
> [exprs (datum->syntax stx exprs stx)])
> #`(#%module-begin #, at exprs))]))
>
>
> Why is this done?
>
> Cheers,
>
> Stephen
>
>
>
>
> --
>
> --
> Stephen De Gabrielle
> stephen.degabrielle at acm.org
> Telephone +44 (0)20 85670911
> Mobile +44 (0)79 85189045
> http://www.degabrielle.name/stephen
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>