PreviousUpNext

15.4.1029  src/lib/std/2d/geometry2d-junk.pkg

## geometry2d-junk.pkg
#
# Support code (mostly print stuff) for src/lib/std/2d/geometry2d.pkg
#

# Compiled by:
#     src/lib/std/standard.lib


                                                                                # Geometry2d            is from   src/lib/std/2d/geometry2d.api
stipulate
    package rc  =  range_check;                                                 # range_check           is from   src/lib/std/2d/range-check.pkg
    package ebf =  eight_byte_float;                                            # eight_byte_float      is from   src/lib/std/eight-byte-float.pkg
    package lms =  list_mergesort;                                              # list_mergesort        is from   src/lib/src/list-mergesort.pkg
    package g2d =  geometry2d;                                                  # geometry2d            is from   src/lib/std/2d/geometry2d.pkg
    #
    nb =  log::note_on_stderr;                                                  # log                   is from   src/lib/std/src/log.pkg
herein

    package geometry2d_junk {
        #
        #
        fun box_to_string ({ row, col, high, wide }: g2d::Box)
            =
            sprintf "{ row => %d, col => %d, high => %d, wide => %d }" row col high wide;


        fun boxes_to_string  (indent: String,  boxes: List(g2d::Box))
            =
            {   strings   = map box_to_string boxes;
                separator = "\n" + indent;
                #
                result    = string::join' indent separator "\n" strings;
                #
                result;
            };

        fun point_to_string ({ row, col }: g2d::Point)
            =
            sprintf "{ row => %d, col => %d }" row col;


        fun size_to_string ({ high, wide }: g2d::Size)
            =
            sprintf "{ high => %d, wide => %d }" high wide;

        fun site_to_string (site: g2d::Window_Site)
            =
            {   site ->     { upperleft:        g2d::Point,
                              size:             g2d::Size,
                              border_thickness: Int
                            };

                sprintf "{ upperleft => %s, size => %s, border_thickness => %d }" (point_to_string upperleft) (size_to_string size) border_thickness;
            };


    };                  # package geometry2d_junk

end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext