PreviousUpNext

15.4.108  src/app/makelib/stuff/makelib-defaults.pkg

## makelib-defaults.pkg
## author: Matthias Blume (blume@cs.princeton.edu)

# Compiled by:
#     src/app/makelib/stuff/makelib-stuff.sublib

# makelib parameters that are configurable via shell-dictionary variables.

stipulate
    package bc  =  basic_control;                                       # basic_control                 is from   src/lib/compiler/front/basics/main/basic-control.pkg
    package ci  =  global_control_index;                                # global_control_index          is from   src/lib/global-controls/global-control-index.pkg
    package cj  =  global_control_junk;                                 # global_control_junk                   is from   src/lib/global-controls/global-control-junk.pkg
    package ctl =  global_control;                                      # global_control                is from   src/lib/global-controls/global-control.pkg

    menu_slot =  [10, 2];
    obscurity =  2;
    prefix    =  "makelib";

    registry =  ci::make  { help => "makelib" };

                                                                        my _ =
    bc::note_subindex  (prefix, registry, menu_slot);

    convert_boolean
        =
        cj::cvt::bool;

    int_cvt
        =
        cj::cvt::int;

    st_cvt =                                                            #  "st" == "string thunk "?
        { name_of_type   =>  "String",
          from_string =>  \\ s =  THE {. s; },
          to_string   =>  \\ th =  th ()
        };

    sot_cvt =                                                           #  "sot" == string option thunk 
        { name_of_type   =>  "String",
          from_string =>  \\ s =  THE {. THE s; },
          to_string   =>  \\ th =  case (th ())

                                        THE s =>  s;
                                        NULL  =>  "(not set)";
                                   esac
        };

    next_menu_slot =   REF 0;


herein

    package makelib_defaults {

        fun make_control
                ( to_from_string_fns,
                  name,
                  help,
                  initial_value
                )
            =
            {   state     =  REF  initial_value;
                menu_slot =  *next_menu_slot;

                control
                    =
                    ctl::make_control                                           # global_control        is from   src/lib/global-controls/global-control.pkg
                      {
                        obscurity,
                        name,
                        help,
                        menu_slot =>  [menu_slot],
                        control   =>  state
                      };
            
                next_menu_slot :=  menu_slot + 1;

                ci::note_control
                    #
                    registry
                    #
                    { control         =>   ctl::make_string_control  to_from_string_fns  control,
                      dictionary_name =>   THE (cj::dn::to_upper "CM_" name)
                    };
                                                                        # global_control_junk   is from   src/lib/global-controls/global-control-junk.pkg

                {   set   =>   \\ x =  state := x,
                    get   =>   {. *state; }
                };
            };

        fun new_string_control                                                  # XXX BUGGO DELTEME this is just fun new (above) with more debug printouts
                ( to_from_string_fns,
                  name,
                  help,
                  initial_value
                )
            =
            {   state     =  REF  initial_value;
                menu_slot =  *next_menu_slot;

                control
                    =
                    ctl::make_control                                   # global_control        is from   src/lib/global-controls/global-control.pkg
                        {
                          obscurity,
                          name,
                          help,
                          menu_slot =>  [menu_slot],
                          control   =>  state
                        };
            
                next_menu_slot :=  menu_slot + 1;

                ci::note_control
                    registry
                    { control         =>   ctl::make_string_control  to_from_string_fns  control,
                      dictionary_name =>   THE (cj::dn::to_upper  "CM_"  name)
                    };
                                                                        # global_control_junk   is from   src/lib/global-controls/global-control-junk.pkg

                { set   =>   \\ x =  state := x,
                  get   =>   {. *state; }
                };
            };

        verbose    =   make_control (convert_boolean, "verbose", "makelib chattiness", TRUE );
        debug      =   make_control (convert_boolean, "debug",   "makelib debug mode", FALSE);

        keep_going_after_compile_errors
            =
            make_control
              ( convert_boolean,
                "keep_going_after_compile_errors",
                "whether makelib compiles more sourcefiles after encountering one with compile errors",
                FALSE
              );


        parse_caching
            =
            make_control (int_cvt, "parse_caching", "limit on parse trees cached", 100);


        warn_on_obsolete_syntax
            =
            make_control (convert_boolean, "warn_on_obsolete_syntax",
                                 "whether makelib accepts old-style syntax",
                                 TRUE);
        conserve_memory
            =
            make_control (convert_boolean, "conserve_memory", "makelib memory stinginess", FALSE);

        generate_index
            =
            make_control (convert_boolean, "generate_index",
                                  "whether makelib generates library indices",
                                  TRUE);

        make_compile_logs
            =
            make_control (convert_boolean, "make_compile_logs",
                                  "whether makelib generates foo.compile.log files",
                                  TRUE);

        #  Controls for make tool 
        package make_tool
        =
        package {
            stipulate
                menu_slot = [1];
                prefix = "make_tool";
                obscurity = 2;
                m_index = ci::make { help => "makelib Make Tool" };

                                                                                     my _ = 
                ci::note_subindex                               # global_control_index  is from   src/lib/global-controls/global-control-index.pkg
                    registry
                    { prefix    =>  THE prefix,
                      menu_slot,
                      obscurity =>  0,
                      reg       =>  m_index
                    };

                next_menu_slot = REF 0;

                fun make (c, name, help, d)
                    =
                    {   r         =   REF d;
                        menu_slot =   *next_menu_slot;

                        control
                            =
                            ctl::make_control
                              {
                                name,
                                menu_slot => [menu_slot],
                                obscurity,
                                help,
                                control => r
                            };

                        next_menu_slot :=  menu_slot + 1;

                        ci::note_control
                            m_index
                            { control         =>   ctl::make_string_control  c  control,
                              dictionary_name =>   THE (cj::dn::to_upper  "CM_MAKE_" name)
                            };

                        { set   =>   \\ x =  r := x,
                          get   =>   {. *r; }
                        };
                    };
            herein
                command
                    =
                    make (cj::cvt::string, "command",
                         "the shell-command", "make");

                pass_bindir
                    =
                    make (cj::cvt::bool, "pass_bindir",
                         "whether to pass LIB7_BIN_DIR to command", TRUE);
            end;
        };
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext