ASCII32-126

Pipelines v1.9

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline displays the decimal, hexadecimal and binary values for each
.* of the ASCII characters in the range 32-126. The output is displayed on the console
.* and written to the file: ASCII.txt.
 
.* The pipeline is intended to demonstrate how the specs stage can be used to transform
.* characters to their decimal, hexadecimal and binary values.
 
pipe (endchar ?)
     literal x20-x7e               .* Generate a literal in the range 32-126.
     | split before x20-x7e        .* Separate the literal into individual characters.
     | specs recno from 32 1       .* Put record number in column 1..
             1-* c2x nw            .* ..its hexadecimal representation next..
             1-* c2b nw            .* ..followed by its binary representation..
             1-* nw                .* ..followed by the actual ascii character.
     | a: drop 48                  .* Drop 48 records..
     | j: specs select 1 1-* 1     .* Build a two column output record from..
                select 0 1-* nw    .* ..each of the two input streams.
     | cons                        .* Display on the console.
     | > &sysdrive:\Documents and Settings\&username\My Documents\ASCII.txt
     ?
     a:
     | elastic                     .* Accept the first 48 records.
     | j:                          .* Route back to specs.