PreviousUpNext

15.4.1390  src/lib/x-kit/widget/edit/boolfloatintstrings-millout.pkg

## boolfloatinstrings-millout.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

#   package im  =  int_red_black_map;                                                           # int_red_black_map             is from   src/lib/src/int-red-black-map.pkg
#   package is  =  int_red_black_set;                                                           # int_red_black_set             is from   src/lib/src/int-red-black-set.pkg
    package sm  =  string_map;                                                                  # string_map                    is from   src/lib/src/string-map.pkg

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

    package boolfloatintstrings_millout                                                         # 
    {
        Boolfloatintstring
          #
          = BOOL   Bool
          | FLOAT  { units: Null_Or(String), value: Float }
          | INT    { units: Null_Or(String), value: Int   }
          | STRING String
          ;

        Boolfloatintstrings
          =
          sm::Map(Boolfloatintstring);

        Boolfloatintstrings_Millout
          =     
          { note_watcher:  (mt::Inport, Null_Or(mt::Millin), (mt::Outport, Boolfloatintstrings) -> Void) -> Void,       # Second arg will be NULL if watcher is not another mill (e.g. a pane).
            drop_watcher:   mt::Inport -> Void                                                                          # The mt::Inport must match that given to note_watcher.
          };                             

        exception  BOOLFLOATINTSTRINGS_MILLOUT  Boolfloatintstrings_Millout;                    # We'll never 'raise' this exception:  It is purely a datastructure to hide the Float_Millout type from millboss-imp.pkg, in the interests of good modularity.
        #
        #
        fun maybe_unwrap__boolfloatintstrings_millout  (watchable:  mt::Millout):  Fail_Or( Boolfloatintstrings_Millout )
            =
            case watchable.crypt
                #
                BOOLFLOATINTSTRINGS_MILLOUT
                boolfloatintstrings_millout
                    =>
                    WORK boolfloatintstrings_millout;

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

        fun unwrap__boolfloatintstrings_millout  (watchable:  mt::Millout):   Boolfloatintstrings_Millout
            =
            case watchable.crypt
                #
                BOOLFLOATINTSTRINGS_MILLOUT
                boolfloatintstrings_millout
                    =>
                    boolfloatintstrings_millout;

                _   =>  {   msg = (sprintf "maybe_unwrap__boolfloatintstrings_millout:  Unknown Millout value, port_type='%s', data_type='%s' info='%s'  --boolfloatintstrings-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 =  "boolfloatintstrings_millout::Boolfloatintstrings_Millout";                # Export so clients can use this value by reference instead of duplication (with attendant maintenance issues).

        fun wrap__boolfloatintstrings_millout
              (
                outport:                        mt::Outport,
                boolfloatintstrings_millout:    Boolfloatintstrings_Millout
              ):                                mt::Millout
            =
            { outport,
              port_type,
              data_type =>  "boolfloatintstrings_millout::Boolfloatintstrings",
              info      =>  "Wrapped by boolfloatintstrings_millout::wrap__boolfloatintstrings_millout.",
              crypt     =>  BOOLFLOATINTSTRINGS_MILLOUT boolfloatintstrings_millout,
              counter   =>  REF 0       
            };           
    };

end;





Comments and suggestions to: bugs@mythryl.org

PreviousUpNext