String Buffers

version 5 by Jesse McGrew

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 5 - Testing - Not for release

    Showing the buffer of is an action out of world, applying to one thing. Understand "showbuf [any things]" as showing the buffer of.

    To say bufferedness of (obj - thing):
        if obj is a labeled thing begin;
            say "labeled";
        otherwise if obj is a buffered thing;
            say "buffered";
        otherwise;
            say "unbuffered";
        end if.

    Carry out showing the buffer of:
        [BUGFIX: >SHOWBUF ALL causes the noun to be 0]
        if the noun is not a thing begin; say "You can't do that."; stop the action; end if;
        say "[the noun] ([bufferedness of the noun][if the noun is a blank buffered thing], blank[end if])[line break]";
        if the noun is a buffered thing begin;
            say " buffer allocation: [buffer allocation of the noun][line break]";
            say " initial message: '[the initial message of the noun]'[line break]";
            say " message: '[the message of the noun]'[line break]";
            say " message length: [the message length of the noun][line break]";
            if the noun is a labeled thing begin;
                say " showing its label: [if the noun is showing its label]yes[otherwise]no[end if][line break]";
            end if;
        end if;

    Showing buffer stats is an action out of world, applying to nothing. Understand "showbuf" as showing buffer stats.

    Carry out showing buffer stats:
        say "Total buffer space: [total string buffer space] byte[s][line break]";
        repeat with x running through buffered things begin;
            say " [x]: [buffer allocation of x] allocated, [message length of x] used[line break]";
        end repeat.