Output Filtering

version 2 by Ron Newcomb

  • Home page
  • Beginning
  • Previous



  • Chapter - I6 helper routines for Output Filtering

    To say bold type: (- bold_on(); -).

    To say italic type: (- italic_on(); -).

    To say roman type: (- roman_on(); -).

    To say blank line: say "[bracket]BLANK LINE[close bracket]".

    To say the/-- filtered (itext - indexed text): (- SayGameResponse(({itext})); -).

    Include (-

    [ bold_on;
    if (capture_active > 0) print "{";
    else style bold;
    ];

    [ italic_on;
    if (capture_active > 0) print "<";
    else style underline;
    ];

    [ roman_on;
    if (capture_active > 0) print "}";
    else style roman;
    ];


    [ SayGameResponse indt ch i dsize;
        if ((indt==0) || (BlkType(indt) ~= INDEXED_TEXT_TY)) return;
        dsize = BlkValueExtent(indt);
        for (i=0:i<dsize:i++) {
            ch = BlkValueRead(indt, i);
            switch (ch)
            {
            0: return;
            255: return;
            '{': style bold; continue;
            '<': style underline; continue;
            '}': style roman; continue;
        #ifdef TARGET_ZCODE;
            10: continue;
        #endif;
            }
            #ifdef DEBUG_OUTPUT_FILTERING;
                switch (ch) { ! then print ZSCII values instead
                32: print " ";
                10: print "^";
                default: print ch, " ";
                }
            #ifnot;
                #ifdef IT_Storage_Glulx_Unicode;
                    glk_put_char_uni(ch);
                #ifnot; ! IT_Storage_Glulx_Unicode
                    print (char) ch;
                #endif;
            #endif;
        }
    ];

    -).


    Output Filtering ends here.