View script | License | Download documentation as: HTML or editable |
Download script | History | Other scripts by: vincentecuye |
[0.045] 17.539k
Documentation for: codecs.rREBOL2 Codec SystemAuthor: Annick ECUYER Version: 1.0.0 (2-Mar-2025) Contents1. Purpose 2. Loading / Execution 3. Codec registration 4. Codecs information 5. Codec usage - data identification 6. Codec usage - decoding 7. Codec usage - encoding 8. Module context 9. Codec structure 1. PurposeThis script implements a coder/encoder system for REBOL2, like in R3/Red, modules that converts to/from (mostly) binary formats. It's a component (system/components), and cam be used with the 'Needs header field : Needs: [codecs 1.0.0] The predefined codecs are (options in parenthesis):
Theses are linked to internal Rebol function but can be replaced. 2. Loading / Execution>> do %codecs.r It's only updated if it isn't loaded / the existing version is older.To force a refresh/reload : >> do/args %codecs.r 'force By default, all words in header/exports are bound to the global context.It can be prevented at script execution: ; only exports 'encode and 'decode functions >> do/args %codecs.r [with [encode decode]] The rest is still available in 'ctx-codecs . 3. Codec registration
4. Codecs information
5. Codec usage - data identification
6. Codec usage - decoding
7. Codec usage - encoding
8. Module context
9. Codec structurecodec!: make object! [ name: none ; mandatory, used to identify the codec type: none ; category for classification (optional) title: none ; text description (optional) version: none ; codec version (optional) suffixes: none ; block! of suffixes in the form [%.txt %.bin] (optional) encoding: any-function! ; encoding method (optional) decoding: any-function! ; decoding method (optional) identify: any-function! ; identify method (optional) ] |