PreviousUpNext

15.4.1431  src/lib/x-kit/widget/edit/textmill-statechange-millout.pkg

## textmill-statechange-millout.pkg
#
# Textpane state information stored in textmill                                                 # textmill                      is from   src/lib/x-kit/widget/edit/textmill.pkg
# without revealing the relevant types to textmill.
#
# See also:
#     src/lib/x-kit/widget/edit/textpane.pkg
#     src/lib/x-kit/widget/edit/millboss-imp.pkg
#     src/lib/x-kit/widget/edit/textmill.pkg
#     src/lib/x-kit/widget/edit/keystroke-macro-junk.pkg

# Compiled by:
#     src/lib/x-kit/widget/xkit-widget.sublib


stipulate
    include package   threadkit;                                                                # threadkit                     is from   src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg
    #
    package mt  =  millboss_types;                                                              # millboss_types                is from   src/lib/x-kit/widget/edit/millboss-types.pkg

    nb = log::note_on_stderr;                                                                   # log                           is from   src/lib/std/src/log.pkg
herein

    package textmill_statechange_millout                                                        # 
    {
        exception  TEXTMILL_STATECHANGE_MILLOUT  mt::Textmill_Statechange_Millout;                      # We'll never 'raise' this exception:  It is purely a datastructure to hide the Textmill_Statechange_Millout type from millboss-imp.pkg, in the interests of good modularity.
        #
        #
        fun maybe_unwrap__textmill_statechange_millout  (watchable:  mt::Millout):  Fail_Or( mt::Textmill_Statechange_Millout )
            =
            case watchable.crypt
                #
                TEXTMILL_STATECHANGE_MILLOUT
                textmill_statechange_millout
                    =>
                    WORK textmill_statechange_millout;

                _   =>  FAIL (sprintf "maybe_unwrap__textmill_statechange_millout:  Unknown Millout value, port_type='%s', data_type='%s' info='%s'  --textmill-statechange-millout.pkg"
                                        watchable.port_type 
                                        watchable.data_type 
                                        watchable.info
                             );
            esac;       

        fun unwrap__textmill_statechange_millout  (watchable:  mt::Millout):   mt::Textmill_Statechange_Millout
            =
            case watchable.crypt
                #
                TEXTMILL_STATECHANGE_MILLOUT
                textmill_statechange_millout
                    =>
                    textmill_statechange_millout;

                _   =>  {   msg = (sprintf "maybe_unwrap__textmill_statechange_millout:  Unknown Millout value, port_type='%s', data_type='%s' info='%s'  --textmill-statechange-millout.pkg"
                                        watchable.port_type 
                                        watchable.data_type 
                                        watchable.info
                                  );
                            log::fatal msg;                                                     # Won't return.
                            raise exception DIE msg;                                            # Just to keep compiler happy.
                        };
            esac;       


        port_type =  "millboss_types::Textmill_Statechange_Millout";            # Export so clients can use this value by reference instead of duplication (with attendant maintenance issues).

        fun wrap__textmill_statechange_millout
              (
                outport:                        mt::Outport,
                textmill_statechange_millout:   mt::Textmill_Statechange_Millout
              ):                                mt::Millout
            =
            { outport,
              port_type,
              data_type =>  "millboss_types::Textmill_Statechange",
              info      =>  "Wrapped by textmill_statechange_millout::wrap__textmill_statechange_millout.",
              crypt     =>  TEXTMILL_STATECHANGE_MILLOUT textmill_statechange_millout,
              counter   =>  REF 0       
            };           
    };

end;





Comments and suggestions to: bugs@mythryl.org

PreviousUpNext