ENVIRONMENT

From ICE Enterprises
Jump to navigation Jump to search

Performs various functions on the NeXtMidas environment

<func>  Function to perform on environment [DEF=SHOW]
<key>   Function dependent keyword. Desired variable of interest for
        SET or GET
<value> Results label for GET, or value for SET

This command performs a number of functions from showing the NeXtMidas
environment, to performing an NFSLOOKUP or showing system related
information like memory usage or threads Java properties

Since the environment variables are now the table ENV in the results table,
they may be read directly without using this command.

The NeXtMidas FILE intrinsic replaces the X-Midas environment file functions.

Special keywords may not set an entry in the ENV table or may do more than
just set the entry.

FUNCTIONS:
  GET - ENV GET <key> <label>
    Get the keyword in the environment. Prints to screen if <label> is blank

    The environment variables in the ENV table are:
      NMROOT       - The NeXtMidas root installation directory
      USER         - User name
      HOME         - The home directory
      HOSTNAME     - The local host name
      HOSTADDR     - The local host IP address
      OSTYPE       - The operating system type (UNIX,WINDOWS,...)
      OSNAME       - The operating system name (Linux,...)
      OSREP        - The operating system data representation (EEEI,IEEE)
      EDITOR       - The desired editor. Automatically chosen by EDIT command.
      VIEW         - TBD
      THEME        - The current theme (see LOOKANDFEEL).
      STYLE        - TBD
      GRAPHICS     - What graphics options to use. See details below.
      PID          - Process ID
      MSF          - The current Midas State File
      NMVERSION    - The NeXtMidas version (x.y.z).
      JVMVERSION   - The Java version (x.y.z).
      NMPRERELEASE - TRUE if version is a pre-release, FALSE otherwise.
      PAUSE        - The default pause time between primitive process calls.
      VERIFY       - The VERIFY mask string
      DEBUG        - The DEBUG mask string of bar ("|") separated values.
      HWFILE       - The hardware configuration file
      KEYMAP       - Mapping of Plot keyboard shortcuts
      UIMANAGER    - Adjustments made to the SWING UIManager
      IOOPTIONS    - The options for input/output for files and other I/O.

    Special GET keywords (not necessarily in the table) are:
      COMPLETIONAUXEXCLUDE - Pipe-separated list of AUXes that are to be
                             excluded when using FILES searching and
                             tab-completion              (since NeXtMidas 3.1.0)
      DEFAULTTABLEFLAGS    - The default table flags     (since NeXtMidas 2.7.1)
      DEFAULTTABLEMODE     - The default table mode      (since NeXtMidas 2.7.0)
      FileNameCASE         - Default FileName case option (this is overridden
                             by the FNCASE= qualifier).  (since NeXtMidas 3.3.1)
      HOSTNAMEFQDN         - Fully-Qualified-Domain-Name for the ENV.HOSTNAME
                             (note that this will simply return ENV.HOSTNAME if
                             the name resolution fails.  (since NeXtMidas 3.3.2)
      NUMSCReens           - The number of screens in this graphics environment
      NUMNONVIRTSCREENS    - The number of non-virtual screens in this graphics
                             environment                 (since NeXtMidas 2.8.0)
      PRIV                 - The privileges mask
      SERVER               - Gets the current server address (this can be
                             overridden by /REMOTE=<server>)
      SERVERFQDN           - Fully-Qualified-Domain-Name for the ENV.SERVER
                             (note that this will simply return ENV.SERVER if
                             the name resolution fails.  (since NeXtMidas 3.3.2)
      USENATIVE            - The mask string defining native code use

  GRAPHICS - The graphics options (found in Theme.java) allow for control over
             the method NeXtMidas uses to display certain items such as plots
             and widgets. The current default in Theme.java is SWING|REALTIME
             but this can be overridden using the 'env set' command (such as in
             startup scripts).

             Options:
             --------
             HEADLESS      - Do not draw Windows (including Plots) on display
             AWT           - use heavyweight (AWT) objects
             SWING         - use lightweight (SWING) objects for Plots
             REALTIME      - allow lightweight plots to draw in their own thread
             MOBILE        - All-SWING with special parenting options for pop-ups
             SWINGDB       - turn on SWING double buffering
             SWINGWIDGETS  - GWidget controls drawn on SWING panels
             SWINGPOPUPS   - GWidget controls drawn on SWING panels
             NOSLAF        - No Swing Look and Feel theme support (or query)
             NOXLAF        - No external swing look and feel changes via UIManagers
             INITONLOAD    - Initialize graphics themes on load instead of on demand
             DEBUG         - Enable graphics environment debug output


  KEYMAP    - (Since 2.7.2) The keymap is a mapping of keyboard shortcuts to
              Plot zoom adjustments. Based on industry practices (most notably
              Google Maps), the keyboard shortcuts allow users to move the
              viewable area of a zoomed-in plot using only the keyboard.

              ENV.KEYMAP is typically set in nmstartup.mm, but can be modified
              at any time. If it is null, Plot will use default settings. The
              defaults are basically to use the arrow keys to make small
              adjustments, the home/page up/page down/end keys for larger
              adjustments, and the "+" and "-" keys for incremental zooming in
              and out.

  UIMANAGER - The SWING UIManager provides the ability to change many aspects
              of the Swing look and feel "on demand".

              Starting in NeXtMidas 2.7.3, users can alter the UIManager by
              using the "environment set uimanager <table>" command:

              nM> env set uimanager {scrollbar={width=10,thumb=red}}

              The above example will change the Swing scrollbar to be 10 pixels
              wide and have a color of red.

              Note that not all UIManager settings can be altered, as they may
              require inputs of sound files, images, etc.. Generally, the
              following input values types are supported:

                Data Types (int, long, double, boolean, etc)
                Strings (or char)
                Colors
                Fonts (font name only, e.g. "courier", "arial", etc)

              A complete list of UIManager properties depends on the Java
              version and OS, but can be found in Java by using the following:

                Enumeration<Object> keys =    UIManager.getDefaults().keys();

  IOOPTIONS - The options for input/output for files and other I/O.  Since 2.9.0
              DisableEscapeSequences - Turn off the handling of escape
                            sequences in quoted Strings (inside macro/prompt)
                            using the backslash character (i.e. '\') just like
                            Java/C string escape sequences.
                            Note: this does not apply to creating Tables from
                            Strings or writing out the contents of a Table with
                            Table.toByte(..). This option is DEPRECATED.
                            In 3.1.0, escape sequences are enabled by default.
              StrictHTTP  - Strictly follow HTTP 1.1 (RFC 2616) rules. E.g. Work
                            around HTTP servers that return 200 status code to a
                            GET/POST request with Range header (with desire to
                            read partial content), which will potentially break
                            communication with NeXtMidas 2.8.2 and prior HTTP
                            servers that did not correctly returned 206 status
                            code.
              TruncateBLUE - When overwriting existing BLUE files, truncate
                            them on the storage device to minimum size
                            necessary (Since 2.9.1).
              DisableQuadwordsEqualityChecks - Turn off the equality checks in
                            DataFile that check quadwords in Type 5000 files.
                            Setting this will enable the (buggy) behavior of
                            NeXtMidas 3.2 and earlier which ignored quadwords
                            in equality checks. (Since 3.3.0)
              WriteNoAbort - Do not abort even if an Exception occurs during
                            writing. (Since 3.5.4)
              FileIONoAbort- Do not abort even if an Exception occurs during
                            a file write or read. (Since 3.7.1)

  SET - ENV SET <key> <value>
    Set the keyword in the environment

    Special SET keywords are:
      COMPLETIONAUXEXCLUDE - Sets the pipe-separated list of AUXes which are
                             ignored when searching via the FILES command or
                             tab-completion.             (Since NeXtMidas 3.1.1)
      DEFAULTTABLEFLAGS    - The default table flags, this can also be set using
                             the TABLE command.          (since NeXtMidas 2.7.1)
      DEFAULTTABLEMODE     - The default table mode, this can also be set using
                             the TABLE command.          (since NeXtMidas 2.7.0)
      FileNameCASE         - Default FileName case option (this is overridden
                             by the FNCASE= qualifier).  (since NeXtMidas 3.3.1)
      PRIV                 - Sets the sandbox privileges (supports value=ALL)
      USENATIVE            - Sets the property in nxm.sys.lib.Native for use
                             of native code

  SHOW - ENV SHOW <key>
    By default shows the current environment is listed on the terminal or
    any of the other special SHOW functions listed below.

    Special SHOW functions are:
      ""       - shows all NeXtMidas environment variables in ENV table and
                 other special ones not in the table [DEFAULT]
      THREAD   - shows all threads
      MEM      - shows memory usage
      PROP <filter> - shows all Java Property values. Since 3.5.2, a simple
                 case-insensitive <filter> search string can be specified for
                 either property name or value.
      KEYGETS  - Deprecated since NeXtMidas 2.7.0 (always blank)
      KEYSETS  - Deprecated since NeXtMidas 2.7.0 (always blank)
      HANDLERS - show table of handlers for FILEs and PACKETs

  RESET - TBD - resets variables affecting pipes and macros

  NSLOOKUP - gets an IP address for the named node
    Syntax: ENV NSLOOKUP <hostname> <inetaddress>

  GC - runs the garbage collector.  Use /VERBOSE=T to see output in a macro.
    Syntax: ENV GC

Examples:
  1. A typical set of the environment variables kept in the ENV table are
    nM> env
      T: ENV             = Table of 24 entries
    19S:  NMROOT         = /home/midas/nxmxxx/
     3S:  USER           = jph
    10S:  HOME           = /home/jph/
     6S:  HOSTNAME       = JPHLAP
     9S:  HOSTADDR       = 127.0.0.1
     4S:  OSTYPE         = UNIX
     5S:  OSNAME         = Linux
     4S:  OSREP          = EEEI
     3S:  EDITOR         = nedit
     4S:  VIEW           = TEXT
     5S:  THEME          = GEAR3
     5S:  STYLE          = GEAR3
    14S:  GRAPHICS       = SWING|REALTIME
     4S:  PID            = 1172
    19S:  MSF            = /home/jph/nmsf_1172
     5S:  NMVERSION      = 3.4.3
     5S:  JVMVERSION     = 1.8.0
     4S:  NMPRERELEASE   = FALSE
      D:  PAUSE          = 0.0125
     1S:  VERIFY         = |
    17S:  DEBUG          = |Trace|Deprecate|
    34S:  USENATIVE      = |IO|Math|Cast|CastX|Convert|Other|
    20S:  HWFILE         = nxm.sys.dat.hwconfig
      T:  KEYMAP         = Table of 1 entries
    ------- Other Environment Settings ------
    CompletionAuxExclude = |99|
    DefaultTableFlags    = |AutoReadPrev|
    DefaultTableMode     = SynchronizedLinkedHashMap
    FileNameCase         = AutoCase
    HostNameFQDN         = jphlap.localdomain
    NumNonVirtScreens    = 1
    NumScreens           = 3
    Priv                 = ALL
    Server               = 
    ServerFQDN           = 
    UseNative            = |IO|Math|Cast|Convert|Other|

  2. To determine the host address of this computer
    nM> ENV GET HOSTNAME myHostname

  3. To set the control panel widgets to use SWING panels and double buffer
    nM> ENV SET GRAPHICS +SWINGWIDGETS|+SWINGDB

  4. To set the Swing scrollbar to be 10 pixels wide and have a color of red:
    nM> env set uimanager {scrollbar={width=10,thumb=red}}

  5. If the /SERVER switch is specified on a macro, it is to be run in server
     mode. If the /CLIENT switch is specified on a macro, it is to be run in
     client mode. The client macro gets the server address from the
     /REMOTE=host:port switch, the ENV.SERVER variable, or the Midas.getServer()
     function. This command will search this path for the servers address
    nM> ENV GET SERVER theServer

  6. To determine how many screens your computer has:
    nM> env get NUMSCREENS ns

  7. To determine how many screens your computer has that are not virtual (aka,
     cinerama is 1 screen not 3).
    nM> env get NUMNONVIRTSCREENS nsNonVirt

  8. Disable the handling of escape sequences in Strings:
     nM> env set iooptions +DisableEscapeSequences

  9. Set the list of AUXes to ignore when using the FILES command or
     tab-completion
     nM> env set COMPLETIONAUXEXCLUDE "RAM|99"

Switches:
  /ALL        - Enumerate contents of any tables in the environment for SHOW
                function
  /REMOTE=<r> - Override the default host:port for the ENV GET SERVER function
  /VERBOSE    - Show additional information while command is running

See Also: TABLE, LOOKANDFEEL