p101_enc

Crates.iop101_enc
lib.rsp101_enc
version
sourcesrc
created_at2024-10-09 21:32:14.400632
updated_at2024-10-09 21:32:14.400632
descriptionLibrary to convert Olivetti P101 program to and from different encodings
homepage
repositoryhttps://gitlab.com/cokkaai/programma_101/-/tree/master/enc
max_upload_size
id1403071
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(cokkaai)

documentation

README

Managing script formats with C101

C101 is the Programma 101 format conversion utility. In the Unix mindset, it allows to combine different filters in pipelines to apply different trasformations.

Pipelines

The conversion of a file to a new format is made of different stages. Each stage is a filter which trasforms its input in another form. Executing many filters in sequence, all required encodings can be managed: this is the concept of pipeline.

Each filter has specific input and output and must be properly combined. A stage output format must match the next stage input format. For instance, to read the prg.101 file from disk, decode from the Larini format, encode it in standard UTF8 and write the program to the standard out one would write:

c101 -f read_file -f larini_decoder -f standard_encoder -f write_to_stdout prg.101

The last parameter is always the file to process. While it may seems complicated, it allows to add a new formats by implementing the specific business logic in a new filter.

Filters

In order to build your own conversione pipeline, a short reference follows

  • read_file - Read the input file from disk into memory as raw bytes.
  • utf8_decoder - Convert bytes into UTF-8. The conversion may fail.
  • standard_decoder - Convert UTF-8 data into P101 program.
  • larini_decoder - Convert a P101 program from the Larini format to the standard one.
  • standard_encoder - Encode a P101 program to UTF-8 using the standard encoding
  • write_to_stdout - Write its input to the standard output

Creating a new filter

A filter, by the trait definition, maps an EncodingData value to another. It means that you can transform raw data to a file or text or program a viceversa. Each filter accepts only the EncodingData it can process; for instance the read_file filter refues any input that is not an EncodingData::File value.

Commit count: 0

cargo fmt