Index: /trunk/configure.cmd
===================================================================
--- /trunk/configure.cmd	(revision 13)
+++ /trunk/configure.cmd	(revision 14)
@@ -28,5 +28,5 @@
 G.ScreenWidth   = -1
 G.ScreenHeight  = -1
-
+G.Verbose       = 1
 
 /* initialize global variables */
@@ -46,7 +46,4 @@
 G.EditionString = "Open Source"
 G.QT_EDITION    = "QT_EDITION_OPENSOURCE"
-
-/* So far, GCC only */
-G.PLATFORM      = "os2-g++"
 
 
@@ -101,4 +98,6 @@
     /* the directory of this script is the "source tree */
     G.RelPath = G.ScriptDir
+    /* the current directory is the "build tree" or "object tree" */
+    G.OutPath = directory()
 
     /* reset the vars file */
@@ -116,4 +115,7 @@
     /* QTDIR may be set and point to an old or system-wide Qt installation */
     call UnsetEnv "QTDIR"
+
+    /* @todo cleanup the option list below when it's clear which options are
+     * inappropriate for OS/2 */
 
     /* initalize internal variables */
@@ -269,5 +271,4 @@
     G.QT_INSTALL_DATA = ""
     G.QT_INSTALL_TRANSLATIONS = ""
-    G.QT_INSTALL_SETTINGS = ""
     G.QT_INSTALL_EXAMPLES = ""
     G.QT_INSTALL_DEMOS = ""
@@ -411,4 +412,284 @@
     --------------------------------------------------------------------------*/
 
+    /* so far, we default to GCC on OS/2 */
+    if (G.PLATFORM == "") then G.PLATFORM = "os2-g++"
+    if (DirExists(G.PLATFORM)) then G.QMAKESPEC = G.PLATFORM
+    else G.QMAKESPEC = G.RelPath"\mkspecs\"G.PLATFORM
+
+    /* Cross-builds are not supported */
+    G.XPLATFORM = G.PLATFORM
+    G.XQMAKESPEC = G.QMAKESPEC
+    G.QT_CROSS_COMPILE = "no"
+
+    /* check specified platforms are supported */
+    if (\DirExists(G.XQMAKESPEC)) then do
+        call SayErr
+        call SayErr "   The specified system/compiler is not supported:"
+        call SayErr
+        call SayErr "      "G.XQMAKESPEC
+        call SayErr
+        call SayErr "   Please see the README file for a complete list."
+        call SayErr
+        call Done 2
+    end
+    if (\FileExists(G.XQMAKESPEC"\qplatformdefs.h")) then do
+        call SayErr
+        call SayErr "   The specified system/compiler port is not complete:"
+        call SayErr
+        call SayErr "      "G.XQMAKESPEC"\qplatformdefs.h"
+        call SayErr
+        call SayErr "   Please see the README file for a complete list."
+        call SayErr
+        call Done 2
+    end
+
+    call SayVerbose "Determining system architecture..."
+
+    if (G.CFG_HOST_ARCH == "") then G.CFG_HOST_ARCH = "os2"
+
+    /* Cross-builds are not supported */
+    G.CFG_ARCH = G.CFG_HOST_ARCH
+
+    if (DirExists(G.RelPath"\src\corelib\arch\"G.CFG_ARCH)) then
+        call SayVerbose "    '"G.CFG_ARCH"' is supported"
+    else do
+        call SayVerbose "    '"G.CFG_ARCH"' is unsupported, using 'generic'"
+        G.CFG_ARCH = "generic"
+    end
+
+    call SayVerbose "System architecture: '"G.CFG_ARCH"'"
+
+    /*--------------------------------------------------------------------------
+     tests that don't need qmake (must be run before displaying help)
+    --------------------------------------------------------------------------*/
+
+    /* setup the build parts */
+    if (G.CFG_BUILD_PARTS == "") then
+        G.CFG_BUILD_PARTS = G.QT_DEFAULT_BUILD_PARTS
+    do i = 1 to words(G.CFG_NOBUILD_PARTS)
+        j = wordpos(word(G.CFG_NOBUILD_PARTS, i), G.CFG_BUILD_PARTS)
+        if (j > 0)
+            call delword G.CFG_BUILD_PARTS, j
+    end
+    if (wordpos("libs", G.CFG_BUILD_PARTS) == 0) then
+        G.CFG_BUILD_PARTS = Join(G.CFG_BUILD_PARTS, "libs")
+
+    /*--------------------------------------------------------------------------
+     post process QT_INSTALL_* variables
+    --------------------------------------------------------------------------*/
+
+    /* prefix */
+    if (G.QT_INSTALL_PREFIX == "") then
+        G.QT_INSTALL_PREFIX = G.OutPath
+    /* docs */
+    if (G.QT_INSTALL_DOCS == "") then
+        G.QT_INSTALL_DOCS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\docs"
+    /* headers */
+    if (G.QT_INSTALL_HEADERS == "") then
+        G.QT_INSTALL_HEADERS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\include"
+    /* libs */
+    if (G.QT_INSTALL_LIBS == "") then
+        G.QT_INSTALL_LIBS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\lib"
+    /* bins */
+    if (G.QT_INSTALL_BINS == "") then
+        G.QT_INSTALL_BINS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\bin"
+    /* plugins */
+    if (G.QT_INSTALL_PLUGINS == "") then
+        G.QT_INSTALL_PLUGINS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\plugins"
+    /* data */
+    if (G.QT_INSTALL_DATA == "") then
+        G.QT_INSTALL_DATA = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\data"
+    /* translations */
+    if (G.QT_INSTALL_TRANSLATIONS == "") then
+        G.QT_INSTALL_TRANSLATIONS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\translations"
+    /* examples */
+    if (G.QT_INSTALL_EXAMPLES == "") then
+        G.QT_INSTALL_EXAMPLES = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\examples"
+    /* demos */
+    if (G.QT_INSTALL_DEMOS == "") then
+        G.QT_INSTALL_DEMOS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\demos"
+
+    /*--------------------------------------------------------------------------
+     help - interactive parts of the script _after_ this section please
+    --------------------------------------------------------------------------*/
+
+    /* next, emit a usage message if something failed. */
+    if (G.OPT_HELP == "yes") then do
+        /* @todo */
+        call SaySay "TODO: Help message"
+    end
+
+    /* -------------------------------------------------------------------------
+     LICENSING, INTERACTIVE PART
+    --------------------------------------------------------------------------*/
+
+    call SaySay
+    call SaySay "This is the Qt for OS/2 "G.EditionString" Edition."
+    call SaySay
+
+    if (G.Edition == "OpenSource") then
+        do while 1
+            call SaySay "You are licensed to use this software under the terms of"
+            call SaySay "the GNU General Public License (GPL) versions 3."
+            call SaySay "You are also licensed to use this software under the terms of"
+            call SaySay "the Lesser GNU General Public License (LGPL) versions 2.1."
+            call SaySay
+            if (G.OPT_CONFIRM_LICENSE == "yes") then do
+    	        call SaySay "You have already accepted the terms of the license."
+                acceptance = "yes"
+            end
+            else do
+        	    call SaySay "Type '3' to view the GNU General Public License version 3."
+                call SaySay "Type 'L' to view the Lesser GNU General Public License version 2.1."
+                call SaySay "Type 'yes' to accept this license offer."
+                call SaySay "Type 'no' to decline this license offer."
+                call SaySay
+                call SaySay "Do you accept the terms of either license?"
+                acceptance = InputLine()
+            end
+            if (acceptance == "yes") then
+                leave
+            else if (acceptance == "no") then do
+                call SaySay "You are not licensed to use this software."
+                call Done 1
+            end
+            else if (acceptance == "3") then
+                address "cmd" "type" G.RelPath"\LICENSE.GPL3 | more"
+            else if (acceptance == "L") then
+                address "cmd" "type" G.RelPath"\LICENSE.LGPL | more"
+            call SaySay
+        end
+    else
+        signal Nonsense
+
+    /*--------------------------------------------------------------------------
+     generate qconfig.cpp
+    --------------------------------------------------------------------------*/
+
+    if (\DirExists(G.OutPath"\src\corelib\global")) then
+        call MakeDir G.OutPath"\src\corelib\global"
+
+    qconfig_cpp = G.OutPath"\src\corelib\global\qconfig.cpp"
+
+    config_cpp_str =,
+'/* License Info */'G.EOL||,
+'static const char qt_configure_licensee_str          [260 + 12] = "qt_lcnsuser='CPPPath(MaxLen(G.Licensee,259))'";'G.EOL||,
+'static const char qt_configure_licensed_products_str [260 + 12] = "qt_lcnsprod='CPPPath(MaxLen(G.Edition,259))'";'G.EOL||,
+'/* Installation Info */'G.EOL||,
+'static const char qt_configure_prefix_path_str       [260 + 12] = "qt_prfxpath='CPPPath(MaxLen(G.QT_INSTALL_PREFIX,259))'";'G.EOL||,
+'static const char qt_configure_documentation_path_str[260 + 12] = "qt_docspath='CPPPath(MaxLen(G.QT_INSTALL_DOCS,259))'";'G.EOL||,
+'static const char qt_configure_headers_path_str      [260 + 12] = "qt_hdrspath='CPPPath(MaxLen(G.QT_INSTALL_HEADERS,259))'";'G.EOL||,
+'static const char qt_configure_libraries_path_str    [260 + 12] = "qt_libspath='CPPPath(MaxLen(G.QT_INSTALL_LIBS,259))'";'G.EOL||,
+'static const char qt_configure_binaries_path_str     [260 + 12] = "qt_binspath='CPPPath(MaxLen(G.QT_INSTALL_BINS,259))'";'G.EOL||,
+'static const char qt_configure_plugins_path_str      [260 + 12] = "qt_plugpath='CPPPath(MaxLen(G.QT_INSTALL_PLUGINS,259))'";'G.EOL||,
+'static const char qt_configure_data_path_str         [260 + 12] = "qt_datapath='CPPPath(MaxLen(G.QT_INSTALL_DATA,259))'";'G.EOL||,
+'static const char qt_configure_translations_path_str [260 + 12] = "qt_trnspath='CPPPath(MaxLen(G.QT_INSTALL_TRANSLATIONS,259))'";'G.EOL||,
+'static const char qt_configure_examples_path_str     [260 + 12] = "qt_xmplpath='CPPPath(MaxLen(G.QT_INSTALL_EXAMPLES,259))'";'G.EOL||,
+'static const char qt_configure_demos_path_str        [260 + 12] = "qt_demopath='CPPPath(MaxLen(G.QT_INSTALL_DEMOS,259))'";'G.EOL||,
+'/* strlen( "qt_lcnsxxxx" ) == 12 */'G.EOL||,
+'#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;'G.EOL||,
+'#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;'G.EOL||,
+G.EOL
+
+    /* avoid unecessary rebuilds by copying only if qconfig.cpp has changed */
+    create = \FileExists(qconfig_cpp)
+    if (\create) then create = CompareFileToVar(qconfig_cpp, config_cpp_str) \= 0
+    if (create) then do
+        call DeleteFile qconfig_cpp
+        call charout qconfig_cpp, config_cpp_str
+        call charout qconfig_cpp
+    end
+
+    /*--------------------------------------------------------------------------
+     build qmake
+    --------------------------------------------------------------------------*/
+
+    call SaySay "Creating qmake. Please wait..."
+
+    /* take the correct Makefile and fix it */
+    MakefilePlatform = G.RelPath"\qmake\Makefile."G.PLATFORM
+    Makefile = G.OutPath"\qmake\Makefile"
+
+    Makefile_str = charin(MakefilePlatform, 1, chars(MakefilePlatform))
+    if (Makefile_str == "") then do
+        SayError "'"MakefilePlatform"' not found."
+        call Done 1
+    end
+
+    Makefile_str =,
+        '# AutoGenerated by configure.cmd'G.EOL||,
+        'BUILD_PATH = 'QuotePath(G.OutPath)||G.EOL||,
+        'SOURCE_PATH = 'QuotePath(G.RelPath)||G.EOL||,
+        'QMAKESPEC = 'G.PLATFORM||G.EOL||,
+        'QMAKE_OPENSOURCE_EDITION = yes'G.EOL||G.EOL||,
+        Makefile_str
+
+    /* avoid unecessary rebuilds by copying only if Makefile has changed */
+    create = \FileExists(Makefile)
+    if (\create) then create = CompareFileToVar(Makefile, Makefile_str) \= 0
+    if (create) then do
+        call DeleteFile Makefile
+        call charout Makefile, Makefile_str
+        call charout Makefile
+    end
+
+    /* mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't
+     * be set once configured */
+/*
+@todo
+*/
+
+    /* create temporary qconfig.h for compiling qmake, if it doesn't exist
+     * when building qmake, we use #defines for the install paths,
+     * however they are real functions in the library */
+
+    old_qconfig_h = ""
+    qconfig_h = G.OutPath"\src\corelib\global\qconfig.h"
+    qmake_qconfig_h = qconfig_h".qmake"
+    if (FileExists(qconfig_h)) then do
+         old_qconfig_h = qconfig_h
+         call MoveFile old_qconfig_h, old_qconfig_h".old"
+    end
+
+    if (\FileExists(qmake_qconfig_h)) then do
+        call charout qmake_qconfig_h, '/* All features enabled while building qmake */'G.EOL
+        call charout qmake_qconfig_h
+    end
+
+    call MoveFile qmake_qconfig_h, qconfig_h
+    list.1 = G.OutPath"\include\QtCore\qconfig.h"
+    list.2 = G.OutPath"\include\Qt\qconfig.h"
+    list.0 = 2
+    do i = 1 to list.0
+        if (\FileExists(list.i)) then do
+            call charout list.i, '#include "..\..\src\corelib\global\qconfig.h"'G.EOL
+            call charout list.i
+        end
+    end
+
+    curdir = directory(G.OutPath"\qmake")
+    /* @todo enable make */
+    say 'address' "cmd" G.MAKE
+    make_rc = 0 /*rc*/
+
+    /* put back original qconfig.h */
+    call MoveFile qconfig_h, qmake_qconfig_h
+    if (old_qconfig_h \== "") then
+        call MoveFile old_qconfig_h".old", old_qconfig_h
+
+    /* exit on failure */
+    if (make_rc \= 0)  then
+        call Done 2
+
     signal Nonsense
     return
@@ -439,4 +720,9 @@
  utility functions
 ------------------------------------------------------------------------------*/
+
+MaxLen: procedure expose (Globals)
+    parse arg aStr, aMaxLen
+    if (length(aStr) > aMaxLen) then return left(aStr,aMaxLen)
+    return aStr
 
 CompareFileToVar: procedure expose (Globals)
@@ -474,5 +760,24 @@
     return
 
+MoveFile: procedure expose (Globals)
+    parse arg fileFrom, fileTo
+    if (filespec('D', fileFrom) == filespec('D', fileTo)) then
+        fileTo = filespec('P', fileTo)||filespec('N', fileTo)
+    else do
+        call SayErr 'FATAL: Could not move '''fileFrom''' to '''fileTo'''!'
+        call SayErr 'Source and target are on different drives'
+        call Done 1
+    end
+    call DeleteFile fileTo
+    address 'cmd' 'move' fileFrom fileTo '1>nul 2>nul'
+    if (rc \== 0) then do
+        call SayErr 'FATAL: Could not move '''fileFrom''' to '''fileTo'''!'
+        call SayErr 'move returned 'rc
+        call Done 1
+    end
+    return
+
 MakeDir: procedure expose (Globals)
+    /* @todo teach it to create all non-existing intermediate dirs */
     parse arg path
     rc = SysMkDir(path)
@@ -503,4 +808,9 @@
     if (noeol) then call charout, '>>> 'str
     else say '>>> 'str
+    return
+
+SayVerbose: procedure expose (Globals)
+    parse arg str, noeol
+    if (G.Verbose) then call SaySay str, noeol
     return
 
@@ -527,10 +837,10 @@
     parse value SysCurPos() with row col
     col = col + delta
-    row = row + (col % G.!ScreenWidth)
+    row = row + (col % G.ScreenWidth)
     if (col < 0) then
         row = row - 1
-    col = col // G.!ScreenWidth
+    col = col // G.ScreenWidth
     if (col < 0) then
-        col = col + G.!ScreenWidth
+        col = col + G.ScreenWidth
     call SysCurPos row, col
     return
@@ -572,5 +882,7 @@
 
     parse arg prompt, default, mode
-    call SaySay prompt
+
+    if (length(prompt) > 0) then
+        call SaySay prompt
     say
 
@@ -703,297 +1015,4 @@
 
 /**
- *  Shows a Yes/No choice.
- *
- *  @param  prompt  prompt to show (specify '' to suppress the prompt)
- *  @param  default default choice:
- *      ''          - no default choice
- *      'Y' or 1    - default is yes
- *      other       - default is no
- *  @return
- *      1 if Yes is selected, otherwise 0
- */
-GetYesNo: procedure expose (Globals)
-    parse arg prompt, default
-    default = translate(default)
-    if (default == 1) then default = 'Y'
-    else if (default \== '' & default \== 'Y') then default = 'N'
-    if (prompt \= '') then call SaySay prompt
-    say
-    call SayPrompt '[YN] ', 1
-    yn = ReadChoice('YN',, default, 'I')
-    say
-    say
-    return (yn == 'Y')
-
-/**
- *  Shows a menu of choices and returns the menu item number selected by the
- *  user. Letters in the mode argument have the following meanings:
- *
- *      E -- allow to press Enter w/o a choice (will return '')
- *      C -- ESC can be pressed to cancel selection (will return -1)
- *
- *  @param  prompt  prompt to display
- *  @param  stem    stem containing a list of choices
- *  @param  default default choice
- *  @param  mode    input mode string consisting of letters as described above
- *  @return
- *      selected menu item number
- */
-GetChoice: procedure expose (Globals)
-    parse arg prompt, stem, default, mode
-    mode = translate(mode)
-    allowEnter = pos('E', mode) > 0
-    allowESC = pos('C', mode) > 0
-    count = value(stem'.0')
-    if (count == 0) then return
-    call SaySay prompt
-    say
-    first = 1
-    do forever
-        extChoices = ''
-        last = first + 9
-        if (last > count) then last = count
-        choices = substr('1234567890', 1, last - first + 1)
-        prompt = choices
-        if (allowEnter) then prompt = prompt'/Enter'
-        if (allowESC) then do
-            prompt = prompt'/Esc'
-            choices = choices||'1B'x
-        end
-        if (first > 1) then do
-            extChoices = extChoices||'49'x
-            prompt = prompt'/PgUp'
-            call SaySay '^^'
-        end
-        do i = first to last
-            ii = i - first + 1
-            if (ii == 10) then ii = 0
-            call SaySay ii')' value(stem'.'i)
-        end
-        if (last < count) then do
-            extChoices = extChoices||'51'x
-            prompt = prompt'/PgDn'
-            call SaySay 'vv'
-        end
-        say
-        def = ''
-        if (default \== '') then do
-            def = default - first + 1
-            if (def < 1 | def > 10) then def = ''
-            else if (def == 10) then def = 0
-        end
-        call SayPrompt '['prompt'] ', 1
-        n = ReadChoice(choices, extChoices, def, mode)
-        say
-        say
-        if (n == '1B'x) then do
-            return -1
-        end
-        if (n == '0E49'x) then do
-            first = first - 10
-            iterate
-        end
-        if (n == '0E51'x) then do
-            first = first + 10
-            iterate
-        end
-        if (n \== '') then do
-            if (n == 0) then n = 10
-            n = n + first - 1
-        end
-        leave
-    end
-    return n
-
-/**
- *  Reads a one-key choice from the keyboard.
- *  user. Letters in the mode argument have the following meanings:
- *
- *      E -- allow to press Enter w/o a choice (will return '')
- *      C -- ESC can be pressed to cancel selection (will return '1B'x)
- *      I -- ignore case of pressed letters
- *
- *  @param  choices     string of allowed one-key choices
- *  @param  extChoices  string of allowed one-extended-key choices
- *  @param  default     default choice (can be a key from choices)
- *  @param  mode        input mode string consisting of letters as described above
- *  @return
- *      entered key (prefixed with 'E0'x if from extChoices)
- */
-ReadChoice: procedure expose (Globals)
-    parse arg choices, extChoices, default, mode
-    mode = translate(mode)
-    ignoreCase = pos('I', mode) > 0
-    allowEnter = pos('E', mode) > 0
-    allowCancel = pos('C', mode) > 0
-    choice = default
-    call charout, choice
-    if (ignoreCase) then choice = translate(choice)
-    extended = 0
-    do forever
-        key = SysGetKey('NOECHO')
-        if (key == 'E0'x) then do
-            extended = 1
-            iterate
-        end
-        if (\extended & ignoreCase) then key = translate(key)
-        select
-            when (allowCancel & \extended & key == '1B'x) then do
-                choice = key
-                leave
-            end
-            when (choice == '' & \extended & verify(key, choices) == 0) then do
-                choice = key
-            end
-            when (extended & verify(key, extChoices) == 0) then do
-                choice = '0E'x||key
-                leave
-            end
-            when (\extended & key == '08'x & choice \== '') then do
-                /* backspace pressed */
-                call charout, key' '
-                choice = ''
-            end
-            when (\extended & key == '0D'x & (choice \== '' | allowEnter)) then do
-                leave
-            end
-            otherwise do
-                extended = 0
-                iterate
-            end
-        end
-        call charout, key
-        extended = 0
-    end
-    return choice
-
-/**
- *  Shows a menu to select a path from the list of entries.
- *
- *  A special menu entry is automatically added as the last choice that allows
- *  to enter a new location to search for valid paths (this operation will
- *  completely overwrite all the menu entries passed to this function in the
- *  stem).
- *
- *  Letters in the mode argument have the following meanings:
- *
- *      C -- ESC can be pressed to cancel selection (will return '')
- *
- *  @param  stem
- *      stem containing entries to choose from (must be prefixed by a name from
- *      Globals), stem'.!choice' must contain a default choice (or '')
- *  @param  prompt
- *      prompt to display
- *  @param  searchPattern
- *      pattern to search for when selecting suitable paths in the new location
- *      (can include the directory prefix, but wildcards are supported in the
- *      filename part only)
- *  @param  checkPath
- *      name of the funciton to check the path. The first argument is the path
- *      to check. If the second argument is 0, it means a preliminary check (i.e.
- *      the path is the result of the SysFileThree procedure); checkPath must
- *      return a validated (and probably modified) path on success or '' if the
- *       path is invalid. If the second argument is 1, it's a final check
- *      (path is what returned by the preliminary check call); checkPath must
- *      return either 1 on success or 0 on failure. The final check is done
- *      right before calling checkVer, so it can set some global variables in
- *      order to pass necessary data to checkVer and to the global level for
- *      further configuration.
- *  @param  checkVer
- *      name of the funciton to check the version. The argument is a path to
- *      check the version for (as returned by checkPath after the preliminary
- *      check call).
- *  @param  errPath
- *      error message to display when a path check fails (%1 will be replaced
- *      with the failed path name)
- *  @param  mode
- *      input mode string consisting of letters as described above
- *  @return
- *      the selected path or '' if the selection was canceled.
- *      If a non-empty path is returned, stem'.!choice' will contain
- *      the selected item number, otherwise it will be empty.
- */
-MenuSelectPath: procedure expose (Globals)
-
-    parse arg stem, prompt, searchPattern, checkPath, checkVer, errPath, mode
-
-    mode = translate(mode)
-    if (pos('C', mode) > 0) then mode = 'C'
-    else mode = ''
-
-    if (symbol('Static.!MenuSelectPath.!Recent') \= 'VAR') then
-        Static.!MenuSelectPath.!Recent = ''
-
-    do forever
-
-        n = value(stem'.0') + 1
-        call SysStemInsert stem, n, '[type a location...]'
-        if (n == 1) then default = 1
-        else default = value(stem'.!choice')
-
-        choice = GetChoice(prompt, stem, default, mode)
-        call SysStemDelete stem, n
-
-        if (choice == -1) then return '' /* canceled */
-
-        if (choice == n) then do
-            call value stem'.!choice', ''
-            path = InputDir('Enter a location where to start searching from ',
-                            '(or Esc to cancel):',,
-                            Static.!MenuSelectPath.!Recent)
-            if (path == '') then iterate /* canceled */
-            Static.!MenuSelectPath.!Recent = path
-            call SaySay 'Please wait...'
-            say
-            patternPath = translate(filespec('D', searchPattern) || filespec('P', searchPattern))
-            patternName = filespec('N', searchPattern)
-            call SysFileTree FixDirNoSlash(path)'\'patternName, 'found', 'FSO'
-            found2.0 = 0
-            if (found.0 > 0) then do
-                do i = 1 to found.0
-                    dir = filespec('D', found.i) || filespec('P', found.i)
-                    /* check that the found path ends with the pattern path */
-                    if (translate(right(dir, length(patternPath))) \== patternPath) then
-                        iterate
-                    dir = left(dir, length(dir) - length(patternPath))
-                    /* check path validity  */
-                    interpret 'dir = 'checkPath'("'dir'")'
-                    if (dir \== '') then
-                        call SysStemInsert 'found2', 1, FixDir(dir)
-                end
-            end
-            if (found2.0 > 0) then do
-                call SysStemCopy 'found2', stem
-                /* SysStemCopy is bogus and doesn't copy the count field... */
-                call value stem'.0', found2.0
-                call value stem'.!choice', ''
-                call value stem'.!changed', 1
-                iterate
-            end
-        end
-        else do
-            path = value(stem'.'choice)
-            /* check path validity and tell the version check will be done next */
-            interpret 'ok = 'checkPath'("'path'", 1)'
-            if (ok) then do
-                if (value(stem'.!choice') \== choice) then
-                    call value stem'.!changed', 1
-                interpret 'ok = 'checkVer'("'path'")'
-                if (ok) then do
-                    call value stem'.!choice', choice
-                    return path
-                end
-                call value stem'.!choice', ''
-                iterate
-            end
-        end
-
-        call SayErr Replace(errPath, '%1', path)
-        say
-        call value stem'.!choice', ''
-
-    end
-
-/**
  *  Encloses the given path with quotes if it contains
  *  space characters, otherwise returns it w/o changes.
@@ -1349,6 +1368,6 @@
     parse arg code
     /* protect against recursive calls */
-    if (value('G.!Done_done') == 1) then exit code
-    call value 'G.!Done_done', 1
+    if (value('G.Done_done') == 1) then exit code
+    call value 'G.Done_done', 1
     /* cleanup stuff goes there */
     /* ... */
