Jul.09.2018 -- CAlive to add debugger visualization members to structs and classes

4 views
Skip to first unread message

Rick C. Hodgin

unread,
Jul 9, 2018, 1:42:11 PM7/9/18
to CAlive Programming Language
CAlive wil allow structs and classes to have debugger visualization algorithms appended which render something to visualize their content in a way other than with raw data.  These functions can be called in user code, or by the debugger to visualize a pointer in a custom way.

There are two function prototypes supported:

    // Visualize to a custom bitmap
    struct SExample
    {
        // Normal members go here
        s32    age;
        datum  name;

    } bitmap visualize(SExample* e, bitmap bmpLast) {
        // Code here to render a visualization of this structure
        // Returns a bitmap that will be displayed by the debugger
        // Could be a birthday cake, a dial from 0..120 years, or
        // anything else.
    }

    // Indicate which fields should be displayed, and how
    struct SExample
    {
        // Normal members go here
        s32    age;
        datum  name;

    } builder visualize(SExample* e, builder bLast) {
        // Code here to indicate which fields should be displayed using what format
        // (uses one item per row):
        //
        //     member_name, source code line to use to display this member's content
        //                  // Note: this is typically an sprintf() statement
        //
        // Example, two members, but displays three lines using void for no associated
        // member name:
        //     void, sprintf(buffer, "%s", ((e->age > 70) ? "Retirement age" : ""));
        //     age,  sprintf(buffer, "Age: %d", e->age);
        //     name, sprintf(buffer, "Name: %s", e->bLast.data_s8);
    }

-- 
Rick C. Hodgin

Reply all
Reply to author
Forward
0 new messages