Changeset 14
- Timestamp:
- May 22, 2009, 1:53:06 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.cmd
r11 r14 28 28 G.ScreenWidth = -1 29 29 G.ScreenHeight = -1 30 30 G.Verbose = 1 31 31 32 32 /* initialize global variables */ … … 46 46 G.EditionString = "Open Source" 47 47 G.QT_EDITION = "QT_EDITION_OPENSOURCE" 48 49 /* So far, GCC only */50 G.PLATFORM = "os2-g++"51 48 52 49 … … 101 98 /* the directory of this script is the "source tree */ 102 99 G.RelPath = G.ScriptDir 100 /* the current directory is the "build tree" or "object tree" */ 101 G.OutPath = directory() 103 102 104 103 /* reset the vars file */ … … 116 115 /* QTDIR may be set and point to an old or system-wide Qt installation */ 117 116 call UnsetEnv "QTDIR" 117 118 /* @todo cleanup the option list below when it's clear which options are 119 * inappropriate for OS/2 */ 118 120 119 121 /* initalize internal variables */ … … 269 271 G.QT_INSTALL_DATA = "" 270 272 G.QT_INSTALL_TRANSLATIONS = "" 271 G.QT_INSTALL_SETTINGS = ""272 273 G.QT_INSTALL_EXAMPLES = "" 273 274 G.QT_INSTALL_DEMOS = "" … … 411 412 --------------------------------------------------------------------------*/ 412 413 414 /* so far, we default to GCC on OS/2 */ 415 if (G.PLATFORM == "") then G.PLATFORM = "os2-g++" 416 if (DirExists(G.PLATFORM)) then G.QMAKESPEC = G.PLATFORM 417 else G.QMAKESPEC = G.RelPath"\mkspecs\"G.PLATFORM 418 419 /* Cross-builds are not supported */ 420 G.XPLATFORM = G.PLATFORM 421 G.XQMAKESPEC = G.QMAKESPEC 422 G.QT_CROSS_COMPILE = "no" 423 424 /* check specified platforms are supported */ 425 if (\DirExists(G.XQMAKESPEC)) then do 426 call SayErr 427 call SayErr " The specified system/compiler is not supported:" 428 call SayErr 429 call SayErr " "G.XQMAKESPEC 430 call SayErr 431 call SayErr " Please see the README file for a complete list." 432 call SayErr 433 call Done 2 434 end 435 if (\FileExists(G.XQMAKESPEC"\qplatformdefs.h")) then do 436 call SayErr 437 call SayErr " The specified system/compiler port is not complete:" 438 call SayErr 439 call SayErr " "G.XQMAKESPEC"\qplatformdefs.h" 440 call SayErr 441 call SayErr " Please see the README file for a complete list." 442 call SayErr 443 call Done 2 444 end 445 446 call SayVerbose "Determining system architecture..." 447 448 if (G.CFG_HOST_ARCH == "") then G.CFG_HOST_ARCH = "os2" 449 450 /* Cross-builds are not supported */ 451 G.CFG_ARCH = G.CFG_HOST_ARCH 452 453 if (DirExists(G.RelPath"\src\corelib\arch\"G.CFG_ARCH)) then 454 call SayVerbose " '"G.CFG_ARCH"' is supported" 455 else do 456 call SayVerbose " '"G.CFG_ARCH"' is unsupported, using 'generic'" 457 G.CFG_ARCH = "generic" 458 end 459 460 call SayVerbose "System architecture: '"G.CFG_ARCH"'" 461 462 /*-------------------------------------------------------------------------- 463 tests that don't need qmake (must be run before displaying help) 464 --------------------------------------------------------------------------*/ 465 466 /* setup the build parts */ 467 if (G.CFG_BUILD_PARTS == "") then 468 G.CFG_BUILD_PARTS = G.QT_DEFAULT_BUILD_PARTS 469 do i = 1 to words(G.CFG_NOBUILD_PARTS) 470 j = wordpos(word(G.CFG_NOBUILD_PARTS, i), G.CFG_BUILD_PARTS) 471 if (j > 0) 472 call delword G.CFG_BUILD_PARTS, j 473 end 474 if (wordpos("libs", G.CFG_BUILD_PARTS) == 0) then 475 G.CFG_BUILD_PARTS = Join(G.CFG_BUILD_PARTS, "libs") 476 477 /*-------------------------------------------------------------------------- 478 post process QT_INSTALL_* variables 479 --------------------------------------------------------------------------*/ 480 481 /* prefix */ 482 if (G.QT_INSTALL_PREFIX == "") then 483 G.QT_INSTALL_PREFIX = G.OutPath 484 /* docs */ 485 if (G.QT_INSTALL_DOCS == "") then 486 G.QT_INSTALL_DOCS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\docs" 487 /* headers */ 488 if (G.QT_INSTALL_HEADERS == "") then 489 G.QT_INSTALL_HEADERS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\include" 490 /* libs */ 491 if (G.QT_INSTALL_LIBS == "") then 492 G.QT_INSTALL_LIBS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\lib" 493 /* bins */ 494 if (G.QT_INSTALL_BINS == "") then 495 G.QT_INSTALL_BINS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\bin" 496 /* plugins */ 497 if (G.QT_INSTALL_PLUGINS == "") then 498 G.QT_INSTALL_PLUGINS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\plugins" 499 /* data */ 500 if (G.QT_INSTALL_DATA == "") then 501 G.QT_INSTALL_DATA = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\data" 502 /* translations */ 503 if (G.QT_INSTALL_TRANSLATIONS == "") then 504 G.QT_INSTALL_TRANSLATIONS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\translations" 505 /* examples */ 506 if (G.QT_INSTALL_EXAMPLES == "") then 507 G.QT_INSTALL_EXAMPLES = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\examples" 508 /* demos */ 509 if (G.QT_INSTALL_DEMOS == "") then 510 G.QT_INSTALL_DEMOS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\demos" 511 512 /*-------------------------------------------------------------------------- 513 help - interactive parts of the script _after_ this section please 514 --------------------------------------------------------------------------*/ 515 516 /* next, emit a usage message if something failed. */ 517 if (G.OPT_HELP == "yes") then do 518 /* @todo */ 519 call SaySay "TODO: Help message" 520 end 521 522 /* ------------------------------------------------------------------------- 523 LICENSING, INTERACTIVE PART 524 --------------------------------------------------------------------------*/ 525 526 call SaySay 527 call SaySay "This is the Qt for OS/2 "G.EditionString" Edition." 528 call SaySay 529 530 if (G.Edition == "OpenSource") then 531 do while 1 532 call SaySay "You are licensed to use this software under the terms of" 533 call SaySay "the GNU General Public License (GPL) versions 3." 534 call SaySay "You are also licensed to use this software under the terms of" 535 call SaySay "the Lesser GNU General Public License (LGPL) versions 2.1." 536 call SaySay 537 if (G.OPT_CONFIRM_LICENSE == "yes") then do 538 call SaySay "You have already accepted the terms of the license." 539 acceptance = "yes" 540 end 541 else do 542 call SaySay "Type '3' to view the GNU General Public License version 3." 543 call SaySay "Type 'L' to view the Lesser GNU General Public License version 2.1." 544 call SaySay "Type 'yes' to accept this license offer." 545 call SaySay "Type 'no' to decline this license offer." 546 call SaySay 547 call SaySay "Do you accept the terms of either license?" 548 acceptance = InputLine() 549 end 550 if (acceptance == "yes") then 551 leave 552 else if (acceptance == "no") then do 553 call SaySay "You are not licensed to use this software." 554 call Done 1 555 end 556 else if (acceptance == "3") then 557 address "cmd" "type" G.RelPath"\LICENSE.GPL3 | more" 558 else if (acceptance == "L") then 559 address "cmd" "type" G.RelPath"\LICENSE.LGPL | more" 560 call SaySay 561 end 562 else 563 signal Nonsense 564 565 /*-------------------------------------------------------------------------- 566 generate qconfig.cpp 567 --------------------------------------------------------------------------*/ 568 569 if (\DirExists(G.OutPath"\src\corelib\global")) then 570 call MakeDir G.OutPath"\src\corelib\global" 571 572 qconfig_cpp = G.OutPath"\src\corelib\global\qconfig.cpp" 573 574 config_cpp_str =, 575 '/* License Info */'G.EOL||, 576 'static const char qt_configure_licensee_str [260 + 12] = "qt_lcnsuser='CPPPath(MaxLen(G.Licensee,259))'";'G.EOL||, 577 'static const char qt_configure_licensed_products_str [260 + 12] = "qt_lcnsprod='CPPPath(MaxLen(G.Edition,259))'";'G.EOL||, 578 '/* Installation Info */'G.EOL||, 579 'static const char qt_configure_prefix_path_str [260 + 12] = "qt_prfxpath='CPPPath(MaxLen(G.QT_INSTALL_PREFIX,259))'";'G.EOL||, 580 'static const char qt_configure_documentation_path_str[260 + 12] = "qt_docspath='CPPPath(MaxLen(G.QT_INSTALL_DOCS,259))'";'G.EOL||, 581 'static const char qt_configure_headers_path_str [260 + 12] = "qt_hdrspath='CPPPath(MaxLen(G.QT_INSTALL_HEADERS,259))'";'G.EOL||, 582 'static const char qt_configure_libraries_path_str [260 + 12] = "qt_libspath='CPPPath(MaxLen(G.QT_INSTALL_LIBS,259))'";'G.EOL||, 583 'static const char qt_configure_binaries_path_str [260 + 12] = "qt_binspath='CPPPath(MaxLen(G.QT_INSTALL_BINS,259))'";'G.EOL||, 584 'static const char qt_configure_plugins_path_str [260 + 12] = "qt_plugpath='CPPPath(MaxLen(G.QT_INSTALL_PLUGINS,259))'";'G.EOL||, 585 'static const char qt_configure_data_path_str [260 + 12] = "qt_datapath='CPPPath(MaxLen(G.QT_INSTALL_DATA,259))'";'G.EOL||, 586 'static const char qt_configure_translations_path_str [260 + 12] = "qt_trnspath='CPPPath(MaxLen(G.QT_INSTALL_TRANSLATIONS,259))'";'G.EOL||, 587 'static const char qt_configure_examples_path_str [260 + 12] = "qt_xmplpath='CPPPath(MaxLen(G.QT_INSTALL_EXAMPLES,259))'";'G.EOL||, 588 'static const char qt_configure_demos_path_str [260 + 12] = "qt_demopath='CPPPath(MaxLen(G.QT_INSTALL_DEMOS,259))'";'G.EOL||, 589 '/* strlen( "qt_lcnsxxxx" ) == 12 */'G.EOL||, 590 '#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;'G.EOL||, 591 '#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;'G.EOL||, 592 '#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;'G.EOL||, 593 '#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;'G.EOL||, 594 '#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;'G.EOL||, 595 '#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;'G.EOL||, 596 '#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;'G.EOL||, 597 '#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;'G.EOL||, 598 '#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;'G.EOL||, 599 '#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;'G.EOL||, 600 '#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;'G.EOL||, 601 '#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;'G.EOL||, 602 G.EOL 603 604 /* avoid unecessary rebuilds by copying only if qconfig.cpp has changed */ 605 create = \FileExists(qconfig_cpp) 606 if (\create) then create = CompareFileToVar(qconfig_cpp, config_cpp_str) \= 0 607 if (create) then do 608 call DeleteFile qconfig_cpp 609 call charout qconfig_cpp, config_cpp_str 610 call charout qconfig_cpp 611 end 612 613 /*-------------------------------------------------------------------------- 614 build qmake 615 --------------------------------------------------------------------------*/ 616 617 call SaySay "Creating qmake. Please wait..." 618 619 /* take the correct Makefile and fix it */ 620 MakefilePlatform = G.RelPath"\qmake\Makefile."G.PLATFORM 621 Makefile = G.OutPath"\qmake\Makefile" 622 623 Makefile_str = charin(MakefilePlatform, 1, chars(MakefilePlatform)) 624 if (Makefile_str == "") then do 625 SayError "'"MakefilePlatform"' not found." 626 call Done 1 627 end 628 629 Makefile_str =, 630 '# AutoGenerated by configure.cmd'G.EOL||, 631 'BUILD_PATH = 'QuotePath(G.OutPath)||G.EOL||, 632 'SOURCE_PATH = 'QuotePath(G.RelPath)||G.EOL||, 633 'QMAKESPEC = 'G.PLATFORM||G.EOL||, 634 'QMAKE_OPENSOURCE_EDITION = yes'G.EOL||G.EOL||, 635 Makefile_str 636 637 /* avoid unecessary rebuilds by copying only if Makefile has changed */ 638 create = \FileExists(Makefile) 639 if (\create) then create = CompareFileToVar(Makefile, Makefile_str) \= 0 640 if (create) then do 641 call DeleteFile Makefile 642 call charout Makefile, Makefile_str 643 call charout Makefile 644 end 645 646 /* mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't 647 * be set once configured */ 648 /* 649 @todo 650 */ 651 652 /* create temporary qconfig.h for compiling qmake, if it doesn't exist 653 * when building qmake, we use #defines for the install paths, 654 * however they are real functions in the library */ 655 656 old_qconfig_h = "" 657 qconfig_h = G.OutPath"\src\corelib\global\qconfig.h" 658 qmake_qconfig_h = qconfig_h".qmake" 659 if (FileExists(qconfig_h)) then do 660 old_qconfig_h = qconfig_h 661 call MoveFile old_qconfig_h, old_qconfig_h".old" 662 end 663 664 if (\FileExists(qmake_qconfig_h)) then do 665 call charout qmake_qconfig_h, '/* All features enabled while building qmake */'G.EOL 666 call charout qmake_qconfig_h 667 end 668 669 call MoveFile qmake_qconfig_h, qconfig_h 670 list.1 = G.OutPath"\include\QtCore\qconfig.h" 671 list.2 = G.OutPath"\include\Qt\qconfig.h" 672 list.0 = 2 673 do i = 1 to list.0 674 if (\FileExists(list.i)) then do 675 call charout list.i, '#include "..\..\src\corelib\global\qconfig.h"'G.EOL 676 call charout list.i 677 end 678 end 679 680 curdir = directory(G.OutPath"\qmake") 681 /* @todo enable make */ 682 say 'address' "cmd" G.MAKE 683 make_rc = 0 /*rc*/ 684 685 /* put back original qconfig.h */ 686 call MoveFile qconfig_h, qmake_qconfig_h 687 if (old_qconfig_h \== "") then 688 call MoveFile old_qconfig_h".old", old_qconfig_h 689 690 /* exit on failure */ 691 if (make_rc \= 0) then 692 call Done 2 693 413 694 signal Nonsense 414 695 return … … 439 720 utility functions 440 721 ------------------------------------------------------------------------------*/ 722 723 MaxLen: procedure expose (Globals) 724 parse arg aStr, aMaxLen 725 if (length(aStr) > aMaxLen) then return left(aStr,aMaxLen) 726 return aStr 441 727 442 728 CompareFileToVar: procedure expose (Globals) … … 474 760 return 475 761 762 MoveFile: procedure expose (Globals) 763 parse arg fileFrom, fileTo 764 if (filespec('D', fileFrom) == filespec('D', fileTo)) then 765 fileTo = filespec('P', fileTo)||filespec('N', fileTo) 766 else do 767 call SayErr 'FATAL: Could not move '''fileFrom''' to '''fileTo'''!' 768 call SayErr 'Source and target are on different drives' 769 call Done 1 770 end 771 call DeleteFile fileTo 772 address 'cmd' 'move' fileFrom fileTo '1>nul 2>nul' 773 if (rc \== 0) then do 774 call SayErr 'FATAL: Could not move '''fileFrom''' to '''fileTo'''!' 775 call SayErr 'move returned 'rc 776 call Done 1 777 end 778 return 779 476 780 MakeDir: procedure expose (Globals) 781 /* @todo teach it to create all non-existing intermediate dirs */ 477 782 parse arg path 478 783 rc = SysMkDir(path) … … 503 808 if (noeol) then call charout, '>>> 'str 504 809 else say '>>> 'str 810 return 811 812 SayVerbose: procedure expose (Globals) 813 parse arg str, noeol 814 if (G.Verbose) then call SaySay str, noeol 505 815 return 506 816 … … 527 837 parse value SysCurPos() with row col 528 838 col = col + delta 529 row = row + (col % G. !ScreenWidth)839 row = row + (col % G.ScreenWidth) 530 840 if (col < 0) then 531 841 row = row - 1 532 col = col // G. !ScreenWidth842 col = col // G.ScreenWidth 533 843 if (col < 0) then 534 col = col + G. !ScreenWidth844 col = col + G.ScreenWidth 535 845 call SysCurPos row, col 536 846 return … … 572 882 573 883 parse arg prompt, default, mode 574 call SaySay prompt 884 885 if (length(prompt) > 0) then 886 call SaySay prompt 575 887 say 576 888 … … 703 1015 704 1016 /** 705 * Shows a Yes/No choice.706 *707 * @param prompt prompt to show (specify '' to suppress the prompt)708 * @param default default choice:709 * '' - no default choice710 * 'Y' or 1 - default is yes711 * other - default is no712 * @return713 * 1 if Yes is selected, otherwise 0714 */715 GetYesNo: procedure expose (Globals)716 parse arg prompt, default717 default = translate(default)718 if (default == 1) then default = 'Y'719 else if (default \== '' & default \== 'Y') then default = 'N'720 if (prompt \= '') then call SaySay prompt721 say722 call SayPrompt '[YN] ', 1723 yn = ReadChoice('YN',, default, 'I')724 say725 say726 return (yn == 'Y')727 728 /**729 * Shows a menu of choices and returns the menu item number selected by the730 * user. Letters in the mode argument have the following meanings:731 *732 * E -- allow to press Enter w/o a choice (will return '')733 * C -- ESC can be pressed to cancel selection (will return -1)734 *735 * @param prompt prompt to display736 * @param stem stem containing a list of choices737 * @param default default choice738 * @param mode input mode string consisting of letters as described above739 * @return740 * selected menu item number741 */742 GetChoice: procedure expose (Globals)743 parse arg prompt, stem, default, mode744 mode = translate(mode)745 allowEnter = pos('E', mode) > 0746 allowESC = pos('C', mode) > 0747 count = value(stem'.0')748 if (count == 0) then return749 call SaySay prompt750 say751 first = 1752 do forever753 extChoices = ''754 last = first + 9755 if (last > count) then last = count756 choices = substr('1234567890', 1, last - first + 1)757 prompt = choices758 if (allowEnter) then prompt = prompt'/Enter'759 if (allowESC) then do760 prompt = prompt'/Esc'761 choices = choices||'1B'x762 end763 if (first > 1) then do764 extChoices = extChoices||'49'x765 prompt = prompt'/PgUp'766 call SaySay '^^'767 end768 do i = first to last769 ii = i - first + 1770 if (ii == 10) then ii = 0771 call SaySay ii')' value(stem'.'i)772 end773 if (last < count) then do774 extChoices = extChoices||'51'x775 prompt = prompt'/PgDn'776 call SaySay 'vv'777 end778 say779 def = ''780 if (default \== '') then do781 def = default - first + 1782 if (def < 1 | def > 10) then def = ''783 else if (def == 10) then def = 0784 end785 call SayPrompt '['prompt'] ', 1786 n = ReadChoice(choices, extChoices, def, mode)787 say788 say789 if (n == '1B'x) then do790 return -1791 end792 if (n == '0E49'x) then do793 first = first - 10794 iterate795 end796 if (n == '0E51'x) then do797 first = first + 10798 iterate799 end800 if (n \== '') then do801 if (n == 0) then n = 10802 n = n + first - 1803 end804 leave805 end806 return n807 808 /**809 * Reads a one-key choice from the keyboard.810 * user. Letters in the mode argument have the following meanings:811 *812 * E -- allow to press Enter w/o a choice (will return '')813 * C -- ESC can be pressed to cancel selection (will return '1B'x)814 * I -- ignore case of pressed letters815 *816 * @param choices string of allowed one-key choices817 * @param extChoices string of allowed one-extended-key choices818 * @param default default choice (can be a key from choices)819 * @param mode input mode string consisting of letters as described above820 * @return821 * entered key (prefixed with 'E0'x if from extChoices)822 */823 ReadChoice: procedure expose (Globals)824 parse arg choices, extChoices, default, mode825 mode = translate(mode)826 ignoreCase = pos('I', mode) > 0827 allowEnter = pos('E', mode) > 0828 allowCancel = pos('C', mode) > 0829 choice = default830 call charout, choice831 if (ignoreCase) then choice = translate(choice)832 extended = 0833 do forever834 key = SysGetKey('NOECHO')835 if (key == 'E0'x) then do836 extended = 1837 iterate838 end839 if (\extended & ignoreCase) then key = translate(key)840 select841 when (allowCancel & \extended & key == '1B'x) then do842 choice = key843 leave844 end845 when (choice == '' & \extended & verify(key, choices) == 0) then do846 choice = key847 end848 when (extended & verify(key, extChoices) == 0) then do849 choice = '0E'x||key850 leave851 end852 when (\extended & key == '08'x & choice \== '') then do853 /* backspace pressed */854 call charout, key' '855 choice = ''856 end857 when (\extended & key == '0D'x & (choice \== '' | allowEnter)) then do858 leave859 end860 otherwise do861 extended = 0862 iterate863 end864 end865 call charout, key866 extended = 0867 end868 return choice869 870 /**871 * Shows a menu to select a path from the list of entries.872 *873 * A special menu entry is automatically added as the last choice that allows874 * to enter a new location to search for valid paths (this operation will875 * completely overwrite all the menu entries passed to this function in the876 * stem).877 *878 * Letters in the mode argument have the following meanings:879 *880 * C -- ESC can be pressed to cancel selection (will return '')881 *882 * @param stem883 * stem containing entries to choose from (must be prefixed by a name from884 * Globals), stem'.!choice' must contain a default choice (or '')885 * @param prompt886 * prompt to display887 * @param searchPattern888 * pattern to search for when selecting suitable paths in the new location889 * (can include the directory prefix, but wildcards are supported in the890 * filename part only)891 * @param checkPath892 * name of the funciton to check the path. The first argument is the path893 * to check. If the second argument is 0, it means a preliminary check (i.e.894 * the path is the result of the SysFileThree procedure); checkPath must895 * return a validated (and probably modified) path on success or '' if the896 * path is invalid. If the second argument is 1, it's a final check897 * (path is what returned by the preliminary check call); checkPath must898 * return either 1 on success or 0 on failure. The final check is done899 * right before calling checkVer, so it can set some global variables in900 * order to pass necessary data to checkVer and to the global level for901 * further configuration.902 * @param checkVer903 * name of the funciton to check the version. The argument is a path to904 * check the version for (as returned by checkPath after the preliminary905 * check call).906 * @param errPath907 * error message to display when a path check fails (%1 will be replaced908 * with the failed path name)909 * @param mode910 * input mode string consisting of letters as described above911 * @return912 * the selected path or '' if the selection was canceled.913 * If a non-empty path is returned, stem'.!choice' will contain914 * the selected item number, otherwise it will be empty.915 */916 MenuSelectPath: procedure expose (Globals)917 918 parse arg stem, prompt, searchPattern, checkPath, checkVer, errPath, mode919 920 mode = translate(mode)921 if (pos('C', mode) > 0) then mode = 'C'922 else mode = ''923 924 if (symbol('Static.!MenuSelectPath.!Recent') \= 'VAR') then925 Static.!MenuSelectPath.!Recent = ''926 927 do forever928 929 n = value(stem'.0') + 1930 call SysStemInsert stem, n, '[type a location...]'931 if (n == 1) then default = 1932 else default = value(stem'.!choice')933 934 choice = GetChoice(prompt, stem, default, mode)935 call SysStemDelete stem, n936 937 if (choice == -1) then return '' /* canceled */938 939 if (choice == n) then do940 call value stem'.!choice', ''941 path = InputDir('Enter a location where to start searching from ',942 '(or Esc to cancel):',,943 Static.!MenuSelectPath.!Recent)944 if (path == '') then iterate /* canceled */945 Static.!MenuSelectPath.!Recent = path946 call SaySay 'Please wait...'947 say948 patternPath = translate(filespec('D', searchPattern) || filespec('P', searchPattern))949 patternName = filespec('N', searchPattern)950 call SysFileTree FixDirNoSlash(path)'\'patternName, 'found', 'FSO'951 found2.0 = 0952 if (found.0 > 0) then do953 do i = 1 to found.0954 dir = filespec('D', found.i) || filespec('P', found.i)955 /* check that the found path ends with the pattern path */956 if (translate(right(dir, length(patternPath))) \== patternPath) then957 iterate958 dir = left(dir, length(dir) - length(patternPath))959 /* check path validity */960 interpret 'dir = 'checkPath'("'dir'")'961 if (dir \== '') then962 call SysStemInsert 'found2', 1, FixDir(dir)963 end964 end965 if (found2.0 > 0) then do966 call SysStemCopy 'found2', stem967 /* SysStemCopy is bogus and doesn't copy the count field... */968 call value stem'.0', found2.0969 call value stem'.!choice', ''970 call value stem'.!changed', 1971 iterate972 end973 end974 else do975 path = value(stem'.'choice)976 /* check path validity and tell the version check will be done next */977 interpret 'ok = 'checkPath'("'path'", 1)'978 if (ok) then do979 if (value(stem'.!choice') \== choice) then980 call value stem'.!changed', 1981 interpret 'ok = 'checkVer'("'path'")'982 if (ok) then do983 call value stem'.!choice', choice984 return path985 end986 call value stem'.!choice', ''987 iterate988 end989 end990 991 call SayErr Replace(errPath, '%1', path)992 say993 call value stem'.!choice', ''994 995 end996 997 /**998 1017 * Encloses the given path with quotes if it contains 999 1018 * space characters, otherwise returns it w/o changes. … … 1349 1368 parse arg code 1350 1369 /* protect against recursive calls */ 1351 if (value('G. !Done_done') == 1) then exit code1352 call value 'G. !Done_done', 11370 if (value('G.Done_done') == 1) then exit code 1371 call value 'G.Done_done', 1 1353 1372 /* cleanup stuff goes there */ 1354 1373 /* ... */
Note:
See TracChangeset
for help on using the changeset viewer.