Changeset 22073 for branches


Ignore:
Timestamp:
Aug 15, 2014, 6:35:57 PM (11 years ago)
Author:
rousseau
Message:

Test Commit 4: line endings -- second conversion run.

The first run missed the files in the scratch directory and some
in the root for some reason. Repeated the process for those.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/swt/git.diff

    r22072 r22073  
    1 diff --git a/src/win32k/kKrnlLib/tools/ProcessZip.cmd b/src/win32k/kKrnlLib/tools/ProcessZip.cmd
    2 index 10c896b..952537d 100644
    3 --- a/src/win32k/kKrnlLib/tools/ProcessZip.cmd
    4 +++ b/src/win32k/kKrnlLib/tools/ProcessZip.cmd
    5 @@ -1,329 +1,329 @@
    6 -/* $Id: ProcessZip.cmd,v 1.1 2002-04-07 01:44:47 bird Exp $
    7 - *
    8 - * Testcase Zipped Kernel Processer.
    9 - *
    10 - * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    11 - *
    12 - * GPL
    13 - *
    14 - */
    15 -
    16 -/*
    17 - * Config.
    18 - */
    19 -sSyms = 'h:\kernels\syms';
    20 -sSDFs = 'h:\kernels\sdfs';
    21 -sPMDF = 'f:\pmdf';
    22 -
    23 -/* Temp dir. */
    24 -sTmp = value('TMP',,'OS2ENVIRONMENT');
    25 -if (sTmp = '') then
    26 -    sTmp = value('TEMP',,'OS2ENVIRONMENT');
    27 -if (sTmp = '') then
    28 -    sTmp = value('TMPDIR',,'OS2ENVIRONMENT');
    29 -if (sTmp = '') then
    30 -do
    31 -    say 'No TMP/TEMP/TMPDIR env variable.'
    32 -    exit(2);
    33 -end
    34 -
    35 -
    36 -/*
    37 - * Input
    38 - */
    39 -parse arg sZip sDummy
    40 -
    41 -if ((sZip = '') | (sDummy <> '') | (stream(sZip, 'c', 'query exist') = '')) then
    42 -do
    43 -    say 'Syntax error or invalid filename!'
    44 -    say 'Syntax: ProcessZip.cmd <zipfile name>'
    45 -    exit(1);
    46 -end
    47 -
    48 -
    49 -/*
    50 - * zip type?
    51 - */
    52 -if (translate(substr(filespec('name', sZip), 1, 2)) = 'DF' ) then
    53 -    rc = ProcessDumpFormatterZip(sZip);
     1diff --git a/$/rexx-with-CRLF.cmd b/$/rexx-with-CRLF.cmd
     2index 82798b2..e64ab26 100644
     3--- a/$/rexx-with-CRLF.cmd
     4+++ b/$/rexx-with-CRLF.cmd
     5@@ -1,6 +1,6 @@
     6-/* Rexx */
     7-
     8-say '';
     9-say 'This script was git-svn committed with CRLF line endings.';
     10-say 'When checked out, this should still be the case.';
     11-say '';
     12+/* Rexx */
     13+
     14+say '';
     15+say 'This script was git-svn committed with CRLF line endings.';
     16+say 'When checked out, this should still be the case.';
     17+say '';
     18diff --git a/$/rexx-with-LF.cmd b/$/rexx-with-LF.cmd
     19index a096cf3..269bcab 100644
     20--- a/$/rexx-with-LF.cmd
     21+++ b/$/rexx-with-LF.cmd
     22@@ -1,8 +1,8 @@
     23-/* Rexx */
     24-
     25-say '';
     26-say 'This script was git-committed with only LF line endings.';
     27-say 'When checked out with git-svn it should be converted to CRLF';
     28-say 'provided that the correct .gitattributes file is present.';
     29-say 'Behavior when checking out with svn will be tested next.';
     30-say '';
     31+/* Rexx */
     32+
     33+say '';
     34+say 'This script was git-committed with only LF line endings.';
     35+say 'When checked out with git-svn it should be converted to CRLF';
     36+say 'provided that the correct .gitattributes file is present.';
     37+say 'Behavior when checking out with svn will be tested next.';
     38+say '';
     39diff --git a/Config.kmk b/Config.kmk
     40index 612f721..ded33f8 100644
     41--- a/Config.kmk
     42+++ b/Config.kmk
     43@@ -1,322 +1,322 @@
     44-## @file
     45-# Global Project Configuration File
     46-#
     47-
     48-#------------------------------------------------------------------------------
     49-# Global definitions
     50-#------------------------------------------------------------------------------
     51-
     52-#
     53-# @todo kBuild forgets to do that on OS/2
     54-#
     55-INST_DLL = bin/
     56-
     57-#
     58-# Watcom Linker is required because of some Watcom-specific directives (used
     59-# e.g. to compensate for the lack of SEGMENTS support in .DEF in emxomfld, see
     60-# svn.netlabs.org/libc/ticket/252). Besides, it's more stable than the outdated
     61-# IBM linker.
     62-#
     63-ifn1of ($(EMXOMFLD_TYPE),WLINK wlink)
     64-$(error You must use Watcom Linker and set EMXOMFLD_TYPE to WLINK (it's now $(EMXOMFLD_TYPE)))
     65-endif
     66-
     67-#
     68-# TCPV40HDRS requires an alternative libsocket.lib located in a separate directory.
     69-# Try to deduce it.
     70-#
     71-PATH_GCC_LIB_TCPIPV4 := $(dir $(shell gcc -print-file-name=libsocket.lib))/tcpipv4
     72-ifeq ($(PATH_GCC_LIB_TCPIPV4),/tcpipv4)
     73-$(error Could not detect the GCC TCPIPV4 socket library path.)
     74-endif
     75-
     76-##
     77-# Defines an import library target for the given DLL target.
     78-#
     79-# @param 1 DLL target name.
     80-# @param 2 .def file (defaults to <1>.def).
     81-# @param 3 .def file for debug (defaults to <2>).
     82-# @param 4 list of object files containing additional exports.
     83-# @param 5 non-empty to disable .def post-processing with ImpDef.
     84-#
     85-odin_implib = $(evalcall odin_implib_common,$(1),$(2),$(3),$(4),$(5))
     86-
     87-define odin_implib_common
     88-    local target := $(1)
     89-    local def := $(abspath $(PATH_SUB_CURRENT)/$(if $(2),$(2),$(1).def))
     90-    local def_exp := $(notdir $(basename $(def))).exp.def
     91-ifneq ($(3),)
     92-    #local def_debug := $(abspath $(PATH_SUB_CURRENT)/$(3))
     93-    #local def_exp_debug := $(notdir $(basename $(def_debug))).exp.def
     94-endif
     95-    local obj_list := $(4)
     96-    local do_def_exp := $(if $(5),,1)
     97-    $(eval $(def_odin_implib))
     98-endef
     99-
     100-define def_odin_implib
     101-    LIBRARIES += $(target)_imp
     102-    $(target)_imp_TEMPLATE = OdinCxx
     103-    $(target)_imp_NAME     = $(target)
     104-    $$$$($(target)_imp_0_OUTDIR)/$(def_exp): $(def) \
     105-      $(addsuffix $$$$(TOOL_GXX3OMF_COBJSUFF), \
     106-                  $(addprefix $$$$($(target)_0_OUTDIR)/,$(obj_list))) \
     107-      $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
     108-               %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
     109-ifneq ($(do_def_exp),)
     110-               $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $(def) $$@
    54111-else
    55 -    rc = ProcessKernelZip(sZip);
    56 -exit rc;
    57 -
    58 -
    59 -
    60 -/**
    61 - * Extracts os2krnl and os2krnl.sym to the syms directory.
    62 - */
    63 -ProcessKernelZip: procedure expose sSyms;
    64 -    parse arg sZip
    65 -    /*
    66 -     * Get the build number.
    67 -     */
    68 -    queTmp = RxQueue('Create');
    69 -    queOld = RxQueue('Set', queTmp);
    70 -    Address CMD 'unzip -p' sZip 'os2krnl | grep "Internal revision" | sed "s/.*Internal revision[ \t]*//" | cut -b1-10 | RxQueue' queTmp
    71 -    sBuild = '';
    72 -    if (queued() > 0) then
    73 -        parse pull sBuild
    74 -    call RxQueue 'Delete', RxQueue('Set', queOld);
    75 -    if (sBuild = '') then
    76 -    do
    77 -        say 'couldn''t determin build number.' sZip
    78 -        return(3);
    79 -    end
    80 -    rc = InterpretInternalRevision(sBuild);
    81 -
    82 -
    83 -    /* get kernel build type */
    84 -    queTmp = RxQueue('Create');
    85 -    queOld = RxQueue('Set', queTmp);
    86 -    Address CMD 'unzip -p' sZip 'os2krnl | grep "SAB KNL" | sed "s/.*SAB KNL//" | cut -b1 | RxQueue' queTmp
    87 -    chBuildType = '';
    88 -    if (queued() > 0) then
    89 -        pull chBuildType
    90 -    call RxQueue 'Delete', RxQueue('Set', queOld);
    91 -    if (sBuild = '') then
    92 -    do
    93 -        say 'couldn''t determin build type.' sZip
    94 -        return(3);
    95 -    end
    96 -
    97 -
    98 -    /*
    99 -     *  Construct base filename
    100 -     */
    101 -    sBase = sSyms||'\'||uBuild||chBuildType||chType||chRev
    102 -    say sBase
    103 -
    104 -
    105 -    /*
    106 -     * Skip if allready exists.
    107 -     */
    108 -    if ( (stream(sBase||'.sym', 'c', 'query exist') <> '') & (stream(sBase, 'c', 'query exist') <> '') ) then
    109 -    do
    110 -        say 'nothing to do' sZip;
    111 -        return(0);
    112 -    end
    113 -
    114 -    /*
    115 -     * Extract the files.
    116 -     */
    117 -    rcExit = 0;
    118 -    Address CMD 'unzip -p' sZip 'os2krnl >' sBase
    119 -    if (rc <> 0) then
    120 -    do
    121 -        say 'Error: failed to extract kernel file. rc='rc;
    122 -        rcExit = rc;
    123 -    end
    124 -    else
    125 -        Address CMD 'attrib +r' sBase
    126 -
    127 -    Address CMD 'unzip -p' sZip 'os2krnl.sym >' sBase||'.sym'
    128 -    if (rc <> 0) then
    129 -    do
    130 -        say 'Error: failed to extract symbol file. rc='rc;
    131 -        rcExit = rc;
    132 -    end
    133 -    else
    134 -        Address CMD 'attrib +r' sBase||'.sym'
    135 -
    136 -return(rcExit);
    137 -
    138 -
    139 -
    140 -
    141 -/**
    142 - * Extracts the .sdf files to the sdfs directory.
    143 - * Extracts all the stuff to the pmdf directory and updates pmdfvers.lst.
    144 - */
    145 -ProcessDumpFormatterZip: procedure expose sSDFs sPMDF sTmp;
    146 -    parse arg sZip
    147 -
    148 -    /*
    149 -     * Get content list and extract the first .exe file.
    150 -     */
    151 -    rc = ListZip(sZip);
    152 -
    153 -    iExe = 0;
    154 -    do i = 1 to asFiles.0
    155 -        if (translate(right(asFiles.i, 4)) = '.EXE') then
    156 -        do
    157 -            iExe = i;
    158 -            leave;
    159 -        end
    160 -    end
    161 -    if (iExe = 0) then
    162 -    do
    163 -        say 'Invalid zip, didn''t find any .exe files.' sZip;
    164 -        return 10;
    165 -    end
    166 -
    167 -    Address CMD 'unzip -p' sZip asFiles.iExe '>' sTmp'\Tmpdf.exe';
    168 -
    169 -    /*
    170 -     * Get the build number.
    171 -     */
    172 -    queTmp = RxQueue('Create');
    173 -    queOld = RxQueue('Set', queTmp);
    174 -    Address CMD sTmp'\Tmpdf.exe | grep "Internal revision" | sed "s/.*Internal revision[ \t]*//" | RxQueue' queTmp
    175 -    sBuild = '';
    176 -    if (queued() > 0) then
    177 -        parse pull sBuild
    178 -    call RxQueue 'Delete', RxQueue('Set', queOld);
    179 -    if (sBuild = '') then
    180 -    do
    181 -        say 'couldn''t determin build number.' sZip
    182 -        return(3);
    183 -    end
    184 -    rc = InterpretInternalRevision(sBuild);
    185 -
    186 -
    187 -    /*
    188 -     * Extract the .sdf.
    189 -     */
    190 -    do i =  1 to asFiles.0
    191 -        if (translate(right(asFiles.i, 4)) = '.SDF') then
    192 -        do
    193 -            /*
    194 -             * Type.
    195 -             */
    196 -            chType = translate(substr(asFiles.i, 1, 1));
    197 -            if (chType = 'W') then
    198 -                chType = 'W4';
    199 -            else if ((chType <> 'S') & (chType <> 'U')) then
    200 -            do
    201 -                say 'invalid sub directory:' asFiles.i;
    202 -                return 11;
    203 -            end
    204 -
    205 -            /*
    206 -             * Construct filename
    207 -             */
    208 -            sFilename = sSdfs||'\'||uBuild||'_'||chType'_';
    209 -            if (chRev <> '') then
    210 -                sFilename = sFilename||chRev||'_';
    211 -            sFilename = sFilename || filespec('name', asFiles.i);
    212 -            say sFilename;
    213 -            if (stream(sFilename, 'c', 'query exist') = '') then
    214 -            do
    215 -                Address CMD 'unzip -p' sZip asFiles.i '>' sFilename;
    216 -                if (rc <> 0) then
    217 -                do
    218 -                    say 'extract of' asFiles.i '->' sFilename' failed. rc='rc;
    219 -                    rcExit = rc;
    220 -                end
    221 -                Address CMD 'attrib +r' sFilename;
    222 -            end
    223 -        end
    224 -    end
    225 -
    226 -
    227 -
    228 -    /*
    229 -     * PMDF.
    230 -     */
    231 -    sPMDFListDirs = '';
    232 -    fSkipDir = 1;
    233 -    do i = 1 to asFiles.0
    234 -        /*
    235 -         * Is the first file in that directory?
    236 -         */
    237 -        sDir = strip(strip(filespec('path', asFiles.i), 'B', '\'), 'B', '/');
    238 -        if (pos(sDir, sPMDFListDirs) <= 0) then
    239 -        do
    240 -            sPMDFListDirs = sPMDFListDirs ||' ; '||sDir;
    241 -
    242 -            /*
    243 -             * Check if df_ret.exe exists - if so, nothing to do.
    244 -             */
    245 -            if (stream(sPMDF||'\'||sDir||'df_ret.exe', 'c', 'query exist') <> '') then
    246 -                fSkipDir = 1;
    247 -            else
    248 -                fSkipDir = 0;
    249 -
    250 -            /*
    251 -             * Create directory and add it to pmdfvers.lst.
    252 -             */
    253 -            if (\fSkipDir) then
    254 -            do
    255 -                Address CMD 'mkdir' sPMDF||'\'||sDir;
    256 -                Address CMD 'echo' sDir||';'||sBuild||';'||sBuild '>>' sPMDF'\pmdfvers.lst';
    257 -            end
    258 -        end
    259 -
    260 -        /*
    261 -         * Extract the file.
    262 -         */
    263 -        if (\fSkipDir) then
    264 -        do
    265 -            Address CMD 'unzip -p' sZip asFiles.i '>' sPMDF||'\'||sDir||'\'||filespec('name', asFiles.i);
    266 -        end
    267 -    end
    268 -
    269 -return(rcExit);
    270 -
    271 -
    272 -
    273 -/**
    274 - * Gets the zip content listing.
    275 - */
    276 -ListZip: procedure expose asFiles.;
    277 -    parse arg sZip
    278 -    queTmp = RxQueue('Create');
    279 -    queOld = RxQueue('Set', queTmp);
    280 -    Address CMD 'unzip -v' sZip '| RxQueue' queTmp
    281 -    asFiles.0 = 0;
    282 -    fFiles = 0;
    283 -    do while (queued() > 0)
    284 -        parse pull sLine
    285 -        sLine = strip(sLine);
    286 -        /* check for start/end of file listing */
    287 -        if (substr(sLine, 1, 1) = '-') then
    288 -        do
    289 -            fFiles = fFiles + 1;
    290 -            iterate;
    291 -        end
    292 -
    293 -        /* in file listing? */
    294 -        if (fFiles = 1) then
    295 -        do
    296 -            asFiles.0 = asFiles.0 + 1;
    297 -            i = asFiles.0;
    298 -            parse var sLine . . . . . . . asFiles.i
    299 -            asFiles.i = strip(asFiles.i, 'L');
    300 -        end
    301 -    end
    302 -    call RxQueue 'Delete', RxQueue('Set', queOld);
    303 -return 0;
    304 -
    305 -
    306 -/**
    307 - * Get build number, revision and type.
    308 - */
    309 -InterpretInternalRevision: procedure expose uBuild chRev chType;
    310 -    parse arg sBuild
    311 -
    312 -    /* got a 10 byte string like 14.086c_UN */
    313 -    parse upper var sBuild iHigh'.'sLow'_'sType with
    314 -    uBuild = substr(sLow, 1, 3) + iHigh*1000;
    315 -    chRev = ''
    316 -    if (length(sLow) > 3) then
    317 -        chRev = substr(sLow, 4, 1);
    318 -
    319 -    select
    320 -        when (substr(sType, 1, 1) = 'U') then
    321 -            chType = 'U'
    322 -        when (substr(sType, 1, 1) = 'S') then
    323 -            chType = 'S'
    324 -        when (substr(sType, 1, 1) = 'W') then
    325 -            chType = '4'
    326 -        otherwise
    327 -        do
    328 -            say 'fatal error: unknown kernel type: '''sType''''
    329 -            say 'sBulid =' sBuild
    330 -            exit(4);
    331 -        end
    332 -    end
    333 -return 0;
    334 -
    335 +/* $Id: ProcessZip.cmd,v 1.1 2002-04-07 01:44:47 bird Exp $
    336 + *
    337 + * Testcase Zipped Kernel Processer.
    338 + *
    339 + * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    340 + *
    341 + * GPL
    342 + *
    343 + */
    344 +
    345 +/*
    346 + * Config.
    347 + */
    348 +sSyms = 'h:\kernels\syms';
    349 +sSDFs = 'h:\kernels\sdfs';
    350 +sPMDF = 'f:\pmdf';
    351 +
    352 +/* Temp dir. */
    353 +sTmp = value('TMP',,'OS2ENVIRONMENT');
    354 +if (sTmp = '') then
    355 +    sTmp = value('TEMP',,'OS2ENVIRONMENT');
    356 +if (sTmp = '') then
    357 +    sTmp = value('TMPDIR',,'OS2ENVIRONMENT');
    358 +if (sTmp = '') then
    359 +do
    360 +    say 'No TMP/TEMP/TMPDIR env variable.'
    361 +    exit(2);
    362 +end
    363 +
    364 +
    365 +/*
    366 + * Input
    367 + */
    368 +parse arg sZip sDummy
    369 +
    370 +if ((sZip = '') | (sDummy <> '') | (stream(sZip, 'c', 'query exist') = '')) then
    371 +do
    372 +    say 'Syntax error or invalid filename!'
    373 +    say 'Syntax: ProcessZip.cmd <zipfile name>'
    374 +    exit(1);
    375 +end
    376 +
    377 +
    378 +/*
    379 + * zip type?
    380 + */
    381 +if (translate(substr(filespec('name', sZip), 1, 2)) = 'DF' ) then
    382 +    rc = ProcessDumpFormatterZip(sZip);
     112-               $(QUIET2)$(CP) $(def) $$@
     113-endif
     114-ifneq ($(obj_list),)
     115-               $(QUIET2)emxexp.exe \
     116-                    $(addsuffix $$(TOOL_GXX3OMF_COBJSUFF), \
     117-                                $(addprefix $$($(target)_0_OUTDIR)/,$(obj_list))) >> $$@
     118-endif
     119-ifeq ($(def_exp_debug),)
     120- ifneq ($(do_def_exp)$(obj_list),)
     121-    $(target)_imp_SOURCES  = $$($(target)_imp_0_OUTDIR)/$(def_exp)
     122-    $(target)_imp_CLEAN   += $$($(target)_imp_0_OUTDIR)/$(def_exp)
     123- else
     124-    $(target)_imp_SOURCES  = $(def)
     125- endif
     126-else
     127- ifneq ($(do_def_exp)$(obj_list),)
     128-    $(target)_imp_SOURCES.release  = $$($(target)_imp_0_OUTDIR)/$(def_exp)
     129-    $(target)_imp_CLEAN.release   += $$($(target)_imp_0_OUTDIR)/$(def_exp)
     130-    $$$$($(target)_imp_0_OUTDIR)/$(def_exp_debug): $(def_debug) \
     131-        $(addsuffix $$$$(TOOL_GXX3OMF_COBJSUFF), \
     132-                    $(addprefix $$$$($(target)_0_OUTDIR)/,$(obj_list))) \
     133-        $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
     134-               %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
     135-ifneq ($(do_def_exp),)
     136-               $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $(def_debug) $$@
     137-else
     138-               $(QUIET2)$(CP) $(def_debug) $$@
     139-endif
     140-ifneq ($(obj_list),)
     141-               $(QUIET2)emxexp.exe \
     142-                    $(addsuffix $$(TOOL_GXX3OMF_COBJSUFF), \
     143-                                $(addprefix $$($(target)_0_OUTDIR)/,$(obj_list))) >> $$@
     144-endif
     145-    $(target)_imp_SOURCES.debug    = $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
     146-    $(target)_imp_CLEAN.debug     += $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
     147- else
     148-    $(target)_imp_SOURCES.release  = $(def)
     149-    $(target)_imp_SOURCES.debug    = $(def_debug)
     150- endif
     151-endif
     152-endef
     153-
     154-##
     155-# Shortcut to $(call odin_implib,<1>,<2>,<3>,<4>,1) used to disable .def file
     156-# post-processing with the ImpDef tool.
     157-#
     158-# @param 1 DLL target name.
     159-# @param 2 .def file (defaults to <1>.def).
     160-# @param 3 .def file for debug (defaults to <2>).
     161-# @param 4 list of object files containing additional exports.
     162-#
     163-odin_implib_no_expdef = $(call odin_implib,$(1),$(2),$(3),$(4),1)
     164-
     165-##
     166-# Shortcut to $(call odin_implib, <1>,<1>.def,<1>dbg.def,<2>).
     167-#
     168-# @param 1 DLL target name.
     169-# @param 2 list of object files containing additional exports.
     170-#
     171-odin_implib_2 = $(call odin_implib,$(1),$(1).def,$(1)dbg.def,$(2))
     172-
     173-##
     174-# Shortcut to $(call odin_implib_no_expdef,<1>,<1>.def,<1>dbg.def,<2>).
     175-#
     176-# @param 1 DLL target name.
     177-# @param 2 list of object files containing additional exports.
     178-#
     179-odin_implib_2_no_expdef = $(call odin_implib_no_expdef,$(1),$(1).def,$(1)dbg.def,$(2))
     180-
     181-#
     182-# Handler for Wine RC (.orc) source files
     183-#
     184-KBUILD_SRC_HANDLERS += .orc:def_src_handler_wrc
     185-define def_src_handler_wrc
     186-local type := WRC
     187- $(kb-src-one 2)
     188-endef
     189-PROPS_ACCUMULATE_R += WRCFLAGS
     190-
     191-#
     192-# Override handler for .asm files to compile them with the MASM-compilant tool
     193-#
     194-KBUILD_SRC_HANDLERS := .asm:def_src_handler_masm $(KBUILD_SRC_HANDLERS)
     195-define def_src_handler_masm
     196-local type := $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)
     197- $(kb-src-one 2)
     198-endef
     199-PROPS_ACCUMULATE_R += $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)FLAGS
     200-
     201-#
     202-# Handler for .def files to add bldlevel info to them
     203-#
     204-define def_src_handler_def
     205-local type := DEF
     206- $(kb-src-one 2)
     207-#.NOTPARALLEL: $(obj) # BldLevelInf.cmd can't open files in parallel
     208-endef
     209-
     210-#------------------------------------------------------------------------------
     211-# Tools
     212-#------------------------------------------------------------------------------
     213-
     214-#
     215-# Add support for Wine RC to the GCC compiler
     216-#
     217-TOOL_GXX3OMF_WRC                = $(PATH_STAGE_BIN)/winerc.exe
     218-TOOL_GXX3OMF_WRCOBJSUFF         = .orc$(TOOL_GXX3OMF_COBJSUFF)
     219-TOOL_GXX3OMF_WRCFLAGS           =
     220-TOOL_GXX3OMF_COMPILE_WRC_OUTPUT = $(outbase).orc.s
     221-TOOL_GXX3OMF_COMPILE_WRC_DEPEND = $(TOOL_GXX3OMF_WRC)
     222-TOOL_GXX3OMF_COMPILE_WRC_DEPORD =
     223-define TOOL_GXX3OMF_COMPILE_WRC_CMDS
     224-       $(QUIET)$(TOOL_GXX3OMF_WRC) -s -I$(subst /,\\,$(abspath $(dir $(source))))\
     225-               $(flags) $(addprefix -I, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
     226-               $(subst /,\\,$(abspath $(source))) \
     227-               -o $(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT)
     228-       $(QUIET)$(TOOL_GXX3OMF_CC) -E -I$(subst /,\\,$(abspath $(dir $(source))))\
     229-               $(addprefix -I, $(incs)) -I . $(addprefix -D, $(defs))\
     230-               -x c $(abspath $(source)) \
     231-               | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
     232-       $(subst $(source),$(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT),\
     233-                $(subst $(flags),,$(TOOL_GXX3OMF_COMPILE_AS_CMDS)))
     234-endef
     235-
     236-#
     237-# Add support for MASM to the GCC compiler
     238-#
     239-TOOL_GXX3OMF_MASM                   = $(PATH_TOOL_ALP)
     240-TOOL_GXX3OMF_MASMFLAGS              = -Mb
     241-TOOL_GXX3OMF_COMPILE_MASM_OUTPUT    = $(outbase).lst
     242-TOOL_GXX3OMF_COMPILE_MASM_DEPEND    =
     243-TOOL_GXX3OMF_COMPILE_MASM_DEPORD    =
     244-define TOOL_GXX3OMF_COMPILE_MASM_CMDS
     245-       $(QUIET)$(TOOL_GXX3OMF_MASM) -D:__GNUC__ -D:__EMX__\
     246-               $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
     247-               $(source)\
     248-               -Fl:$(outbase).lst\
     249-               -Fd:$(dep)\
     250-               -Fo:$(obj)
     251-endef
     252-
     253-#
     254-# Add support for DEF file bldlevel info generator to the GCC compiler
     255-#
     256-TOOL_GXX3OMF_DEF                    = $(PATH_ROOT)/tools/bin/BldLevelInf.cmd
     257-TOOL_GXX3OMF_DEFOBJSUFF             = .bldlevel.def
     258-TOOL_GXX3OMF_COMPILE_DEF_OUTPUT     =
     259-TOOL_GXX3OMF_COMPILE_DEF_DEPEND     = $(PATH_ROOT)/include/odinbuild.h
     260-TOOL_GXX3OMF_COMPILE_DEF_DEPORD     =
     261-define TOOL_GXX3OMF_COMPILE_DEF_CMDS
     262-       $(QUIET)cmd /c 'set BUILD_QUIET=1 && $(TOOL_GXX3OMF_DEF)\
     263-               $(source) $(outbase).bldlevel.def\
     264-               -R"$(source)"\
     265-               -V"#define=ODIN32_VERSION,$(subst /,/,$(PATH_ROOT)/include/odinbuild.h)"\
     266-               -M"#define=ODIN32_BUILD_NR,$(subst /,/,$(PATH_ROOT)/include/odinbuild.h)"'
     267-endef
     268-
     269-#------------------------------------------------------------------------------
     270-# Common libraries referenced by components
     271-#------------------------------------------------------------------------------
     272-
     273-#------------------------------------------------------------------------------
     274-# General Stuff
     275-#------------------------------------------------------------------------------
     276-
     277-KBUILD_UNIT_PATHS          += $(PATH_ROOT)
     278-
     279-TEMPLATE_OdinCxx            = Odin C/C++ sources
     280-TEMPLATE_OdinCxx_USES       = Extra
     281-TEMPLATE_OdinCxx_TOOL       = GXX3OMF
     282-TEMPLATE_OdinCxx_INCS       = $(PATH_ROOT)/include/win $(PATH_ROOT)/include $(PATH_ROOT)/include/incl_gcc
     283-TEMPLATE_OdinCxx_DEFS       = USE_OS2_TOOLKIT_HEADERS OS2EMX_PLAIN_CHAR \
     284-                              __WIN32OS2__ __i386__
     285-TEMPLATE_OdinCxx_DEFS.debug = DEBUG
     286-TEMPLATE_OdinCxx_LDFLAGS    = -Zlinker '"DISABLE 1121"'
     287-
     288-# generate .sym files but don't put them in a separate dir
     289-TEMPLATE_OdinCxx_LD_DEBUG       = split
     290-TEMPLATE_OdinCxx_DEBUG_STAGE    = nul
     291-
     292-TEMPLATE_OdinBin                = Odin DLL or EXE
     293-TEMPLATE_OdinBin_EXTENDS        = OdinCxx
     294-
     295-# Override DEF handler to add bldlevel info to .DEF files
     296-TEMPLATE_OdinBin_SRC_HANDLERS   = .def:def_src_handler_def
     297-
     298-TEMPLATE_OdinDLL            = Odin DLL
     299-TEMPLATE_OdinDLL_EXTENDS    = OdinBin
     300-TEMPLATE_OdinDLL_EXTENDS_BY = appending
     301-TEMPLATE_OdinDLL_DEFS       = $(TEMPLATE_OdinCxx_DEFS) __WINE__ COMCTL32UNDOC TCPV40HDRS __USE_LIBC_TCPIP
     302-TEMPLATE_OdinDLL_LIBS       = $(PATH_STAGE_LIB)/odincrt.lib \
     303-                              $(PATH_STAGE_LIB)/initdll.lib
     304-TEMPLATE_OdinDLL_LDFLAGS    = -L$(PATH_GCC_LIB_TCPIPV4) # necessary for TCPV40HDRS
     305-TEMPLATE_OdinDLL_LDFLAGS   += KMK_NOIMPLIB # disable automatic implib
     306-TEMPLATE_OdinDLL_WRCFLAGS   = -p_$(target)
     307-
     308-TEMPLATE_OdinSimpleDLL              = Odin DLL with ordinary entry point
     309-TEMPLATE_OdinSimpleDLL_EXTENDS      = OdinDLL
     310-TEMPLATE_OdinSimpleDLL_EXTENDS_BY   = overriding
     311-TEMPLATE_OdinSimpleDLL_LIBS         = $(PATH_STAGE_LIB)/dllentry.o $(TEMPLATE_OdinDLL_LIBS)
     312-TEMPLATE_OdinSimpleDLL_WRCFLAGS     = -p_Resource
     313-
     314-TEMPLATE_OdinCRT            = OdinCRT DLL
     315-TEMPLATE_OdinCRT_EXTENDS    = OdinBin
     316-TEMPLATE_OdinCRT_EXTENDS_BY = appending
     317-TEMPLATE_OdinCRT_DEFS       = __WINE__
     318-TEMPLATE_OdinCRT_LIBS       = $(PATH_STAGE_LIB)/initdll.lib
     319-TEMPLATE_OdinCRT_LDFLAGS   += KMK_NOIMPLIB # disable automatic implib
     320-
     321-TEMPLATE_OdinApp            = Odin application
     322-TEMPLATE_OdinApp_EXTENDS    = OdinBin
     323-
     324-TEMPLATE_OdinTestApp        = Odin application
     325-TEMPLATE_OdinTestApp_EXTENDS= OdinApp
     326-TEMPLATE_OdinTestApp_STAGE  = tests/
     327-
     328-#------------------------------------------------------------------------------
     329-# GCC Stuff
     330-#------------------------------------------------------------------------------
     331-
     332-#------------------------------------------------------------------------------
     333-# Other Stuff
     334-#------------------------------------------------------------------------------
     335-
     336-#
     337-# Include a site-specific config for local overrides
     338-#
     339-ifndef LOCALCFG
     340- LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
     341- ifneq ($(LOCALCFG),)
     342-  include $(LOCALCFG)
     343- endif
     344-endif
     345-
     346-#------------------------------------------------------------------------------
     347-# Post-processing
     348-#------------------------------------------------------------------------------
     349-
     350-ifeq ($(PATH_TOOL_ALP),)
     351-ifneq ($(PATH_SDK_OS2TK4),)
     352-PATH_TOOL_ALP := $(PATH_SDK_OS2TK4)/bin/alp.exe
     353-else
     354-PATH_TOOL_ALP := alp.exe
     355-endif
     356-endif
     357-
     358-ifneq ($(PATH_SDK_OS2TK4),)
     359-#
     360-# We can't add Toolkit includes in _INCS (it will casuse then to be searched
     361-# before GCC headers and lead to conflicts), so use -idirafter.
     362-#
     363-TEMPLATE_OdinCxx_CFLAGS    += -idirafter $(PATH_SDK_OS2TK4)/h
     364-TEMPLATE_OdinCxx_CXXFLAGS  += -idirafter $(PATH_SDK_OS2TK4)/h
     365-endif
     366+## @file
     367+# Global Project Configuration File
     368+#
     369+
     370+#------------------------------------------------------------------------------
     371+# Global definitions
     372+#------------------------------------------------------------------------------
     373+
     374+#
     375+# @todo kBuild forgets to do that on OS/2
     376+#
     377+INST_DLL = bin/
     378+
     379+#
     380+# Watcom Linker is required because of some Watcom-specific directives (used
     381+# e.g. to compensate for the lack of SEGMENTS support in .DEF in emxomfld, see
     382+# svn.netlabs.org/libc/ticket/252). Besides, it's more stable than the outdated
     383+# IBM linker.
     384+#
     385+ifn1of ($(EMXOMFLD_TYPE),WLINK wlink)
     386+$(error You must use Watcom Linker and set EMXOMFLD_TYPE to WLINK (it's now $(EMXOMFLD_TYPE)))
     387+endif
     388+
     389+#
     390+# TCPV40HDRS requires an alternative libsocket.lib located in a separate directory.
     391+# Try to deduce it.
     392+#
     393+PATH_GCC_LIB_TCPIPV4 := $(dir $(shell gcc -print-file-name=libsocket.lib))/tcpipv4
     394+ifeq ($(PATH_GCC_LIB_TCPIPV4),/tcpipv4)
     395+$(error Could not detect the GCC TCPIPV4 socket library path.)
     396+endif
     397+
     398+##
     399+# Defines an import library target for the given DLL target.
     400+#
     401+# @param 1 DLL target name.
     402+# @param 2 .def file (defaults to <1>.def).
     403+# @param 3 .def file for debug (defaults to <2>).
     404+# @param 4 list of object files containing additional exports.
     405+# @param 5 non-empty to disable .def post-processing with ImpDef.
     406+#
     407+odin_implib = $(evalcall odin_implib_common,$(1),$(2),$(3),$(4),$(5))
     408+
     409+define odin_implib_common
     410+    local target := $(1)
     411+    local def := $(abspath $(PATH_SUB_CURRENT)/$(if $(2),$(2),$(1).def))
     412+    local def_exp := $(notdir $(basename $(def))).exp.def
     413+ifneq ($(3),)
     414+    #local def_debug := $(abspath $(PATH_SUB_CURRENT)/$(3))
     415+    #local def_exp_debug := $(notdir $(basename $(def_debug))).exp.def
     416+endif
     417+    local obj_list := $(4)
     418+    local do_def_exp := $(if $(5),,1)
     419+    $(eval $(def_odin_implib))
     420+endef
     421+
     422+define def_odin_implib
     423+    LIBRARIES += $(target)_imp
     424+    $(target)_imp_TEMPLATE = OdinCxx
     425+    $(target)_imp_NAME     = $(target)
     426+    $$$$($(target)_imp_0_OUTDIR)/$(def_exp): $(def) \
     427+      $(addsuffix $$$$(TOOL_GXX3OMF_COBJSUFF), \
     428+                  $(addprefix $$$$($(target)_0_OUTDIR)/,$(obj_list))) \
     429+      $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
     430+               %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
     431+ifneq ($(do_def_exp),)
     432+               $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $(def) $$@
    383433+else
    384 +    rc = ProcessKernelZip(sZip);
    385 +exit rc;
    386 +
    387 +
    388 +
    389 +/**
    390 + * Extracts os2krnl and os2krnl.sym to the syms directory.
    391 + */
    392 +ProcessKernelZip: procedure expose sSyms;
    393 +    parse arg sZip
    394 +    /*
    395 +     * Get the build number.
    396 +     */
    397 +    queTmp = RxQueue('Create');
    398 +    queOld = RxQueue('Set', queTmp);
    399 +    Address CMD 'unzip -p' sZip 'os2krnl | grep "Internal revision" | sed "s/.*Internal revision[ \t]*//" | cut -b1-10 | RxQueue' queTmp
    400 +    sBuild = '';
    401 +    if (queued() > 0) then
    402 +        parse pull sBuild
    403 +    call RxQueue 'Delete', RxQueue('Set', queOld);
    404 +    if (sBuild = '') then
    405 +    do
    406 +        say 'couldn''t determin build number.' sZip
    407 +        return(3);
    408 +    end
    409 +    rc = InterpretInternalRevision(sBuild);
    410 +
    411 +
    412 +    /* get kernel build type */
    413 +    queTmp = RxQueue('Create');
    414 +    queOld = RxQueue('Set', queTmp);
    415 +    Address CMD 'unzip -p' sZip 'os2krnl | grep "SAB KNL" | sed "s/.*SAB KNL//" | cut -b1 | RxQueue' queTmp
    416 +    chBuildType = '';
    417 +    if (queued() > 0) then
    418 +        pull chBuildType
    419 +    call RxQueue 'Delete', RxQueue('Set', queOld);
    420 +    if (sBuild = '') then
    421 +    do
    422 +        say 'couldn''t determin build type.' sZip
    423 +        return(3);
    424 +    end
    425 +
    426 +
    427 +    /*
    428 +     *  Construct base filename
    429 +     */
    430 +    sBase = sSyms||'\'||uBuild||chBuildType||chType||chRev
    431 +    say sBase
    432 +
    433 +
    434 +    /*
    435 +     * Skip if allready exists.
    436 +     */
    437 +    if ( (stream(sBase||'.sym', 'c', 'query exist') <> '') & (stream(sBase, 'c', 'query exist') <> '') ) then
    438 +    do
    439 +        say 'nothing to do' sZip;
    440 +        return(0);
    441 +    end
    442 +
    443 +    /*
    444 +     * Extract the files.
    445 +     */
    446 +    rcExit = 0;
    447 +    Address CMD 'unzip -p' sZip 'os2krnl >' sBase
    448 +    if (rc <> 0) then
    449 +    do
    450 +        say 'Error: failed to extract kernel file. rc='rc;
    451 +        rcExit = rc;
    452 +    end
    453 +    else
    454 +        Address CMD 'attrib +r' sBase
    455 +
    456 +    Address CMD 'unzip -p' sZip 'os2krnl.sym >' sBase||'.sym'
    457 +    if (rc <> 0) then
    458 +    do
    459 +        say 'Error: failed to extract symbol file. rc='rc;
    460 +        rcExit = rc;
    461 +    end
    462 +    else
    463 +        Address CMD 'attrib +r' sBase||'.sym'
    464 +
    465 +return(rcExit);
    466 +
    467 +
    468 +
    469 +
    470 +/**
    471 + * Extracts the .sdf files to the sdfs directory.
    472 + * Extracts all the stuff to the pmdf directory and updates pmdfvers.lst.
    473 + */
    474 +ProcessDumpFormatterZip: procedure expose sSDFs sPMDF sTmp;
    475 +    parse arg sZip
    476 +
    477 +    /*
    478 +     * Get content list and extract the first .exe file.
    479 +     */
    480 +    rc = ListZip(sZip);
    481 +
    482 +    iExe = 0;
    483 +    do i = 1 to asFiles.0
    484 +        if (translate(right(asFiles.i, 4)) = '.EXE') then
    485 +        do
    486 +            iExe = i;
    487 +            leave;
    488 +        end
    489 +    end
    490 +    if (iExe = 0) then
    491 +    do
    492 +        say 'Invalid zip, didn''t find any .exe files.' sZip;
    493 +        return 10;
    494 +    end
    495 +
    496 +    Address CMD 'unzip -p' sZip asFiles.iExe '>' sTmp'\Tmpdf.exe';
    497 +
    498 +    /*
    499 +     * Get the build number.
    500 +     */
    501 +    queTmp = RxQueue('Create');
    502 +    queOld = RxQueue('Set', queTmp);
    503 +    Address CMD sTmp'\Tmpdf.exe | grep "Internal revision" | sed "s/.*Internal revision[ \t]*//" | RxQueue' queTmp
    504 +    sBuild = '';
    505 +    if (queued() > 0) then
    506 +        parse pull sBuild
    507 +    call RxQueue 'Delete', RxQueue('Set', queOld);
    508 +    if (sBuild = '') then
    509 +    do
    510 +        say 'couldn''t determin build number.' sZip
    511 +        return(3);
    512 +    end
    513 +    rc = InterpretInternalRevision(sBuild);
    514 +
    515 +
    516 +    /*
    517 +     * Extract the .sdf.
    518 +     */
    519 +    do i =  1 to asFiles.0
    520 +        if (translate(right(asFiles.i, 4)) = '.SDF') then
    521 +        do
    522 +            /*
    523 +             * Type.
    524 +             */
    525 +            chType = translate(substr(asFiles.i, 1, 1));
    526 +            if (chType = 'W') then
    527 +                chType = 'W4';
    528 +            else if ((chType <> 'S') & (chType <> 'U')) then
    529 +            do
    530 +                say 'invalid sub directory:' asFiles.i;
    531 +                return 11;
    532 +            end
    533 +
    534 +            /*
    535 +             * Construct filename
    536 +             */
    537 +            sFilename = sSdfs||'\'||uBuild||'_'||chType'_';
    538 +            if (chRev <> '') then
    539 +                sFilename = sFilename||chRev||'_';
    540 +            sFilename = sFilename || filespec('name', asFiles.i);
    541 +            say sFilename;
    542 +            if (stream(sFilename, 'c', 'query exist') = '') then
    543 +            do
    544 +                Address CMD 'unzip -p' sZip asFiles.i '>' sFilename;
    545 +                if (rc <> 0) then
    546 +                do
    547 +                    say 'extract of' asFiles.i '->' sFilename' failed. rc='rc;
    548 +                    rcExit = rc;
    549 +                end
    550 +                Address CMD 'attrib +r' sFilename;
    551 +            end
    552 +        end
    553 +    end
    554 +
    555 +
    556 +
    557 +    /*
    558 +     * PMDF.
    559 +     */
    560 +    sPMDFListDirs = '';
    561 +    fSkipDir = 1;
    562 +    do i = 1 to asFiles.0
    563 +        /*
    564 +         * Is the first file in that directory?
    565 +         */
    566 +        sDir = strip(strip(filespec('path', asFiles.i), 'B', '\'), 'B', '/');
    567 +        if (pos(sDir, sPMDFListDirs) <= 0) then
    568 +        do
    569 +            sPMDFListDirs = sPMDFListDirs ||' ; '||sDir;
    570 +
    571 +            /*
    572 +             * Check if df_ret.exe exists - if so, nothing to do.
    573 +             */
    574 +            if (stream(sPMDF||'\'||sDir||'df_ret.exe', 'c', 'query exist') <> '') then
    575 +                fSkipDir = 1;
    576 +            else
    577 +                fSkipDir = 0;
    578 +
    579 +            /*
    580 +             * Create directory and add it to pmdfvers.lst.
    581 +             */
    582 +            if (\fSkipDir) then
    583 +            do
    584 +                Address CMD 'mkdir' sPMDF||'\'||sDir;
    585 +                Address CMD 'echo' sDir||';'||sBuild||';'||sBuild '>>' sPMDF'\pmdfvers.lst';
    586 +            end
    587 +        end
    588 +
    589 +        /*
    590 +         * Extract the file.
    591 +         */
    592 +        if (\fSkipDir) then
    593 +        do
    594 +            Address CMD 'unzip -p' sZip asFiles.i '>' sPMDF||'\'||sDir||'\'||filespec('name', asFiles.i);
    595 +        end
    596 +    end
    597 +
    598 +return(rcExit);
    599 +
    600 +
    601 +
    602 +/**
    603 + * Gets the zip content listing.
    604 + */
    605 +ListZip: procedure expose asFiles.;
    606 +    parse arg sZip
    607 +    queTmp = RxQueue('Create');
    608 +    queOld = RxQueue('Set', queTmp);
    609 +    Address CMD 'unzip -v' sZip '| RxQueue' queTmp
    610 +    asFiles.0 = 0;
    611 +    fFiles = 0;
    612 +    do while (queued() > 0)
    613 +        parse pull sLine
    614 +        sLine = strip(sLine);
    615 +        /* check for start/end of file listing */
    616 +        if (substr(sLine, 1, 1) = '-') then
    617 +        do
    618 +            fFiles = fFiles + 1;
    619 +            iterate;
    620 +        end
    621 +
    622 +        /* in file listing? */
    623 +        if (fFiles = 1) then
    624 +        do
    625 +            asFiles.0 = asFiles.0 + 1;
    626 +            i = asFiles.0;
    627 +            parse var sLine . . . . . . . asFiles.i
    628 +            asFiles.i = strip(asFiles.i, 'L');
    629 +        end
    630 +    end
    631 +    call RxQueue 'Delete', RxQueue('Set', queOld);
    632 +return 0;
    633 +
    634 +
    635 +/**
    636 + * Get build number, revision and type.
    637 + */
    638 +InterpretInternalRevision: procedure expose uBuild chRev chType;
    639 +    parse arg sBuild
    640 +
    641 +    /* got a 10 byte string like 14.086c_UN */
    642 +    parse upper var sBuild iHigh'.'sLow'_'sType with
    643 +    uBuild = substr(sLow, 1, 3) + iHigh*1000;
    644 +    chRev = ''
    645 +    if (length(sLow) > 3) then
    646 +        chRev = substr(sLow, 4, 1);
    647 +
    648 +    select
    649 +        when (substr(sType, 1, 1) = 'U') then
    650 +            chType = 'U'
    651 +        when (substr(sType, 1, 1) = 'S') then
    652 +            chType = 'S'
    653 +        when (substr(sType, 1, 1) = 'W') then
    654 +            chType = '4'
    655 +        otherwise
    656 +        do
    657 +            say 'fatal error: unknown kernel type: '''sType''''
    658 +            say 'sBulid =' sBuild
    659 +            exit(4);
    660 +        end
    661 +    end
    662 +return 0;
    663 +
    664 diff --git a/src/win32k/kKrnlLib/tools/TestKernels.cmd b/src/win32k/kKrnlLib/tools/TestKernels.cmd
    665 index cde7eed..d0acbc0 100644
    666 --- a/src/win32k/kKrnlLib/tools/TestKernels.cmd
    667 +++ b/src/win32k/kKrnlLib/tools/TestKernels.cmd
    668 @@ -1,138 +1,138 @@
    669 -/* $Id: TestKernels.cmd,v 1.1 2002-03-31 19:30:41 bird Exp $
    670 - *
    671 - * This script loops thru a set of different kernels running testcase 1.
    672 - * Note: The kernels and symbols files are in a single directory
    673 - *      Name format
    674 - *      nnnn[n]bk[.SYM]
    675 - *
    676 - *  nnnn[n]     Build number. (4 or 5 digits). (ex. 9036)
    677 - *  b           Build type: A - allstrict; H - halfstrict; R - retail (GA)
    678 - *  k           Kernel type: U - uniprocess; S - smp; 4 - warp 4 fixpack 13+
    679 - *  [.SYM]      Kernel files has no extention while the symbol files has .SYM.
    680 - */
    681 -
    682 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    683 -    call SysLoadFuncs;
    684 -
    685 -    parse arg sR3Tst sDir sdummy
    686 -    if (sR3Tst = '' | sDir = '' | sDir = '-?' | sDir = '/?' | sDir = '-h' | sDir = '-H' ,
    687 -        | sDir  = '/h' | sDir = '/H' | sDir = '--help') then
    688 -    do
    689 -        call syntax;
    690 -        exit -1;
    691 -    end
    692 -
    693 -    /*
    694 -     * Read directory
    695 -     */
    696 -    rc = SysFileTree(sDir'\*', 'asFiles', 'FO');
    697 -    if (rc <> 0) then
    698 -    do
    699 -        say 'SysFileTree failed with rc='rc'.';
    700 -        exit -2;
    701 -    end
    702 -    if (asFiles.0 <= 0) then
    703 -    do
    704 -        say 'No files found';
    705 -        exit -3;
    706 -    end
    707 -
    708 -    iRetCode = 0;
    709 -    do i = 1 to asFiles.0
    710 -        /*
    711 -         * Interpret name (get build no., kernel type and build type).
    712 -         */
    713 -        sName = translate(filespec('name', asFiles.i));
    714 -        if (lastpos('.', sName) > 0) then
    715 -        do
    716 -            sExt = substr(sName, lastpos('.', sName) + 1);
    717 -            sName = substr(sName, 1, lastpos('.', sName) - 1);
    718 -        end
    719 -        else
    720 -            sExt = '';
    721 -
    722 -        if (sExt <> '') then
    723 -            iterate
    724 -
    725 -        if (substr(sName, 5, 1) <= '9') then    cchBuild = 5;
    726 -        else                                    cchBuild = 4;
    727 -        iBuild = substr(sName, 1, cchBuild);
    728 -        chBuildType = substr(sName, cchBuild + 1, 1);
    729 -        chKernelType = substr(sName, cchBuild + 2, 1);
    730 -        chRev = substr(sName, cchBuild + 3, 1);
    731 -
    732 -        /*
    733 -         * Validate name.
    734 -         */
    735 -        do j = 1 to length(iBuild)
    736 -            if (substr(iBuild, j, 1) < '0' | substr(iBuild, j, 1) > '9') then
    737 -            do
    738 -                j = -1;
    739 -                leave;
    740 -            end
    741 -        end
    742 -        if (j = -1) then
    743 -            iterate;
    744 -
    745 -        if (chBuildType <> 'A' & chBuildType <> 'H' & chBuildType <> 'R') then
    746 -        do
    747 -            say 'invalid build type char:' chBuildType '('asFiles.i')';
    748 -            exit -4;
    749 -        end
    750 -
    751 -        if (chKernelType <> 'U' & chKernelType <> 'S' & chKernelType <> '4') then
    752 -        do
    753 -            say 'invalid kernel type char:' chKernelType '('asFiles.i')';
    754 -            exit -4;
    755 -        end
    756 -
    757 -        /*
    758 -         * Determin version number (based on build number).
    759 -         */
    760 -        iVerMajor = 2;
    761 -        if (iBuild >= 14000) then
    762 -            iVerMinor = 45;
    763 -        else if (iBuild >= 9000) then
    764 -            iVerMinor = 40;
    765 -        else if (iBuild >= 8000) then
    766 -            iVerMinor = 30;
    767 -        else if (iBuild >= 6200) then
    768 -            iVerMinor = 21;
    769 -        else
    770 -        do
    771 -            say 'unsupported build number:' iBuild '('asFiles.i')';
    772 -            exit(-5);
    773 -        end
    774 -
    775 -        /*
    776 -         * Process it
    777 -         */
    778 -        say;
    779 -        say;
    780 -        say 'Processing' asFiles.i'....';
    781 -        if (chBuildType = 'R') then
    782 -            sCmd = sR3Tst '1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev;
    783 -        else
    784 -            sCmd = sR3Tst '1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev asFiles.i||'.SYM';
    785 -        say sCmd;
    786 -        sCmd;
    787 -        if (rc <> 0) then
    788 -        do
    789 -            say 'failed... rc='rc;
    790 -            say 'cmd:' sCmd
    791 -            exit rc;
    792 -        end
    793 -
    794 -    end
    795 -
    796 -    exit(0);
    797 -
    798 -
    799 -
    800 -
    801 -/*
    802 - * Write syntax:
    803 - */
    804 -syntax: procedure;
    805 -    say 'TestKernels.cmd <kKrnlLibR3Tst.exe> <kernel-directory>';
    806 +/* $Id: TestKernels.cmd,v 1.1 2002-03-31 19:30:41 bird Exp $
    807 + *
    808 + * This script loops thru a set of different kernels running testcase 1.
    809 + * Note: The kernels and symbols files are in a single directory
    810 + *      Name format
    811 + *      nnnn[n]bk[.SYM]
    812 + *
    813 + *  nnnn[n]     Build number. (4 or 5 digits). (ex. 9036)
    814 + *  b           Build type: A - allstrict; H - halfstrict; R - retail (GA)
    815 + *  k           Kernel type: U - uniprocess; S - smp; 4 - warp 4 fixpack 13+
    816 + *  [.SYM]      Kernel files has no extention while the symbol files has .SYM.
    817 + */
    818 +
    819 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    820 +    call SysLoadFuncs;
    821 +
    822 +    parse arg sR3Tst sDir sdummy
    823 +    if (sR3Tst = '' | sDir = '' | sDir = '-?' | sDir = '/?' | sDir = '-h' | sDir = '-H' ,
    824 +        | sDir  = '/h' | sDir = '/H' | sDir = '--help') then
    825 +    do
    826 +        call syntax;
    827 +        exit -1;
    828 +    end
    829 +
    830 +    /*
    831 +     * Read directory
    832 +     */
    833 +    rc = SysFileTree(sDir'\*', 'asFiles', 'FO');
    834 +    if (rc <> 0) then
    835 +    do
    836 +        say 'SysFileTree failed with rc='rc'.';
    837 +        exit -2;
    838 +    end
    839 +    if (asFiles.0 <= 0) then
    840 +    do
    841 +        say 'No files found';
    842 +        exit -3;
    843 +    end
    844 +
    845 +    iRetCode = 0;
    846 +    do i = 1 to asFiles.0
    847 +        /*
    848 +         * Interpret name (get build no., kernel type and build type).
    849 +         */
    850 +        sName = translate(filespec('name', asFiles.i));
    851 +        if (lastpos('.', sName) > 0) then
    852 +        do
    853 +            sExt = substr(sName, lastpos('.', sName) + 1);
    854 +            sName = substr(sName, 1, lastpos('.', sName) - 1);
    855 +        end
    856 +        else
    857 +            sExt = '';
    858 +
    859 +        if (sExt <> '') then
    860 +            iterate
    861 +
    862 +        if (substr(sName, 5, 1) <= '9') then    cchBuild = 5;
    863 +        else                                    cchBuild = 4;
    864 +        iBuild = substr(sName, 1, cchBuild);
    865 +        chBuildType = substr(sName, cchBuild + 1, 1);
    866 +        chKernelType = substr(sName, cchBuild + 2, 1);
    867 +        chRev = substr(sName, cchBuild + 3, 1);
    868 +
    869 +        /*
    870 +         * Validate name.
    871 +         */
    872 +        do j = 1 to length(iBuild)
    873 +            if (substr(iBuild, j, 1) < '0' | substr(iBuild, j, 1) > '9') then
    874 +            do
    875 +                j = -1;
    876 +                leave;
    877 +            end
    878 +        end
    879 +        if (j = -1) then
    880 +            iterate;
    881 +
    882 +        if (chBuildType <> 'A' & chBuildType <> 'H' & chBuildType <> 'R') then
    883 +        do
    884 +            say 'invalid build type char:' chBuildType '('asFiles.i')';
    885 +            exit -4;
    886 +        end
    887 +
    888 +        if (chKernelType <> 'U' & chKernelType <> 'S' & chKernelType <> '4') then
    889 +        do
    890 +            say 'invalid kernel type char:' chKernelType '('asFiles.i')';
    891 +            exit -4;
    892 +        end
    893 +
    894 +        /*
    895 +         * Determin version number (based on build number).
    896 +         */
    897 +        iVerMajor = 2;
    898 +        if (iBuild >= 14000) then
    899 +            iVerMinor = 45;
    900 +        else if (iBuild >= 9000) then
    901 +            iVerMinor = 40;
    902 +        else if (iBuild >= 8000) then
    903 +            iVerMinor = 30;
    904 +        else if (iBuild >= 6200) then
    905 +            iVerMinor = 21;
    906 +        else
    907 +        do
    908 +            say 'unsupported build number:' iBuild '('asFiles.i')';
    909 +            exit(-5);
    910 +        end
    911 +
    912 +        /*
    913 +         * Process it
    914 +         */
    915 +        say;
    916 +        say;
    917 +        say 'Processing' asFiles.i'....';
    918 +        if (chBuildType = 'R') then
    919 +            sCmd = sR3Tst '1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev;
    920 +        else
    921 +            sCmd = sR3Tst '1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev asFiles.i||'.SYM';
    922 +        say sCmd;
    923 +        sCmd;
    924 +        if (rc <> 0) then
    925 +        do
    926 +            say 'failed... rc='rc;
    927 +            say 'cmd:' sCmd
    928 +            exit rc;
    929 +        end
    930 +
    931 +    end
    932 +
    933 +    exit(0);
    934 +
    935 +
    936 +
    937 +
    938 +/*
    939 + * Write syntax:
    940 + */
    941 +syntax: procedure;
    942 +    say 'TestKernels.cmd <kKrnlLibR3Tst.exe> <kernel-directory>';
    943      return;
    944 \ No newline at end of file
    945 diff --git a/src/win32k/kKrnlLib/tools/pmdfrexx/pm.cmd b/src/win32k/kKrnlLib/tools/pmdfrexx/pm.cmd
    946 index 5fac2ce..16d6772 100644
    947 --- a/src/win32k/kKrnlLib/tools/pmdfrexx/pm.cmd
    948 +++ b/src/win32k/kKrnlLib/tools/pmdfrexx/pm.cmd
    949 @@ -1,1578 +1,1578 @@
    950 -/**/
    951 -
    952 -
    953 -/*
    954 - * Init stuff.
    955 - */
    956 -signal on NoValue Name SignalHanlder_NoValue;
    957 -NUMERIC DIGITS 11
    958 -
    959 -
    960 -/*
    961 - * Globals
    962 - */
    963 -sGlobals = 'ulHandleTable aProc. sGlobals';
    964 -ulHandleTable = 0;
    965 -aProc.0 = 0;                            /* process table */
    966 -
    967 -
    968 -/*
    969 - * Args
    970 - */
    971 -parse arg sCmd sArgs
    972 -sCmd = lowercase(sCmd);
    973 -sArg = lowercase(sArgs);
    974 -say '';
    975 -
    976 -
    977 -/*
    978 - * Operation
    979 - */
    980 -select
    981 -    /*
    982 -     * pmsems
    983 -     */
    984 -    when (sCmd = 'pmsemcheck') then
    985 -        return pmsemCheck(sArgs);
    986 -    when (sCmd = 'pmsemdump') then
    987 -        return pmsemDump(sArgs);
    988 -    when (sCmd = 'pmsemdumpall') then
    989 -        return PmsemDumpAll(sArgs);
    990 -
    991 -    /*
    992 -     * Windows Structures.
    993 -     */
    994 -    when (sCmd = 'wnddump') then
    995 -        return wndDump(sArgs);
    996 -
    997 -    /*
    998 -     * Window handles.
    999 -     */
    1000 -    when (sCmd = 'hwnd') then
    1001 -        return hwnd2PWND(sArgs);
    1002 -
    1003 -    /*
    1004 -     * PM stuff
    1005 -     */
    1006 -    when (sCMD = 'pmstatus') then
    1007 -        return PmStatus(sArgs);
    1008 -
    1009 -    /*
    1010 -     * Generic dump
    1011 -     */
    1012 -    when (sCmd = 'dump' | sCmd = '.d') then
    1013 -    do
    1014 -        parse var sArgs sStruct sDumperArgs
    1015 -        select
    1016 -            when (sStruct = 'mq') then
    1017 -                return MqDump(sDumperArgs);
    1018 -            when (sStruct = 'pmsem') then
    1019 -                return PmsemDump(sDumperArgs);
    1020 -            when (sStruct = 'qmsg') then
    1021 -                return QmsgDump(sDumperArgs);
    1022 -            when (sStruct = 'sms') then
    1023 -                return SmsDump(sDumperArgs);
    1024 -            when (sStruct = 'sqmsg') then
    1025 -                return SqmsgDump(sDumperArgs);
    1026 -            when (sStruct = 'wnd') then
    1027 -                return WndDump(sDumperArgs);
    1028 -
    1029 -            otherwise
    1030 -                say 'syntax error: no or invalid structure name.';
    1031 -        return syntax(sArgs);
    1032 -        end
    1033 -    end
    1034 -
    1035 -
    1036 -    /*
    1037 -     * Help and syntax error.
    1038 -     */
    1039 -    when (sCmd = '?' | sCmd = 'help' | sCmd = '-?' | sCmd = '/?' | sCmd = '-h' | sCmd = '/h' | sCmd = '--help') then
    1040 -        return syntax(sArgs);
    1041 -    otherwise
    1042 -        say 'syntax error: no or invalid command'
    1043 -        return syntax(sArgs);
    1044 -    end
    1045 -exit(0)
    1046 -
    1047 -/**
    1048 - * Display usage syntax:
    1049 - */
    1050 -syntax: procedure;
    1051 -    parse source . . sSource;
    1052 -    sName = filespec('name', sSource);
    1053 -    say 'PMDF PM Rexx Utils v0.0.1';
    1054 -    say 'syntax: %'sName' <command> [args]';
    1055 -    say 'command:'
    1056 -    say '       checksems       Check the PM semaphores';
    1057 -return -1;
    1058 -
    1059 -/* Procedure which we signals on user syntax errors. */
    1060 -synatxerror:
    1061 -    say 'syntax error!'
    1062 -    call syntax;
    1063 -return -1;
    1064 -
    1065 -
    1066 -
    1067 -/*
    1068 - * PMSEMS/GRESEMS
    1069 - * PMSEMS/GRESEMS
    1070 - * PMSEMS/GRESEMS
    1071 - * PMSEMS/GRESEMS
    1072 - * PMSEMS/GRESEMS
    1073 - * PMSEMS/GRESEMS
    1074 - * PMSEMS/GRESEMS
    1075 - * PMSEMS/GRESEMS
    1076 - * PMSEMS/GRESEMS
    1077 - */
    1078 -/* access functions */
    1079 -pmsemSize:      procedure expose(sGlobals); return 32;
    1080 -pmsemIdent:     procedure expose(sGlobals); parse arg iSem, sMem; return memString(iSem * 32, 7, 1, sMem);
    1081 -pmsem386:       procedure expose(sGlobals); parse arg iSem, sMem; return memByte( iSem * 32 +  7, sMem);
    1082 -pmsemPid:       procedure expose(sGlobals); parse arg iSem, sMem; return memWord( iSem * 32 +  8, sMem);
    1083 -pmsemTid:       procedure expose(sGlobals); parse arg iSem, sMem; return memWord( iSem * 32 + 10, sMem);
    1084 -pmsemPTid:      procedure expose(sGlobals); parse arg iSem, sMem; return memDWord(iSem * 32 +  8, sMem);
    1085 -pmsemNested:    procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 12, sMem);
    1086 -pmsemWaiting:   procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 16, sMem);
    1087 -pmsemUseCount:  procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 20, sMem);/*debug*/
    1088 -pmsemHEV:       procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 24, sMem);
    1089 -pmsemCallAddr:  procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 28, sMem);/*debug*/
    1090 -
    1091 -
    1092 -/**
    1093 - * Structure dumper.
    1094 - * @param   sSemMem     32 byte memory block (at least) containing the PMSEM to dump.
    1095 - * @parma   sMsg        Optional description message. (optional)
    1096 - * @param   iSem        The sem we're dumping. (optional)
    1097 - */
    1098 -pmsemDump1: procedure expose(sGlobals)
    1099 -parse arg sSemMem, sMsg, iSem
    1100 -    if (iSem <> '') then
    1101 -        say sMsg 'PMSEM/GRESEM -' pmsemGetName(iSem);
    1102 -    else
    1103 -        say sMsg 'PMSEM/GRESEM';
    1104 -    say '         acIdent:' pmsemIdent(0, sSemMem);
    1105 -    say '           fcSet:' pmsem386(0, sSemMem);
    1106 -    say '             Tid:' d2x(pmsemTid(0, sSemMem),4);
    1107 -    say '             Pid:' d2x(pmsemPid(0, sSemMem),4);
    1108 -    say 'ulNestedUseCount:' d2x(pmsemNested(0, sSemMem),8);
    1109 -    say '  ulWaitingCount:' d2x(pmsemWaiting(0, sSemMem),8);
    1110 -    say '      ulUseCount:' d2x(pmsemUseCount(0, sSemMem),8);
    1111 -    say '   ulEventHandle:' d2x(pmsemHEV(0, sSemMem),8);
    1112 -    say '    ulCallerAddr:' d2x(pmsemCallAddr(0, sSemMem),8);
    1113 -return 0;
    1114 -
    1115 -
    1116 -
    1117 -
    1118 -
    1119 -/**
    1120 - * Check if any of the PM sems are taken or have bogus state.
    1121 - * @returns 0 on success. -1 on error.
    1122 - */
    1123 -PmsemCheck: procedure expose(sGlobals)
    1124 -    sMem = dfReadMem('pmsemaphores', 35 * pmsemSize())
    1125 -    if (sMem <> '') then
    1126 -    do
    1127 -        /* loop thru them all listing the taken/bogus ones */
    1128 -        cDumps = 0;
    1129 -        say 'info: checking pm/gre sems'
    1130 -        do iSem = 0 to 34
    1131 -            rc = pmsemValidate(iSem, sMem);
    1132 -            if (rc <> 1) then
    1133 -            do
    1134 -                if (cDumps = 0) then say '';
    1135 -                cDumps = cDumps + 1;
    1136 -                if rc = 0 then  sMsg = 'Taken';
    1137 -                else            sMsg = 'Bogus';
    1138 -                call pmsemDump1 memCopy(iSem * pmsemSize(), pmsemSize(), sMem), sMsg, iSem;
    1139 -            end
    1140 -        end
    1141 -        if (cDumps = 0) then
    1142 -            say 'info: pm/gre sems are all free and ok.'
    1143 -        else
    1144 -            say 'info: 'cDumps 'semaphores was taken or bogus.';
    1145 -    end
    1146 -    else
    1147 -        say 'error: failed to read semaphore table.';
    1148 -return -1;
    1149 -
    1150 -
    1151 -/**
    1152 - * Dump a number of pm/gre sems.
    1153 - * @returns 0 on success. -1 on error.
    1154 - */
    1155 -PmsemDump: procedure expose(sGlobals)
    1156 -parse arg sAddr  cCount
    1157 -    /* defaults and param validation */
    1158 -    if (cCount = '' | datatype(cCount) <> 'NUM') then
    1159 -        cCount = 1;
    1160 -    if (sAddr = '') then
    1161 -        signal SyntaxError
    1162 -
    1163 -    /* read memory and do the dump */
    1164 -    sMem = dfReadMem(sAddr, cCount * pmsemSize())
    1165 -    if (sMem <> '') then
    1166 -    do
    1167 -        do i = 0 to cCount - 1
    1168 -            call pmsemDump1 memCopy(i * pmsemSize(), pmsemSize(), sMem);
    1169 -        end
    1170 -    end
    1171 -    else
    1172 -        say 'error: failed to read semaphore table.';
    1173 -return -1;
    1174 -
    1175 -
    1176 -/**
    1177 - * Dumps all PM/GRE sems
    1178 - * @returns 0 on success. -1 on error.
    1179 - */
    1180 -PmsemDumpAll: procedure expose(sGlobals)
    1181 -    /* read memory and do the dump */
    1182 -    sMem = dfReadMem('pmsemaphores', 35 * pmsemSize())
    1183 -    if (sMem <> '') then
    1184 -    do
    1185 -        do i = 0 to 34
    1186 -            call pmsemDump1 memCopy(i * pmsemSize(), pmsemSize(), sMem),, i;
    1187 -        end
    1188 -    end
    1189 -    else
    1190 -        say 'error: failed to read semaphore table.';
    1191 -return -1;
    1192 -
    1193 -
    1194 -/**
    1195 - * Checks a give PM sem is free and not bogus.
    1196 - * @returns 1 if free and not bogus.
    1197 - *          0 if taken.
    1198 - *          -1 if bogus.
    1199 - * @param   iSem    Semaphore index.
    1200 - * @param   sMem    Memory containging the semaphore array.
    1201 - *                  (If no array use iSem=0)
    1202 - */
    1203 -pmsemValidate: procedure expose(sGlobals)
    1204 -parse arg iSem, sMem
    1205 -    if (pmsemPTid(iSem, sMem) <> 0) then
    1206 -        return 0;
    1207 -    if (pos(pmsemIdent(iSem, sMem), "PMSEM;;;;;GRESEM") < 0) then
    1208 -        return -1;
    1209 -    if (pmsemWaiting(iSem, sMem) > 0) then
    1210 -        return -1;
    1211 -    if (pmsemHEV(iSem, sMem) = 0) then
    1212 -        return -1;
    1213 -return 1;
    1214 -
    1215 -
    1216 -/**
    1217 - * Gives us the name of the pmsem at a given index.
    1218 - * @returns Namestring.
    1219 - * @param   i   Index
    1220 - */
    1221 -pmsemGetName: procedure expose(sGlobals)
    1222 -parse arg i
    1223 -    select
    1224 -        when i = 0  then return 'PMSEM_ATOM';
    1225 -        when i = 1  then return 'PMSEM_USER';
    1226 -        when i = 2  then return 'PMSEM_VISLOCK';
    1227 -        when i = 3  then return 'PMSEM_DEBUG';
    1228 -        when i = 4  then return 'PMSEM_HOOK';
    1229 -        when i = 5  then return 'PMSEM_HEAP';
    1230 -        when i = 6  then return 'PMSEM_DLL';
    1231 -        when i = 7  then return 'PMSEM_THUNK';
    1232 -        when i = 8  then return 'PMSEM_XLCE';
    1233 -        when i = 9  then return 'PMSEM_UPDATE';
    1234 -        when i = 10 then return 'PMSEM_CLIP';
    1235 -        when i = 11 then return 'PMSEM_INPUT';
    1236 -        when i = 12 then return 'PMSEM_DESKTOP';
    1237 -        when i = 13 then return 'PMSEM_HANDLE';
    1238 -        when i = 14 then return 'PMSEM_ALARM';
    1239 -        when i = 15 then return 'PMSEM_STRRES';
    1240 -        when i = 16 then return 'PMSEM_TIMER';
    1241 -        when i = 17 then return 'PMSEM_CONTROLS';
    1242 -        when i = 18 then return 'GRESEM_GREINIT';
    1243 -        when i = 19 then return 'GRESEM_AUTOHEAP';
    1244 -        when i = 20 then return 'GRESEM_PDEV';
    1245 -        when i = 21 then return 'GRESEM_LDEV';
    1246 -        when i = 22 then return 'GRESEM_CODEPAGE';
    1247 -        when i = 23 then return 'GRESEM_HFONT';
    1248 -        when i = 24 then return 'GRESEM_FONTCNTXT';
    1249 -        when i = 25 then return 'GRESEM_FNTDRVR';
    1250 -        when i = 26 then return 'GRESEM_SHMALLOC';
    1251 -        when i = 27 then return 'GRESEM_GLOBALDATA';
    1252 -        when i = 28 then return 'GRESEM_DBCSENV';
    1253 -        when i = 29 then return 'GRESEM_SRVLOCK';
    1254 -        when i = 30 then return 'GRESEM_SELLOCK';
    1255 -        when i = 31 then return 'GRESEM_PROCLOCK';
    1256 -        when i = 32 then return 'GRESEM_DRIVERSEM';
    1257 -        when i = 33 then return 'GRESEM_SEMLFICACHE';
    1258 -        when i = 34 then return 'GRESEM_SEMFONTTABLE';
    1259 -    otherwise
    1260 -    end
    1261 -return 'Unknown-'i;
    1262 -
    1263 -
    1264 -
    1265 -/*
    1266 - * WINDOW STRUCTURE (WND)
    1267 - * WINDOW STRUCTURE (WND)
    1268 - * WINDOW STRUCTURE (WND)
    1269 - * WINDOW STRUCTURE (WND)
    1270 - * WINDOW STRUCTURE (WND)
    1271 - * WINDOW STRUCTURE (WND)
    1272 - * WINDOW STRUCTURE (WND)
    1273 - * WINDOW STRUCTURE (WND)
    1274 - * WINDOW STRUCTURE (WND)
    1275 - * WINDOW STRUCTURE (WND)
    1276 - */
    1277 -/* size and access functions */
    1278 -wndSize:            procedure expose(sGlobals); return 144; /* guesswork! */
    1279 -
    1280 -wndNext:            procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('00'), sMem);
    1281 -wndParent:          procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('04'), sMem);
    1282 -wndChild:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('08'), sMem);
    1283 -wndOwner:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('0c'), sMem);
    1284 -wndRecs:            procedure expose(sGlobals); parse arg iWord,sMem;return memWord( x2d('10') + iWord*2, sMem);
    1285 -wndStyle:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('18'), sMem);
    1286 -wndId:              procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('1c'), sMem);
    1287 -wndReserved0:       procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('20'), sMem);
    1288 -wndReserved1:       procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('24'), sMem);
    1289 -wndMsgQueue:        procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('28'), sMem);
    1290 -wndHWND:            procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('2c'), sMem);
    1291 -wndModel:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('30'), sMem);
    1292 -wndProc:            procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('34'), sMem);
    1293 -wndThunkProc:       procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('38'), sMem);
    1294 -wndPresParams:      procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('40'), sMem);
    1295 -wndFocus:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('44'), sMem);
    1296 -wndWPSULong:        procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('48'), sMem);
    1297 -wndInstData:        procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('50'), sMem);
    1298 -wndOpen32:          procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('58'), sMem);
    1299 -/*
    1300 -wndWord:            procedure expose(sGlobals); parse arg iWord,sMem;return memDword(96 + iWord*4, sMem);
    1301 -*/
    1302 -/** dump one wnd structure */
    1303 -wndDump1: procedure expose(sGlobals)
    1304 -parse arg sMem, sMsg
    1305 -    if (sMsg <> '') then
    1306 -        say sMsg
    1307 -    say '      pwndNext:' d2x(wndNext(sMem),8);
    1308 -    say '    pwndParent:' d2x(wndParent(sMem),8);
    1309 -    say '     pwndChild:' d2x(wndChild(sMem),8);
    1310 -    say '     pwndOwner:' d2x(wndOwner(sMem),8);
    1311 -    say '     rcsWindow: xl='wndRecs(0, sMem)',yl='wndRecs(1, sMem),
    1312 -                        'xr='wndRecs(2, sMem)',yr='wndRecs(3, sMem) '(decimal)'
    1313 -    say '       ulStyle:' d2x(wndStyle(sMem),8);
    1314 -    say '            id:' d2x(wndId(sMem),8);
    1315 -    say '     Reserved0:' d2x(wndReserved0(sMem),8);
    1316 -    say '     Reserved1:' d2x(wndReserved1(sMem),8);
    1317 -    say '   pmqMsgQueue:' d2x(wndMsgQueue(sMem),8);
    1318 -    say '          hwnd:' d2x(wndHWND(sMem),8);
    1319 -    say '   fModel16bit:' d2x(wndModel(sMem),8);
    1320 -    say '    pfnWinProc:' d2x(wndProc(sMem),8)  '('dfNear('%'d2x(wndProc(sMem),8))')'
    1321 -    if (wndThunkProc(sMem) = 0) then
    1322 -        say '  pfnThunkProc:' d2x(wndThunkProc(sMem),8)
    1323 -    else
    1324 -        say '  pfnThunkProc:' d2x(wndThunkProc(sMem),8) ' ('dfNear('%'d2x(wndThunkProc(sMem),8))')'
    1325 -    say '   ppresParams:' d2x(wndPresParams(sMem),8);
    1326 -    say '     pwndFocus:' d2x(wndFocus(sMem),8);
    1327 -    say '         ulWPS:' d2x(wndWPSULong(sMem),8) '('dfNear('%'d2x(wndWPSULong(sMem),8))')'
    1328 -    say '     pInstData:' d2x(wndInstData(sMem),8);
    1329 -    say '            ??:' d2x(memDword(x2d('54'), sMem),8);
    1330 -    say '       pOpen32:' d2x(wndOpen32(sMem),8);
    1331 -/*  This aint right!
    1332 -    i = 0;
    1333 -    do while (i < 12)
    1334 -        say ' aulWin['d2x(i,2)'-'d2x(i+3,2)']: '||,
    1335 -                             d2x(wndWord(i+0, sMem), 8) d2x(wndWord(i+1, sMem), 8),
    1336 -                             d2x(wndWord(i+2, sMem), 8) d2x(wndWord(i+3, sMem), 8)
    1337 -        i = i + 4;
    1338 -    end
    1339 -*/
    1340 -return 0;
    1341 -
    1342 -
    1343 -/**
    1344 - * Dump window structures.
    1345 - */
    1346 -WndDump: procedure expose(sGlobals)
    1347 -parse arg sAddr cCount
    1348 -    /*defaults and param validation */
    1349 -    if (cCount = '' | datatype(cCount) <> 'NUM') then
    1350 -        cCount = 1;
    1351 -    if (sAddr = '') then
    1352 -        signal SyntaxError
    1353 -    if (hwndIsHandle(sAddr)) then
    1354 -    do
    1355 -        ulPWND = hwnd2PWND(sAddr);
    1356 -        if (ulPWND > 0) then
    1357 -            sAddr = '%'d2x(ulPWND);
    1358 -    end
    1359 -
    1360 -    /* read memory */
    1361 -    sMem = dfReadMem(sAddr, cCount * wndSize())
    1362 -    if (sMem <> '') then
    1363 -    do
    1364 -        /* loop thru them all listing the taken/bogus ones */
    1365 -        do i = 0 to cCount - 1
    1366 -            call wndDump1 memCopy(i * wndSize(), wndSize(), sMem);
    1367 -        end
    1368 -    end
    1369 -    else
    1370 -        say 'error: failed to read window structure at '''sAddr'''.';
    1371 -return 0;
    1372 -
    1373 -
    1374 -
    1375 -
    1376 -/*
    1377 - * WINDOW HANDLE (HWND)
    1378 - * WINDOW HANDLE (HWND)
    1379 - * WINDOW HANDLE (HWND)
    1380 - * WINDOW HANDLE (HWND)
    1381 - * WINDOW HANDLE (HWND)
    1382 - * WINDOW HANDLE (HWND)
    1383 - * WINDOW HANDLE (HWND)
    1384 - * WINDOW HANDLE (HWND)
    1385 - */
    1386 -hwnd2PWND: procedure expose(sGlobals)
    1387 -parse arg sHwnd sDummy
    1388 -    ulIndex = x2d(right(sHwnd, 4));
    1389 -    ulBase = hwndpHandleTable();
    1390 -    if (ulBase = 0) then
    1391 -        return 0;
    1392 -
    1393 -    ulHandleEntry = ulBase + ulIndex * 8 + 32;
    1394 -return dfReadDword('%'d2x(ulHandleEntry, 8), 4);
    1395 -
    1396 -
    1397 -/**
    1398 - * Checks if a value is a hwnd.
    1399 - * @returns true/false.
    1400 - * @param   sValue  Value in question.
    1401 - */
    1402 -hwndIsHandle: procedure expose(sGlobals)
    1403 -parse arg sValue sDummy
    1404 -
    1405 -    /* Paranoid check if this is a number or hex value or whatever*/
    1406 -    sValue = strip(sValue);
    1407 -    if (sValue = '') then
    1408 -        return 0;
    1409 -    if (datatype(sValue) <> 'NUM') then
    1410 -    do  /* assumes kind of hexx */
    1411 -        sValue = translate(sValue);
    1412 -        if (left(sValue, 2) = '0X') then
    1413 -            sValue = substr(sValue, 3);
    1414 -        if (right(sValue,1) = 'H') then
    1415 -            sValue = substr(sValue, 1, length(sValue) - 1);
    1416 -        if (sValue = '') then
    1417 -            return 0;
    1418 -        if (strip(translate(sValue, '', '123456767ABCDEF')) <> '') then
    1419 -            return 0;
    1420 -        ulValue = x2d(sValue);
    1421 -    end
    1422 -    else
    1423 -    do  /* check if decimal value, if not try hex */
    1424 -        if (sValue >= x2d('80000001') & sValue < x2d('8000ffff')) then
    1425 -            return 1;
    1426 -         ulValue = x2d(sValue);
    1427 -    end
    1428 -
    1429 -    /* Check for valid handle range. */
    1430 -return ulValue >= x2d('80000001') & ulValue < x2d('8000ffff');
    1431 -
    1432 -
    1433 -/**
    1434 - * Gets the pointer to the handle table.
    1435 - */
    1436 -hwndpHandleTable: procedure expose(sGlobals)
    1437 -    if (ulHandleTable > 0) then
    1438 -        return ulHandleTable;
    1439 -
    1440 -    ulHandleTable = dfReadDword('pHandleTable', 4);
    1441 -    if (ulHandleTable > 0) then
    1442 -        return ulHandleTable
    1443 -    say 'error-hwndpHandleTable: failed to read pHandleTable';
    1444 -return 0;
    1445 -
    1446 -
    1447 -
    1448 -/*
    1449 - * MESSAGE QUEUE STRUCTURE (MQ)
    1450 - * MESSAGE QUEUE STRUCTURE (MQ)
    1451 - * MESSAGE QUEUE STRUCTURE (MQ)
    1452 - * MESSAGE QUEUE STRUCTURE (MQ)
    1453 - * MESSAGE QUEUE STRUCTURE (MQ)
    1454 - * MESSAGE QUEUE STRUCTURE (MQ)
    1455 - * MESSAGE QUEUE STRUCTURE (MQ)
    1456 - * MESSAGE QUEUE STRUCTURE (MQ)
    1457 - * MESSAGE QUEUE STRUCTURE (MQ)
    1458 - */
    1459 -mqSize:             procedure expose(sGlobals);                     return x2d('b0');
    1460 -mqNext:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('00'), sMem);
    1461 -mqEntrySize:        procedure expose(sGlobals); parse arg sMem;     return memWord(x2d('04'), sMem);
    1462 -/*mqQueue:            procedure expose(sGlobals);  parse arg sMem;     return memWord(x2d('06'), sMem);*/
    1463 -mqMessages:         procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('08'), sMem);
    1464 -/* ?? */
    1465 -mqMaxMessages:      procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('0c'), sMem);
    1466 -mqPid:              procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('18'), sMem);
    1467 -mqTid:              procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('1c'), sMem);
    1468 -mqFirstMsg:         procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('20'), sMem);
    1469 -mqLastMsg:          procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('24'), sMem);
    1470 -mqSGid:             procedure expose(sGlobals); parse arg sMem;     return memWord(x2d('28'), sMem);
    1471 -mqHev:              procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('2c'), sMem);
    1472 -mqSent:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('3c'), sMem);
    1473 -mqCurrent:          procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('40'), sMem);
    1474 -
    1475 -mqBadPwnd:          procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('68'), sMem);
    1476 -mqBadQueue:         procedure expose(sGlobals); parse arg sMem;     return memByte(x2d('6c'), sMem);
    1477 -mqCountTimers:      procedure expose(sGlobals); parse arg sMem;     return memByte(x2d('6d'), sMem);
    1478 -mqHeap:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('70'), sMem);
    1479 -mqHAccel:           procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('74'), sMem);
    1480 -
    1481 -mqShutdown:         procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('90'), sMem);
    1482 -
    1483 -mqRcvdSMSList:      procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('98'), sMem);
    1484 -mqSlot:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('a0'), sMem);
    1485 -
    1486 -/** dump one mq structure */
    1487 -mqDump1: procedure expose(sGlobals)
    1488 -parse arg sMem;
    1489 -    say '     pmqNext:' d2x(mqNext(sMem), 8);
    1490 -    say '     cbEntry:' d2x(mqEntrySize(sMem), 8);
    1491 -    say '   cMessages:' d2x(mqMessages(sMem), 8);
    1492 -    say 'cMaxMessages:' d2x(mqMaxMessages(sMem), 8);
    1493 -    say '         Tid:' d2x(mqTid(sMem), 8);
    1494 -    say '         Pid:' d2x(mqPid(sMem), 8);
    1495 -    say 'psmsFirstMsg:' d2x(mqFirstMsg(sMem), 8);
    1496 -    say ' psmsLastMsg:' d2x(mqLastMsg(sMem), 8);
    1497 -    say '        SGId:' d2x(mqSGid(sMem), 8);
    1498 -    say '         hev:' d2x(mqHev(sMem), 8);
    1499 -    say '    psmsSent:' d2x(mqSent(sMem), 8);
    1500 -    say ' psmsCurrent:' d2x(mqCurrent(sMem), 8);
    1501 -    say '     pwndBad:' d2x(mqBadPWND(sMem), 8);
    1502 -    say '   fBadQueue:' d2x(mqBadQueue(sMem), 2);
    1503 -    say '     cTimers:' d2x(mqCountTimers(sMem), 2);
    1504 -    say '       pHeap:' d2x(mqHeap(sMem), 8);
    1505 -    say '      HACCEL:' d2x(mqHAccel(sMem), 8);
    1506 -    say ' fchShutdown:' d2x(mqShutdown(sMem), 2);
    1507 -    say ' RcvdSMSList:' d2x(mqRcvdSMSList(sMem), 8);
    1508 -    say '        Slot:' d2x(mqSlot(sMem), 4);
    1509 -return 0;
    1510 -
    1511 -
    1512 -/**
    1513 - * Message queue dumper.
    1514 - * @param   sAddr   Address expression of a MQ struct, or a window
    1515 - *                  which message queue you wanna dump.
    1516 - * @returns 0
    1517 - */
    1518 -mqDump: procedure expose(sGlobals)
    1519 -parse arg sAddr cCount
    1520 -    /*defaults and param validation */
    1521 -    if (cCount = '' | datatype(cCount) <> 'NUM') then
    1522 -        cCount = 1;
    1523 -    if (sAddr = '') then
    1524 -        signal SyntaxError
    1525 -
    1526 -    /*
    1527 -     * The user might have passed in an window handle.
    1528 -     * If so we'll dump it's queue.
    1529 -     */
    1530 -    if (hwndIsHandle(sAddr)) then
    1531 -    do  /* input is a hwnd, we will try dump it's queue */
    1532 -        ulPWND = hwnd2PWND(sAddr);
    1533 -        if (ulPWND > 0) then
    1534 -        do
    1535 -            sMem = dfReadMem('%'d2x(ulPWND), wndSize());
    1536 -            if (sMem <> '') then
    1537 -            do
    1538 -                ulMQ = wndMsgQueue(sMem);
    1539 -                if (ulMq > 0) then
    1540 -                    sAddr = '%'d2x(ulPWND);
    1541 -            end
    1542 -            drop sMem;
    1543 -        end
    1544 -    end
    1545 -
    1546 -    /* read memory */
    1547 -    sMem = dfReadMem(sAddr, cCount * mqSize())
    1548 -    if (sMem <> '') then
    1549 -    do
    1550 -        /* loop thru them all listing the taken/bogus ones */
    1551 -        do i = 0 to cCount - 1
    1552 -            call mqDump1 memCopy(i * mqSize(), mqSize(), sMem);
    1553 -        end
    1554 -    end
    1555 -    else
    1556 -        say 'error: failed to read window structure at '''sAddr'''.';
    1557 -return 0;
    1558 -
    1559 -
    1560 -/*
    1561 - * SENDMSG STRUCTRURE (SMS)
    1562 - * SENDMSG STRUCTRURE (SMS)
    1563 - * SENDMSG STRUCTRURE (SMS)
    1564 - * SENDMSG STRUCTRURE (SMS)
    1565 - * SENDMSG STRUCTRURE (SMS)
    1566 - * SENDMSG STRUCTRURE (SMS)
    1567 - * SENDMSG STRUCTRURE (SMS)
    1568 - */
    1569 -smsSize:            procedure expose(sGlobals);                     return 64;
    1570 -smsNextMaster:      procedure expose(sGlobals); parse arg sMem;     return memDword(0, sMem);
    1571 -smsSendHead:        procedure expose(sGlobals); parse arg sMem;     return memDword(4, sMem);
    1572 -smsReserved0:       procedure expose(sGlobals); parse arg sMem;     return memDword(8, sMem);
    1573 -smsReceiveNext:     procedure expose(sGlobals); parse arg sMem;     return memDword(12, sMem);
    1574 -smsTime:            procedure expose(sGlobals); parse arg sMem;     return memDword(16, sMem);
    1575 -smsSenderPMQ:       procedure expose(sGlobals); parse arg sMem;     return memDword(20, sMem);
    1576 -smsReceiverPMQ:     procedure expose(sGlobals); parse arg sMem;     return memDword(24, sMem);
    1577 -smsResult:          procedure expose(sGlobals); parse arg sMem;     return memDword(28, sMem);
    1578 -smsReserved1:       procedure expose(sGlobals); parse arg sMem;     return memDword(32, sMem);
    1579 -smsPWND:            procedure expose(sGlobals); parse arg sMem;     return memDword(36, sMem);
    1580 -smsMsgId:           procedure expose(sGlobals); parse arg sMem;     return memDword(40, sMem);
    1581 -smsMP1:             procedure expose(sGlobals); parse arg sMem;     return memDword(44, sMem);
    1582 -smsMP2:             procedure expose(sGlobals); parse arg sMem;     return memDword(48, sMem);
    1583 -smsReserved2:       procedure expose(sGlobals); parse arg sMem;     return memDword(52, sMem);
    1584 -smsReserved3:       procedure expose(sGlobals); parse arg sMem;     return memDword(56, sMem);
    1585 -smsReserved4:       procedure expose(sGlobals); parse arg sMem;     return memDword(60, sMem);
    1586 -
    1587 -/** Dumps one sms structure */
    1588 -smsDump1: procedure expose(sGlobals)
    1589 -parse arg sMem
    1590 -    say ' psmsMasterNext:' d2x(smsNextMaster(sMem),8)
    1591 -    say '   psmsSendHead:' d2x(smsSendHead(sMem),8)
    1592 -    say '      Reserved0:' d2x(smsReserved0(sMem),8)
    1593 -    say 'psmsReceiveNext:' d2x(smsReceiveNext(sMem),8)
    1594 -    say '           Time:' d2x(smsTime(sMem),8)
    1595 -    say '      pmqSender:' d2x(smsSenderPMQ(sMem),8)
    1596 -    say '    pmqReceiver:' d2x(smsReceiverPMQ(sMem),8)
    1597 -    say '       ulResult:' d2x(smsResult(sMem),8)
    1598 -    say '      Reserved1:' d2x(smsReserved1(sMem),8)
    1599 -    say '           pWnd:' d2x(smsPWND(sMem),8)
    1600 -    say '        ulMsgId:' d2x(smsMsgId(sMem),8) '('msgMsgIdToText(smsMsgId(sMem))')'
    1601 -    say '            MP1:' d2x(smsMP1(sMem),8)
    1602 -    say '            MP2:' d2x(smsMP2(sMem),8)
    1603 -    say '      Reserved2:' d2x(smsReserved2(sMem),8)
    1604 -    say '      Reserved3:' d2x(smsReserved3(sMem),8)
    1605 -    say '      Reserved4:' d2x(smsReserved4(sMem),8)
    1606 -return 0;
    1607 -
    1608 -
    1609 -/**
    1610 - * Send message struct (SMS) dumper.
    1611 - * @param   sAddr   Address expression of a sms struct.
    1612 - * @returns 0
    1613 - */
    1614 -SmsDump: procedure expose(sGlobals)
    1615 -parse arg sAddr cCount
    1616 -    /*defaults and param validation */
    1617 -    if (cCount = '' | datatype(cCount) <> 'NUM') then
    1618 -        cCount = 1;
    1619 -    if (sAddr = '') then
    1620 -        signal SyntaxError
    1621 -
    1622 -    /* read memory */
    1623 -    sMem = dfReadMem(sAddr, cCount * smsSize())
    1624 -    if (sMem <> '') then
    1625 -    do
    1626 -        /* loop thru them all listing the taken/bogus ones */
    1627 -        do i = 0 to cCount - 1
    1628 -            call smsDump1 memCopy(i * smsSize(), smsSize(), sMem);
    1629 -        end
    1630 -    end
    1631 -    else
    1632 -        say 'error: failed to read SMS structure at '''sAddr'''.';
    1633 -return 0;
    1634 -
    1635 -
    1636 -/*
    1637 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1638 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1639 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1640 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1641 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1642 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1643 - * PM QUEUE MESSAGE STRUCTURE (QMSG)
    1644 - */
    1645 -qmsgSize:           procedure expose(sGlobals);                     return 32;
    1646 -qmsgHwnd:           procedure expose(sGlobals); parse arg sMem;     return memDword(0, sMem);
    1647 -qmsgMsgId:          procedure expose(sGlobals); parse arg sMem;     return memDword(4, sMem);
    1648 -qmsgMP1:            procedure expose(sGlobals); parse arg sMem;     return memDword(8, sMem);
    1649 -qmsgMP2:            procedure expose(sGlobals); parse arg sMem;     return memDword(12, sMem);
    1650 -qmsgTime:           procedure expose(sGlobals); parse arg sMem;     return memDword(16, sMem);
    1651 -qmsgPtlX:           procedure expose(sGlobals); parse arg sMem;     return memDword(20, sMem);
    1652 -qmsgPtlY:           procedure expose(sGlobals); parse arg sMem;     return memDword(24, sMem);
    1653 -qmsgReserved:       procedure expose(sGlobals); parse arg sMem;     return memDword(28, sMem);
    1654 -
    1655 -qmsgDump1: procedure expose(sGlobals);
    1656 -parse arg sMem
    1657 -    say '     Hwnd:' d2x(qmsgHwnd(sMem),8)
    1658 -    say '    MsgId:' d2x(qmsgMsgId(sMem),8) '('msgMsgIdToText(qmsgMsgId(sMem))')'
    1659 -    say '      MP1:' d2x(qmsgMP1(sMem),8)
    1660 -    say '      MP2:' d2x(qmsgMP2(sMem),8)
    1661 -    say '     Time:' d2x(qmsgTime(sMem),8)
    1662 -    say '    Ptl.x:' d2x(qmsgPtlX(sMem),8)
    1663 -    say '    Ptl.y:' d2x(qmsgPtlY(sMem),8)
    1664 -    say ' Reserved:' d2x(qmsgReserved(sMem),8)
    1665 -return 0;
    1666 -
    1667 -
    1668 -/**
    1669 - * Queue message struct (QMSG) dumper.
    1670 - * @param   sAddr   Address expression of a sms struct.
    1671 - * @returns 0
    1672 - */
    1673 -QmsgDump: procedure expose(sGlobals)
    1674 -parse arg sAddr cCount
    1675 -    /*defaults and param validation */
    1676 -    if (cCount = '' | datatype(cCount) <> 'NUM') then
    1677 -        cCount = 1;
    1678 -    if (sAddr = '') then
    1679 -        signal SyntaxError
    1680 -
    1681 -    /* read memory */
    1682 -    sMem = dfReadMem(sAddr, cCount * qmsgSize())
    1683 -    if (sMem <> '') then
    1684 -    do
    1685 -        /* loop thru them all listing the taken/bogus ones */
    1686 -        do i = 0 to cCount - 1
    1687 -            call qmsgDump1 memCopy(i * qmsgSize(), qmsgSize(), sMem);
    1688 -        end
    1689 -    end
    1690 -    else
    1691 -        say 'error: failed to read QMSG structure at '''sAddr'''.';
    1692 -return 0;
    1693 -
    1694 -
    1695 -/*
    1696 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1697 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1698 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1699 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1700 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1701 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1702 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1703 - * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    1704 - */
    1705 -sqmsgSize:           procedure expose(sGlobals);                     return 32;
    1706 -sqmsgMsgId:          procedure expose(sGlobals); parse arg sMem;     return memDword(0, sMem);
    1707 -sqmsgMP1:            procedure expose(sGlobals); parse arg sMem;     return memDword(4, sMem);
    1708 -sqmsgMP2:            procedure expose(sGlobals); parse arg sMem;     return memDword(8, sMem);
    1709 -sqmsgTime:           procedure expose(sGlobals); parse arg sMem;     return memDword(12, sMem);
    1710 -sqmsgReserved0:      procedure expose(sGlobals); parse arg sMem;     return memDword(16, sMem);
    1711 -sqmsgReserved1:      procedure expose(sGlobals); parse arg sMem;     return memDword(20, sMem);
    1712 -sqmsgReserved2:      procedure expose(sGlobals); parse arg sMem;     return memDword(24, sMem);
    1713 -sqmsgReserved3:      procedure expose(sGlobals); parse arg sMem;     return memDword(28, sMem);
    1714 -
    1715 -sqmsgDump1: procedure expose(sGlobals);
    1716 -parse arg sMem
    1717 -    say '    MsgId:' d2x(sqmsgMsgId(sMem),8) '('msgMsgIdToText(sqmsgMsgId(sMem))')'
    1718 -    say '      MP1:' d2x(sqmsgMP1(sMem),8)
    1719 -    say '      MP2:' d2x(sqmsgMP2(sMem),8)
    1720 -    say '     Time:' d2x(sqmsgTime(sMem),8)
    1721 -    say 'Reserved0:' d2x(sqmsgReserved0(sMem),8)
    1722 -    say 'Reserved1:' d2x(sqmsgReserved1(sMem),8)
    1723 -    say 'Reserved2:' d2x(sqmsgReserved2(sMem),8)
    1724 -    say 'Reserved3:' d2x(sqmsgReserved3(sMem),8)
    1725 -return 0;
    1726 -
    1727 -
    1728 -/**
    1729 - * System Queue message struct (SQMSG) dumper.
    1730 - * @param   sAddr   Address expression of a sqmsg struct.
    1731 - * @returns 0
    1732 - */
    1733 -SqmsgDump: procedure expose(sGlobals)
    1734 -parse arg sAddr cCount
    1735 -    /*defaults and param validation */
    1736 -    if (cCount = '' | datatype(cCount) <> 'NUM') then
    1737 -        cCount = 1;
    1738 -    if (sAddr = '') then
    1739 -        signal SyntaxError
    1740 -
    1741 -    /* read memory */
    1742 -    sMem = dfReadMem(sAddr, cCount * sqmsgSize())
    1743 -    if (sMem <> '') then
    1744 -    do
    1745 -        /* loop thru them all listing the taken/bogus ones */
    1746 -        do i = 0 to cCount - 1
    1747 -            call sqmsgDump1 memCopy(i * sqmsgSize(), sqmsgSize(), sMem);
    1748 -        end
    1749 -    end
    1750 -    else
    1751 -        say 'error: failed to read SQMSG structure at '''sAddr'''.';
    1752 -return 0;
    1753 -
    1754 -
    1755 -/*
    1756 - * MSG HELPERS
    1757 - * MSG HELPERS
    1758 - * MSG HELPERS
    1759 - * MSG HELPERS
    1760 - * MSG HELPERS
    1761 - * MSG HELPERS
    1762 - * MSG HELPERS
    1763 - * MSG HELPERS
    1764 - */
    1765 -
    1766 -/**
    1767 - * translates a message ID into a message define string
    1768 - * @param   iMsgId  The message id in question.
    1769 - * @returns Symbol name.
    1770 - *          '' if unknown.
    1771 - */
    1772 -msgMsgIdToText: procedure
    1773 -parse arg iMsgId
    1774 -    select
    1775 -        when (iMsgId = x2d('0000')) then return 'WM_NULL';
    1776 -        when (iMsgId = x2d('0001')) then return 'WM_CREATE';
    1777 -        when (iMsgId = x2d('0002')) then return 'WM_DESTROY';
    1778 -        /*when (iMsgId == x2d('0003')) then return '';*/
    1779 -        when (iMsgId = x2d('0004')) then return 'WM_ENABLE';
    1780 -        when (iMsgId = x2d('0005')) then return 'WM_SHOW';
    1781 -        when (iMsgId = x2d('0006')) then return 'WM_MOVE';
    1782 -        when (iMsgId = x2d('0007')) then return 'WM_SIZE';
    1783 -        when (iMsgId = x2d('0008')) then return 'WM_ADJUSTWINDOWPOS';
    1784 -        when (iMsgId = x2d('0009')) then return 'WM_CALCVALIDRECTS';
    1785 -        when (iMsgId = x2d('000a')) then return 'WM_SETWINDOWPARAMS';
    1786 -        when (iMsgId = x2d('000b')) then return 'WM_QUERYWINDOWPARAMS';
    1787 -        when (iMsgId = x2d('000c')) then return 'WM_HITTEST';
    1788 -        when (iMsgId = x2d('000d')) then return 'WM_ACTIVATE';
    1789 -        when (iMsgId = x2d('000f')) then return 'WM_SETFOCUS';
    1790 -        when (iMsgId = x2d('0010')) then return 'WM_SETSELECTION';
    1791 -        when (iMsgId = x2d('0011')) then return 'WM_PPAINT';
    1792 -        when (iMsgId = x2d('0012')) then return 'WM_PSETFOCUS';
    1793 -        when (iMsgId = x2d('0013')) then return 'WM_PSYSCOLORCHANGE';
    1794 -        when (iMsgId = x2d('0014')) then return 'WM_PSIZE';
    1795 -        when (iMsgId = x2d('0015')) then return 'WM_PACTIVATE';
    1796 -        when (iMsgId = x2d('0016')) then return 'WM_PCONTROL';
    1797 -        when (iMsgId = x2d('0020')) then return 'WM_COMMAND';
    1798 -        when (iMsgId = x2d('0021')) then return 'WM_SYSCOMMAND';
    1799 -        when (iMsgId = x2d('0022')) then return 'WM_HELP';
    1800 -        when (iMsgId = x2d('0023')) then return 'WM_PAINT';
    1801 -        when (iMsgId = x2d('0024')) then return 'WM_TIMER';
    1802 -        when (iMsgId = x2d('0025')) then return 'WM_SEM1';
    1803 -        when (iMsgId = x2d('0026')) then return 'WM_SEM2';
    1804 -        when (iMsgId = x2d('0027')) then return 'WM_SEM3';
    1805 -        when (iMsgId = x2d('0028')) then return 'WM_SEM4';
    1806 -        when (iMsgId = x2d('0029')) then return 'WM_CLOSE';
    1807 -        when (iMsgId = x2d('002a')) then return 'WM_QUIT';
    1808 -        when (iMsgId = x2d('002b')) then return 'WM_SYSCOLORCHANGE';
    1809 -        when (iMsgId = x2d('002d')) then return 'WM_SYSVALUECHANGED';
    1810 -        when (iMsgId = x2d('002e')) then return 'WM_APPTERMINATENOTIFY';
    1811 -        when (iMsgId = x2d('002f')) then return 'WM_PRESPARAMCHANGED';
    1812 -        when (iMsgId = x2d('0030')) then return 'WM_CONTROL';
    1813 -        when (iMsgId = x2d('0031')) then return 'WM_VSCROLL';
    1814 -        when (iMsgId = x2d('0032')) then return 'WM_HSCROLL';
    1815 -        when (iMsgId = x2d('0033')) then return 'WM_INITMENU';
    1816 -        when (iMsgId = x2d('0034')) then return 'WM_MENUSELECT';
    1817 -        when (iMsgId = x2d('0035')) then return 'WM_MENUEND';
    1818 -        when (iMsgId = x2d('0036')) then return 'WM_DRAWITEM';
    1819 -        when (iMsgId = x2d('0037')) then return 'WM_MEASUREITEM';
    1820 -        when (iMsgId = x2d('0038')) then return 'WM_CONTROLPOINTER';
    1821 -        when (iMsgId = x2d('003a')) then return 'WM_QUERYDLGCODE';
    1822 -        when (iMsgId = x2d('003b')) then return 'WM_INITDLG';
    1823 -        when (iMsgId = x2d('003c')) then return 'WM_SUBSTITUTESTRING';
    1824 -        when (iMsgId = x2d('003d')) then return 'WM_MATCHMNEMONIC';
    1825 -        when (iMsgId = x2d('003e')) then return 'WM_SAVEAPPLICATION';
    1826 -        when (iMsgId = x2d('0490')) then return 'WM_SEMANTICEVENT';
    1827 -        when (iMsgId = x2d('1000')) then return 'WM_USER';
    1828 -        when (iMsgId = x2d('007e')) then return 'WM_VRNDISABLED';
    1829 -        when (iMsgId = x2d('007f')) then return 'WM_VRNENABLED';
    1830 -        when (iMsgId = x2d('007a')) then return 'WM_CHAR';
    1831 -        when (iMsgId = x2d('007b')) then return 'WM_VIOCHAR';
    1832 -        when (iMsgId = x2d('0070')) then return 'WM_MOUSEMOVE';
    1833 -        when (iMsgId = x2d('0071')) then return 'WM_BUTTON1DOWN';
    1834 -        when (iMsgId = x2d('0072')) then return 'WM_BUTTON1UP';
    1835 -        when (iMsgId = x2d('0073')) then return 'WM_BUTTON1DBLCLK';
    1836 -        when (iMsgId = x2d('0074')) then return 'WM_BUTTON2DOWN';
    1837 -        when (iMsgId = x2d('0075')) then return 'WM_BUTTON2UP';
    1838 -        when (iMsgId = x2d('0076')) then return 'WM_BUTTON2DBLCLK';
    1839 -        when (iMsgId = x2d('0077')) then return 'WM_BUTTON3DOWN';
    1840 -        when (iMsgId = x2d('0078')) then return 'WM_BUTTON3UP';
    1841 -        when (iMsgId = x2d('0079')) then return 'WM_BUTTON3DBLCLK';
    1842 -        when (iMsgId = x2d('007D')) then return 'WM_MOUSEMAP';
    1843 -        when (iMsgId = x2d('0410')) then return 'WM_CHORD';
    1844 -        when (iMsgId = x2d('0411')) then return 'WM_BUTTON1MOTIONSTART';
    1845 -        when (iMsgId = x2d('0412')) then return 'WM_BUTTON1MOTIONEND';
    1846 -        when (iMsgId = x2d('0413')) then return 'WM_BUTTON1CLICK';
    1847 -        when (iMsgId = x2d('0414')) then return 'WM_BUTTON2MOTIONSTART';
    1848 -        when (iMsgId = x2d('0415')) then return 'WM_BUTTON2MOTIONEND';
    1849 -        when (iMsgId = x2d('0416')) then return 'WM_BUTTON2CLICK';
    1850 -        when (iMsgId = x2d('0417')) then return 'WM_BUTTON3MOTIONSTART';
    1851 -        when (iMsgId = x2d('0418')) then return 'WM_BUTTON3MOTIONEND';
    1852 -        when (iMsgId = x2d('0419')) then return 'WM_BUTTON3CLICK';
    1853 -        when (iMsgId = x2d('0420')) then return 'WM_BEGINDRAG';
    1854 -        when (iMsgId = x2d('0421')) then return 'WM_ENDDRAG';
    1855 -        when (iMsgId = x2d('0422')) then return 'WM_SINGLESELECT';
    1856 -        when (iMsgId = x2d('0423')) then return 'WM_OPEN';
    1857 -        when (iMsgId = x2d('0424')) then return 'WM_CONTEXTMENU';
    1858 -        when (iMsgId = x2d('0425')) then return 'WM_CONTEXTHELP';
    1859 -        when (iMsgId = x2d('0426')) then return 'WM_TEXTEDIT';
    1860 -        when (iMsgId = x2d('0427')) then return 'WM_BEGINSELECT';
    1861 -        when (iMsgId = x2d('0428')) then return 'WM_ENDSELECT';
    1862 -        when (iMsgId = x2d('0429')) then return 'WM_PICKUP';
    1863 -        /*when (iMsgId = x2d('')) then return '
    1864 -        when (iMsgId = x2d('')) then return '
    1865 -        when (iMsgId = x2d('')) then return '
    1866 -        when (iMsgId = x2d('')) then return '
    1867 -        when (iMsgId = x2d('')) then return '
    1868 -        when (iMsgId = x2d('')) then return '
    1869 -        when (iMsgId = x2d('')) then return '
    1870 -        when (iMsgId = x2d('')) then return '*/
    1871 -        when (iMsgId >= x2d('04c0') & iMsgId <= x2d('04ff')) then return 'WM_PENxxx';
    1872 -        when (iMsgId >= x2d('0500') & iMsgId <= x2d('05ff')) then return 'WM_MMPMxxx';
    1873 -        when (iMsgId >= x2d('0600') & iMsgId <= x2d('065f')) then return 'WM_STDDLGxxx';
    1874 -        when (iMsgId >= x2d('0bd0') & iMsgId <= x2d('0bff')) then return 'WM_BIDIxxx';
    1875 -        when (iMsgId >= x2d('0f00') & iMsgId <= x2d('0fff')) then return 'WM_HELPMGRxxx';
    1876 -        otherwise
    1877 -    end
    1878 -return '';
    1879 -
    1880 -
    1881 -/*
    1882 - * PM
    1883 - * PM
    1884 - * PM
    1885 - * PM
    1886 - * PM
    1887 - * PM
    1888 - * PM
    1889 - * PM
    1890 - * PM
    1891 - * PM
    1892 - * PM
    1893 - * PM
    1894 - */
    1895 -PmStatus: procedure expose(sGlobals)
    1896 -parse arg sArgs
    1897 -
    1898 -    say 'PM Status:'
    1899 -    say '     fBadAppDialog:' d2x(dfReadDword('fBadAppDialog'), 8)
    1900 -    sMem = dfReadMem('qhpsBadApp', 8);
    1901 -    say '        qhpsBadApp: tid='d2x(memWord(0, sMem), 4)','||,
    1902 -                            'pid='d2x(memWord(2, sMem), 4)','||,
    1903 -                            'flags='d2x(memWord(4, sMem), 4)','||,
    1904 -                            'sgid='d2x(memWord(6, sMem), 4);
    1905 -    say '- Focus & Locks -'
    1906 -    pwndFocus   = dfReadDword('pwndfocus');
    1907 -    say '         pwndFocus:' d2x(pwndFocus, 8);
    1908 -    sMem = dfReadMem('%'||d2x(pwndFocus), wndSize());
    1909 -    if (sMem <> '') then
    1910 -    do
    1911 -    say ' pwndFocus.hwnd   :' d2x(wndHwnd(sMem), 8);
    1912 -        say ' pwndFocus.mq     :'    d2x(wndMsgQueue(sMem), 8);
    1913 -        sMem = dfReadMem('%'||d2x(wndMsgQueue(sMem)), mqSize());
    1914 -        if (sMem <> '') then
    1915 -        do
    1916 -    say ' pwndFocus.mq.slot:' d2x(mqSlot(sMem), 4);
    1917 -    say ' pwndFocus.mq.tid :' d2x(mqTid(sMem), 8);
    1918 -    say ' pwndFocus.mq.pid :' d2x(mqPid(sMem), 8);
    1919 -        end
    1920 -    end
    1921 -    say '        pmqsyslock:' d2x(dfReadDword('pmqsyslock'), 8);
    1922 -    say '        pmqVisLock:' d2x(dfReadDword('pmqVisLock'), 8)
    1923 -    say '      pwndSysModal:' d2x(dfReadDword('pwndSysModal'), 8)
    1924 -    say '          pmqTrack:' d2x(dfReadDword('pmqTrack'), 8)
    1925 -    say '     pmqLockUpdate:' d2x(dfReadDword('pmqLockUpdate'), 8)
    1926 -    say '- Event Receivers -'
    1927 -    say '      pmqMouseWake:' d2x(dfReadDword('pmqMouseWake'), 8);
    1928 -    say '        pmqKeyWake:' d2x(dfReadDword('pmqKeyWake'), 8)
    1929 -    say '      pmqEventWake:' d2x(dfReadDword('pmqEventWake'), 8)
    1930 -    say '- Lists -'
    1931 -    say '         pSysqueue:' d2x(dfReadDword('pSysqueue'), 8)
    1932 -    say '           pmqList:' d2x(dfReadDword('pmqList'), 8)
    1933 -    say '- Misc Variables -'
    1934 -    say '       pwndDesktop:' d2x(dfReadDword('pwndDesktop'), 8)
    1935 -    say '        pwndObject:' d2x(dfReadDword('pwndObject'), 8)
    1936 -    say '          pmqShell:' d2x(dfReadDword('pmqShell'), 8)
    1937 -    say '         pmqShell2:' d2x(dfReadDword('pmqShell2'), 8)
    1938 -    say '       pmqShutdown:' d2x(dfReadDword('pmqShutdown'), 8)
    1939 -    say '         paAABRegs:' d2x(dfReadDword('paAABRegs'), 8)
    1940 -
    1941 -
    1942 -return 0;
    1943 -
    1944 -
    1945 -/*
    1946 - * PMDF WORKERS
    1947 - * PMDF WORKERS
    1948 - * PMDF WORKERS
    1949 - * PMDF WORKERS
    1950 - * PMDF WORKERS
    1951 - * PMDF WORKERS
    1952 - * PMDF WORKERS
    1953 - * PMDF WORKERS
    1954 - * PMDF WORKERS
    1955 - * PMDF WORKERS
    1956 - * PMDF WORKERS
    1957 - * PMDF WORKERS
    1958 - */
    1959 -
    1960 -
    1961 -
    1962 -/**
    1963 - * Read memory.
    1964 - * @param   sStartExpr  Expression giving the address where to read from.
    1965 - * @param   cbLength    Number of _bytes_ to read.
    1966 - * @returns The memory we have read. (internal format!)
    1967 - */
    1968 -dfReadMem: procedure expose(sGlobals)
    1969 -parse arg sStartExpr, cbLength
    1970 -
    1971 -    /* dump memory */
    1972 -    if ((cbLength // 4) = 0) then
    1973 -    do  /* optimized read */
    1974 -        /*say 'dbg-df: dd' sStartExpr 'L'cbLength/4'T'*/
    1975 -        Address df 'CMD' 'asOut' 'dd' sStartExpr 'L'cbLength/4'T'
    1976 -        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    1977 -        if (rc = 0) then
    1978 -        do
    1979 -            /* interpret output */
    1980 -            j = 0;
    1981 -            sMem = '';
    1982 -            do i = 1 to asOut.0
    1983 -                /* format:
    1984 -                 * 0000:00000000  45534D50 0000004D 00000000 00000000
    1985 -                 */
    1986 -                parse var asOut.i .'  'ch.0' 'ch.1' 'ch.2' 'ch.3
    1987 -                /*say 'dbg:' asOut.i
    1988 -                say 'dbg:' ch.0','ch.1','ch.2','ch.3*/
    1989 -                k = 0;
    1990 -                ch.4 = '';
    1991 -                do while(k <= 3 & strip(ch.k) <> '')
    1992 -                    sMem = sMem || substr(ch.k,7,2)||substr(ch.k,5,2)||substr(ch.k,3,2)||substr(ch.k,1,2);
    1993 -                    j = j + 4;
    1994 -                    k = k + 1;
    1995 -                end
    1996 -            end
    1997 -            if (j <> 0) then
    1998 -                return d2x(j,8)||sMem;
    1999 -        end
    2000 -
    2001 -    end
    2002 -    else
    2003 -    do  /* slower (more output) byte by byte read */
    2004 -        /*say 'dbg-df: db' sStartExpr 'L'cbLength'T'*/
    2005 -        Address df 'CMD' 'asOut' 'db' sStartExpr 'L'cbLength'T'
    2006 -        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    2007 -        if (rc = 0) then
    2008 -        do
    2009 -            /* interpret output */
    2010 -            j = 0;
    2011 -            sMem = '';
    2012 -            do i = 1 to asOut.0
    2013 -                /* format:
    2014 -                 * 9f47:0000af00 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM...........
    2015 -                 */
    2016 -                ch.16 = '';
    2017 -                parse var asOut.i .' 'ch.0' 'ch.1' 'ch.2' 'ch.3' 'ch.4' 'ch.5' 'ch.6' 'ch.7'-'ch.8' 'ch.9' 'ch.10' 'ch.11' 'ch.12' 'ch.13' 'ch.14' 'ch.15' '.
    2018 -                k = 0;
    2019 -                /*say 'dbg:' asOut.i
    2020 -                say 'dbg:' ch.0','ch.1','ch.2','ch.3','ch.4','ch.5','ch.6','ch.7','ch.8','ch.9','ch.10','ch.11','ch.12','ch.13','ch.14','ch.15*/
    2021 -                do while(k <= 15 & strip(ch.k) <> '')
    2022 -                    sMem = sMem || ch.k;
    2023 -                    j = j + 1;
    2024 -                    k = k + 1;
    2025 -                end
    2026 -            end
    2027 -            if (j <> 0) then
    2028 -                return d2x(j,8)||sMem;
    2029 -        end
    2030 -    end
    2031 -return '';
    2032 -
    2033 -
    2034 -/**
    2035 - * Reads a DWord at a given address.
    2036 - * @param   sAddr   Address expression.
    2037 - * @return  The value of the dword at given address.
    2038 - *          -1 on error.
    2039 - */
    2040 -dfReadByte: procedure expose(sGlobals)
    2041 -parse arg sAddr
    2042 -    sMem = dfReadMem(sAddr, 4);
    2043 -    if (sMem <> '') then
    2044 -        return memByte(0, sMem);
    2045 -return -1;
    2046 -
    2047 -
    2048 -/**
    2049 - * Reads a Word at a given address.
    2050 - * @param   sAddr   Address expression.
    2051 - * @return  The value of the dword at given address.
    2052 - *          -1 on error.
    2053 - */
    2054 -dfReadWord: procedure expose(sGlobals)
    2055 -parse arg sAddr
    2056 -    sMem = dfReadMem(sAddr, W);
    2057 -    if (sMem <> '') then
    2058 -        return memWord(0, sMem);
    2059 -return -1;
    2060 -
    2061 -
    2062 -/**
    2063 - * Reads a DWord at a given address.
    2064 - * @param   sAddr   Address expression.
    2065 - * @return  The value of the dword at given address.
    2066 - *          -1 on error.
    2067 - */
    2068 -dfReadDWord: procedure expose(sGlobals)
    2069 -parse arg sAddr
    2070 -    sMem = dfReadMem(sAddr, 4);
    2071 -    if (sMem <> '') then
    2072 -        return memDword(0, sMem);
    2073 -return -1;
    2074 -
    2075 -
    2076 -/**
    2077 - * Get near symbol.
    2078 - * @param   sAddr   Address expression.
    2079 - * @return  Near output.
    2080 - *          '' on error.
    2081 - */
    2082 -dfNear: procedure expose(sGlobals)
    2083 -parse arg sAddr
    2084 -    Address df 'CMD' 'asOut' 'ln' sAddr
    2085 -    if (rc = 0 & asOut.0 > 0) then
    2086 -    do
    2087 -        if (pos('symbols found', asOut.1) <= 0) then
    2088 -        do
    2089 -            parse var asOut.1 .' 'sRet;
    2090 -            return strip(sRet);
    2091 -        end
    2092 -    end
    2093 -return '';
    2094 -
    2095 -
    2096 -/**
    2097 - * Read all processes into global variable.
    2098 - */
    2099 -dfProcessReadAll: procedure expose(sGlobals)
    2100 -parse arg fBlockInfo
    2101 -    if (\fBlockInfo) then
    2102 -    do
    2103 -        say '[reading processes]'
    2104 -        Address df 'CMD' 'asOut' '.p';
    2105 -        say '[done]'
    2106 -        if (rc = 0 & asOut.0 > 0) then
    2107 -        do
    2108 -            j = 0;
    2109 -            do i = 1 to asOut.0
    2110 -                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    2111 -                    iterate;
    2112 -                /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    2113 -                 *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    2114 -                 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    2115 -                 */
    2116 -                j = j + 1;
    2117 -                aProc.j.sType = '0';
    2118 -                aProc.j.hxBlockId = '0';
    2119 -                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    2120 -                parse var asOut.i aProc.j.hxSlot,
    2121 -                                  aProc.j.hxPid,
    2122 -                                  aProc.j.hxPPid,
    2123 -                                  aProc.j.hxCsid,
    2124 -                                  aProc.j.hxOrd,
    2125 -                                  aProc.j.sState,
    2126 -                                  aProc.j.hxPri,
    2127 -                                  aProc.j.hxpTSD,
    2128 -                                  aProc.j.hxpPTDA,
    2129 -                                  aProc.j.hxpPCB,
    2130 -                                  aProc.j.hxDisp,
    2131 -                                  aProc.j.hxSG,
    2132 -                                  aProc.j.sName;
    2133 -                if (strip(aProc.j.hxSlot) = '') then
    2134 -                    j = j - 1;
    2135 -            end
    2136 -            aProc.0 = j;
    2137 -        end
    2138 -    end
    2139 -    else
    2140 -    do
    2141 -        say '[reading processes]'
    2142 -        Address df 'CMD' 'asOut' '.pb';
    2143 -        say '[done]'
    2144 -        if (rc = 0 & asOut.0 > 0) then
    2145 -        do
    2146 -            j = 0;
    2147 -            do i = 1 to asOut.0
    2148 -                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    2149 -                    iterate;
    2150 -                /*  0044  blk fd436cf8 4os2     Sem32     8001 005d hevResultCodeSet
    2151 -                 * *000b# blk fd436190 pmshell
    2152 -                 *  0073  blk 0b008cbe msrv     SysSem
    2153 -                 */
    2154 -                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    2155 -                j = j + 1;
    2156 -                aProc.j.hxPid = '0';
    2157 -                aProc.j.hxPPid = '0';
    2158 -                aProc.j.hxCsid = '0';
    2159 -                aProc.j.hxOrd = '0';
    2160 -                aProc.j.hxPri = '0';
    2161 -                aProc.j.hxpTSD = '0';
    2162 -                aProc.j.hxpPTDA = '0';
    2163 -                aProc.j.hxpPCB = '0';
    2164 -                aProc.j.hxDisp = '0';
    2165 -                aProc.j.hxSG = '0';
    2166 -                parse var asOut.i aProc.j.hxSlot,
    2167 -                                  aProc.j.sState,
    2168 -                                  aProc.j.hxBlockId,
    2169 -                                  aProc.j.sName,
    2170 -                                  aProc.j.sType .;
    2171 -                if (strip(aProc.j.hxSlot) = '') then
    2172 -                    j = j - 1;
    2173 -            end
    2174 -            aProc.0 = j;
    2175 -        end
    2176 -    end
    2177 -return -1;
    2178 -
    2179 -
    2180 -/**
    2181 - * Gets the blockId of a process from the dumpformatter.
    2182 - * @param   iSlot   The slot to query.
    2183 - * @returns Block id (hex string).
    2184 - *          '0' if failure.
    2185 - */
    2186 -dfProcessBlockId: procedure expose(sGlobals)
    2187 -parse arg iSlot
    2188 -    Address df 'CMD' 'asOut' '.pb' iSlot;
    2189 -    if (rc = 0 & asOut.0 > 0) then
    2190 -    do
    2191 -        /* *000b# blk fd436190 pmshell */
    2192 -        asOut.2 = strip(asOut.2);
    2193 -        parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName
    2194 -        sBlockId = strip(sBlockId)      /* needed??? */
    2195 -        if (sBlockId <> '') then
    2196 -            return sBlockId;
    2197 -    end
    2198 -return '0';
    2199 -
    2200 -
    2201 -/**
    2202 - * Gets the PTDA of a process.
    2203 - * @param   sSlot   Slot or special chars '*' and '#'.
    2204 - * @return  Hex pointer to the PTDA.
    2205 - */
    2206 -dfProcPTDA: procedure expose(sGlobals)
    2207 -parse arg iSlot
    2208 -    Address df 'CMD' 'asOut' '.p' iSlot;
    2209 -    if (rc = 0 & asOut.0 > 0) then
    2210 -    do
    2211 -        /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    2212 -         *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    2213 -         * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    2214 -         */
    2215 -        i = 2;
    2216 -        asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    2217 -        parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .;
    2218 -        hxPTDA = strip(hxPTDA)      /* needed??? */
    2219 -        if (hxPTDA <> '') then
    2220 -            return hxPTDA;
    2221 -    end
    2222 -return '0';
    2223 -
    2224 -
    2225 -/**
    2226 - * Gets a byte from the memory array aMem.
    2227 - * @param   iIndex      Byte offset into the array.
    2228 - */
    2229 -memByte: procedure expose(sGlobals)
    2230 -parse arg iIndex, sMem
    2231 -    cb = memSize(sMem);
    2232 -    if (iIndex < cb) then
    2233 -    do
    2234 -        return x2d(substr(sMem, (iIndex * 2) + 9 + 0, 2));
    2235 -    end
    2236 -    say 'error-memByte: access out of range. cb='cb ' iIndex='iIndex;
    2237 -return -1;
    2238 -
    2239 -
    2240 -/**
    2241 - * Gets a word from the memory array aMem.
    2242 - * @param   iIndex      Byte offset into the array.
    2243 - */
    2244 -memWord: procedure expose(sGlobals)
    2245 -parse arg iIndex, sMem
    2246 -    cb = memSize(sMem);
    2247 -    if (iIndex + 1 < cb) then
    2248 -    do
    2249 -        return x2d(substr(sMem, (iIndex * 2) + 9 + 2, 2)||,
    2250 -                   substr(sMem, (iIndex * 2) + 9 + 0, 2));
    2251 -    end
    2252 -    say 'error-memWord: access out of range. cb='cb ' iIndex='iIndex;
    2253 -return -1;
    2254 -
    2255 -
    2256 -/**
    2257 - * Gets a dword from the passed in memory block.
    2258 - * @param   iIndex      Byte offset into the array.
    2259 - * @param   sMem        Memory block.
    2260 - * @remark  note problems with signed!
    2261 - */
    2262 -memDword: procedure expose(sGlobals)
    2263 -parse arg iIndex, sMem
    2264 -    cb = memSize(sMem);
    2265 -    if (iIndex + 3 < cb) then
    2266 -    do
    2267 -        iIndex = iIndex*2 + 9;
    2268 -        return   x2d(substr(sMem, iIndex + 6, 2)||,
    2269 -                     substr(sMem, iIndex + 4, 2)||,
    2270 -                     substr(sMem, iIndex + 2, 2)||,
    2271 -                     substr(sMem, iIndex + 0, 2));
    2272 -    end
    2273 -    say 'error-memDword: access out of range. cb='cb ' iIndex='iIndex;
    2274 -return -1;
    2275 -
    2276 -
    2277 -/**
    2278 - * Gets a string from the memory array aMem.
    2279 - * @return  String.
    2280 - * @param   iIndex          Byte offset into the array aMem.
    2281 - * @param   cchLength       Length of the string. (optional)
    2282 - *                          If not specified we'll stop at '\0' or end of aMem.
    2283 - * @param   fStoppAtNull    Flag that we'll stop at '\0' even when lenght is specifed. (optional)
    2284 - *                          Default is to fetch cchLength if cchLength is specifed.
    2285 - */
    2286 -memString: procedure expose(sGlobals)
    2287 -parse arg iIndex, cchLength, fStoppAtNull, sMem
    2288 -    cb = memSize(sMem);
    2289 -    if (iIndex < cb) then
    2290 -    do
    2291 -        /* handle optional parameters */
    2292 -        if (fStoppAtNull = '') then
    2293 -            fStoppAtNull = (cchLength = '');
    2294 -        if (cchLength = '') then
    2295 -            cchLength = cb - iIndex;
    2296 -        else if (cchLength + iIndex > cb) then
    2297 -            cchLength = cb - iIndex;
    2298 -
    2299 -        /* fetch string */
    2300 -        sStr = '';
    2301 -        i = iIndex;
    2302 -        do  i = iIndex to iIndex + cchLength
    2303 -            ch = substr(sMem, i*2 + 9, 2);
    2304 -            if (fStoppAtNull) then
    2305 -                if (ch = '00') then
    2306 -                    leave;
    2307 -            sStr = sStr||x2c(ch);
    2308 -        end
    2309 -        return sStr;
    2310 -    end
    2311 -    say 'error-memWord: access out of range. cb='cb ' cbLength='cbLength;
    2312 -return '';
    2313 -
    2314 -
    2315 -/**
    2316 - * Dumps a byte range of the given memory to screen.
    2317 - * @return  0 on success. -1 on failure.
    2318 - * @paran   iIndex      Index into the memory block.
    2319 - * @paran   cbLength    Length to dump.
    2320 - * @paran   sMem        Memory block.
    2321 - */
    2322 -memDumpByte: procedure expose(sGlobals)
    2323 -parse arg iIndex, cbLength, sMem
    2324 -    cb = memSize(sMem);
    2325 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    2326 -    do
    2327 -        iOff = 0;
    2328 -        do while (cbLength > 0)
    2329 -            i = 0;
    2330 -            sLine = '0000:'||d2x(iOff,8);
    2331 -            do i = 0 to 15
    2332 -                if (cbLength - i > 0) then
    2333 -                do
    2334 -                    if (i = 8) then
    2335 -                        sLine = sLine || '-' || d2x(memByte(i + iOff, sMem),2);
    2336 -                    else
    2337 -                        sLine = sLine || ' ' || d2x(memByte(i + iOff, sMem),2);
    2338 -                end
    2339 -                else
    2340 -                    sLine = sLine || '   ';
    2341 -            end
    2342 -            sLine = sLine || ' ';
    2343 -            do i = 0 to 15
    2344 -                if (cbLength - i <= 0) then
    2345 -                    leave;
    2346 -                iCh = memByte(i + iOff, sMem);
    2347 -                if (iCh >= 32) then
    2348 -                    sLine = sLine || d2c(iCh);
    2349 -                else
    2350 -                    sLine = sLine || '.';
    2351 -            end
    2352 -            say sLine
    2353 -            iOff = iOff + 16;
    2354 -            cbLength = cbLength - 16;
    2355 -        end
    2356 -
    2357 -        return 0;
    2358 -    end
    2359 -    say 'error-memDumpByte: access out of range. cb='cb 'iIndex='iIndex 'cbLength='cbLength;
    2360 -return -1;
    2361 -
    2362 -
    2363 -/**
    2364 - * Dumps a word range of the given memory to screen.
    2365 - * @return  0 on success. -1 on failure.
    2366 - * @paran   iIndex      Index into the memory block.
    2367 - * @paran   cbLength    Length to dump.
    2368 - * @paran   sMem        Memory block.
    2369 - */
    2370 -memDumpWord: procedure expose(sGlobals)
    2371 -parse arg iIndex, cbLength, sMem
    2372 -    cb = memSize(sMem);
    2373 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    2374 -    do
    2375 -        iOff = 0;
    2376 -        do while (cbLength > 0)
    2377 -            i = 0;
    2378 -            sLine = '0000:'||d2x(iOff,8)||' ';
    2379 -            do i = 0 to 7
    2380 -                if (cbLength - i > 0) then
    2381 -                    sLine = sLine || ' ' || d2x(memWord(i*2 + iOff, sMem),4);
    2382 -                else
    2383 -                    sLine = sLine || '   ';
    2384 -            end
    2385 -
    2386 -            say sLine
    2387 -            iOff = iOff + 16;
    2388 -            cbLength = cbLength - 16;
    2389 -        end
    2390 -
    2391 -        return 0;
    2392 -    end
    2393 -    say 'error-memDumpWord: access out of range. cb='cb ' cbLength='cbLength;
    2394 -return -1;
    2395 -
    2396 -
    2397 -/**
    2398 - * Dumps a dword range of the given memory to screen.
    2399 - * @return  0 on success. -1 on failure.
    2400 - * @paran   iIndex      Index into the memory block.
    2401 - * @paran   cbLength    Length to dump.
    2402 - * @paran   sMem        Memory block.
    2403 - */
    2404 -memDumpDword: procedure expose(sGlobals)
    2405 -parse arg iIndex, cbLength, sMem
    2406 -    cb = memSize(sMem);
    2407 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    2408 -    do
    2409 -        iOff = 0;
    2410 -        do while (cbLength > 0)
    2411 -            i = 0;
    2412 -            sLine = '0000:'||d2x(iOff, 8)||' ';
    2413 -            do i = 0 to 3
    2414 -                if (cbLength - i > 0) then
    2415 -                    sLine = sLine || ' ' || d2x(memDWord(i*4 + iOff, sMem),8);
    2416 -                else
    2417 -                    sLine = sLine || '   ';
    2418 -            end
    2419 -
    2420 -            say sLine
    2421 -            iOff = iOff + 16;
    2422 -            cbLength = cbLength - 16;
    2423 -        end
    2424 -
    2425 -        return 0;
    2426 -    end
    2427 -    say 'error-memDumpDword: access out of range. cb='cb ' cbLength='cbLength;
    2428 -return -1;
    2429 -
    2430 -
    2431 -/**
    2432 - * Copies a portion of a memory block.
    2433 - * @param   iIndex      Index into the memory block.
    2434 - * @param   cbLength    Bytes to copy.
    2435 - * @param   sMem        Source block.
    2436 - */
    2437 -memCopy: procedure expose(sGlobals)
    2438 -parse arg iIndex, cbLength, sMem
    2439 -    cb = memSize(sMem);
    2440 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    2441 -    do
    2442 -        sCopy = d2x(cbLength,8)||substr(sMem, 9 + iIndex * 2, cbLength * 2);
    2443 -        return sCopy
    2444 -    end
    2445 -    say 'error-memCopy: access out of range. cb='cb ' cbLength='cbLength;
    2446 -return -1;
    2447 -
    2448 -
    2449 -/**
    2450 - * Gets the size of a memory block.
    2451 - * @param   sMem    The memory block in question.
    2452 - */
    2453 -memSize: procedure expose(sGlobals)
    2454 -parse arg sMem
    2455 -/* debug assertions - start - comment out when stable! */
    2456 -if (length(sMem) - 8 <> x2d(left(sMem, 8)) * 2) then
    2457 -do
    2458 -    say 'fatal assert: memSize got a bad memoryblock'
    2459 -    say '              length(sMem) =' length(sMem);
    2460 -    say '              cb = ' x2d(left(sMem,8));
    2461 -    exit(16);
    2462 -end
    2463 -/* debug assertions -  end  - comment out when stable! */
    2464 -return x2d(left(sMem,8));
    2465 -
    2466 -
    2467 -
    2468 -/**
    2469 - * Dump all processes. (debug more or less)
    2470 - */
    2471 -procDumpAll: procedure expose(sGlobals)
    2472 -    say 'Processes:'
    2473 -    do i = 1 to aProc.0
    2474 -        say 'slot='aProc.i.hxSlot 'pid='aProc.i.hxPid 'blkid='aProc.i.hxBlockId 'name='aProc.i.sName
    2475 -    end
    2476 -return 0;
    2477 -
    2478 -
    2479 -/**
    2480 - * Searches thru the process list looking for a process
    2481 - * by it's pid and tid.
    2482 - * @returns Index of the process.
    2483 - * @param   pid     Process Id. (Decimal value)
    2484 - * @param   tid     Thread Id. (Decimal value)
    2485 - */
    2486 -procFindByPidTid: procedure expose(sGlobals)
    2487 -parse arg pid, tid
    2488 -    do i = 1 to aProc.0
    2489 -        if (x2d(aProc.i.hxPid) = pid & x2d(aProc.i.hxTid) = tid) then
    2490 -            return i;
    2491 -    end
    2492 -return 0;
    2493 -
    2494 -
    2495 -/**
    2496 - * Searches thru the process list looking for a process
    2497 - * by it's slot number.
    2498 - * @returns Index of the process.
    2499 - * @param   iSlot   Thread slot number. (Decimal value)
    2500 - */
    2501 -procFindByPidTid: procedure expose(sGlobals)
    2502 -parse arg iSlot
    2503 -    do i = 1 to aProc.0
    2504 -        if (x2d(aProc.i.hxSlot) = iSlot) then
    2505 -            return i;
    2506 -    end
    2507 -return 0;
    2508 -
    2509 -
    2510 -/**
    2511 - * Novaluehandler.
    2512 - */
    2513 -SignalHanlder_NoValue:
    2514 -    say 'fatal error: novalue signal SIGL='SIGL;
    2515 -exit(16);
    2516 -
    2517 -
    2518 -/**
    2519 - * Lowercases a string.
    2520 - * @param   sString     String to fold down.
    2521 - * @returns Lowercase version of sString.
    2522 - */
    2523 -lowercase: procedure expose(sGlobals)
    2524 -parse arg sString
    2525 -return translate(sString,,
    2526 -                 'abcdefghijklmnopqrstuvwxyz',,
    2527 -                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    2528 +/**/
    2529 +
    2530 +
    2531 +/*
    2532 + * Init stuff.
    2533 + */
    2534 +signal on NoValue Name SignalHanlder_NoValue;
    2535 +NUMERIC DIGITS 11
    2536 +
    2537 +
    2538 +/*
    2539 + * Globals
    2540 + */
    2541 +sGlobals = 'ulHandleTable aProc. sGlobals';
    2542 +ulHandleTable = 0;
    2543 +aProc.0 = 0;                            /* process table */
    2544 +
    2545 +
    2546 +/*
    2547 + * Args
    2548 + */
    2549 +parse arg sCmd sArgs
    2550 +sCmd = lowercase(sCmd);
    2551 +sArg = lowercase(sArgs);
    2552 +say '';
    2553 +
    2554 +
    2555 +/*
    2556 + * Operation
    2557 + */
    2558 +select
    2559 +    /*
    2560 +     * pmsems
    2561 +     */
    2562 +    when (sCmd = 'pmsemcheck') then
    2563 +        return pmsemCheck(sArgs);
    2564 +    when (sCmd = 'pmsemdump') then
    2565 +        return pmsemDump(sArgs);
    2566 +    when (sCmd = 'pmsemdumpall') then
    2567 +        return PmsemDumpAll(sArgs);
    2568 +
    2569 +    /*
    2570 +     * Windows Structures.
    2571 +     */
    2572 +    when (sCmd = 'wnddump') then
    2573 +        return wndDump(sArgs);
    2574 +
    2575 +    /*
    2576 +     * Window handles.
    2577 +     */
    2578 +    when (sCmd = 'hwnd') then
    2579 +        return hwnd2PWND(sArgs);
    2580 +
    2581 +    /*
    2582 +     * PM stuff
    2583 +     */
    2584 +    when (sCMD = 'pmstatus') then
    2585 +        return PmStatus(sArgs);
    2586 +
    2587 +    /*
    2588 +     * Generic dump
    2589 +     */
    2590 +    when (sCmd = 'dump' | sCmd = '.d') then
    2591 +    do
    2592 +        parse var sArgs sStruct sDumperArgs
    2593 +        select
    2594 +            when (sStruct = 'mq') then
    2595 +                return MqDump(sDumperArgs);
    2596 +            when (sStruct = 'pmsem') then
    2597 +                return PmsemDump(sDumperArgs);
    2598 +            when (sStruct = 'qmsg') then
    2599 +                return QmsgDump(sDumperArgs);
    2600 +            when (sStruct = 'sms') then
    2601 +                return SmsDump(sDumperArgs);
    2602 +            when (sStruct = 'sqmsg') then
    2603 +                return SqmsgDump(sDumperArgs);
    2604 +            when (sStruct = 'wnd') then
    2605 +                return WndDump(sDumperArgs);
    2606 +
    2607 +            otherwise
    2608 +                say 'syntax error: no or invalid structure name.';
    2609 +        return syntax(sArgs);
    2610 +        end
    2611 +    end
    2612 +
    2613 +
    2614 +    /*
    2615 +     * Help and syntax error.
    2616 +     */
    2617 +    when (sCmd = '?' | sCmd = 'help' | sCmd = '-?' | sCmd = '/?' | sCmd = '-h' | sCmd = '/h' | sCmd = '--help') then
    2618 +        return syntax(sArgs);
    2619 +    otherwise
    2620 +        say 'syntax error: no or invalid command'
    2621 +        return syntax(sArgs);
    2622 +    end
    2623 +exit(0)
    2624 +
    2625 +/**
    2626 + * Display usage syntax:
    2627 + */
    2628 +syntax: procedure;
    2629 +    parse source . . sSource;
    2630 +    sName = filespec('name', sSource);
    2631 +    say 'PMDF PM Rexx Utils v0.0.1';
    2632 +    say 'syntax: %'sName' <command> [args]';
    2633 +    say 'command:'
    2634 +    say '       checksems       Check the PM semaphores';
    2635 +return -1;
    2636 +
    2637 +/* Procedure which we signals on user syntax errors. */
    2638 +synatxerror:
    2639 +    say 'syntax error!'
    2640 +    call syntax;
    2641 +return -1;
    2642 +
    2643 +
    2644 +
    2645 +/*
    2646 + * PMSEMS/GRESEMS
    2647 + * PMSEMS/GRESEMS
    2648 + * PMSEMS/GRESEMS
    2649 + * PMSEMS/GRESEMS
    2650 + * PMSEMS/GRESEMS
    2651 + * PMSEMS/GRESEMS
    2652 + * PMSEMS/GRESEMS
    2653 + * PMSEMS/GRESEMS
    2654 + * PMSEMS/GRESEMS
    2655 + */
    2656 +/* access functions */
    2657 +pmsemSize:      procedure expose(sGlobals); return 32;
    2658 +pmsemIdent:     procedure expose(sGlobals); parse arg iSem, sMem; return memString(iSem * 32, 7, 1, sMem);
    2659 +pmsem386:       procedure expose(sGlobals); parse arg iSem, sMem; return memByte( iSem * 32 +  7, sMem);
    2660 +pmsemPid:       procedure expose(sGlobals); parse arg iSem, sMem; return memWord( iSem * 32 +  8, sMem);
    2661 +pmsemTid:       procedure expose(sGlobals); parse arg iSem, sMem; return memWord( iSem * 32 + 10, sMem);
    2662 +pmsemPTid:      procedure expose(sGlobals); parse arg iSem, sMem; return memDWord(iSem * 32 +  8, sMem);
    2663 +pmsemNested:    procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 12, sMem);
    2664 +pmsemWaiting:   procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 16, sMem);
    2665 +pmsemUseCount:  procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 20, sMem);/*debug*/
    2666 +pmsemHEV:       procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 24, sMem);
    2667 +pmsemCallAddr:  procedure expose(sGlobals); parse arg iSem, sMem; return memDword(iSem * 32 + 28, sMem);/*debug*/
    2668 +
    2669 +
    2670 +/**
    2671 + * Structure dumper.
    2672 + * @param   sSemMem     32 byte memory block (at least) containing the PMSEM to dump.
    2673 + * @parma   sMsg        Optional description message. (optional)
    2674 + * @param   iSem        The sem we're dumping. (optional)
    2675 + */
    2676 +pmsemDump1: procedure expose(sGlobals)
    2677 +parse arg sSemMem, sMsg, iSem
    2678 +    if (iSem <> '') then
    2679 +        say sMsg 'PMSEM/GRESEM -' pmsemGetName(iSem);
    2680 +    else
    2681 +        say sMsg 'PMSEM/GRESEM';
    2682 +    say '         acIdent:' pmsemIdent(0, sSemMem);
    2683 +    say '           fcSet:' pmsem386(0, sSemMem);
    2684 +    say '             Tid:' d2x(pmsemTid(0, sSemMem),4);
    2685 +    say '             Pid:' d2x(pmsemPid(0, sSemMem),4);
    2686 +    say 'ulNestedUseCount:' d2x(pmsemNested(0, sSemMem),8);
    2687 +    say '  ulWaitingCount:' d2x(pmsemWaiting(0, sSemMem),8);
    2688 +    say '      ulUseCount:' d2x(pmsemUseCount(0, sSemMem),8);
    2689 +    say '   ulEventHandle:' d2x(pmsemHEV(0, sSemMem),8);
    2690 +    say '    ulCallerAddr:' d2x(pmsemCallAddr(0, sSemMem),8);
    2691 +return 0;
    2692 +
    2693 +
    2694 +
    2695 +
    2696 +
    2697 +/**
    2698 + * Check if any of the PM sems are taken or have bogus state.
    2699 + * @returns 0 on success. -1 on error.
    2700 + */
    2701 +PmsemCheck: procedure expose(sGlobals)
    2702 +    sMem = dfReadMem('pmsemaphores', 35 * pmsemSize())
    2703 +    if (sMem <> '') then
    2704 +    do
    2705 +        /* loop thru them all listing the taken/bogus ones */
    2706 +        cDumps = 0;
    2707 +        say 'info: checking pm/gre sems'
    2708 +        do iSem = 0 to 34
    2709 +            rc = pmsemValidate(iSem, sMem);
    2710 +            if (rc <> 1) then
    2711 +            do
    2712 +                if (cDumps = 0) then say '';
    2713 +                cDumps = cDumps + 1;
    2714 +                if rc = 0 then  sMsg = 'Taken';
    2715 +                else            sMsg = 'Bogus';
    2716 +                call pmsemDump1 memCopy(iSem * pmsemSize(), pmsemSize(), sMem), sMsg, iSem;
    2717 +            end
    2718 +        end
    2719 +        if (cDumps = 0) then
    2720 +            say 'info: pm/gre sems are all free and ok.'
    2721 +        else
    2722 +            say 'info: 'cDumps 'semaphores was taken or bogus.';
    2723 +    end
    2724 +    else
    2725 +        say 'error: failed to read semaphore table.';
    2726 +return -1;
    2727 +
    2728 +
    2729 +/**
    2730 + * Dump a number of pm/gre sems.
    2731 + * @returns 0 on success. -1 on error.
    2732 + */
    2733 +PmsemDump: procedure expose(sGlobals)
    2734 +parse arg sAddr  cCount
    2735 +    /* defaults and param validation */
    2736 +    if (cCount = '' | datatype(cCount) <> 'NUM') then
    2737 +        cCount = 1;
    2738 +    if (sAddr = '') then
    2739 +        signal SyntaxError
    2740 +
    2741 +    /* read memory and do the dump */
    2742 +    sMem = dfReadMem(sAddr, cCount * pmsemSize())
    2743 +    if (sMem <> '') then
    2744 +    do
    2745 +        do i = 0 to cCount - 1
    2746 +            call pmsemDump1 memCopy(i * pmsemSize(), pmsemSize(), sMem);
    2747 +        end
    2748 +    end
    2749 +    else
    2750 +        say 'error: failed to read semaphore table.';
    2751 +return -1;
    2752 +
    2753 +
    2754 +/**
    2755 + * Dumps all PM/GRE sems
    2756 + * @returns 0 on success. -1 on error.
    2757 + */
    2758 +PmsemDumpAll: procedure expose(sGlobals)
    2759 +    /* read memory and do the dump */
    2760 +    sMem = dfReadMem('pmsemaphores', 35 * pmsemSize())
    2761 +    if (sMem <> '') then
    2762 +    do
    2763 +        do i = 0 to 34
    2764 +            call pmsemDump1 memCopy(i * pmsemSize(), pmsemSize(), sMem),, i;
    2765 +        end
    2766 +    end
    2767 +    else
    2768 +        say 'error: failed to read semaphore table.';
    2769 +return -1;
    2770 +
    2771 +
    2772 +/**
    2773 + * Checks a give PM sem is free and not bogus.
    2774 + * @returns 1 if free and not bogus.
    2775 + *          0 if taken.
    2776 + *          -1 if bogus.
    2777 + * @param   iSem    Semaphore index.
    2778 + * @param   sMem    Memory containging the semaphore array.
    2779 + *                  (If no array use iSem=0)
    2780 + */
    2781 +pmsemValidate: procedure expose(sGlobals)
    2782 +parse arg iSem, sMem
    2783 +    if (pmsemPTid(iSem, sMem) <> 0) then
    2784 +        return 0;
    2785 +    if (pos(pmsemIdent(iSem, sMem), "PMSEM;;;;;GRESEM") < 0) then
    2786 +        return -1;
    2787 +    if (pmsemWaiting(iSem, sMem) > 0) then
    2788 +        return -1;
    2789 +    if (pmsemHEV(iSem, sMem) = 0) then
    2790 +        return -1;
    2791 +return 1;
    2792 +
    2793 +
    2794 +/**
    2795 + * Gives us the name of the pmsem at a given index.
    2796 + * @returns Namestring.
    2797 + * @param   i   Index
    2798 + */
    2799 +pmsemGetName: procedure expose(sGlobals)
    2800 +parse arg i
    2801 +    select
    2802 +        when i = 0  then return 'PMSEM_ATOM';
    2803 +        when i = 1  then return 'PMSEM_USER';
    2804 +        when i = 2  then return 'PMSEM_VISLOCK';
    2805 +        when i = 3  then return 'PMSEM_DEBUG';
    2806 +        when i = 4  then return 'PMSEM_HOOK';
    2807 +        when i = 5  then return 'PMSEM_HEAP';
    2808 +        when i = 6  then return 'PMSEM_DLL';
    2809 +        when i = 7  then return 'PMSEM_THUNK';
    2810 +        when i = 8  then return 'PMSEM_XLCE';
    2811 +        when i = 9  then return 'PMSEM_UPDATE';
    2812 +        when i = 10 then return 'PMSEM_CLIP';
    2813 +        when i = 11 then return 'PMSEM_INPUT';
    2814 +        when i = 12 then return 'PMSEM_DESKTOP';
    2815 +        when i = 13 then return 'PMSEM_HANDLE';
    2816 +        when i = 14 then return 'PMSEM_ALARM';
    2817 +        when i = 15 then return 'PMSEM_STRRES';
    2818 +        when i = 16 then return 'PMSEM_TIMER';
    2819 +        when i = 17 then return 'PMSEM_CONTROLS';
    2820 +        when i = 18 then return 'GRESEM_GREINIT';
    2821 +        when i = 19 then return 'GRESEM_AUTOHEAP';
    2822 +        when i = 20 then return 'GRESEM_PDEV';
    2823 +        when i = 21 then return 'GRESEM_LDEV';
    2824 +        when i = 22 then return 'GRESEM_CODEPAGE';
    2825 +        when i = 23 then return 'GRESEM_HFONT';
    2826 +        when i = 24 then return 'GRESEM_FONTCNTXT';
    2827 +        when i = 25 then return 'GRESEM_FNTDRVR';
    2828 +        when i = 26 then return 'GRESEM_SHMALLOC';
    2829 +        when i = 27 then return 'GRESEM_GLOBALDATA';
    2830 +        when i = 28 then return 'GRESEM_DBCSENV';
    2831 +        when i = 29 then return 'GRESEM_SRVLOCK';
    2832 +        when i = 30 then return 'GRESEM_SELLOCK';
    2833 +        when i = 31 then return 'GRESEM_PROCLOCK';
    2834 +        when i = 32 then return 'GRESEM_DRIVERSEM';
    2835 +        when i = 33 then return 'GRESEM_SEMLFICACHE';
    2836 +        when i = 34 then return 'GRESEM_SEMFONTTABLE';
    2837 +    otherwise
    2838 +    end
    2839 +return 'Unknown-'i;
    2840 +
    2841 +
    2842 +
    2843 +/*
    2844 + * WINDOW STRUCTURE (WND)
    2845 + * WINDOW STRUCTURE (WND)
    2846 + * WINDOW STRUCTURE (WND)
    2847 + * WINDOW STRUCTURE (WND)
    2848 + * WINDOW STRUCTURE (WND)
    2849 + * WINDOW STRUCTURE (WND)
    2850 + * WINDOW STRUCTURE (WND)
    2851 + * WINDOW STRUCTURE (WND)
    2852 + * WINDOW STRUCTURE (WND)
    2853 + * WINDOW STRUCTURE (WND)
    2854 + */
    2855 +/* size and access functions */
    2856 +wndSize:            procedure expose(sGlobals); return 144; /* guesswork! */
    2857 +
    2858 +wndNext:            procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('00'), sMem);
    2859 +wndParent:          procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('04'), sMem);
    2860 +wndChild:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('08'), sMem);
    2861 +wndOwner:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('0c'), sMem);
    2862 +wndRecs:            procedure expose(sGlobals); parse arg iWord,sMem;return memWord( x2d('10') + iWord*2, sMem);
    2863 +wndStyle:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('18'), sMem);
    2864 +wndId:              procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('1c'), sMem);
    2865 +wndReserved0:       procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('20'), sMem);
    2866 +wndReserved1:       procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('24'), sMem);
    2867 +wndMsgQueue:        procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('28'), sMem);
    2868 +wndHWND:            procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('2c'), sMem);
    2869 +wndModel:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('30'), sMem);
    2870 +wndProc:            procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('34'), sMem);
    2871 +wndThunkProc:       procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('38'), sMem);
    2872 +wndPresParams:      procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('40'), sMem);
    2873 +wndFocus:           procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('44'), sMem);
    2874 +wndWPSULong:        procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('48'), sMem);
    2875 +wndInstData:        procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('50'), sMem);
    2876 +wndOpen32:          procedure expose(sGlobals); parse arg sMem;      return memDword(x2d('58'), sMem);
    2877 +/*
    2878 +wndWord:            procedure expose(sGlobals); parse arg iWord,sMem;return memDword(96 + iWord*4, sMem);
    2879 +*/
    2880 +/** dump one wnd structure */
    2881 +wndDump1: procedure expose(sGlobals)
    2882 +parse arg sMem, sMsg
    2883 +    if (sMsg <> '') then
    2884 +        say sMsg
    2885 +    say '      pwndNext:' d2x(wndNext(sMem),8);
    2886 +    say '    pwndParent:' d2x(wndParent(sMem),8);
    2887 +    say '     pwndChild:' d2x(wndChild(sMem),8);
    2888 +    say '     pwndOwner:' d2x(wndOwner(sMem),8);
    2889 +    say '     rcsWindow: xl='wndRecs(0, sMem)',yl='wndRecs(1, sMem),
    2890 +                        'xr='wndRecs(2, sMem)',yr='wndRecs(3, sMem) '(decimal)'
    2891 +    say '       ulStyle:' d2x(wndStyle(sMem),8);
    2892 +    say '            id:' d2x(wndId(sMem),8);
    2893 +    say '     Reserved0:' d2x(wndReserved0(sMem),8);
    2894 +    say '     Reserved1:' d2x(wndReserved1(sMem),8);
    2895 +    say '   pmqMsgQueue:' d2x(wndMsgQueue(sMem),8);
    2896 +    say '          hwnd:' d2x(wndHWND(sMem),8);
    2897 +    say '   fModel16bit:' d2x(wndModel(sMem),8);
    2898 +    say '    pfnWinProc:' d2x(wndProc(sMem),8)  '('dfNear('%'d2x(wndProc(sMem),8))')'
    2899 +    if (wndThunkProc(sMem) = 0) then
    2900 +        say '  pfnThunkProc:' d2x(wndThunkProc(sMem),8)
    2901 +    else
    2902 +        say '  pfnThunkProc:' d2x(wndThunkProc(sMem),8) ' ('dfNear('%'d2x(wndThunkProc(sMem),8))')'
    2903 +    say '   ppresParams:' d2x(wndPresParams(sMem),8);
    2904 +    say '     pwndFocus:' d2x(wndFocus(sMem),8);
    2905 +    say '         ulWPS:' d2x(wndWPSULong(sMem),8) '('dfNear('%'d2x(wndWPSULong(sMem),8))')'
    2906 +    say '     pInstData:' d2x(wndInstData(sMem),8);
    2907 +    say '            ??:' d2x(memDword(x2d('54'), sMem),8);
    2908 +    say '       pOpen32:' d2x(wndOpen32(sMem),8);
    2909 +/*  This aint right!
    2910 +    i = 0;
    2911 +    do while (i < 12)
    2912 +        say ' aulWin['d2x(i,2)'-'d2x(i+3,2)']: '||,
    2913 +                             d2x(wndWord(i+0, sMem), 8) d2x(wndWord(i+1, sMem), 8),
    2914 +                             d2x(wndWord(i+2, sMem), 8) d2x(wndWord(i+3, sMem), 8)
    2915 +        i = i + 4;
    2916 +    end
    2917 +*/
    2918 +return 0;
    2919 +
    2920 +
    2921 +/**
    2922 + * Dump window structures.
    2923 + */
    2924 +WndDump: procedure expose(sGlobals)
    2925 +parse arg sAddr cCount
    2926 +    /*defaults and param validation */
    2927 +    if (cCount = '' | datatype(cCount) <> 'NUM') then
    2928 +        cCount = 1;
    2929 +    if (sAddr = '') then
    2930 +        signal SyntaxError
    2931 +    if (hwndIsHandle(sAddr)) then
    2932 +    do
    2933 +        ulPWND = hwnd2PWND(sAddr);
    2934 +        if (ulPWND > 0) then
    2935 +            sAddr = '%'d2x(ulPWND);
    2936 +    end
    2937 +
    2938 +    /* read memory */
    2939 +    sMem = dfReadMem(sAddr, cCount * wndSize())
    2940 +    if (sMem <> '') then
    2941 +    do
    2942 +        /* loop thru them all listing the taken/bogus ones */
    2943 +        do i = 0 to cCount - 1
    2944 +            call wndDump1 memCopy(i * wndSize(), wndSize(), sMem);
    2945 +        end
    2946 +    end
    2947 +    else
    2948 +        say 'error: failed to read window structure at '''sAddr'''.';
    2949 +return 0;
    2950 +
    2951 +
    2952 +
    2953 +
    2954 +/*
    2955 + * WINDOW HANDLE (HWND)
    2956 + * WINDOW HANDLE (HWND)
    2957 + * WINDOW HANDLE (HWND)
    2958 + * WINDOW HANDLE (HWND)
    2959 + * WINDOW HANDLE (HWND)
    2960 + * WINDOW HANDLE (HWND)
    2961 + * WINDOW HANDLE (HWND)
    2962 + * WINDOW HANDLE (HWND)
    2963 + */
    2964 +hwnd2PWND: procedure expose(sGlobals)
    2965 +parse arg sHwnd sDummy
    2966 +    ulIndex = x2d(right(sHwnd, 4));
    2967 +    ulBase = hwndpHandleTable();
    2968 +    if (ulBase = 0) then
    2969 +        return 0;
    2970 +
    2971 +    ulHandleEntry = ulBase + ulIndex * 8 + 32;
    2972 +return dfReadDword('%'d2x(ulHandleEntry, 8), 4);
    2973 +
    2974 +
    2975 +/**
    2976 + * Checks if a value is a hwnd.
    2977 + * @returns true/false.
    2978 + * @param   sValue  Value in question.
    2979 + */
    2980 +hwndIsHandle: procedure expose(sGlobals)
    2981 +parse arg sValue sDummy
    2982 +
    2983 +    /* Paranoid check if this is a number or hex value or whatever*/
    2984 +    sValue = strip(sValue);
    2985 +    if (sValue = '') then
    2986 +        return 0;
    2987 +    if (datatype(sValue) <> 'NUM') then
    2988 +    do  /* assumes kind of hexx */
    2989 +        sValue = translate(sValue);
    2990 +        if (left(sValue, 2) = '0X') then
    2991 +            sValue = substr(sValue, 3);
    2992 +        if (right(sValue,1) = 'H') then
    2993 +            sValue = substr(sValue, 1, length(sValue) - 1);
    2994 +        if (sValue = '') then
    2995 +            return 0;
    2996 +        if (strip(translate(sValue, '', '123456767ABCDEF')) <> '') then
    2997 +            return 0;
    2998 +        ulValue = x2d(sValue);
    2999 +    end
    3000 +    else
    3001 +    do  /* check if decimal value, if not try hex */
    3002 +        if (sValue >= x2d('80000001') & sValue < x2d('8000ffff')) then
    3003 +            return 1;
    3004 +         ulValue = x2d(sValue);
    3005 +    end
    3006 +
    3007 +    /* Check for valid handle range. */
    3008 +return ulValue >= x2d('80000001') & ulValue < x2d('8000ffff');
    3009 +
    3010 +
    3011 +/**
    3012 + * Gets the pointer to the handle table.
    3013 + */
    3014 +hwndpHandleTable: procedure expose(sGlobals)
    3015 +    if (ulHandleTable > 0) then
    3016 +        return ulHandleTable;
    3017 +
    3018 +    ulHandleTable = dfReadDword('pHandleTable', 4);
    3019 +    if (ulHandleTable > 0) then
    3020 +        return ulHandleTable
    3021 +    say 'error-hwndpHandleTable: failed to read pHandleTable';
    3022 +return 0;
    3023 +
    3024 +
    3025 +
    3026 +/*
    3027 + * MESSAGE QUEUE STRUCTURE (MQ)
    3028 + * MESSAGE QUEUE STRUCTURE (MQ)
    3029 + * MESSAGE QUEUE STRUCTURE (MQ)
    3030 + * MESSAGE QUEUE STRUCTURE (MQ)
    3031 + * MESSAGE QUEUE STRUCTURE (MQ)
    3032 + * MESSAGE QUEUE STRUCTURE (MQ)
    3033 + * MESSAGE QUEUE STRUCTURE (MQ)
    3034 + * MESSAGE QUEUE STRUCTURE (MQ)
    3035 + * MESSAGE QUEUE STRUCTURE (MQ)
    3036 + */
    3037 +mqSize:             procedure expose(sGlobals);                     return x2d('b0');
    3038 +mqNext:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('00'), sMem);
    3039 +mqEntrySize:        procedure expose(sGlobals); parse arg sMem;     return memWord(x2d('04'), sMem);
    3040 +/*mqQueue:            procedure expose(sGlobals);  parse arg sMem;     return memWord(x2d('06'), sMem);*/
    3041 +mqMessages:         procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('08'), sMem);
    3042 +/* ?? */
    3043 +mqMaxMessages:      procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('0c'), sMem);
    3044 +mqPid:              procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('18'), sMem);
    3045 +mqTid:              procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('1c'), sMem);
    3046 +mqFirstMsg:         procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('20'), sMem);
    3047 +mqLastMsg:          procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('24'), sMem);
    3048 +mqSGid:             procedure expose(sGlobals); parse arg sMem;     return memWord(x2d('28'), sMem);
    3049 +mqHev:              procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('2c'), sMem);
    3050 +mqSent:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('3c'), sMem);
    3051 +mqCurrent:          procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('40'), sMem);
    3052 +
    3053 +mqBadPwnd:          procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('68'), sMem);
    3054 +mqBadQueue:         procedure expose(sGlobals); parse arg sMem;     return memByte(x2d('6c'), sMem);
    3055 +mqCountTimers:      procedure expose(sGlobals); parse arg sMem;     return memByte(x2d('6d'), sMem);
    3056 +mqHeap:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('70'), sMem);
    3057 +mqHAccel:           procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('74'), sMem);
    3058 +
    3059 +mqShutdown:         procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('90'), sMem);
    3060 +
    3061 +mqRcvdSMSList:      procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('98'), sMem);
    3062 +mqSlot:             procedure expose(sGlobals); parse arg sMem;     return memDword(x2d('a0'), sMem);
    3063 +
    3064 +/** dump one mq structure */
    3065 +mqDump1: procedure expose(sGlobals)
    3066 +parse arg sMem;
    3067 +    say '     pmqNext:' d2x(mqNext(sMem), 8);
    3068 +    say '     cbEntry:' d2x(mqEntrySize(sMem), 8);
    3069 +    say '   cMessages:' d2x(mqMessages(sMem), 8);
    3070 +    say 'cMaxMessages:' d2x(mqMaxMessages(sMem), 8);
    3071 +    say '         Tid:' d2x(mqTid(sMem), 8);
    3072 +    say '         Pid:' d2x(mqPid(sMem), 8);
    3073 +    say 'psmsFirstMsg:' d2x(mqFirstMsg(sMem), 8);
    3074 +    say ' psmsLastMsg:' d2x(mqLastMsg(sMem), 8);
    3075 +    say '        SGId:' d2x(mqSGid(sMem), 8);
    3076 +    say '         hev:' d2x(mqHev(sMem), 8);
    3077 +    say '    psmsSent:' d2x(mqSent(sMem), 8);
    3078 +    say ' psmsCurrent:' d2x(mqCurrent(sMem), 8);
    3079 +    say '     pwndBad:' d2x(mqBadPWND(sMem), 8);
    3080 +    say '   fBadQueue:' d2x(mqBadQueue(sMem), 2);
    3081 +    say '     cTimers:' d2x(mqCountTimers(sMem), 2);
    3082 +    say '       pHeap:' d2x(mqHeap(sMem), 8);
    3083 +    say '      HACCEL:' d2x(mqHAccel(sMem), 8);
    3084 +    say ' fchShutdown:' d2x(mqShutdown(sMem), 2);
    3085 +    say ' RcvdSMSList:' d2x(mqRcvdSMSList(sMem), 8);
    3086 +    say '        Slot:' d2x(mqSlot(sMem), 4);
    3087 +return 0;
    3088 +
    3089 +
    3090 +/**
    3091 + * Message queue dumper.
    3092 + * @param   sAddr   Address expression of a MQ struct, or a window
    3093 + *                  which message queue you wanna dump.
    3094 + * @returns 0
    3095 + */
    3096 +mqDump: procedure expose(sGlobals)
    3097 +parse arg sAddr cCount
    3098 +    /*defaults and param validation */
    3099 +    if (cCount = '' | datatype(cCount) <> 'NUM') then
    3100 +        cCount = 1;
    3101 +    if (sAddr = '') then
    3102 +        signal SyntaxError
    3103 +
    3104 +    /*
    3105 +     * The user might have passed in an window handle.
    3106 +     * If so we'll dump it's queue.
    3107 +     */
    3108 +    if (hwndIsHandle(sAddr)) then
    3109 +    do  /* input is a hwnd, we will try dump it's queue */
    3110 +        ulPWND = hwnd2PWND(sAddr);
    3111 +        if (ulPWND > 0) then
    3112 +        do
    3113 +            sMem = dfReadMem('%'d2x(ulPWND), wndSize());
    3114 +            if (sMem <> '') then
    3115 +            do
    3116 +                ulMQ = wndMsgQueue(sMem);
    3117 +                if (ulMq > 0) then
    3118 +                    sAddr = '%'d2x(ulPWND);
    3119 +            end
    3120 +            drop sMem;
    3121 +        end
    3122 +    end
    3123 +
    3124 +    /* read memory */
    3125 +    sMem = dfReadMem(sAddr, cCount * mqSize())
    3126 +    if (sMem <> '') then
    3127 +    do
    3128 +        /* loop thru them all listing the taken/bogus ones */
    3129 +        do i = 0 to cCount - 1
    3130 +            call mqDump1 memCopy(i * mqSize(), mqSize(), sMem);
    3131 +        end
    3132 +    end
    3133 +    else
    3134 +        say 'error: failed to read window structure at '''sAddr'''.';
    3135 +return 0;
    3136 +
    3137 +
    3138 +/*
    3139 + * SENDMSG STRUCTRURE (SMS)
    3140 + * SENDMSG STRUCTRURE (SMS)
    3141 + * SENDMSG STRUCTRURE (SMS)
    3142 + * SENDMSG STRUCTRURE (SMS)
    3143 + * SENDMSG STRUCTRURE (SMS)
    3144 + * SENDMSG STRUCTRURE (SMS)
    3145 + * SENDMSG STRUCTRURE (SMS)
    3146 + */
    3147 +smsSize:            procedure expose(sGlobals);                     return 64;
    3148 +smsNextMaster:      procedure expose(sGlobals); parse arg sMem;     return memDword(0, sMem);
    3149 +smsSendHead:        procedure expose(sGlobals); parse arg sMem;     return memDword(4, sMem);
    3150 +smsReserved0:       procedure expose(sGlobals); parse arg sMem;     return memDword(8, sMem);
    3151 +smsReceiveNext:     procedure expose(sGlobals); parse arg sMem;     return memDword(12, sMem);
    3152 +smsTime:            procedure expose(sGlobals); parse arg sMem;     return memDword(16, sMem);
    3153 +smsSenderPMQ:       procedure expose(sGlobals); parse arg sMem;     return memDword(20, sMem);
    3154 +smsReceiverPMQ:     procedure expose(sGlobals); parse arg sMem;     return memDword(24, sMem);
    3155 +smsResult:          procedure expose(sGlobals); parse arg sMem;     return memDword(28, sMem);
    3156 +smsReserved1:       procedure expose(sGlobals); parse arg sMem;     return memDword(32, sMem);
    3157 +smsPWND:            procedure expose(sGlobals); parse arg sMem;     return memDword(36, sMem);
    3158 +smsMsgId:           procedure expose(sGlobals); parse arg sMem;     return memDword(40, sMem);
    3159 +smsMP1:             procedure expose(sGlobals); parse arg sMem;     return memDword(44, sMem);
    3160 +smsMP2:             procedure expose(sGlobals); parse arg sMem;     return memDword(48, sMem);
    3161 +smsReserved2:       procedure expose(sGlobals); parse arg sMem;     return memDword(52, sMem);
    3162 +smsReserved3:       procedure expose(sGlobals); parse arg sMem;     return memDword(56, sMem);
    3163 +smsReserved4:       procedure expose(sGlobals); parse arg sMem;     return memDword(60, sMem);
    3164 +
    3165 +/** Dumps one sms structure */
    3166 +smsDump1: procedure expose(sGlobals)
    3167 +parse arg sMem
    3168 +    say ' psmsMasterNext:' d2x(smsNextMaster(sMem),8)
    3169 +    say '   psmsSendHead:' d2x(smsSendHead(sMem),8)
    3170 +    say '      Reserved0:' d2x(smsReserved0(sMem),8)
    3171 +    say 'psmsReceiveNext:' d2x(smsReceiveNext(sMem),8)
    3172 +    say '           Time:' d2x(smsTime(sMem),8)
    3173 +    say '      pmqSender:' d2x(smsSenderPMQ(sMem),8)
    3174 +    say '    pmqReceiver:' d2x(smsReceiverPMQ(sMem),8)
    3175 +    say '       ulResult:' d2x(smsResult(sMem),8)
    3176 +    say '      Reserved1:' d2x(smsReserved1(sMem),8)
    3177 +    say '           pWnd:' d2x(smsPWND(sMem),8)
    3178 +    say '        ulMsgId:' d2x(smsMsgId(sMem),8) '('msgMsgIdToText(smsMsgId(sMem))')'
    3179 +    say '            MP1:' d2x(smsMP1(sMem),8)
    3180 +    say '            MP2:' d2x(smsMP2(sMem),8)
    3181 +    say '      Reserved2:' d2x(smsReserved2(sMem),8)
    3182 +    say '      Reserved3:' d2x(smsReserved3(sMem),8)
    3183 +    say '      Reserved4:' d2x(smsReserved4(sMem),8)
    3184 +return 0;
    3185 +
    3186 +
    3187 +/**
    3188 + * Send message struct (SMS) dumper.
    3189 + * @param   sAddr   Address expression of a sms struct.
    3190 + * @returns 0
    3191 + */
    3192 +SmsDump: procedure expose(sGlobals)
    3193 +parse arg sAddr cCount
    3194 +    /*defaults and param validation */
    3195 +    if (cCount = '' | datatype(cCount) <> 'NUM') then
    3196 +        cCount = 1;
    3197 +    if (sAddr = '') then
    3198 +        signal SyntaxError
    3199 +
    3200 +    /* read memory */
    3201 +    sMem = dfReadMem(sAddr, cCount * smsSize())
    3202 +    if (sMem <> '') then
    3203 +    do
    3204 +        /* loop thru them all listing the taken/bogus ones */
    3205 +        do i = 0 to cCount - 1
    3206 +            call smsDump1 memCopy(i * smsSize(), smsSize(), sMem);
    3207 +        end
    3208 +    end
    3209 +    else
    3210 +        say 'error: failed to read SMS structure at '''sAddr'''.';
    3211 +return 0;
    3212 +
    3213 +
    3214 +/*
    3215 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3216 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3217 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3218 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3219 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3220 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3221 + * PM QUEUE MESSAGE STRUCTURE (QMSG)
    3222 + */
    3223 +qmsgSize:           procedure expose(sGlobals);                     return 32;
    3224 +qmsgHwnd:           procedure expose(sGlobals); parse arg sMem;     return memDword(0, sMem);
    3225 +qmsgMsgId:          procedure expose(sGlobals); parse arg sMem;     return memDword(4, sMem);
    3226 +qmsgMP1:            procedure expose(sGlobals); parse arg sMem;     return memDword(8, sMem);
    3227 +qmsgMP2:            procedure expose(sGlobals); parse arg sMem;     return memDword(12, sMem);
    3228 +qmsgTime:           procedure expose(sGlobals); parse arg sMem;     return memDword(16, sMem);
    3229 +qmsgPtlX:           procedure expose(sGlobals); parse arg sMem;     return memDword(20, sMem);
    3230 +qmsgPtlY:           procedure expose(sGlobals); parse arg sMem;     return memDword(24, sMem);
    3231 +qmsgReserved:       procedure expose(sGlobals); parse arg sMem;     return memDword(28, sMem);
    3232 +
    3233 +qmsgDump1: procedure expose(sGlobals);
    3234 +parse arg sMem
    3235 +    say '     Hwnd:' d2x(qmsgHwnd(sMem),8)
    3236 +    say '    MsgId:' d2x(qmsgMsgId(sMem),8) '('msgMsgIdToText(qmsgMsgId(sMem))')'
    3237 +    say '      MP1:' d2x(qmsgMP1(sMem),8)
    3238 +    say '      MP2:' d2x(qmsgMP2(sMem),8)
    3239 +    say '     Time:' d2x(qmsgTime(sMem),8)
    3240 +    say '    Ptl.x:' d2x(qmsgPtlX(sMem),8)
    3241 +    say '    Ptl.y:' d2x(qmsgPtlY(sMem),8)
    3242 +    say ' Reserved:' d2x(qmsgReserved(sMem),8)
    3243 +return 0;
    3244 +
    3245 +
    3246 +/**
    3247 + * Queue message struct (QMSG) dumper.
    3248 + * @param   sAddr   Address expression of a sms struct.
    3249 + * @returns 0
    3250 + */
    3251 +QmsgDump: procedure expose(sGlobals)
    3252 +parse arg sAddr cCount
    3253 +    /*defaults and param validation */
    3254 +    if (cCount = '' | datatype(cCount) <> 'NUM') then
    3255 +        cCount = 1;
    3256 +    if (sAddr = '') then
    3257 +        signal SyntaxError
    3258 +
    3259 +    /* read memory */
    3260 +    sMem = dfReadMem(sAddr, cCount * qmsgSize())
    3261 +    if (sMem <> '') then
    3262 +    do
    3263 +        /* loop thru them all listing the taken/bogus ones */
    3264 +        do i = 0 to cCount - 1
    3265 +            call qmsgDump1 memCopy(i * qmsgSize(), qmsgSize(), sMem);
    3266 +        end
    3267 +    end
    3268 +    else
    3269 +        say 'error: failed to read QMSG structure at '''sAddr'''.';
    3270 +return 0;
    3271 +
    3272 +
    3273 +/*
    3274 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3275 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3276 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3277 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3278 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3279 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3280 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3281 + * PM SYSSTEM QUEUE MESSAGE STRUCTURE (SQMSG)
    3282 + */
    3283 +sqmsgSize:           procedure expose(sGlobals);                     return 32;
    3284 +sqmsgMsgId:          procedure expose(sGlobals); parse arg sMem;     return memDword(0, sMem);
    3285 +sqmsgMP1:            procedure expose(sGlobals); parse arg sMem;     return memDword(4, sMem);
    3286 +sqmsgMP2:            procedure expose(sGlobals); parse arg sMem;     return memDword(8, sMem);
    3287 +sqmsgTime:           procedure expose(sGlobals); parse arg sMem;     return memDword(12, sMem);
    3288 +sqmsgReserved0:      procedure expose(sGlobals); parse arg sMem;     return memDword(16, sMem);
    3289 +sqmsgReserved1:      procedure expose(sGlobals); parse arg sMem;     return memDword(20, sMem);
    3290 +sqmsgReserved2:      procedure expose(sGlobals); parse arg sMem;     return memDword(24, sMem);
    3291 +sqmsgReserved3:      procedure expose(sGlobals); parse arg sMem;     return memDword(28, sMem);
    3292 +
    3293 +sqmsgDump1: procedure expose(sGlobals);
    3294 +parse arg sMem
    3295 +    say '    MsgId:' d2x(sqmsgMsgId(sMem),8) '('msgMsgIdToText(sqmsgMsgId(sMem))')'
    3296 +    say '      MP1:' d2x(sqmsgMP1(sMem),8)
    3297 +    say '      MP2:' d2x(sqmsgMP2(sMem),8)
    3298 +    say '     Time:' d2x(sqmsgTime(sMem),8)
    3299 +    say 'Reserved0:' d2x(sqmsgReserved0(sMem),8)
    3300 +    say 'Reserved1:' d2x(sqmsgReserved1(sMem),8)
    3301 +    say 'Reserved2:' d2x(sqmsgReserved2(sMem),8)
    3302 +    say 'Reserved3:' d2x(sqmsgReserved3(sMem),8)
    3303 +return 0;
    3304 +
    3305 +
    3306 +/**
    3307 + * System Queue message struct (SQMSG) dumper.
    3308 + * @param   sAddr   Address expression of a sqmsg struct.
    3309 + * @returns 0
    3310 + */
    3311 +SqmsgDump: procedure expose(sGlobals)
    3312 +parse arg sAddr cCount
    3313 +    /*defaults and param validation */
    3314 +    if (cCount = '' | datatype(cCount) <> 'NUM') then
    3315 +        cCount = 1;
    3316 +    if (sAddr = '') then
    3317 +        signal SyntaxError
    3318 +
    3319 +    /* read memory */
    3320 +    sMem = dfReadMem(sAddr, cCount * sqmsgSize())
    3321 +    if (sMem <> '') then
    3322 +    do
    3323 +        /* loop thru them all listing the taken/bogus ones */
    3324 +        do i = 0 to cCount - 1
    3325 +            call sqmsgDump1 memCopy(i * sqmsgSize(), sqmsgSize(), sMem);
    3326 +        end
    3327 +    end
    3328 +    else
    3329 +        say 'error: failed to read SQMSG structure at '''sAddr'''.';
    3330 +return 0;
    3331 +
    3332 +
    3333 +/*
    3334 + * MSG HELPERS
    3335 + * MSG HELPERS
    3336 + * MSG HELPERS
    3337 + * MSG HELPERS
    3338 + * MSG HELPERS
    3339 + * MSG HELPERS
    3340 + * MSG HELPERS
    3341 + * MSG HELPERS
    3342 + */
    3343 +
    3344 +/**
    3345 + * translates a message ID into a message define string
    3346 + * @param   iMsgId  The message id in question.
    3347 + * @returns Symbol name.
    3348 + *          '' if unknown.
    3349 + */
    3350 +msgMsgIdToText: procedure
    3351 +parse arg iMsgId
    3352 +    select
    3353 +        when (iMsgId = x2d('0000')) then return 'WM_NULL';
    3354 +        when (iMsgId = x2d('0001')) then return 'WM_CREATE';
    3355 +        when (iMsgId = x2d('0002')) then return 'WM_DESTROY';
    3356 +        /*when (iMsgId == x2d('0003')) then return '';*/
    3357 +        when (iMsgId = x2d('0004')) then return 'WM_ENABLE';
    3358 +        when (iMsgId = x2d('0005')) then return 'WM_SHOW';
    3359 +        when (iMsgId = x2d('0006')) then return 'WM_MOVE';
    3360 +        when (iMsgId = x2d('0007')) then return 'WM_SIZE';
    3361 +        when (iMsgId = x2d('0008')) then return 'WM_ADJUSTWINDOWPOS';
    3362 +        when (iMsgId = x2d('0009')) then return 'WM_CALCVALIDRECTS';
    3363 +        when (iMsgId = x2d('000a')) then return 'WM_SETWINDOWPARAMS';
    3364 +        when (iMsgId = x2d('000b')) then return 'WM_QUERYWINDOWPARAMS';
    3365 +        when (iMsgId = x2d('000c')) then return 'WM_HITTEST';
    3366 +        when (iMsgId = x2d('000d')) then return 'WM_ACTIVATE';
    3367 +        when (iMsgId = x2d('000f')) then return 'WM_SETFOCUS';
    3368 +        when (iMsgId = x2d('0010')) then return 'WM_SETSELECTION';
    3369 +        when (iMsgId = x2d('0011')) then return 'WM_PPAINT';
    3370 +        when (iMsgId = x2d('0012')) then return 'WM_PSETFOCUS';
    3371 +        when (iMsgId = x2d('0013')) then return 'WM_PSYSCOLORCHANGE';
    3372 +        when (iMsgId = x2d('0014')) then return 'WM_PSIZE';
    3373 +        when (iMsgId = x2d('0015')) then return 'WM_PACTIVATE';
    3374 +        when (iMsgId = x2d('0016')) then return 'WM_PCONTROL';
    3375 +        when (iMsgId = x2d('0020')) then return 'WM_COMMAND';
    3376 +        when (iMsgId = x2d('0021')) then return 'WM_SYSCOMMAND';
    3377 +        when (iMsgId = x2d('0022')) then return 'WM_HELP';
    3378 +        when (iMsgId = x2d('0023')) then return 'WM_PAINT';
    3379 +        when (iMsgId = x2d('0024')) then return 'WM_TIMER';
    3380 +        when (iMsgId = x2d('0025')) then return 'WM_SEM1';
    3381 +        when (iMsgId = x2d('0026')) then return 'WM_SEM2';
    3382 +        when (iMsgId = x2d('0027')) then return 'WM_SEM3';
    3383 +        when (iMsgId = x2d('0028')) then return 'WM_SEM4';
    3384 +        when (iMsgId = x2d('0029')) then return 'WM_CLOSE';
    3385 +        when (iMsgId = x2d('002a')) then return 'WM_QUIT';
    3386 +        when (iMsgId = x2d('002b')) then return 'WM_SYSCOLORCHANGE';
    3387 +        when (iMsgId = x2d('002d')) then return 'WM_SYSVALUECHANGED';
    3388 +        when (iMsgId = x2d('002e')) then return 'WM_APPTERMINATENOTIFY';
    3389 +        when (iMsgId = x2d('002f')) then return 'WM_PRESPARAMCHANGED';
    3390 +        when (iMsgId = x2d('0030')) then return 'WM_CONTROL';
    3391 +        when (iMsgId = x2d('0031')) then return 'WM_VSCROLL';
    3392 +        when (iMsgId = x2d('0032')) then return 'WM_HSCROLL';
    3393 +        when (iMsgId = x2d('0033')) then return 'WM_INITMENU';
    3394 +        when (iMsgId = x2d('0034')) then return 'WM_MENUSELECT';
    3395 +        when (iMsgId = x2d('0035')) then return 'WM_MENUEND';
    3396 +        when (iMsgId = x2d('0036')) then return 'WM_DRAWITEM';
    3397 +        when (iMsgId = x2d('0037')) then return 'WM_MEASUREITEM';
    3398 +        when (iMsgId = x2d('0038')) then return 'WM_CONTROLPOINTER';
    3399 +        when (iMsgId = x2d('003a')) then return 'WM_QUERYDLGCODE';
    3400 +        when (iMsgId = x2d('003b')) then return 'WM_INITDLG';
    3401 +        when (iMsgId = x2d('003c')) then return 'WM_SUBSTITUTESTRING';
    3402 +        when (iMsgId = x2d('003d')) then return 'WM_MATCHMNEMONIC';
    3403 +        when (iMsgId = x2d('003e')) then return 'WM_SAVEAPPLICATION';
    3404 +        when (iMsgId = x2d('0490')) then return 'WM_SEMANTICEVENT';
    3405 +        when (iMsgId = x2d('1000')) then return 'WM_USER';
    3406 +        when (iMsgId = x2d('007e')) then return 'WM_VRNDISABLED';
    3407 +        when (iMsgId = x2d('007f')) then return 'WM_VRNENABLED';
    3408 +        when (iMsgId = x2d('007a')) then return 'WM_CHAR';
    3409 +        when (iMsgId = x2d('007b')) then return 'WM_VIOCHAR';
    3410 +        when (iMsgId = x2d('0070')) then return 'WM_MOUSEMOVE';
    3411 +        when (iMsgId = x2d('0071')) then return 'WM_BUTTON1DOWN';
    3412 +        when (iMsgId = x2d('0072')) then return 'WM_BUTTON1UP';
    3413 +        when (iMsgId = x2d('0073')) then return 'WM_BUTTON1DBLCLK';
    3414 +        when (iMsgId = x2d('0074')) then return 'WM_BUTTON2DOWN';
    3415 +        when (iMsgId = x2d('0075')) then return 'WM_BUTTON2UP';
    3416 +        when (iMsgId = x2d('0076')) then return 'WM_BUTTON2DBLCLK';
    3417 +        when (iMsgId = x2d('0077')) then return 'WM_BUTTON3DOWN';
    3418 +        when (iMsgId = x2d('0078')) then return 'WM_BUTTON3UP';
    3419 +        when (iMsgId = x2d('0079')) then return 'WM_BUTTON3DBLCLK';
    3420 +        when (iMsgId = x2d('007D')) then return 'WM_MOUSEMAP';
    3421 +        when (iMsgId = x2d('0410')) then return 'WM_CHORD';
    3422 +        when (iMsgId = x2d('0411')) then return 'WM_BUTTON1MOTIONSTART';
    3423 +        when (iMsgId = x2d('0412')) then return 'WM_BUTTON1MOTIONEND';
    3424 +        when (iMsgId = x2d('0413')) then return 'WM_BUTTON1CLICK';
    3425 +        when (iMsgId = x2d('0414')) then return 'WM_BUTTON2MOTIONSTART';
    3426 +        when (iMsgId = x2d('0415')) then return 'WM_BUTTON2MOTIONEND';
    3427 +        when (iMsgId = x2d('0416')) then return 'WM_BUTTON2CLICK';
    3428 +        when (iMsgId = x2d('0417')) then return 'WM_BUTTON3MOTIONSTART';
    3429 +        when (iMsgId = x2d('0418')) then return 'WM_BUTTON3MOTIONEND';
    3430 +        when (iMsgId = x2d('0419')) then return 'WM_BUTTON3CLICK';
    3431 +        when (iMsgId = x2d('0420')) then return 'WM_BEGINDRAG';
    3432 +        when (iMsgId = x2d('0421')) then return 'WM_ENDDRAG';
    3433 +        when (iMsgId = x2d('0422')) then return 'WM_SINGLESELECT';
    3434 +        when (iMsgId = x2d('0423')) then return 'WM_OPEN';
    3435 +        when (iMsgId = x2d('0424')) then return 'WM_CONTEXTMENU';
    3436 +        when (iMsgId = x2d('0425')) then return 'WM_CONTEXTHELP';
    3437 +        when (iMsgId = x2d('0426')) then return 'WM_TEXTEDIT';
    3438 +        when (iMsgId = x2d('0427')) then return 'WM_BEGINSELECT';
    3439 +        when (iMsgId = x2d('0428')) then return 'WM_ENDSELECT';
    3440 +        when (iMsgId = x2d('0429')) then return 'WM_PICKUP';
    3441 +        /*when (iMsgId = x2d('')) then return '
    3442 +        when (iMsgId = x2d('')) then return '
    3443 +        when (iMsgId = x2d('')) then return '
    3444 +        when (iMsgId = x2d('')) then return '
    3445 +        when (iMsgId = x2d('')) then return '
    3446 +        when (iMsgId = x2d('')) then return '
    3447 +        when (iMsgId = x2d('')) then return '
    3448 +        when (iMsgId = x2d('')) then return '*/
    3449 +        when (iMsgId >= x2d('04c0') & iMsgId <= x2d('04ff')) then return 'WM_PENxxx';
    3450 +        when (iMsgId >= x2d('0500') & iMsgId <= x2d('05ff')) then return 'WM_MMPMxxx';
    3451 +        when (iMsgId >= x2d('0600') & iMsgId <= x2d('065f')) then return 'WM_STDDLGxxx';
    3452 +        when (iMsgId >= x2d('0bd0') & iMsgId <= x2d('0bff')) then return 'WM_BIDIxxx';
    3453 +        when (iMsgId >= x2d('0f00') & iMsgId <= x2d('0fff')) then return 'WM_HELPMGRxxx';
    3454 +        otherwise
    3455 +    end
    3456 +return '';
    3457 +
    3458 +
    3459 +/*
    3460 + * PM
    3461 + * PM
    3462 + * PM
    3463 + * PM
    3464 + * PM
    3465 + * PM
    3466 + * PM
    3467 + * PM
    3468 + * PM
    3469 + * PM
    3470 + * PM
    3471 + * PM
    3472 + */
    3473 +PmStatus: procedure expose(sGlobals)
    3474 +parse arg sArgs
    3475 +
    3476 +    say 'PM Status:'
    3477 +    say '     fBadAppDialog:' d2x(dfReadDword('fBadAppDialog'), 8)
    3478 +    sMem = dfReadMem('qhpsBadApp', 8);
    3479 +    say '        qhpsBadApp: tid='d2x(memWord(0, sMem), 4)','||,
    3480 +                            'pid='d2x(memWord(2, sMem), 4)','||,
    3481 +                            'flags='d2x(memWord(4, sMem), 4)','||,
    3482 +                            'sgid='d2x(memWord(6, sMem), 4);
    3483 +    say '- Focus & Locks -'
    3484 +    pwndFocus   = dfReadDword('pwndfocus');
    3485 +    say '         pwndFocus:' d2x(pwndFocus, 8);
    3486 +    sMem = dfReadMem('%'||d2x(pwndFocus), wndSize());
    3487 +    if (sMem <> '') then
    3488 +    do
    3489 +    say ' pwndFocus.hwnd   :' d2x(wndHwnd(sMem), 8);
    3490 +        say ' pwndFocus.mq     :'    d2x(wndMsgQueue(sMem), 8);
    3491 +        sMem = dfReadMem('%'||d2x(wndMsgQueue(sMem)), mqSize());
    3492 +        if (sMem <> '') then
    3493 +        do
    3494 +    say ' pwndFocus.mq.slot:' d2x(mqSlot(sMem), 4);
    3495 +    say ' pwndFocus.mq.tid :' d2x(mqTid(sMem), 8);
    3496 +    say ' pwndFocus.mq.pid :' d2x(mqPid(sMem), 8);
    3497 +        end
    3498 +    end
    3499 +    say '        pmqsyslock:' d2x(dfReadDword('pmqsyslock'), 8);
    3500 +    say '        pmqVisLock:' d2x(dfReadDword('pmqVisLock'), 8)
    3501 +    say '      pwndSysModal:' d2x(dfReadDword('pwndSysModal'), 8)
    3502 +    say '          pmqTrack:' d2x(dfReadDword('pmqTrack'), 8)
    3503 +    say '     pmqLockUpdate:' d2x(dfReadDword('pmqLockUpdate'), 8)
    3504 +    say '- Event Receivers -'
    3505 +    say '      pmqMouseWake:' d2x(dfReadDword('pmqMouseWake'), 8);
    3506 +    say '        pmqKeyWake:' d2x(dfReadDword('pmqKeyWake'), 8)
    3507 +    say '      pmqEventWake:' d2x(dfReadDword('pmqEventWake'), 8)
    3508 +    say '- Lists -'
    3509 +    say '         pSysqueue:' d2x(dfReadDword('pSysqueue'), 8)
    3510 +    say '           pmqList:' d2x(dfReadDword('pmqList'), 8)
    3511 +    say '- Misc Variables -'
    3512 +    say '       pwndDesktop:' d2x(dfReadDword('pwndDesktop'), 8)
    3513 +    say '        pwndObject:' d2x(dfReadDword('pwndObject'), 8)
    3514 +    say '          pmqShell:' d2x(dfReadDword('pmqShell'), 8)
    3515 +    say '         pmqShell2:' d2x(dfReadDword('pmqShell2'), 8)
    3516 +    say '       pmqShutdown:' d2x(dfReadDword('pmqShutdown'), 8)
    3517 +    say '         paAABRegs:' d2x(dfReadDword('paAABRegs'), 8)
    3518 +
    3519 +
    3520 +return 0;
    3521 +
    3522 +
    3523 +/*
    3524 + * PMDF WORKERS
    3525 + * PMDF WORKERS
    3526 + * PMDF WORKERS
    3527 + * PMDF WORKERS
    3528 + * PMDF WORKERS
    3529 + * PMDF WORKERS
    3530 + * PMDF WORKERS
    3531 + * PMDF WORKERS
    3532 + * PMDF WORKERS
    3533 + * PMDF WORKERS
    3534 + * PMDF WORKERS
    3535 + * PMDF WORKERS
    3536 + */
    3537 +
    3538 +
    3539 +
    3540 +/**
    3541 + * Read memory.
    3542 + * @param   sStartExpr  Expression giving the address where to read from.
    3543 + * @param   cbLength    Number of _bytes_ to read.
    3544 + * @returns The memory we have read. (internal format!)
    3545 + */
    3546 +dfReadMem: procedure expose(sGlobals)
    3547 +parse arg sStartExpr, cbLength
    3548 +
    3549 +    /* dump memory */
    3550 +    if ((cbLength // 4) = 0) then
    3551 +    do  /* optimized read */
    3552 +        /*say 'dbg-df: dd' sStartExpr 'L'cbLength/4'T'*/
    3553 +        Address df 'CMD' 'asOut' 'dd' sStartExpr 'L'cbLength/4'T'
    3554 +        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    3555 +        if (rc = 0) then
    3556 +        do
    3557 +            /* interpret output */
    3558 +            j = 0;
    3559 +            sMem = '';
    3560 +            do i = 1 to asOut.0
    3561 +                /* format:
    3562 +                 * 0000:00000000  45534D50 0000004D 00000000 00000000
    3563 +                 */
    3564 +                parse var asOut.i .'  'ch.0' 'ch.1' 'ch.2' 'ch.3
    3565 +                /*say 'dbg:' asOut.i
    3566 +                say 'dbg:' ch.0','ch.1','ch.2','ch.3*/
    3567 +                k = 0;
    3568 +                ch.4 = '';
    3569 +                do while(k <= 3 & strip(ch.k) <> '')
    3570 +                    sMem = sMem || substr(ch.k,7,2)||substr(ch.k,5,2)||substr(ch.k,3,2)||substr(ch.k,1,2);
    3571 +                    j = j + 4;
    3572 +                    k = k + 1;
    3573 +                end
    3574 +            end
    3575 +            if (j <> 0) then
    3576 +                return d2x(j,8)||sMem;
    3577 +        end
    3578 +
    3579 +    end
    3580 +    else
    3581 +    do  /* slower (more output) byte by byte read */
    3582 +        /*say 'dbg-df: db' sStartExpr 'L'cbLength'T'*/
    3583 +        Address df 'CMD' 'asOut' 'db' sStartExpr 'L'cbLength'T'
    3584 +        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    3585 +        if (rc = 0) then
    3586 +        do
    3587 +            /* interpret output */
    3588 +            j = 0;
    3589 +            sMem = '';
    3590 +            do i = 1 to asOut.0
    3591 +                /* format:
    3592 +                 * 9f47:0000af00 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM...........
    3593 +                 */
    3594 +                ch.16 = '';
    3595 +                parse var asOut.i .' 'ch.0' 'ch.1' 'ch.2' 'ch.3' 'ch.4' 'ch.5' 'ch.6' 'ch.7'-'ch.8' 'ch.9' 'ch.10' 'ch.11' 'ch.12' 'ch.13' 'ch.14' 'ch.15' '.
    3596 +                k = 0;
    3597 +                /*say 'dbg:' asOut.i
    3598 +                say 'dbg:' ch.0','ch.1','ch.2','ch.3','ch.4','ch.5','ch.6','ch.7','ch.8','ch.9','ch.10','ch.11','ch.12','ch.13','ch.14','ch.15*/
    3599 +                do while(k <= 15 & strip(ch.k) <> '')
    3600 +                    sMem = sMem || ch.k;
    3601 +                    j = j + 1;
    3602 +                    k = k + 1;
    3603 +                end
    3604 +            end
    3605 +            if (j <> 0) then
    3606 +                return d2x(j,8)||sMem;
    3607 +        end
    3608 +    end
    3609 +return '';
    3610 +
    3611 +
    3612 +/**
    3613 + * Reads a DWord at a given address.
    3614 + * @param   sAddr   Address expression.
    3615 + * @return  The value of the dword at given address.
    3616 + *          -1 on error.
    3617 + */
    3618 +dfReadByte: procedure expose(sGlobals)
    3619 +parse arg sAddr
    3620 +    sMem = dfReadMem(sAddr, 4);
    3621 +    if (sMem <> '') then
    3622 +        return memByte(0, sMem);
    3623 +return -1;
    3624 +
    3625 +
    3626 +/**
    3627 + * Reads a Word at a given address.
    3628 + * @param   sAddr   Address expression.
    3629 + * @return  The value of the dword at given address.
    3630 + *          -1 on error.
    3631 + */
    3632 +dfReadWord: procedure expose(sGlobals)
    3633 +parse arg sAddr
    3634 +    sMem = dfReadMem(sAddr, W);
    3635 +    if (sMem <> '') then
    3636 +        return memWord(0, sMem);
    3637 +return -1;
    3638 +
    3639 +
    3640 +/**
    3641 + * Reads a DWord at a given address.
    3642 + * @param   sAddr   Address expression.
    3643 + * @return  The value of the dword at given address.
    3644 + *          -1 on error.
    3645 + */
    3646 +dfReadDWord: procedure expose(sGlobals)
    3647 +parse arg sAddr
    3648 +    sMem = dfReadMem(sAddr, 4);
    3649 +    if (sMem <> '') then
    3650 +        return memDword(0, sMem);
    3651 +return -1;
    3652 +
    3653 +
    3654 +/**
    3655 + * Get near symbol.
    3656 + * @param   sAddr   Address expression.
    3657 + * @return  Near output.
    3658 + *          '' on error.
    3659 + */
    3660 +dfNear: procedure expose(sGlobals)
    3661 +parse arg sAddr
    3662 +    Address df 'CMD' 'asOut' 'ln' sAddr
    3663 +    if (rc = 0 & asOut.0 > 0) then
    3664 +    do
    3665 +        if (pos('symbols found', asOut.1) <= 0) then
    3666 +        do
    3667 +            parse var asOut.1 .' 'sRet;
    3668 +            return strip(sRet);
    3669 +        end
    3670 +    end
    3671 +return '';
    3672 +
    3673 +
    3674 +/**
    3675 + * Read all processes into global variable.
    3676 + */
    3677 +dfProcessReadAll: procedure expose(sGlobals)
    3678 +parse arg fBlockInfo
    3679 +    if (\fBlockInfo) then
    3680 +    do
    3681 +        say '[reading processes]'
    3682 +        Address df 'CMD' 'asOut' '.p';
    3683 +        say '[done]'
    3684 +        if (rc = 0 & asOut.0 > 0) then
    3685 +        do
    3686 +            j = 0;
    3687 +            do i = 1 to asOut.0
    3688 +                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    3689 +                    iterate;
    3690 +                /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    3691 +                 *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    3692 +                 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    3693 +                 */
    3694 +                j = j + 1;
    3695 +                aProc.j.sType = '0';
    3696 +                aProc.j.hxBlockId = '0';
    3697 +                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    3698 +                parse var asOut.i aProc.j.hxSlot,
    3699 +                                  aProc.j.hxPid,
    3700 +                                  aProc.j.hxPPid,
    3701 +                                  aProc.j.hxCsid,
    3702 +                                  aProc.j.hxOrd,
    3703 +                                  aProc.j.sState,
    3704 +                                  aProc.j.hxPri,
    3705 +                                  aProc.j.hxpTSD,
    3706 +                                  aProc.j.hxpPTDA,
    3707 +                                  aProc.j.hxpPCB,
    3708 +                                  aProc.j.hxDisp,
    3709 +                                  aProc.j.hxSG,
    3710 +                                  aProc.j.sName;
    3711 +                if (strip(aProc.j.hxSlot) = '') then
    3712 +                    j = j - 1;
    3713 +            end
    3714 +            aProc.0 = j;
    3715 +        end
    3716 +    end
    3717 +    else
    3718 +    do
    3719 +        say '[reading processes]'
    3720 +        Address df 'CMD' 'asOut' '.pb';
    3721 +        say '[done]'
    3722 +        if (rc = 0 & asOut.0 > 0) then
    3723 +        do
    3724 +            j = 0;
    3725 +            do i = 1 to asOut.0
    3726 +                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    3727 +                    iterate;
    3728 +                /*  0044  blk fd436cf8 4os2     Sem32     8001 005d hevResultCodeSet
    3729 +                 * *000b# blk fd436190 pmshell
    3730 +                 *  0073  blk 0b008cbe msrv     SysSem
    3731 +                 */
    3732 +                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    3733 +                j = j + 1;
    3734 +                aProc.j.hxPid = '0';
    3735 +                aProc.j.hxPPid = '0';
    3736 +                aProc.j.hxCsid = '0';
    3737 +                aProc.j.hxOrd = '0';
    3738 +                aProc.j.hxPri = '0';
    3739 +                aProc.j.hxpTSD = '0';
    3740 +                aProc.j.hxpPTDA = '0';
    3741 +                aProc.j.hxpPCB = '0';
    3742 +                aProc.j.hxDisp = '0';
    3743 +                aProc.j.hxSG = '0';
    3744 +                parse var asOut.i aProc.j.hxSlot,
    3745 +                                  aProc.j.sState,
    3746 +                                  aProc.j.hxBlockId,
    3747 +                                  aProc.j.sName,
    3748 +                                  aProc.j.sType .;
    3749 +                if (strip(aProc.j.hxSlot) = '') then
    3750 +                    j = j - 1;
    3751 +            end
    3752 +            aProc.0 = j;
    3753 +        end
    3754 +    end
    3755 +return -1;
    3756 +
    3757 +
    3758 +/**
    3759 + * Gets the blockId of a process from the dumpformatter.
    3760 + * @param   iSlot   The slot to query.
    3761 + * @returns Block id (hex string).
    3762 + *          '0' if failure.
    3763 + */
    3764 +dfProcessBlockId: procedure expose(sGlobals)
    3765 +parse arg iSlot
    3766 +    Address df 'CMD' 'asOut' '.pb' iSlot;
    3767 +    if (rc = 0 & asOut.0 > 0) then
    3768 +    do
    3769 +        /* *000b# blk fd436190 pmshell */
    3770 +        asOut.2 = strip(asOut.2);
    3771 +        parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName
    3772 +        sBlockId = strip(sBlockId)      /* needed??? */
    3773 +        if (sBlockId <> '') then
    3774 +            return sBlockId;
    3775 +    end
    3776 +return '0';
    3777 +
    3778 +
    3779 +/**
    3780 + * Gets the PTDA of a process.
    3781 + * @param   sSlot   Slot or special chars '*' and '#'.
    3782 + * @return  Hex pointer to the PTDA.
    3783 + */
    3784 +dfProcPTDA: procedure expose(sGlobals)
    3785 +parse arg iSlot
    3786 +    Address df 'CMD' 'asOut' '.p' iSlot;
    3787 +    if (rc = 0 & asOut.0 > 0) then
    3788 +    do
    3789 +        /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    3790 +         *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    3791 +         * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    3792 +         */
    3793 +        i = 2;
    3794 +        asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    3795 +        parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .;
    3796 +        hxPTDA = strip(hxPTDA)      /* needed??? */
    3797 +        if (hxPTDA <> '') then
    3798 +            return hxPTDA;
    3799 +    end
    3800 +return '0';
    3801 +
    3802 +
    3803 +/**
    3804 + * Gets a byte from the memory array aMem.
    3805 + * @param   iIndex      Byte offset into the array.
    3806 + */
    3807 +memByte: procedure expose(sGlobals)
    3808 +parse arg iIndex, sMem
    3809 +    cb = memSize(sMem);
    3810 +    if (iIndex < cb) then
    3811 +    do
    3812 +        return x2d(substr(sMem, (iIndex * 2) + 9 + 0, 2));
    3813 +    end
    3814 +    say 'error-memByte: access out of range. cb='cb ' iIndex='iIndex;
    3815 +return -1;
    3816 +
    3817 +
    3818 +/**
    3819 + * Gets a word from the memory array aMem.
    3820 + * @param   iIndex      Byte offset into the array.
    3821 + */
    3822 +memWord: procedure expose(sGlobals)
    3823 +parse arg iIndex, sMem
    3824 +    cb = memSize(sMem);
    3825 +    if (iIndex + 1 < cb) then
    3826 +    do
    3827 +        return x2d(substr(sMem, (iIndex * 2) + 9 + 2, 2)||,
    3828 +                   substr(sMem, (iIndex * 2) + 9 + 0, 2));
    3829 +    end
    3830 +    say 'error-memWord: access out of range. cb='cb ' iIndex='iIndex;
    3831 +return -1;
    3832 +
    3833 +
    3834 +/**
    3835 + * Gets a dword from the passed in memory block.
    3836 + * @param   iIndex      Byte offset into the array.
    3837 + * @param   sMem        Memory block.
    3838 + * @remark  note problems with signed!
    3839 + */
    3840 +memDword: procedure expose(sGlobals)
    3841 +parse arg iIndex, sMem
    3842 +    cb = memSize(sMem);
    3843 +    if (iIndex + 3 < cb) then
    3844 +    do
    3845 +        iIndex = iIndex*2 + 9;
    3846 +        return   x2d(substr(sMem, iIndex + 6, 2)||,
    3847 +                     substr(sMem, iIndex + 4, 2)||,
    3848 +                     substr(sMem, iIndex + 2, 2)||,
    3849 +                     substr(sMem, iIndex + 0, 2));
    3850 +    end
    3851 +    say 'error-memDword: access out of range. cb='cb ' iIndex='iIndex;
    3852 +return -1;
    3853 +
    3854 +
    3855 +/**
    3856 + * Gets a string from the memory array aMem.
    3857 + * @return  String.
    3858 + * @param   iIndex          Byte offset into the array aMem.
    3859 + * @param   cchLength       Length of the string. (optional)
    3860 + *                          If not specified we'll stop at '\0' or end of aMem.
    3861 + * @param   fStoppAtNull    Flag that we'll stop at '\0' even when lenght is specifed. (optional)
    3862 + *                          Default is to fetch cchLength if cchLength is specifed.
    3863 + */
    3864 +memString: procedure expose(sGlobals)
    3865 +parse arg iIndex, cchLength, fStoppAtNull, sMem
    3866 +    cb = memSize(sMem);
    3867 +    if (iIndex < cb) then
    3868 +    do
    3869 +        /* handle optional parameters */
    3870 +        if (fStoppAtNull = '') then
    3871 +            fStoppAtNull = (cchLength = '');
    3872 +        if (cchLength = '') then
    3873 +            cchLength = cb - iIndex;
    3874 +        else if (cchLength + iIndex > cb) then
    3875 +            cchLength = cb - iIndex;
    3876 +
    3877 +        /* fetch string */
    3878 +        sStr = '';
    3879 +        i = iIndex;
    3880 +        do  i = iIndex to iIndex + cchLength
    3881 +            ch = substr(sMem, i*2 + 9, 2);
    3882 +            if (fStoppAtNull) then
    3883 +                if (ch = '00') then
    3884 +                    leave;
    3885 +            sStr = sStr||x2c(ch);
    3886 +        end
    3887 +        return sStr;
    3888 +    end
    3889 +    say 'error-memWord: access out of range. cb='cb ' cbLength='cbLength;
    3890 +return '';
    3891 +
    3892 +
    3893 +/**
    3894 + * Dumps a byte range of the given memory to screen.
    3895 + * @return  0 on success. -1 on failure.
    3896 + * @paran   iIndex      Index into the memory block.
    3897 + * @paran   cbLength    Length to dump.
    3898 + * @paran   sMem        Memory block.
    3899 + */
    3900 +memDumpByte: procedure expose(sGlobals)
    3901 +parse arg iIndex, cbLength, sMem
    3902 +    cb = memSize(sMem);
    3903 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    3904 +    do
    3905 +        iOff = 0;
    3906 +        do while (cbLength > 0)
    3907 +            i = 0;
    3908 +            sLine = '0000:'||d2x(iOff,8);
    3909 +            do i = 0 to 15
    3910 +                if (cbLength - i > 0) then
    3911 +                do
    3912 +                    if (i = 8) then
    3913 +                        sLine = sLine || '-' || d2x(memByte(i + iOff, sMem),2);
    3914 +                    else
    3915 +                        sLine = sLine || ' ' || d2x(memByte(i + iOff, sMem),2);
    3916 +                end
    3917 +                else
    3918 +                    sLine = sLine || '   ';
    3919 +            end
    3920 +            sLine = sLine || ' ';
    3921 +            do i = 0 to 15
    3922 +                if (cbLength - i <= 0) then
    3923 +                    leave;
    3924 +                iCh = memByte(i + iOff, sMem);
    3925 +                if (iCh >= 32) then
    3926 +                    sLine = sLine || d2c(iCh);
    3927 +                else
    3928 +                    sLine = sLine || '.';
    3929 +            end
    3930 +            say sLine
    3931 +            iOff = iOff + 16;
    3932 +            cbLength = cbLength - 16;
    3933 +        end
    3934 +
    3935 +        return 0;
    3936 +    end
    3937 +    say 'error-memDumpByte: access out of range. cb='cb 'iIndex='iIndex 'cbLength='cbLength;
    3938 +return -1;
    3939 +
    3940 +
    3941 +/**
    3942 + * Dumps a word range of the given memory to screen.
    3943 + * @return  0 on success. -1 on failure.
    3944 + * @paran   iIndex      Index into the memory block.
    3945 + * @paran   cbLength    Length to dump.
    3946 + * @paran   sMem        Memory block.
    3947 + */
    3948 +memDumpWord: procedure expose(sGlobals)
    3949 +parse arg iIndex, cbLength, sMem
    3950 +    cb = memSize(sMem);
    3951 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    3952 +    do
    3953 +        iOff = 0;
    3954 +        do while (cbLength > 0)
    3955 +            i = 0;
    3956 +            sLine = '0000:'||d2x(iOff,8)||' ';
    3957 +            do i = 0 to 7
    3958 +                if (cbLength - i > 0) then
    3959 +                    sLine = sLine || ' ' || d2x(memWord(i*2 + iOff, sMem),4);
    3960 +                else
    3961 +                    sLine = sLine || '   ';
    3962 +            end
    3963 +
    3964 +            say sLine
    3965 +            iOff = iOff + 16;
    3966 +            cbLength = cbLength - 16;
    3967 +        end
    3968 +
    3969 +        return 0;
    3970 +    end
    3971 +    say 'error-memDumpWord: access out of range. cb='cb ' cbLength='cbLength;
    3972 +return -1;
    3973 +
    3974 +
    3975 +/**
    3976 + * Dumps a dword range of the given memory to screen.
    3977 + * @return  0 on success. -1 on failure.
    3978 + * @paran   iIndex      Index into the memory block.
    3979 + * @paran   cbLength    Length to dump.
    3980 + * @paran   sMem        Memory block.
    3981 + */
    3982 +memDumpDword: procedure expose(sGlobals)
    3983 +parse arg iIndex, cbLength, sMem
    3984 +    cb = memSize(sMem);
    3985 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    3986 +    do
    3987 +        iOff = 0;
    3988 +        do while (cbLength > 0)
    3989 +            i = 0;
    3990 +            sLine = '0000:'||d2x(iOff, 8)||' ';
    3991 +            do i = 0 to 3
    3992 +                if (cbLength - i > 0) then
    3993 +                    sLine = sLine || ' ' || d2x(memDWord(i*4 + iOff, sMem),8);
    3994 +                else
    3995 +                    sLine = sLine || '   ';
    3996 +            end
    3997 +
    3998 +            say sLine
    3999 +            iOff = iOff + 16;
    4000 +            cbLength = cbLength - 16;
    4001 +        end
    4002 +
    4003 +        return 0;
    4004 +    end
    4005 +    say 'error-memDumpDword: access out of range. cb='cb ' cbLength='cbLength;
    4006 +return -1;
    4007 +
    4008 +
    4009 +/**
    4010 + * Copies a portion of a memory block.
    4011 + * @param   iIndex      Index into the memory block.
    4012 + * @param   cbLength    Bytes to copy.
    4013 + * @param   sMem        Source block.
    4014 + */
    4015 +memCopy: procedure expose(sGlobals)
    4016 +parse arg iIndex, cbLength, sMem
    4017 +    cb = memSize(sMem);
    4018 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    4019 +    do
    4020 +        sCopy = d2x(cbLength,8)||substr(sMem, 9 + iIndex * 2, cbLength * 2);
    4021 +        return sCopy
    4022 +    end
    4023 +    say 'error-memCopy: access out of range. cb='cb ' cbLength='cbLength;
    4024 +return -1;
    4025 +
    4026 +
    4027 +/**
    4028 + * Gets the size of a memory block.
    4029 + * @param   sMem    The memory block in question.
    4030 + */
    4031 +memSize: procedure expose(sGlobals)
    4032 +parse arg sMem
    4033 +/* debug assertions - start - comment out when stable! */
    4034 +if (length(sMem) - 8 <> x2d(left(sMem, 8)) * 2) then
    4035 +do
    4036 +    say 'fatal assert: memSize got a bad memoryblock'
    4037 +    say '              length(sMem) =' length(sMem);
    4038 +    say '              cb = ' x2d(left(sMem,8));
    4039 +    exit(16);
    4040 +end
    4041 +/* debug assertions -  end  - comment out when stable! */
    4042 +return x2d(left(sMem,8));
    4043 +
    4044 +
    4045 +
    4046 +/**
    4047 + * Dump all processes. (debug more or less)
    4048 + */
    4049 +procDumpAll: procedure expose(sGlobals)
    4050 +    say 'Processes:'
    4051 +    do i = 1 to aProc.0
    4052 +        say 'slot='aProc.i.hxSlot 'pid='aProc.i.hxPid 'blkid='aProc.i.hxBlockId 'name='aProc.i.sName
    4053 +    end
    4054 +return 0;
    4055 +
    4056 +
    4057 +/**
    4058 + * Searches thru the process list looking for a process
    4059 + * by it's pid and tid.
    4060 + * @returns Index of the process.
    4061 + * @param   pid     Process Id. (Decimal value)
    4062 + * @param   tid     Thread Id. (Decimal value)
    4063 + */
    4064 +procFindByPidTid: procedure expose(sGlobals)
    4065 +parse arg pid, tid
    4066 +    do i = 1 to aProc.0
    4067 +        if (x2d(aProc.i.hxPid) = pid & x2d(aProc.i.hxTid) = tid) then
    4068 +            return i;
    4069 +    end
    4070 +return 0;
    4071 +
    4072 +
    4073 +/**
    4074 + * Searches thru the process list looking for a process
    4075 + * by it's slot number.
    4076 + * @returns Index of the process.
    4077 + * @param   iSlot   Thread slot number. (Decimal value)
    4078 + */
    4079 +procFindByPidTid: procedure expose(sGlobals)
    4080 +parse arg iSlot
    4081 +    do i = 1 to aProc.0
    4082 +        if (x2d(aProc.i.hxSlot) = iSlot) then
    4083 +            return i;
    4084 +    end
    4085 +return 0;
    4086 +
    4087 +
    4088 +/**
    4089 + * Novaluehandler.
    4090 + */
    4091 +SignalHanlder_NoValue:
    4092 +    say 'fatal error: novalue signal SIGL='SIGL;
    4093 +exit(16);
    4094 +
    4095 +
    4096 +/**
    4097 + * Lowercases a string.
    4098 + * @param   sString     String to fold down.
    4099 + * @returns Lowercase version of sString.
    4100 + */
    4101 +lowercase: procedure expose(sGlobals)
    4102 +parse arg sString
    4103 +return translate(sString,,
    4104 +                 'abcdefghijklmnopqrstuvwxyz',,
    4105 +                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    4106 diff --git a/src/win32k/kKrnlLib/tools/pmdfrexx/sem.cmd b/src/win32k/kKrnlLib/tools/pmdfrexx/sem.cmd
    4107 index 146b544..4176ed1 100644
    4108 --- a/src/win32k/kKrnlLib/tools/pmdfrexx/sem.cmd
    4109 +++ b/src/win32k/kKrnlLib/tools/pmdfrexx/sem.cmd
    4110 @@ -1,909 +1,909 @@
    4111 -/**/
    4112 -
    4113 -
    4114 -/*
    4115 - * Init stuff.
    4116 - */
    4117 -signal on NoValue Name SignalHanlder_NoValue;
    4118 -NUMERIC DIGITS 11
    4119 -
    4120 -
    4121 -/*
    4122 - * Globals
    4123 - */
    4124 -sGlobals = 'ulShSemTbl aProc. sGlobals';
    4125 -ulShSemTbl = 0;
    4126 -aProc.0 = 0;                            /* process table */
    4127 -
    4128 -
    4129 -/*
    4130 - * Args
    4131 - */
    4132 -parse arg sCmd sArgs
    4133 -sCmd = lowercase(sCmd);
    4134 -sArg = lowercase(sArgs);
    4135 -say '';
    4136 -
    4137 -
    4138 -/*
    4139 - * Operation
    4140 - */
    4141 -select
    4142 -    /*
    4143 -     *
    4144 -     */
    4145 -    when (sCmd = 'hsem') then
    4146 -        return Hsem2psem(sArgs);
    4147 -    when (sCmd = 'hsemdump') then
    4148 -        return HsemDump(sArgs);
    4149 -
    4150 -    /*
    4151 -     * Sem32
    4152 -     */
    4153 -    when (sCmd = 'sem32check') then
    4154 -        return Sem32Check(sArgs);
    4155 -
    4156 -
    4157 -    /*
    4158 -     * Generic dump
    4159 -     */
    4160 -    when (sCmd = 'dump' | sCmd = '.d') then
    4161 -    do
    4162 -        parse var sArgs sStruct sDumperArgs
    4163 -        select
    4164 -
    4165 -            otherwise
    4166 -                say 'syntax error: no or invalid structure name.';
    4167 -        return syntax(sArgs);
    4168 -        end
    4169 -    end
    4170 -
    4171 -
    4172 -    /*
    4173 -     * Help and syntax error.
    4174 -     */
    4175 -    when (sCmd = '?' | sCmd = 'help' | sCmd = '-?' | sCmd = '/?' | sCmd = '-h' | sCmd = '/h' | sCmd = '--help') then
    4176 -        return syntax(sArgs);
    4177 -    otherwise
    4178 -        say 'syntax error: no or invalid command'
    4179 -        return syntax(sArgs);
    4180 -    end
    4181 -exit(0)
    4182 -
    4183 -/**
    4184 - * Display usage syntax:
    4185 - */
    4186 -syntax: procedure;
    4187 -    parse source . . sSource;
    4188 -    sName = filespec('name', sSource);
    4189 -    say 'PMDF SEM Rexx Utils v0.0.1';
    4190 -    say 'syntax: %'sName' <command> [args]';
    4191 -    say 'command:'
    4192 -return -1;
    4193 -
    4194 -/* Procedure which we signals on user syntax errors. */
    4195 -synatxerror:
    4196 -    say 'syntax error!'
    4197 -    call syntax;
    4198 -return -1;
    4199 -
    4200 -/*
    4201 - * HSEM GENERIC SEM HANDLE WORKERS
    4202 - * HSEM GENERIC SEM HANDLE WORKERS
    4203 - * HSEM GENERIC SEM HANDLE WORKERS
    4204 - * HSEM GENERIC SEM HANDLE WORKERS
    4205 - * HSEM GENERIC SEM HANDLE WORKERS
    4206 - * HSEM GENERIC SEM HANDLE WORKERS
    4207 - */
    4208 -
    4209 -/**
    4210 - * Checks if a handle is private or shared.
    4211 - * @param   iHandle     Decimal handle value.
    4212 - * @returns true/false
    4213 - */
    4214 -hsemIsPrivate: procedure expose(sGlobals)
    4215 -parse arg iHandle;
    4216 -return iHandle < x2d('80000000'); /*??*/
    4217 -
    4218 -
    4219 -/**
    4220 - * Returns the index part of the handle.
    4221 - * @param   iHandle     Decimal handle value.
    4222 - * @returns Index.
    4223 - */
    4224 -hsemGetIndex: procedure expose(sGlobals)
    4225 -parse arg iHandle;
    4226 -return iHandle // 65536;
    4227 -
    4228 -
    4229 -/**
    4230 - * Returns the index part of the handle.
    4231 - * @param   sHandle     Handle.
    4232 - * @returns Index.
    4233 - */
    4234 -hsemIsHexHandle: procedure expose(sGlobals)
    4235 -parse arg sHandle;
    4236 -fResult = (left(sHandle, 4) = '8001') | (left(sHandle, 4) = '8003') | (left(sHandle, 4) = '0001');
    4237 -return fResult;
    4238 -
    4239 -
    4240 -/**
    4241 - * Get shared sem table base address
    4242 - * @returns ulShSemTbl.
    4243 - *          0/-1 on error.
    4244 - */
    4245 -hsemShSemTbl: procedure expose(sGlobals)
    4246 -    if (ulShSemTbl > 0) then
    4247 -        return ulShSemTbl;
    4248 -    ulShSemTbl = dfReadDword('_pShSemTbl');
    4249 -return ulShSemTbl
    4250 -
    4251 -
    4252 -/**
    4253 - * Converts a semaphore handle to a sem structure pointer.
    4254 - * @returns Linear address of sem structure.
    4255 - *          0 on failure.
    4256 - * @param   Semaphore handle.
    4257 - */
    4258 -Hsem2psem: procedure expose(sGlobals)
    4259 -parse arg sHSEM
    4260 -    sHSEM = strip(sHSEM);
    4261 -    /* argument stuff. */
    4262 -    if (hsemIsHexHandle(sHSEM)) then
    4263 -        iHandle = x2d(sHSEM);
    4264 -    else
    4265 -        iHandle = sHSEM;
    4266 -
    4267 -    /* lookup the index */
    4268 -    iIdx = hsemGetIndex(iHandle);
    4269 -    ulSem = 0;
    4270 -    if (hsemIsPrivate(iHandle)) then
    4271 -    do  /* private sem lookup */
    4272 -        ulPTDA = dfProcPTDA('#');
    4273 -        if (dfReadDword('%'ulPTDA '+ (%ulPrTotUsed - %ptda_start)') > iIdx) then
    4274 -            ulSem  = dfReadDword('%(dw(%'ulPTDA '+ (%pPrSemTbl - %ptda_start))+'d2x(iIdx*4)')');
    4275 -        else
    4276 -            say 'error-Hsem2psem: Invalid semaphore index. ('sHSEM')'
    4277 -    end
    4278 -    else
    4279 -    do  /* global sem lookup */
    4280 -        ulAddr = hsemShSemTbl() + iIdx*4;
    4281 -        ulSem  = dfReadDword('%'d2x(ulAddr));
    4282 -    end
    4283 -
    4284 -    say 'Hsem2psem:' sHSEM '<=>' d2x(ulSem, 8)
    4285 -return ulSem;
    4286 -
    4287 -
    4288 -/**
    4289 - * Dump a sem based by handle value.
    4290 - * @param   sHSEM   Semaphore handle to dump.
    4291 - */
    4292 -HsemDump: procedure expose(sGlobals)
    4293 -parse arg sHSEM
    4294 -
    4295 -    ulSem = hsem2psem(sHSEM);
    4296 -    if (ulSem > 0) then
    4297 -    do
    4298 -        rc = sem32Dump1Ext(ulSem);
    4299 -        return 0;
    4300 -    end
    4301 -return -1;
    4302 -
    4303 -
    4304 -/**
    4305 - * Dumps a sem32 structure.
    4306 - * @param   ulAddr  Decimal address of the sem32 structure.
    4307 - */
    4308 -sem32Dump1Ext: procedure expose(sGlobals)
    4309 -parse arg ulAddr
    4310 -
    4311 -    Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulAddr);
    4312 -
    4313 -    do i = 1 to asOut.0;
    4314 -        if (pos('ADDR:', translate(asOut.i)) > 0) then
    4315 -        do
    4316 -            sAddr = strip(substr(asOut.i, pos(':', asOut.i) + 1))
    4317 -            if (x2d(sAddr) > 0) then
    4318 -                asOut.i = asOut.i '('dfNear(sAddr)')';
    4319 -        end
    4320 -        if (pos(':', asOut.i) > 0) then
    4321 -            say asOut.i;
    4322 -    end
    4323 -return 0;
    4324 -
    4325 -
    4326 -/**
    4327 - * Reads a sem32 structure.
    4328 - * @param   ulAddr  Decimal address of the sem32 structure.
    4329 - */
    4330 -sem32Read: procedure expose(sGlobals)
    4331 -parse arg ulAddr
    4332 -    sSem = '';
    4333 -    Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulAddr);
    4334 -    do i = 1 to asOut.0;
    4335 -        asOut.i = strip(translate(asOut.i, '=', ': '||'0d0a'x));
    4336 -        j = pos(' ', asOut.i);
    4337 -        do while (j > 0)
    4338 -            asOut.i = substr(asOut.i, 1, j-1) || substr(asOut.i, j+1);
    4339 -            j = pos(' ', asOut.i);
    4340 -        end
    4341 -        if (pos('=', asOut.i) > 0) then
    4342 -        do
    4343 -            sSem = sSem||';'asOut.i;
    4344 -        end
    4345 -    end
    4346 -    /*say 'dbg-sem32Read:' sSem;*/
    4347 -return sSem;
    4348 -
    4349 -/* access methods */
    4350 -sem32IsEvent:       procedure expose(sGlobals); parse arg sSem;     return pos('Event;', sSem) > 0;
    4351 -sem32IsMutex:       procedure expose(sGlobals); parse arg sSem;     return pos('Mutex;', sSem) > 0;
    4352 -sem32IsPrivate:     procedure expose(sGlobals); parse arg sSem;     return pos('Private', sSem) > 0;
    4353 -sem32IsShared:      procedure expose(sGlobals); parse arg sSem;     return pos('Shared', sSem) > 0;
    4354 -sem32Flags:         procedure expose(sGlobals); parse arg sSem;
    4355 -i = pos('Flags', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4356 -return '';
    4357 -sem32CreateAddr:    procedure expose(sGlobals); parse arg sSem;
    4358 -i = pos('CreateAddr', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4359 -return '';
    4360 -sem32CallerAddr:    procedure expose(sGlobals); parse arg sSem;
    4361 -i = pos('CallerAddr', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4362 -return '';
    4363 -sem32MuxQ:          procedure expose(sGlobals); parse arg sSem;
    4364 -i = pos('pMuxQ', sSem); if (i > 0) then         return substr(sSem, pos('=', sSem, i)+1, 4);
    4365 -return '';
    4366 -sem32OpenCt:        procedure expose(sGlobals); parse arg sSem;
    4367 -i = pos('OpenCount', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4368 -return '00';
    4369 -
    4370 -sem32mtxIsOwned:    procedure expose(sGlobals); parse arg sSem; return sem32mtxOwner(sSem) <> '0000';
    4371 -sem32mtxOwner:      procedure expose(sGlobals); parse arg sSem;
    4372 -i = pos('Owner', sSem);     if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4373 -return '00';
    4374 -sem32mtxRequestCt:  procedure expose(sGlobals); parse arg sSem;
    4375 -i = pos('RequestCt', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4376 -return '00';
    4377 -sem32mtxRequesterCt:procedure expose(sGlobals); parse arg sSem;
    4378 -i = pos('RequesterCt', sSem);if (i > 0) then    return substr(sSem, pos('=', sSem, i)+1, 4);
    4379 -return '00';
    4380 -
    4381 -sem32evtIsPosted:   procedure expose(sGlobals); parse arg sSem; return sem32Flags(sSem) = 'Posted';
    4382 -sem32evtIsReset:    procedure expose(sGlobals); parse arg sSem; return sem32Flags(sSem) = 'Reset';
    4383 -sem32evtPostCount:  procedure expose(sGlobals); parse arg sSem;
    4384 -i = pos('PostCount', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    4385 -return '';
    4386 -
    4387 -
    4388 -/**
    4389 - * Display all the sems which this process is holding.
    4390 - * Only private sems are implemented currently.
    4391 - */
    4392 -Sem32Check: procedure  expose(sGlobals)
    4393 -    ulPTDA = dfProcPTDA('#');
    4394 -
    4395 -    cPr = dfReadDWord('%'ulPTDA '+ (ulPrTotUsed-ptda_start)');
    4396 -    if (cPr > 0) then
    4397 -    do
    4398 -        sPrTabMem = dfReadMem('%(dw(%'ulPTDA '+(pPrSemTbl-ptda_start)))', cPr*4);
    4399 -        if (sPrTabMem <> '') then
    4400 -        do
    4401 -            do i = 0 to cPr - 1
    4402 -                if (i // 20 = 0) then
    4403 -                    say 'info:' right(i-0,length(cPr)) 'of' cPr 'private sems processed...'
    4404 -                ulSem = memDword(i*4, sPrTabMem);
    4405 -                if (ulSem >= '10000'x) then
    4406 -                do
    4407 -                    sSem = sem32Read(ulSem);
    4408 -                    if (sSem <> '') then
    4409 -                    do
    4410 -                        fOk = 1;
    4411 -                        if (sem32IsMutex(sSem)) then
    4412 -                        do /* mutex*/
    4413 -                            if (sem32mtxIsOwned(sSem)) then
    4414 -                                fOk = 0;
    4415 -                        end
    4416 -                        else if (sem32IsEvent(sSem)) then
    4417 -                        do  /* event */
    4418 -                            if (sem32evtIsReset(sSem)) then
    4419 -                                fOk = 0;
    4420 -                        end
    4421 -                        else fOk = 0;
    4422 -                        if (\fOk) then
    4423 -                            call sem32Dump1Ext ulSem;
    4424 -                    end
    4425 -                end
    4426 -            end
    4427 -        end
    4428 -        else
    4429 -            say 'error-Sem32Check: failed to read private sem table.'
    4430 -    end
    4431 -
    4432 -return 0;
    4433 -
    4434 -
    4435 -
    4436 -/*
    4437 - * PMDF WORKERS - COMMON COMMON COMMON
    4438 - * PMDF WORKERS - COMMON COMMON COMMON
    4439 - * PMDF WORKERS - COMMON COMMON COMMON
    4440 - * PMDF WORKERS - COMMON COMMON COMMON
    4441 - * PMDF WORKERS - COMMON COMMON COMMON
    4442 - * PMDF WORKERS - COMMON COMMON COMMON
    4443 - * PMDF WORKERS - COMMON COMMON COMMON
    4444 - * PMDF WORKERS - COMMON COMMON COMMON
    4445 - * PMDF WORKERS - COMMON COMMON COMMON
    4446 - * PMDF WORKERS - COMMON COMMON COMMON
    4447 - * PMDF WORKERS - COMMON COMMON COMMON
    4448 - * PMDF WORKERS - COMMON COMMON COMMON
    4449 - */
    4450 -
    4451 -
    4452 -
    4453 -/**
    4454 - * Read memory.
    4455 - * @param   sStartExpr  Expression giving the address where to read from.
    4456 - * @param   cbLength    Number of _bytes_ to read.
    4457 - * @returns The memory we have read. (internal format!)
    4458 - */
    4459 -dfReadMem: procedure expose(sGlobals)
    4460 -parse arg sStartExpr, cbLength
    4461 -
    4462 -    /* dump memory */
    4463 -    if ((cbLength // 4) = 0) then
    4464 -    do  /* optimized read */
    4465 -        /*say 'dbg-df: dd' sStartExpr 'L'cbLength/4'T'*/
    4466 -        Address df 'CMD' 'asOut' 'dd' sStartExpr 'L'cbLength/4'T'
    4467 -        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    4468 -        if (rc = 0) then
    4469 -        do
    4470 -            /* interpret output */
    4471 -            j = 0;
    4472 -            sMem = '';
    4473 -            do i = 1 to asOut.0
    4474 -                /* format:
    4475 -                 * 0000:00000000  45534D50 0000004D 00000000 00000000
    4476 -                 */
    4477 -                parse var asOut.i .'  'ch.0' 'ch.1' 'ch.2' 'ch.3
    4478 -                /*say 'dbg:' asOut.i
    4479 -                say 'dbg:' ch.0','ch.1','ch.2','ch.3*/
    4480 -                k = 0;
    4481 -                ch.4 = '';
    4482 -                do while(k <= 3 & strip(ch.k) <> '')
    4483 -                    sMem = sMem || substr(ch.k,7,2)||substr(ch.k,5,2)||substr(ch.k,3,2)||substr(ch.k,1,2);
    4484 -                    j = j + 4;
    4485 -                    k = k + 1;
    4486 -                end
    4487 -            end
    4488 -            if (j <> 0) then
    4489 -                return d2x(j,8)||sMem;
    4490 -        end
    4491 -
    4492 -    end
    4493 -    else
    4494 -    do  /* slower (more output) byte by byte read */
    4495 -        /*say 'dbg-df: db' sStartExpr 'L'cbLength'T'*/
    4496 -        Address df 'CMD' 'asOut' 'db' sStartExpr 'L'cbLength'T'
    4497 -        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    4498 -        if (rc = 0) then
    4499 -        do
    4500 -            /* interpret output */
    4501 -            j = 0;
    4502 -            sMem = '';
    4503 -            do i = 1 to asOut.0
    4504 -                /* format:
    4505 -                 * 9f47:0000af00 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM...........
    4506 -                 */
    4507 -                ch.16 = '';
    4508 -                parse var asOut.i .' 'ch.0' 'ch.1' 'ch.2' 'ch.3' 'ch.4' 'ch.5' 'ch.6' 'ch.7'-'ch.8' 'ch.9' 'ch.10' 'ch.11' 'ch.12' 'ch.13' 'ch.14' 'ch.15' '.
    4509 -                k = 0;
    4510 -                /*say 'dbg:' asOut.i
    4511 -                say 'dbg:' ch.0','ch.1','ch.2','ch.3','ch.4','ch.5','ch.6','ch.7','ch.8','ch.9','ch.10','ch.11','ch.12','ch.13','ch.14','ch.15*/
    4512 -                do while(k <= 15 & strip(ch.k) <> '')
    4513 -                    sMem = sMem || ch.k;
    4514 -                    j = j + 1;
    4515 -                    k = k + 1;
    4516 -                end
    4517 -            end
    4518 -            if (j <> 0) then
    4519 -                return d2x(j,8)||sMem;
    4520 -        end
    4521 -    end
    4522 -return '';
    4523 -
    4524 -
    4525 -/**
    4526 - * Reads a DWord at a given address.
    4527 - * @param   sAddr   Address expression.
    4528 - * @return  The value of the dword at given address.
    4529 - *          -1 on error.
    4530 - */
    4531 -dfReadByte: procedure expose(sGlobals)
    4532 -parse arg sAddr
    4533 -    sMem = dfReadMem(sAddr, 4);
    4534 -    if (sMem <> '') then
    4535 -        return memByte(0, sMem);
    4536 -return -1;
    4537 -
    4538 -
    4539 -/**
    4540 - * Reads a Word at a given address.
    4541 - * @param   sAddr   Address expression.
    4542 - * @return  The value of the dword at given address.
    4543 - *          -1 on error.
    4544 - */
    4545 -dfReadWord: procedure expose(sGlobals)
    4546 -parse arg sAddr
    4547 -    sMem = dfReadMem(sAddr, W);
    4548 -    if (sMem <> '') then
    4549 -        return memWord(0, sMem);
    4550 -return -1;
    4551 -
    4552 -
    4553 -/**
    4554 - * Reads a DWord at a given address.
    4555 - * @param   sAddr   Address expression.
    4556 - * @return  The value of the dword at given address.
    4557 - *          -1 on error.
    4558 - */
    4559 -dfReadDword: procedure expose(sGlobals)
    4560 -parse arg sAddr
    4561 -    sMem = dfReadMem(sAddr, 4);
    4562 -    if (sMem <> '') then
    4563 -        return memDword(0, sMem);
    4564 -return -1;
    4565 -
    4566 -
    4567 -/**
    4568 - * Get near symbol.
    4569 - * @param   sAddr   Address expression.
    4570 - * @return  Near output.
    4571 - *          '' on error.
    4572 - */
    4573 -dfNear: procedure expose(sGlobals)
    4574 -parse arg sAddr
    4575 -    Address df 'CMD' 'asOut' 'ln' sAddr
    4576 -    if (rc = 0 & asOut.0 > 0) then
    4577 -    do
    4578 -        if (pos('symbols found', asOut.1) <= 0) then
    4579 -        do
    4580 -            parse var asOut.1 .' 'sRet;
    4581 -            return strip(sRet);
    4582 -        end
    4583 -    end
    4584 -return '';
    4585 -
    4586 -
    4587 -/**
    4588 - * Read all processes into global variable.
    4589 - */
    4590 -dfProcessReadAll: procedure expose(sGlobals)
    4591 -parse arg fBlockInfo
    4592 -    if (\fBlockInfo) then
    4593 -    do
    4594 -        say '[reading processes]'
    4595 -        Address df 'CMD' 'asOut' '.p';
    4596 -        say '[done]'
    4597 -        if (rc = 0 & asOut.0 > 0) then
    4598 -        do
    4599 -            j = 0;
    4600 -            do i = 1 to asOut.0
    4601 -                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    4602 -                    iterate;
    4603 -                /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    4604 -                 *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    4605 -                 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    4606 -                 */
    4607 -                j = j + 1;
    4608 -                aProc.j.sType = '0';
    4609 -                aProc.j.hxBlockId = '0';
    4610 -                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    4611 -                parse var asOut.i aProc.j.hxSlot,
    4612 -                                  aProc.j.hxPid,
    4613 -                                  aProc.j.hxPPid,
    4614 -                                  aProc.j.hxCsid,
    4615 -                                  aProc.j.hxOrd,
    4616 -                                  aProc.j.sState,
    4617 -                                  aProc.j.hxPri,
    4618 -                                  aProc.j.hxpTSD,
    4619 -                                  aProc.j.hxpPTDA,
    4620 -                                  aProc.j.hxpPCB,
    4621 -                                  aProc.j.hxDisp,
    4622 -                                  aProc.j.hxSG,
    4623 -                                  aProc.j.sName;
    4624 -                if (strip(aProc.j.hxSlot) = '') then
    4625 -                    j = j - 1;
    4626 -            end
    4627 -            aProc.0 = j;
    4628 -        end
    4629 -    end
    4630 -    else
    4631 -    do
    4632 -        say '[reading processes]'
    4633 -        Address df 'CMD' 'asOut' '.pb';
    4634 -        say '[done]'
    4635 -        if (rc = 0 & asOut.0 > 0) then
    4636 -        do
    4637 -            j = 0;
    4638 -            do i = 1 to asOut.0
    4639 -                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    4640 -                    iterate;
    4641 -                /*  0044  blk fd436cf8 4os2     Sem32     8001 005d hevResultCodeSet
    4642 -                 * *000b# blk fd436190 pmshell
    4643 -                 *  0073  blk 0b008cbe msrv     SysSem
    4644 -                 */
    4645 -                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    4646 -                j = j + 1;
    4647 -                aProc.j.hxPid = '0';
    4648 -                aProc.j.hxPPid = '0';
    4649 -                aProc.j.hxCsid = '0';
    4650 -                aProc.j.hxOrd = '0';
    4651 -                aProc.j.hxPri = '0';
    4652 -                aProc.j.hxpTSD = '0';
    4653 -                aProc.j.hxpPTDA = '0';
    4654 -                aProc.j.hxpPCB = '0';
    4655 -                aProc.j.hxDisp = '0';
    4656 -                aProc.j.hxSG = '0';
    4657 -                parse var asOut.i aProc.j.hxSlot,
    4658 -                                  aProc.j.sState,
    4659 -                                  aProc.j.hxBlockId,
    4660 -                                  aProc.j.sName,
    4661 -                                  aProc.j.sType .;
    4662 -                if (strip(aProc.j.hxSlot) = '') then
    4663 -                    j = j - 1;
    4664 -            end
    4665 -            aProc.0 = j;
    4666 -        end
    4667 -    end
    4668 -return -1;
    4669 -
    4670 -
    4671 -/**
    4672 - * Gets the blockId of a process from the dumpformatter.
    4673 - * @param   iSlot   The slot to query.
    4674 - * @returns Block id (hex string).
    4675 - *          '0' if failure.
    4676 - */
    4677 -dfProcessBlockId: procedure expose(sGlobals)
    4678 -parse arg iSlot
    4679 -    Address df 'CMD' 'asOut' '.pb' iSlot;
    4680 -    if (rc = 0 & asOut.0 > 0) then
    4681 -    do
    4682 -        /* *000b# blk fd436190 pmshell */
    4683 -        asOut.2 = strip(asOut.2);
    4684 -        parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName
    4685 -        sBlockId = strip(sBlockId)      /* needed??? */
    4686 -        if (sBlockId <> '') then
    4687 -            return sBlockId;
    4688 -    end
    4689 -return '0';
    4690 -
    4691 -
    4692 -/**
    4693 - * Gets the PTDA of a process.
    4694 - * @param   sSlot   Slot or special chars '*' and '#'.
    4695 - * @return  Hex pointer to the PTDA.
    4696 - */
    4697 -dfProcPTDA: procedure expose(sGlobals)
    4698 -parse arg iSlot
    4699 -    Address df 'CMD' 'asOut' '.p' iSlot;
    4700 -    if (rc = 0 & asOut.0 > 0) then
    4701 -    do
    4702 -        /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    4703 -         *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    4704 -         * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    4705 -         */
    4706 -        i = 2;
    4707 -        asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    4708 -        parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .;
    4709 -        hxPTDA = strip(hxPTDA)      /* needed??? */
    4710 -        if (hxPTDA <> '') then
    4711 -            return hxPTDA;
    4712 -    end
    4713 -return '0';
    4714 -
    4715 -
    4716 -/**
    4717 - * Gets a byte from the memory array aMem.
    4718 - * @param   iIndex      Byte offset into the array.
    4719 - */
    4720 -memByte: procedure expose(sGlobals)
    4721 -parse arg iIndex, sMem
    4722 -    cb = memSize(sMem);
    4723 -    if (iIndex < cb) then
    4724 -    do
    4725 -        return x2d(substr(sMem, (iIndex * 2) + 9 + 0, 2));
    4726 -    end
    4727 -    say 'error-memByte: access out of range. cb='cb ' iIndex='iIndex;
    4728 -return -1;
    4729 -
    4730 -
    4731 -/**
    4732 - * Gets a word from the memory array aMem.
    4733 - * @param   iIndex      Byte offset into the array.
    4734 - */
    4735 -memWord: procedure expose(sGlobals)
    4736 -parse arg iIndex, sMem
    4737 -    cb = memSize(sMem);
    4738 -    if (iIndex + 1 < cb) then
    4739 -    do
    4740 -        return x2d(substr(sMem, (iIndex * 2) + 9 + 2, 2)||,
    4741 -                   substr(sMem, (iIndex * 2) + 9 + 0, 2));
    4742 -    end
    4743 -    say 'error-memWord: access out of range. cb='cb ' iIndex='iIndex;
    4744 -return -1;
    4745 -
    4746 -
    4747 -/**
    4748 - * Gets a dword from the passed in memory block.
    4749 - * @param   iIndex      Byte offset into the array.
    4750 - * @param   sMem        Memory block.
    4751 - * @remark  note problems with signed!
    4752 - */
    4753 -memDword: procedure expose(sGlobals)
    4754 -parse arg iIndex, sMem
    4755 -    cb = memSize(sMem);
    4756 -    if (iIndex + 3 < cb) then
    4757 -    do
    4758 -        iIndex = iIndex*2 + 9;
    4759 -        return   x2d(substr(sMem, iIndex + 6, 2)||,
    4760 -                     substr(sMem, iIndex + 4, 2)||,
    4761 -                     substr(sMem, iIndex + 2, 2)||,
    4762 -                     substr(sMem, iIndex + 0, 2));
    4763 -    end
    4764 -    say 'error-memDword: access out of range. cb='cb ' iIndex='iIndex;
    4765 -return -1;
    4766 -
    4767 -
    4768 -/**
    4769 - * Gets a string from the memory array aMem.
    4770 - * @return  String.
    4771 - * @param   iIndex          Byte offset into the array aMem.
    4772 - * @param   cchLength       Length of the string. (optional)
    4773 - *                          If not specified we'll stop at '\0' or end of aMem.
    4774 - * @param   fStoppAtNull    Flag that we'll stop at '\0' even when lenght is specifed. (optional)
    4775 - *                          Default is to fetch cchLength if cchLength is specifed.
    4776 - */
    4777 -memString: procedure expose(sGlobals)
    4778 -parse arg iIndex, cchLength, fStoppAtNull, sMem
    4779 -    cb = memSize(sMem);
    4780 -    if (iIndex < cb) then
    4781 -    do
    4782 -        /* handle optional parameters */
    4783 -        if (fStoppAtNull = '') then
    4784 -            fStoppAtNull = (cchLength = '');
    4785 -        if (cchLength = '') then
    4786 -            cchLength = cb - iIndex;
    4787 -        else if (cchLength + iIndex > cb) then
    4788 -            cchLength = cb - iIndex;
    4789 -
    4790 -        /* fetch string */
    4791 -        sStr = '';
    4792 -        i = iIndex;
    4793 -        do  i = iIndex to iIndex + cchLength
    4794 -            ch = substr(sMem, i*2 + 9, 2);
    4795 -            if (fStoppAtNull) then
    4796 -                if (ch = '00') then
    4797 -                    leave;
    4798 -            sStr = sStr||x2c(ch);
    4799 -        end
    4800 -        return sStr;
    4801 -    end
    4802 -    say 'error-memWord: access out of range. cb='cb ' cbLength='cbLength;
    4803 -return '';
    4804 -
    4805 -
    4806 -/**
    4807 - * Dumps a byte range of the given memory to screen.
    4808 - * @return  0 on success. -1 on failure.
    4809 - * @paran   iIndex      Index into the memory block.
    4810 - * @paran   cbLength    Length to dump.
    4811 - * @paran   sMem        Memory block.
    4812 - */
    4813 -memDumpByte: procedure expose(sGlobals)
    4814 -parse arg iIndex, cbLength, sMem
    4815 -    cb = memSize(sMem);
    4816 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    4817 -    do
    4818 -        iOff = 0;
    4819 -        do while (cbLength > 0)
    4820 -            i = 0;
    4821 -            sLine = '0000:'||d2x(iOff,8);
    4822 -            do i = 0 to 15
    4823 -                if (cbLength - i > 0) then
    4824 -                do
    4825 -                    if (i = 8) then
    4826 -                        sLine = sLine || '-' || d2x(memByte(i + iOff, sMem),2);
    4827 -                    else
    4828 -                        sLine = sLine || ' ' || d2x(memByte(i + iOff, sMem),2);
    4829 -                end
    4830 -                else
    4831 -                    sLine = sLine || '   ';
    4832 -            end
    4833 -            sLine = sLine || ' ';
    4834 -            do i = 0 to 15
    4835 -                if (cbLength - i <= 0) then
    4836 -                    leave;
    4837 -                iCh = memByte(i + iOff, sMem);
    4838 -                if (iCh >= 32) then
    4839 -                    sLine = sLine || d2c(iCh);
    4840 -                else
    4841 -                    sLine = sLine || '.';
    4842 -            end
    4843 -            say sLine
    4844 -            iOff = iOff + 16;
    4845 -            cbLength = cbLength - 16;
    4846 -        end
    4847 -
    4848 -        return 0;
    4849 -    end
    4850 -    say 'error-memDumpByte: access out of range. cb='cb 'iIndex='iIndex 'cbLength='cbLength;
    4851 -return -1;
    4852 -
    4853 -
    4854 -/**
    4855 - * Dumps a word range of the given memory to screen.
    4856 - * @return  0 on success. -1 on failure.
    4857 - * @paran   iIndex      Index into the memory block.
    4858 - * @paran   cbLength    Length to dump.
    4859 - * @paran   sMem        Memory block.
    4860 - */
    4861 -memDumpWord: procedure expose(sGlobals)
    4862 -parse arg iIndex, cbLength, sMem
    4863 -    cb = memSize(sMem);
    4864 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    4865 -    do
    4866 -        iOff = 0;
    4867 -        do while (cbLength > 0)
    4868 -            i = 0;
    4869 -            sLine = '0000:'||d2x(iOff,8)||' ';
    4870 -            do i = 0 to 7
    4871 -                if (cbLength - i > 0) then
    4872 -                    sLine = sLine || ' ' || d2x(memWord(i*2 + iOff, sMem),4);
    4873 -                else
    4874 -                    sLine = sLine || '   ';
    4875 -            end
    4876 -
    4877 -            say sLine
    4878 -            iOff = iOff + 16;
    4879 -            cbLength = cbLength - 16;
    4880 -        end
    4881 -
    4882 -        return 0;
    4883 -    end
    4884 -    say 'error-memDumpWord: access out of range. cb='cb ' cbLength='cbLength;
    4885 -return -1;
    4886 -
    4887 -
    4888 -/**
    4889 - * Dumps a dword range of the given memory to screen.
    4890 - * @return  0 on success. -1 on failure.
    4891 - * @paran   iIndex      Index into the memory block.
    4892 - * @paran   cbLength    Length to dump.
    4893 - * @paran   sMem        Memory block.
    4894 - */
    4895 -memDumpDword: procedure expose(sGlobals)
    4896 -parse arg iIndex, cbLength, sMem
    4897 -    cb = memSize(sMem);
    4898 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    4899 -    do
    4900 -        iOff = 0;
    4901 -        do while (cbLength > 0)
    4902 -            i = 0;
    4903 -            sLine = '0000:'||d2x(iOff, 8)||' ';
    4904 -            do i = 0 to 3
    4905 -                if (cbLength - i > 0) then
    4906 -                    sLine = sLine || ' ' || d2x(memDWord(i*4 + iOff, sMem),8);
    4907 -                else
    4908 -                    sLine = sLine || '   ';
    4909 -            end
    4910 -
    4911 -            say sLine
    4912 -            iOff = iOff + 16;
    4913 -            cbLength = cbLength - 16;
    4914 -        end
    4915 -
    4916 -        return 0;
    4917 -    end
    4918 -    say 'error-memDumpDword: access out of range. cb='cb ' cbLength='cbLength;
    4919 -return -1;
    4920 -
    4921 -
    4922 -/**
    4923 - * Copies a portion of a memory block.
    4924 - * @param   iIndex      Index into the memory block.
    4925 - * @param   cbLength    Bytes to copy.
    4926 - * @param   sMem        Source block.
    4927 - */
    4928 -memCopy: procedure expose(sGlobals)
    4929 -parse arg iIndex, cbLength, sMem
    4930 -    cb = memSize(sMem);
    4931 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    4932 -    do
    4933 -        sCopy = d2x(cbLength,8)||substr(sMem, 9 + iIndex * 2, cbLength * 2);
    4934 -        return sCopy
    4935 -    end
    4936 -    say 'error-memCopy: access out of range. cb='cb ' cbLength='cbLength;
    4937 -return -1;
    4938 -
    4939 -
    4940 -/**
    4941 - * Gets the size of a memory block.
    4942 - * @param   sMem    The memory block in question.
    4943 - */
    4944 -memSize: procedure expose(sGlobals)
    4945 -parse arg sMem
    4946 -/* debug assertions - start - comment out when stable! */
    4947 -if (length(sMem) - 8 <> x2d(left(sMem, 8)) * 2) then
    4948 -do
    4949 -    say 'fatal assert: memSize got a bad memoryblock'
    4950 -    say '              length(sMem) =' length(sMem);
    4951 -    say '              cb = ' x2d(left(sMem,8));
    4952 -    exit(16);
    4953 -end
    4954 -/* debug assertions -  end  - comment out when stable! */
    4955 -return x2d(left(sMem,8));
    4956 -
    4957 -
    4958 -
    4959 -/**
    4960 - * Dump all processes. (debug more or less)
    4961 - */
    4962 -procDumpAll: procedure expose(sGlobals)
    4963 -    say 'Processes:'
    4964 -    do i = 1 to aProc.0
    4965 -        say 'slot='aProc.i.hxSlot 'pid='aProc.i.hxPid 'blkid='aProc.i.hxBlockId 'name='aProc.i.sName
    4966 -    end
    4967 -return 0;
    4968 -
    4969 -
    4970 -/**
    4971 - * Searches thru the process list looking for a process
    4972 - * by it's pid and tid.
    4973 - * @returns Index of the process.
    4974 - * @param   pid     Process Id. (Decimal value)
    4975 - * @param   tid     Thread Id. (Decimal value)
    4976 - */
    4977 -procFindByPidTid: procedure expose(sGlobals)
    4978 -parse arg pid, tid
    4979 -    do i = 1 to aProc.0
    4980 -        if (x2d(aProc.i.hxPid) = pid & x2d(aProc.i.hxTid) = tid) then
    4981 -            return i;
    4982 -    end
    4983 -return 0;
    4984 -
    4985 -
    4986 -/**
    4987 - * Searches thru the process list looking for a process
    4988 - * by it's slot number.
    4989 - * @returns Index of the process.
    4990 - * @param   iSlot   Thread slot number. (Decimal value)
    4991 - */
    4992 -procFindByPidTid: procedure expose(sGlobals)
    4993 -parse arg iSlot
    4994 -    do i = 1 to aProc.0
    4995 -        if (x2d(aProc.i.hxSlot) = iSlot) then
    4996 -            return i;
    4997 -    end
    4998 -return 0;
    4999 -
    5000 -
    5001 -/**
    5002 - * Novaluehandler.
    5003 - */
    5004 -SignalHanlder_NoValue:
    5005 -    say 'fatal error: novalue signal SIGL='SIGL;
    5006 -exit(16);
    5007 -
    5008 -
    5009 -/**
    5010 - * Lowercases a string.
    5011 - * @param   sString     String to fold down.
    5012 - * @returns Lowercase version of sString.
    5013 - */
    5014 -lowercase: procedure expose(sGlobals)
    5015 -parse arg sString
    5016 -return translate(sString,,
    5017 -                 'abcdefghijklmnopqrstuvwxyz',,
    5018 -                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    5019 -
    5020 +/**/
    5021 +
    5022 +
    5023 +/*
    5024 + * Init stuff.
    5025 + */
    5026 +signal on NoValue Name SignalHanlder_NoValue;
    5027 +NUMERIC DIGITS 11
    5028 +
    5029 +
    5030 +/*
    5031 + * Globals
    5032 + */
    5033 +sGlobals = 'ulShSemTbl aProc. sGlobals';
    5034 +ulShSemTbl = 0;
    5035 +aProc.0 = 0;                            /* process table */
    5036 +
    5037 +
    5038 +/*
    5039 + * Args
    5040 + */
    5041 +parse arg sCmd sArgs
    5042 +sCmd = lowercase(sCmd);
    5043 +sArg = lowercase(sArgs);
    5044 +say '';
    5045 +
    5046 +
    5047 +/*
    5048 + * Operation
    5049 + */
    5050 +select
    5051 +    /*
    5052 +     *
    5053 +     */
    5054 +    when (sCmd = 'hsem') then
    5055 +        return Hsem2psem(sArgs);
    5056 +    when (sCmd = 'hsemdump') then
    5057 +        return HsemDump(sArgs);
    5058 +
    5059 +    /*
    5060 +     * Sem32
    5061 +     */
    5062 +    when (sCmd = 'sem32check') then
    5063 +        return Sem32Check(sArgs);
    5064 +
    5065 +
    5066 +    /*
    5067 +     * Generic dump
    5068 +     */
    5069 +    when (sCmd = 'dump' | sCmd = '.d') then
    5070 +    do
    5071 +        parse var sArgs sStruct sDumperArgs
    5072 +        select
    5073 +
    5074 +            otherwise
    5075 +                say 'syntax error: no or invalid structure name.';
    5076 +        return syntax(sArgs);
    5077 +        end
    5078 +    end
    5079 +
    5080 +
    5081 +    /*
    5082 +     * Help and syntax error.
    5083 +     */
    5084 +    when (sCmd = '?' | sCmd = 'help' | sCmd = '-?' | sCmd = '/?' | sCmd = '-h' | sCmd = '/h' | sCmd = '--help') then
    5085 +        return syntax(sArgs);
    5086 +    otherwise
    5087 +        say 'syntax error: no or invalid command'
    5088 +        return syntax(sArgs);
    5089 +    end
    5090 +exit(0)
    5091 +
    5092 +/**
    5093 + * Display usage syntax:
    5094 + */
    5095 +syntax: procedure;
    5096 +    parse source . . sSource;
    5097 +    sName = filespec('name', sSource);
    5098 +    say 'PMDF SEM Rexx Utils v0.0.1';
    5099 +    say 'syntax: %'sName' <command> [args]';
    5100 +    say 'command:'
    5101 +return -1;
    5102 +
    5103 +/* Procedure which we signals on user syntax errors. */
    5104 +synatxerror:
    5105 +    say 'syntax error!'
    5106 +    call syntax;
    5107 +return -1;
    5108 +
    5109 +/*
    5110 + * HSEM GENERIC SEM HANDLE WORKERS
    5111 + * HSEM GENERIC SEM HANDLE WORKERS
    5112 + * HSEM GENERIC SEM HANDLE WORKERS
    5113 + * HSEM GENERIC SEM HANDLE WORKERS
    5114 + * HSEM GENERIC SEM HANDLE WORKERS
    5115 + * HSEM GENERIC SEM HANDLE WORKERS
    5116 + */
    5117 +
    5118 +/**
    5119 + * Checks if a handle is private or shared.
    5120 + * @param   iHandle     Decimal handle value.
    5121 + * @returns true/false
    5122 + */
    5123 +hsemIsPrivate: procedure expose(sGlobals)
    5124 +parse arg iHandle;
    5125 +return iHandle < x2d('80000000'); /*??*/
    5126 +
    5127 +
    5128 +/**
    5129 + * Returns the index part of the handle.
    5130 + * @param   iHandle     Decimal handle value.
    5131 + * @returns Index.
    5132 + */
    5133 +hsemGetIndex: procedure expose(sGlobals)
    5134 +parse arg iHandle;
    5135 +return iHandle // 65536;
    5136 +
    5137 +
    5138 +/**
    5139 + * Returns the index part of the handle.
    5140 + * @param   sHandle     Handle.
    5141 + * @returns Index.
    5142 + */
    5143 +hsemIsHexHandle: procedure expose(sGlobals)
    5144 +parse arg sHandle;
    5145 +fResult = (left(sHandle, 4) = '8001') | (left(sHandle, 4) = '8003') | (left(sHandle, 4) = '0001');
    5146 +return fResult;
    5147 +
    5148 +
    5149 +/**
    5150 + * Get shared sem table base address
    5151 + * @returns ulShSemTbl.
    5152 + *          0/-1 on error.
    5153 + */
    5154 +hsemShSemTbl: procedure expose(sGlobals)
    5155 +    if (ulShSemTbl > 0) then
    5156 +        return ulShSemTbl;
    5157 +    ulShSemTbl = dfReadDword('_pShSemTbl');
    5158 +return ulShSemTbl
    5159 +
    5160 +
    5161 +/**
    5162 + * Converts a semaphore handle to a sem structure pointer.
    5163 + * @returns Linear address of sem structure.
    5164 + *          0 on failure.
    5165 + * @param   Semaphore handle.
    5166 + */
    5167 +Hsem2psem: procedure expose(sGlobals)
    5168 +parse arg sHSEM
    5169 +    sHSEM = strip(sHSEM);
    5170 +    /* argument stuff. */
    5171 +    if (hsemIsHexHandle(sHSEM)) then
    5172 +        iHandle = x2d(sHSEM);
    5173 +    else
    5174 +        iHandle = sHSEM;
    5175 +
    5176 +    /* lookup the index */
    5177 +    iIdx = hsemGetIndex(iHandle);
    5178 +    ulSem = 0;
    5179 +    if (hsemIsPrivate(iHandle)) then
    5180 +    do  /* private sem lookup */
    5181 +        ulPTDA = dfProcPTDA('#');
    5182 +        if (dfReadDword('%'ulPTDA '+ (%ulPrTotUsed - %ptda_start)') > iIdx) then
    5183 +            ulSem  = dfReadDword('%(dw(%'ulPTDA '+ (%pPrSemTbl - %ptda_start))+'d2x(iIdx*4)')');
    5184 +        else
    5185 +            say 'error-Hsem2psem: Invalid semaphore index. ('sHSEM')'
    5186 +    end
    5187 +    else
    5188 +    do  /* global sem lookup */
    5189 +        ulAddr = hsemShSemTbl() + iIdx*4;
    5190 +        ulSem  = dfReadDword('%'d2x(ulAddr));
    5191 +    end
    5192 +
    5193 +    say 'Hsem2psem:' sHSEM '<=>' d2x(ulSem, 8)
    5194 +return ulSem;
    5195 +
    5196 +
    5197 +/**
    5198 + * Dump a sem based by handle value.
    5199 + * @param   sHSEM   Semaphore handle to dump.
    5200 + */
    5201 +HsemDump: procedure expose(sGlobals)
    5202 +parse arg sHSEM
    5203 +
    5204 +    ulSem = hsem2psem(sHSEM);
    5205 +    if (ulSem > 0) then
    5206 +    do
    5207 +        rc = sem32Dump1Ext(ulSem);
    5208 +        return 0;
    5209 +    end
    5210 +return -1;
    5211 +
    5212 +
    5213 +/**
    5214 + * Dumps a sem32 structure.
    5215 + * @param   ulAddr  Decimal address of the sem32 structure.
    5216 + */
    5217 +sem32Dump1Ext: procedure expose(sGlobals)
    5218 +parse arg ulAddr
    5219 +
    5220 +    Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulAddr);
    5221 +
    5222 +    do i = 1 to asOut.0;
    5223 +        if (pos('ADDR:', translate(asOut.i)) > 0) then
    5224 +        do
    5225 +            sAddr = strip(substr(asOut.i, pos(':', asOut.i) + 1))
    5226 +            if (x2d(sAddr) > 0) then
    5227 +                asOut.i = asOut.i '('dfNear(sAddr)')';
    5228 +        end
    5229 +        if (pos(':', asOut.i) > 0) then
    5230 +            say asOut.i;
    5231 +    end
    5232 +return 0;
    5233 +
    5234 +
    5235 +/**
    5236 + * Reads a sem32 structure.
    5237 + * @param   ulAddr  Decimal address of the sem32 structure.
    5238 + */
    5239 +sem32Read: procedure expose(sGlobals)
    5240 +parse arg ulAddr
    5241 +    sSem = '';
    5242 +    Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulAddr);
    5243 +    do i = 1 to asOut.0;
    5244 +        asOut.i = strip(translate(asOut.i, '=', ': '||'0d0a'x));
    5245 +        j = pos(' ', asOut.i);
    5246 +        do while (j > 0)
    5247 +            asOut.i = substr(asOut.i, 1, j-1) || substr(asOut.i, j+1);
    5248 +            j = pos(' ', asOut.i);
    5249 +        end
    5250 +        if (pos('=', asOut.i) > 0) then
    5251 +        do
    5252 +            sSem = sSem||';'asOut.i;
    5253 +        end
    5254 +    end
    5255 +    /*say 'dbg-sem32Read:' sSem;*/
    5256 +return sSem;
    5257 +
    5258 +/* access methods */
    5259 +sem32IsEvent:       procedure expose(sGlobals); parse arg sSem;     return pos('Event;', sSem) > 0;
    5260 +sem32IsMutex:       procedure expose(sGlobals); parse arg sSem;     return pos('Mutex;', sSem) > 0;
    5261 +sem32IsPrivate:     procedure expose(sGlobals); parse arg sSem;     return pos('Private', sSem) > 0;
    5262 +sem32IsShared:      procedure expose(sGlobals); parse arg sSem;     return pos('Shared', sSem) > 0;
    5263 +sem32Flags:         procedure expose(sGlobals); parse arg sSem;
    5264 +i = pos('Flags', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5265 +return '';
    5266 +sem32CreateAddr:    procedure expose(sGlobals); parse arg sSem;
    5267 +i = pos('CreateAddr', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5268 +return '';
    5269 +sem32CallerAddr:    procedure expose(sGlobals); parse arg sSem;
    5270 +i = pos('CallerAddr', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5271 +return '';
    5272 +sem32MuxQ:          procedure expose(sGlobals); parse arg sSem;
    5273 +i = pos('pMuxQ', sSem); if (i > 0) then         return substr(sSem, pos('=', sSem, i)+1, 4);
    5274 +return '';
    5275 +sem32OpenCt:        procedure expose(sGlobals); parse arg sSem;
    5276 +i = pos('OpenCount', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5277 +return '00';
    5278 +
    5279 +sem32mtxIsOwned:    procedure expose(sGlobals); parse arg sSem; return sem32mtxOwner(sSem) <> '0000';
    5280 +sem32mtxOwner:      procedure expose(sGlobals); parse arg sSem;
    5281 +i = pos('Owner', sSem);     if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5282 +return '00';
    5283 +sem32mtxRequestCt:  procedure expose(sGlobals); parse arg sSem;
    5284 +i = pos('RequestCt', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5285 +return '00';
    5286 +sem32mtxRequesterCt:procedure expose(sGlobals); parse arg sSem;
    5287 +i = pos('RequesterCt', sSem);if (i > 0) then    return substr(sSem, pos('=', sSem, i)+1, 4);
    5288 +return '00';
    5289 +
    5290 +sem32evtIsPosted:   procedure expose(sGlobals); parse arg sSem; return sem32Flags(sSem) = 'Posted';
    5291 +sem32evtIsReset:    procedure expose(sGlobals); parse arg sSem; return sem32Flags(sSem) = 'Reset';
    5292 +sem32evtPostCount:  procedure expose(sGlobals); parse arg sSem;
    5293 +i = pos('PostCount', sSem); if (i > 0) then     return substr(sSem, pos('=', sSem, i)+1, 4);
    5294 +return '';
    5295 +
    5296 +
    5297 +/**
    5298 + * Display all the sems which this process is holding.
    5299 + * Only private sems are implemented currently.
    5300 + */
    5301 +Sem32Check: procedure  expose(sGlobals)
    5302 +    ulPTDA = dfProcPTDA('#');
    5303 +
    5304 +    cPr = dfReadDWord('%'ulPTDA '+ (ulPrTotUsed-ptda_start)');
    5305 +    if (cPr > 0) then
    5306 +    do
    5307 +        sPrTabMem = dfReadMem('%(dw(%'ulPTDA '+(pPrSemTbl-ptda_start)))', cPr*4);
    5308 +        if (sPrTabMem <> '') then
    5309 +        do
    5310 +            do i = 0 to cPr - 1
    5311 +                if (i // 20 = 0) then
    5312 +                    say 'info:' right(i-0,length(cPr)) 'of' cPr 'private sems processed...'
    5313 +                ulSem = memDword(i*4, sPrTabMem);
    5314 +                if (ulSem >= '10000'x) then
    5315 +                do
    5316 +                    sSem = sem32Read(ulSem);
    5317 +                    if (sSem <> '') then
    5318 +                    do
    5319 +                        fOk = 1;
    5320 +                        if (sem32IsMutex(sSem)) then
    5321 +                        do /* mutex*/
    5322 +                            if (sem32mtxIsOwned(sSem)) then
    5323 +                                fOk = 0;
    5324 +                        end
    5325 +                        else if (sem32IsEvent(sSem)) then
    5326 +                        do  /* event */
    5327 +                            if (sem32evtIsReset(sSem)) then
    5328 +                                fOk = 0;
    5329 +                        end
    5330 +                        else fOk = 0;
    5331 +                        if (\fOk) then
    5332 +                            call sem32Dump1Ext ulSem;
    5333 +                    end
    5334 +                end
    5335 +            end
    5336 +        end
    5337 +        else
    5338 +            say 'error-Sem32Check: failed to read private sem table.'
    5339 +    end
    5340 +
    5341 +return 0;
    5342 +
    5343 +
    5344 +
    5345 +/*
    5346 + * PMDF WORKERS - COMMON COMMON COMMON
    5347 + * PMDF WORKERS - COMMON COMMON COMMON
    5348 + * PMDF WORKERS - COMMON COMMON COMMON
    5349 + * PMDF WORKERS - COMMON COMMON COMMON
    5350 + * PMDF WORKERS - COMMON COMMON COMMON
    5351 + * PMDF WORKERS - COMMON COMMON COMMON
    5352 + * PMDF WORKERS - COMMON COMMON COMMON
    5353 + * PMDF WORKERS - COMMON COMMON COMMON
    5354 + * PMDF WORKERS - COMMON COMMON COMMON
    5355 + * PMDF WORKERS - COMMON COMMON COMMON
    5356 + * PMDF WORKERS - COMMON COMMON COMMON
    5357 + * PMDF WORKERS - COMMON COMMON COMMON
    5358 + */
    5359 +
    5360 +
    5361 +
    5362 +/**
    5363 + * Read memory.
    5364 + * @param   sStartExpr  Expression giving the address where to read from.
    5365 + * @param   cbLength    Number of _bytes_ to read.
    5366 + * @returns The memory we have read. (internal format!)
    5367 + */
    5368 +dfReadMem: procedure expose(sGlobals)
    5369 +parse arg sStartExpr, cbLength
    5370 +
    5371 +    /* dump memory */
    5372 +    if ((cbLength // 4) = 0) then
    5373 +    do  /* optimized read */
    5374 +        /*say 'dbg-df: dd' sStartExpr 'L'cbLength/4'T'*/
    5375 +        Address df 'CMD' 'asOut' 'dd' sStartExpr 'L'cbLength/4'T'
    5376 +        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    5377 +        if (rc = 0) then
    5378 +        do
    5379 +            /* interpret output */
    5380 +            j = 0;
    5381 +            sMem = '';
    5382 +            do i = 1 to asOut.0
    5383 +                /* format:
    5384 +                 * 0000:00000000  45534D50 0000004D 00000000 00000000
    5385 +                 */
    5386 +                parse var asOut.i .'  'ch.0' 'ch.1' 'ch.2' 'ch.3
    5387 +                /*say 'dbg:' asOut.i
    5388 +                say 'dbg:' ch.0','ch.1','ch.2','ch.3*/
    5389 +                k = 0;
    5390 +                ch.4 = '';
    5391 +                do while(k <= 3 & strip(ch.k) <> '')
    5392 +                    sMem = sMem || substr(ch.k,7,2)||substr(ch.k,5,2)||substr(ch.k,3,2)||substr(ch.k,1,2);
    5393 +                    j = j + 4;
    5394 +                    k = k + 1;
    5395 +                end
    5396 +            end
    5397 +            if (j <> 0) then
    5398 +                return d2x(j,8)||sMem;
    5399 +        end
    5400 +
    5401 +    end
    5402 +    else
    5403 +    do  /* slower (more output) byte by byte read */
    5404 +        /*say 'dbg-df: db' sStartExpr 'L'cbLength'T'*/
    5405 +        Address df 'CMD' 'asOut' 'db' sStartExpr 'L'cbLength'T'
    5406 +        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    5407 +        if (rc = 0) then
    5408 +        do
    5409 +            /* interpret output */
    5410 +            j = 0;
    5411 +            sMem = '';
    5412 +            do i = 1 to asOut.0
    5413 +                /* format:
    5414 +                 * 9f47:0000af00 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM...........
    5415 +                 */
    5416 +                ch.16 = '';
    5417 +                parse var asOut.i .' 'ch.0' 'ch.1' 'ch.2' 'ch.3' 'ch.4' 'ch.5' 'ch.6' 'ch.7'-'ch.8' 'ch.9' 'ch.10' 'ch.11' 'ch.12' 'ch.13' 'ch.14' 'ch.15' '.
    5418 +                k = 0;
    5419 +                /*say 'dbg:' asOut.i
    5420 +                say 'dbg:' ch.0','ch.1','ch.2','ch.3','ch.4','ch.5','ch.6','ch.7','ch.8','ch.9','ch.10','ch.11','ch.12','ch.13','ch.14','ch.15*/
    5421 +                do while(k <= 15 & strip(ch.k) <> '')
    5422 +                    sMem = sMem || ch.k;
    5423 +                    j = j + 1;
    5424 +                    k = k + 1;
    5425 +                end
    5426 +            end
    5427 +            if (j <> 0) then
    5428 +                return d2x(j,8)||sMem;
    5429 +        end
    5430 +    end
    5431 +return '';
    5432 +
    5433 +
    5434 +/**
    5435 + * Reads a DWord at a given address.
    5436 + * @param   sAddr   Address expression.
    5437 + * @return  The value of the dword at given address.
    5438 + *          -1 on error.
    5439 + */
    5440 +dfReadByte: procedure expose(sGlobals)
    5441 +parse arg sAddr
    5442 +    sMem = dfReadMem(sAddr, 4);
    5443 +    if (sMem <> '') then
    5444 +        return memByte(0, sMem);
    5445 +return -1;
    5446 +
    5447 +
    5448 +/**
    5449 + * Reads a Word at a given address.
    5450 + * @param   sAddr   Address expression.
    5451 + * @return  The value of the dword at given address.
    5452 + *          -1 on error.
    5453 + */
    5454 +dfReadWord: procedure expose(sGlobals)
    5455 +parse arg sAddr
    5456 +    sMem = dfReadMem(sAddr, W);
    5457 +    if (sMem <> '') then
    5458 +        return memWord(0, sMem);
    5459 +return -1;
    5460 +
    5461 +
    5462 +/**
    5463 + * Reads a DWord at a given address.
    5464 + * @param   sAddr   Address expression.
    5465 + * @return  The value of the dword at given address.
    5466 + *          -1 on error.
    5467 + */
    5468 +dfReadDword: procedure expose(sGlobals)
    5469 +parse arg sAddr
    5470 +    sMem = dfReadMem(sAddr, 4);
    5471 +    if (sMem <> '') then
    5472 +        return memDword(0, sMem);
    5473 +return -1;
    5474 +
    5475 +
    5476 +/**
    5477 + * Get near symbol.
    5478 + * @param   sAddr   Address expression.
    5479 + * @return  Near output.
    5480 + *          '' on error.
    5481 + */
    5482 +dfNear: procedure expose(sGlobals)
    5483 +parse arg sAddr
    5484 +    Address df 'CMD' 'asOut' 'ln' sAddr
    5485 +    if (rc = 0 & asOut.0 > 0) then
    5486 +    do
    5487 +        if (pos('symbols found', asOut.1) <= 0) then
    5488 +        do
    5489 +            parse var asOut.1 .' 'sRet;
    5490 +            return strip(sRet);
    5491 +        end
    5492 +    end
    5493 +return '';
    5494 +
    5495 +
    5496 +/**
    5497 + * Read all processes into global variable.
    5498 + */
    5499 +dfProcessReadAll: procedure expose(sGlobals)
    5500 +parse arg fBlockInfo
    5501 +    if (\fBlockInfo) then
    5502 +    do
    5503 +        say '[reading processes]'
    5504 +        Address df 'CMD' 'asOut' '.p';
    5505 +        say '[done]'
    5506 +        if (rc = 0 & asOut.0 > 0) then
    5507 +        do
    5508 +            j = 0;
    5509 +            do i = 1 to asOut.0
    5510 +                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    5511 +                    iterate;
    5512 +                /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    5513 +                 *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    5514 +                 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    5515 +                 */
    5516 +                j = j + 1;
    5517 +                aProc.j.sType = '0';
    5518 +                aProc.j.hxBlockId = '0';
    5519 +                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    5520 +                parse var asOut.i aProc.j.hxSlot,
    5521 +                                  aProc.j.hxPid,
    5522 +                                  aProc.j.hxPPid,
    5523 +                                  aProc.j.hxCsid,
    5524 +                                  aProc.j.hxOrd,
    5525 +                                  aProc.j.sState,
    5526 +                                  aProc.j.hxPri,
    5527 +                                  aProc.j.hxpTSD,
    5528 +                                  aProc.j.hxpPTDA,
    5529 +                                  aProc.j.hxpPCB,
    5530 +                                  aProc.j.hxDisp,
    5531 +                                  aProc.j.hxSG,
    5532 +                                  aProc.j.sName;
    5533 +                if (strip(aProc.j.hxSlot) = '') then
    5534 +                    j = j - 1;
    5535 +            end
    5536 +            aProc.0 = j;
    5537 +        end
    5538 +    end
    5539 +    else
    5540 +    do
    5541 +        say '[reading processes]'
    5542 +        Address df 'CMD' 'asOut' '.pb';
    5543 +        say '[done]'
    5544 +        if (rc = 0 & asOut.0 > 0) then
    5545 +        do
    5546 +            j = 0;
    5547 +            do i = 1 to asOut.0
    5548 +                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    5549 +                    iterate;
    5550 +                /*  0044  blk fd436cf8 4os2     Sem32     8001 005d hevResultCodeSet
    5551 +                 * *000b# blk fd436190 pmshell
    5552 +                 *  0073  blk 0b008cbe msrv     SysSem
    5553 +                 */
    5554 +                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    5555 +                j = j + 1;
    5556 +                aProc.j.hxPid = '0';
    5557 +                aProc.j.hxPPid = '0';
    5558 +                aProc.j.hxCsid = '0';
    5559 +                aProc.j.hxOrd = '0';
    5560 +                aProc.j.hxPri = '0';
    5561 +                aProc.j.hxpTSD = '0';
    5562 +                aProc.j.hxpPTDA = '0';
    5563 +                aProc.j.hxpPCB = '0';
    5564 +                aProc.j.hxDisp = '0';
    5565 +                aProc.j.hxSG = '0';
    5566 +                parse var asOut.i aProc.j.hxSlot,
    5567 +                                  aProc.j.sState,
    5568 +                                  aProc.j.hxBlockId,
    5569 +                                  aProc.j.sName,
    5570 +                                  aProc.j.sType .;
    5571 +                if (strip(aProc.j.hxSlot) = '') then
    5572 +                    j = j - 1;
    5573 +            end
    5574 +            aProc.0 = j;
    5575 +        end
    5576 +    end
    5577 +return -1;
    5578 +
    5579 +
    5580 +/**
    5581 + * Gets the blockId of a process from the dumpformatter.
    5582 + * @param   iSlot   The slot to query.
    5583 + * @returns Block id (hex string).
    5584 + *          '0' if failure.
    5585 + */
    5586 +dfProcessBlockId: procedure expose(sGlobals)
    5587 +parse arg iSlot
    5588 +    Address df 'CMD' 'asOut' '.pb' iSlot;
    5589 +    if (rc = 0 & asOut.0 > 0) then
    5590 +    do
    5591 +        /* *000b# blk fd436190 pmshell */
    5592 +        asOut.2 = strip(asOut.2);
    5593 +        parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName
    5594 +        sBlockId = strip(sBlockId)      /* needed??? */
    5595 +        if (sBlockId <> '') then
    5596 +            return sBlockId;
    5597 +    end
    5598 +return '0';
    5599 +
    5600 +
    5601 +/**
    5602 + * Gets the PTDA of a process.
    5603 + * @param   sSlot   Slot or special chars '*' and '#'.
    5604 + * @return  Hex pointer to the PTDA.
    5605 + */
    5606 +dfProcPTDA: procedure expose(sGlobals)
    5607 +parse arg iSlot
    5608 +    Address df 'CMD' 'asOut' '.p' iSlot;
    5609 +    if (rc = 0 & asOut.0 > 0) then
    5610 +    do
    5611 +        /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    5612 +         *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    5613 +         * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    5614 +         */
    5615 +        i = 2;
    5616 +        asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    5617 +        parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .;
    5618 +        hxPTDA = strip(hxPTDA)      /* needed??? */
    5619 +        if (hxPTDA <> '') then
    5620 +            return hxPTDA;
    5621 +    end
    5622 +return '0';
    5623 +
    5624 +
    5625 +/**
    5626 + * Gets a byte from the memory array aMem.
    5627 + * @param   iIndex      Byte offset into the array.
    5628 + */
    5629 +memByte: procedure expose(sGlobals)
    5630 +parse arg iIndex, sMem
    5631 +    cb = memSize(sMem);
    5632 +    if (iIndex < cb) then
    5633 +    do
    5634 +        return x2d(substr(sMem, (iIndex * 2) + 9 + 0, 2));
    5635 +    end
    5636 +    say 'error-memByte: access out of range. cb='cb ' iIndex='iIndex;
    5637 +return -1;
    5638 +
    5639 +
    5640 +/**
    5641 + * Gets a word from the memory array aMem.
    5642 + * @param   iIndex      Byte offset into the array.
    5643 + */
    5644 +memWord: procedure expose(sGlobals)
    5645 +parse arg iIndex, sMem
    5646 +    cb = memSize(sMem);
    5647 +    if (iIndex + 1 < cb) then
    5648 +    do
    5649 +        return x2d(substr(sMem, (iIndex * 2) + 9 + 2, 2)||,
    5650 +                   substr(sMem, (iIndex * 2) + 9 + 0, 2));
    5651 +    end
    5652 +    say 'error-memWord: access out of range. cb='cb ' iIndex='iIndex;
    5653 +return -1;
    5654 +
    5655 +
    5656 +/**
    5657 + * Gets a dword from the passed in memory block.
    5658 + * @param   iIndex      Byte offset into the array.
    5659 + * @param   sMem        Memory block.
    5660 + * @remark  note problems with signed!
    5661 + */
    5662 +memDword: procedure expose(sGlobals)
    5663 +parse arg iIndex, sMem
    5664 +    cb = memSize(sMem);
    5665 +    if (iIndex + 3 < cb) then
    5666 +    do
    5667 +        iIndex = iIndex*2 + 9;
    5668 +        return   x2d(substr(sMem, iIndex + 6, 2)||,
    5669 +                     substr(sMem, iIndex + 4, 2)||,
    5670 +                     substr(sMem, iIndex + 2, 2)||,
    5671 +                     substr(sMem, iIndex + 0, 2));
    5672 +    end
    5673 +    say 'error-memDword: access out of range. cb='cb ' iIndex='iIndex;
    5674 +return -1;
    5675 +
    5676 +
    5677 +/**
    5678 + * Gets a string from the memory array aMem.
    5679 + * @return  String.
    5680 + * @param   iIndex          Byte offset into the array aMem.
    5681 + * @param   cchLength       Length of the string. (optional)
    5682 + *                          If not specified we'll stop at '\0' or end of aMem.
    5683 + * @param   fStoppAtNull    Flag that we'll stop at '\0' even when lenght is specifed. (optional)
    5684 + *                          Default is to fetch cchLength if cchLength is specifed.
    5685 + */
    5686 +memString: procedure expose(sGlobals)
    5687 +parse arg iIndex, cchLength, fStoppAtNull, sMem
    5688 +    cb = memSize(sMem);
    5689 +    if (iIndex < cb) then
    5690 +    do
    5691 +        /* handle optional parameters */
    5692 +        if (fStoppAtNull = '') then
    5693 +            fStoppAtNull = (cchLength = '');
    5694 +        if (cchLength = '') then
    5695 +            cchLength = cb - iIndex;
    5696 +        else if (cchLength + iIndex > cb) then
    5697 +            cchLength = cb - iIndex;
    5698 +
    5699 +        /* fetch string */
    5700 +        sStr = '';
    5701 +        i = iIndex;
    5702 +        do  i = iIndex to iIndex + cchLength
    5703 +            ch = substr(sMem, i*2 + 9, 2);
    5704 +            if (fStoppAtNull) then
    5705 +                if (ch = '00') then
    5706 +                    leave;
    5707 +            sStr = sStr||x2c(ch);
    5708 +        end
    5709 +        return sStr;
    5710 +    end
    5711 +    say 'error-memWord: access out of range. cb='cb ' cbLength='cbLength;
    5712 +return '';
    5713 +
    5714 +
    5715 +/**
    5716 + * Dumps a byte range of the given memory to screen.
    5717 + * @return  0 on success. -1 on failure.
    5718 + * @paran   iIndex      Index into the memory block.
    5719 + * @paran   cbLength    Length to dump.
    5720 + * @paran   sMem        Memory block.
    5721 + */
    5722 +memDumpByte: procedure expose(sGlobals)
    5723 +parse arg iIndex, cbLength, sMem
    5724 +    cb = memSize(sMem);
    5725 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    5726 +    do
    5727 +        iOff = 0;
    5728 +        do while (cbLength > 0)
    5729 +            i = 0;
    5730 +            sLine = '0000:'||d2x(iOff,8);
    5731 +            do i = 0 to 15
    5732 +                if (cbLength - i > 0) then
    5733 +                do
    5734 +                    if (i = 8) then
    5735 +                        sLine = sLine || '-' || d2x(memByte(i + iOff, sMem),2);
    5736 +                    else
    5737 +                        sLine = sLine || ' ' || d2x(memByte(i + iOff, sMem),2);
    5738 +                end
    5739 +                else
    5740 +                    sLine = sLine || '   ';
    5741 +            end
    5742 +            sLine = sLine || ' ';
    5743 +            do i = 0 to 15
    5744 +                if (cbLength - i <= 0) then
    5745 +                    leave;
    5746 +                iCh = memByte(i + iOff, sMem);
    5747 +                if (iCh >= 32) then
    5748 +                    sLine = sLine || d2c(iCh);
    5749 +                else
    5750 +                    sLine = sLine || '.';
    5751 +            end
    5752 +            say sLine
    5753 +            iOff = iOff + 16;
    5754 +            cbLength = cbLength - 16;
    5755 +        end
    5756 +
    5757 +        return 0;
    5758 +    end
    5759 +    say 'error-memDumpByte: access out of range. cb='cb 'iIndex='iIndex 'cbLength='cbLength;
    5760 +return -1;
    5761 +
    5762 +
    5763 +/**
    5764 + * Dumps a word range of the given memory to screen.
    5765 + * @return  0 on success. -1 on failure.
    5766 + * @paran   iIndex      Index into the memory block.
    5767 + * @paran   cbLength    Length to dump.
    5768 + * @paran   sMem        Memory block.
    5769 + */
    5770 +memDumpWord: procedure expose(sGlobals)
    5771 +parse arg iIndex, cbLength, sMem
    5772 +    cb = memSize(sMem);
    5773 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    5774 +    do
    5775 +        iOff = 0;
    5776 +        do while (cbLength > 0)
    5777 +            i = 0;
    5778 +            sLine = '0000:'||d2x(iOff,8)||' ';
    5779 +            do i = 0 to 7
    5780 +                if (cbLength - i > 0) then
    5781 +                    sLine = sLine || ' ' || d2x(memWord(i*2 + iOff, sMem),4);
    5782 +                else
    5783 +                    sLine = sLine || '   ';
    5784 +            end
    5785 +
    5786 +            say sLine
    5787 +            iOff = iOff + 16;
    5788 +            cbLength = cbLength - 16;
    5789 +        end
    5790 +
    5791 +        return 0;
    5792 +    end
    5793 +    say 'error-memDumpWord: access out of range. cb='cb ' cbLength='cbLength;
    5794 +return -1;
    5795 +
    5796 +
    5797 +/**
    5798 + * Dumps a dword range of the given memory to screen.
    5799 + * @return  0 on success. -1 on failure.
    5800 + * @paran   iIndex      Index into the memory block.
    5801 + * @paran   cbLength    Length to dump.
    5802 + * @paran   sMem        Memory block.
    5803 + */
    5804 +memDumpDword: procedure expose(sGlobals)
    5805 +parse arg iIndex, cbLength, sMem
    5806 +    cb = memSize(sMem);
    5807 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    5808 +    do
    5809 +        iOff = 0;
    5810 +        do while (cbLength > 0)
    5811 +            i = 0;
    5812 +            sLine = '0000:'||d2x(iOff, 8)||' ';
    5813 +            do i = 0 to 3
    5814 +                if (cbLength - i > 0) then
    5815 +                    sLine = sLine || ' ' || d2x(memDWord(i*4 + iOff, sMem),8);
    5816 +                else
    5817 +                    sLine = sLine || '   ';
    5818 +            end
    5819 +
    5820 +            say sLine
    5821 +            iOff = iOff + 16;
    5822 +            cbLength = cbLength - 16;
    5823 +        end
    5824 +
    5825 +        return 0;
    5826 +    end
    5827 +    say 'error-memDumpDword: access out of range. cb='cb ' cbLength='cbLength;
    5828 +return -1;
    5829 +
    5830 +
    5831 +/**
    5832 + * Copies a portion of a memory block.
    5833 + * @param   iIndex      Index into the memory block.
    5834 + * @param   cbLength    Bytes to copy.
    5835 + * @param   sMem        Source block.
    5836 + */
    5837 +memCopy: procedure expose(sGlobals)
    5838 +parse arg iIndex, cbLength, sMem
    5839 +    cb = memSize(sMem);
    5840 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    5841 +    do
    5842 +        sCopy = d2x(cbLength,8)||substr(sMem, 9 + iIndex * 2, cbLength * 2);
    5843 +        return sCopy
    5844 +    end
    5845 +    say 'error-memCopy: access out of range. cb='cb ' cbLength='cbLength;
    5846 +return -1;
    5847 +
    5848 +
    5849 +/**
    5850 + * Gets the size of a memory block.
    5851 + * @param   sMem    The memory block in question.
    5852 + */
    5853 +memSize: procedure expose(sGlobals)
    5854 +parse arg sMem
    5855 +/* debug assertions - start - comment out when stable! */
    5856 +if (length(sMem) - 8 <> x2d(left(sMem, 8)) * 2) then
    5857 +do
    5858 +    say 'fatal assert: memSize got a bad memoryblock'
    5859 +    say '              length(sMem) =' length(sMem);
    5860 +    say '              cb = ' x2d(left(sMem,8));
    5861 +    exit(16);
    5862 +end
    5863 +/* debug assertions -  end  - comment out when stable! */
    5864 +return x2d(left(sMem,8));
    5865 +
    5866 +
    5867 +
    5868 +/**
    5869 + * Dump all processes. (debug more or less)
    5870 + */
    5871 +procDumpAll: procedure expose(sGlobals)
    5872 +    say 'Processes:'
    5873 +    do i = 1 to aProc.0
    5874 +        say 'slot='aProc.i.hxSlot 'pid='aProc.i.hxPid 'blkid='aProc.i.hxBlockId 'name='aProc.i.sName
    5875 +    end
    5876 +return 0;
    5877 +
    5878 +
    5879 +/**
    5880 + * Searches thru the process list looking for a process
    5881 + * by it's pid and tid.
    5882 + * @returns Index of the process.
    5883 + * @param   pid     Process Id. (Decimal value)
    5884 + * @param   tid     Thread Id. (Decimal value)
    5885 + */
    5886 +procFindByPidTid: procedure expose(sGlobals)
    5887 +parse arg pid, tid
    5888 +    do i = 1 to aProc.0
    5889 +        if (x2d(aProc.i.hxPid) = pid & x2d(aProc.i.hxTid) = tid) then
    5890 +            return i;
    5891 +    end
    5892 +return 0;
    5893 +
    5894 +
    5895 +/**
    5896 + * Searches thru the process list looking for a process
    5897 + * by it's slot number.
    5898 + * @returns Index of the process.
    5899 + * @param   iSlot   Thread slot number. (Decimal value)
    5900 + */
    5901 +procFindByPidTid: procedure expose(sGlobals)
    5902 +parse arg iSlot
    5903 +    do i = 1 to aProc.0
    5904 +        if (x2d(aProc.i.hxSlot) = iSlot) then
    5905 +            return i;
    5906 +    end
    5907 +return 0;
    5908 +
    5909 +
    5910 +/**
    5911 + * Novaluehandler.
    5912 + */
    5913 +SignalHanlder_NoValue:
    5914 +    say 'fatal error: novalue signal SIGL='SIGL;
    5915 +exit(16);
    5916 +
    5917 +
    5918 +/**
    5919 + * Lowercases a string.
    5920 + * @param   sString     String to fold down.
    5921 + * @returns Lowercase version of sString.
    5922 + */
    5923 +lowercase: procedure expose(sGlobals)
    5924 +parse arg sString
    5925 +return translate(sString,,
    5926 +                 'abcdefghijklmnopqrstuvwxyz',,
    5927 +                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    5928 +
    5929 diff --git a/src/win32k/kKrnlLib/tools/pmdfrexx/stack.cmd b/src/win32k/kKrnlLib/tools/pmdfrexx/stack.cmd
    5930 index abb65f0..a3f8951 100644
    5931 --- a/src/win32k/kKrnlLib/tools/pmdfrexx/stack.cmd
    5932 +++ b/src/win32k/kKrnlLib/tools/pmdfrexx/stack.cmd
    5933 @@ -1,729 +1,729 @@
    5934 -/**/
    5935 -
    5936 -
    5937 -/*
    5938 - * Init stuff.
    5939 - */
    5940 -signal on NoValue Name SignalHanlder_NoValue;
    5941 -NUMERIC DIGITS 11
    5942 -
    5943 -
    5944 -/*
    5945 - * Globals
    5946 - */
    5947 -sGlobals = 'ulShSemTbl aProc. sGlobals';
    5948 -ulShSemTbl = 0;
    5949 -aProc.0 = 0;                            /* process table */
    5950 -
    5951 -
    5952 -/*
    5953 - * Args
    5954 - */
    5955 -parse arg sCmd sArgs
    5956 -sCmd = lowercase(sCmd);
    5957 -sArg = lowercase(sArgs);
    5958 -say '';
    5959 -
    5960 -
    5961 -/*
    5962 - * Operation
    5963 - */
    5964 -select
    5965 -    /*
    5966 -     *
    5967 -     */
    5968 -    when (sCmd = 'unwind') then
    5969 -        return Unwind(sArgs);
    5970 -
    5971 -
    5972 -    /*
    5973 -     * Generic dump
    5974 -     */
    5975 -    when (sCmd = 'dump' | sCmd = '.d') then
    5976 -    do
    5977 -        parse var sArgs sStruct sDumperArgs
    5978 -        select
    5979 -
    5980 -            otherwise
    5981 -                say 'syntax error: no or invalid structure name.';
    5982 -        return syntax(sArgs);
    5983 -        end
    5984 -    end
    5985 -
    5986 -
    5987 -    /*
    5988 -     * Help and syntax error.
    5989 -     */
    5990 -    when (sCmd = '?' | sCmd = 'help' | sCmd = '-?' | sCmd = '/?' | sCmd = '-h' | sCmd = '/h' | sCmd = '--help') then
    5991 -        return syntax(sArgs);
    5992 -    otherwise
    5993 -        say 'syntax error: no or invalid command'
    5994 -        return syntax(sArgs);
    5995 -    end
    5996 -exit(0)
    5997 -
    5998 -/**
    5999 - * Display usage syntax:
    6000 - */
    6001 -syntax: procedure;
    6002 -    parse source . . sSource;
    6003 -    sName = filespec('name', sSource);
    6004 -    say 'PMDF Stack Rexx Utils v0.0.1';
    6005 -    say 'syntax: %'sName' <command> [args]';
    6006 -    say 'command:'
    6007 -return -1;
    6008 -
    6009 -/* Procedure which we signals on user syntax errors. */
    6010 -synatxerror:
    6011 -    say 'syntax error!'
    6012 -    call syntax;
    6013 -return -1;
    6014 -
    6015 -/**
    6016 - * Unwinds a stack from a given ebp value.
    6017 - * @param   hxEBP    EBP hex value.
    6018 - * @param   hxSS     SS hex value or blank for flat stack.
    6019 - * @remark  doesn't work on 16bit stacks.
    6020 - */
    6021 -Unwind: procedure expose(sGlobals)
    6022 -parse arg hxEBP hxSS dummy
    6023 -    cbWordSize = 4;
    6024 -
    6025 -    do while (hxEBP > 0)
    6026 -        /* try read stack frame */
    6027 -        if (hxSS <> '') then
    6028 -            sAddr = hxSS':'hxEBP;
    6029 -        else
    6030 -            sAddr = '%'hxEBP;
    6031 -        cbMem = cbWordSize*6;
    6032 -        sMem = dfReadMem(sAddr, cbMem);
    6033 -        do while (sMem = '' & cbMem > cbWordSize * 2)
    6034 -            cbMem = cbMem - cbWordSize;
    6035 -            sMem = dfReadMem(sAddr, cbMem);
    6036 -        end
    6037 -        if (sMem = '') then
    6038 -            leave
    6039 -
    6040 -        /* display stackframe */
    6041 -        if (cbWordSize = 4) then
    6042 -            iEIP = memDword(cbWordSize, sMem);
    6043 -        else
    6044 -            iEIP = memWord(cbWordSize, sMem);
    6045 -        sLine = 'ret='d2x(iEIP, cbWordSize * 2)' ';
    6046 -
    6047 -        if (cbWordSize = 4) then
    6048 -            iEBP = memDword(0, sMem);
    6049 -        else
    6050 -            iEBP = memWord(0, sMem);
    6051 -        sLine = sLine || 'nextebp='d2x(iEBP, cbWordSize * 2)' ';
    6052 -
    6053 -        do i = 2 to memSize(sMem) / cbWordSize - 1
    6054 -            if (cbWordSize = 4) then
    6055 -                iParm = memDword(cbWordSize * i, sMem);
    6056 -            else
    6057 -                iParm = memWord(cbWordSize * i, sMem);
    6058 -            sLine = sLine || ' ' || d2x(iParm, cbWordSize*2);
    6059 -        end
    6060 -        sSymbol = dfNear('%'d2x(iEIP));
    6061 -        if (sSymbol <> '') then
    6062 -            sLine = sLine || ' ' || sSymbol;
    6063 -        say sLine;
    6064 -
    6065 -        /*
    6066 -         * Next
    6067 -         */
    6068 -        if (iEBP <= 0) then
    6069 -            leave;
    6070 -        hxEBP = d2x(iEBP,cbWordSize*2);
    6071 -    end
    6072 -
    6073 -    say '*end of stack*'
    6074 -return 0;
    6075 -
    6076 -
    6077 -
    6078 -/*
    6079 - * PMDF WORKERS - COMMON COMMON COMMON
    6080 - * PMDF WORKERS - COMMON COMMON COMMON
    6081 - * PMDF WORKERS - COMMON COMMON COMMON
    6082 - * PMDF WORKERS - COMMON COMMON COMMON
    6083 - * PMDF WORKERS - COMMON COMMON COMMON
    6084 - * PMDF WORKERS - COMMON COMMON COMMON
    6085 - * PMDF WORKERS - COMMON COMMON COMMON
    6086 - * PMDF WORKERS - COMMON COMMON COMMON
    6087 - * PMDF WORKERS - COMMON COMMON COMMON
    6088 - * PMDF WORKERS - COMMON COMMON COMMON
    6089 - * PMDF WORKERS - COMMON COMMON COMMON
    6090 - * PMDF WORKERS - COMMON COMMON COMMON
    6091 - */
    6092 -
    6093 -
    6094 -
    6095 -/**
    6096 - * Read memory.
    6097 - * @param   sStartExpr  Expression giving the address where to read from.
    6098 - * @param   cbLength    Number of _bytes_ to read.
    6099 - * @returns The memory we have read. (internal format!)
    6100 - */
    6101 -dfReadMem: procedure expose(sGlobals)
    6102 -parse arg sStartExpr, cbLength
    6103 -
    6104 -    /* dump memory */
    6105 -    if ((cbLength // 4) = 0) then
    6106 -    do  /* optimized read */
    6107 -        /*say 'dbg-df: dd' sStartExpr 'L'cbLength/4'T'*/
    6108 -        Address df 'CMD' 'asOut' 'dd' sStartExpr 'L'cbLength/4'T'
    6109 -        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    6110 -        if (rc = 0) then
    6111 -        do
    6112 -            /* interpret output */
    6113 -            j = 0;
    6114 -            sMem = '';
    6115 -            do i = 1 to asOut.0
    6116 -                /* format:
    6117 -                 * 0000:00000000  45534D50 0000004D 00000000 00000000
    6118 -                 */
    6119 -                parse var asOut.i .'  'ch.0' 'ch.1' 'ch.2' 'ch.3
    6120 -                /*say 'dbg:' asOut.i
    6121 -                say 'dbg:' ch.0','ch.1','ch.2','ch.3*/
    6122 -                k = 0;
    6123 -                ch.4 = '';
    6124 -                do while(k <= 3 & strip(ch.k) <> '')
    6125 -                    sMem = sMem || substr(ch.k,7,2)||substr(ch.k,5,2)||substr(ch.k,3,2)||substr(ch.k,1,2);
    6126 -                    j = j + 4;
    6127 -                    k = k + 1;
    6128 -                end
    6129 -            end
    6130 -            if (j <> 0) then
    6131 -                return d2x(j,8)||sMem;
    6132 -        end
    6133 -
    6134 -    end
    6135 -    else
    6136 -    do  /* slower (more output) byte by byte read */
    6137 -        /*say 'dbg-df: db' sStartExpr 'L'cbLength'T'*/
    6138 -        Address df 'CMD' 'asOut' 'db' sStartExpr 'L'cbLength'T'
    6139 -        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    6140 -        if (rc = 0) then
    6141 -        do
    6142 -            /* interpret output */
    6143 -            j = 0;
    6144 -            sMem = '';
    6145 -            do i = 1 to asOut.0
    6146 -                /* format:
    6147 -                 * 9f47:0000af00 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM...........
    6148 -                 */
    6149 -                ch.16 = '';
    6150 -                parse var asOut.i .' 'ch.0' 'ch.1' 'ch.2' 'ch.3' 'ch.4' 'ch.5' 'ch.6' 'ch.7'-'ch.8' 'ch.9' 'ch.10' 'ch.11' 'ch.12' 'ch.13' 'ch.14' 'ch.15' '.
    6151 -                k = 0;
    6152 -                /*say 'dbg:' asOut.i
    6153 -                say 'dbg:' ch.0','ch.1','ch.2','ch.3','ch.4','ch.5','ch.6','ch.7','ch.8','ch.9','ch.10','ch.11','ch.12','ch.13','ch.14','ch.15*/
    6154 -                do while(k <= 15 & strip(ch.k) <> '')
    6155 -                    sMem = sMem || ch.k;
    6156 -                    j = j + 1;
    6157 -                    k = k + 1;
    6158 -                end
    6159 -            end
    6160 -            if (j <> 0) then
    6161 -                return d2x(j,8)||sMem;
    6162 -        end
    6163 -    end
    6164 -return '';
    6165 -
    6166 -
    6167 -/**
    6168 - * Reads a DWord at a given address.
    6169 - * @param   sAddr   Address expression.
    6170 - * @return  The value of the dword at given address.
    6171 - *          -1 on error.
    6172 - */
    6173 -dfReadByte: procedure expose(sGlobals)
    6174 -parse arg sAddr
    6175 -    sMem = dfReadMem(sAddr, 4);
    6176 -    if (sMem <> '') then
    6177 -        return memByte(0, sMem);
    6178 -return -1;
    6179 -
    6180 -
    6181 -/**
    6182 - * Reads a Word at a given address.
    6183 - * @param   sAddr   Address expression.
    6184 - * @return  The value of the dword at given address.
    6185 - *          -1 on error.
    6186 - */
    6187 -dfReadWord: procedure expose(sGlobals)
    6188 -parse arg sAddr
    6189 -    sMem = dfReadMem(sAddr, W);
    6190 -    if (sMem <> '') then
    6191 -        return memWord(0, sMem);
    6192 -return -1;
    6193 -
    6194 -
    6195 -/**
    6196 - * Reads a DWord at a given address.
    6197 - * @param   sAddr   Address expression.
    6198 - * @return  The value of the dword at given address.
    6199 - *          -1 on error.
    6200 - */
    6201 -dfReadDword: procedure expose(sGlobals)
    6202 -parse arg sAddr
    6203 -    sMem = dfReadMem(sAddr, 4);
    6204 -    if (sMem <> '') then
    6205 -        return memDword(0, sMem);
    6206 -return -1;
    6207 -
    6208 -
    6209 -/**
    6210 - * Get near symbol.
    6211 - * @param   sAddr   Address expression.
    6212 - * @return  Near output.
    6213 - *          '' on error.
    6214 - */
    6215 -dfNear: procedure expose(sGlobals)
    6216 -parse arg sAddr
    6217 -    Address df 'CMD' 'asOut' 'ln' sAddr
    6218 -    if (rc = 0 & asOut.0 > 0) then
    6219 -    do
    6220 -        if (pos('symbols found', asOut.1) <= 0) then
    6221 -        do
    6222 -            parse var asOut.1 .' 'sRet;
    6223 -            return strip(sRet);
    6224 -        end
    6225 -    end
    6226 -return '';
    6227 -
    6228 -
    6229 -/**
    6230 - * Read all processes into global variable.
    6231 - */
    6232 -dfProcessReadAll: procedure expose(sGlobals)
    6233 -parse arg fBlockInfo
    6234 -    if (\fBlockInfo) then
    6235 -    do
    6236 -        say '[reading processes]'
    6237 -        Address df 'CMD' 'asOut' '.p';
    6238 -        say '[done]'
    6239 -        if (rc = 0 & asOut.0 > 0) then
    6240 -        do
    6241 -            j = 0;
    6242 -            do i = 1 to asOut.0
    6243 -                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    6244 -                    iterate;
    6245 -                /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    6246 -                 *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    6247 -                 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    6248 -                 */
    6249 -                j = j + 1;
    6250 -                aProc.j.sType = '0';
    6251 -                aProc.j.hxBlockId = '0';
    6252 -                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    6253 -                parse var asOut.i aProc.j.hxSlot,
    6254 -                                  aProc.j.hxPid,
    6255 -                                  aProc.j.hxPPid,
    6256 -                                  aProc.j.hxCsid,
    6257 -                                  aProc.j.hxOrd,
    6258 -                                  aProc.j.sState,
    6259 -                                  aProc.j.hxPri,
    6260 -                                  aProc.j.hxpTSD,
    6261 -                                  aProc.j.hxpPTDA,
    6262 -                                  aProc.j.hxpPCB,
    6263 -                                  aProc.j.hxDisp,
    6264 -                                  aProc.j.hxSG,
    6265 -                                  aProc.j.sName;
    6266 -                if (strip(aProc.j.hxSlot) = '') then
    6267 -                    j = j - 1;
    6268 -            end
    6269 -            aProc.0 = j;
    6270 -        end
    6271 -    end
    6272 -    else
    6273 -    do
    6274 -        say '[reading processes]'
    6275 -        Address df 'CMD' 'asOut' '.pb';
    6276 -        say '[done]'
    6277 -        if (rc = 0 & asOut.0 > 0) then
    6278 -        do
    6279 -            j = 0;
    6280 -            do i = 1 to asOut.0
    6281 -                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    6282 -                    iterate;
    6283 -                /*  0044  blk fd436cf8 4os2     Sem32     8001 005d hevResultCodeSet
    6284 -                 * *000b# blk fd436190 pmshell
    6285 -                 *  0073  blk 0b008cbe msrv     SysSem
    6286 -                 */
    6287 -                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    6288 -                j = j + 1;
    6289 -                aProc.j.hxPid = '0';
    6290 -                aProc.j.hxPPid = '0';
    6291 -                aProc.j.hxCsid = '0';
    6292 -                aProc.j.hxOrd = '0';
    6293 -                aProc.j.hxPri = '0';
    6294 -                aProc.j.hxpTSD = '0';
    6295 -                aProc.j.hxpPTDA = '0';
    6296 -                aProc.j.hxpPCB = '0';
    6297 -                aProc.j.hxDisp = '0';
    6298 -                aProc.j.hxSG = '0';
    6299 -                parse var asOut.i aProc.j.hxSlot,
    6300 -                                  aProc.j.sState,
    6301 -                                  aProc.j.hxBlockId,
    6302 -                                  aProc.j.sName,
    6303 -                                  aProc.j.sType .;
    6304 -                if (strip(aProc.j.hxSlot) = '') then
    6305 -                    j = j - 1;
    6306 -            end
    6307 -            aProc.0 = j;
    6308 -        end
    6309 -    end
    6310 -return -1;
    6311 -
    6312 -
    6313 -/**
    6314 - * Gets the blockId of a process from the dumpformatter.
    6315 - * @param   iSlot   The slot to query.
    6316 - * @returns Block id (hex string).
    6317 - *          '0' if failure.
    6318 - */
    6319 -dfProcessBlockId: procedure expose(sGlobals)
    6320 -parse arg iSlot
    6321 -    Address df 'CMD' 'asOut' '.pb' iSlot;
    6322 -    if (rc = 0 & asOut.0 > 0) then
    6323 -    do
    6324 -        /* *000b# blk fd436190 pmshell */
    6325 -        asOut.2 = strip(asOut.2);
    6326 -        parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName
    6327 -        sBlockId = strip(sBlockId)      /* needed??? */
    6328 -        if (sBlockId <> '') then
    6329 -            return sBlockId;
    6330 -    end
    6331 -return '0';
    6332 -
    6333 -
    6334 -/**
    6335 - * Gets the PTDA of a process.
    6336 - * @param   sSlot   Slot or special chars '*' and '#'.
    6337 - * @return  Hex pointer to the PTDA.
    6338 - */
    6339 -dfProcPTDA: procedure expose(sGlobals)
    6340 -parse arg iSlot
    6341 -    Address df 'CMD' 'asOut' '.p' iSlot;
    6342 -    if (rc = 0 & asOut.0 > 0) then
    6343 -    do
    6344 -        /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    6345 -         *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    6346 -         * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    6347 -         */
    6348 -        i = 2;
    6349 -        asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    6350 -        parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .;
    6351 -        hxPTDA = strip(hxPTDA)      /* needed??? */
    6352 -        if (hxPTDA <> '') then
    6353 -            return hxPTDA;
    6354 -    end
    6355 -return '0';
    6356 -
    6357 -
    6358 -/**
    6359 - * Gets a byte from the memory array aMem.
    6360 - * @param   iIndex      Byte offset into the array.
    6361 - */
    6362 -memByte: procedure expose(sGlobals)
    6363 -parse arg iIndex, sMem
    6364 -    cb = memSize(sMem);
    6365 -    if (iIndex < cb) then
    6366 -    do
    6367 -        return x2d(substr(sMem, (iIndex * 2) + 9 + 0, 2));
    6368 -    end
    6369 -    say 'error-memByte: access out of range. cb='cb ' iIndex='iIndex;
    6370 -return -1;
    6371 -
    6372 -
    6373 -/**
    6374 - * Gets a word from the memory array aMem.
    6375 - * @param   iIndex      Byte offset into the array.
    6376 - */
    6377 -memWord: procedure expose(sGlobals)
    6378 -parse arg iIndex, sMem
    6379 -    cb = memSize(sMem);
    6380 -    if (iIndex + 1 < cb) then
    6381 -    do
    6382 -        return x2d(substr(sMem, (iIndex * 2) + 9 + 2, 2)||,
    6383 -                   substr(sMem, (iIndex * 2) + 9 + 0, 2));
    6384 -    end
    6385 -    say 'error-memWord: access out of range. cb='cb ' iIndex='iIndex;
    6386 -return -1;
    6387 -
    6388 -
    6389 -/**
    6390 - * Gets a dword from the passed in memory block.
    6391 - * @param   iIndex      Byte offset into the array.
    6392 - * @param   sMem        Memory block.
    6393 - * @remark  note problems with signed!
    6394 - */
    6395 -memDword: procedure expose(sGlobals)
    6396 -parse arg iIndex, sMem
    6397 -    cb = memSize(sMem);
    6398 -    if (iIndex + 3 < cb) then
    6399 -    do
    6400 -        iIndex = iIndex*2 + 9;
    6401 -        return   x2d(substr(sMem, iIndex + 6, 2)||,
    6402 -                     substr(sMem, iIndex + 4, 2)||,
    6403 -                     substr(sMem, iIndex + 2, 2)||,
    6404 -                     substr(sMem, iIndex + 0, 2));
    6405 -    end
    6406 -    say 'error-memDword: access out of range. cb='cb ' iIndex='iIndex;
    6407 -return -1;
    6408 -
    6409 -
    6410 -/**
    6411 - * Gets a string from the memory array aMem.
    6412 - * @return  String.
    6413 - * @param   iIndex          Byte offset into the array aMem.
    6414 - * @param   cchLength       Length of the string. (optional)
    6415 - *                          If not specified we'll stop at '\0' or end of aMem.
    6416 - * @param   fStoppAtNull    Flag that we'll stop at '\0' even when lenght is specifed. (optional)
    6417 - *                          Default is to fetch cchLength if cchLength is specifed.
    6418 - */
    6419 -memString: procedure expose(sGlobals)
    6420 -parse arg iIndex, cchLength, fStoppAtNull, sMem
    6421 -    cb = memSize(sMem);
    6422 -    if (iIndex < cb) then
    6423 -    do
    6424 -        /* handle optional parameters */
    6425 -        if (fStoppAtNull = '') then
    6426 -            fStoppAtNull = (cchLength = '');
    6427 -        if (cchLength = '') then
    6428 -            cchLength = cb - iIndex;
    6429 -        else if (cchLength + iIndex > cb) then
    6430 -            cchLength = cb - iIndex;
    6431 -
    6432 -        /* fetch string */
    6433 -        sStr = '';
    6434 -        i = iIndex;
    6435 -        do  i = iIndex to iIndex + cchLength
    6436 -            ch = substr(sMem, i*2 + 9, 2);
    6437 -            if (fStoppAtNull) then
    6438 -                if (ch = '00') then
    6439 -                    leave;
    6440 -            sStr = sStr||x2c(ch);
    6441 -        end
    6442 -        return sStr;
    6443 -    end
    6444 -    say 'error-memWord: access out of range. cb='cb ' cbLength='cbLength;
    6445 -return '';
    6446 -
    6447 -
    6448 -/**
    6449 - * Dumps a byte range of the given memory to screen.
    6450 - * @return  0 on success. -1 on failure.
    6451 - * @paran   iIndex      Index into the memory block.
    6452 - * @paran   cbLength    Length to dump.
    6453 - * @paran   sMem        Memory block.
    6454 - */
    6455 -memDumpByte: procedure expose(sGlobals)
    6456 -parse arg iIndex, cbLength, sMem
    6457 -    cb = memSize(sMem);
    6458 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    6459 -    do
    6460 -        iOff = 0;
    6461 -        do while (cbLength > 0)
    6462 -            i = 0;
    6463 -            sLine = '0000:'||d2x(iOff,8);
    6464 -            do i = 0 to 15
    6465 -                if (cbLength - i > 0) then
    6466 -                do
    6467 -                    if (i = 8) then
    6468 -                        sLine = sLine || '-' || d2x(memByte(i + iOff, sMem),2);
    6469 -                    else
    6470 -                        sLine = sLine || ' ' || d2x(memByte(i + iOff, sMem),2);
    6471 -                end
    6472 -                else
    6473 -                    sLine = sLine || '   ';
    6474 -            end
    6475 -            sLine = sLine || ' ';
    6476 -            do i = 0 to 15
    6477 -                if (cbLength - i <= 0) then
    6478 -                    leave;
    6479 -                iCh = memByte(i + iOff, sMem);
    6480 -                if (iCh >= 32) then
    6481 -                    sLine = sLine || d2c(iCh);
    6482 -                else
    6483 -                    sLine = sLine || '.';
    6484 -            end
    6485 -            say sLine
    6486 -            iOff = iOff + 16;
    6487 -            cbLength = cbLength - 16;
    6488 -        end
    6489 -
    6490 -        return 0;
    6491 -    end
    6492 -    say 'error-memDumpByte: access out of range. cb='cb 'iIndex='iIndex 'cbLength='cbLength;
    6493 -return -1;
    6494 -
    6495 -
    6496 -/**
    6497 - * Dumps a word range of the given memory to screen.
    6498 - * @return  0 on success. -1 on failure.
    6499 - * @paran   iIndex      Index into the memory block.
    6500 - * @paran   cbLength    Length to dump.
    6501 - * @paran   sMem        Memory block.
    6502 - */
    6503 -memDumpWord: procedure expose(sGlobals)
    6504 -parse arg iIndex, cbLength, sMem
    6505 -    cb = memSize(sMem);
    6506 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    6507 -    do
    6508 -        iOff = 0;
    6509 -        do while (cbLength > 0)
    6510 -            i = 0;
    6511 -            sLine = '0000:'||d2x(iOff,8)||' ';
    6512 -            do i = 0 to 7
    6513 -                if (cbLength - i > 0) then
    6514 -                    sLine = sLine || ' ' || d2x(memWord(i*2 + iOff, sMem),4);
    6515 -                else
    6516 -                    sLine = sLine || '   ';
    6517 -            end
    6518 -
    6519 -            say sLine
    6520 -            iOff = iOff + 16;
    6521 -            cbLength = cbLength - 16;
    6522 -        end
    6523 -
    6524 -        return 0;
    6525 -    end
    6526 -    say 'error-memDumpWord: access out of range. cb='cb ' cbLength='cbLength;
    6527 -return -1;
    6528 -
    6529 -
    6530 -/**
    6531 - * Dumps a dword range of the given memory to screen.
    6532 - * @return  0 on success. -1 on failure.
    6533 - * @paran   iIndex      Index into the memory block.
    6534 - * @paran   cbLength    Length to dump.
    6535 - * @paran   sMem        Memory block.
    6536 - */
    6537 -memDumpDword: procedure expose(sGlobals)
    6538 -parse arg iIndex, cbLength, sMem
    6539 -    cb = memSize(sMem);
    6540 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    6541 -    do
    6542 -        iOff = 0;
    6543 -        do while (cbLength > 0)
    6544 -            i = 0;
    6545 -            sLine = '0000:'||d2x(iOff, 8)||' ';
    6546 -            do i = 0 to 3
    6547 -                if (cbLength - i > 0) then
    6548 -                    sLine = sLine || ' ' || d2x(memDWord(i*4 + iOff, sMem),8);
    6549 -                else
    6550 -                    sLine = sLine || '   ';
    6551 -            end
    6552 -
    6553 -            say sLine
    6554 -            iOff = iOff + 16;
    6555 -            cbLength = cbLength - 16;
    6556 -        end
    6557 -
    6558 -        return 0;
    6559 -    end
    6560 -    say 'error-memDumpDword: access out of range. cb='cb ' cbLength='cbLength;
    6561 -return -1;
    6562 -
    6563 -
    6564 -/**
    6565 - * Copies a portion of a memory block.
    6566 - * @param   iIndex      Index into the memory block.
    6567 - * @param   cbLength    Bytes to copy.
    6568 - * @param   sMem        Source block.
    6569 - */
    6570 -memCopy: procedure expose(sGlobals)
    6571 -parse arg iIndex, cbLength, sMem
    6572 -    cb = memSize(sMem);
    6573 -    if (iIndex < cb & iIndex + cbLength <= cb) then
    6574 -    do
    6575 -        sCopy = d2x(cbLength,8)||substr(sMem, 9 + iIndex * 2, cbLength * 2);
    6576 -        return sCopy
    6577 -    end
    6578 -    say 'error-memCopy: access out of range. cb='cb ' cbLength='cbLength;
    6579 -return -1;
    6580 -
    6581 -
    6582 -/**
    6583 - * Gets the size of a memory block.
    6584 - * @param   sMem    The memory block in question.
    6585 - */
    6586 -memSize: procedure expose(sGlobals)
    6587 -parse arg sMem
    6588 -/* debug assertions - start - comment out when stable! */
    6589 -if (length(sMem) - 8 <> x2d(left(sMem, 8)) * 2) then
    6590 -do
    6591 -    say 'fatal assert: memSize got a bad memoryblock'
    6592 -    say '              length(sMem) =' length(sMem);
    6593 -    say '              cb = ' x2d(left(sMem,8));
    6594 -    exit(16);
    6595 -end
    6596 -/* debug assertions -  end  - comment out when stable! */
    6597 -return x2d(left(sMem,8));
    6598 -
    6599 -
    6600 -
    6601 -/**
    6602 - * Dump all processes. (debug more or less)
    6603 - */
    6604 -procDumpAll: procedure expose(sGlobals)
    6605 -    say 'Processes:'
    6606 -    do i = 1 to aProc.0
    6607 -        say 'slot='aProc.i.hxSlot 'pid='aProc.i.hxPid 'blkid='aProc.i.hxBlockId 'name='aProc.i.sName
    6608 -    end
    6609 -return 0;
    6610 -
    6611 -
    6612 -/**
    6613 - * Searches thru the process list looking for a process
    6614 - * by it's pid and tid.
    6615 - * @returns Index of the process.
    6616 - * @param   pid     Process Id. (Decimal value)
    6617 - * @param   tid     Thread Id. (Decimal value)
    6618 - */
    6619 -procFindByPidTid: procedure expose(sGlobals)
    6620 -parse arg pid, tid
    6621 -    do i = 1 to aProc.0
    6622 -        if (x2d(aProc.i.hxPid) = pid & x2d(aProc.i.hxTid) = tid) then
    6623 -            return i;
    6624 -    end
    6625 -return 0;
    6626 -
    6627 -
    6628 -/**
    6629 - * Searches thru the process list looking for a process
    6630 - * by it's slot number.
    6631 - * @returns Index of the process.
    6632 - * @param   iSlot   Thread slot number. (Decimal value)
    6633 - */
    6634 -procFindByPidTid: procedure expose(sGlobals)
    6635 -parse arg iSlot
    6636 -    do i = 1 to aProc.0
    6637 -        if (x2d(aProc.i.hxSlot) = iSlot) then
    6638 -            return i;
    6639 -    end
    6640 -return 0;
    6641 -
    6642 -
    6643 -/**
    6644 - * Novaluehandler.
    6645 - */
    6646 -SignalHanlder_NoValue:
    6647 -    say 'fatal error: novalue signal SIGL='SIGL;
    6648 -exit(16);
    6649 -
    6650 -
    6651 -/**
    6652 - * Lowercases a string.
    6653 - * @param   sString     String to fold down.
    6654 - * @returns Lowercase version of sString.
    6655 - */
    6656 -lowercase: procedure expose(sGlobals)
    6657 -parse arg sString
    6658 -return translate(sString,,
    6659 -                 'abcdefghijklmnopqrstuvwxyz',,
    6660 -                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    6661 -
    6662 -
    6663 +/**/
    6664 +
    6665 +
    6666 +/*
    6667 + * Init stuff.
    6668 + */
    6669 +signal on NoValue Name SignalHanlder_NoValue;
    6670 +NUMERIC DIGITS 11
    6671 +
    6672 +
    6673 +/*
    6674 + * Globals
    6675 + */
    6676 +sGlobals = 'ulShSemTbl aProc. sGlobals';
    6677 +ulShSemTbl = 0;
    6678 +aProc.0 = 0;                            /* process table */
    6679 +
    6680 +
    6681 +/*
    6682 + * Args
    6683 + */
    6684 +parse arg sCmd sArgs
    6685 +sCmd = lowercase(sCmd);
    6686 +sArg = lowercase(sArgs);
    6687 +say '';
    6688 +
    6689 +
    6690 +/*
    6691 + * Operation
    6692 + */
    6693 +select
    6694 +    /*
    6695 +     *
    6696 +     */
    6697 +    when (sCmd = 'unwind') then
    6698 +        return Unwind(sArgs);
    6699 +
    6700 +
    6701 +    /*
    6702 +     * Generic dump
    6703 +     */
    6704 +    when (sCmd = 'dump' | sCmd = '.d') then
    6705 +    do
    6706 +        parse var sArgs sStruct sDumperArgs
    6707 +        select
    6708 +
    6709 +            otherwise
    6710 +                say 'syntax error: no or invalid structure name.';
    6711 +        return syntax(sArgs);
    6712 +        end
    6713 +    end
    6714 +
    6715 +
    6716 +    /*
    6717 +     * Help and syntax error.
    6718 +     */
    6719 +    when (sCmd = '?' | sCmd = 'help' | sCmd = '-?' | sCmd = '/?' | sCmd = '-h' | sCmd = '/h' | sCmd = '--help') then
    6720 +        return syntax(sArgs);
    6721 +    otherwise
    6722 +        say 'syntax error: no or invalid command'
    6723 +        return syntax(sArgs);
    6724 +    end
    6725 +exit(0)
    6726 +
    6727 +/**
    6728 + * Display usage syntax:
    6729 + */
    6730 +syntax: procedure;
    6731 +    parse source . . sSource;
    6732 +    sName = filespec('name', sSource);
    6733 +    say 'PMDF Stack Rexx Utils v0.0.1';
    6734 +    say 'syntax: %'sName' <command> [args]';
    6735 +    say 'command:'
    6736 +return -1;
    6737 +
    6738 +/* Procedure which we signals on user syntax errors. */
    6739 +synatxerror:
    6740 +    say 'syntax error!'
    6741 +    call syntax;
    6742 +return -1;
    6743 +
    6744 +/**
    6745 + * Unwinds a stack from a given ebp value.
    6746 + * @param   hxEBP    EBP hex value.
    6747 + * @param   hxSS     SS hex value or blank for flat stack.
    6748 + * @remark  doesn't work on 16bit stacks.
    6749 + */
    6750 +Unwind: procedure expose(sGlobals)
    6751 +parse arg hxEBP hxSS dummy
    6752 +    cbWordSize = 4;
    6753 +
    6754 +    do while (hxEBP > 0)
    6755 +        /* try read stack frame */
    6756 +        if (hxSS <> '') then
    6757 +            sAddr = hxSS':'hxEBP;
    6758 +        else
    6759 +            sAddr = '%'hxEBP;
    6760 +        cbMem = cbWordSize*6;
    6761 +        sMem = dfReadMem(sAddr, cbMem);
    6762 +        do while (sMem = '' & cbMem > cbWordSize * 2)
    6763 +            cbMem = cbMem - cbWordSize;
    6764 +            sMem = dfReadMem(sAddr, cbMem);
    6765 +        end
    6766 +        if (sMem = '') then
    6767 +            leave
    6768 +
    6769 +        /* display stackframe */
    6770 +        if (cbWordSize = 4) then
    6771 +            iEIP = memDword(cbWordSize, sMem);
    6772 +        else
    6773 +            iEIP = memWord(cbWordSize, sMem);
    6774 +        sLine = 'ret='d2x(iEIP, cbWordSize * 2)' ';
    6775 +
    6776 +        if (cbWordSize = 4) then
    6777 +            iEBP = memDword(0, sMem);
    6778 +        else
    6779 +            iEBP = memWord(0, sMem);
    6780 +        sLine = sLine || 'nextebp='d2x(iEBP, cbWordSize * 2)' ';
    6781 +
    6782 +        do i = 2 to memSize(sMem) / cbWordSize - 1
    6783 +            if (cbWordSize = 4) then
    6784 +                iParm = memDword(cbWordSize * i, sMem);
    6785 +            else
    6786 +                iParm = memWord(cbWordSize * i, sMem);
    6787 +            sLine = sLine || ' ' || d2x(iParm, cbWordSize*2);
    6788 +        end
    6789 +        sSymbol = dfNear('%'d2x(iEIP));
    6790 +        if (sSymbol <> '') then
    6791 +            sLine = sLine || ' ' || sSymbol;
    6792 +        say sLine;
    6793 +
    6794 +        /*
    6795 +         * Next
    6796 +         */
    6797 +        if (iEBP <= 0) then
    6798 +            leave;
    6799 +        hxEBP = d2x(iEBP,cbWordSize*2);
    6800 +    end
    6801 +
    6802 +    say '*end of stack*'
    6803 +return 0;
    6804 +
    6805 +
    6806 +
    6807 +/*
    6808 + * PMDF WORKERS - COMMON COMMON COMMON
    6809 + * PMDF WORKERS - COMMON COMMON COMMON
    6810 + * PMDF WORKERS - COMMON COMMON COMMON
    6811 + * PMDF WORKERS - COMMON COMMON COMMON
    6812 + * PMDF WORKERS - COMMON COMMON COMMON
    6813 + * PMDF WORKERS - COMMON COMMON COMMON
    6814 + * PMDF WORKERS - COMMON COMMON COMMON
    6815 + * PMDF WORKERS - COMMON COMMON COMMON
    6816 + * PMDF WORKERS - COMMON COMMON COMMON
    6817 + * PMDF WORKERS - COMMON COMMON COMMON
    6818 + * PMDF WORKERS - COMMON COMMON COMMON
    6819 + * PMDF WORKERS - COMMON COMMON COMMON
    6820 + */
    6821 +
    6822 +
    6823 +
    6824 +/**
    6825 + * Read memory.
    6826 + * @param   sStartExpr  Expression giving the address where to read from.
    6827 + * @param   cbLength    Number of _bytes_ to read.
    6828 + * @returns The memory we have read. (internal format!)
    6829 + */
    6830 +dfReadMem: procedure expose(sGlobals)
    6831 +parse arg sStartExpr, cbLength
    6832 +
    6833 +    /* dump memory */
    6834 +    if ((cbLength // 4) = 0) then
    6835 +    do  /* optimized read */
    6836 +        /*say 'dbg-df: dd' sStartExpr 'L'cbLength/4'T'*/
    6837 +        Address df 'CMD' 'asOut' 'dd' sStartExpr 'L'cbLength/4'T'
    6838 +        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    6839 +        if (rc = 0) then
    6840 +        do
    6841 +            /* interpret output */
    6842 +            j = 0;
    6843 +            sMem = '';
    6844 +            do i = 1 to asOut.0
    6845 +                /* format:
    6846 +                 * 0000:00000000  45534D50 0000004D 00000000 00000000
    6847 +                 */
    6848 +                parse var asOut.i .'  'ch.0' 'ch.1' 'ch.2' 'ch.3
    6849 +                /*say 'dbg:' asOut.i
    6850 +                say 'dbg:' ch.0','ch.1','ch.2','ch.3*/
    6851 +                k = 0;
    6852 +                ch.4 = '';
    6853 +                do while(k <= 3 & strip(ch.k) <> '')
    6854 +                    sMem = sMem || substr(ch.k,7,2)||substr(ch.k,5,2)||substr(ch.k,3,2)||substr(ch.k,1,2);
    6855 +                    j = j + 4;
    6856 +                    k = k + 1;
    6857 +                end
    6858 +            end
    6859 +            if (j <> 0) then
    6860 +                return d2x(j,8)||sMem;
    6861 +        end
    6862 +
    6863 +    end
    6864 +    else
    6865 +    do  /* slower (more output) byte by byte read */
    6866 +        /*say 'dbg-df: db' sStartExpr 'L'cbLength'T'*/
    6867 +        Address df 'CMD' 'asOut' 'db' sStartExpr 'L'cbLength'T'
    6868 +        /*say 'dbg-df: rc='rc' asOut.0='asOut.0;*/
    6869 +        if (rc = 0) then
    6870 +        do
    6871 +            /* interpret output */
    6872 +            j = 0;
    6873 +            sMem = '';
    6874 +            do i = 1 to asOut.0
    6875 +                /* format:
    6876 +                 * 9f47:0000af00 50 4d 53 45 4d 00 00 00-00 00 00 00 00 00 00 00 PMSEM...........
    6877 +                 */
    6878 +                ch.16 = '';
    6879 +                parse var asOut.i .' 'ch.0' 'ch.1' 'ch.2' 'ch.3' 'ch.4' 'ch.5' 'ch.6' 'ch.7'-'ch.8' 'ch.9' 'ch.10' 'ch.11' 'ch.12' 'ch.13' 'ch.14' 'ch.15' '.
    6880 +                k = 0;
    6881 +                /*say 'dbg:' asOut.i
    6882 +                say 'dbg:' ch.0','ch.1','ch.2','ch.3','ch.4','ch.5','ch.6','ch.7','ch.8','ch.9','ch.10','ch.11','ch.12','ch.13','ch.14','ch.15*/
    6883 +                do while(k <= 15 & strip(ch.k) <> '')
    6884 +                    sMem = sMem || ch.k;
    6885 +                    j = j + 1;
    6886 +                    k = k + 1;
    6887 +                end
    6888 +            end
    6889 +            if (j <> 0) then
    6890 +                return d2x(j,8)||sMem;
    6891 +        end
    6892 +    end
    6893 +return '';
    6894 +
    6895 +
    6896 +/**
    6897 + * Reads a DWord at a given address.
    6898 + * @param   sAddr   Address expression.
    6899 + * @return  The value of the dword at given address.
    6900 + *          -1 on error.
    6901 + */
    6902 +dfReadByte: procedure expose(sGlobals)
    6903 +parse arg sAddr
    6904 +    sMem = dfReadMem(sAddr, 4);
    6905 +    if (sMem <> '') then
    6906 +        return memByte(0, sMem);
    6907 +return -1;
    6908 +
    6909 +
    6910 +/**
    6911 + * Reads a Word at a given address.
    6912 + * @param   sAddr   Address expression.
    6913 + * @return  The value of the dword at given address.
    6914 + *          -1 on error.
    6915 + */
    6916 +dfReadWord: procedure expose(sGlobals)
    6917 +parse arg sAddr
    6918 +    sMem = dfReadMem(sAddr, W);
    6919 +    if (sMem <> '') then
    6920 +        return memWord(0, sMem);
    6921 +return -1;
    6922 +
    6923 +
    6924 +/**
    6925 + * Reads a DWord at a given address.
    6926 + * @param   sAddr   Address expression.
    6927 + * @return  The value of the dword at given address.
    6928 + *          -1 on error.
    6929 + */
    6930 +dfReadDword: procedure expose(sGlobals)
    6931 +parse arg sAddr
    6932 +    sMem = dfReadMem(sAddr, 4);
    6933 +    if (sMem <> '') then
    6934 +        return memDword(0, sMem);
    6935 +return -1;
    6936 +
    6937 +
    6938 +/**
    6939 + * Get near symbol.
    6940 + * @param   sAddr   Address expression.
    6941 + * @return  Near output.
    6942 + *          '' on error.
    6943 + */
    6944 +dfNear: procedure expose(sGlobals)
    6945 +parse arg sAddr
    6946 +    Address df 'CMD' 'asOut' 'ln' sAddr
    6947 +    if (rc = 0 & asOut.0 > 0) then
    6948 +    do
    6949 +        if (pos('symbols found', asOut.1) <= 0) then
    6950 +        do
    6951 +            parse var asOut.1 .' 'sRet;
    6952 +            return strip(sRet);
    6953 +        end
    6954 +    end
    6955 +return '';
    6956 +
    6957 +
    6958 +/**
    6959 + * Read all processes into global variable.
    6960 + */
    6961 +dfProcessReadAll: procedure expose(sGlobals)
    6962 +parse arg fBlockInfo
    6963 +    if (\fBlockInfo) then
    6964 +    do
    6965 +        say '[reading processes]'
    6966 +        Address df 'CMD' 'asOut' '.p';
    6967 +        say '[done]'
    6968 +        if (rc = 0 & asOut.0 > 0) then
    6969 +        do
    6970 +            j = 0;
    6971 +            do i = 1 to asOut.0
    6972 +                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    6973 +                    iterate;
    6974 +                /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    6975 +                 *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    6976 +                 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    6977 +                 */
    6978 +                j = j + 1;
    6979 +                aProc.j.sType = '0';
    6980 +                aProc.j.hxBlockId = '0';
    6981 +                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    6982 +                parse var asOut.i aProc.j.hxSlot,
    6983 +                                  aProc.j.hxPid,
    6984 +                                  aProc.j.hxPPid,
    6985 +                                  aProc.j.hxCsid,
    6986 +                                  aProc.j.hxOrd,
    6987 +                                  aProc.j.sState,
    6988 +                                  aProc.j.hxPri,
    6989 +                                  aProc.j.hxpTSD,
    6990 +                                  aProc.j.hxpPTDA,
    6991 +                                  aProc.j.hxpPCB,
    6992 +                                  aProc.j.hxDisp,
    6993 +                                  aProc.j.hxSG,
    6994 +                                  aProc.j.sName;
    6995 +                if (strip(aProc.j.hxSlot) = '') then
    6996 +                    j = j - 1;
    6997 +            end
    6998 +            aProc.0 = j;
    6999 +        end
    7000 +    end
    7001 +    else
    7002 +    do
    7003 +        say '[reading processes]'
    7004 +        Address df 'CMD' 'asOut' '.pb';
    7005 +        say '[done]'
    7006 +        if (rc = 0 & asOut.0 > 0) then
    7007 +        do
    7008 +            j = 0;
    7009 +            do i = 1 to asOut.0
    7010 +                if (word(asOut.i,1) = 'Slot' | strip(asOut.i) = '') then
    7011 +                    iterate;
    7012 +                /*  0044  blk fd436cf8 4os2     Sem32     8001 005d hevResultCodeSet
    7013 +                 * *000b# blk fd436190 pmshell
    7014 +                 *  0073  blk 0b008cbe msrv     SysSem
    7015 +                 */
    7016 +                asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    7017 +                j = j + 1;
    7018 +                aProc.j.hxPid = '0';
    7019 +                aProc.j.hxPPid = '0';
    7020 +                aProc.j.hxCsid = '0';
    7021 +                aProc.j.hxOrd = '0';
    7022 +                aProc.j.hxPri = '0';
    7023 +                aProc.j.hxpTSD = '0';
    7024 +                aProc.j.hxpPTDA = '0';
    7025 +                aProc.j.hxpPCB = '0';
    7026 +                aProc.j.hxDisp = '0';
    7027 +                aProc.j.hxSG = '0';
    7028 +                parse var asOut.i aProc.j.hxSlot,
    7029 +                                  aProc.j.sState,
    7030 +                                  aProc.j.hxBlockId,
    7031 +                                  aProc.j.sName,
    7032 +                                  aProc.j.sType .;
    7033 +                if (strip(aProc.j.hxSlot) = '') then
    7034 +                    j = j - 1;
    7035 +            end
    7036 +            aProc.0 = j;
    7037 +        end
    7038 +    end
    7039 +return -1;
    7040 +
    7041 +
    7042 +/**
    7043 + * Gets the blockId of a process from the dumpformatter.
    7044 + * @param   iSlot   The slot to query.
    7045 + * @returns Block id (hex string).
    7046 + *          '0' if failure.
    7047 + */
    7048 +dfProcessBlockId: procedure expose(sGlobals)
    7049 +parse arg iSlot
    7050 +    Address df 'CMD' 'asOut' '.pb' iSlot;
    7051 +    if (rc = 0 & asOut.0 > 0) then
    7052 +    do
    7053 +        /* *000b# blk fd436190 pmshell */
    7054 +        asOut.2 = strip(asOut.2);
    7055 +        parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName
    7056 +        sBlockId = strip(sBlockId)      /* needed??? */
    7057 +        if (sBlockId <> '') then
    7058 +            return sBlockId;
    7059 +    end
    7060 +return '0';
    7061 +
    7062 +
    7063 +/**
    7064 + * Gets the PTDA of a process.
    7065 + * @param   sSlot   Slot or special chars '*' and '#'.
    7066 + * @return  Hex pointer to the PTDA.
    7067 + */
    7068 +dfProcPTDA: procedure expose(sGlobals)
    7069 +parse arg iSlot
    7070 +    Address df 'CMD' 'asOut' '.p' iSlot;
    7071 +    if (rc = 0 & asOut.0 > 0) then
    7072 +    do
    7073 +        /*  0074  0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst
    7074 +         *  000a  0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem
    7075 +         * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell
    7076 +         */
    7077 +        i = 2;
    7078 +        asOut.i = translate(left(asOut.i, 10), '  ', '#*') || substr(asOut.i, 11);
    7079 +        parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .;
    7080 +        hxPTDA = strip(hxPTDA)      /* needed??? */
    7081 +        if (hxPTDA <> '') then
    7082 +            return hxPTDA;
    7083 +    end
    7084 +return '0';
    7085 +
    7086 +
    7087 +/**
    7088 + * Gets a byte from the memory array aMem.
    7089 + * @param   iIndex      Byte offset into the array.
    7090 + */
    7091 +memByte: procedure expose(sGlobals)
    7092 +parse arg iIndex, sMem
    7093 +    cb = memSize(sMem);
    7094 +    if (iIndex < cb) then
    7095 +    do
    7096 +        return x2d(substr(sMem, (iIndex * 2) + 9 + 0, 2));
    7097 +    end
    7098 +    say 'error-memByte: access out of range. cb='cb ' iIndex='iIndex;
    7099 +return -1;
    7100 +
    7101 +
    7102 +/**
    7103 + * Gets a word from the memory array aMem.
    7104 + * @param   iIndex      Byte offset into the array.
    7105 + */
    7106 +memWord: procedure expose(sGlobals)
    7107 +parse arg iIndex, sMem
    7108 +    cb = memSize(sMem);
    7109 +    if (iIndex + 1 < cb) then
    7110 +    do
    7111 +        return x2d(substr(sMem, (iIndex * 2) + 9 + 2, 2)||,
    7112 +                   substr(sMem, (iIndex * 2) + 9 + 0, 2));
    7113 +    end
    7114 +    say 'error-memWord: access out of range. cb='cb ' iIndex='iIndex;
    7115 +return -1;
    7116 +
    7117 +
    7118 +/**
    7119 + * Gets a dword from the passed in memory block.
    7120 + * @param   iIndex      Byte offset into the array.
    7121 + * @param   sMem        Memory block.
    7122 + * @remark  note problems with signed!
    7123 + */
    7124 +memDword: procedure expose(sGlobals)
    7125 +parse arg iIndex, sMem
    7126 +    cb = memSize(sMem);
    7127 +    if (iIndex + 3 < cb) then
    7128 +    do
    7129 +        iIndex = iIndex*2 + 9;
    7130 +        return   x2d(substr(sMem, iIndex + 6, 2)||,
    7131 +                     substr(sMem, iIndex + 4, 2)||,
    7132 +                     substr(sMem, iIndex + 2, 2)||,
    7133 +                     substr(sMem, iIndex + 0, 2));
    7134 +    end
    7135 +    say 'error-memDword: access out of range. cb='cb ' iIndex='iIndex;
    7136 +return -1;
    7137 +
    7138 +
    7139 +/**
    7140 + * Gets a string from the memory array aMem.
    7141 + * @return  String.
    7142 + * @param   iIndex          Byte offset into the array aMem.
    7143 + * @param   cchLength       Length of the string. (optional)
    7144 + *                          If not specified we'll stop at '\0' or end of aMem.
    7145 + * @param   fStoppAtNull    Flag that we'll stop at '\0' even when lenght is specifed. (optional)
    7146 + *                          Default is to fetch cchLength if cchLength is specifed.
    7147 + */
    7148 +memString: procedure expose(sGlobals)
    7149 +parse arg iIndex, cchLength, fStoppAtNull, sMem
    7150 +    cb = memSize(sMem);
    7151 +    if (iIndex < cb) then
    7152 +    do
    7153 +        /* handle optional parameters */
    7154 +        if (fStoppAtNull = '') then
    7155 +            fStoppAtNull = (cchLength = '');
    7156 +        if (cchLength = '') then
    7157 +            cchLength = cb - iIndex;
    7158 +        else if (cchLength + iIndex > cb) then
    7159 +            cchLength = cb - iIndex;
    7160 +
    7161 +        /* fetch string */
    7162 +        sStr = '';
    7163 +        i = iIndex;
    7164 +        do  i = iIndex to iIndex + cchLength
    7165 +            ch = substr(sMem, i*2 + 9, 2);
    7166 +            if (fStoppAtNull) then
    7167 +                if (ch = '00') then
    7168 +                    leave;
    7169 +            sStr = sStr||x2c(ch);
    7170 +        end
    7171 +        return sStr;
    7172 +    end
    7173 +    say 'error-memWord: access out of range. cb='cb ' cbLength='cbLength;
    7174 +return '';
    7175 +
    7176 +
    7177 +/**
    7178 + * Dumps a byte range of the given memory to screen.
    7179 + * @return  0 on success. -1 on failure.
    7180 + * @paran   iIndex      Index into the memory block.
    7181 + * @paran   cbLength    Length to dump.
    7182 + * @paran   sMem        Memory block.
    7183 + */
    7184 +memDumpByte: procedure expose(sGlobals)
    7185 +parse arg iIndex, cbLength, sMem
    7186 +    cb = memSize(sMem);
    7187 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    7188 +    do
    7189 +        iOff = 0;
    7190 +        do while (cbLength > 0)
    7191 +            i = 0;
    7192 +            sLine = '0000:'||d2x(iOff,8);
    7193 +            do i = 0 to 15
    7194 +                if (cbLength - i > 0) then
    7195 +                do
    7196 +                    if (i = 8) then
    7197 +                        sLine = sLine || '-' || d2x(memByte(i + iOff, sMem),2);
    7198 +                    else
    7199 +                        sLine = sLine || ' ' || d2x(memByte(i + iOff, sMem),2);
    7200 +                end
    7201 +                else
    7202 +                    sLine = sLine || '   ';
    7203 +            end
    7204 +            sLine = sLine || ' ';
    7205 +            do i = 0 to 15
    7206 +                if (cbLength - i <= 0) then
    7207 +                    leave;
    7208 +                iCh = memByte(i + iOff, sMem);
    7209 +                if (iCh >= 32) then
    7210 +                    sLine = sLine || d2c(iCh);
    7211 +                else
    7212 +                    sLine = sLine || '.';
    7213 +            end
    7214 +            say sLine
    7215 +            iOff = iOff + 16;
    7216 +            cbLength = cbLength - 16;
    7217 +        end
    7218 +
    7219 +        return 0;
    7220 +    end
    7221 +    say 'error-memDumpByte: access out of range. cb='cb 'iIndex='iIndex 'cbLength='cbLength;
    7222 +return -1;
    7223 +
    7224 +
    7225 +/**
    7226 + * Dumps a word range of the given memory to screen.
    7227 + * @return  0 on success. -1 on failure.
    7228 + * @paran   iIndex      Index into the memory block.
    7229 + * @paran   cbLength    Length to dump.
    7230 + * @paran   sMem        Memory block.
    7231 + */
    7232 +memDumpWord: procedure expose(sGlobals)
    7233 +parse arg iIndex, cbLength, sMem
    7234 +    cb = memSize(sMem);
    7235 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    7236 +    do
    7237 +        iOff = 0;
    7238 +        do while (cbLength > 0)
    7239 +            i = 0;
    7240 +            sLine = '0000:'||d2x(iOff,8)||' ';
    7241 +            do i = 0 to 7
    7242 +                if (cbLength - i > 0) then
    7243 +                    sLine = sLine || ' ' || d2x(memWord(i*2 + iOff, sMem),4);
    7244 +                else
    7245 +                    sLine = sLine || '   ';
    7246 +            end
    7247 +
    7248 +            say sLine
    7249 +            iOff = iOff + 16;
    7250 +            cbLength = cbLength - 16;
    7251 +        end
    7252 +
    7253 +        return 0;
    7254 +    end
    7255 +    say 'error-memDumpWord: access out of range. cb='cb ' cbLength='cbLength;
    7256 +return -1;
    7257 +
    7258 +
    7259 +/**
    7260 + * Dumps a dword range of the given memory to screen.
    7261 + * @return  0 on success. -1 on failure.
    7262 + * @paran   iIndex      Index into the memory block.
    7263 + * @paran   cbLength    Length to dump.
    7264 + * @paran   sMem        Memory block.
    7265 + */
    7266 +memDumpDword: procedure expose(sGlobals)
    7267 +parse arg iIndex, cbLength, sMem
    7268 +    cb = memSize(sMem);
    7269 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    7270 +    do
    7271 +        iOff = 0;
    7272 +        do while (cbLength > 0)
    7273 +            i = 0;
    7274 +            sLine = '0000:'||d2x(iOff, 8)||' ';
    7275 +            do i = 0 to 3
    7276 +                if (cbLength - i > 0) then
    7277 +                    sLine = sLine || ' ' || d2x(memDWord(i*4 + iOff, sMem),8);
    7278 +                else
    7279 +                    sLine = sLine || '   ';
    7280 +            end
    7281 +
    7282 +            say sLine
    7283 +            iOff = iOff + 16;
    7284 +            cbLength = cbLength - 16;
    7285 +        end
    7286 +
    7287 +        return 0;
    7288 +    end
    7289 +    say 'error-memDumpDword: access out of range. cb='cb ' cbLength='cbLength;
    7290 +return -1;
    7291 +
    7292 +
    7293 +/**
    7294 + * Copies a portion of a memory block.
    7295 + * @param   iIndex      Index into the memory block.
    7296 + * @param   cbLength    Bytes to copy.
    7297 + * @param   sMem        Source block.
    7298 + */
    7299 +memCopy: procedure expose(sGlobals)
    7300 +parse arg iIndex, cbLength, sMem
    7301 +    cb = memSize(sMem);
    7302 +    if (iIndex < cb & iIndex + cbLength <= cb) then
    7303 +    do
    7304 +        sCopy = d2x(cbLength,8)||substr(sMem, 9 + iIndex * 2, cbLength * 2);
    7305 +        return sCopy
    7306 +    end
    7307 +    say 'error-memCopy: access out of range. cb='cb ' cbLength='cbLength;
    7308 +return -1;
    7309 +
    7310 +
    7311 +/**
    7312 + * Gets the size of a memory block.
    7313 + * @param   sMem    The memory block in question.
    7314 + */
    7315 +memSize: procedure expose(sGlobals)
    7316 +parse arg sMem
    7317 +/* debug assertions - start - comment out when stable! */
    7318 +if (length(sMem) - 8 <> x2d(left(sMem, 8)) * 2) then
    7319 +do
    7320 +    say 'fatal assert: memSize got a bad memoryblock'
    7321 +    say '              length(sMem) =' length(sMem);
    7322 +    say '              cb = ' x2d(left(sMem,8));
    7323 +    exit(16);
    7324 +end
    7325 +/* debug assertions -  end  - comment out when stable! */
    7326 +return x2d(left(sMem,8));
    7327 +
    7328 +
    7329 +
    7330 +/**
    7331 + * Dump all processes. (debug more or less)
    7332 + */
    7333 +procDumpAll: procedure expose(sGlobals)
    7334 +    say 'Processes:'
    7335 +    do i = 1 to aProc.0
    7336 +        say 'slot='aProc.i.hxSlot 'pid='aProc.i.hxPid 'blkid='aProc.i.hxBlockId 'name='aProc.i.sName
    7337 +    end
    7338 +return 0;
    7339 +
    7340 +
    7341 +/**
    7342 + * Searches thru the process list looking for a process
    7343 + * by it's pid and tid.
    7344 + * @returns Index of the process.
    7345 + * @param   pid     Process Id. (Decimal value)
    7346 + * @param   tid     Thread Id. (Decimal value)
    7347 + */
    7348 +procFindByPidTid: procedure expose(sGlobals)
    7349 +parse arg pid, tid
    7350 +    do i = 1 to aProc.0
    7351 +        if (x2d(aProc.i.hxPid) = pid & x2d(aProc.i.hxTid) = tid) then
    7352 +            return i;
    7353 +    end
    7354 +return 0;
    7355 +
    7356 +
    7357 +/**
    7358 + * Searches thru the process list looking for a process
    7359 + * by it's slot number.
    7360 + * @returns Index of the process.
    7361 + * @param   iSlot   Thread slot number. (Decimal value)
    7362 + */
    7363 +procFindByPidTid: procedure expose(sGlobals)
    7364 +parse arg iSlot
    7365 +    do i = 1 to aProc.0
    7366 +        if (x2d(aProc.i.hxSlot) = iSlot) then
    7367 +            return i;
    7368 +    end
    7369 +return 0;
    7370 +
    7371 +
    7372 +/**
    7373 + * Novaluehandler.
    7374 + */
    7375 +SignalHanlder_NoValue:
    7376 +    say 'fatal error: novalue signal SIGL='SIGL;
    7377 +exit(16);
    7378 +
    7379 +
    7380 +/**
    7381 + * Lowercases a string.
    7382 + * @param   sString     String to fold down.
    7383 + * @returns Lowercase version of sString.
    7384 + */
    7385 +lowercase: procedure expose(sGlobals)
    7386 +parse arg sString
    7387 +return translate(sString,,
    7388 +                 'abcdefghijklmnopqrstuvwxyz',,
    7389 +                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    7390 +
    7391 +
    7392 diff --git a/src/win32k/lib/Makefile.kmk b/src/win32k/lib/Makefile.kmk
    7393 index 2815a5b..9606e4d 100644
    7394 --- a/src/win32k/lib/Makefile.kmk
    7395 +++ b/src/win32k/lib/Makefile.kmk
    7396 @@ -1,31 +1,31 @@
     434+               $(QUIET2)$(CP) $(def) $$@
     435+endif
     436+ifneq ($(obj_list),)
     437+               $(QUIET2)emxexp.exe \
     438+                    $(addsuffix $$(TOOL_GXX3OMF_COBJSUFF), \
     439+                                $(addprefix $$($(target)_0_OUTDIR)/,$(obj_list))) >> $$@
     440+endif
     441+ifeq ($(def_exp_debug),)
     442+ ifneq ($(do_def_exp)$(obj_list),)
     443+    $(target)_imp_SOURCES  = $$($(target)_imp_0_OUTDIR)/$(def_exp)
     444+    $(target)_imp_CLEAN   += $$($(target)_imp_0_OUTDIR)/$(def_exp)
     445+ else
     446+    $(target)_imp_SOURCES  = $(def)
     447+ endif
     448+else
     449+ ifneq ($(do_def_exp)$(obj_list),)
     450+    $(target)_imp_SOURCES.release  = $$($(target)_imp_0_OUTDIR)/$(def_exp)
     451+    $(target)_imp_CLEAN.release   += $$($(target)_imp_0_OUTDIR)/$(def_exp)
     452+    $$$$($(target)_imp_0_OUTDIR)/$(def_exp_debug): $(def_debug) \
     453+        $(addsuffix $$$$(TOOL_GXX3OMF_COBJSUFF), \
     454+                    $(addprefix $$$$($(target)_0_OUTDIR)/,$(obj_list))) \
     455+        $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
     456+               %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
     457+ifneq ($(do_def_exp),)
     458+               $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $(def_debug) $$@
     459+else
     460+               $(QUIET2)$(CP) $(def_debug) $$@
     461+endif
     462+ifneq ($(obj_list),)
     463+               $(QUIET2)emxexp.exe \
     464+                    $(addsuffix $$(TOOL_GXX3OMF_COBJSUFF), \
     465+                                $(addprefix $$($(target)_0_OUTDIR)/,$(obj_list))) >> $$@
     466+endif
     467+    $(target)_imp_SOURCES.debug    = $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
     468+    $(target)_imp_CLEAN.debug     += $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
     469+ else
     470+    $(target)_imp_SOURCES.release  = $(def)
     471+    $(target)_imp_SOURCES.debug    = $(def_debug)
     472+ endif
     473+endif
     474+endef
     475+
     476+##
     477+# Shortcut to $(call odin_implib,<1>,<2>,<3>,<4>,1) used to disable .def file
     478+# post-processing with the ImpDef tool.
     479+#
     480+# @param 1 DLL target name.
     481+# @param 2 .def file (defaults to <1>.def).
     482+# @param 3 .def file for debug (defaults to <2>).
     483+# @param 4 list of object files containing additional exports.
     484+#
     485+odin_implib_no_expdef = $(call odin_implib,$(1),$(2),$(3),$(4),1)
     486+
     487+##
     488+# Shortcut to $(call odin_implib, <1>,<1>.def,<1>dbg.def,<2>).
     489+#
     490+# @param 1 DLL target name.
     491+# @param 2 list of object files containing additional exports.
     492+#
     493+odin_implib_2 = $(call odin_implib,$(1),$(1).def,$(1)dbg.def,$(2))
     494+
     495+##
     496+# Shortcut to $(call odin_implib_no_expdef,<1>,<1>.def,<1>dbg.def,<2>).
     497+#
     498+# @param 1 DLL target name.
     499+# @param 2 list of object files containing additional exports.
     500+#
     501+odin_implib_2_no_expdef = $(call odin_implib_no_expdef,$(1),$(1).def,$(1)dbg.def,$(2))
     502+
     503+#
     504+# Handler for Wine RC (.orc) source files
     505+#
     506+KBUILD_SRC_HANDLERS += .orc:def_src_handler_wrc
     507+define def_src_handler_wrc
     508+local type := WRC
     509+ $(kb-src-one 2)
     510+endef
     511+PROPS_ACCUMULATE_R += WRCFLAGS
     512+
     513+#
     514+# Override handler for .asm files to compile them with the MASM-compilant tool
     515+#
     516+KBUILD_SRC_HANDLERS := .asm:def_src_handler_masm $(KBUILD_SRC_HANDLERS)
     517+define def_src_handler_masm
     518+local type := $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)
     519+ $(kb-src-one 2)
     520+endef
     521+PROPS_ACCUMULATE_R += $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)FLAGS
     522+
     523+#
     524+# Handler for .def files to add bldlevel info to them
     525+#
     526+define def_src_handler_def
     527+local type := DEF
     528+ $(kb-src-one 2)
     529+#.NOTPARALLEL: $(obj) # BldLevelInf.cmd can't open files in parallel
     530+endef
     531+
     532+#------------------------------------------------------------------------------
     533+# Tools
     534+#------------------------------------------------------------------------------
     535+
     536+#
     537+# Add support for Wine RC to the GCC compiler
     538+#
     539+TOOL_GXX3OMF_WRC                = $(PATH_STAGE_BIN)/winerc.exe
     540+TOOL_GXX3OMF_WRCOBJSUFF         = .orc$(TOOL_GXX3OMF_COBJSUFF)
     541+TOOL_GXX3OMF_WRCFLAGS           =
     542+TOOL_GXX3OMF_COMPILE_WRC_OUTPUT = $(outbase).orc.s
     543+TOOL_GXX3OMF_COMPILE_WRC_DEPEND = $(TOOL_GXX3OMF_WRC)
     544+TOOL_GXX3OMF_COMPILE_WRC_DEPORD =
     545+define TOOL_GXX3OMF_COMPILE_WRC_CMDS
     546+       $(QUIET)$(TOOL_GXX3OMF_WRC) -s -I$(subst /,\\,$(abspath $(dir $(source))))\
     547+               $(flags) $(addprefix -I, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
     548+               $(subst /,\\,$(abspath $(source))) \
     549+               -o $(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT)
     550+       $(QUIET)$(TOOL_GXX3OMF_CC) -E -I$(subst /,\\,$(abspath $(dir $(source))))\
     551+               $(addprefix -I, $(incs)) -I . $(addprefix -D, $(defs))\
     552+               -x c $(abspath $(source)) \
     553+               | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
     554+       $(subst $(source),$(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT),\
     555+                $(subst $(flags),,$(TOOL_GXX3OMF_COMPILE_AS_CMDS)))
     556+endef
     557+
     558+#
     559+# Add support for MASM to the GCC compiler
     560+#
     561+TOOL_GXX3OMF_MASM                   = $(PATH_TOOL_ALP)
     562+TOOL_GXX3OMF_MASMFLAGS              = -Mb
     563+TOOL_GXX3OMF_COMPILE_MASM_OUTPUT    = $(outbase).lst
     564+TOOL_GXX3OMF_COMPILE_MASM_DEPEND    =
     565+TOOL_GXX3OMF_COMPILE_MASM_DEPORD    =
     566+define TOOL_GXX3OMF_COMPILE_MASM_CMDS
     567+       $(QUIET)$(TOOL_GXX3OMF_MASM) -D:__GNUC__ -D:__EMX__\
     568+               $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
     569+               $(source)\
     570+               -Fl:$(outbase).lst\
     571+               -Fd:$(dep)\
     572+               -Fo:$(obj)
     573+endef
     574+
     575+#
     576+# Add support for DEF file bldlevel info generator to the GCC compiler
     577+#
     578+TOOL_GXX3OMF_DEF                    = $(PATH_ROOT)/tools/bin/BldLevelInf.cmd
     579+TOOL_GXX3OMF_DEFOBJSUFF             = .bldlevel.def
     580+TOOL_GXX3OMF_COMPILE_DEF_OUTPUT     =
     581+TOOL_GXX3OMF_COMPILE_DEF_DEPEND     = $(PATH_ROOT)/include/odinbuild.h
     582+TOOL_GXX3OMF_COMPILE_DEF_DEPORD     =
     583+define TOOL_GXX3OMF_COMPILE_DEF_CMDS
     584+       $(QUIET)cmd /c 'set BUILD_QUIET=1 && $(TOOL_GXX3OMF_DEF)\
     585+               $(source) $(outbase).bldlevel.def\
     586+               -R"$(source)"\
     587+               -V"#define=ODIN32_VERSION,$(subst /,/,$(PATH_ROOT)/include/odinbuild.h)"\
     588+               -M"#define=ODIN32_BUILD_NR,$(subst /,/,$(PATH_ROOT)/include/odinbuild.h)"'
     589+endef
     590+
     591+#------------------------------------------------------------------------------
     592+# Common libraries referenced by components
     593+#------------------------------------------------------------------------------
     594+
     595+#------------------------------------------------------------------------------
     596+# General Stuff
     597+#------------------------------------------------------------------------------
     598+
     599+KBUILD_UNIT_PATHS          += $(PATH_ROOT)
     600+
     601+TEMPLATE_OdinCxx            = Odin C/C++ sources
     602+TEMPLATE_OdinCxx_USES       = Extra
     603+TEMPLATE_OdinCxx_TOOL       = GXX3OMF
     604+TEMPLATE_OdinCxx_INCS       = $(PATH_ROOT)/include/win $(PATH_ROOT)/include $(PATH_ROOT)/include/incl_gcc
     605+TEMPLATE_OdinCxx_DEFS       = USE_OS2_TOOLKIT_HEADERS OS2EMX_PLAIN_CHAR \
     606+                              __WIN32OS2__ __i386__
     607+TEMPLATE_OdinCxx_DEFS.debug = DEBUG
     608+TEMPLATE_OdinCxx_LDFLAGS    = -Zlinker '"DISABLE 1121"'
     609+
     610+# generate .sym files but don't put them in a separate dir
     611+TEMPLATE_OdinCxx_LD_DEBUG       = split
     612+TEMPLATE_OdinCxx_DEBUG_STAGE    = nul
     613+
     614+TEMPLATE_OdinBin                = Odin DLL or EXE
     615+TEMPLATE_OdinBin_EXTENDS        = OdinCxx
     616+
     617+# Override DEF handler to add bldlevel info to .DEF files
     618+TEMPLATE_OdinBin_SRC_HANDLERS   = .def:def_src_handler_def
     619+
     620+TEMPLATE_OdinDLL            = Odin DLL
     621+TEMPLATE_OdinDLL_EXTENDS    = OdinBin
     622+TEMPLATE_OdinDLL_EXTENDS_BY = appending
     623+TEMPLATE_OdinDLL_DEFS       = $(TEMPLATE_OdinCxx_DEFS) __WINE__ COMCTL32UNDOC TCPV40HDRS __USE_LIBC_TCPIP
     624+TEMPLATE_OdinDLL_LIBS       = $(PATH_STAGE_LIB)/odincrt.lib \
     625+                              $(PATH_STAGE_LIB)/initdll.lib
     626+TEMPLATE_OdinDLL_LDFLAGS    = -L$(PATH_GCC_LIB_TCPIPV4) # necessary for TCPV40HDRS
     627+TEMPLATE_OdinDLL_LDFLAGS   += KMK_NOIMPLIB # disable automatic implib
     628+TEMPLATE_OdinDLL_WRCFLAGS   = -p_$(target)
     629+
     630+TEMPLATE_OdinSimpleDLL              = Odin DLL with ordinary entry point
     631+TEMPLATE_OdinSimpleDLL_EXTENDS      = OdinDLL
     632+TEMPLATE_OdinSimpleDLL_EXTENDS_BY   = overriding
     633+TEMPLATE_OdinSimpleDLL_LIBS         = $(PATH_STAGE_LIB)/dllentry.o $(TEMPLATE_OdinDLL_LIBS)
     634+TEMPLATE_OdinSimpleDLL_WRCFLAGS     = -p_Resource
     635+
     636+TEMPLATE_OdinCRT            = OdinCRT DLL
     637+TEMPLATE_OdinCRT_EXTENDS    = OdinBin
     638+TEMPLATE_OdinCRT_EXTENDS_BY = appending
     639+TEMPLATE_OdinCRT_DEFS       = __WINE__
     640+TEMPLATE_OdinCRT_LIBS       = $(PATH_STAGE_LIB)/initdll.lib
     641+TEMPLATE_OdinCRT_LDFLAGS   += KMK_NOIMPLIB # disable automatic implib
     642+
     643+TEMPLATE_OdinApp            = Odin application
     644+TEMPLATE_OdinApp_EXTENDS    = OdinBin
     645+
     646+TEMPLATE_OdinTestApp        = Odin application
     647+TEMPLATE_OdinTestApp_EXTENDS= OdinApp
     648+TEMPLATE_OdinTestApp_STAGE  = tests/
     649+
     650+#------------------------------------------------------------------------------
     651+# GCC Stuff
     652+#------------------------------------------------------------------------------
     653+
     654+#------------------------------------------------------------------------------
     655+# Other Stuff
     656+#------------------------------------------------------------------------------
     657+
     658+#
     659+# Include a site-specific config for local overrides
     660+#
     661+ifndef LOCALCFG
     662+ LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
     663+ ifneq ($(LOCALCFG),)
     664+  include $(LOCALCFG)
     665+ endif
     666+endif
     667+
     668+#------------------------------------------------------------------------------
     669+# Post-processing
     670+#------------------------------------------------------------------------------
     671+
     672+ifeq ($(PATH_TOOL_ALP),)
     673+ifneq ($(PATH_SDK_OS2TK4),)
     674+PATH_TOOL_ALP := $(PATH_SDK_OS2TK4)/bin/alp.exe
     675+else
     676+PATH_TOOL_ALP := alp.exe
     677+endif
     678+endif
     679+
     680+ifneq ($(PATH_SDK_OS2TK4),)
     681+#
     682+# We can't add Toolkit includes in _INCS (it will casuse then to be searched
     683+# before GCC headers and lead to conflicts), so use -idirafter.
     684+#
     685+TEMPLATE_OdinCxx_CFLAGS    += -idirafter $(PATH_SDK_OS2TK4)/h
     686+TEMPLATE_OdinCxx_CXXFLAGS  += -idirafter $(PATH_SDK_OS2TK4)/h
     687+endif
     688diff --git a/Makefile.kmk b/Makefile.kmk
     689index 196c17a..3b13f74 100644
     690--- a/Makefile.kmk
     691+++ b/Makefile.kmk
     692@@ -1,15 +1,15 @@
    7397693-## @file
    7398 -# Win32K static API library.
    7399 -#
    7400 -
    7401 -SUB_DEPTH = ../../..
     694-# Top-level makefile
     695-#
     696-
     697-SUB_DEPTH = .
    7402698-include $(KBUILD_PATH)/subheader.kmk
    7403699-
    7404 -#$(call odin_implib,ntdll)
    7405 -
    7406 -LIBRARIES          += win32k
    7407 -win32k_TEMPLATE     = OdinCxx
    7408 -
    7409 -win32K_DEFS         = RING3 WIN32KLIB
    7410 -
    7411 -win32k_SOURCES      = \
    7412 -    libInit.c \
    7413 -    libTerm.c \
    7414 -    libWin32kInstalled.c \
    7415 -    libWin32kQueryOptionsStatus.c \
    7416 -    libWin32kSetOptions.c \
    7417 -    libWin32kSetEnvironment.c \
    7418 -    libDosAllocMemEx.c \
    7419 -    libDosKillProcessEx.c \
    7420 -    libW32kHandleSystemEvent.c \
    7421 -    libW32kQueryOTEs.c \
    7422 -    libW32kQuerySystemMemInfo.c \
    7423 -    libW32kProcessReadWrite.c \
    7424 -    libGetCS.asm \
    7425 -    libCallThruCallGate.asm
     700-#
     701-# Include sub-makefiles.
     702-#
     703-include $(PATH_SUB_CURRENT)/lib/Makefile.kmk
     704-include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
     705-include $(PATH_SUB_CURRENT)/src/Makefile.kmk
    7426706-
    7427707-include $(FILE_KBUILD_SUB_FOOTER)
    7428708+## @file
    7429 +# Win32K static API library.
    7430 +#
    7431 +
    7432 +SUB_DEPTH = ../../..
     709+# Top-level makefile
     710+#
     711+
     712+SUB_DEPTH = .
    7433713+include $(KBUILD_PATH)/subheader.kmk
    7434714+
    7435 +#$(call odin_implib,ntdll)
    7436 +
    7437 +LIBRARIES          += win32k
    7438 +win32k_TEMPLATE     = OdinCxx
    7439 +
    7440 +win32K_DEFS         = RING3 WIN32KLIB
    7441 +
    7442 +win32k_SOURCES      = \
    7443 +    libInit.c \
    7444 +    libTerm.c \
    7445 +    libWin32kInstalled.c \
    7446 +    libWin32kQueryOptionsStatus.c \
    7447 +    libWin32kSetOptions.c \
    7448 +    libWin32kSetEnvironment.c \
    7449 +    libDosAllocMemEx.c \
    7450 +    libDosKillProcessEx.c \
    7451 +    libW32kHandleSystemEvent.c \
    7452 +    libW32kQueryOTEs.c \
    7453 +    libW32kQuerySystemMemInfo.c \
    7454 +    libW32kProcessReadWrite.c \
    7455 +    libGetCS.asm \
    7456 +    libCallThruCallGate.asm
     715+#
     716+# Include sub-makefiles.
     717+#
     718+include $(PATH_SUB_CURRENT)/lib/Makefile.kmk
     719+include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
     720+include $(PATH_SUB_CURRENT)/src/Makefile.kmk
    7457721+
    7458722+include $(FILE_KBUILD_SUB_FOOTER)
    7459 diff --git a/src/win32k/makedesc.cmd b/src/win32k/makedesc.cmd
    7460 index f23e8b5..50045ba 100644
    7461 --- a/src/win32k/makedesc.cmd
    7462 +++ b/src/win32k/makedesc.cmd
    7463 @@ -1,563 +1,563 @@
    7464 -/* $Id: makedesc.cmd,v 1.2 2000-12-16 23:20:18 bird Exp $
    7465 - *
    7466 - * Adds a Description string to the given .def-file.
    7467 - * Fills in default values; like build time and host.
    7468 - *
    7469 - */
    7470 -
    7471 -call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    7472 -call SysLoadFuncs;
    7473 -
    7474 -/*
    7475 - * Set default parameter values.
    7476 - */
    7477 -sDefFileIn      = '';
    7478 -sDefFileOut     = '';
    7479 -sASDFeatureId   = '';
    7480 -sCountryCode    = '';
    7481 -sDateTime       = left(' 'date()' 'time(), 26);
    7482 -sDescription    = 'Odin32';
    7483 -sFixPakVer      = '';
    7484 -sHostname       = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11));
    7485 -sLanguageCode   = '';
    7486 -sMiniVer        = '';
    7487 -sVendor         = 'Project Odin';
    7488 -sVersion        = '0.5';
    7489 -
    7490 -
    7491 -/*
    7492 - * Parse parameters.
    7493 - */
    7494 -parse arg  sArgs
    7495 -if (sArgs = '') then
    7496 -do
    7497 -    call syntax;
    7498 -    exit(1);
    7499 -end
    7500 -
    7501 -do while (sArgs <> '')
    7502 -    sArgs = strip(sArgs);
    7503 -    if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then
    7504 -    do  /*
    7505 -         * Option.
    7506 -         */
    7507 -        ch = translate(substr(sArgs, 2, 1));
    7508 -        if (pos(ch, 'ACDHLMNPRTV') < 1) then
    7509 -        do
    7510 -            say 'invalid option:' substr(sArgs, 1, 2);
    7511 -            call syntax;
    7512 -            exit(2);
    7513 -        end
    7514 -
    7515 -        /* get value and advance sArgs to next or to end. */
    7516 -        if (substr(sArgs, 3, 1) = '"') then
    7517 -        do
    7518 -            iNext = pos('"', sArgs, 4);
    7519 -            fQuote = 1;
    7520 -        end
    7521 -        else
    7522 -        do
    7523 -            iNext = pos(' ', sArgs, 3);
    7524 -            if (iNext <= 0) then
    7525 -                iNext = length(sArgs);
    7526 -            fQuote = 0;
    7527 -        end
    7528 -
    7529 -        if (iNext > 3 | ch = 'R') then
    7530 -        do
    7531 -            sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote);
    7532 -            sArgs = strip(substr(sArgs, iNext+1));
    7533 -            /*say 'iNext:' iNext  'sValue:' sValue  'sArgs:' sArgs; */
    7534 -
    7535 -            /* check if we're gonna search for something in an file. */
    7536 -            if (sValue <> '' & pos('#define=', sValue) > 0) then
    7537 -                sValue = LookupDefine(sValue);
    7538 -        end
    7539 -        else
    7540 -        do
    7541 -            say 'syntax error near' substr(sArgs, 1, 2)'.';
    7542 -            call syntax;
    7543 -            exit(3);
    7544 -        end
    7545 -
    7546 -
    7547 -        /* set value */
    7548 -        select
    7549 -            when (ch = 'A') then /* ASD Feature Id */
    7550 -                sASDFeatureId   = sValue;
    7551 -
    7552 -            when (ch = 'C') then /* Country code */
    7553 -                sCountryCode    = sValue;
    7554 -
    7555 -            when (ch = 'D') then /* Description */
    7556 -                sDescription    = sValue;
    7557 -
    7558 -            when (ch = 'H') then /* Hostname */
    7559 -                sHostname       = sValue;
    7560 -
    7561 -            when (ch = 'L') then /* Language code */
    7562 -                sLanguageCode   = sValue;
    7563 -
    7564 -            when (ch = 'M') then /* MiniVer */
    7565 -                sMiniVer        = sValue;
    7566 -
    7567 -            when (ch = 'N') then /* Vendor */
    7568 -                sVendor         = sValue;
    7569 -
    7570 -            when (ch = 'R') then /* Vendor */
    7571 -                sDescription    = ReadDescription(sValue, sDefFile);
    7572 -
    7573 -            when (ch = 'P') then /* Fixpak version */
    7574 -                sFixPakVer      = sValue;
    7575 -
    7576 -            when (ch = 'T') then /* Date Time */
    7577 -                sDateTime       = sValue;
    7578 -
    7579 -            when (ch = 'V') then /* Version */
    7580 -                sVersion        = sValue;
    7581 -
    7582 -            /* Otherwise it's an illegal option */
    7583 -            otherwise:
    7584 -                say 'invalid option:' substr(sArgs, 1, 2);
    7585 -                call syntax;
    7586 -                exit(2);
    7587 -        end /* select */
    7588 -    end
    7589 -    else
    7590 -    do  /*
    7591 -         * Defition file...
    7592 -         */
    7593 -        if (sDefFileOut <> '') then
    7594 -        do
    7595 -            say 'Syntax error: Can''t specify more than two defintion files!';
    7596 -            exit(4);
    7597 -        end
    7598 -        if (sDefFileIn = '') then
    7599 -            parse value sArgs with sDefFileIn' 'sArgs
    7600 -        else
    7601 -            parse value sArgs with sDefFileOut' 'sArgs
    7602 -        sArgs = strip(sArgs);
    7603 -    end
    7604 -end
    7605 -
    7606 -
    7607 -/* check that a defintion file was specified. */
    7608 -if (sDefFileIn = '') then
    7609 -do
    7610 -    say 'Syntax error: Will have to specify a .def-file to update.';
    7611 -    call syntax;
    7612 -    exit(5);
    7613 -end
    7614 -
    7615 -
    7616 -/*
    7617 - * Trim strings to correct lengths.
    7618 - */
    7619 -sVendor         = strip(substr(sVendor, 1, 31));
    7620 -if (substr(sDateTime, 1, 1) <> ' ') then
    7621 -    sDateTime = ' ' || sDateTime;
    7622 -sDateTime       = left(sDateTime, 26);
    7623 -sHostname       = strip(substr(sHostname, 1, 11));
    7624 -sMiniVer        = strip(substr(sMiniVer, 1, 11));
    7625 -sDescription    = strip(substr(sDescription, 1, 80));
    7626 -sCountryCode    = strip(substr(sCountryCode, 1, 4));
    7627 -sLanguageCode   = strip(substr(sLanguageCode, 1, 4));
    7628 -sASDFeatureId   = strip(substr(sASDFeatureId, 1, 11));
    7629 -sFixPakVer      = strip(substr(sFixPakVer, 1, 11));
    7630 -
    7631 -
    7632 -/*
    7633 - * Signature
    7634 - */
    7635 -sEnhSign = '##1##'
    7636 -
    7637 -/*
    7638 - * Build description string.
    7639 - */
    7640 -sDescription =  '@#'sVendor':'sVersion'#@'sEnhSign||,
    7641 -                sDateTime||sHostname||,
    7642 -                ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||,
    7643 -                '::'sFixPakVer'@@'sDescription;
    7644 -
    7645 -/*
    7646 - * Update .def-file.
    7647 - */
    7648 -rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);
    7649 -exit(rc);
    7650 -
    7651 -
    7652 -/**
    7653 - * Display script syntax.
    7654 - */
    7655 -syntax: procedure
    7656 -    say 'Syntax: MakeDesc.cmd [options] <deffile in> <deffile out> [options]'
    7657 -    say '   <deffile>   Defitionfile which will have an DESCRIPTION appended.'
    7658 -    say 'Options:'
    7659 -    say '   -A<string>  ASD Feature Id.'
    7660 -    say '   -C<string>  Country code.'
    7661 -    say '   -D<string>  Description.'
    7662 -    say '   -R[deffile] Read description from .def file.'
    7663 -    say '   -H<string>  Hostname.'
    7664 -    say '   -L<string>  Language code.'
    7665 -    say '   -M<string>  MiniVer.'
    7666 -    say '   -N<string>  Vendor.'
    7667 -    say '   -P<string>  Fixpak version.'
    7668 -    say '   -T<string>  Date Time.'
    7669 -    say '   -V<string>  Version.'
    7670 -    say '<string> could be a double qoute qouted string or a single word.'
    7671 -    say '       You could also reference #defines in C/C++ include files.'
    7672 -    say '       The string should then have this form:'
    7673 -    say '           "#define=<DEFINE_NAME>,<includefile.h>"'
    7674 -    say '';
    7675 -
    7676 -    return;
    7677 -
    7678 -
    7679 -/**
    7680 - * Search for a #define in an C/C++ header or source file.
    7681 - *
    7682 - * @returns String containing the defined value
    7683 - *          found for the define in the header file.
    7684 - *          Quits on fatal errors.
    7685 - * @param   A string on the form: "#define=DEFINETOFIND,includefile.h"
    7686 - * @remark  Write only code... - let's hope it works.
    7687 - */
    7688 -LookupDefine: procedure
    7689 -    parse arg '#'sDefine'='sMacro','sIncludeFile
    7690 -
    7691 -    /*
    7692 -     * Validate parameters.
    7693 -     */
    7694 -    sMacro = strip(sMacro);
    7695 -    sIncludeFile = strip(sIncludeFile);
    7696 -    if (sMacro = '') then
    7697 -    do
    7698 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    7699 -        say '    <DEFINE_NAME> was empty.';
    7700 -        exit(-20);
    7701 -    end
    7702 -    if (sIncludeFile = '') then
    7703 -    do
    7704 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    7705 -        say '    <includefile.h> was empty.';
    7706 -        exit(-20);
    7707 -    end
    7708 -
    7709 -
    7710 -    sIllegal = translate(translate(sMacro),,
    7711 -                         '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',,
    7712 -                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_');
    7713 -
    7714 -    if (strip(translate(sIllegal, ' ', '!')) <> '') then
    7715 -    do
    7716 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    7717 -        say '    <DEFINE_NAME> contains illegal charater(s).'
    7718 -        say '        'sMacro;
    7719 -        say '        'translate(sIllegal, ' ', '!');
    7720 -        exit(-20);
    7721 -    end
    7722 -
    7723 -    /*
    7724 -     * Open include file.
    7725 -     */
    7726 -    sRc = stream(sIncludeFile, 'c', 'open read');
    7727 -    if (pos('READY', sRc) <> 1) then
    7728 -    do  /* search INCLUDE variable */
    7729 -        sFile = SysSearchPath('INCLUDE', sIncludeFile);
    7730 -        if (sFile = '') then
    7731 -        do
    7732 -            say 'Can''t find include file 'sIncludeFile'.';
    7733 -            exit(-20);
    7734 -        end
    7735 -        sIncludeFile = sFile;
    7736 -
    7737 -        sRc = stream(sIncludeFile, 'c', 'open read');
    7738 -        if (pos('READY', sRc) <> 1) then
    7739 -        do
    7740 -            say 'Failed to open include file' sIncludeFile'.';
    7741 -            exit(-20);
    7742 -        end
    7743 -    end
    7744 -
    7745 -    /*
    7746 -     * Search the file line by line.
    7747 -     *  We'll check for lines starting with a hash (#) char.
    7748 -     *  Then check that the word after the hash is 'define'.
    7749 -     *  Then match the next word with the macro name.
    7750 -     *  Then then get the next rest of the line to comment or continuation char.
    7751 -     *      (continuation is not supported)
    7752 -     *  Finally strip quotes.
    7753 -     */
    7754 -    sValue = '';
    7755 -    do while (lines(sIncludeFile) > 0)
    7756 -        sLine = strip(linein(sIncludeFile));
    7757 -        if (sLine = '') then
    7758 -            iterate;
    7759 -        if (substr(sLine, 1, 1) <> '#') then
    7760 -            iterate;
    7761 -        sLine = substr(sLine, 2);
    7762 -        if (word(sLine, 1) <> 'define') then
    7763 -            iterate;
    7764 -        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1));
    7765 -        if (  substr(sLine, 1, length(sMacro)) <> sMacro,
    7766 -            | substr(sLine, length(sMacro)+1, 1) <> ' ') then
    7767 -            iterate;
    7768 -        sLine = strip(substr(sLine, length(sMacro) + 1));
    7769 -        if (sLine = '') then
    7770 -        do
    7771 -            say 'error: #define' sMacro' is empty.';
    7772 -            call stream sIncludeFile, 'c', 'close';
    7773 -            exit(-20);
    7774 -        end
    7775 -
    7776 -        chQuote = substr(sLine, 1, 1);
    7777 -        if (chQuote = '"' | chQuote = "'") then
    7778 -        do  /* quoted string */
    7779 -            iLastQuote = 0;
    7780 -            do forever
    7781 -                iLast = pos(chQuote, sLine, 2);
    7782 -                if (iLast <= 0) then
    7783 -                    leave;
    7784 -                if (substr(sLine, iLast, 1) = '\') then
    7785 -                    iterate;
    7786 -                iLastQuote = iLast;
    7787 -                leave;
    7788 -            end
    7789 -
    7790 -            if (iLastQuote <= 0) then
    7791 -            do
    7792 -                say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.';
    7793 -                call stream sIncludeFile, 'c', 'close';
    7794 -                exit(-20);
    7795 -            end
    7796 -
    7797 -            call stream sIncludeFile, 'c', 'close';
    7798 -            sValue = substr(sLine, 2, iLastQuote - 2);
    7799 -            say 'Found 'sMacro'='sValue;
    7800 -            return sValue;
    7801 -        end
    7802 -        else
    7803 -        do
    7804 -            iCommentCPP = pos('//',sLine);
    7805 -            iCommentC   = pos('/*',sLine);
    7806 -            if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then
    7807 -                iComment = iCommentCPP;
    7808 -            else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then
    7809 -                iComment = iCommentC;
    7810 -            else if (iCommentCPP > 0) then
    7811 -                iComment = iCommentCPP;
    7812 -            else if (iCommentC > 0) then
    7813 -                iComment = iCommentC;
    7814 -            else
    7815 -                iComment = 0;
    7816 -
    7817 -            if (iComment > 0) then
    7818 -                sValue = strip(substr(sLine, 1, iComment-1));
    7819 -            else
    7820 -                sValue = strip(sLine);
    7821 -
    7822 -            if (sValue <> '') then
    7823 -            do
    7824 -                if (substr(sValue, length(sValue)) = '\') then
    7825 -                do
    7826 -                    say 'Found continuation char: Multiline definitions are not supported!\n';
    7827 -                    call stream sIncludeFile, 'c', 'close';
    7828 -                    exit(-20);
    7829 -                end
    7830 -            end
    7831 -
    7832 -            if (sValue = '') then
    7833 -                say 'warning: The #define has no value.';
    7834 -
    7835 -            call stream sIncludeFile, 'c', 'close';
    7836 -            say 'Found 'sMacro'='sValue;
    7837 -            return sValue;
    7838 -        end
    7839 -    end
    7840 -
    7841 -    call stream sIncludeFile, 'c', 'close';
    7842 -    say 'error: didn''t find #define' sMacro'.';
    7843 -    exit(-20);
    7844 -
    7845 -
    7846 -
    7847 -/**
    7848 - * Reads the description line for a .def-file.
    7849 - * @returns The Description string, with quotes removed.
    7850 - *          Empty string is acceptable.
    7851 - *          On error we'll terminate the script.
    7852 - * @param   sDefFile    Filaname of .def-file to read the description from.
    7853 - * @param   sDefFile2   Used if sDefFile is empty.
    7854 - * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    7855 - */
    7856 -ReadDescription: procedure;
    7857 -    parse arg sDefFile, sDefFile2
    7858 -
    7859 -    /*
    7860 -     * Validate parameters.
    7861 -     */
    7862 -    if (sDefFile = '') then
    7863 -        sDefFile = sDefFile2;
    7864 -    if (sDefFile = '') then
    7865 -    do
    7866 -        say 'error: no definition file to get description from.'
    7867 -        exit(-1);
    7868 -    end
    7869 -
    7870 -    /*
    7871 -     * Open file
    7872 -     */
    7873 -    rc = stream(sDefFile, 'c', 'open read');
    7874 -    if (pos('READY', rc) <> 1) then
    7875 -    do
    7876 -        say 'error: failed to open deffile file.';
    7877 -        exit(-1);
    7878 -    end
    7879 -
    7880 -
    7881 -    /*
    7882 -     * Search for the 'DESCRIPTION' line.
    7883 -     */
    7884 -    do while (lines(sDefFile) > 0)
    7885 -        sLine = strip(linein(sDefFile));
    7886 -        if (sLine = '') then
    7887 -            iterate;
    7888 -        if (translate(word(sLine, 1)) <> 'DESCRIPTION') then
    7889 -            iterate;
    7890 -        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1));
    7891 -
    7892 -        ch = substr(sLine, 1, 1);
    7893 -        if (ch <> "'" & ch <> '"') then
    7894 -        do
    7895 -            say 'syntax error: description line in' sDefFile 'is misformed.';
    7896 -            call stream sDefFile, 'c', 'close';
    7897 -            exit(-10);
    7898 -        end
    7899 -
    7900 -        iEnd = pos(ch, sLine, 2);
    7901 -        if (iEnd <= 0) then
    7902 -        do
    7903 -            say 'syntax error: description line in' sDefFile 'is misformed.';
    7904 -            call stream sDefFile, 'c', 'close';
    7905 -            exit(-10);
    7906 -        end
    7907 -
    7908 -        call stream sDefFile, 'c', 'close';
    7909 -        sValue = substr(sLine, 2, iEnd - 2);
    7910 -        say 'Found Description:' sValue;
    7911 -        return sValue;
    7912 -    end
    7913 -
    7914 -    call stream sDefFile, 'c', 'close';
    7915 -    say 'info: Didn''t find description line in' sDefFile'.';
    7916 -    return '';
    7917 -
    7918 -
    7919 -/**
    7920 - * This is a function which reads sDefFileIn into and
    7921 - * internal array and changes the DESCRIPTION text if found.
    7922 - * If DESCRIPTION isn't found, it is added at the end.
    7923 - * The array is written to sDefFileOut.
    7924 - * @returns 0 on succes.
    7925 - *          Errorcode on error.
    7926 - * @param   sDefFileIn      Input .def-file.
    7927 - * @param   sDefFileOut     Output .def-file. Overwritten.
    7928 - * @param   sDescription    New description string.
    7929 - * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    7930 - */
    7931 -UpdateDefFile: procedure;
    7932 -    parse arg sDefFileIn, sDefFileOut, sDescription
    7933 -
    7934 -    /*
    7935 -     * Validate parameters.
    7936 -     */
    7937 -    if (sDefFileOut = '') then
    7938 -        sDefFileOut = sDefFileIn;
    7939 -
    7940 -    /*
    7941 -     * Open file input file.
    7942 -     */
    7943 -    rc = stream(sDefFileIn, 'c', 'open read');
    7944 -    if (pos('READY', rc) <> 1) then
    7945 -    do
    7946 -        say 'error: failed to open' sDefFileIn 'file.';
    7947 -        return 110;
    7948 -    end
    7949 -
    7950 -
    7951 -    /*
    7952 -     * Search for the 'DESCRIPTION' line.
    7953 -     */
    7954 -    i = 0;
    7955 -    fDescription = 0;
    7956 -    do while (lines(sDefFileIn) > 0)
    7957 -        /*
    7958 -         * Read line.
    7959 -         */
    7960 -        i = i + 1;
    7961 -        asFile.i = strip(linein(sDefFileIn));
    7962 -
    7963 -        /*
    7964 -         * Look for DESCRIPTION;
    7965 -         */
    7966 -        if (asFile.i = '') then
    7967 -            iterate;
    7968 -        if (translate(word(asFile.i, 1)) <> 'DESCRIPTION') then
    7969 -            iterate;
    7970 -        if (fDescription) then
    7971 -        do
    7972 -            say 'warning: multiple descriptions lines. Line' i 'removed';
    7973 -            i = i - 1;
    7974 -            iterate;
    7975 -        end
    7976 -
    7977 -        /*
    7978 -         * Found description - replace with new description.
    7979 -         */
    7980 -        asFile.i = "DESCRIPTION '"||sDescription||"'";
    7981 -        fDescription = 1;
    7982 -    end
    7983 -
    7984 -    /*
    7985 -     * Add description is none was found.
    7986 -     */
    7987 -    if (\fDescription) then
    7988 -    do
    7989 -        i = i + 1;
    7990 -        asFile.i = "DESCRIPTION '"||sDescription||"'";
    7991 -    end
    7992 -    asFile.0 = i;
    7993 -
    7994 -
    7995 -    /*
    7996 -     * Close input file and open output file.
    7997 -     */
    7998 -    call stream sDefFileIn, 'c', 'close';
    7999 -    call SysFileDelete(sDefFileOut);
    8000 -    rc = stream(sDefFileOut, 'c', 'open write');
    8001 -    if (pos('READY', rc) <> 1) then
    8002 -    do
    8003 -        say 'error: failed to open outputfile' sDefFileOut 'file.';
    8004 -        return 110;
    8005 -    end
    8006 -
    8007 -    /*
    8008 -     * Make firstline and write all the lines to the output file.
    8009 -     */
    8010 -    call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;
    8011 -    do i = 1 to asFile.0
    8012 -        rc = lineout(sDefFileOut, asFile.i);
    8013 -        if (rc > 0) then
    8014 -        do
    8015 -            say 'error: failed to write line' i 'to' sDefFileOut'.'
    8016 -            call stream sDefFileOut, 'c', 'close';
    8017 -            return 5;
    8018 -        end
    8019 -    end
    8020 -
    8021 -    /*
    8022 -     * Close output file and return succesfully.
    8023 -     */
    8024 -    call stream sDefFileOut, 'c', 'close';
    8025 -    return 0;
    8026 -
    8027 +/* $Id: makedesc.cmd,v 1.2 2000-12-16 23:20:18 bird Exp $
    8028 + *
    8029 + * Adds a Description string to the given .def-file.
    8030 + * Fills in default values; like build time and host.
    8031 + *
    8032 + */
    8033 +
    8034 +call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    8035 +call SysLoadFuncs;
    8036 +
    8037 +/*
    8038 + * Set default parameter values.
    8039 + */
    8040 +sDefFileIn      = '';
    8041 +sDefFileOut     = '';
    8042 +sASDFeatureId   = '';
    8043 +sCountryCode    = '';
    8044 +sDateTime       = left(' 'date()' 'time(), 26);
    8045 +sDescription    = 'Odin32';
    8046 +sFixPakVer      = '';
    8047 +sHostname       = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11));
    8048 +sLanguageCode   = '';
    8049 +sMiniVer        = '';
    8050 +sVendor         = 'Project Odin';
    8051 +sVersion        = '0.5';
    8052 +
    8053 +
    8054 +/*
    8055 + * Parse parameters.
    8056 + */
    8057 +parse arg  sArgs
    8058 +if (sArgs = '') then
    8059 +do
    8060 +    call syntax;
    8061 +    exit(1);
    8062 +end
    8063 +
    8064 +do while (sArgs <> '')
    8065 +    sArgs = strip(sArgs);
    8066 +    if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then
    8067 +    do  /*
    8068 +         * Option.
    8069 +         */
    8070 +        ch = translate(substr(sArgs, 2, 1));
    8071 +        if (pos(ch, 'ACDHLMNPRTV') < 1) then
    8072 +        do
    8073 +            say 'invalid option:' substr(sArgs, 1, 2);
    8074 +            call syntax;
    8075 +            exit(2);
    8076 +        end
    8077 +
    8078 +        /* get value and advance sArgs to next or to end. */
    8079 +        if (substr(sArgs, 3, 1) = '"') then
    8080 +        do
    8081 +            iNext = pos('"', sArgs, 4);
    8082 +            fQuote = 1;
    8083 +        end
    8084 +        else
    8085 +        do
    8086 +            iNext = pos(' ', sArgs, 3);
    8087 +            if (iNext <= 0) then
    8088 +                iNext = length(sArgs);
    8089 +            fQuote = 0;
    8090 +        end
    8091 +
    8092 +        if (iNext > 3 | ch = 'R') then
    8093 +        do
    8094 +            sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote);
    8095 +            sArgs = strip(substr(sArgs, iNext+1));
    8096 +            /*say 'iNext:' iNext  'sValue:' sValue  'sArgs:' sArgs; */
    8097 +
    8098 +            /* check if we're gonna search for something in an file. */
    8099 +            if (sValue <> '' & pos('#define=', sValue) > 0) then
    8100 +                sValue = LookupDefine(sValue);
    8101 +        end
    8102 +        else
    8103 +        do
    8104 +            say 'syntax error near' substr(sArgs, 1, 2)'.';
    8105 +            call syntax;
    8106 +            exit(3);
    8107 +        end
    8108 +
    8109 +
    8110 +        /* set value */
    8111 +        select
    8112 +            when (ch = 'A') then /* ASD Feature Id */
    8113 +                sASDFeatureId   = sValue;
    8114 +
    8115 +            when (ch = 'C') then /* Country code */
    8116 +                sCountryCode    = sValue;
    8117 +
    8118 +            when (ch = 'D') then /* Description */
    8119 +                sDescription    = sValue;
    8120 +
    8121 +            when (ch = 'H') then /* Hostname */
    8122 +                sHostname       = sValue;
    8123 +
    8124 +            when (ch = 'L') then /* Language code */
    8125 +                sLanguageCode   = sValue;
    8126 +
    8127 +            when (ch = 'M') then /* MiniVer */
    8128 +                sMiniVer        = sValue;
    8129 +
    8130 +            when (ch = 'N') then /* Vendor */
    8131 +                sVendor         = sValue;
    8132 +
    8133 +            when (ch = 'R') then /* Vendor */
    8134 +                sDescription    = ReadDescription(sValue, sDefFile);
    8135 +
    8136 +            when (ch = 'P') then /* Fixpak version */
    8137 +                sFixPakVer      = sValue;
    8138 +
    8139 +            when (ch = 'T') then /* Date Time */
    8140 +                sDateTime       = sValue;
    8141 +
    8142 +            when (ch = 'V') then /* Version */
    8143 +                sVersion        = sValue;
    8144 +
    8145 +            /* Otherwise it's an illegal option */
    8146 +            otherwise:
    8147 +                say 'invalid option:' substr(sArgs, 1, 2);
    8148 +                call syntax;
    8149 +                exit(2);
    8150 +        end /* select */
    8151 +    end
    8152 +    else
    8153 +    do  /*
    8154 +         * Defition file...
    8155 +         */
    8156 +        if (sDefFileOut <> '') then
    8157 +        do
    8158 +            say 'Syntax error: Can''t specify more than two defintion files!';
    8159 +            exit(4);
    8160 +        end
    8161 +        if (sDefFileIn = '') then
    8162 +            parse value sArgs with sDefFileIn' 'sArgs
    8163 +        else
    8164 +            parse value sArgs with sDefFileOut' 'sArgs
    8165 +        sArgs = strip(sArgs);
    8166 +    end
    8167 +end
    8168 +
    8169 +
    8170 +/* check that a defintion file was specified. */
    8171 +if (sDefFileIn = '') then
    8172 +do
    8173 +    say 'Syntax error: Will have to specify a .def-file to update.';
    8174 +    call syntax;
    8175 +    exit(5);
    8176 +end
    8177 +
    8178 +
    8179 +/*
    8180 + * Trim strings to correct lengths.
    8181 + */
    8182 +sVendor         = strip(substr(sVendor, 1, 31));
    8183 +if (substr(sDateTime, 1, 1) <> ' ') then
    8184 +    sDateTime = ' ' || sDateTime;
    8185 +sDateTime       = left(sDateTime, 26);
    8186 +sHostname       = strip(substr(sHostname, 1, 11));
    8187 +sMiniVer        = strip(substr(sMiniVer, 1, 11));
    8188 +sDescription    = strip(substr(sDescription, 1, 80));
    8189 +sCountryCode    = strip(substr(sCountryCode, 1, 4));
    8190 +sLanguageCode   = strip(substr(sLanguageCode, 1, 4));
    8191 +sASDFeatureId   = strip(substr(sASDFeatureId, 1, 11));
    8192 +sFixPakVer      = strip(substr(sFixPakVer, 1, 11));
    8193 +
    8194 +
    8195 +/*
    8196 + * Signature
    8197 + */
    8198 +sEnhSign = '##1##'
    8199 +
    8200 +/*
    8201 + * Build description string.
    8202 + */
    8203 +sDescription =  '@#'sVendor':'sVersion'#@'sEnhSign||,
    8204 +                sDateTime||sHostname||,
    8205 +                ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||,
    8206 +                '::'sFixPakVer'@@'sDescription;
    8207 +
    8208 +/*
    8209 + * Update .def-file.
    8210 + */
    8211 +rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);
    8212 +exit(rc);
    8213 +
    8214 +
    8215 +/**
    8216 + * Display script syntax.
    8217 + */
    8218 +syntax: procedure
    8219 +    say 'Syntax: MakeDesc.cmd [options] <deffile in> <deffile out> [options]'
    8220 +    say '   <deffile>   Defitionfile which will have an DESCRIPTION appended.'
    8221 +    say 'Options:'
    8222 +    say '   -A<string>  ASD Feature Id.'
    8223 +    say '   -C<string>  Country code.'
    8224 +    say '   -D<string>  Description.'
    8225 +    say '   -R[deffile] Read description from .def file.'
    8226 +    say '   -H<string>  Hostname.'
    8227 +    say '   -L<string>  Language code.'
    8228 +    say '   -M<string>  MiniVer.'
    8229 +    say '   -N<string>  Vendor.'
    8230 +    say '   -P<string>  Fixpak version.'
    8231 +    say '   -T<string>  Date Time.'
    8232 +    say '   -V<string>  Version.'
    8233 +    say '<string> could be a double qoute qouted string or a single word.'
    8234 +    say '       You could also reference #defines in C/C++ include files.'
    8235 +    say '       The string should then have this form:'
    8236 +    say '           "#define=<DEFINE_NAME>,<includefile.h>"'
    8237 +    say '';
    8238 +
    8239 +    return;
    8240 +
    8241 +
    8242 +/**
    8243 + * Search for a #define in an C/C++ header or source file.
    8244 + *
    8245 + * @returns String containing the defined value
    8246 + *          found for the define in the header file.
    8247 + *          Quits on fatal errors.
    8248 + * @param   A string on the form: "#define=DEFINETOFIND,includefile.h"
    8249 + * @remark  Write only code... - let's hope it works.
    8250 + */
    8251 +LookupDefine: procedure
    8252 +    parse arg '#'sDefine'='sMacro','sIncludeFile
    8253 +
    8254 +    /*
    8255 +     * Validate parameters.
    8256 +     */
    8257 +    sMacro = strip(sMacro);
    8258 +    sIncludeFile = strip(sIncludeFile);
    8259 +    if (sMacro = '') then
    8260 +    do
    8261 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    8262 +        say '    <DEFINE_NAME> was empty.';
    8263 +        exit(-20);
    8264 +    end
    8265 +    if (sIncludeFile = '') then
    8266 +    do
    8267 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    8268 +        say '    <includefile.h> was empty.';
    8269 +        exit(-20);
    8270 +    end
    8271 +
    8272 +
    8273 +    sIllegal = translate(translate(sMacro),,
    8274 +                         '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',,
    8275 +                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_');
    8276 +
    8277 +    if (strip(translate(sIllegal, ' ', '!')) <> '') then
    8278 +    do
    8279 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    8280 +        say '    <DEFINE_NAME> contains illegal charater(s).'
    8281 +        say '        'sMacro;
    8282 +        say '        'translate(sIllegal, ' ', '!');
    8283 +        exit(-20);
    8284 +    end
    8285 +
    8286 +    /*
    8287 +     * Open include file.
    8288 +     */
    8289 +    sRc = stream(sIncludeFile, 'c', 'open read');
    8290 +    if (pos('READY', sRc) <> 1) then
    8291 +    do  /* search INCLUDE variable */
    8292 +        sFile = SysSearchPath('INCLUDE', sIncludeFile);
    8293 +        if (sFile = '') then
    8294 +        do
    8295 +            say 'Can''t find include file 'sIncludeFile'.';
    8296 +            exit(-20);
    8297 +        end
    8298 +        sIncludeFile = sFile;
    8299 +
    8300 +        sRc = stream(sIncludeFile, 'c', 'open read');
    8301 +        if (pos('READY', sRc) <> 1) then
    8302 +        do
    8303 +            say 'Failed to open include file' sIncludeFile'.';
    8304 +            exit(-20);
    8305 +        end
    8306 +    end
    8307 +
    8308 +    /*
    8309 +     * Search the file line by line.
    8310 +     *  We'll check for lines starting with a hash (#) char.
    8311 +     *  Then check that the word after the hash is 'define'.
    8312 +     *  Then match the next word with the macro name.
    8313 +     *  Then then get the next rest of the line to comment or continuation char.
    8314 +     *      (continuation is not supported)
    8315 +     *  Finally strip quotes.
    8316 +     */
    8317 +    sValue = '';
    8318 +    do while (lines(sIncludeFile) > 0)
    8319 +        sLine = strip(linein(sIncludeFile));
    8320 +        if (sLine = '') then
    8321 +            iterate;
    8322 +        if (substr(sLine, 1, 1) <> '#') then
    8323 +            iterate;
    8324 +        sLine = substr(sLine, 2);
    8325 +        if (word(sLine, 1) <> 'define') then
    8326 +            iterate;
    8327 +        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1));
    8328 +        if (  substr(sLine, 1, length(sMacro)) <> sMacro,
    8329 +            | substr(sLine, length(sMacro)+1, 1) <> ' ') then
    8330 +            iterate;
    8331 +        sLine = strip(substr(sLine, length(sMacro) + 1));
    8332 +        if (sLine = '') then
    8333 +        do
    8334 +            say 'error: #define' sMacro' is empty.';
    8335 +            call stream sIncludeFile, 'c', 'close';
    8336 +            exit(-20);
    8337 +        end
    8338 +
    8339 +        chQuote = substr(sLine, 1, 1);
    8340 +        if (chQuote = '"' | chQuote = "'") then
    8341 +        do  /* quoted string */
    8342 +            iLastQuote = 0;
    8343 +            do forever
    8344 +                iLast = pos(chQuote, sLine, 2);
    8345 +                if (iLast <= 0) then
    8346 +                    leave;
    8347 +                if (substr(sLine, iLast, 1) = '\') then
    8348 +                    iterate;
    8349 +                iLastQuote = iLast;
    8350 +                leave;
    8351 +            end
    8352 +
    8353 +            if (iLastQuote <= 0) then
    8354 +            do
    8355 +                say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.';
    8356 +                call stream sIncludeFile, 'c', 'close';
    8357 +                exit(-20);
    8358 +            end
    8359 +
    8360 +            call stream sIncludeFile, 'c', 'close';
    8361 +            sValue = substr(sLine, 2, iLastQuote - 2);
    8362 +            say 'Found 'sMacro'='sValue;
    8363 +            return sValue;
    8364 +        end
    8365 +        else
    8366 +        do
    8367 +            iCommentCPP = pos('//',sLine);
    8368 +            iCommentC   = pos('/*',sLine);
    8369 +            if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then
    8370 +                iComment = iCommentCPP;
    8371 +            else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then
    8372 +                iComment = iCommentC;
    8373 +            else if (iCommentCPP > 0) then
    8374 +                iComment = iCommentCPP;
    8375 +            else if (iCommentC > 0) then
    8376 +                iComment = iCommentC;
    8377 +            else
    8378 +                iComment = 0;
    8379 +
    8380 +            if (iComment > 0) then
    8381 +                sValue = strip(substr(sLine, 1, iComment-1));
    8382 +            else
    8383 +                sValue = strip(sLine);
    8384 +
    8385 +            if (sValue <> '') then
    8386 +            do
    8387 +                if (substr(sValue, length(sValue)) = '\') then
    8388 +                do
    8389 +                    say 'Found continuation char: Multiline definitions are not supported!\n';
    8390 +                    call stream sIncludeFile, 'c', 'close';
    8391 +                    exit(-20);
    8392 +                end
    8393 +            end
    8394 +
    8395 +            if (sValue = '') then
    8396 +                say 'warning: The #define has no value.';
    8397 +
    8398 +            call stream sIncludeFile, 'c', 'close';
    8399 +            say 'Found 'sMacro'='sValue;
    8400 +            return sValue;
    8401 +        end
    8402 +    end
    8403 +
    8404 +    call stream sIncludeFile, 'c', 'close';
    8405 +    say 'error: didn''t find #define' sMacro'.';
    8406 +    exit(-20);
    8407 +
    8408 +
    8409 +
    8410 +/**
    8411 + * Reads the description line for a .def-file.
    8412 + * @returns The Description string, with quotes removed.
    8413 + *          Empty string is acceptable.
    8414 + *          On error we'll terminate the script.
    8415 + * @param   sDefFile    Filaname of .def-file to read the description from.
    8416 + * @param   sDefFile2   Used if sDefFile is empty.
    8417 + * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    8418 + */
    8419 +ReadDescription: procedure;
    8420 +    parse arg sDefFile, sDefFile2
    8421 +
    8422 +    /*
    8423 +     * Validate parameters.
    8424 +     */
    8425 +    if (sDefFile = '') then
    8426 +        sDefFile = sDefFile2;
    8427 +    if (sDefFile = '') then
    8428 +    do
    8429 +        say 'error: no definition file to get description from.'
    8430 +        exit(-1);
    8431 +    end
    8432 +
    8433 +    /*
    8434 +     * Open file
    8435 +     */
    8436 +    rc = stream(sDefFile, 'c', 'open read');
    8437 +    if (pos('READY', rc) <> 1) then
    8438 +    do
    8439 +        say 'error: failed to open deffile file.';
    8440 +        exit(-1);
    8441 +    end
    8442 +
    8443 +
    8444 +    /*
    8445 +     * Search for the 'DESCRIPTION' line.
    8446 +     */
    8447 +    do while (lines(sDefFile) > 0)
    8448 +        sLine = strip(linein(sDefFile));
    8449 +        if (sLine = '') then
    8450 +            iterate;
    8451 +        if (translate(word(sLine, 1)) <> 'DESCRIPTION') then
    8452 +            iterate;
    8453 +        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1));
    8454 +
    8455 +        ch = substr(sLine, 1, 1);
    8456 +        if (ch <> "'" & ch <> '"') then
    8457 +        do
    8458 +            say 'syntax error: description line in' sDefFile 'is misformed.';
    8459 +            call stream sDefFile, 'c', 'close';
    8460 +            exit(-10);
    8461 +        end
    8462 +
    8463 +        iEnd = pos(ch, sLine, 2);
    8464 +        if (iEnd <= 0) then
    8465 +        do
    8466 +            say 'syntax error: description line in' sDefFile 'is misformed.';
    8467 +            call stream sDefFile, 'c', 'close';
    8468 +            exit(-10);
    8469 +        end
    8470 +
    8471 +        call stream sDefFile, 'c', 'close';
    8472 +        sValue = substr(sLine, 2, iEnd - 2);
    8473 +        say 'Found Description:' sValue;
    8474 +        return sValue;
    8475 +    end
    8476 +
    8477 +    call stream sDefFile, 'c', 'close';
    8478 +    say 'info: Didn''t find description line in' sDefFile'.';
    8479 +    return '';
    8480 +
    8481 +
    8482 +/**
    8483 + * This is a function which reads sDefFileIn into and
    8484 + * internal array and changes the DESCRIPTION text if found.
    8485 + * If DESCRIPTION isn't found, it is added at the end.
    8486 + * The array is written to sDefFileOut.
    8487 + * @returns 0 on succes.
    8488 + *          Errorcode on error.
    8489 + * @param   sDefFileIn      Input .def-file.
    8490 + * @param   sDefFileOut     Output .def-file. Overwritten.
    8491 + * @param   sDescription    New description string.
    8492 + * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    8493 + */
    8494 +UpdateDefFile: procedure;
    8495 +    parse arg sDefFileIn, sDefFileOut, sDescription
    8496 +
    8497 +    /*
    8498 +     * Validate parameters.
    8499 +     */
    8500 +    if (sDefFileOut = '') then
    8501 +        sDefFileOut = sDefFileIn;
    8502 +
    8503 +    /*
    8504 +     * Open file input file.
    8505 +     */
    8506 +    rc = stream(sDefFileIn, 'c', 'open read');
    8507 +    if (pos('READY', rc) <> 1) then
    8508 +    do
    8509 +        say 'error: failed to open' sDefFileIn 'file.';
    8510 +        return 110;
    8511 +    end
    8512 +
    8513 +
    8514 +    /*
    8515 +     * Search for the 'DESCRIPTION' line.
    8516 +     */
    8517 +    i = 0;
    8518 +    fDescription = 0;
    8519 +    do while (lines(sDefFileIn) > 0)
    8520 +        /*
    8521 +         * Read line.
    8522 +         */
    8523 +        i = i + 1;
    8524 +        asFile.i = strip(linein(sDefFileIn));
    8525 +
    8526 +        /*
    8527 +         * Look for DESCRIPTION;
    8528 +         */
    8529 +        if (asFile.i = '') then
    8530 +            iterate;
    8531 +        if (translate(word(asFile.i, 1)) <> 'DESCRIPTION') then
    8532 +            iterate;
    8533 +        if (fDescription) then
    8534 +        do
    8535 +            say 'warning: multiple descriptions lines. Line' i 'removed';
    8536 +            i = i - 1;
    8537 +            iterate;
    8538 +        end
    8539 +
    8540 +        /*
    8541 +         * Found description - replace with new description.
    8542 +         */
    8543 +        asFile.i = "DESCRIPTION '"||sDescription||"'";
    8544 +        fDescription = 1;
    8545 +    end
    8546 +
    8547 +    /*
    8548 +     * Add description is none was found.
    8549 +     */
    8550 +    if (\fDescription) then
    8551 +    do
    8552 +        i = i + 1;
    8553 +        asFile.i = "DESCRIPTION '"||sDescription||"'";
    8554 +    end
    8555 +    asFile.0 = i;
    8556 +
    8557 +
    8558 +    /*
    8559 +     * Close input file and open output file.
    8560 +     */
    8561 +    call stream sDefFileIn, 'c', 'close';
    8562 +    call SysFileDelete(sDefFileOut);
    8563 +    rc = stream(sDefFileOut, 'c', 'open write');
    8564 +    if (pos('READY', rc) <> 1) then
    8565 +    do
    8566 +        say 'error: failed to open outputfile' sDefFileOut 'file.';
    8567 +        return 110;
    8568 +    end
    8569 +
    8570 +    /*
    8571 +     * Make firstline and write all the lines to the output file.
    8572 +     */
    8573 +    call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;
    8574 +    do i = 1 to asFile.0
    8575 +        rc = lineout(sDefFileOut, asFile.i);
    8576 +        if (rc > 0) then
    8577 +        do
    8578 +            say 'error: failed to write line' i 'to' sDefFileOut'.'
    8579 +            call stream sDefFileOut, 'c', 'close';
    8580 +            return 5;
    8581 +        end
    8582 +    end
    8583 +
    8584 +    /*
    8585 +     * Close output file and return succesfully.
    8586 +     */
    8587 +    call stream sDefFileOut, 'c', 'close';
    8588 +    return 0;
    8589 +
    8590 diff --git a/src/win32k/rexx/tst.cmd b/src/win32k/rexx/tst.cmd
    8591 index c0ef743..6036c3a 100644
    8592 --- a/src/win32k/rexx/tst.cmd
    8593 +++ b/src/win32k/rexx/tst.cmd
    8594 @@ -1,9 +1,9 @@
    8595 -/* rexx */
    8596 -
    8597 -    parse source sSource;
    8598 -    parse arg sArgs
    8599 -    say 'parse source:' sSource
    8600 -    say 'parse arg   :' sArgs
    8601 -    say 'exit rc     :' 1;
    8602 -    exit(1);
    8603 -
    8604 +/* rexx */
    8605 +
    8606 +    parse source sSource;
    8607 +    parse arg sArgs
    8608 +    say 'parse source:' sSource
    8609 +    say 'parse arg   :' sArgs
    8610 +    say 'exit rc     :' 1;
    8611 +    exit(1);
    8612 +
    8613 diff --git a/src/win32k/test/TestKernels.cmd b/src/win32k/test/TestKernels.cmd
    8614 index 5d9bed9..9e72ca3 100644
    8615 --- a/src/win32k/test/TestKernels.cmd
    8616 +++ b/src/win32k/test/TestKernels.cmd
    8617 @@ -1,141 +1,141 @@
    8618 -/* $Id: TestKernels.cmd,v 1.4 2002-12-06 02:58:57 bird Exp $
    8619 - *
    8620 - * This script loops thru a set of different kernels running testcase 1.
    8621 - * Note: The kernels and symbols files are in a single directory
    8622 - *      Name format
    8623 - *      nnnn[n]bk[.SYM]
    8624 - *
    8625 - *  nnnn[n]     Build number. (4 or 5 digits). (ex. 9036)
    8626 - *  b           Build type: A - allstrict; H - halfstrict; R - retail (GA)
    8627 - *  k           Kernel type: U - uniprocess; S - smp; 4 - warp 4 fixpack 13+
    8628 - *  [.SYM]      Kernel files has no extention while the symbol files has .SYM.
    8629 - */
    8630 -
    8631 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    8632 -    call SysLoadFuncs;
    8633 -
    8634 -    parse arg sDir sdummy
    8635 -    if (sDir = '' | sDir = '-?' | sDir = '/?' | sDir = '-h' | sDir = '-H' | sDir  = '/h' | sDir = '/H' | sDir = '--help') then
    8636 -    do
    8637 -        call syntax;
    8638 -        exit -1;
    8639 -    end
    8640 -
    8641 -    /*
    8642 -     * Read directory
    8643 -     */
    8644 -    rc = SysFileTree(sDir'\*', 'asFiles', 'FO');
    8645 -    if (rc <> 0) then
    8646 -    do
    8647 -        say 'SysFileTree failed with rc='rc'.';
    8648 -        exit -2;
    8649 -    end
    8650 -    if (asFiles.0 <= 0) then
    8651 -    do
    8652 -        say 'No files found';
    8653 -        exit -3;
    8654 -    end
    8655 -
    8656 -    iRetCode = 0;
    8657 -    do i = 1 to asFiles.0
    8658 -        /*
    8659 -         * Interpret name (get build no., kernel type and build type).
    8660 -         */
    8661 -        sName = translate(filespec('name', asFiles.i));
    8662 -        if (lastpos('.', sName) > 0) then
    8663 -        do
    8664 -            sExt = substr(sName, lastpos('.', sName) + 1);
    8665 -            sName = substr(sName, 1, lastpos('.', sName) - 1);
    8666 -        end
    8667 -        else
    8668 -            sExt = '';
    8669 -
    8670 -        if (sExt <> '') then
    8671 -            iterate
    8672 -
    8673 -        if (substr(sName, 5, 1) <= '9') then    cchBuild = 5;
    8674 -        else                                    cchBuild = 4;
    8675 -        iBuild = substr(sName, 1, cchBuild);
    8676 -        chBuildType = substr(sName, cchBuild + 1, 1);
    8677 -        chKernelType = substr(sName, cchBuild + 2, 1);
    8678 -        chRev = substr(sName, cchBuild + 3, 1);
    8679 -
    8680 -        /*
    8681 -         * Validate name.
    8682 -         */
    8683 -        do j = 1 to length(iBuild)
    8684 -            if (substr(iBuild, j, 1) < '0' | substr(iBuild, j, 1) > '9') then
    8685 -            do
    8686 -                j = -1;
    8687 -                leave;
    8688 -            end
    8689 -        end
    8690 -        if (j = -1) then
    8691 -            iterate;
    8692 -
    8693 -        if (chBuildType <> 'A' & chBuildType <> 'H' & chBuildType <> 'R' & chBuildType <> 'B') then
    8694 -        do
    8695 -            say 'invalid build type char:' chBuildType '('asFiles.i')';
    8696 -            exit -4;
    8697 -        end
    8698 -
    8699 -        if (chKernelType <> 'U' & chKernelType <> 'S' & chKernelType <> '4') then
    8700 -        do
    8701 -            say 'invalid kernel type char:' chKernelType '('asFiles.i')';
    8702 -            exit -4;
    8703 -        end
    8704 -
    8705 -        /*
    8706 -         * Determin version number (based on build number).
    8707 -         */
    8708 -        iVerMajor = 2;
    8709 -        if (iBuild >= 14000) then
    8710 -            iVerMinor = 45;
    8711 -        else if (iBuild >= 9000) then
    8712 -            iVerMinor = 40;
    8713 -        else if (iBuild >= 8000) then
    8714 -            iVerMinor = 30;
    8715 -        else if (iBuild >= 6200) then
    8716 -            iVerMinor = 21;
    8717 -        else
    8718 -        do
    8719 -            say 'unsupported build number:' iBuild '('asFiles.i')';
    8720 -            exit(-5);
    8721 -        end
    8722 -
    8723 -        /*
    8724 -         * Process it
    8725 -         */
    8726 -        say;
    8727 -        say;
    8728 -        say 'Processing' asFiles.i'....';
    8729 -        if (chBuildType = 'R') then
    8730 -        do
    8731 -            sCmd = 'win32ktst.exe 1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev ;
    8732 -            say sCmd;
    8733 -            sCmd;
    8734 -            if (rc = 0) then
    8735 -                iterate;
    8736 -        end
    8737 -        sCmd = 'win32ktst.exe 1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev asFiles.i||'.SYM';
    8738 -        say sCmd;
    8739 -        sCmd;
    8740 -        if (rc <> 0) then
    8741 -        do
    8742 -            say 'failed... rc='rc;
    8743 -            exit rc;
    8744 -        end
    8745 -
    8746 -    end
    8747 -
    8748 -    exit(0);
    8749 -
    8750 -
    8751 -
    8752 -
    8753 -/*
    8754 - * Write syntax:
    8755 - */
    8756 -syntax: procedure;
    8757 -    say 'TestKernels.cmd <kernel-directory>';
    8758 +/* $Id: TestKernels.cmd,v 1.4 2002-12-06 02:58:57 bird Exp $
    8759 + *
    8760 + * This script loops thru a set of different kernels running testcase 1.
    8761 + * Note: The kernels and symbols files are in a single directory
    8762 + *      Name format
    8763 + *      nnnn[n]bk[.SYM]
    8764 + *
    8765 + *  nnnn[n]     Build number. (4 or 5 digits). (ex. 9036)
    8766 + *  b           Build type: A - allstrict; H - halfstrict; R - retail (GA)
    8767 + *  k           Kernel type: U - uniprocess; S - smp; 4 - warp 4 fixpack 13+
    8768 + *  [.SYM]      Kernel files has no extention while the symbol files has .SYM.
    8769 + */
    8770 +
    8771 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    8772 +    call SysLoadFuncs;
    8773 +
    8774 +    parse arg sDir sdummy
    8775 +    if (sDir = '' | sDir = '-?' | sDir = '/?' | sDir = '-h' | sDir = '-H' | sDir  = '/h' | sDir = '/H' | sDir = '--help') then
    8776 +    do
    8777 +        call syntax;
    8778 +        exit -1;
    8779 +    end
    8780 +
    8781 +    /*
    8782 +     * Read directory
    8783 +     */
    8784 +    rc = SysFileTree(sDir'\*', 'asFiles', 'FO');
    8785 +    if (rc <> 0) then
    8786 +    do
    8787 +        say 'SysFileTree failed with rc='rc'.';
    8788 +        exit -2;
    8789 +    end
    8790 +    if (asFiles.0 <= 0) then
    8791 +    do
    8792 +        say 'No files found';
    8793 +        exit -3;
    8794 +    end
    8795 +
    8796 +    iRetCode = 0;
    8797 +    do i = 1 to asFiles.0
    8798 +        /*
    8799 +         * Interpret name (get build no., kernel type and build type).
    8800 +         */
    8801 +        sName = translate(filespec('name', asFiles.i));
    8802 +        if (lastpos('.', sName) > 0) then
    8803 +        do
    8804 +            sExt = substr(sName, lastpos('.', sName) + 1);
    8805 +            sName = substr(sName, 1, lastpos('.', sName) - 1);
    8806 +        end
    8807 +        else
    8808 +            sExt = '';
    8809 +
    8810 +        if (sExt <> '') then
    8811 +            iterate
    8812 +
    8813 +        if (substr(sName, 5, 1) <= '9') then    cchBuild = 5;
    8814 +        else                                    cchBuild = 4;
    8815 +        iBuild = substr(sName, 1, cchBuild);
    8816 +        chBuildType = substr(sName, cchBuild + 1, 1);
    8817 +        chKernelType = substr(sName, cchBuild + 2, 1);
    8818 +        chRev = substr(sName, cchBuild + 3, 1);
    8819 +
    8820 +        /*
    8821 +         * Validate name.
    8822 +         */
    8823 +        do j = 1 to length(iBuild)
    8824 +            if (substr(iBuild, j, 1) < '0' | substr(iBuild, j, 1) > '9') then
    8825 +            do
    8826 +                j = -1;
    8827 +                leave;
    8828 +            end
    8829 +        end
    8830 +        if (j = -1) then
    8831 +            iterate;
    8832 +
    8833 +        if (chBuildType <> 'A' & chBuildType <> 'H' & chBuildType <> 'R' & chBuildType <> 'B') then
    8834 +        do
    8835 +            say 'invalid build type char:' chBuildType '('asFiles.i')';
    8836 +            exit -4;
    8837 +        end
    8838 +
    8839 +        if (chKernelType <> 'U' & chKernelType <> 'S' & chKernelType <> '4') then
    8840 +        do
    8841 +            say 'invalid kernel type char:' chKernelType '('asFiles.i')';
    8842 +            exit -4;
    8843 +        end
    8844 +
    8845 +        /*
    8846 +         * Determin version number (based on build number).
    8847 +         */
    8848 +        iVerMajor = 2;
    8849 +        if (iBuild >= 14000) then
    8850 +            iVerMinor = 45;
    8851 +        else if (iBuild >= 9000) then
    8852 +            iVerMinor = 40;
    8853 +        else if (iBuild >= 8000) then
    8854 +            iVerMinor = 30;
    8855 +        else if (iBuild >= 6200) then
    8856 +            iVerMinor = 21;
    8857 +        else
    8858 +        do
    8859 +            say 'unsupported build number:' iBuild '('asFiles.i')';
    8860 +            exit(-5);
    8861 +        end
    8862 +
    8863 +        /*
    8864 +         * Process it
    8865 +         */
    8866 +        say;
    8867 +        say;
    8868 +        say 'Processing' asFiles.i'....';
    8869 +        if (chBuildType = 'R') then
    8870 +        do
    8871 +            sCmd = 'win32ktst.exe 1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev ;
    8872 +            say sCmd;
    8873 +            sCmd;
    8874 +            if (rc = 0) then
    8875 +                iterate;
    8876 +        end
    8877 +        sCmd = 'win32ktst.exe 1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev asFiles.i||'.SYM';
    8878 +        say sCmd;
    8879 +        sCmd;
    8880 +        if (rc <> 0) then
    8881 +        do
    8882 +            say 'failed... rc='rc;
    8883 +            exit rc;
    8884 +        end
    8885 +
    8886 +    end
    8887 +
    8888 +    exit(0);
    8889 +
    8890 +
    8891 +
    8892 +
    8893 +/*
    8894 + * Write syntax:
    8895 + */
    8896 +syntax: procedure;
    8897 +    say 'TestKernels.cmd <kernel-directory>';
    8898      return;
    8899 \ No newline at end of file
    8900 diff --git a/src/winmm/Makefile.kmk b/src/winmm/Makefile.kmk
    8901 index 8f3849c..d00dada 100644
    8902 --- a/src/winmm/Makefile.kmk
    8903 +++ b/src/winmm/Makefile.kmk
    8904 @@ -1,59 +1,59 @@
    8905 -## @file
    8906 -# WINMM and supplemental libraries
    8907 -#
    8908 -
    8909 -SUB_DEPTH = ../..
    8910 -include $(KBUILD_PATH)/subheader.kmk
    8911 -
    8912 -#
    8913 -# Include sub-makefiles.
    8914 -#
    8915 -include $(PATH_SUB_CURRENT)/mcicda/Makefile.kmk
    8916 -include $(PATH_SUB_CURRENT)/mciwave/Makefile.kmk
    8917 -
    8918 -$(call odin_implib_2,winmm)
    8919 -
    8920 -DLLS               += winmm
    8921 -winmm_TEMPLATE      = OdinDLL
    8922 -
    8923 -winmm_SOURCES       = \
    8924 -    os2timer.cpp \
    8925 -    waveout.cpp \
    8926 -    waveoutdart.cpp \
    8927 -    waveoutbase.cpp \
    8928 -    waveinoutbase.cpp \
    8929 -    waveoutdaud.cpp \
    8930 -    waveindart.cpp \
    8931 -    wavein.cpp \
    8932 -    time.cpp \
    8933 -    auxiliary.cpp \
    8934 -    auxos2.cpp \
    8935 -    mixer.cpp \
    8936 -    mixeros2.cpp \
    8937 -    mixerdata.cpp \
    8938 -    midi.cpp \
    8939 -    irtmidi.cpp \
    8940 -    midistrm.cpp \
    8941 -    mci.cpp \
    8942 -    joy.cpp \
    8943 -    mmio.cpp \
    8944 -    driver.c \
    8945 -    playsound.cpp \
    8946 -    joyos2.cpp \
    8947 -    waveoutflash.cpp \
    8948 -    dbglocal.cpp \
    8949 -    initterm.cpp \
    8950 -    winmmrsrc.orc
    8951 -
    8952 -winmm_SOURCES.release += \
    8953 -    winmm.def
    8954 -winmm_SOURCES.debug += \
    8955 -    dbgwrap.cpp \
    8956 -    winmmdbg.def
    8957 -
    8958 -winmm_LIBS          = \
    8959 -    $(PATH_STAGE_LIB)/libwrap.lib \
    8960 -    $(PATH_STAGE_LIB)/kernel32.lib \
    8961 -    $(PATH_STAGE_LIB)/user32.lib
    8962 -
    8963 -include $(FILE_KBUILD_SUB_FOOTER)
    8964 +## @file
    8965 +# WINMM and supplemental libraries
    8966 +#
    8967 +
    8968 +SUB_DEPTH = ../..
    8969 +include $(KBUILD_PATH)/subheader.kmk
    8970 +
    8971 +#
    8972 +# Include sub-makefiles.
    8973 +#
    8974 +include $(PATH_SUB_CURRENT)/mcicda/Makefile.kmk
    8975 +include $(PATH_SUB_CURRENT)/mciwave/Makefile.kmk
    8976 +
    8977 +$(call odin_implib_2,winmm)
    8978 +
    8979 +DLLS               += winmm
    8980 +winmm_TEMPLATE      = OdinDLL
    8981 +
    8982 +winmm_SOURCES       = \
    8983 +    os2timer.cpp \
    8984 +    waveout.cpp \
    8985 +    waveoutdart.cpp \
    8986 +    waveoutbase.cpp \
    8987 +    waveinoutbase.cpp \
    8988 +    waveoutdaud.cpp \
    8989 +    waveindart.cpp \
    8990 +    wavein.cpp \
    8991 +    time.cpp \
    8992 +    auxiliary.cpp \
    8993 +    auxos2.cpp \
    8994 +    mixer.cpp \
    8995 +    mixeros2.cpp \
    8996 +    mixerdata.cpp \
    8997 +    midi.cpp \
    8998 +    irtmidi.cpp \
    8999 +    midistrm.cpp \
    9000 +    mci.cpp \
    9001 +    joy.cpp \
    9002 +    mmio.cpp \
    9003 +    driver.c \
    9004 +    playsound.cpp \
    9005 +    joyos2.cpp \
    9006 +    waveoutflash.cpp \
    9007 +    dbglocal.cpp \
    9008 +    initterm.cpp \
    9009 +    winmmrsrc.orc
    9010 +
    9011 +winmm_SOURCES.release += \
    9012 +    winmm.def
    9013 +winmm_SOURCES.debug += \
    9014 +    dbgwrap.cpp \
    9015 +    winmmdbg.def
    9016 +
    9017 +winmm_LIBS          = \
    9018 +    $(PATH_STAGE_LIB)/libwrap.lib \
    9019 +    $(PATH_STAGE_LIB)/kernel32.lib \
    9020 +    $(PATH_STAGE_LIB)/user32.lib
    9021 +
    9022 +include $(FILE_KBUILD_SUB_FOOTER)
    9023 diff --git a/src/winmm/mciwave/Makefile.kmk b/src/winmm/mciwave/Makefile.kmk
    9024 index 429710e..c35e8f3 100644
    9025 --- a/src/winmm/mciwave/Makefile.kmk
    9026 +++ b/src/winmm/mciwave/Makefile.kmk
    9027 @@ -1,24 +1,24 @@
    9028 -## @file
    9029 -# MCIWAVE library
    9030 -#
    9031 -
    9032 -SUB_DEPTH = ../../..
    9033 -include $(KBUILD_PATH)/subheader.kmk
    9034 -
    9035 -$(call odin_implib,mciwave)
    9036 -
    9037 -DLLS               += mciwave
    9038 -mciwave_TEMPLATE    = OdinSimpleDLL
    9039 -
    9040 -mciwave_SOURCES     = \
    9041 -    mciwave.c \
    9042 -    mciwaversrc.orc \
    9043 -    mciwave.def
    9044 -
    9045 -mciwave_LIBS        = \
    9046 -    $(PATH_STAGE_LIB)/libwrap.lib \
    9047 -    $(PATH_STAGE_LIB)/kernel32.lib \
    9048 -    $(PATH_STAGE_LIB)/user32.lib \
    9049 -    $(PATH_STAGE_LIB)/winmm.lib
    9050 -
    9051 -include $(FILE_KBUILD_SUB_FOOTER)
    9052 +## @file
    9053 +# MCIWAVE library
    9054 +#
    9055 +
    9056 +SUB_DEPTH = ../../..
    9057 +include $(KBUILD_PATH)/subheader.kmk
    9058 +
    9059 +$(call odin_implib,mciwave)
    9060 +
    9061 +DLLS               += mciwave
    9062 +mciwave_TEMPLATE    = OdinSimpleDLL
    9063 +
    9064 +mciwave_SOURCES     = \
    9065 +    mciwave.c \
    9066 +    mciwaversrc.orc \
    9067 +    mciwave.def
    9068 +
    9069 +mciwave_LIBS        = \
    9070 +    $(PATH_STAGE_LIB)/libwrap.lib \
    9071 +    $(PATH_STAGE_LIB)/kernel32.lib \
    9072 +    $(PATH_STAGE_LIB)/user32.lib \
    9073 +    $(PATH_STAGE_LIB)/winmm.lib
    9074 +
    9075 +include $(FILE_KBUILD_SUB_FOOTER)
    9076 diff --git a/testapp/encodings/Makefile.kmk b/testapp/encodings/Makefile.kmk
    9077 index 1ff8c54..60316a3 100644
    9078 --- a/testapp/encodings/Makefile.kmk
    9079 +++ b/testapp/encodings/Makefile.kmk
    9080 @@ -1,17 +1,17 @@
    9081 -## @file
    9082 -#
    9083 -
    9084 -SUB_DEPTH = ../..
    9085 -include $(KBUILD_PATH)/subheader.kmk
    9086 -
    9087 -PROGRAMS           += encodings
    9088 -encodings_TEMPLATE  = OdinTestApp
    9089 -
    9090 -encodings_SOURCES   = \
    9091 -    test.c
    9092 -
    9093 -encodings_LIBS      = \
    9094 -    $(PATH_STAGE_LIB)/kernel32.lib \
    9095 -    $(PATH_STAGE_LIB)/user32.lib
    9096 -
    9097 -include $(FILE_KBUILD_SUB_FOOTER)
    9098 +## @file
    9099 +#
    9100 +
    9101 +SUB_DEPTH = ../..
    9102 +include $(KBUILD_PATH)/subheader.kmk
    9103 +
    9104 +PROGRAMS           += encodings
    9105 +encodings_TEMPLATE  = OdinTestApp
    9106 +
    9107 +encodings_SOURCES   = \
    9108 +    test.c
    9109 +
    9110 +encodings_LIBS      = \
    9111 +    $(PATH_STAGE_LIB)/kernel32.lib \
    9112 +    $(PATH_STAGE_LIB)/user32.lib
    9113 +
    9114 +include $(FILE_KBUILD_SUB_FOOTER)
    9115 diff --git a/testapp/exceptions/GuardPages/Makefile.kmk b/testapp/exceptions/GuardPages/Makefile.kmk
    9116 index c6196df..137c2c1 100644
    9117 --- a/testapp/exceptions/GuardPages/Makefile.kmk
    9118 +++ b/testapp/exceptions/GuardPages/Makefile.kmk
    9119 @@ -1,12 +1,12 @@
    9120 -## @file
    9121 -#
    9122 -
    9123 -SUB_DEPTH = ../../..
    9124 -include $(KBUILD_PATH)/subheader.kmk
    9125 -
    9126 -PROGRAMS               += GuardPages
    9127 -GuardPages_TEMPLATE     = OdinTestApp
    9128 -GuardPages_SOURCES      = main.cpp
    9129 -GuardPages_LIBS         = $(PATH_STAGE_LIB)/kernel32.lib
    9130 -
    9131 -include $(FILE_KBUILD_SUB_FOOTER)
    9132 +## @file
    9133 +#
    9134 +
    9135 +SUB_DEPTH = ../../..
    9136 +include $(KBUILD_PATH)/subheader.kmk
    9137 +
    9138 +PROGRAMS               += GuardPages
    9139 +GuardPages_TEMPLATE     = OdinTestApp
    9140 +GuardPages_SOURCES      = main.cpp
    9141 +GuardPages_LIBS         = $(PATH_STAGE_LIB)/kernel32.lib
    9142 +
    9143 +include $(FILE_KBUILD_SUB_FOOTER)
    9144 diff --git a/testapp/gui/fileopen/Makefile.kmk b/testapp/gui/fileopen/Makefile.kmk
    9145 index 3c0731a..a9c392f 100644
    9146 --- a/testapp/gui/fileopen/Makefile.kmk
    9147 +++ b/testapp/gui/fileopen/Makefile.kmk
    9148 @@ -1,20 +1,20 @@
    9149 -## @file
    9150 -#
    9151 -
    9152 -SUB_DEPTH = ../../..
    9153 -include $(KBUILD_PATH)/subheader.kmk
    9154 -
    9155 -PROGRAMS           += fileopen
    9156 -fileopen_TEMPLATE   = OdinTestApp
    9157 -
    9158 -fileopen_SOURCES    = \
    9159 -    fileopen.cpp
    9160 -
    9161 -fileopen_DEFS       = UNICODE
    9162 -
    9163 -fileopen_LIBS       = \
    9164 -    $(PATH_STAGE_LIB)/kernel32.lib \
    9165 -    $(PATH_STAGE_LIB)/comdlg32.lib \
    9166 -    $(PATH_STAGE_LIB)/user32.lib
    9167 -
    9168 -include $(FILE_KBUILD_SUB_FOOTER)
    9169 +## @file
    9170 +#
    9171 +
    9172 +SUB_DEPTH = ../../..
    9173 +include $(KBUILD_PATH)/subheader.kmk
    9174 +
    9175 +PROGRAMS           += fileopen
    9176 +fileopen_TEMPLATE   = OdinTestApp
    9177 +
    9178 +fileopen_SOURCES    = \
    9179 +    fileopen.cpp
    9180 +
    9181 +fileopen_DEFS       = UNICODE
    9182 +
    9183 +fileopen_LIBS       = \
    9184 +    $(PATH_STAGE_LIB)/kernel32.lib \
    9185 +    $(PATH_STAGE_LIB)/comdlg32.lib \
    9186 +    $(PATH_STAGE_LIB)/user32.lib
    9187 +
    9188 +include $(FILE_KBUILD_SUB_FOOTER)
    9189 diff --git a/testapp/gui/input/Makefile.kmk b/testapp/gui/input/Makefile.kmk
    9190 index c9719e7..4fc24e6 100644
    9191 --- a/testapp/gui/input/Makefile.kmk
    9192 +++ b/testapp/gui/input/Makefile.kmk
    9193 @@ -1,20 +1,20 @@
    9194 -## @file
    9195 -#
    9196 -
    9197 -SUB_DEPTH = ../../..
    9198 -include $(KBUILD_PATH)/subheader.kmk
    9199 -
    9200 -PROGRAMS           += input_a
    9201 -input_a_TEMPLATE    = OdinTestApp
    9202 -input_a_SOURCES     = input.c
    9203 -input_a_LIBS        = $(PATH_STAGE_LIB)/kernel32.lib \
    9204 -                      $(PATH_STAGE_LIB)/user32.lib \
    9205 -                      $(PATH_STAGE_LIB)/comctl32.lib
    9206 -
    9207 -PROGRAMS           += input_w
    9208 -input_w_TEMPLATE    = OdinTestApp
    9209 -input_w_DEFS        = UNICODE
    9210 -input_w_SOURCES     = $(input_a_SOURCES)
    9211 -input_w_LIBS        = $(input_a_LIBS)
    9212 -
    9213 -include $(FILE_KBUILD_SUB_FOOTER)
    9214 +## @file
    9215 +#
    9216 +
    9217 +SUB_DEPTH = ../../..
    9218 +include $(KBUILD_PATH)/subheader.kmk
    9219 +
    9220 +PROGRAMS           += input_a
    9221 +input_a_TEMPLATE    = OdinTestApp
    9222 +input_a_SOURCES     = input.c
    9223 +input_a_LIBS        = $(PATH_STAGE_LIB)/kernel32.lib \
    9224 +                      $(PATH_STAGE_LIB)/user32.lib \
    9225 +                      $(PATH_STAGE_LIB)/comctl32.lib
    9226 +
    9227 +PROGRAMS           += input_w
    9228 +input_w_TEMPLATE    = OdinTestApp
    9229 +input_w_DEFS        = UNICODE
    9230 +input_w_SOURCES     = $(input_a_SOURCES)
    9231 +input_w_LIBS        = $(input_a_LIBS)
    9232 +
    9233 +include $(FILE_KBUILD_SUB_FOOTER)
    9234 diff --git a/testapp/gui/systray/Makefile.kmk b/testapp/gui/systray/Makefile.kmk
    9235 index 5c8635f..9a7a1e8 100644
    9236 --- a/testapp/gui/systray/Makefile.kmk
    9237 +++ b/testapp/gui/systray/Makefile.kmk
    9238 @@ -1,16 +1,16 @@
    9239 -## @file
    9240 -#
    9241 -
    9242 -SUB_DEPTH = ../../..
    9243 -include $(KBUILD_PATH)/subheader.kmk
    9244 -
    9245 -PROGRAMS               += StealthDialog
    9246 -StealthDialog_TEMPLATE  = OdinTestApp
    9247 -StealthDialog_SOURCES   = StealthDialog.cpp StealthDialog.orc
    9248 -
    9249 -StealthDialog_LIBS      = $(PATH_STAGE_LIB)/kernel32.lib \
    9250 -                          $(PATH_STAGE_LIB)/user32.lib \
    9251 -                          $(PATH_STAGE_LIB)/comctl32.lib \
    9252 -                          $(PATH_STAGE_LIB)/shell32.lib
    9253 -
    9254 -include $(FILE_KBUILD_SUB_FOOTER)
    9255 +## @file
    9256 +#
    9257 +
    9258 +SUB_DEPTH = ../../..
    9259 +include $(KBUILD_PATH)/subheader.kmk
    9260 +
    9261 +PROGRAMS               += StealthDialog
    9262 +StealthDialog_TEMPLATE  = OdinTestApp
    9263 +StealthDialog_SOURCES   = StealthDialog.cpp StealthDialog.orc
    9264 +
    9265 +StealthDialog_LIBS      = $(PATH_STAGE_LIB)/kernel32.lib \
    9266 +                          $(PATH_STAGE_LIB)/user32.lib \
    9267 +                          $(PATH_STAGE_LIB)/comctl32.lib \
    9268 +                          $(PATH_STAGE_LIB)/shell32.lib
    9269 +
    9270 +include $(FILE_KBUILD_SUB_FOOTER)
    9271 diff --git a/tools/DailyBuild/job.cmd b/tools/DailyBuild/job.cmd
    9272 index 09fef4f..d215d5e 100644
    9273 --- a/tools/DailyBuild/job.cmd
    9274 +++ b/tools/DailyBuild/job.cmd
    9275 @@ -1,181 +1,181 @@
    9276 -/* $Id: job.cmd,v 1.11 2003-08-05 00:16:17 bird Exp $
    9277 - *
    9278 - * Main job for building OS/2.
    9279 - *
    9280 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    9281 - *
    9282 - * Project Odin Software License can be found in LICENSE.TXT
    9283 - *
    9284 - */
    9285 -
    9286 -    /* Load rexxutils functions */
    9287 -    if (RxFuncQuery('SysLoadFuncs') = 1) then
    9288 -    do
    9289 -        rc = RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs');
    9290 -        if (rc <> 0) then
    9291 -        do
    9292 -            say 'RxFuncAdd -> 'rc'';
    9293 -            do i = 1 to 1000
    9294 -                rc = RxFuncAdd('SysDropFuncs', 'RexxUtil', 'SysDropFuncs');
    9295 -                call SysDropFuncs;
    9296 -                rc = RxFuncAdd('SysDropFuncs', 'RexxUtil', 'SysDropFuncs');
    9297 -                call SysDropFuncs;
    9298 -            end
    9299 -            rc = RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs');
    9300 -        end
    9301 -        call SysLoadFuncs;
    9302 -    end
    9303 -
    9304 -    /*
    9305 -     * Get and set the build date.
    9306 -     */
    9307 -    parse arg sDate sType sDummy
    9308 -    fOk = 1;
    9309 -    if (sDate <> '') then
    9310 -    do
    9311 -        parse var sDate sYear'-'sMonth'-'sDay
    9312 -        sType = substr(translate(sType), 1, 1);
    9313 -        if (  (length(sYear) <> 4) | (strip(translate(sYear, '','0123456789')) <> ''),
    9314 -            | (length(sMonth) <>2) | (strip(translate(sMonth, '','0123456789')) <> ''),
    9315 -            | (length(sDay)  <> 2) | (strip(translate(sDay, '','0123456789')) <> ''),
    9316 -            | ((sType <> 'W') & (sType <> 'D'))) then
    9317 -            fOk = 0;
    9318 -        else
    9319 -            sDate = sYear||sMonth||sDay;
    9320 -    end
    9321 -    else
    9322 -    do
    9323 -        sDate = date('S');
    9324 -        sType = 'D';
    9325 -        if (Date('B')//7 = 3) then  /* weekly on Thursdays */
    9326 -            sType = 'W';
    9327 -    end
    9328 -
    9329 -    if (\fOk) then
    9330 -    do
    9331 -        say 'Hey mister! you''ve given me a bad date or build type!!!';
    9332 -        say 'Date='sYear'-'sMonth'-'sDay
    9333 -        say 'Buildtype='sType;
    9334 -        exit(16);
    9335 -    end
    9336 -    call value 'BUILD_DATE', sDate, 'OS2ENVIRONMENT';
    9337 -    call value 'BUILD_TYPE', sType, 'OS2ENVIRONMENT';
    9338 -
    9339 -
    9340 -    /*
    9341 -     * Get source directory of this script
    9342 -     */
    9343 -    parse source sd1 sd2 sScript
    9344 -    sScriptDir = filespec('drive', sScript) || filespec('path', sScript);
    9345 -    sStateDir = sScriptDir||'State'||sType;
    9346 -    sLogFile = sScriptDir || 'Logs\' || sDate || '.log';
    9347 -    sTree    = sScriptDir || '..\tree' || sDate;
    9348 -    'call' sScriptDir||'bin\CreatePath.cmd 'sScriptDir||'Logs'
    9349 -    'call' sScriptDir||'bin\CreatePath.cmd 'sScriptDir||'DBBackup'
    9350 -    'call' sScriptDir||'bin\CreatePath.cmd 'sStateDir;
    9351 -
    9352 -    /*
    9353 -     * Clean tree, get it and build it.
    9354 -     */
    9355 -    'mkdir' sTree
    9356 -    filespec('drive', sScript);
    9357 -    'cd' sTree;
    9358 -    if (rc <> 0) then call failure rc, '', 'cd 'sTree 'failed.';
    9359 -    'call' sScriptDir || 'odin32env.cmd'
    9360 -    if (rc <> 0) then call failure rc, '', 'Env failed.';
    9361 -    if (IsChangeLogModified(sStateDir)) then
    9362 -    do
    9363 -        say 'Nothing to do. ChangeLog unmodified.'
    9364 -        'echo ChangeLog unmodified >' sLogFile;
    9365 -        exit(0);
    9366 -    end
    9367 -    'call' sScriptDir || 'odin32clean.cmd'
    9368 -    if (rc <> 0) then call failure rc, sStateDir, 'Clean failed.';
    9369 -    'call' sScriptDir || 'odin32get.cmd'
    9370 -    if (rc <> 0) then call failure rc, sStateDir, 'Get failed.';
    9371 -    'call' sScriptDir || 'odin32bldnr.cmd inc'
    9372 -    if (rc <> 0) then call failure rc, sStateDir, 'Build Nr inc failed.';
    9373 -    'call' sScriptDir || 'odin32build.cmd 2>&1 | tee /a ' || sLogFile; /* 4OS/2 tee command. */
    9374 -    if (rc <> 0) then call failure rc, sStateDir, 'Build failed.';
    9375 -    'call' sScriptDir || 'odin32bldnr.cmd commit'
    9376 -    if (rc <> 0) then call failure rc, sStateDir, 'Build Nr commit failed.';
    9377 -
    9378 -    /*
    9379 -     * Pack and upload it.
    9380 -     */
    9381 -    'call' sScriptDir || 'odin32pack.cmd  2>&1 | tee /a ' || sLogFile; /* 4OS/2 tee command. */
    9382 -    if (rc <> 0) then call failure rc, sStateDir, 'Packing failed.';
    9383 -    'call' sScriptDir || 'odin32ftp2.cmd';
    9384 -    if (rc <> 0) then call failure rc, sStateDir, 'Upload failed!';
    9385 -
    9386 -
    9387 -    /*
    9388 -     * database update
    9389 -     */
    9390 -    /*
    9391 -    sScriptDir || 'odin32db.cmd  2>&1 | tee /a ' || sLogFile; /* 4OS/2 tee command. */
    9392 -    if (rc <> 0) then call failure rc, '', 'db failed.';
    9393 -    */
    9394 -
    9395 -    /* successfull exit */
    9396 -    exit(0);
    9397 -
    9398 -
    9399 -/*
    9400 - * fatal failures terminates here!.
    9401 - */
    9402 -failure: procedure
    9403 -parse arg rc, sStateDir, sText;
    9404 -    say 'rc='rc sText
    9405 -    if (sStateDir <> '') then
    9406 -        call ForceNextBuild sStateDir;
    9407 -    exit(rc);
    9408 -
    9409 -
    9410 -/*
    9411 - * Checks if the change log is up to date or not.
    9412 - */
    9413 -IsChangeLogModified: procedure
    9414 -parse arg sStateDir;
    9415 -
    9416 -    sDir = directory();
    9417 -    'cd' sStateDir
    9418 -    if (rc <> 0) then call failure rc, 'cd 'sStateDir' failed!';
    9419 -
    9420 -    if (stream(sStateDir'\ChangeLog', 'c', 'query exist') == '') then
    9421 -    do
    9422 -        /* no such file: check it out. */
    9423 -        fUpToDate = 0;
    9424 -    end
    9425 -    else
    9426 -    do
    9427 -        /* check if up to date. */
    9428 -        'cvs status ChangeLog | grep -q "Status: Up-to-date"';
    9429 -        if (rc <> 0) then
    9430 -            fUpToDate = 0;
    9431 -        else
    9432 -            fUpToDate = 1;
    9433 -    end
    9434 -
    9435 -    /*
    9436 -     * Check out the latest ChangeLog.
    9437 -     */
    9438 -    if (\fUpToDate) then
    9439 -    do
    9440 -        /* check if up to date. */
    9441 -        'if exist ChangeLog del ChangeLog';
    9442 -        'call cvs checkout ChangeLog';
    9443 -    end
    9444 -
    9445 -    call directory sDir;
    9446 -return fUpToDate;
    9447 -
    9448 -
    9449 -/*
    9450 - * Force build next time.
    9451 - * Called when we fail.
    9452 - */
    9453 -ForceNextBuild: procedure
    9454 -parse arg sStateDir;
    9455 -    'if exist 'sStateDir'\ChangeLog del 'sStateDir'\ChangeLog';
    9456 -return rc;
    9457 +/* $Id: job.cmd,v 1.11 2003-08-05 00:16:17 bird Exp $
    9458 + *
    9459 + * Main job for building OS/2.
    9460 + *
    9461 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    9462 + *
    9463 + * Project Odin Software License can be found in LICENSE.TXT
    9464 + *
    9465 + */
    9466 +
    9467 +    /* Load rexxutils functions */
    9468 +    if (RxFuncQuery('SysLoadFuncs') = 1) then
    9469 +    do
    9470 +        rc = RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs');
    9471 +        if (rc <> 0) then
    9472 +        do
    9473 +            say 'RxFuncAdd -> 'rc'';
    9474 +            do i = 1 to 1000
    9475 +                rc = RxFuncAdd('SysDropFuncs', 'RexxUtil', 'SysDropFuncs');
    9476 +                call SysDropFuncs;
    9477 +                rc = RxFuncAdd('SysDropFuncs', 'RexxUtil', 'SysDropFuncs');
    9478 +                call SysDropFuncs;
    9479 +            end
    9480 +            rc = RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs');
    9481 +        end
    9482 +        call SysLoadFuncs;
    9483 +    end
    9484 +
    9485 +    /*
    9486 +     * Get and set the build date.
    9487 +     */
    9488 +    parse arg sDate sType sDummy
    9489 +    fOk = 1;
    9490 +    if (sDate <> '') then
    9491 +    do
    9492 +        parse var sDate sYear'-'sMonth'-'sDay
    9493 +        sType = substr(translate(sType), 1, 1);
    9494 +        if (  (length(sYear) <> 4) | (strip(translate(sYear, '','0123456789')) <> ''),
    9495 +            | (length(sMonth) <>2) | (strip(translate(sMonth, '','0123456789')) <> ''),
    9496 +            | (length(sDay)  <> 2) | (strip(translate(sDay, '','0123456789')) <> ''),
    9497 +            | ((sType <> 'W') & (sType <> 'D'))) then
    9498 +            fOk = 0;
    9499 +        else
    9500 +            sDate = sYear||sMonth||sDay;
    9501 +    end
    9502 +    else
    9503 +    do
    9504 +        sDate = date('S');
    9505 +        sType = 'D';
    9506 +        if (Date('B')//7 = 3) then  /* weekly on Thursdays */
    9507 +            sType = 'W';
    9508 +    end
    9509 +
    9510 +    if (\fOk) then
    9511 +    do
    9512 +        say 'Hey mister! you''ve given me a bad date or build type!!!';
    9513 +        say 'Date='sYear'-'sMonth'-'sDay
    9514 +        say 'Buildtype='sType;
    9515 +        exit(16);
    9516 +    end
    9517 +    call value 'BUILD_DATE', sDate, 'OS2ENVIRONMENT';
    9518 +    call value 'BUILD_TYPE', sType, 'OS2ENVIRONMENT';
    9519 +
    9520 +
    9521 +    /*
    9522 +     * Get source directory of this script
    9523 +     */
    9524 +    parse source sd1 sd2 sScript
    9525 +    sScriptDir = filespec('drive', sScript) || filespec('path', sScript);
    9526 +    sStateDir = sScriptDir||'State'||sType;
    9527 +    sLogFile = sScriptDir || 'Logs\' || sDate || '.log';
    9528 +    sTree    = sScriptDir || '..\tree' || sDate;
    9529 +    'call' sScriptDir||'bin\CreatePath.cmd 'sScriptDir||'Logs'
    9530 +    'call' sScriptDir||'bin\CreatePath.cmd 'sScriptDir||'DBBackup'
    9531 +    'call' sScriptDir||'bin\CreatePath.cmd 'sStateDir;
    9532 +
    9533 +    /*
    9534 +     * Clean tree, get it and build it.
    9535 +     */
    9536 +    'mkdir' sTree
    9537 +    filespec('drive', sScript);
    9538 +    'cd' sTree;
    9539 +    if (rc <> 0) then call failure rc, '', 'cd 'sTree 'failed.';
    9540 +    'call' sScriptDir || 'odin32env.cmd'
    9541 +    if (rc <> 0) then call failure rc, '', 'Env failed.';
    9542 +    if (IsChangeLogModified(sStateDir)) then
    9543 +    do
    9544 +        say 'Nothing to do. ChangeLog unmodified.'
    9545 +        'echo ChangeLog unmodified >' sLogFile;
    9546 +        exit(0);
    9547 +    end
    9548 +    'call' sScriptDir || 'odin32clean.cmd'
    9549 +    if (rc <> 0) then call failure rc, sStateDir, 'Clean failed.';
    9550 +    'call' sScriptDir || 'odin32get.cmd'
    9551 +    if (rc <> 0) then call failure rc, sStateDir, 'Get failed.';
    9552 +    'call' sScriptDir || 'odin32bldnr.cmd inc'
    9553 +    if (rc <> 0) then call failure rc, sStateDir, 'Build Nr inc failed.';
    9554 +    'call' sScriptDir || 'odin32build.cmd 2>&1 | tee /a ' || sLogFile; /* 4OS/2 tee command. */
    9555 +    if (rc <> 0) then call failure rc, sStateDir, 'Build failed.';
    9556 +    'call' sScriptDir || 'odin32bldnr.cmd commit'
    9557 +    if (rc <> 0) then call failure rc, sStateDir, 'Build Nr commit failed.';
    9558 +
    9559 +    /*
    9560 +     * Pack and upload it.
    9561 +     */
    9562 +    'call' sScriptDir || 'odin32pack.cmd  2>&1 | tee /a ' || sLogFile; /* 4OS/2 tee command. */
    9563 +    if (rc <> 0) then call failure rc, sStateDir, 'Packing failed.';
    9564 +    'call' sScriptDir || 'odin32ftp2.cmd';
    9565 +    if (rc <> 0) then call failure rc, sStateDir, 'Upload failed!';
    9566 +
    9567 +
    9568 +    /*
    9569 +     * database update
    9570 +     */
    9571 +    /*
    9572 +    sScriptDir || 'odin32db.cmd  2>&1 | tee /a ' || sLogFile; /* 4OS/2 tee command. */
    9573 +    if (rc <> 0) then call failure rc, '', 'db failed.';
    9574 +    */
    9575 +
    9576 +    /* successfull exit */
    9577 +    exit(0);
    9578 +
    9579 +
    9580 +/*
    9581 + * fatal failures terminates here!.
    9582 + */
    9583 +failure: procedure
    9584 +parse arg rc, sStateDir, sText;
    9585 +    say 'rc='rc sText
    9586 +    if (sStateDir <> '') then
    9587 +        call ForceNextBuild sStateDir;
    9588 +    exit(rc);
    9589 +
    9590 +
    9591 +/*
    9592 + * Checks if the change log is up to date or not.
    9593 + */
    9594 +IsChangeLogModified: procedure
    9595 +parse arg sStateDir;
    9596 +
    9597 +    sDir = directory();
    9598 +    'cd' sStateDir
    9599 +    if (rc <> 0) then call failure rc, 'cd 'sStateDir' failed!';
    9600 +
    9601 +    if (stream(sStateDir'\ChangeLog', 'c', 'query exist') == '') then
    9602 +    do
    9603 +        /* no such file: check it out. */
    9604 +        fUpToDate = 0;
    9605 +    end
    9606 +    else
    9607 +    do
    9608 +        /* check if up to date. */
    9609 +        'cvs status ChangeLog | grep -q "Status: Up-to-date"';
    9610 +        if (rc <> 0) then
    9611 +            fUpToDate = 0;
    9612 +        else
    9613 +            fUpToDate = 1;
    9614 +    end
    9615 +
    9616 +    /*
    9617 +     * Check out the latest ChangeLog.
    9618 +     */
    9619 +    if (\fUpToDate) then
    9620 +    do
    9621 +        /* check if up to date. */
    9622 +        'if exist ChangeLog del ChangeLog';
    9623 +        'call cvs checkout ChangeLog';
    9624 +    end
    9625 +
    9626 +    call directory sDir;
    9627 +return fUpToDate;
    9628 +
    9629 +
    9630 +/*
    9631 + * Force build next time.
    9632 + * Called when we fail.
    9633 + */
    9634 +ForceNextBuild: procedure
    9635 +parse arg sStateDir;
    9636 +    'if exist 'sStateDir'\ChangeLog del 'sStateDir'\ChangeLog';
    9637 +return rc;
    9638 diff --git a/tools/DailyBuild/odin32bldnr.cmd b/tools/DailyBuild/odin32bldnr.cmd
    9639 index 4defeb5..20e3be4 100644
    9640 --- a/tools/DailyBuild/odin32bldnr.cmd
    9641 +++ b/tools/DailyBuild/odin32bldnr.cmd
    9642 @@ -1,167 +1,167 @@
    9643 -/* $Id: odin32bldnr.cmd,v 1.5 2002-06-26 22:07:15 bird Exp $
    9644 - *
    9645 - * Build number update script.
    9646 - *
    9647 - * Two operations:
    9648 - *      1. Increment the build number.
    9649 - *      2. Commit the build number file.
    9650 - *
    9651 - * Assumes that current directory is the root.
    9652 - *
    9653 - * Copyright (c) 2001-2002 knut st. osmundsen (bird@anduin.net)
    9654 - *
    9655 - * Project Odin Software License can be found in LICENSE.TXT
    9656 - *
    9657 - */
    9658 -
    9659 -call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    9660 -call SysLoadFuncs;
    9661 -
    9662 -/* get build settings */
    9663 -sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    9664 -sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    9665 -if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    9666 -
    9667 -
    9668 -/*
    9669 - * Parse parameters.
    9670 - */
    9671 -parse arg sOperation sIgnore
    9672 -
    9673 -/*
    9674 - * Save and change directory.
    9675 - */
    9676 -sTree = directory();
    9677 -'cd include';
    9678 -if (rc <> 0) then call failure rc, 'cd include failed.';
    9679 -
    9680 -
    9681 -/*
    9682 - * Do operation.
    9683 - */
    9684 -if (substr(sOperation, 1, 3) = 'inc') then
    9685 -do
    9686 -    /*
    9687 -     * Scan the odinbuild.h file for ODIN32_BUILD_NR.
    9688 -     */
    9689 -    sOut = 'odinbuild.h';
    9690 -    sIn = 'odinbuild.h.backup';
    9691 -    call SysFileDelete('odinbuild.h.backup');
    9692 -    'copy' sOut sIn;
    9693 -    if (rc) then call failure rc, 'backup copy failed';
    9694 -    call SysFileDelete('odinbuild.h');
    9695 -
    9696 -    rcIn = stream(sIn, 'c', 'open read');
    9697 -    rcOut = stream(sOut, 'c', 'open write');
    9698 -    if (pos('READY', rcIn) <> 1 | pos('READY', rcOut) <> 1) then
    9699 -    do
    9700 -        call stream(sIn, 'c', 'close');
    9701 -        call stream(sOut, 'c', 'close');
    9702 -        call failure 5, 'failed to open in or/and out file. rcIn='rcIn 'rcOut='rcOut;
    9703 -    end
    9704 -
    9705 -    /*
    9706 -     * Copy loop which updates ODIN32_BUILD_NR when found.
    9707 -     */
    9708 -    fFound = 0;
    9709 -    do while (lines(sIn))
    9710 -        sLine = linein(sIn);
    9711 -        if (\fFound & substr(strip(sLine), 1, 24) = '#define ODIN32_BUILD_NR ') then
    9712 -        do
    9713 -            parse var sLine '#define ODIN32_BUILD_NR' iBuildNr sComment;
    9714 -            iBuildNr = strip(iBuildNr);
    9715 -            sComment = strip(sComment);
    9716 -            iBuildNr = iBuildNr + 1;
    9717 -            sLine = '#define ODIN32_BUILD_NR       '||iBuildNr||'        '||sComment;
    9718 -            say 'newln:' sLine;
    9719 -            fFound = 1;
    9720 -        end
    9721 -        call lineout sOut, sLine;
    9722 -    end
    9723 -    call lineout sOut, '';
    9724 -    call stream sIn, 'c', 'close';
    9725 -    call stream sOut, 'c', 'close';
    9726 -    rc = 0;
    9727 -end
    9728 -else if (sOperation = 'svn') then
    9729 -do
    9730 -
    9731 -    /* get svn revision */
    9732 -    'rxqueue /clear'
    9733 -    'svn info | grep "Revision:" | cut -d" " -f2 | rxqueue'
    9734 -    iBuildNr = LineIn("QUEUE:")
    9735 -
    9736 -    /*
    9737 -     * Scan the odinbuild.h file for ODIN32_BUILD_NR.
    9738 -     */
    9739 -    sOut = 'odinbuild.h';
    9740 -    sIn = 'odinbuild.h.backup';
    9741 -    call SysFileDelete('odinbuild.h.backup');
    9742 -    'copy' sOut sIn;
    9743 -    if (rc) then call failure rc, 'backup copy failed';
    9744 -    call SysFileDelete('odinbuild.h');
    9745 -
    9746 -    rcIn = stream(sIn, 'c', 'open read');
    9747 -    rcOut = stream(sOut, 'c', 'open write');
    9748 -    if (pos('READY', rcIn) <> 1 | pos('READY', rcOut) <> 1) then
    9749 -    do
    9750 -        call stream(sIn, 'c', 'close');
    9751 -        call stream(sOut, 'c', 'close');
    9752 -        call failure 5, 'failed to open in or/and out file. rcIn='rcIn 'rcOut='rcOut;
    9753 -    end
    9754 -
    9755 -    /*
    9756 -     * Copy loop which updates ODIN32_BUILD_NR when found.
    9757 -     */
    9758 -    fFound = 0;
    9759 -    do while (lines(sIn))
    9760 -        sLine = linein(sIn);
    9761 -        if (\fFound & substr(strip(sLine), 1, 24) = '#define ODIN32_BUILD_NR ') then
    9762 -        do
    9763 -            parse var sLine '#define ODIN32_BUILD_NR' iOldBuildNr sComment;
    9764 -            sComment = strip(sComment);
    9765 -            sLine = '#define ODIN32_BUILD_NR       '||iBuildNr||'        '||sComment;
    9766 -            say 'newln:' sLine;
    9767 -            fFound = 1;
    9768 -        end
    9769 -        call lineout sOut, sLine;
    9770 -    end
    9771 -    call lineout sOut, '';
    9772 -    call stream sIn, 'c', 'close';
    9773 -    call stream sOut, 'c', 'close';
    9774 -    rc = 0;
    9775 -end
    9776 -else if (sOperation = 'commit') then
    9777 -do
    9778 -    /*
    9779 -     * Commit the build nr. file.
    9780 -     */
    9781 -    if (sType = 'W') then
    9782 -        'cvs commit -m "Weekly build - 'sDate'" odinbuild.h';
    9783 -    else
    9784 -        'cvs commit -m "Daily build - 'sDate'" odinbuild.h';
    9785 -    if (rc <> 0) then call failed rc, 'failed to commit odinbuild.h'
    9786 -end
    9787 -else
    9788 -do
    9789 -    say 'invalid operation' sOperation'. Should be commit or inc.'
    9790 -    rc = 87;
    9791 -end
    9792 -
    9793 -
    9794 -/*
    9795 - * Restore directory.
    9796 - */
    9797 -call directory(sTree);
    9798 -
    9799 -exit(rc);
    9800 -
    9801 -
    9802 -/*
    9803 - * Fatal failures terminates here!.
    9804 - */
    9805 -failure: procedure
    9806 -parse arg rc, sText;
    9807 -    say 'rc='rc sText
    9808 -    exit(rc);
    9809 -
    9810 +/* $Id: odin32bldnr.cmd,v 1.5 2002-06-26 22:07:15 bird Exp $
    9811 + *
    9812 + * Build number update script.
    9813 + *
    9814 + * Two operations:
    9815 + *      1. Increment the build number.
    9816 + *      2. Commit the build number file.
    9817 + *
    9818 + * Assumes that current directory is the root.
    9819 + *
    9820 + * Copyright (c) 2001-2002 knut st. osmundsen (bird@anduin.net)
    9821 + *
    9822 + * Project Odin Software License can be found in LICENSE.TXT
    9823 + *
    9824 + */
    9825 +
    9826 +call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    9827 +call SysLoadFuncs;
    9828 +
    9829 +/* get build settings */
    9830 +sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    9831 +sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    9832 +if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    9833 +
    9834 +
    9835 +/*
    9836 + * Parse parameters.
    9837 + */
    9838 +parse arg sOperation sIgnore
    9839 +
    9840 +/*
    9841 + * Save and change directory.
    9842 + */
    9843 +sTree = directory();
    9844 +'cd include';
    9845 +if (rc <> 0) then call failure rc, 'cd include failed.';
    9846 +
    9847 +
    9848 +/*
    9849 + * Do operation.
    9850 + */
    9851 +if (substr(sOperation, 1, 3) = 'inc') then
    9852 +do
    9853 +    /*
    9854 +     * Scan the odinbuild.h file for ODIN32_BUILD_NR.
    9855 +     */
    9856 +    sOut = 'odinbuild.h';
    9857 +    sIn = 'odinbuild.h.backup';
    9858 +    call SysFileDelete('odinbuild.h.backup');
    9859 +    'copy' sOut sIn;
    9860 +    if (rc) then call failure rc, 'backup copy failed';
    9861 +    call SysFileDelete('odinbuild.h');
    9862 +
    9863 +    rcIn = stream(sIn, 'c', 'open read');
    9864 +    rcOut = stream(sOut, 'c', 'open write');
    9865 +    if (pos('READY', rcIn) <> 1 | pos('READY', rcOut) <> 1) then
    9866 +    do
    9867 +        call stream(sIn, 'c', 'close');
    9868 +        call stream(sOut, 'c', 'close');
    9869 +        call failure 5, 'failed to open in or/and out file. rcIn='rcIn 'rcOut='rcOut;
    9870 +    end
    9871 +
    9872 +    /*
    9873 +     * Copy loop which updates ODIN32_BUILD_NR when found.
    9874 +     */
    9875 +    fFound = 0;
    9876 +    do while (lines(sIn))
    9877 +        sLine = linein(sIn);
    9878 +        if (\fFound & substr(strip(sLine), 1, 24) = '#define ODIN32_BUILD_NR ') then
    9879 +        do
    9880 +            parse var sLine '#define ODIN32_BUILD_NR' iBuildNr sComment;
    9881 +            iBuildNr = strip(iBuildNr);
    9882 +            sComment = strip(sComment);
    9883 +            iBuildNr = iBuildNr + 1;
    9884 +            sLine = '#define ODIN32_BUILD_NR       '||iBuildNr||'        '||sComment;
    9885 +            say 'newln:' sLine;
    9886 +            fFound = 1;
    9887 +        end
    9888 +        call lineout sOut, sLine;
    9889 +    end
    9890 +    call lineout sOut, '';
    9891 +    call stream sIn, 'c', 'close';
    9892 +    call stream sOut, 'c', 'close';
    9893 +    rc = 0;
    9894 +end
    9895 +else if (sOperation = 'svn') then
    9896 +do
    9897 +
    9898 +    /* get svn revision */
    9899 +    'rxqueue /clear'
    9900 +    'svn info | grep "Revision:" | cut -d" " -f2 | rxqueue'
    9901 +    iBuildNr = LineIn("QUEUE:")
    9902 +
    9903 +    /*
    9904 +     * Scan the odinbuild.h file for ODIN32_BUILD_NR.
    9905 +     */
    9906 +    sOut = 'odinbuild.h';
    9907 +    sIn = 'odinbuild.h.backup';
    9908 +    call SysFileDelete('odinbuild.h.backup');
    9909 +    'copy' sOut sIn;
    9910 +    if (rc) then call failure rc, 'backup copy failed';
    9911 +    call SysFileDelete('odinbuild.h');
    9912 +
    9913 +    rcIn = stream(sIn, 'c', 'open read');
    9914 +    rcOut = stream(sOut, 'c', 'open write');
    9915 +    if (pos('READY', rcIn) <> 1 | pos('READY', rcOut) <> 1) then
    9916 +    do
    9917 +        call stream(sIn, 'c', 'close');
    9918 +        call stream(sOut, 'c', 'close');
    9919 +        call failure 5, 'failed to open in or/and out file. rcIn='rcIn 'rcOut='rcOut;
    9920 +    end
    9921 +
    9922 +    /*
    9923 +     * Copy loop which updates ODIN32_BUILD_NR when found.
    9924 +     */
    9925 +    fFound = 0;
    9926 +    do while (lines(sIn))
    9927 +        sLine = linein(sIn);
    9928 +        if (\fFound & substr(strip(sLine), 1, 24) = '#define ODIN32_BUILD_NR ') then
    9929 +        do
    9930 +            parse var sLine '#define ODIN32_BUILD_NR' iOldBuildNr sComment;
    9931 +            sComment = strip(sComment);
    9932 +            sLine = '#define ODIN32_BUILD_NR       '||iBuildNr||'        '||sComment;
    9933 +            say 'newln:' sLine;
    9934 +            fFound = 1;
    9935 +        end
    9936 +        call lineout sOut, sLine;
    9937 +    end
    9938 +    call lineout sOut, '';
    9939 +    call stream sIn, 'c', 'close';
    9940 +    call stream sOut, 'c', 'close';
    9941 +    rc = 0;
    9942 +end
    9943 +else if (sOperation = 'commit') then
    9944 +do
    9945 +    /*
    9946 +     * Commit the build nr. file.
    9947 +     */
    9948 +    if (sType = 'W') then
    9949 +        'cvs commit -m "Weekly build - 'sDate'" odinbuild.h';
    9950 +    else
    9951 +        'cvs commit -m "Daily build - 'sDate'" odinbuild.h';
    9952 +    if (rc <> 0) then call failed rc, 'failed to commit odinbuild.h'
    9953 +end
    9954 +else
    9955 +do
    9956 +    say 'invalid operation' sOperation'. Should be commit or inc.'
    9957 +    rc = 87;
    9958 +end
    9959 +
    9960 +
    9961 +/*
    9962 + * Restore directory.
    9963 + */
    9964 +call directory(sTree);
    9965 +
    9966 +exit(rc);
    9967 +
    9968 +
    9969 +/*
    9970 + * Fatal failures terminates here!.
    9971 + */
    9972 +failure: procedure
    9973 +parse arg rc, sText;
    9974 +    say 'rc='rc sText
    9975 +    exit(rc);
    9976 +
    9977 diff --git a/tools/DailyBuild/odin32build.cmd b/tools/DailyBuild/odin32build.cmd
    9978 index aa140ce..5943d91 100644
    9979 --- a/tools/DailyBuild/odin32build.cmd
    9980 +++ b/tools/DailyBuild/odin32build.cmd
    9981 @@ -1,39 +1,39 @@
    9982 -/* $Id: odin32build.cmd,v 1.2 2002-06-26 22:08:32 bird Exp $
    9983 - *
    9984 - * Builds debug and release editions of Odin32.
    9985 - *
    9986 - * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    9987 - *
    9988 - * Project Odin Software License can be found in LICENSE.TXT
    9989 - *
    9990 - */
    9991 -    /* get build settings */
    9992 -    /*sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    9993 -    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    9994 -    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    9995 -    */
    9996 -
    9997 -/*
    9998 - * Parse parameters.
    9999 - */
    10000 -parse arg sSMP
    10001 -
    10002 -    /* debug build */
    10003 -    'SET DEBUG=1';
    10004 -    'nmake dep';
    10005 -    if (RC <> 0) then call failure rc, 'Make failed (dep).';
    10006 -    'nmake NODEBUGINFO=1 'sSMP;
    10007 -    if (RC <> 0) then call failure rc, 'Make debug failed.';
    10008 -
    10009 -    /* release build */
    10010 -    'SET DEBUG=';
    10011 -    'nmake 'sSMP;
    10012 -    if (RC <> 0) then call failure rc, 'Make release failed .';
    10013 -
    10014 -    exit(0);
    10015 -
    10016 -failure: procedure
    10017 -parse arg rc, sText;
    10018 -    say 'rc='rc sText
    10019 -    exit(rc);
    10020 -
    10021 +/* $Id: odin32build.cmd,v 1.2 2002-06-26 22:08:32 bird Exp $
    10022 + *
    10023 + * Builds debug and release editions of Odin32.
    10024 + *
    10025 + * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    10026 + *
    10027 + * Project Odin Software License can be found in LICENSE.TXT
    10028 + *
    10029 + */
    10030 +    /* get build settings */
    10031 +    /*sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10032 +    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10033 +    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10034 +    */
    10035 +
    10036 +/*
    10037 + * Parse parameters.
    10038 + */
    10039 +parse arg sSMP
    10040 +
    10041 +    /* debug build */
    10042 +    'SET DEBUG=1';
    10043 +    'nmake dep';
    10044 +    if (RC <> 0) then call failure rc, 'Make failed (dep).';
    10045 +    'nmake NODEBUGINFO=1 'sSMP;
    10046 +    if (RC <> 0) then call failure rc, 'Make debug failed.';
    10047 +
    10048 +    /* release build */
    10049 +    'SET DEBUG=';
    10050 +    'nmake 'sSMP;
    10051 +    if (RC <> 0) then call failure rc, 'Make release failed .';
    10052 +
    10053 +    exit(0);
    10054 +
    10055 +failure: procedure
    10056 +parse arg rc, sText;
    10057 +    say 'rc='rc sText
    10058 +    exit(rc);
    10059 +
    10060 diff --git a/tools/DailyBuild/odin32clean.cmd b/tools/DailyBuild/odin32clean.cmd
    10061 index af79a87..5ffbe1c 100644
    10062 --- a/tools/DailyBuild/odin32clean.cmd
    10063 +++ b/tools/DailyBuild/odin32clean.cmd
    10064 @@ -1,46 +1,46 @@
    10065 -/* $Id: odin32clean.cmd,v 1.5 2003-02-06 21:03:43 bird Exp $
    10066 - *
    10067 - * Removes trees. WARNING!!!!! All tree<date> directories are removed
    10068 - * if .nodelete is not found in the root of them.
    10069 - *
    10070 - * (Delpath is a "deltree" clone I've made, use your own.)
    10071 - *
    10072 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    10073 - *
    10074 - * Project Odin Software License can be found in LICENSE.TXT
    10075 - *
    10076 - */
    10077 -
    10078 -    /* get build settings */
    10079 -    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10080 -    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10081 -    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10082 -
    10083 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    10084 -    call SysloadFuncs;
    10085 -
    10086 -    sTree    = 'tree' || sDate;
    10087 -
    10088 -    /*
    10089 -     * We assume currentdirectory is the current tree.
    10090 -     */
    10091 -    rc = SysFileTree('..\tree'||substr(sDate,1,4)||'*.', 'asTrees', 'DO');
    10092 -    if (rc = 0) then
    10093 -    do
    10094 -        do i = 1 to asTrees.0
    10095 -            if (stream(asTrees.i||'\.nodelete', 'c', 'query exists') = '') then
    10096 -            do
    10097 -                parse source . . sSrc
    10098 -                filespec('drive', sSrc)||filespec('path', sSrc)||'\bin\rm -rF "'asTrees.i'"';
    10099 -            end
    10100 -            say asTrees.i
    10101 -        end
    10102 -    end
    10103 -exit(0);
    10104 -
    10105 -
    10106 -failure: procedure
    10107 -parse arg rc, sText;
    10108 -    say 'rc='rc sText
    10109 -exit(rc);
    10110 -
    10111 +/* $Id: odin32clean.cmd,v 1.5 2003-02-06 21:03:43 bird Exp $
    10112 + *
    10113 + * Removes trees. WARNING!!!!! All tree<date> directories are removed
    10114 + * if .nodelete is not found in the root of them.
    10115 + *
    10116 + * (Delpath is a "deltree" clone I've made, use your own.)
    10117 + *
    10118 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    10119 + *
    10120 + * Project Odin Software License can be found in LICENSE.TXT
    10121 + *
    10122 + */
    10123 +
    10124 +    /* get build settings */
    10125 +    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10126 +    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10127 +    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10128 +
    10129 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    10130 +    call SysloadFuncs;
    10131 +
    10132 +    sTree    = 'tree' || sDate;
    10133 +
    10134 +    /*
    10135 +     * We assume currentdirectory is the current tree.
    10136 +     */
    10137 +    rc = SysFileTree('..\tree'||substr(sDate,1,4)||'*.', 'asTrees', 'DO');
    10138 +    if (rc = 0) then
    10139 +    do
    10140 +        do i = 1 to asTrees.0
    10141 +            if (stream(asTrees.i||'\.nodelete', 'c', 'query exists') = '') then
    10142 +            do
    10143 +                parse source . . sSrc
    10144 +                filespec('drive', sSrc)||filespec('path', sSrc)||'\bin\rm -rF "'asTrees.i'"';
    10145 +            end
    10146 +            say asTrees.i
    10147 +        end
    10148 +    end
    10149 +exit(0);
    10150 +
    10151 +
    10152 +failure: procedure
    10153 +parse arg rc, sText;
    10154 +    say 'rc='rc sText
    10155 +exit(rc);
    10156 +
    10157 diff --git a/tools/DailyBuild/odin32db.cmd b/tools/DailyBuild/odin32db.cmd
    10158 index dcf0b93..d369a78 100644
    10159 --- a/tools/DailyBuild/odin32db.cmd
    10160 +++ b/tools/DailyBuild/odin32db.cmd
    10161 @@ -1,228 +1,228 @@
    10162 -/* $Id: odin32db.cmd,v 1.7 2002-06-26 22:09:59 bird Exp $
    10163 - *
    10164 - * Updates the Odin32 API database.
    10165 - *
    10166 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    10167 - *
    10168 - * Project Odin Software License can be found in LICENSE.TXT
    10169 - *
    10170 - */
    10171 -    /* get build settings */
    10172 -    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10173 -    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10174 -    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10175 -
    10176 -
    10177 -    /* load rexxutils functions and Ftp Utils. */
    10178 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    10179 -    call SysloadFuncs;
    10180 -    call RxFuncAdd 'FtpLoadFuncs','rxFtp','FtpLoadFuncs';
    10181 -    call FtpLoadFuncs;
    10182 -
    10183 -    /*
    10184 -     * Get source directory of this script
    10185 -     */
    10186 -    parse source sd1 sd2 sScript
    10187 -    sScriptDir = filespec('drive', sScript) || filespec('path', sScript);
    10188 -    sDir = directory();
    10189 -    'cd tools\database';
    10190 -    if rc <> 0 then call failure rc, 'cd db failed';
    10191 -    'nmake';
    10192 -    if rc <> 0 then call failure rc, 'nmake db failed';
    10193 -    'cd ..\..\src';
    10194 -    if rc <> 0 then call failure rc, 'cd src failed';
    10195 -    'nmake apiimport';
    10196 -    if rc <> 0 then call failure rc, 'apiimport failed';
    10197 -    'nmake stateupd 2>&1';
    10198 -    if rc <> 0 then call failure rc, 'stateupd failed';
    10199 -
    10200 -    /* create database backup */
    10201 -    filespec('drive', getMySqlDataDir());
    10202 -    if rc <> 0 then call failure rc, 'c: failed';
    10203 -    'cd' getMySqlDataDir()||'\odin32';
    10204 -    if rc <> 0 then call failure rc, 'cd <> failed';
    10205 -    'mysqladmin refresh';
    10206 -    'rar a -m5 ' || sScriptDir || 'dbbackup\db'||sDate||'.rar *'
    10207 -    if rc <> 0 then call failure rc, 'rar db failed';
    10208 -    'cd \';
    10209 -    'd:';
    10210 -    'cd ..';
    10211 -
    10212 -    /* dump database and install the dump at netlabs */
    10213 -    call directory sDir;
    10214 -    'mkdir db'
    10215 -    'mysqldump --no-create-db --add-drop-table --allow-keywords -Tdb odin32'
    10216 -    if (rc <> 0) then call failure rc, 'mysqldump failed';
    10217 -    '@rm -f odin32db.dump'
    10218 -    'mysqldump --no-create-db --add-drop-table --allow-keywords -e odin32 > odin32db.dump'
    10219 -    if (rc <> 0) then call failure rc, 'mysqldump (2) failed';
    10220 -    'zip -9 odin32db.zip odin32db.dump'
    10221 -    if (rc <> 0) then call failure rc, 'createing odin32db.zip failed';
    10222 -    rc = SysFileTree('db\*', 'asFiles', 'O');
    10223 -    if (rc <> 0) then call failure rc, 'listing db\* failed';
    10224 -    do i = 1 to asFiles.0
    10225 -        rc = putRexxFtp(asFiles.i, '/dev/12345678', '/daily/db', 'ftp.netlabs.org');
    10226 -        if (rc <> 0) then call failure rc, 'uploading of 'asFiles.i' failed';
    10227 -    end
    10228 -    rc = putRexxFtp('odin32db.zip', '/dev/12345678', '/daily/db', 'ftp.netlabs.org');
    10229 -    if (rc <> 0) then call failure rc, 'uploading of 'asFiles.i' failed';
    10230 -
    10231 -    sPwdDummy = GetPassword('odin32dbupdate');
    10232 -    parse var sPwdDummy sPasswd':'sDummy
    10233 -    'wget -O /dev/con http://www.netlabs.org/odin/odin32dbtest/Odin32DBUpdate.phtml?sPasswd='||sPasswd
    10234 -    if (rc <> 0) then call failure rc, 'wget failed';
    10235 -
    10236 -
    10237 -    exit(0);
    10238 -
    10239 -failure: procedure
    10240 -parse arg rc, sText;
    10241 -    say 'rc='rc sText
    10242 -exit(rc);
    10243 -
    10244 -failure2: procedure
    10245 -parse arg rc, sText;
    10246 -    say 'rc='rc sText
    10247 -return 0;
    10248 -
    10249 -
    10250 -/*
    10251 - * Get the MySql data directory.
    10252 - */
    10253 -getMySqlDataDir: procedure
    10254 -
    10255 -    /* Get mysql variables */
    10256 -    '@mysqladmin variables | rxqueue /lifo'
    10257 -
    10258 -    /* Get datadir */
    10259 -    sDataDir = '';
    10260 -    do queued()
    10261 -        pull s;
    10262 -        if (pos(' DATADIR ', s) > 0) then
    10263 -        do
    10264 -            sDataDir = strip( substr( s, pos('|',s,3) + 1 ) );
    10265 -            sDataDir = strip( substr(sDataDir, 1, length(sDataDir)-1) );
    10266 -            leave;
    10267 -        end
    10268 -    end
    10269 -
    10270 -    /* Drain queue */
    10271 -    do queued()
    10272 -        pull s
    10273 -    end
    10274 -    drop s;
    10275 -
    10276 -    /* If failure set default directory. */
    10277 -    if (sDataDir = '') then
    10278 -        sDataDir = 'd:\knut\Apps\MySql\data\';
    10279 -return sDataDir;
    10280 -
    10281 -/*
    10282 - *
    10283 - *  From odin32ftp2.cmd
    10284 - *  From odin32ftp2.cmd
    10285 - *  From odin32ftp2.cmd
    10286 - *  From odin32ftp2.cmd
    10287 - *  From odin32ftp2.cmd
    10288 - *  From odin32ftp2.cmd
    10289 - *
    10290 - */
    10291 -
    10292 -
    10293 -/*
    10294 - * Reads the password file (passwd) in the script directory to
    10295 - *   get a password and userid for a given site.
    10296 - *
    10297 - * Format of the passwd file is:
    10298 - *  <site> <user> <password>
    10299 - * Lines starting with '#' is ignored.
    10300 - *
    10301 - * @param   sSite   name of the site.
    10302 - * @returns String on the form '<userid>:<passwd>' if found.
    10303 - *          Empty string if not found.
    10304 - */
    10305 -GetPassword: procedure;
    10306 -    parse upper arg sSiteToFind
    10307 -    parse source sd1 sd2 sScript
    10308 -    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    10309 -
    10310 -    rc = stream(sPasswd, 'c', 'open read');
    10311 -    if (pos('READY', rc) <> 1) then
    10312 -    do
    10313 -        say 'failed to open ftp password file - rc='rc;
    10314 -        return '';
    10315 -    end
    10316 -
    10317 -    sRet = '';
    10318 -    do while (lines(sPasswd) > 0)
    10319 -        sLine = strip(linein(sPasswd));
    10320 -        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    10321 -            iterate;
    10322 -
    10323 -        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    10324 -        sSite = translate(strip(sSite));
    10325 -        sUser = strip(sUser);
    10326 -        sPassword = strip(sPassword);
    10327 -        if (sSite = '' | sPassword = '' | sUser = '') then
    10328 -            say 'warning! misformed password line!';
    10329 -        if (sSite = sSiteToFind) then
    10330 -        do
    10331 -           sRet = sUser||':'||sPassword;
    10332 -           leave
    10333 -        end
    10334 -    end
    10335 -    call stream sPasswd, 'c', 'close';
    10336 -return sRet;
    10337 -
    10338 -
    10339 -/*
    10340 - * REXX FTP put function.
    10341 - */
    10342 -putRexxFtp: procedure
    10343 -    parse arg sFile, sLockFile, sRemoteDir, sSite
    10344 -
    10345 -    /* check for done-lock */
    10346 -    if stream(sLockFile,'c','query exists') = '' then
    10347 -    do
    10348 -        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    10349 -
    10350 -        /* get password */
    10351 -        sPasswdString = GetPassword(sSite);
    10352 -        if (sPasswdString = '') then
    10353 -        do
    10354 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    10355 -            return -1;
    10356 -        end
    10357 -        parse var sPasswdString sUser':'sPasswd;
    10358 -
    10359 -        /* log on the ftp site */
    10360 -        rc = FtpSetUser(sSite, sUser, sPasswd);
    10361 -        if (rc = 1) then
    10362 -        do
    10363 -            /* put file, delete it if we fail */
    10364 -            say sSite  sUser  sPasswd  sFile  sRemoteDir'/'filespec('name', sFile)  'Binary'
    10365 -            rcPut = FtpPut(sFile, sRemoteDir'/'filespec('name',sFile), 'Binary');
    10366 -            /*
    10367 -            if (rcPut <> 0) then
    10368 -                rc = FtpDelete(sRemoteDir'/'filespec('name', sFile));
    10369 -            */
    10370 -
    10371 -            /* Logoff and make lock file. */
    10372 -            rc = FtpLogoff();
    10373 -            if (rcPut = 0) then
    10374 -                'echo ok  ' || sLockFile; /* changed - no lockfile */
    10375 -            else
    10376 -                call failure2 rc, 'FtpPut failed -' sSite , FTPERRNO;
    10377 -            rc = rcPut;
    10378 -        end
    10379 -        else
    10380 -        do
    10381 -            call failure2 rc, 'Logon failed -' sSite, FTPERRNO;
    10382 -            if rc = 0 then rc = -1;
    10383 -        end
    10384 -    end
    10385 -    else
    10386 -        rc = 0;
    10387 -return 0;
    10388 -
    10389 -
    10390 +/* $Id: odin32db.cmd,v 1.7 2002-06-26 22:09:59 bird Exp $
    10391 + *
    10392 + * Updates the Odin32 API database.
    10393 + *
    10394 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    10395 + *
    10396 + * Project Odin Software License can be found in LICENSE.TXT
    10397 + *
    10398 + */
    10399 +    /* get build settings */
    10400 +    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10401 +    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10402 +    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10403 +
    10404 +
    10405 +    /* load rexxutils functions and Ftp Utils. */
    10406 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    10407 +    call SysloadFuncs;
    10408 +    call RxFuncAdd 'FtpLoadFuncs','rxFtp','FtpLoadFuncs';
    10409 +    call FtpLoadFuncs;
    10410 +
    10411 +    /*
    10412 +     * Get source directory of this script
    10413 +     */
    10414 +    parse source sd1 sd2 sScript
    10415 +    sScriptDir = filespec('drive', sScript) || filespec('path', sScript);
    10416 +    sDir = directory();
    10417 +    'cd tools\database';
    10418 +    if rc <> 0 then call failure rc, 'cd db failed';
    10419 +    'nmake';
    10420 +    if rc <> 0 then call failure rc, 'nmake db failed';
    10421 +    'cd ..\..\src';
    10422 +    if rc <> 0 then call failure rc, 'cd src failed';
    10423 +    'nmake apiimport';
    10424 +    if rc <> 0 then call failure rc, 'apiimport failed';
    10425 +    'nmake stateupd 2>&1';
    10426 +    if rc <> 0 then call failure rc, 'stateupd failed';
    10427 +
    10428 +    /* create database backup */
    10429 +    filespec('drive', getMySqlDataDir());
    10430 +    if rc <> 0 then call failure rc, 'c: failed';
    10431 +    'cd' getMySqlDataDir()||'\odin32';
    10432 +    if rc <> 0 then call failure rc, 'cd <> failed';
    10433 +    'mysqladmin refresh';
    10434 +    'rar a -m5 ' || sScriptDir || 'dbbackup\db'||sDate||'.rar *'
    10435 +    if rc <> 0 then call failure rc, 'rar db failed';
    10436 +    'cd \';
    10437 +    'd:';
    10438 +    'cd ..';
    10439 +
    10440 +    /* dump database and install the dump at netlabs */
    10441 +    call directory sDir;
    10442 +    'mkdir db'
    10443 +    'mysqldump --no-create-db --add-drop-table --allow-keywords -Tdb odin32'
    10444 +    if (rc <> 0) then call failure rc, 'mysqldump failed';
    10445 +    '@rm -f odin32db.dump'
    10446 +    'mysqldump --no-create-db --add-drop-table --allow-keywords -e odin32 > odin32db.dump'
    10447 +    if (rc <> 0) then call failure rc, 'mysqldump (2) failed';
    10448 +    'zip -9 odin32db.zip odin32db.dump'
    10449 +    if (rc <> 0) then call failure rc, 'createing odin32db.zip failed';
    10450 +    rc = SysFileTree('db\*', 'asFiles', 'O');
    10451 +    if (rc <> 0) then call failure rc, 'listing db\* failed';
    10452 +    do i = 1 to asFiles.0
    10453 +        rc = putRexxFtp(asFiles.i, '/dev/12345678', '/daily/db', 'ftp.netlabs.org');
    10454 +        if (rc <> 0) then call failure rc, 'uploading of 'asFiles.i' failed';
    10455 +    end
    10456 +    rc = putRexxFtp('odin32db.zip', '/dev/12345678', '/daily/db', 'ftp.netlabs.org');
    10457 +    if (rc <> 0) then call failure rc, 'uploading of 'asFiles.i' failed';
    10458 +
    10459 +    sPwdDummy = GetPassword('odin32dbupdate');
    10460 +    parse var sPwdDummy sPasswd':'sDummy
    10461 +    'wget -O /dev/con http://www.netlabs.org/odin/odin32dbtest/Odin32DBUpdate.phtml?sPasswd='||sPasswd
    10462 +    if (rc <> 0) then call failure rc, 'wget failed';
    10463 +
    10464 +
    10465 +    exit(0);
    10466 +
    10467 +failure: procedure
    10468 +parse arg rc, sText;
    10469 +    say 'rc='rc sText
    10470 +exit(rc);
    10471 +
    10472 +failure2: procedure
    10473 +parse arg rc, sText;
    10474 +    say 'rc='rc sText
    10475 +return 0;
    10476 +
    10477 +
    10478 +/*
    10479 + * Get the MySql data directory.
    10480 + */
    10481 +getMySqlDataDir: procedure
    10482 +
    10483 +    /* Get mysql variables */
    10484 +    '@mysqladmin variables | rxqueue /lifo'
    10485 +
    10486 +    /* Get datadir */
    10487 +    sDataDir = '';
    10488 +    do queued()
    10489 +        pull s;
    10490 +        if (pos(' DATADIR ', s) > 0) then
    10491 +        do
    10492 +            sDataDir = strip( substr( s, pos('|',s,3) + 1 ) );
    10493 +            sDataDir = strip( substr(sDataDir, 1, length(sDataDir)-1) );
    10494 +            leave;
    10495 +        end
    10496 +    end
    10497 +
    10498 +    /* Drain queue */
    10499 +    do queued()
    10500 +        pull s
    10501 +    end
    10502 +    drop s;
    10503 +
    10504 +    /* If failure set default directory. */
    10505 +    if (sDataDir = '') then
    10506 +        sDataDir = 'd:\knut\Apps\MySql\data\';
    10507 +return sDataDir;
    10508 +
    10509 +/*
    10510 + *
    10511 + *  From odin32ftp2.cmd
    10512 + *  From odin32ftp2.cmd
    10513 + *  From odin32ftp2.cmd
    10514 + *  From odin32ftp2.cmd
    10515 + *  From odin32ftp2.cmd
    10516 + *  From odin32ftp2.cmd
    10517 + *
    10518 + */
    10519 +
    10520 +
    10521 +/*
    10522 + * Reads the password file (passwd) in the script directory to
    10523 + *   get a password and userid for a given site.
    10524 + *
    10525 + * Format of the passwd file is:
    10526 + *  <site> <user> <password>
    10527 + * Lines starting with '#' is ignored.
    10528 + *
    10529 + * @param   sSite   name of the site.
    10530 + * @returns String on the form '<userid>:<passwd>' if found.
    10531 + *          Empty string if not found.
    10532 + */
    10533 +GetPassword: procedure;
    10534 +    parse upper arg sSiteToFind
    10535 +    parse source sd1 sd2 sScript
    10536 +    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    10537 +
    10538 +    rc = stream(sPasswd, 'c', 'open read');
    10539 +    if (pos('READY', rc) <> 1) then
    10540 +    do
    10541 +        say 'failed to open ftp password file - rc='rc;
    10542 +        return '';
    10543 +    end
    10544 +
    10545 +    sRet = '';
    10546 +    do while (lines(sPasswd) > 0)
    10547 +        sLine = strip(linein(sPasswd));
    10548 +        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    10549 +            iterate;
    10550 +
    10551 +        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    10552 +        sSite = translate(strip(sSite));
    10553 +        sUser = strip(sUser);
    10554 +        sPassword = strip(sPassword);
    10555 +        if (sSite = '' | sPassword = '' | sUser = '') then
    10556 +            say 'warning! misformed password line!';
    10557 +        if (sSite = sSiteToFind) then
    10558 +        do
    10559 +           sRet = sUser||':'||sPassword;
    10560 +           leave
    10561 +        end
    10562 +    end
    10563 +    call stream sPasswd, 'c', 'close';
    10564 +return sRet;
    10565 +
    10566 +
    10567 +/*
    10568 + * REXX FTP put function.
    10569 + */
    10570 +putRexxFtp: procedure
    10571 +    parse arg sFile, sLockFile, sRemoteDir, sSite
    10572 +
    10573 +    /* check for done-lock */
    10574 +    if stream(sLockFile,'c','query exists') = '' then
    10575 +    do
    10576 +        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    10577 +
    10578 +        /* get password */
    10579 +        sPasswdString = GetPassword(sSite);
    10580 +        if (sPasswdString = '') then
    10581 +        do
    10582 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    10583 +            return -1;
    10584 +        end
    10585 +        parse var sPasswdString sUser':'sPasswd;
    10586 +
    10587 +        /* log on the ftp site */
    10588 +        rc = FtpSetUser(sSite, sUser, sPasswd);
    10589 +        if (rc = 1) then
    10590 +        do
    10591 +            /* put file, delete it if we fail */
    10592 +            say sSite  sUser  sPasswd  sFile  sRemoteDir'/'filespec('name', sFile)  'Binary'
    10593 +            rcPut = FtpPut(sFile, sRemoteDir'/'filespec('name',sFile), 'Binary');
    10594 +            /*
    10595 +            if (rcPut <> 0) then
    10596 +                rc = FtpDelete(sRemoteDir'/'filespec('name', sFile));
    10597 +            */
    10598 +
    10599 +            /* Logoff and make lock file. */
    10600 +            rc = FtpLogoff();
    10601 +            if (rcPut = 0) then
    10602 +                'echo ok  ' || sLockFile; /* changed - no lockfile */
    10603 +            else
    10604 +                call failure2 rc, 'FtpPut failed -' sSite , FTPERRNO;
    10605 +            rc = rcPut;
    10606 +        end
    10607 +        else
    10608 +        do
    10609 +            call failure2 rc, 'Logon failed -' sSite, FTPERRNO;
    10610 +            if rc = 0 then rc = -1;
    10611 +        end
    10612 +    end
    10613 +    else
    10614 +        rc = 0;
    10615 +return 0;
    10616 +
    10617 +
    10618 diff --git a/tools/DailyBuild/odin32dbupl.cmd b/tools/DailyBuild/odin32dbupl.cmd
    10619 index 4c0b7ce..54f4fd1 100644
    10620 --- a/tools/DailyBuild/odin32dbupl.cmd
    10621 +++ b/tools/DailyBuild/odin32dbupl.cmd
    10622 @@ -1,178 +1,178 @@
    10623 -/* $Id: odin32dbupl.cmd,v 1.2 2002-06-26 22:10:23 bird Exp $
    10624 - *
    10625 - * Updates the Odin32 API database.
    10626 - *
    10627 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    10628 - *
    10629 - * Project Odin Software License can be found in LICENSE.TXT
    10630 - *
    10631 - */
    10632 -
    10633 -    /* get build settings */
    10634 -    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10635 -    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10636 -    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10637 -
    10638 -    /* load rexxutils functions */
    10639 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    10640 -    call SysloadFuncs;
    10641 -
    10642 -    sPwdDummy = GetPassword('odin32dbupdate');
    10643 -    parse var sPwdDummy sPasswd':'sDummy
    10644 -    'wget -O /dev/con http://www.netlabs.org/odin/odin32dbtest/Odin32DBUpdate.phtml?sPasswd='||sPasswd
    10645 -    if (rc <> 0) then call failure rc, 'wget failed';
    10646 -
    10647 -
    10648 -    exit(0);
    10649 -
    10650 -failure: procedure
    10651 -parse arg rc, sText;
    10652 -    say 'rc='rc sText
    10653 -    exit(rc);
    10654 -
    10655 -failure2: procedure
    10656 -parse arg rc, sText;
    10657 -    say 'rc='rc sText
    10658 -    return 0;
    10659 -
    10660 -
    10661 -/*
    10662 - * Get the MySql data directory.
    10663 - */
    10664 -getMySqlDataDir: procedure
    10665 -
    10666 -    /* Get mysql variables */
    10667 -    '@mysqladmin variables | rxqueue /lifo'
    10668 -
    10669 -    /* Get datadir */
    10670 -    sDataDir = '';
    10671 -    do queued()
    10672 -        pull s;
    10673 -        if (pos(' DATADIR ', s) > 0) then
    10674 -        do
    10675 -            sDataDir = strip( substr( s, pos('|',s,3) + 1 ) );
    10676 -            sDataDir = strip( substr(sDataDir, 1, length(sDataDir)-1) );
    10677 -            leave;
    10678 -        end
    10679 -    end
    10680 -
    10681 -    /* Drain queue */
    10682 -    do queued()
    10683 -        pull s
    10684 -    end
    10685 -    drop s;
    10686 -
    10687 -    /* If failure set default directory. */
    10688 -    if (sDataDir = '') then
    10689 -        sDataDir = 'd:\knut\Apps\MySql\data\';
    10690 -    return sDataDir;
    10691 -
    10692 -/*
    10693 - *
    10694 - *  From odin32ftp2.cmd
    10695 - *  From odin32ftp2.cmd
    10696 - *  From odin32ftp2.cmd
    10697 - *  From odin32ftp2.cmd
    10698 - *  From odin32ftp2.cmd
    10699 - *  From odin32ftp2.cmd
    10700 - *
    10701 - */
    10702 -
    10703 -
    10704 -/*
    10705 - * Reads the password file (passwd) in the script directory to
    10706 - *   get a password and userid for a given site.
    10707 - *
    10708 - * Format of the passwd file is:
    10709 - *  <site> <user> <password>
    10710 - * Lines starting with '#' is ignored.
    10711 - *
    10712 - * @param   sSite   name of the site.
    10713 - * @returns String on the form '<userid>:<passwd>' if found.
    10714 - *          Empty string if not found.
    10715 - */
    10716 -GetPassword: procedure;
    10717 -    parse upper arg sSiteToFind
    10718 -    parse source sd1 sd2 sScript
    10719 -    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    10720 -
    10721 -    rc = stream(sPasswd, 'c', 'open read');
    10722 -    if (pos('READY', rc) <> 1) then
    10723 -    do
    10724 -        say 'failed to open ftp password file - rc='rc;
    10725 -        return '';
    10726 -    end
    10727 -
    10728 -    sRet = '';
    10729 -    do while (lines(sPasswd) > 0)
    10730 -        sLine = strip(linein(sPasswd));
    10731 -        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    10732 -            iterate;
    10733 -
    10734 -        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    10735 -        sSite = translate(strip(sSite));
    10736 -        sUser = strip(sUser);
    10737 -        sPassword = strip(sPassword);
    10738 -        if (sSite = '' | sPassword = '' | sUser = '') then
    10739 -            say 'warning! misformed password line!';
    10740 -        if (sSite = sSiteToFind) then
    10741 -        do
    10742 -           sRet = sUser||':'||sPassword;
    10743 -           leave
    10744 -        end
    10745 -    end
    10746 -    call stream sPasswd, 'c', 'close';
    10747 -    return sRet;
    10748 -
    10749 -
    10750 -/*
    10751 - * REXX FTP put function.
    10752 - */
    10753 -putRexxFtp: procedure
    10754 -    parse arg sFile, sLockFile, sRemoteDir, sSite
    10755 -
    10756 -    /* check for done-lock */
    10757 -    if stream(sLockFile,'c','query exists') = '' then
    10758 -    do
    10759 -        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    10760 -
    10761 -        /* get password */
    10762 -        sPasswdString = GetPassword(sSite);
    10763 -        if (sPasswdString = '') then
    10764 -        do
    10765 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    10766 -            return -1;
    10767 -        end
    10768 -        parse var sPasswdString sUser':'sPasswd;
    10769 -
    10770 -        /* log on the ftp site */
    10771 -        rc = FtpSetUser(sSite, sUser, sPasswd);
    10772 -        if (rc = 1) then
    10773 -        do
    10774 -            /* put file, delete it if we fail */
    10775 -            say sSite  sUser  sPasswd  sFile  sRemoteDir'/'filespec('name', sFile)  'Binary'
    10776 -            rcPut = FtpPut(sFile, sRemoteDir'/'filespec('name',sFile), 'Binary');
    10777 -            /*
    10778 -            if (rcPut <> 0) then
    10779 -                rc = FtpDelete(sRemoteDir'/'filespec('name', sFile));
    10780 -            */
    10781 -
    10782 -            /* Logoff and make lock file. */
    10783 -            rc = FtpLogoff();
    10784 -            if (rcPut = 0) then
    10785 -                'echo ok  ' || sLockFile; /* changed - no lockfile */
    10786 -            else
    10787 -                call failure2 rc, 'FtpPut failed -' sSite , FTPERRNO;
    10788 -            rc = rcPut;
    10789 -        end
    10790 -        else
    10791 -        do
    10792 -            call failure2 rc, 'Logon failed -' sSite, FTPERRNO;
    10793 -            if rc = 0 then rc = -1;
    10794 -        end
    10795 -    end
    10796 -    else
    10797 -        rc = 0;
    10798 -    return 0;
    10799 -
    10800 -
    10801 +/* $Id: odin32dbupl.cmd,v 1.2 2002-06-26 22:10:23 bird Exp $
    10802 + *
    10803 + * Updates the Odin32 API database.
    10804 + *
    10805 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    10806 + *
    10807 + * Project Odin Software License can be found in LICENSE.TXT
    10808 + *
    10809 + */
    10810 +
    10811 +    /* get build settings */
    10812 +    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    10813 +    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    10814 +    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    10815 +
    10816 +    /* load rexxutils functions */
    10817 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    10818 +    call SysloadFuncs;
    10819 +
    10820 +    sPwdDummy = GetPassword('odin32dbupdate');
    10821 +    parse var sPwdDummy sPasswd':'sDummy
    10822 +    'wget -O /dev/con http://www.netlabs.org/odin/odin32dbtest/Odin32DBUpdate.phtml?sPasswd='||sPasswd
    10823 +    if (rc <> 0) then call failure rc, 'wget failed';
    10824 +
    10825 +
    10826 +    exit(0);
    10827 +
    10828 +failure: procedure
    10829 +parse arg rc, sText;
    10830 +    say 'rc='rc sText
    10831 +    exit(rc);
    10832 +
    10833 +failure2: procedure
    10834 +parse arg rc, sText;
    10835 +    say 'rc='rc sText
    10836 +    return 0;
    10837 +
    10838 +
    10839 +/*
    10840 + * Get the MySql data directory.
    10841 + */
    10842 +getMySqlDataDir: procedure
    10843 +
    10844 +    /* Get mysql variables */
    10845 +    '@mysqladmin variables | rxqueue /lifo'
    10846 +
    10847 +    /* Get datadir */
    10848 +    sDataDir = '';
    10849 +    do queued()
    10850 +        pull s;
    10851 +        if (pos(' DATADIR ', s) > 0) then
    10852 +        do
    10853 +            sDataDir = strip( substr( s, pos('|',s,3) + 1 ) );
    10854 +            sDataDir = strip( substr(sDataDir, 1, length(sDataDir)-1) );
    10855 +            leave;
    10856 +        end
    10857 +    end
    10858 +
    10859 +    /* Drain queue */
    10860 +    do queued()
    10861 +        pull s
    10862 +    end
    10863 +    drop s;
    10864 +
    10865 +    /* If failure set default directory. */
    10866 +    if (sDataDir = '') then
    10867 +        sDataDir = 'd:\knut\Apps\MySql\data\';
    10868 +    return sDataDir;
    10869 +
    10870 +/*
    10871 + *
    10872 + *  From odin32ftp2.cmd
    10873 + *  From odin32ftp2.cmd
    10874 + *  From odin32ftp2.cmd
    10875 + *  From odin32ftp2.cmd
    10876 + *  From odin32ftp2.cmd
    10877 + *  From odin32ftp2.cmd
    10878 + *
    10879 + */
    10880 +
    10881 +
    10882 +/*
    10883 + * Reads the password file (passwd) in the script directory to
    10884 + *   get a password and userid for a given site.
    10885 + *
    10886 + * Format of the passwd file is:
    10887 + *  <site> <user> <password>
    10888 + * Lines starting with '#' is ignored.
    10889 + *
    10890 + * @param   sSite   name of the site.
    10891 + * @returns String on the form '<userid>:<passwd>' if found.
    10892 + *          Empty string if not found.
    10893 + */
    10894 +GetPassword: procedure;
    10895 +    parse upper arg sSiteToFind
    10896 +    parse source sd1 sd2 sScript
    10897 +    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    10898 +
    10899 +    rc = stream(sPasswd, 'c', 'open read');
    10900 +    if (pos('READY', rc) <> 1) then
    10901 +    do
    10902 +        say 'failed to open ftp password file - rc='rc;
    10903 +        return '';
    10904 +    end
    10905 +
    10906 +    sRet = '';
    10907 +    do while (lines(sPasswd) > 0)
    10908 +        sLine = strip(linein(sPasswd));
    10909 +        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    10910 +            iterate;
    10911 +
    10912 +        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    10913 +        sSite = translate(strip(sSite));
    10914 +        sUser = strip(sUser);
    10915 +        sPassword = strip(sPassword);
    10916 +        if (sSite = '' | sPassword = '' | sUser = '') then
    10917 +            say 'warning! misformed password line!';
    10918 +        if (sSite = sSiteToFind) then
    10919 +        do
    10920 +           sRet = sUser||':'||sPassword;
    10921 +           leave
    10922 +        end
    10923 +    end
    10924 +    call stream sPasswd, 'c', 'close';
    10925 +    return sRet;
    10926 +
    10927 +
    10928 +/*
    10929 + * REXX FTP put function.
    10930 + */
    10931 +putRexxFtp: procedure
    10932 +    parse arg sFile, sLockFile, sRemoteDir, sSite
    10933 +
    10934 +    /* check for done-lock */
    10935 +    if stream(sLockFile,'c','query exists') = '' then
    10936 +    do
    10937 +        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    10938 +
    10939 +        /* get password */
    10940 +        sPasswdString = GetPassword(sSite);
    10941 +        if (sPasswdString = '') then
    10942 +        do
    10943 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    10944 +            return -1;
    10945 +        end
    10946 +        parse var sPasswdString sUser':'sPasswd;
    10947 +
    10948 +        /* log on the ftp site */
    10949 +        rc = FtpSetUser(sSite, sUser, sPasswd);
    10950 +        if (rc = 1) then
    10951 +        do
    10952 +            /* put file, delete it if we fail */
    10953 +            say sSite  sUser  sPasswd  sFile  sRemoteDir'/'filespec('name', sFile)  'Binary'
    10954 +            rcPut = FtpPut(sFile, sRemoteDir'/'filespec('name',sFile), 'Binary');
    10955 +            /*
    10956 +            if (rcPut <> 0) then
    10957 +                rc = FtpDelete(sRemoteDir'/'filespec('name', sFile));
    10958 +            */
    10959 +
    10960 +            /* Logoff and make lock file. */
    10961 +            rc = FtpLogoff();
    10962 +            if (rcPut = 0) then
    10963 +                'echo ok  ' || sLockFile; /* changed - no lockfile */
    10964 +            else
    10965 +                call failure2 rc, 'FtpPut failed -' sSite , FTPERRNO;
    10966 +            rc = rcPut;
    10967 +        end
    10968 +        else
    10969 +        do
    10970 +            call failure2 rc, 'Logon failed -' sSite, FTPERRNO;
    10971 +            if rc = 0 then rc = -1;
    10972 +        end
    10973 +    end
    10974 +    else
    10975 +        rc = 0;
    10976 +    return 0;
    10977 +
    10978 +
    10979 diff --git a/tools/DailyBuild/odin32env.cmd b/tools/DailyBuild/odin32env.cmd
    10980 index 6e97e35..52c5f90 100644
    10981 --- a/tools/DailyBuild/odin32env.cmd
    10982 +++ b/tools/DailyBuild/odin32env.cmd
    10983 @@ -1,31 +1,31 @@
    10984 -/* $Id: odin32env.cmd,v 1.32 2003-04-14 22:23:47 bird Exp $
    10985 - *
    10986 - * Sets the build environment.
    10987 - *
    10988 - * Copyright (c) 1999-2003 knut st. osmundsen (bird@anduin.net)
    10989 - *
    10990 - * Project Odin Software License can be found in LICENSE.TXT
    10991 - *
    10992 - */
    10993 -
    10994 -/*
    10995 - * Source dir.
    10996 - */
    10997 -parse source . . sSrc
    10998 -sDir = filespec('drive', sSrc) || filespec('path', sSrc);
    10999 -
    11000 -/* base env */
    11001 -'Set PATH='||sDir||'bin'||';%PATH%';
    11002 -sOldDir = directory();
    11003 -call directory sDir||'bin';
    11004 -call BuildEnv 'warpin mysql perl~ cvs ddkbase mscv6-16 emx gcc321 vac365õ watcomc11cõ vac40õ vac308 toolkit40 debug'
    11005 -call directory sOldDir;
    11006 -
    11007 -/* minor adjustments. */
    11008 -'Set CVSROOT=:pserver:bird@www.netlabs.org:/netlabs.cvs/odin32';
    11009 -'Set MULTIJOBS=1';
    11010 -'Set BUILD_SETUP_MAK=';
    11011 -'Set EMX=%PATH_EMXPGCC%';
    11012 -
    11013 -exit(0);
    11014 -
    11015 +/* $Id: odin32env.cmd,v 1.32 2003-04-14 22:23:47 bird Exp $
    11016 + *
    11017 + * Sets the build environment.
    11018 + *
    11019 + * Copyright (c) 1999-2003 knut st. osmundsen (bird@anduin.net)
    11020 + *
    11021 + * Project Odin Software License can be found in LICENSE.TXT
    11022 + *
    11023 + */
    11024 +
    11025 +/*
    11026 + * Source dir.
    11027 + */
    11028 +parse source . . sSrc
    11029 +sDir = filespec('drive', sSrc) || filespec('path', sSrc);
    11030 +
    11031 +/* base env */
    11032 +'Set PATH='||sDir||'bin'||';%PATH%';
    11033 +sOldDir = directory();
    11034 +call directory sDir||'bin';
    11035 +call BuildEnv 'warpin mysql perl~ cvs ddkbase mscv6-16 emx gcc321 vac365õ watcomc11cõ vac40õ vac308 toolkit40 debug'
    11036 +call directory sOldDir;
    11037 +
    11038 +/* minor adjustments. */
    11039 +'Set CVSROOT=:pserver:bird@www.netlabs.org:/netlabs.cvs/odin32';
    11040 +'Set MULTIJOBS=1';
    11041 +'Set BUILD_SETUP_MAK=';
    11042 +'Set EMX=%PATH_EMXPGCC%';
    11043 +
    11044 +exit(0);
    11045 +
    11046 diff --git a/tools/DailyBuild/odin32ftp.cmd b/tools/DailyBuild/odin32ftp.cmd
    11047 index 7694968..e7826f8 100644
    11048 --- a/tools/DailyBuild/odin32ftp.cmd
    11049 +++ b/tools/DailyBuild/odin32ftp.cmd
    11050 @@ -1,232 +1,232 @@
    11051 -/* $Id: odin32ftp.cmd,v 1.3 2002-06-26 22:10:45 bird Exp $
    11052 - *
    11053 - * Old FTP routines using only RexxFTP.
    11054 - *
    11055 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    11056 - *
    11057 - * Project Odin Software License can be found in LICENSE.TXT
    11058 - *
    11059 - */
    11060 -/*Trace 'A'*/
    11061 -
    11062 -/* get build settings */
    11063 -sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    11064 -sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    11065 -if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    11066 -
    11067 -
    11068 -rc = RxFuncAdd('FtpLoadFuncs','rxFtp','FtpLoadFuncs');
    11069 -rc = FtpLoadFuncs();
    11070 -
    11071 -parse arg sLoc
    11072 -
    11073 -do i = 1 to 7
    11074 -    sFile   = 'odin32bin-'|| sDate;
    11075 -    sDelete = 'odin32bin-'|| DateSub(sDate, 7);
    11076 -    sFileDbg   = sFile   || '-debug.zip';
    11077 -    sDeleteDbg = sDelete || '-debug.zip';
    11078 -    sFileRel   = sFile   || '-release.zip';
    11079 -    sDeleteRel = sDelete || '-release.zip';
    11080 -
    11081 -    if (sLoc = '' | sLoc = 'os2') then
    11082 -    do
    11083 -        /*              (sFile,                  sFileRemote,                     sDelete,         sLockFile,             sSite); */
    11084 -        rc = putfunction(sFileDbg,         '/daily/'sFileDbg,         '/daily/'sDeleteDbg,       'os2-debug',     'ftp.os2.org');
    11085 -        rc = putfunction(sFileRel,         '/daily/'sFileRel,         '/daily/'sDeleteRel,     'os2-release',     'ftp.os2.org');
    11086 -        rc = putfunction('ChangeLog',     '/daily/Changelog',         '/daily/'sDeleteRel,      'os2-Change',     'ftp.os2.org');
    11087 -    end
    11088 -
    11089 -    if (sLoc = '' | sLoc = 'netlabs') then
    11090 -    do
    11091 -        /*              (sFile,                     sFileRemote,                     sDelete,          sLockFile,             sSite); */
    11092 -        rc = putfunction(sFileDbg,    '/odinftp/daily/'sFileDbg, '/odinftp/daily/'sDeleteDbg,    'netlabs-debug', 'ftp.netlabs.org');
    11093 -        rc = putfunction(sFileRel,    '/odinftp/daily/'sFileRel, '/odinftp/daily/'sDeleteRel,  'netlabs-release', 'ftp.netlabs.org');
    11094 -        rc = putfunction('ChangeLog','/odinftp/daily/ChangeLog', '/odinftp/daily/'sDeleteRel,'netlabs-changelog', 'ftp.netlabs.org');
    11095 -    end
    11096 -end
    11097 -
    11098 -exit(0);
    11099 -
    11100 -putfunction: procedure
    11101 -    parse arg sFile, sFileRemote, sDelete, sLockFile, sSite
    11102 -    if stream(sLockFile,'c','query exists') = '' then
    11103 -    do
    11104 -        say '---'
    11105 -        say sFile
    11106 -        say sFileRemote;
    11107 -        say sDelete
    11108 -        say sLockFile
    11109 -        say sSite
    11110 -
    11111 -        /* get password */
    11112 -        sPasswdString = GetPassword(sSite);
    11113 -        if (sPasswdString = '') then
    11114 -        do
    11115 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    11116 -            return -1;
    11117 -        end
    11118 -        parse var sPasswdString sUser':'sPasswd;
    11119 -        /*
    11120 -        say sUser
    11121 -        say sPasswd */
    11122 -
    11123 -        say sSite':' sFile '-> ' sFileRemote;
    11124 -        rc = FtpSetUser(sSite, sUser, sPasswd);
    11125 -        if (rc = 1) then
    11126 -        do
    11127 -            rc = 0;
    11128 -            if (sType <> 'D') then
    11129 -                rc = FtpDelete(sFileRemote);
    11130 -            rcPut = FtpPut(sFile, sFileRemote, 'Binary');
    11131 -            if (rcPut <> 0) then
    11132 -                rc = FtpDelete(sFileRemote);
    11133 -            rc = FtpDelete(sDelete)
    11134 -            say sDelete ' - ' rc
    11135 -            rc = FtpLogoff();
    11136 -            if (rcPut = 0) then
    11137 -                'echo ok > ' || sLockFile;
    11138 -            else
    11139 -                call failure rc, 'FtpPut failed -' sSite , FTPERRNO;
    11140 -            rc = rcPut;
    11141 -        end
    11142 -        else
    11143 -        do
    11144 -            call failure rc, 'Logon failed -' sSite, FTPERRNO;
    11145 -            if rc = 0 then rc = -1;
    11146 -        end
    11147 -    end
    11148 -    else
    11149 -        rc = 0;
    11150 -
    11151 -    return 0;
    11152 -
    11153 -
    11154 -
    11155 -
    11156 -
    11157 -failure: procedure
    11158 -parse arg rc, sText, iftperrno;
    11159 -    say 'rc='rc sText
    11160 -    say 'FTPerrno:'||iftperrno
    11161 -return;
    11162 -
    11163 -
    11164 -
    11165 -
    11166 -
    11167 -/*
    11168 - * Reads the password file (passwd) in the script directory to
    11169 - *   get a password and userid for a given site.
    11170 - *
    11171 - * Format of the passwd file is:
    11172 - *  <site> <user> <password>
    11173 - * Lines starting with '#' is ignored.
    11174 - *
    11175 - * @param   sSite   name of the site.
    11176 - * @returns String on the form '<userid>:<passwd>' if found.
    11177 - *          Empty string if not found.
    11178 - */
    11179 -GetPassword: procedure;
    11180 -    parse upper arg sSiteToFind
    11181 -    parse source sd1 sd2 sScript
    11182 -    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    11183 -
    11184 -    rc = stream(sPasswd, 'c', 'open read');
    11185 -    if (pos('READY', rc) <> 1) then
    11186 -    do
    11187 -        say 'failed to open ftp password file - rc='rc;
    11188 -        return '';
    11189 -    end
    11190 -
    11191 -    sRet = '';
    11192 -    do while (lines(sPasswd) > 0)
    11193 -        sLine = strip(linein(sPasswd));
    11194 -        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    11195 -            iterate;
    11196 -
    11197 -        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    11198 -        sSite = translate(strip(sSite));
    11199 -        sUser = strip(sUser);
    11200 -        sPassword = strip(sPassword);
    11201 -        if (sSite = '' | sPassword = '' | sUser = '') then
    11202 -            say 'warning! misformed password line!';
    11203 -        if (sSite = sSiteToFind) then
    11204 -        do
    11205 -           sRet = sUser||':'||sPassword;
    11206 -           leave
    11207 -        end
    11208 -    end
    11209 -    call stream sPasswd, 'c', 'close';
    11210 -return sRet;
    11211 -
    11212 -
    11213 -/**
    11214 - * Finds date seven days ago.
    11215 - * @returns  yyyymmdd date
    11216 - * @param    sDate  Date on the yyyymmdd format.
    11217 - * @param    cDays  Number of days to subtract.
    11218 - * @remark   Works only for dates between 1000-01-01 and 9999-12-31
    11219 - *           including the limits.
    11220 - */
    11221 -DateSub: procedure
    11222 -parse arg sDate, cDays
    11223 -
    11224 -    /* subtraction loop which updates sDate and cDays for each iteration. */
    11225 -    do while (cDays > 0)
    11226 -        /*
    11227 -         * Get the day in month of sDate.
    11228 -         * Do a simple subtraction is this is higher than the number of days to subtract.
    11229 -         */
    11230 -        iDayInMonth = substr(sDate, 7, 2);
    11231 -        if (iDayInMonth > cDays) then
    11232 -            return sDate - cDays;
    11233 -
    11234 -        /*
    11235 -         * Determin previous month and the number of days in it.
    11236 -         */
    11237 -        iMonth = substr(sDate, 5, 2);
    11238 -        iYear = substr(sDate, 1, 4);
    11239 -        if (iMonth > 1) then
    11240 -            iPrvMonth = iMonth - 1;
    11241 -        else
    11242 -            iPrvMonth = 12;
    11243 -        cDaysPrvMonth = DateGetDaysInMonth(iYear, iPrvMonth);
    11244 -
    11245 -        /*
    11246 -         * Update date and days left to subtract.
    11247 -         */
    11248 -        cDays = cDays - iDayInMonth;
    11249 -        if (iMonth > 1) then
    11250 -            sDate = sDate - iDayInMonth - 100 + cDaysPrvMonth; /* last day of previous month */
    11251 -        else
    11252 -            sDate = sDate - iDayInMonth - 8869;   /* last day of last year */
    11253 -    end
    11254 -return sDate;
    11255 -
    11256 -
    11257 -/*
    11258 - * Gets the number of days in a given month.
    11259 - * @param       iYear   the year.
    11260 - * @param       iMonth  the month.
    11261 - */
    11262 -DateGetDaysInMonth: procedure
    11263 -    parse arg iYear, iMonth
    11264 -
    11265 -    select
    11266 -        when (iMonth = 4 | iMonth = 6 | iMonth = 9 | iMonth = 11) then
    11267 -            cDays = 30;
    11268 -
    11269 -        when (iMonth = 2) then
    11270 -        do
    11271 -            if ((iYear // 4) = 0) & (((iYear // 400) <> 0) | ((iYear // 2000) = 0)) then
    11272 -                cDays = 29;
    11273 -            else
    11274 -                cDays = 28;
    11275 -        end
    11276 -
    11277 -        otherwise
    11278 -            cDays = 31;
    11279 -    end /* select */
    11280 -return cDays;
    11281 -
    11282 -
    11283 +/* $Id: odin32ftp.cmd,v 1.3 2002-06-26 22:10:45 bird Exp $
    11284 + *
    11285 + * Old FTP routines using only RexxFTP.
    11286 + *
    11287 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    11288 + *
    11289 + * Project Odin Software License can be found in LICENSE.TXT
    11290 + *
    11291 + */
    11292 +/*Trace 'A'*/
    11293 +
    11294 +/* get build settings */
    11295 +sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    11296 +sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    11297 +if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    11298 +
    11299 +
    11300 +rc = RxFuncAdd('FtpLoadFuncs','rxFtp','FtpLoadFuncs');
    11301 +rc = FtpLoadFuncs();
    11302 +
    11303 +parse arg sLoc
    11304 +
    11305 +do i = 1 to 7
    11306 +    sFile   = 'odin32bin-'|| sDate;
    11307 +    sDelete = 'odin32bin-'|| DateSub(sDate, 7);
    11308 +    sFileDbg   = sFile   || '-debug.zip';
    11309 +    sDeleteDbg = sDelete || '-debug.zip';
    11310 +    sFileRel   = sFile   || '-release.zip';
    11311 +    sDeleteRel = sDelete || '-release.zip';
    11312 +
    11313 +    if (sLoc = '' | sLoc = 'os2') then
    11314 +    do
    11315 +        /*              (sFile,                  sFileRemote,                     sDelete,         sLockFile,             sSite); */
    11316 +        rc = putfunction(sFileDbg,         '/daily/'sFileDbg,         '/daily/'sDeleteDbg,       'os2-debug',     'ftp.os2.org');
    11317 +        rc = putfunction(sFileRel,         '/daily/'sFileRel,         '/daily/'sDeleteRel,     'os2-release',     'ftp.os2.org');
    11318 +        rc = putfunction('ChangeLog',     '/daily/Changelog',         '/daily/'sDeleteRel,      'os2-Change',     'ftp.os2.org');
    11319 +    end
    11320 +
    11321 +    if (sLoc = '' | sLoc = 'netlabs') then
    11322 +    do
    11323 +        /*              (sFile,                     sFileRemote,                     sDelete,          sLockFile,             sSite); */
    11324 +        rc = putfunction(sFileDbg,    '/odinftp/daily/'sFileDbg, '/odinftp/daily/'sDeleteDbg,    'netlabs-debug', 'ftp.netlabs.org');
    11325 +        rc = putfunction(sFileRel,    '/odinftp/daily/'sFileRel, '/odinftp/daily/'sDeleteRel,  'netlabs-release', 'ftp.netlabs.org');
    11326 +        rc = putfunction('ChangeLog','/odinftp/daily/ChangeLog', '/odinftp/daily/'sDeleteRel,'netlabs-changelog', 'ftp.netlabs.org');
    11327 +    end
    11328 +end
    11329 +
    11330 +exit(0);
    11331 +
    11332 +putfunction: procedure
    11333 +    parse arg sFile, sFileRemote, sDelete, sLockFile, sSite
    11334 +    if stream(sLockFile,'c','query exists') = '' then
    11335 +    do
    11336 +        say '---'
    11337 +        say sFile
    11338 +        say sFileRemote;
    11339 +        say sDelete
    11340 +        say sLockFile
    11341 +        say sSite
    11342 +
    11343 +        /* get password */
    11344 +        sPasswdString = GetPassword(sSite);
    11345 +        if (sPasswdString = '') then
    11346 +        do
    11347 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    11348 +            return -1;
    11349 +        end
    11350 +        parse var sPasswdString sUser':'sPasswd;
    11351 +        /*
    11352 +        say sUser
    11353 +        say sPasswd */
    11354 +
    11355 +        say sSite':' sFile '-> ' sFileRemote;
    11356 +        rc = FtpSetUser(sSite, sUser, sPasswd);
    11357 +        if (rc = 1) then
    11358 +        do
    11359 +            rc = 0;
    11360 +            if (sType <> 'D') then
    11361 +                rc = FtpDelete(sFileRemote);
    11362 +            rcPut = FtpPut(sFile, sFileRemote, 'Binary');
    11363 +            if (rcPut <> 0) then
    11364 +                rc = FtpDelete(sFileRemote);
    11365 +            rc = FtpDelete(sDelete)
    11366 +            say sDelete ' - ' rc
    11367 +            rc = FtpLogoff();
    11368 +            if (rcPut = 0) then
    11369 +                'echo ok > ' || sLockFile;
    11370 +            else
    11371 +                call failure rc, 'FtpPut failed -' sSite , FTPERRNO;
    11372 +            rc = rcPut;
    11373 +        end
    11374 +        else
    11375 +        do
    11376 +            call failure rc, 'Logon failed -' sSite, FTPERRNO;
    11377 +            if rc = 0 then rc = -1;
    11378 +        end
    11379 +    end
    11380 +    else
    11381 +        rc = 0;
    11382 +
    11383 +    return 0;
    11384 +
    11385 +
    11386 +
    11387 +
    11388 +
    11389 +failure: procedure
    11390 +parse arg rc, sText, iftperrno;
    11391 +    say 'rc='rc sText
    11392 +    say 'FTPerrno:'||iftperrno
    11393 +return;
    11394 +
    11395 +
    11396 +
    11397 +
    11398 +
    11399 +/*
    11400 + * Reads the password file (passwd) in the script directory to
    11401 + *   get a password and userid for a given site.
    11402 + *
    11403 + * Format of the passwd file is:
    11404 + *  <site> <user> <password>
    11405 + * Lines starting with '#' is ignored.
    11406 + *
    11407 + * @param   sSite   name of the site.
    11408 + * @returns String on the form '<userid>:<passwd>' if found.
    11409 + *          Empty string if not found.
    11410 + */
    11411 +GetPassword: procedure;
    11412 +    parse upper arg sSiteToFind
    11413 +    parse source sd1 sd2 sScript
    11414 +    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    11415 +
    11416 +    rc = stream(sPasswd, 'c', 'open read');
    11417 +    if (pos('READY', rc) <> 1) then
    11418 +    do
    11419 +        say 'failed to open ftp password file - rc='rc;
    11420 +        return '';
    11421 +    end
    11422 +
    11423 +    sRet = '';
    11424 +    do while (lines(sPasswd) > 0)
    11425 +        sLine = strip(linein(sPasswd));
    11426 +        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    11427 +            iterate;
    11428 +
    11429 +        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    11430 +        sSite = translate(strip(sSite));
    11431 +        sUser = strip(sUser);
    11432 +        sPassword = strip(sPassword);
    11433 +        if (sSite = '' | sPassword = '' | sUser = '') then
    11434 +            say 'warning! misformed password line!';
    11435 +        if (sSite = sSiteToFind) then
    11436 +        do
    11437 +           sRet = sUser||':'||sPassword;
    11438 +           leave
    11439 +        end
    11440 +    end
    11441 +    call stream sPasswd, 'c', 'close';
    11442 +return sRet;
    11443 +
    11444 +
    11445 +/**
    11446 + * Finds date seven days ago.
    11447 + * @returns  yyyymmdd date
    11448 + * @param    sDate  Date on the yyyymmdd format.
    11449 + * @param    cDays  Number of days to subtract.
    11450 + * @remark   Works only for dates between 1000-01-01 and 9999-12-31
    11451 + *           including the limits.
    11452 + */
    11453 +DateSub: procedure
    11454 +parse arg sDate, cDays
    11455 +
    11456 +    /* subtraction loop which updates sDate and cDays for each iteration. */
    11457 +    do while (cDays > 0)
    11458 +        /*
    11459 +         * Get the day in month of sDate.
    11460 +         * Do a simple subtraction is this is higher than the number of days to subtract.
    11461 +         */
    11462 +        iDayInMonth = substr(sDate, 7, 2);
    11463 +        if (iDayInMonth > cDays) then
    11464 +            return sDate - cDays;
    11465 +
    11466 +        /*
    11467 +         * Determin previous month and the number of days in it.
    11468 +         */
    11469 +        iMonth = substr(sDate, 5, 2);
    11470 +        iYear = substr(sDate, 1, 4);
    11471 +        if (iMonth > 1) then
    11472 +            iPrvMonth = iMonth - 1;
    11473 +        else
    11474 +            iPrvMonth = 12;
    11475 +        cDaysPrvMonth = DateGetDaysInMonth(iYear, iPrvMonth);
    11476 +
    11477 +        /*
    11478 +         * Update date and days left to subtract.
    11479 +         */
    11480 +        cDays = cDays - iDayInMonth;
    11481 +        if (iMonth > 1) then
    11482 +            sDate = sDate - iDayInMonth - 100 + cDaysPrvMonth; /* last day of previous month */
    11483 +        else
    11484 +            sDate = sDate - iDayInMonth - 8869;   /* last day of last year */
    11485 +    end
    11486 +return sDate;
    11487 +
    11488 +
    11489 +/*
    11490 + * Gets the number of days in a given month.
    11491 + * @param       iYear   the year.
    11492 + * @param       iMonth  the month.
    11493 + */
    11494 +DateGetDaysInMonth: procedure
    11495 +    parse arg iYear, iMonth
    11496 +
    11497 +    select
    11498 +        when (iMonth = 4 | iMonth = 6 | iMonth = 9 | iMonth = 11) then
    11499 +            cDays = 30;
    11500 +
    11501 +        when (iMonth = 2) then
    11502 +        do
    11503 +            if ((iYear // 4) = 0) & (((iYear // 400) <> 0) | ((iYear // 2000) = 0)) then
    11504 +                cDays = 29;
    11505 +            else
    11506 +                cDays = 28;
    11507 +        end
    11508 +
    11509 +        otherwise
    11510 +            cDays = 31;
    11511 +    end /* select */
    11512 +return cDays;
    11513 +
    11514 +
    11515 diff --git a/tools/DailyBuild/odin32ftp2.cmd b/tools/DailyBuild/odin32ftp2.cmd
    11516 index f0ea724..048aceb 100644
    11517 --- a/tools/DailyBuild/odin32ftp2.cmd
    11518 +++ b/tools/DailyBuild/odin32ftp2.cmd
    11519 @@ -1,460 +1,460 @@
    11520 -/* $Id: odin32ftp2.cmd,v 1.21 2003-04-14 22:08:04 bird Exp $
    11521 - *
    11522 - * Uploads the relase and debug builds to the FTP sites.
    11523 - *
    11524 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    11525 - *
    11526 - * Project Odin Software License can be found in LICENSE.TXT
    11527 - *
    11528 - */
    11529 -/*Trace 'A'*/
    11530 -
    11531 -/* get build settings */
    11532 -sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    11533 -sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    11534 -if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    11535 -
    11536 -
    11537 -rc = RxFuncAdd('FtpLoadFuncs','rxFtp','FtpLoadFuncs');
    11538 -rc = FtpLoadFuncs();
    11539 -
    11540 -parse arg sLoc
    11541 -
    11542 -/*
    11543 - * Determin files to upload and files to delete.
    11544 - */
    11545 -if (sType = 'W') then
    11546 -do  /* weekly .wpi build */
    11547 -    asUploads.0 = 3;
    11548 -    asUploads.1 = 'ChangeLog';
    11549 -    asUploads.2 = 'odin32bin-'sDate'-release.wpi';
    11550 -    asUploads.3 = 'odin32bin-'sDate'-debug.wpi';
    11551 -    sDirectory  = 'weekly';
    11552 -end
    11553 -else
    11554 -do  /* daily .zip build */
    11555 -    asUploads.0 = 3;
    11556 -    asUploads.1 = 'ChangeLog';
    11557 -    asUploads.2 = 'odin32bin-'sDate'-release.zip';
    11558 -    asUploads.3 = 'odin32bin-'sDate'-debug.zip';
    11559 -    sDirectory  = 'daily';
    11560 -end
    11561 -
    11562 -asDelete.0 = 25;
    11563 -do i = 1 to 12
    11564 -    j = i * 2;
    11565 -    asDelete.j = 'odin32bin-'DateSub(sDate, 31+i)'-release.zip';
    11566 -    j = j + 1;
    11567 -    asDelete.j = 'odin32bin-'DateSub(sDate, 31+i)'-debug.zip';
    11568 -end
    11569 -
    11570 -
    11571 -/*
    11572 - * Execution loop.
    11573 - */
    11574 -do i = 1 to 5 /* (Retries 5 times) */
    11575 -    /*
    11576 -     * Put files to SourceForge.
    11577 -     */
    11578 -    /*
    11579 -    rc = cleanSF();
    11580 -    do j = 1 to asUploads.0
    11581 -        rc = putSF(asUploads.j, 'SF-'||asUploads.j);
    11582 -    end
    11583 -    */
    11584 -
    11585 -    /*
    11586 -     * Forwards files from sourceforge(t) to os2.ftp.org
    11587 -     */
    11588 -    /*
    11589 -    if (sLoc = '' | sLoc = 'os2') then
    11590 -    do
    11591 -        rc = cleanFtp('os2-delete', '/daily', 'www.os2.org');
    11592 -        do j = 1 to asUploads.0
    11593 -            rc = putFtp(asUploads.j, 'os2-'||asUploads.j, '/'||sDirectory, 'www.os2.org');
    11594 -            /*rc = putRexxFtp(asUploads.j, 'os2-'||asUploads.j, '/'||sDirectory, 'www.os2.org');*/
    11595 -            /*rc = forwardSF(asUploads.j, 'os2-'||asUploads.j, '/'||sDirectory, 'www.os2.org');*/
    11596 -        end
    11597 -    end
    11598 -    */
    11599 -
    11600 -    /*
    11601 -     * Upload files to netlabs.
    11602 -     */
    11603 -    if (sLoc = '' | sLoc = 'netlabs') then
    11604 -    do
    11605 -        rc = cleanFtp('netlabs-delete', '/daily', 'ftp.netlabs.org');
    11606 -        do j = 1 to asUploads.0
    11607 -            rc = putFtp(asUploads.j, 'netlabs-'||asUploads.j, '/'||sDirectory, 'ftp.netlabs.org');
    11608 -            /*rc = putRexxFtp(asUploads.j, 'netlabs-'||asUploads.j, '/'||sDirectory, 'ftp.netlabs.org');*/
    11609 -            /*rc = forwardSF(asUploads.j, 'netlabs-'||asUploads.j, '/'||sDirectory, 'ftp.netlabs.org');*/
    11610 -        end
    11611 -    end
    11612 -end
    11613 -
    11614 -exit(0);
    11615 -
    11616 -
    11617 -/*
    11618 - * Deletes all the files in /pub/kTaskMgr/daily.
    11619 - */
    11620 -cleanSF: procedure
    11621 -
    11622 -    sLockFile = 'SF-delete';
    11623 -    if (stream(sLockFile,'c','query exists') = '') then
    11624 -    do
    11625 -        sSFDir = '/home/groups/ftp/pub/ktaskmgr/daily/';
    11626 -        'ssh -f -n -l stknut kTaskMgr.sourceforge.net rm -f' sSFDir||'*';
    11627 -        if (rc <> 0) then
    11628 -        do
    11629 -            say 'rm -f <>/* failed. rc='rc;
    11630 -            return rc;
    11631 -        end
    11632 -        'echo ok >' sLockFile
    11633 -    end
    11634 -return 0;
    11635 -
    11636 -
    11637 -
    11638 -/*
    11639 - * Upload a file to source forge
    11640 - */
    11641 -putSF: procedure
    11642 -    parse arg sFile, sLockFile
    11643 -
    11644 -    sSFDir = '/home/groups/ftp/pub/ktaskmgr/daily/';
    11645 -
    11646 -    if (stream(sLockFile,'c','query exists') = '') then
    11647 -    do
    11648 -        'ssh -f -n -l stknut kTaskMgr.sourceforge.net rm -f' sSFDir||sFile;
    11649 -        'scp' sFile 'stknut@kTaskMgr.sourceforge.net:'||sSFDir||sFile;
    11650 -        if (rc <> 0) then
    11651 -        do
    11652 -            say 'scp' sFile 'failed. rc='rc;
    11653 -            return rc;
    11654 -        end
    11655 -        'echo ok >' sLockFile
    11656 -    end
    11657 -return 0;
    11658 -
    11659 -
    11660 -
    11661 -/*
    11662 - * Forward file from SourceForge to ftp site.
    11663 - */
    11664 -forwardSF: procedure
    11665 -    parse arg sFile, sLockFile, sRemoteDir, sSite
    11666 -
    11667 -    sSFDir = '/home/groups/ftp/pub/ktaskmgr/daily/';
    11668 -
    11669 -    if (stream(sLockFile,'c','query exists') = '') then
    11670 -    do
    11671 -        /* get password */
    11672 -        sPasswdString = GetPassword(sSite);
    11673 -        if (sPasswdString = '') then
    11674 -        do
    11675 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    11676 -            return -1;
    11677 -        end
    11678 -        parse var sPasswdString sUser':'sPasswd;
    11679 -
    11680 -        /* invoke forward process on SourceForge(t). */
    11681 -        'cls'
    11682 -        say 'ssh -l stknut kTaskMgr.sourceforge.net upload' sUser sPasswd sSite sRemoteDir sFile;
    11683 -        'ssh -l stknut kTaskMgr.sourceforge.net ./upload' sUser sPasswd sSite sRemoteDir sFile;
    11684 -        if (rc <> 0) then
    11685 -        do
    11686 -            say 'ssh failed with rc='rc;
    11687 -            return rc;
    11688 -        end
    11689 -        'echo ok >' sLockFile;
    11690 -    end
    11691 -return 0;
    11692 -
    11693 -
    11694 -
    11695 -/*
    11696 - * Puts a file to a ftp site using ncftpput from ncftp v3.0 beta.
    11697 - */
    11698 -putFtp: procedure
    11699 -    parse arg sFile, sLockFile, sRemoteDir, sSite
    11700 -
    11701 -    /* check for done-lock */
    11702 -    if stream(sLockFile,'c','query exists') = '' then
    11703 -    do
    11704 -        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    11705 -
    11706 -        /* get password */
    11707 -        sPasswdString = GetPassword(sSite);
    11708 -        if (sPasswdString = '') then
    11709 -        do
    11710 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    11711 -            return -1;
    11712 -        end
    11713 -        parse var sPasswdString sUser':'sPasswd;
    11714 -
    11715 -        /* do the put */
    11716 -        say 'ncftpput -u' sUser '-p' sPasswd '-z' sSite sRemoteDir sFile;
    11717 -        'ncftpput -u' sUser '-p' sPasswd '-z -F' sSite sRemoteDir sFile;
    11718 -        if (rc == 0) then
    11719 -            'echo ok >' sLockFile;
    11720 -        else
    11721 -        do
    11722 -            asErrors.0 = 7;
    11723 -            asErrors.1 = 'Could not connect to remote host.';
    11724 -            asErrors.2 = 'Could not connect to remote host - timed out.';
    11725 -            asErrors.3 = 'Transfer failed.';
    11726 -            asErrors.4 = 'Transfer failed - timed out.';
    11727 -            asErrors.5 = 'Directory change failed.';
    11728 -            asErrors.6 = 'Directory change failed - timed out.';
    11729 -            asErrors.7 = 'Malformed URL.';
    11730 -            if (rc < asErrors.0) then
    11731 -                say 'ncftpput failed with rc='rc'-' asErrors.rc;
    11732 -            else
    11733 -                say 'ncftpput failed with rc='rc;
    11734 -        end
    11735 -    end
    11736 -    else
    11737 -        rc = 0;
    11738 -return 0;
    11739 -
    11740 -
    11741 -
    11742 -/*
    11743 - * Delete the files in asDelete on a given ftp site.
    11744 - */
    11745 -cleanFtp: procedure expose asDelete.;
    11746 -    parse arg sLockFile, sRemoteDir, sSite
    11747 -
    11748 -    if (stream(sLockFile,'c','query exists') = '') then
    11749 -    do
    11750 -        say '--- deleting old files at 'sSite' ---'
    11751 -
    11752 -        /* get password */
    11753 -        sPasswdString = GetPassword(sSite);
    11754 -        if (sPasswdString = '') then
    11755 -        do
    11756 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    11757 -            return -1;
    11758 -        end
    11759 -        parse var sPasswdString sUser':'sPasswd;
    11760 -
    11761 -        /* start ftp'ing */
    11762 -        rc = FtpSetUser(sSite, sUser, sPasswd);
    11763 -        if (rc = 1) then
    11764 -        do
    11765 -            cErrors = 0;
    11766 -            do i = 1 to asDelete.0
    11767 -                rc = FtpDelete(sRemoteDir||'/'||asDelete.i)
    11768 -                if (rc <> 0 & FTPERRNO = 'FTPCOMMAND') then /* happens when the file don't exists... too. */
    11769 -                    rc = 0;
    11770 -                if (rc <> 0) then
    11771 -                do
    11772 -                    call failure rc, 'FtpDelete failed - 'sRemoteDir||'/'||asDelete.i' -' sSite , FTPERRNO;
    11773 -                    cErrors = cErrors + 1;
    11774 -                end
    11775 -            end
    11776 -
    11777 -            if (cErrors = 0) then
    11778 -                'echo ok >' sLockFile;
    11779 -            else
    11780 -                say 'delete failed with 'cErrors' times.';
    11781 -            call FtpLogoff;
    11782 -        end
    11783 -        else
    11784 -        do
    11785 -            call failure rc, 'Logon failed -' sSite, FTPERRNO;
    11786 -            if (rc = 0) then rc = -1;
    11787 -        end
    11788 -    end
    11789 -    else
    11790 -        rc = 0;
    11791 -return rc;
    11792 -
    11793 -
    11794 -
    11795 -/*
    11796 - * REXX FTP put function.
    11797 - */
    11798 -putRexxFtp: procedure
    11799 -    parse arg sFile, sLockFile, sRemoteDir, sSite
    11800 -
    11801 -    /* check for done-lock */
    11802 -    if stream(sLockFile,'c','query exists') = '' then
    11803 -    do
    11804 -        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    11805 -
    11806 -        /* get password */
    11807 -        sPasswdString = GetPassword(sSite);
    11808 -        if (sPasswdString = '') then
    11809 -        do
    11810 -            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    11811 -            return -1;
    11812 -        end
    11813 -        parse var sPasswdString sUser':'sPasswd;
    11814 -
    11815 -        /* log on the ftp site */
    11816 -        rc = FtpSetUser(sSite, sUser, sPasswd);
    11817 -        if (rc = 1) then
    11818 -        do
    11819 -            /* put file, delete it if we fail */
    11820 -            say sSite  sUser  sPasswd  sFile  sRemoteDir'/'sFile  'Binary'
    11821 -            rcPut = FtpPut(sFile, sRemoteDir'/'sFile, 'Binary');
    11822 -            /*
    11823 -            if (rcPut <> 0) then
    11824 -                rc = FtpDelete(sRemoteDir'/'sFile);
    11825 -            */
    11826 -
    11827 -            /* Logoff and make lock file. */
    11828 -            rc = FtpLogoff();
    11829 -            if (rcPut = 0) then
    11830 -                'echo ok > ' || sLockFile;
    11831 -            else
    11832 -                call failure rc, 'FtpPut failed -' sSite , FTPERRNO;
    11833 -            rc = rcPut;
    11834 -        end
    11835 -        else
    11836 -        do
    11837 -            call failure rc, 'Logon failed -' sSite, FTPERRNO;
    11838 -            if rc = 0 then rc = -1;
    11839 -        end
    11840 -    end
    11841 -    else
    11842 -        rc = 0;
    11843 -return 0;
    11844 -
    11845 -
    11846 -/*
    11847 - * Report error. (non-fatal)
    11848 - */
    11849 -failure: procedure
    11850 -parse arg rc, sText, iftperrno;
    11851 -    say 'rc='rc sText
    11852 -    say 'FTPerrno:'||iftperrno
    11853 -return;
    11854 -
    11855 -
    11856 -/*
    11857 - * Reads the password file (passwd) in the script directory to
    11858 - *   get a password and userid for a given site.
    11859 - *
    11860 - * Format of the passwd file is:
    11861 - *  <site> <user> <password>
    11862 - * Lines starting with '#' is ignored.
    11863 - *
    11864 - * @param   sSite   name of the site.
    11865 - * @returns String on the form '<userid>:<passwd>' if found.
    11866 - *          Empty string if not found.
    11867 - */
    11868 -GetPassword: procedure;
    11869 -    parse upper arg sSiteToFind
    11870 -    parse source sd1 sd2 sScript
    11871 -    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    11872 -
    11873 -    rc = stream(sPasswd, 'c', 'open read');
    11874 -    if (pos('READY', rc) <> 1) then
    11875 -    do
    11876 -        say 'failed to open ftp password file - rc='rc;
    11877 -        return '';
    11878 -    end
    11879 -
    11880 -    sRet = '';
    11881 -    do while (lines(sPasswd) > 0)
    11882 -        sLine = strip(linein(sPasswd));
    11883 -        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    11884 -            iterate;
    11885 -
    11886 -        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    11887 -        sSite = translate(strip(sSite));
    11888 -        sUser = strip(sUser);
    11889 -        sPassword = strip(sPassword);
    11890 -        if (sSite = '' | sPassword = '' | sUser = '') then
    11891 -            say 'warning! misformed password line!';
    11892 -        if (sSite = sSiteToFind) then
    11893 -        do
    11894 -           sRet = sUser||':'||sPassword;
    11895 -           leave
    11896 -        end
    11897 -    end
    11898 -    call stream sPasswd, 'c', 'close';
    11899 -return sRet;
    11900 -
    11901 -
    11902 -testdatesub: procedure
    11903 -    sDate='20010131';
    11904 -
    11905 -    do i = 1 to 365*2+1
    11906 -        say sDate '-' i '=' DateSub(sDate, i);
    11907 -    end
    11908 -exit;
    11909 -
    11910 -
    11911 -/**
    11912 - * Finds date seven days ago.
    11913 - * @returns  yyyymmdd date
    11914 - * @param    sDate  Date on the yyyymmdd format.
    11915 - * @param    cDays  Number of days to subtract.
    11916 - * @remark   Works only for dates between 1000-01-01 and 9999-12-31
    11917 - *           including the limits.
    11918 - */
    11919 -DateSub: procedure
    11920 -parse arg sDate, cDays
    11921 -
    11922 -    /* subtraction loop which updates sDate and cDays for each iteration. */
    11923 -    do while (cDays > 0)
    11924 -        /*
    11925 -         * Get the day in month of sDate.
    11926 -         * Do a simple subtraction is this is higher than the number of days to subtract.
    11927 -         */
    11928 -        iDayInMonth = substr(sDate, 7, 2);
    11929 -        if (iDayInMonth > cDays) then
    11930 -            return sDate - cDays;
    11931 -
    11932 -        /*
    11933 -         * Determin previous month and the number of days in it.
    11934 -         */
    11935 -        iMonth = substr(sDate, 5, 2);
    11936 -        iYear = substr(sDate, 1, 4);
    11937 -        if (iMonth > 1) then
    11938 -            iPrvMonth = iMonth - 1;
    11939 -        else
    11940 -            iPrvMonth = 12;
    11941 -        cDaysPrvMonth = DateGetDaysInMonth(iYear, iPrvMonth);
    11942 -
    11943 -        /*
    11944 -         * Update date and days left to subtract.
    11945 -         */
    11946 -        cDays = cDays - iDayInMonth;
    11947 -        if (iMonth > 1) then
    11948 -            sDate = sDate - iDayInMonth - 100 + cDaysPrvMonth; /* last day of previous month */
    11949 -        else
    11950 -            sDate = sDate - iDayInMonth - 8869;   /* last day of last year */
    11951 -    end
    11952 -return sDate;
    11953 -
    11954 -
    11955 -/*
    11956 - * Gets the number of days in a given month.
    11957 - * @param       iYear   the year.
    11958 - * @param       iMonth  the month.
    11959 - */
    11960 -DateGetDaysInMonth: procedure
    11961 -    parse arg iYear, iMonth
    11962 -
    11963 -    select
    11964 -        when (iMonth = 4 | iMonth = 6 | iMonth = 9 | iMonth = 11) then
    11965 -            cDays = 30;
    11966 -
    11967 -        when (iMonth = 2) then
    11968 -        do
    11969 -            if ((iYear // 4) = 0) & (((iYear // 400) <> 0) | ((iYear // 2000) = 0)) then
    11970 -                cDays = 29;
    11971 -            else
    11972 -                cDays = 28;
    11973 -        end
    11974 -
    11975 -        otherwise
    11976 -            cDays = 31;
    11977 -    end /* select */
    11978 -return cDays;
    11979 -
    11980 +/* $Id: odin32ftp2.cmd,v 1.21 2003-04-14 22:08:04 bird Exp $
    11981 + *
    11982 + * Uploads the relase and debug builds to the FTP sites.
    11983 + *
    11984 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    11985 + *
    11986 + * Project Odin Software License can be found in LICENSE.TXT
    11987 + *
    11988 + */
    11989 +/*Trace 'A'*/
    11990 +
    11991 +/* get build settings */
    11992 +sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    11993 +sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    11994 +if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    11995 +
    11996 +
    11997 +rc = RxFuncAdd('FtpLoadFuncs','rxFtp','FtpLoadFuncs');
    11998 +rc = FtpLoadFuncs();
    11999 +
    12000 +parse arg sLoc
    12001 +
    12002 +/*
    12003 + * Determin files to upload and files to delete.
    12004 + */
    12005 +if (sType = 'W') then
    12006 +do  /* weekly .wpi build */
    12007 +    asUploads.0 = 3;
    12008 +    asUploads.1 = 'ChangeLog';
    12009 +    asUploads.2 = 'odin32bin-'sDate'-release.wpi';
    12010 +    asUploads.3 = 'odin32bin-'sDate'-debug.wpi';
    12011 +    sDirectory  = 'weekly';
    12012 +end
    12013 +else
    12014 +do  /* daily .zip build */
    12015 +    asUploads.0 = 3;
    12016 +    asUploads.1 = 'ChangeLog';
    12017 +    asUploads.2 = 'odin32bin-'sDate'-release.zip';
    12018 +    asUploads.3 = 'odin32bin-'sDate'-debug.zip';
    12019 +    sDirectory  = 'daily';
    12020 +end
    12021 +
    12022 +asDelete.0 = 25;
    12023 +do i = 1 to 12
    12024 +    j = i * 2;
    12025 +    asDelete.j = 'odin32bin-'DateSub(sDate, 31+i)'-release.zip';
    12026 +    j = j + 1;
    12027 +    asDelete.j = 'odin32bin-'DateSub(sDate, 31+i)'-debug.zip';
    12028 +end
    12029 +
    12030 +
    12031 +/*
    12032 + * Execution loop.
    12033 + */
    12034 +do i = 1 to 5 /* (Retries 5 times) */
    12035 +    /*
    12036 +     * Put files to SourceForge.
    12037 +     */
    12038 +    /*
    12039 +    rc = cleanSF();
    12040 +    do j = 1 to asUploads.0
    12041 +        rc = putSF(asUploads.j, 'SF-'||asUploads.j);
    12042 +    end
    12043 +    */
    12044 +
    12045 +    /*
    12046 +     * Forwards files from sourceforge(t) to os2.ftp.org
    12047 +     */
    12048 +    /*
    12049 +    if (sLoc = '' | sLoc = 'os2') then
    12050 +    do
    12051 +        rc = cleanFtp('os2-delete', '/daily', 'www.os2.org');
    12052 +        do j = 1 to asUploads.0
    12053 +            rc = putFtp(asUploads.j, 'os2-'||asUploads.j, '/'||sDirectory, 'www.os2.org');
    12054 +            /*rc = putRexxFtp(asUploads.j, 'os2-'||asUploads.j, '/'||sDirectory, 'www.os2.org');*/
    12055 +            /*rc = forwardSF(asUploads.j, 'os2-'||asUploads.j, '/'||sDirectory, 'www.os2.org');*/
    12056 +        end
    12057 +    end
    12058 +    */
    12059 +
    12060 +    /*
    12061 +     * Upload files to netlabs.
    12062 +     */
    12063 +    if (sLoc = '' | sLoc = 'netlabs') then
    12064 +    do
    12065 +        rc = cleanFtp('netlabs-delete', '/daily', 'ftp.netlabs.org');
    12066 +        do j = 1 to asUploads.0
    12067 +            rc = putFtp(asUploads.j, 'netlabs-'||asUploads.j, '/'||sDirectory, 'ftp.netlabs.org');
    12068 +            /*rc = putRexxFtp(asUploads.j, 'netlabs-'||asUploads.j, '/'||sDirectory, 'ftp.netlabs.org');*/
    12069 +            /*rc = forwardSF(asUploads.j, 'netlabs-'||asUploads.j, '/'||sDirectory, 'ftp.netlabs.org');*/
    12070 +        end
    12071 +    end
    12072 +end
    12073 +
    12074 +exit(0);
    12075 +
    12076 +
    12077 +/*
    12078 + * Deletes all the files in /pub/kTaskMgr/daily.
    12079 + */
    12080 +cleanSF: procedure
    12081 +
    12082 +    sLockFile = 'SF-delete';
    12083 +    if (stream(sLockFile,'c','query exists') = '') then
    12084 +    do
    12085 +        sSFDir = '/home/groups/ftp/pub/ktaskmgr/daily/';
    12086 +        'ssh -f -n -l stknut kTaskMgr.sourceforge.net rm -f' sSFDir||'*';
    12087 +        if (rc <> 0) then
    12088 +        do
    12089 +            say 'rm -f <>/* failed. rc='rc;
    12090 +            return rc;
    12091 +        end
    12092 +        'echo ok >' sLockFile
    12093 +    end
    12094 +return 0;
    12095 +
    12096 +
    12097 +
    12098 +/*
    12099 + * Upload a file to source forge
    12100 + */
    12101 +putSF: procedure
    12102 +    parse arg sFile, sLockFile
    12103 +
    12104 +    sSFDir = '/home/groups/ftp/pub/ktaskmgr/daily/';
    12105 +
    12106 +    if (stream(sLockFile,'c','query exists') = '') then
    12107 +    do
    12108 +        'ssh -f -n -l stknut kTaskMgr.sourceforge.net rm -f' sSFDir||sFile;
    12109 +        'scp' sFile 'stknut@kTaskMgr.sourceforge.net:'||sSFDir||sFile;
    12110 +        if (rc <> 0) then
    12111 +        do
    12112 +            say 'scp' sFile 'failed. rc='rc;
    12113 +            return rc;
    12114 +        end
    12115 +        'echo ok >' sLockFile
    12116 +    end
    12117 +return 0;
    12118 +
    12119 +
    12120 +
    12121 +/*
    12122 + * Forward file from SourceForge to ftp site.
    12123 + */
    12124 +forwardSF: procedure
    12125 +    parse arg sFile, sLockFile, sRemoteDir, sSite
    12126 +
    12127 +    sSFDir = '/home/groups/ftp/pub/ktaskmgr/daily/';
    12128 +
    12129 +    if (stream(sLockFile,'c','query exists') = '') then
    12130 +    do
    12131 +        /* get password */
    12132 +        sPasswdString = GetPassword(sSite);
    12133 +        if (sPasswdString = '') then
    12134 +        do
    12135 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    12136 +            return -1;
    12137 +        end
    12138 +        parse var sPasswdString sUser':'sPasswd;
    12139 +
    12140 +        /* invoke forward process on SourceForge(t). */
    12141 +        'cls'
    12142 +        say 'ssh -l stknut kTaskMgr.sourceforge.net upload' sUser sPasswd sSite sRemoteDir sFile;
    12143 +        'ssh -l stknut kTaskMgr.sourceforge.net ./upload' sUser sPasswd sSite sRemoteDir sFile;
    12144 +        if (rc <> 0) then
    12145 +        do
    12146 +            say 'ssh failed with rc='rc;
    12147 +            return rc;
    12148 +        end
    12149 +        'echo ok >' sLockFile;
    12150 +    end
    12151 +return 0;
    12152 +
    12153 +
    12154 +
    12155 +/*
    12156 + * Puts a file to a ftp site using ncftpput from ncftp v3.0 beta.
    12157 + */
    12158 +putFtp: procedure
    12159 +    parse arg sFile, sLockFile, sRemoteDir, sSite
    12160 +
    12161 +    /* check for done-lock */
    12162 +    if stream(sLockFile,'c','query exists') = '' then
    12163 +    do
    12164 +        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    12165 +
    12166 +        /* get password */
    12167 +        sPasswdString = GetPassword(sSite);
    12168 +        if (sPasswdString = '') then
    12169 +        do
    12170 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    12171 +            return -1;
    12172 +        end
    12173 +        parse var sPasswdString sUser':'sPasswd;
    12174 +
    12175 +        /* do the put */
    12176 +        say 'ncftpput -u' sUser '-p' sPasswd '-z' sSite sRemoteDir sFile;
    12177 +        'ncftpput -u' sUser '-p' sPasswd '-z -F' sSite sRemoteDir sFile;
    12178 +        if (rc == 0) then
    12179 +            'echo ok >' sLockFile;
    12180 +        else
    12181 +        do
    12182 +            asErrors.0 = 7;
    12183 +            asErrors.1 = 'Could not connect to remote host.';
    12184 +            asErrors.2 = 'Could not connect to remote host - timed out.';
    12185 +            asErrors.3 = 'Transfer failed.';
    12186 +            asErrors.4 = 'Transfer failed - timed out.';
    12187 +            asErrors.5 = 'Directory change failed.';
    12188 +            asErrors.6 = 'Directory change failed - timed out.';
    12189 +            asErrors.7 = 'Malformed URL.';
    12190 +            if (rc < asErrors.0) then
    12191 +                say 'ncftpput failed with rc='rc'-' asErrors.rc;
    12192 +            else
    12193 +                say 'ncftpput failed with rc='rc;
    12194 +        end
    12195 +    end
    12196 +    else
    12197 +        rc = 0;
    12198 +return 0;
    12199 +
    12200 +
    12201 +
    12202 +/*
    12203 + * Delete the files in asDelete on a given ftp site.
    12204 + */
    12205 +cleanFtp: procedure expose asDelete.;
    12206 +    parse arg sLockFile, sRemoteDir, sSite
    12207 +
    12208 +    if (stream(sLockFile,'c','query exists') = '') then
    12209 +    do
    12210 +        say '--- deleting old files at 'sSite' ---'
    12211 +
    12212 +        /* get password */
    12213 +        sPasswdString = GetPassword(sSite);
    12214 +        if (sPasswdString = '') then
    12215 +        do
    12216 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    12217 +            return -1;
    12218 +        end
    12219 +        parse var sPasswdString sUser':'sPasswd;
    12220 +
    12221 +        /* start ftp'ing */
    12222 +        rc = FtpSetUser(sSite, sUser, sPasswd);
    12223 +        if (rc = 1) then
    12224 +        do
    12225 +            cErrors = 0;
    12226 +            do i = 1 to asDelete.0
    12227 +                rc = FtpDelete(sRemoteDir||'/'||asDelete.i)
    12228 +                if (rc <> 0 & FTPERRNO = 'FTPCOMMAND') then /* happens when the file don't exists... too. */
    12229 +                    rc = 0;
    12230 +                if (rc <> 0) then
    12231 +                do
    12232 +                    call failure rc, 'FtpDelete failed - 'sRemoteDir||'/'||asDelete.i' -' sSite , FTPERRNO;
    12233 +                    cErrors = cErrors + 1;
    12234 +                end
    12235 +            end
    12236 +
    12237 +            if (cErrors = 0) then
    12238 +                'echo ok >' sLockFile;
    12239 +            else
    12240 +                say 'delete failed with 'cErrors' times.';
    12241 +            call FtpLogoff;
    12242 +        end
    12243 +        else
    12244 +        do
    12245 +            call failure rc, 'Logon failed -' sSite, FTPERRNO;
    12246 +            if (rc = 0) then rc = -1;
    12247 +        end
    12248 +    end
    12249 +    else
    12250 +        rc = 0;
    12251 +return rc;
    12252 +
    12253 +
    12254 +
    12255 +/*
    12256 + * REXX FTP put function.
    12257 + */
    12258 +putRexxFtp: procedure
    12259 +    parse arg sFile, sLockFile, sRemoteDir, sSite
    12260 +
    12261 +    /* check for done-lock */
    12262 +    if stream(sLockFile,'c','query exists') = '' then
    12263 +    do
    12264 +        say '--- put' sFile '->' sRemoteDir'/'sFile '---';
    12265 +
    12266 +        /* get password */
    12267 +        sPasswdString = GetPassword(sSite);
    12268 +        if (sPasswdString = '') then
    12269 +        do
    12270 +            call failure rc, 'Can''t find userid/password for' sSite'.', -1;
    12271 +            return -1;
    12272 +        end
    12273 +        parse var sPasswdString sUser':'sPasswd;
    12274 +
    12275 +        /* log on the ftp site */
    12276 +        rc = FtpSetUser(sSite, sUser, sPasswd);
    12277 +        if (rc = 1) then
    12278 +        do
    12279 +            /* put file, delete it if we fail */
    12280 +            say sSite  sUser  sPasswd  sFile  sRemoteDir'/'sFile  'Binary'
    12281 +            rcPut = FtpPut(sFile, sRemoteDir'/'sFile, 'Binary');
    12282 +            /*
    12283 +            if (rcPut <> 0) then
    12284 +                rc = FtpDelete(sRemoteDir'/'sFile);
    12285 +            */
    12286 +
    12287 +            /* Logoff and make lock file. */
    12288 +            rc = FtpLogoff();
    12289 +            if (rcPut = 0) then
    12290 +                'echo ok > ' || sLockFile;
    12291 +            else
    12292 +                call failure rc, 'FtpPut failed -' sSite , FTPERRNO;
    12293 +            rc = rcPut;
    12294 +        end
    12295 +        else
    12296 +        do
    12297 +            call failure rc, 'Logon failed -' sSite, FTPERRNO;
    12298 +            if rc = 0 then rc = -1;
    12299 +        end
    12300 +    end
    12301 +    else
    12302 +        rc = 0;
    12303 +return 0;
    12304 +
    12305 +
    12306 +/*
    12307 + * Report error. (non-fatal)
    12308 + */
    12309 +failure: procedure
    12310 +parse arg rc, sText, iftperrno;
    12311 +    say 'rc='rc sText
    12312 +    say 'FTPerrno:'||iftperrno
    12313 +return;
    12314 +
    12315 +
    12316 +/*
    12317 + * Reads the password file (passwd) in the script directory to
    12318 + *   get a password and userid for a given site.
    12319 + *
    12320 + * Format of the passwd file is:
    12321 + *  <site> <user> <password>
    12322 + * Lines starting with '#' is ignored.
    12323 + *
    12324 + * @param   sSite   name of the site.
    12325 + * @returns String on the form '<userid>:<passwd>' if found.
    12326 + *          Empty string if not found.
    12327 + */
    12328 +GetPassword: procedure;
    12329 +    parse upper arg sSiteToFind
    12330 +    parse source sd1 sd2 sScript
    12331 +    sPasswd = filespec('drive', sScript) || filespec('path', sScript)||'\passwd';
    12332 +
    12333 +    rc = stream(sPasswd, 'c', 'open read');
    12334 +    if (pos('READY', rc) <> 1) then
    12335 +    do
    12336 +        say 'failed to open ftp password file - rc='rc;
    12337 +        return '';
    12338 +    end
    12339 +
    12340 +    sRet = '';
    12341 +    do while (lines(sPasswd) > 0)
    12342 +        sLine = strip(linein(sPasswd));
    12343 +        if (sLine = '' | substr(sLine, 1, 1) = '#') then
    12344 +            iterate;
    12345 +
    12346 +        parse var sLine sSite' 'sUser' 'sPassword' 'sDummy
    12347 +        sSite = translate(strip(sSite));
    12348 +        sUser = strip(sUser);
    12349 +        sPassword = strip(sPassword);
    12350 +        if (sSite = '' | sPassword = '' | sUser = '') then
    12351 +            say 'warning! misformed password line!';
    12352 +        if (sSite = sSiteToFind) then
    12353 +        do
    12354 +           sRet = sUser||':'||sPassword;
    12355 +           leave
    12356 +        end
    12357 +    end
    12358 +    call stream sPasswd, 'c', 'close';
    12359 +return sRet;
    12360 +
    12361 +
    12362 +testdatesub: procedure
    12363 +    sDate='20010131';
    12364 +
    12365 +    do i = 1 to 365*2+1
    12366 +        say sDate '-' i '=' DateSub(sDate, i);
    12367 +    end
    12368 +exit;
    12369 +
    12370 +
    12371 +/**
    12372 + * Finds date seven days ago.
    12373 + * @returns  yyyymmdd date
    12374 + * @param    sDate  Date on the yyyymmdd format.
    12375 + * @param    cDays  Number of days to subtract.
    12376 + * @remark   Works only for dates between 1000-01-01 and 9999-12-31
    12377 + *           including the limits.
    12378 + */
    12379 +DateSub: procedure
    12380 +parse arg sDate, cDays
    12381 +
    12382 +    /* subtraction loop which updates sDate and cDays for each iteration. */
    12383 +    do while (cDays > 0)
    12384 +        /*
    12385 +         * Get the day in month of sDate.
    12386 +         * Do a simple subtraction is this is higher than the number of days to subtract.
    12387 +         */
    12388 +        iDayInMonth = substr(sDate, 7, 2);
    12389 +        if (iDayInMonth > cDays) then
    12390 +            return sDate - cDays;
    12391 +
    12392 +        /*
    12393 +         * Determin previous month and the number of days in it.
    12394 +         */
    12395 +        iMonth = substr(sDate, 5, 2);
    12396 +        iYear = substr(sDate, 1, 4);
    12397 +        if (iMonth > 1) then
    12398 +            iPrvMonth = iMonth - 1;
    12399 +        else
    12400 +            iPrvMonth = 12;
    12401 +        cDaysPrvMonth = DateGetDaysInMonth(iYear, iPrvMonth);
    12402 +
    12403 +        /*
    12404 +         * Update date and days left to subtract.
    12405 +         */
    12406 +        cDays = cDays - iDayInMonth;
    12407 +        if (iMonth > 1) then
    12408 +            sDate = sDate - iDayInMonth - 100 + cDaysPrvMonth; /* last day of previous month */
    12409 +        else
    12410 +            sDate = sDate - iDayInMonth - 8869;   /* last day of last year */
    12411 +    end
    12412 +return sDate;
    12413 +
    12414 +
    12415 +/*
    12416 + * Gets the number of days in a given month.
    12417 + * @param       iYear   the year.
    12418 + * @param       iMonth  the month.
    12419 + */
    12420 +DateGetDaysInMonth: procedure
    12421 +    parse arg iYear, iMonth
    12422 +
    12423 +    select
    12424 +        when (iMonth = 4 | iMonth = 6 | iMonth = 9 | iMonth = 11) then
    12425 +            cDays = 30;
    12426 +
    12427 +        when (iMonth = 2) then
    12428 +        do
    12429 +            if ((iYear // 4) = 0) & (((iYear // 400) <> 0) | ((iYear // 2000) = 0)) then
    12430 +                cDays = 29;
    12431 +            else
    12432 +                cDays = 28;
    12433 +        end
    12434 +
    12435 +        otherwise
    12436 +            cDays = 31;
    12437 +    end /* select */
    12438 +return cDays;
    12439 +
    12440 diff --git a/tools/DailyBuild/odin32get.cmd b/tools/DailyBuild/odin32get.cmd
    12441 index 191a32c..1974363 100644
    12442 --- a/tools/DailyBuild/odin32get.cmd
    12443 +++ b/tools/DailyBuild/odin32get.cmd
    12444 @@ -1,32 +1,32 @@
    12445 -/* $Id: odin32get.cmd,v 1.6 2003-06-19 20:29:42 bird Exp $
    12446 - *
    12447 - * Gets the CVS tree from netlabs.
    12448 - *
    12449 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    12450 - *
    12451 - * Project Odin Software License can be found in LICENSE.TXT
    12452 - *
    12453 - */
    12454 -
    12455 -    /* get build settings */
    12456 -    /*
    12457 -    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    12458 -    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    12459 -    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    12460 -    */
    12461 -
    12462 -    sDrive = filespec('drive', directory());
    12463 -    'cache386 /LAZY:'sDrive'OFF';
    12464 -    'cvs checkout .'
    12465 -    iRc = rc;
    12466 -    'cache386 /LAZY:'sDrive'ON';
    12467 -    if (iRc <> 0) then call failure iRc, 'CVS checkout . failed';
    12468 -    'copy ..\scripts\bin\buildenv.cmd.paths tools\bin\buildenv.cmd.paths'
    12469 -    exit(0);
    12470 -
    12471 -
    12472 -failure: procedure
    12473 -parse arg rc, sText;
    12474 -    say 'rc='rc sText
    12475 -    exit(rc);
    12476 -
    12477 +/* $Id: odin32get.cmd,v 1.6 2003-06-19 20:29:42 bird Exp $
    12478 + *
    12479 + * Gets the CVS tree from netlabs.
    12480 + *
    12481 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    12482 + *
    12483 + * Project Odin Software License can be found in LICENSE.TXT
    12484 + *
    12485 + */
    12486 +
    12487 +    /* get build settings */
    12488 +    /*
    12489 +    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    12490 +    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    12491 +    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    12492 +    */
    12493 +
    12494 +    sDrive = filespec('drive', directory());
    12495 +    'cache386 /LAZY:'sDrive'OFF';
    12496 +    'cvs checkout .'
    12497 +    iRc = rc;
    12498 +    'cache386 /LAZY:'sDrive'ON';
    12499 +    if (iRc <> 0) then call failure iRc, 'CVS checkout . failed';
    12500 +    'copy ..\scripts\bin\buildenv.cmd.paths tools\bin\buildenv.cmd.paths'
    12501 +    exit(0);
    12502 +
    12503 +
    12504 +failure: procedure
    12505 +parse arg rc, sText;
    12506 +    say 'rc='rc sText
    12507 +    exit(rc);
    12508 +
    12509 diff --git a/tools/DailyBuild/odin32pack.cmd b/tools/DailyBuild/odin32pack.cmd
    12510 index a9d111c..466cd7f 100644
    12511 --- a/tools/DailyBuild/odin32pack.cmd
    12512 +++ b/tools/DailyBuild/odin32pack.cmd
    12513 @@ -1,217 +1,217 @@
    12514 -/* $Id: odin32pack.cmd,v 1.25 2003-04-15 00:34:35 bird Exp $
    12515 - *
    12516 - * Make the two zip files.
    12517 - *
    12518 - * NOTE! This requires 4OS/2 for the DEL commands.
    12519 - *
    12520 - * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    12521 - *
    12522 - * Project Odin Software License can be found in LICENSE.TXT
    12523 - *
    12524 - */
    12525 -    sStartDir = directory();
    12526 -    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    12527 -    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    12528 -    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    12529 -
    12530 -    if (sType = 'W') then
    12531 -        sTypeOdinCMD = '-Weekly';
    12532 -    else
    12533 -        sTypeOdinCMD = '-Daily';
    12534 -
    12535 -
    12536 -    /*
    12537 -     * Make .WPI files.
    12538 -     */
    12539 -    call ChDir 'tools\install';
    12540 -    'call odin.cmd 'sTypeOdinCMD' debug'
    12541 -    if (RC <> 0) then call failure rc, 'odin.cmd debug failed.';
    12542 -    'call odin.cmd 'sTypeOdinCMD' release'
    12543 -    if (RC <> 0) then call failure rc, 'odin.cmd release failed.';
    12544 -    'move *.wpi' sStartDir;
    12545 -    if (RC <> 0) then call failure rc, 'failed to move the *.wpi ->' sStartDir;
    12546 -    call ChDir '..\..';
    12547 -
    12548 -    /*
    12549 -     * Make .ZIP files.
    12550 -     */
    12551 -    call packdir 'bin\debug', 'debug'
    12552 -    /*call packdir3dx 'bin\debug\glide', 'glide-debug' */
    12553 -    call packdir 'bin\release', 'release'
    12554 -    /*call packdir3dx 'bin\release\glide', 'glide-release'*/
    12555 -
    12556 -    /*
    12557 -     * Make copy.
    12558 -     */
    12559 -     /*
    12560 -    if (sType = 'W') then
    12561 -        'copy *.wpi e:\DailyBuildArchive\'
    12562 -    else
    12563 -        'copy *.zip e:\DailyBuildArchive\'
    12564 -      */
    12565 -
    12566 -    /* return successfully */
    12567 -    exit(0);
    12568 -
    12569 -
    12570 -packdir: procedure expose sStartDir sDate sType;
    12571 -parse arg sDir, sBldType;
    12572 -
    12573 -    sZipFile = directory() || '\odin32bin-' || sDate || '-' || sBldType || '.zip';
    12574 -
    12575 -    /*
    12576 -     * Change into the directory we're to pack and do some fixups
    12577 -     */
    12578 -    sRoot = directory();
    12579 -    call ChDir sDir
    12580 -    'del /Q /Y /Z *.cmd > nul 2>&1'
    12581 -    'del /Q /Y /Z /X CVS > nul 2>&1'
    12582 -    'del /Q /Y /Z /X .\glide\CVS > nul 2>&1'
    12583 -    'del /Q /Y /Z /X .\glide\Voodoo1\CVS > nul 2>&1'
    12584 -    'del /Q /Y /Z /X .\glide\Voodoo2\CVS > nul 2>&1'
    12585 -    'del /Q /Y /Z /X .\Voodoo1\CVS > nul 2>&1'
    12586 -    'del /Q /Y /Z /X .\Voodoo1 > nul 2>&1'
    12587 -    'del /Q /Y /Z /X .\Voodoo2\CVS > nul 2>&1'
    12588 -    'del /Q /Y /Z /X .\Voodoo2 > nul 2>&1'
    12589 -    'rmdir .\Voodoo2 > nul 2>&1'
    12590 -    'rmdir .\Voodoo1 > nul 2>&1'
    12591 -
    12592 -    /*
    12593 -     * Create a pack directory in /bin and go into it.
    12594 -     * (Don't test on return from mkdir while the directory might exist.)
    12595 -     */
    12596 -    'mkdir ..\pack'
    12597 -    call ChDir '..\pack'
    12598 -    'del /Q /Y /Z *' /* Perform some cleanup */
    12599 -
    12600 -    /* Copy root files into the pack directory. */
    12601 -    call copy sRoot'\LICENSE.txt';
    12602 -    call copy sRoot'\WGSS50.lic';
    12603 -    call copy sRoot'\ChangeLog';
    12604 -    call copy sRoot'\doc\Readme.txt';
    12605 -    call copy sRoot'\doc\odin.ini.txt'
    12606 -    call copy sRoot'\doc\Logging.txt';
    12607 -    call copy sRoot'\doc\ReportingBugs.txt';
    12608 -    call copy sRoot'\doc\ChangeLog-2001';
    12609 -    call copy sRoot'\doc\ChangeLog-2000';
    12610 -    call copy sRoot'\doc\ChangeLog-1999';
    12611 -
    12612 -    /*
    12613 -     * Move (=rename) the /bin/<release|debug> dir into /pack/system32
    12614 -     * and pack it.
    12615 -     */
    12616 -    'ren' sRoot'\'sDir '.\system32'
    12617 -    if (RC <> 0) then call failure rc, 'renaming' sDir'->system32 failed';
    12618 -    'if exist .\system32\glide ren .\system32\glide ..\glide_tmp'
    12619 -    /*
    12620 -    if (RC <> 0) then
    12621 -    do
    12622 -        rc2 = rc;
    12623 -        call backout sDir, sBldType, sRoot;
    12624 -        call failure rc2, 'renaming system32\glide -> ..\glide_tmp failed';
    12625 -    end
    12626 -    */
    12627 -
    12628 -    call copy sRoot'\bin\wgss50.dll', 'system32\wgss50.dll';
    12629 -    /*call copy sRoot'\bin\odin.ini', 'system32\Odin.ini';*/
    12630 -    if (pos('debug', sBldType) > 0) then
    12631 -    do
    12632 -        call copy sRoot'\bin\release\odincrt.dll', 'system32\odincrt.dll'
    12633 -        call copy sRoot'\bin\release\odincrt.sym', 'system32\odincrt.sym'
    12634 -    end
    12635 -
    12636 -    say 'zip -9 -R' sZipFile '* -xCVS';
    12637 -    'zip -9 -R' sZipFile '* -xCVS';
    12638 -    if (RC <> 0) then
    12639 -    do
    12640 -        rc2 = rc;
    12641 -        call backout sDir, sBldType, sRoot;
    12642 -        call failure rc2, 'zip...';
    12643 -    end
    12644 -
    12645 -    /* resotre */
    12646 -    call backout sDir, sBldType, sRoot;
    12647 -
    12648 -    /* restore directory */
    12649 -    call directory(sRoot);
    12650 -    return;
    12651 -
    12652 -/* backout procedure for packdir */
    12653 -backout: procedure;
    12654 -    parse arg sDir, sBldType, sRoot
    12655 -    if (pos('debug', sBldType) > 0) then
    12656 -    do
    12657 -        'del system32\odincrt.dll'
    12658 -        'del system32\odincrt.sym'
    12659 -    end
    12660 -    'ren ..\glide_tmp .\system32\glide'
    12661 -    'ren .\system32' sRoot'\'sDir
    12662 -    return;
    12663 -
    12664 -/*
    12665 - * Pack the 3dx dlls.
    12666 - */
    12667 -packdir3dx: procedure expose sStartDir sDate sType;
    12668 -parse arg sDir, sBldType;
    12669 -    sZipFile = directory()||'\odin32bin-' || sDate || '-' || sBldType || '.zip';
    12670 -
    12671 -    sRoot = directory();
    12672 -    call ChDir sDir
    12673 -    say 'zip -9 -R' sZipFile '* -xCVS';
    12674 -    'zip -9 -R' sZipFile '* -xCVS';
    12675 -    if (rc <> 0) then call failure rc, 'zip...';
    12676 -
    12677 -    /* restore directory */
    12678 -    call directory(sRoot);
    12679 -    return;
    12680 -
    12681 -
    12682 -/*
    12683 - * Changes the directory.
    12684 - * On error we will call failure.
    12685 - */
    12686 -ChDir: procedure expose sStartDir;
    12687 -    parse arg sDir
    12688 -
    12689 -    'cd' sDir
    12690 -    if (rc <> 0) then
    12691 -    do
    12692 -        call failure rc, 'Failed to ChDir into' sDir '(CWD='directory()').'
    12693 -        return rc;
    12694 -    end
    12695 -    return 0;
    12696 -
    12697 -
    12698 -/*
    12699 - * Copy a file.
    12700 - * On error we will call failure.
    12701 - */
    12702 -Copy: procedure expose sStartDir
    12703 -    parse arg sSrc, sDst, fNotFatal
    12704 -
    12705 -    /* if no sDst set default */
    12706 -    if (sDst = '') then sDst='.';
    12707 -    if (fNotFatal = '') then fNotFatal = 0;
    12708 -
    12709 -    'copy' sSrc sDst
    12710 -    if (rc <> 0 & \fNotFatal) then
    12711 -    do
    12712 -        call failure rc, 'Copying' sSrc 'to' sDst 'failed.'
    12713 -        return rc;
    12714 -    end
    12715 -    return 0;
    12716 -
    12717 -
    12718 -/*
    12719 - * Complain about a failure and exit the script.
    12720 - * Note. Uses the global variable sStartDir to restore the current
    12721 - *       directory where the script was started from.
    12722 - * @param rc    Error code to write. (usually RC)
    12723 - * @param sText Description.
    12724 - */
    12725 -failure: procedure expose sStartDir;
    12726 -parse arg rc, sText;
    12727 -    say 'rc='rc sText
    12728 -    call directory sStartDir;
    12729 -    exit(rc);
    12730 -
    12731 +/* $Id: odin32pack.cmd,v 1.25 2003-04-15 00:34:35 bird Exp $
    12732 + *
    12733 + * Make the two zip files.
    12734 + *
    12735 + * NOTE! This requires 4OS/2 for the DEL commands.
    12736 + *
    12737 + * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    12738 + *
    12739 + * Project Odin Software License can be found in LICENSE.TXT
    12740 + *
    12741 + */
    12742 +    sStartDir = directory();
    12743 +    sDate = value('BUILD_DATE',, 'OS2ENVIRONMENT');
    12744 +    sType = value('BUILD_TYPE',, 'OS2ENVIRONMENT');
    12745 +    if ((sDate = '') | (sType = '')) then do say 'BUILD_DATE/BUILD_TYPE unset, you didn''t start job.cmd.'; exit(16); end
    12746 +
    12747 +    if (sType = 'W') then
    12748 +        sTypeOdinCMD = '-Weekly';
    12749 +    else
    12750 +        sTypeOdinCMD = '-Daily';
    12751 +
    12752 +
    12753 +    /*
    12754 +     * Make .WPI files.
    12755 +     */
    12756 +    call ChDir 'tools\install';
    12757 +    'call odin.cmd 'sTypeOdinCMD' debug'
    12758 +    if (RC <> 0) then call failure rc, 'odin.cmd debug failed.';
    12759 +    'call odin.cmd 'sTypeOdinCMD' release'
    12760 +    if (RC <> 0) then call failure rc, 'odin.cmd release failed.';
    12761 +    'move *.wpi' sStartDir;
    12762 +    if (RC <> 0) then call failure rc, 'failed to move the *.wpi ->' sStartDir;
    12763 +    call ChDir '..\..';
    12764 +
    12765 +    /*
    12766 +     * Make .ZIP files.
    12767 +     */
    12768 +    call packdir 'bin\debug', 'debug'
    12769 +    /*call packdir3dx 'bin\debug\glide', 'glide-debug' */
    12770 +    call packdir 'bin\release', 'release'
    12771 +    /*call packdir3dx 'bin\release\glide', 'glide-release'*/
    12772 +
    12773 +    /*
    12774 +     * Make copy.
    12775 +     */
    12776 +     /*
    12777 +    if (sType = 'W') then
    12778 +        'copy *.wpi e:\DailyBuildArchive\'
    12779 +    else
    12780 +        'copy *.zip e:\DailyBuildArchive\'
    12781 +      */
    12782 +
    12783 +    /* return successfully */
    12784 +    exit(0);
    12785 +
    12786 +
    12787 +packdir: procedure expose sStartDir sDate sType;
    12788 +parse arg sDir, sBldType;
    12789 +
    12790 +    sZipFile = directory() || '\odin32bin-' || sDate || '-' || sBldType || '.zip';
    12791 +
    12792 +    /*
    12793 +     * Change into the directory we're to pack and do some fixups
    12794 +     */
    12795 +    sRoot = directory();
    12796 +    call ChDir sDir
    12797 +    'del /Q /Y /Z *.cmd > nul 2>&1'
    12798 +    'del /Q /Y /Z /X CVS > nul 2>&1'
    12799 +    'del /Q /Y /Z /X .\glide\CVS > nul 2>&1'
    12800 +    'del /Q /Y /Z /X .\glide\Voodoo1\CVS > nul 2>&1'
    12801 +    'del /Q /Y /Z /X .\glide\Voodoo2\CVS > nul 2>&1'
    12802 +    'del /Q /Y /Z /X .\Voodoo1\CVS > nul 2>&1'
    12803 +    'del /Q /Y /Z /X .\Voodoo1 > nul 2>&1'
    12804 +    'del /Q /Y /Z /X .\Voodoo2\CVS > nul 2>&1'
    12805 +    'del /Q /Y /Z /X .\Voodoo2 > nul 2>&1'
    12806 +    'rmdir .\Voodoo2 > nul 2>&1'
    12807 +    'rmdir .\Voodoo1 > nul 2>&1'
    12808 +
    12809 +    /*
    12810 +     * Create a pack directory in /bin and go into it.
    12811 +     * (Don't test on return from mkdir while the directory might exist.)
    12812 +     */
    12813 +    'mkdir ..\pack'
    12814 +    call ChDir '..\pack'
    12815 +    'del /Q /Y /Z *' /* Perform some cleanup */
    12816 +
    12817 +    /* Copy root files into the pack directory. */
    12818 +    call copy sRoot'\LICENSE.txt';
    12819 +    call copy sRoot'\WGSS50.lic';
    12820 +    call copy sRoot'\ChangeLog';
    12821 +    call copy sRoot'\doc\Readme.txt';
    12822 +    call copy sRoot'\doc\odin.ini.txt'
    12823 +    call copy sRoot'\doc\Logging.txt';
    12824 +    call copy sRoot'\doc\ReportingBugs.txt';
    12825 +    call copy sRoot'\doc\ChangeLog-2001';
    12826 +    call copy sRoot'\doc\ChangeLog-2000';
    12827 +    call copy sRoot'\doc\ChangeLog-1999';
    12828 +
    12829 +    /*
    12830 +     * Move (=rename) the /bin/<release|debug> dir into /pack/system32
    12831 +     * and pack it.
    12832 +     */
    12833 +    'ren' sRoot'\'sDir '.\system32'
    12834 +    if (RC <> 0) then call failure rc, 'renaming' sDir'->system32 failed';
    12835 +    'if exist .\system32\glide ren .\system32\glide ..\glide_tmp'
    12836 +    /*
    12837 +    if (RC <> 0) then
    12838 +    do
    12839 +        rc2 = rc;
    12840 +        call backout sDir, sBldType, sRoot;
    12841 +        call failure rc2, 'renaming system32\glide -> ..\glide_tmp failed';
    12842 +    end
    12843 +    */
    12844 +
    12845 +    call copy sRoot'\bin\wgss50.dll', 'system32\wgss50.dll';
    12846 +    /*call copy sRoot'\bin\odin.ini', 'system32\Odin.ini';*/
    12847 +    if (pos('debug', sBldType) > 0) then
    12848 +    do
    12849 +        call copy sRoot'\bin\release\odincrt.dll', 'system32\odincrt.dll'
    12850 +        call copy sRoot'\bin\release\odincrt.sym', 'system32\odincrt.sym'
    12851 +    end
    12852 +
    12853 +    say 'zip -9 -R' sZipFile '* -xCVS';
    12854 +    'zip -9 -R' sZipFile '* -xCVS';
    12855 +    if (RC <> 0) then
    12856 +    do
    12857 +        rc2 = rc;
    12858 +        call backout sDir, sBldType, sRoot;
    12859 +        call failure rc2, 'zip...';
    12860 +    end
    12861 +
    12862 +    /* resotre */
    12863 +    call backout sDir, sBldType, sRoot;
    12864 +
    12865 +    /* restore directory */
    12866 +    call directory(sRoot);
    12867 +    return;
    12868 +
    12869 +/* backout procedure for packdir */
    12870 +backout: procedure;
    12871 +    parse arg sDir, sBldType, sRoot
    12872 +    if (pos('debug', sBldType) > 0) then
    12873 +    do
    12874 +        'del system32\odincrt.dll'
    12875 +        'del system32\odincrt.sym'
    12876 +    end
    12877 +    'ren ..\glide_tmp .\system32\glide'
    12878 +    'ren .\system32' sRoot'\'sDir
    12879 +    return;
    12880 +
    12881 +/*
    12882 + * Pack the 3dx dlls.
    12883 + */
    12884 +packdir3dx: procedure expose sStartDir sDate sType;
    12885 +parse arg sDir, sBldType;
    12886 +    sZipFile = directory()||'\odin32bin-' || sDate || '-' || sBldType || '.zip';
    12887 +
    12888 +    sRoot = directory();
    12889 +    call ChDir sDir
    12890 +    say 'zip -9 -R' sZipFile '* -xCVS';
    12891 +    'zip -9 -R' sZipFile '* -xCVS';
    12892 +    if (rc <> 0) then call failure rc, 'zip...';
    12893 +
    12894 +    /* restore directory */
    12895 +    call directory(sRoot);
    12896 +    return;
    12897 +
    12898 +
    12899 +/*
    12900 + * Changes the directory.
    12901 + * On error we will call failure.
    12902 + */
    12903 +ChDir: procedure expose sStartDir;
    12904 +    parse arg sDir
    12905 +
    12906 +    'cd' sDir
    12907 +    if (rc <> 0) then
    12908 +    do
    12909 +        call failure rc, 'Failed to ChDir into' sDir '(CWD='directory()').'
    12910 +        return rc;
    12911 +    end
    12912 +    return 0;
    12913 +
    12914 +
    12915 +/*
    12916 + * Copy a file.
    12917 + * On error we will call failure.
    12918 + */
    12919 +Copy: procedure expose sStartDir
    12920 +    parse arg sSrc, sDst, fNotFatal
    12921 +
    12922 +    /* if no sDst set default */
    12923 +    if (sDst = '') then sDst='.';
    12924 +    if (fNotFatal = '') then fNotFatal = 0;
    12925 +
    12926 +    'copy' sSrc sDst
    12927 +    if (rc <> 0 & \fNotFatal) then
    12928 +    do
    12929 +        call failure rc, 'Copying' sSrc 'to' sDst 'failed.'
    12930 +        return rc;
    12931 +    end
    12932 +    return 0;
    12933 +
    12934 +
    12935 +/*
    12936 + * Complain about a failure and exit the script.
    12937 + * Note. Uses the global variable sStartDir to restore the current
    12938 + *       directory where the script was started from.
    12939 + * @param rc    Error code to write. (usually RC)
    12940 + * @param sText Description.
    12941 + */
    12942 +failure: procedure expose sStartDir;
    12943 +parse arg rc, sText;
    12944 +    say 'rc='rc sText
    12945 +    call directory sStartDir;
    12946 +    exit(rc);
    12947 +
    12948 diff --git a/tools/Makefile.kmk b/tools/Makefile.kmk
    12949 index f7684a9..120c7b0 100644
    12950 --- a/tools/Makefile.kmk
    12951 +++ b/tools/Makefile.kmk
    12952 @@ -1,16 +1,16 @@
    12953 -## @file
    12954 -# Support tools
    12955 -#
    12956 -
    12957 -SUB_DEPTH = ..
    12958 -include $(KBUILD_PATH)/subheader.kmk
    12959 -
    12960 -#
    12961 -# Include sub-makefiles.
    12962 -#
    12963 -include $(PATH_SUB_CURRENT)/common/Makefile.kmk
    12964 -include $(PATH_SUB_CURRENT)/impdef/Makefile.kmk
    12965 -include $(PATH_SUB_CURRENT)/wrc/Makefile.kmk
    12966 -include $(PATH_SUB_CURRENT)/install/Makefile.kmk
    12967 -
    12968 -include $(FILE_KBUILD_SUB_FOOTER)
    12969 +## @file
    12970 +# Support tools
    12971 +#
    12972 +
    12973 +SUB_DEPTH = ..
    12974 +include $(KBUILD_PATH)/subheader.kmk
    12975 +
    12976 +#
    12977 +# Include sub-makefiles.
    12978 +#
    12979 +include $(PATH_SUB_CURRENT)/common/Makefile.kmk
    12980 +include $(PATH_SUB_CURRENT)/impdef/Makefile.kmk
    12981 +include $(PATH_SUB_CURRENT)/wrc/Makefile.kmk
    12982 +include $(PATH_SUB_CURRENT)/install/Makefile.kmk
    12983 +
    12984 +include $(FILE_KBUILD_SUB_FOOTER)
    12985 diff --git a/tools/bin/APIImport.cmd b/tools/bin/APIImport.cmd
    12986 index 6fd7078..13c1a83 100644
    12987 --- a/tools/bin/APIImport.cmd
    12988 +++ b/tools/bin/APIImport.cmd
    12989 @@ -1,82 +1,82 @@
    12990 -/* $Id: APIImport.cmd,v 1.7 2001-01-26 21:33:13 phaller Exp $
    12991 - *
    12992 - * Helper script which invokes APIImport.exe with the correct .def file.
    12993 - *
    12994 - * Copyright (c) 2000 knut st. osmundsen
    12995 - *
    12996 - */
    12997 -
    12998 -if RxFuncQuery('SysFileDelete')=1 THEN
    12999 -  call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete';
    13000 -
    13001 -if RxFuncQuery('SysFileFree')=1 THEN
    13002 -    call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree';
    13003 -
    13004 -    sDllName = filespec('name', directory());
    13005 -
    13006 -    parse source sD1 sD2 sSrc;
    13007 -
    13008 -    sSrc = filespec('drive', sSrc) || filespec('path', sSrc);
    13009 -    sAPIImport= sSrc||'APIImport.exe  -e+ ';
    13010 -    if (sDllName = 'msvcrt') then
    13011 -    do
    13012 -        call MakeTempDeffile sDllName, 'APIImport.def';
    13013 -        call MakeTempDeffile sDllName||'20', 'APIImport20.def';
    13014 -        call MakeTempDeffile sDllName||'40', 'APIImport40.def';
    13015 -        sAPIImport || ' APIImport.def APIImport20.def APIImport40.def';
    13016 -    end
    13017 -    else
    13018 -    do
    13019 -        if (translate(sDllName) = 'WNETAP32') then
    13020 -            sDllName = 'netapi32';
    13021 -        else if (translate(sDllName) = 'OPENGL') then
    13022 -        do
    13023 -            'copy mesa\opengl32.def';
    13024 -            sDllName = 'opengl32';
    13025 -        end
    13026 -
    13027 -        call MakeTempDeffile sDllName, 'APIImport.def';
    13028 -        sAPIImport || ' APIImport.def';
    13029 -    end
    13030 -    exit(rc);
    13031 -
    13032 -
    13033 -MakeTempDeffile: procedure;
    13034 -    parse arg sDllName, sTmpName
    13035 -
    13036 -    call SysFileDelete sTmpName;
    13037 -    sOrgDef = sDllName||'.def';
    13038 -    rc = stream(sOrgDef, 'c', 'open read');
    13039 -    if (pos('READY', rc) <> 1) then
    13040 -    do
    13041 -        rc = SysFileTree('*.def', 'asFiles', 'FO');
    13042 -        if rc = 0 then
    13043 -        do
    13044 -            do i = 1 to asFiles.0
    13045 -                if translate(substr(asFiles.i, length(asFiles.i) - 7, 7)) <> 'EXP.DEF' then
    13046 -                do
    13047 -                    sOrgDef = asFiles.i;
    13048 -                    rc = stream(sOrgDef, 'c', 'open read');
    13049 -                    if (pos('READY', rc) <> 1) then
    13050 -                        say 'APIImport.cmd: failiure (2) rc='||rc;
    13051 -                    else
    13052 -                        i = asFiles.0;
    13053 -                end
    13054 -            end
    13055 -        end
    13056 -        else
    13057 -            say 'APIImport.cmd: failiure (1) rc='||rc;
    13058 -    end
    13059 -    rc = stream(sTmpName, 'c', 'open write');
    13060 -
    13061 -    do while (lines(sOrgDef) > 0)
    13062 -        sLine = linein(sOrgDef);
    13063 -        if (pos('LIBRARY ',  translate(strip(sLine))) = 1 ) then
    13064 -            call lineout sTmpName, 'LIBRARY '||sDllName;
    13065 -        else
    13066 -            call lineout sTmpName, sLine;
    13067 -    end
    13068 -
    13069 -    rc = stream(sOrgDef, 'c', 'close');
    13070 -    rc = stream(sTmpName, 'c', 'close');
    13071 -    return 0;
    13072 +/* $Id: APIImport.cmd,v 1.7 2001-01-26 21:33:13 phaller Exp $
    13073 + *
    13074 + * Helper script which invokes APIImport.exe with the correct .def file.
    13075 + *
    13076 + * Copyright (c) 2000 knut st. osmundsen
    13077 + *
    13078 + */
    13079 +
    13080 +if RxFuncQuery('SysFileDelete')=1 THEN
    13081 +  call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete';
    13082 +
    13083 +if RxFuncQuery('SysFileFree')=1 THEN
    13084 +    call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree';
    13085 +
    13086 +    sDllName = filespec('name', directory());
    13087 +
    13088 +    parse source sD1 sD2 sSrc;
    13089 +
    13090 +    sSrc = filespec('drive', sSrc) || filespec('path', sSrc);
    13091 +    sAPIImport= sSrc||'APIImport.exe  -e+ ';
    13092 +    if (sDllName = 'msvcrt') then
    13093 +    do
    13094 +        call MakeTempDeffile sDllName, 'APIImport.def';
    13095 +        call MakeTempDeffile sDllName||'20', 'APIImport20.def';
    13096 +        call MakeTempDeffile sDllName||'40', 'APIImport40.def';
    13097 +        sAPIImport || ' APIImport.def APIImport20.def APIImport40.def';
    13098 +    end
    13099 +    else
    13100 +    do
    13101 +        if (translate(sDllName) = 'WNETAP32') then
    13102 +            sDllName = 'netapi32';
    13103 +        else if (translate(sDllName) = 'OPENGL') then
    13104 +        do
    13105 +            'copy mesa\opengl32.def';
    13106 +            sDllName = 'opengl32';
    13107 +        end
    13108 +
    13109 +        call MakeTempDeffile sDllName, 'APIImport.def';
    13110 +        sAPIImport || ' APIImport.def';
    13111 +    end
    13112 +    exit(rc);
    13113 +
    13114 +
    13115 +MakeTempDeffile: procedure;
    13116 +    parse arg sDllName, sTmpName
    13117 +
    13118 +    call SysFileDelete sTmpName;
    13119 +    sOrgDef = sDllName||'.def';
    13120 +    rc = stream(sOrgDef, 'c', 'open read');
    13121 +    if (pos('READY', rc) <> 1) then
    13122 +    do
    13123 +        rc = SysFileTree('*.def', 'asFiles', 'FO');
    13124 +        if rc = 0 then
    13125 +        do
    13126 +            do i = 1 to asFiles.0
    13127 +                if translate(substr(asFiles.i, length(asFiles.i) - 7, 7)) <> 'EXP.DEF' then
    13128 +                do
    13129 +                    sOrgDef = asFiles.i;
    13130 +                    rc = stream(sOrgDef, 'c', 'open read');
    13131 +                    if (pos('READY', rc) <> 1) then
    13132 +                        say 'APIImport.cmd: failiure (2) rc='||rc;
    13133 +                    else
    13134 +                        i = asFiles.0;
    13135 +                end
    13136 +            end
    13137 +        end
    13138 +        else
    13139 +            say 'APIImport.cmd: failiure (1) rc='||rc;
    13140 +    end
    13141 +    rc = stream(sTmpName, 'c', 'open write');
    13142 +
    13143 +    do while (lines(sOrgDef) > 0)
    13144 +        sLine = linein(sOrgDef);
    13145 +        if (pos('LIBRARY ',  translate(strip(sLine))) = 1 ) then
    13146 +            call lineout sTmpName, 'LIBRARY '||sDllName;
    13147 +        else
    13148 +            call lineout sTmpName, sLine;
    13149 +    end
    13150 +
    13151 +    rc = stream(sOrgDef, 'c', 'close');
    13152 +    rc = stream(sTmpName, 'c', 'close');
    13153 +    return 0;
    13154 diff --git a/tools/bin/BldLevelInf.cmd b/tools/bin/BldLevelInf.cmd
    13155 index ebcde3d..8a556f8 100644
    13156 --- a/tools/bin/BldLevelInf.cmd
    13157 +++ b/tools/bin/BldLevelInf.cmd
    13158 @@ -1,604 +1,604 @@
    13159 -/* $Id: BldLevelInf.cmd,v 1.6 2002-08-24 04:36:04 bird Exp $
    13160 - *
    13161 - * Adds a Description string to the given .def-file.
    13162 - * Fills in default values; like build time and host.
    13163 - *
    13164 - */
    13165 -
    13166 -signal on novalue name NoValueHandler
    13167 -
    13168 -if RxFuncQuery('SysLoadFuncs') = 1 then
    13169 -do
    13170 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    13171 -    call SysLoadFuncs;
    13172 -end
    13173 -
    13174 -
    13175 -/*
    13176 - * Set default parameter values.
    13177 - */
    13178 -sDefFileIn      = '';
    13179 -sDefFileOut     = '';
    13180 -sASDFeatureId   = '';
    13181 -sCountryCode    = '';
    13182 -sDateTime       = left(' 'date()' 'time(), 26);
    13183 -sDescription    = 'Odin32';
    13184 -sFixPakVer      = '';
    13185 -sHostname       = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11));
    13186 -sLanguageCode   = '';
    13187 -sMiniVer        = '';
    13188 -sVendor         = 'Project Odin';
    13189 -sVersion        = '0.5';
    13190 -
    13191 -
    13192 -/*
    13193 - * Config stuff.
    13194 - */
    13195 -iVerbose        = 1;                    /* 0, 1 or 2. */
    13196 -if (getenv("BUILD_QUIET") <> '') then
    13197 -    iVerbose    = 0;
    13198 -else if (getenv("BUILD_VERBOSE") <> '') then
    13199 -    iVerbose    = 2;
    13200 -sGlobals = 'iVerbose'
    13201 -
    13202 -/*
    13203 - * Parse parameters.
    13204 - */
    13205 -parse arg  sArgs
    13206 -if (sArgs = '') then
    13207 -do
    13208 -    call syntax;
    13209 -    exit(1);
    13210 -end
    13211 -
    13212 -do while (sArgs <> '')
    13213 -    sArgs = strip(sArgs);
    13214 -    if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then
    13215 -    do  /*
    13216 -         * Option.
    13217 -         */
    13218 -        ch = translate(substr(sArgs, 2, 1));
    13219 -        if (pos(ch, 'ACDHLMNPRTV') < 1) then
    13220 -        do
    13221 -            say 'invalid option:' substr(sArgs, 1, 2);
    13222 -            call syntax;
    13223 -            exit(2);
    13224 -        end
    13225 -
    13226 -        /* get value and advance sArgs to next or to end. */
    13227 -        if (substr(sArgs, 3, 1) = '"') then
    13228 -        do
    13229 -            iNext = pos('"', sArgs, 4);
    13230 -            fQuote = 1;
    13231 -        end
    13232 -        else
    13233 -        do
    13234 -            iNext = pos(' ', sArgs, 3);
    13235 -            if (iNext <= 0) then
    13236 -                iNext = length(sArgs);
    13237 -            fQuote = 0;
    13238 -        end
    13239 -
    13240 -        if (iNext > 3 | ch = 'R') then
    13241 -        do
    13242 -            sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote);
    13243 -            sArgs = strip(substr(sArgs, iNext+1));
    13244 -            /*say 'iNext:' iNext  'sValue:' sValue  'sArgs:' sArgs; */
    13245 -
    13246 -            /* check if we're gonna search for something in an file. */
    13247 -            if (sValue <> '' & pos('#define=', sValue) > 0) then
    13248 -                sValue = LookupDefine(sValue);
    13249 -        end
    13250 -        else
    13251 -        do
    13252 -            say 'syntax error near' substr(sArgs, 1, 2)'.';
    13253 -            call syntax;
    13254 -            exit(3);
    13255 -        end
    13256 -
    13257 -
    13258 -        /* set value */
    13259 -        select
    13260 -            when (ch = 'A') then /* ASD Feature Id */
    13261 -                sASDFeatureId   = sValue;
    13262 -
    13263 -            when (ch = 'C') then /* Country code */
    13264 -                sCountryCode    = sValue;
    13265 -
    13266 -            when (ch = 'D') then /* Description */
    13267 -                sDescription    = sValue;
    13268 -
    13269 -            when (ch = 'H') then /* Hostname */
    13270 -                sHostname       = sValue;
    13271 -
    13272 -            when (ch = 'L') then /* Language code */
    13273 -                sLanguageCode   = sValue;
    13274 -
    13275 -            when (ch = 'M') then /* MiniVer */
    13276 -                sMiniVer        = sValue;
    13277 -
    13278 -            when (ch = 'N') then /* Vendor */
    13279 -                sVendor         = sValue;
    13280 -
    13281 -            when (ch = 'R') then /* Description */
    13282 -                sDescription    = ReadDescription(sValue, sDefFileIn);
    13283 -
    13284 -            when (ch = 'P') then /* Fixpak version */
    13285 -                sFixPakVer      = sValue;
    13286 -
    13287 -            when (ch = 'T') then /* Date Time */
    13288 -                sDateTime       = sValue;
    13289 -
    13290 -            when (ch = 'V') then /* Version */
    13291 -                sVersion        = sValue;
    13292 -
    13293 -            /* Otherwise it's an illegal option */
    13294 -            otherwise
    13295 -                say 'invalid option:' substr(sArgs, 1, 2);
    13296 -                call syntax;
    13297 -                exit(2);
    13298 -        end /* select */
    13299 -    end
    13300 -    else
    13301 -    do  /*
    13302 -         * Defition file...
    13303 -         */
    13304 -        if (sDefFileOut <> '') then
    13305 -        do
    13306 -            say 'Syntax error: Can''t specify more than two defintion files!';
    13307 -            exit(4);
    13308 -        end
    13309 -        if (sDefFileIn = '') then
    13310 -            parse value sArgs with sDefFileIn' 'sArgs
    13311 -        else
    13312 -            parse value sArgs with sDefFileOut' 'sArgs
    13313 -        sArgs = strip(sArgs);
    13314 -    end
    13315 -end
    13316 -
    13317 -
    13318 -/* check that a defintion file was specified. */
    13319 -if (sDefFileIn = '') then
    13320 -do
    13321 -    say 'Syntax error: Will have to specify a .def-file to update.';
    13322 -    call syntax;
    13323 -    exit(5);
    13324 -end
    13325 -
    13326 -
    13327 -/*
    13328 - * Trim strings to correct lengths.
    13329 - */
    13330 -sVendor         = strip(substr(sVendor, 1, 31));
    13331 -if (substr(sDateTime, 1, 1) <> ' ') then
    13332 -    sDateTime = ' ' || sDateTime;
    13333 -sDateTime       = left(sDateTime, 26);
    13334 -sHostname       = strip(substr(sHostname, 1, 11));
    13335 -sMiniVer        = strip(substr(sMiniVer, 1, 11));
    13336 -sDescription    = strip(substr(sDescription, 1, 80));
    13337 -sCountryCode    = strip(substr(sCountryCode, 1, 4));
    13338 -sLanguageCode   = strip(substr(sLanguageCode, 1, 4));
    13339 -sASDFeatureId   = strip(substr(sASDFeatureId, 1, 11));
    13340 -sFixPakVer      = strip(substr(sFixPakVer, 1, 11));
    13341 -
    13342 -
    13343 -/*
    13344 - * Signature
    13345 - */
    13346 -sEnhSign = '##1##'
    13347 -
    13348 -/*
    13349 - * Build description string.
    13350 - */
    13351 -sDescription =  '@#'sVendor':'sVersion'#@'sEnhSign||,
    13352 -                sDateTime||sHostname||,
    13353 -                ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||,
    13354 -                '::'sFixPakVer'@@'sDescription;
    13355 -
    13356 -/*
    13357 - * Update .def-file.
    13358 - */
    13359 -rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);
    13360 -if (rc = 0 & iVerbose >= 1) then
    13361 -    say 'BldLevelInf: Applied build info to '''sDefFileOut'''.';
    13362 -exit(rc);
    13363 -
    13364 -
    13365 -/**
    13366 - * Display script syntax.
    13367 - */
    13368 -syntax: procedure expose (sGlobals);
    13369 -    say 'Syntax: MakeDesc.cmd [options] <deffile in> <deffile out> [options]'
    13370 -    say '   <deffile>   Defitionfile which will have an DESCRIPTION appended.'
    13371 -    say 'Options:'
    13372 -    say '   -A<string>  ASD Feature Id.'
    13373 -    say '   -C<string>  Country code.'
    13374 -    say '   -D<string>  Description.'
    13375 -    say '   -R[deffile] Read description from .def file.'
    13376 -    say '   -H<string>  Hostname.'
    13377 -    say '   -L<string>  Language code.'
    13378 -    say '   -M<string>  MiniVer.'
    13379 -    say '   -N<string>  Vendor.'
    13380 -    say '   -P<string>  Fixpak version.'
    13381 -    say '   -T<string>  Date Time.'
    13382 -    say '   -V<string>  Version.'
    13383 -    say '<string> could be a double qoute qouted string or a single word.'
    13384 -    say '       You could also reference #defines in C/C++ include files.'
    13385 -    say '       The string should then have this form:'
    13386 -    say '           "#define=<DEFINE_NAME>,<includefile.h>"'
    13387 -    say '';
    13388 -
    13389 -    return;
    13390 -
    13391 -
    13392 -/**
    13393 - * Search for a #define in an C/C++ header or source file.
    13394 - *
    13395 - * @returns String containing the defined value
    13396 - *          found for the define in the header file.
    13397 - *          Quits on fatal errors.
    13398 - * @param   A string on the form: "#define=DEFINETOFIND,includefile.h"
    13399 - * @remark  Write only code... - let's hope it works.
    13400 - */
    13401 -LookupDefine: procedure expose (sGlobals);
    13402 -    parse arg '#'sDefine'='sMacro','sIncludeFile
    13403 -
    13404 -    /*
    13405 -     * Validate parameters.
    13406 -     */
    13407 -    sMacro = strip(sMacro);
    13408 -    sIncludeFile = strip(sIncludeFile);
    13409 -    if (sMacro = '') then
    13410 -    do
    13411 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    13412 -        say '    <DEFINE_NAME> was empty.';
    13413 -        exit(-20);
    13414 -    end
    13415 -    if (sIncludeFile = '') then
    13416 -    do
    13417 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    13418 -        say '    <includefile.h> was empty.';
    13419 -        exit(-20);
    13420 -    end
    13421 -
    13422 -
    13423 -    sIllegal = translate(translate(sMacro),,
    13424 -                         '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',,
    13425 -                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_');
    13426 -
    13427 -    if (strip(translate(sIllegal, ' ', '!')) <> '') then
    13428 -    do
    13429 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    13430 -        say '    <DEFINE_NAME> contains illegal charater(s).'
    13431 -        say '        'sMacro;
    13432 -        say '        'translate(sIllegal, ' ', '!');
    13433 -        exit(-20);
    13434 -    end
    13435 -
    13436 -    /*
    13437 -     * Open include file.
    13438 -     */
    13439 -    sRc = stream(sIncludeFile, 'c', 'open read');
    13440 -    if (pos('READY', sRc) <> 1) then
    13441 -    do  /* search INCLUDE variable */
    13442 -        sFile = SysSearchPath('INCLUDE', sIncludeFile);
    13443 -        if (sFile = '') then
    13444 -        do
    13445 -            say 'Can''t find include file 'sIncludeFile'.';
    13446 -            exit(-20);
    13447 -        end
    13448 -        sIncludeFile = sFile;
    13449 -
    13450 -        sRc = stream(sIncludeFile, 'c', 'open read');
    13451 -        if (pos('READY', sRc) <> 1) then
    13452 -        do
    13453 -            say 'Failed to open include file' sIncludeFile'.';
    13454 -            exit(-20);
    13455 -        end
    13456 -    end
    13457 -
    13458 -    /*
    13459 -     * Search the file line by line.
    13460 -     *  We'll check for lines starting with a hash (#) char.
    13461 -     *  Then check that the word after the hash is 'define'.
    13462 -     *  Then match the next word with the macro name.
    13463 -     *  Then then get the next rest of the line to comment or continuation char.
    13464 -     *      (continuation is not supported)
    13465 -     *  Finally strip quotes.
    13466 -     */
    13467 -    sValue = '';
    13468 -    do while (lines(sIncludeFile) > 0)
    13469 -        sLine = strip(linein(sIncludeFile));
    13470 -        if (sLine = '') then
    13471 -            iterate;
    13472 -        if (substr(sLine, 1, 1) <> '#') then
    13473 -            iterate;
    13474 -        sLine = substr(sLine, 2);
    13475 -        if (word(sLine, 1) <> 'define') then
    13476 -            iterate;
    13477 -        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1));
    13478 -        if (  substr(sLine, 1, length(sMacro)) <> sMacro,
    13479 -            | substr(sLine, length(sMacro)+1, 1) <> ' ') then
    13480 -            iterate;
    13481 -        sLine = strip(substr(sLine, length(sMacro) + 1));
    13482 -        if (sLine = '') then
    13483 -        do
    13484 -            say 'error: #define' sMacro' is empty.';
    13485 -            call stream sIncludeFile, 'c', 'close';
    13486 -            exit(-20);
    13487 -        end
    13488 -
    13489 -        chQuote = substr(sLine, 1, 1);
    13490 -        if (chQuote = '"' | chQuote = "'") then
    13491 -        do  /* quoted string */
    13492 -            iLastQuote = 0;
    13493 -            do forever
    13494 -                iLast = pos(chQuote, sLine, 2);
    13495 -                if (iLast <= 0) then
    13496 -                    leave;
    13497 -                if (substr(sLine, iLast, 1) = '\') then
    13498 -                    iterate;
    13499 -                iLastQuote = iLast;
    13500 -                leave;
    13501 -            end
    13502 -
    13503 -            if (iLastQuote <= 0) then
    13504 -            do
    13505 -                say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.';
    13506 -                call stream sIncludeFile, 'c', 'close';
    13507 -                exit(-20);
    13508 -            end
    13509 -
    13510 -            call stream sIncludeFile, 'c', 'close';
    13511 -            sValue = substr(sLine, 2, iLastQuote - 2);
    13512 -            if (iVerbose >= 2) then
    13513 -                say 'Found 'sMacro'='sValue;
    13514 -            return sValue;
    13515 -        end
    13516 -        else
    13517 -        do
    13518 -            iCommentCPP = pos('//',sLine);
    13519 -            iCommentC   = pos('/*',sLine);
    13520 -            if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then
    13521 -                iComment = iCommentCPP;
    13522 -            else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then
    13523 -                iComment = iCommentC;
    13524 -            else if (iCommentCPP > 0) then
    13525 -                iComment = iCommentCPP;
    13526 -            else if (iCommentC > 0) then
    13527 -                iComment = iCommentC;
    13528 -            else
    13529 -                iComment = 0;
    13530 -
    13531 -            if (iComment > 0) then
    13532 -                sValue = strip(substr(sLine, 1, iComment-1));
    13533 -            else
    13534 -                sValue = strip(sLine);
    13535 -
    13536 -            if (sValue <> '') then
    13537 -            do
    13538 -                if (substr(sValue, length(sValue)) = '\') then
    13539 -                do
    13540 -                    say 'Found continuation char: Multiline definitions are not supported!\n';
    13541 -                    call stream sIncludeFile, 'c', 'close';
    13542 -                    exit(-20);
    13543 -                end
    13544 -            end
    13545 -
    13546 -            if (sValue = '') then
    13547 -                say 'warning: The #define has no value.';
    13548 -
    13549 -            call stream sIncludeFile, 'c', 'close';
    13550 -            if (iVerbose >= 2) then
    13551 -                say 'Found 'sMacro'='sValue;
    13552 -            return sValue;
    13553 -        end
    13554 -    end
    13555 -
    13556 -    call stream sIncludeFile, 'c', 'close';
    13557 -    say 'error: didn''t find #define' sMacro'.';
    13558 -    exit(-20);
    13559 -
    13560 -
    13561 -
    13562 -/**
    13563 - * Reads the description line for a .def-file.
    13564 - * @returns The Description string, with quotes removed.
    13565 - *          Empty string is acceptable.
    13566 - *          On error we'll terminate the script.
    13567 - * @param   sDefFile    Filaname of .def-file to read the description from.
    13568 - * @param   sDefFile2   Used if sDefFile is empty.
    13569 - * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    13570 - */
    13571 -ReadDescription: procedure expose (sGlobals);
    13572 -    parse arg sDefFile, sDefFile2
    13573 -
    13574 -    /*
    13575 -     * Validate parameters.
    13576 -     */
    13577 -    if (sDefFile = '') then
    13578 -        sDefFile = sDefFile2;
    13579 -    if (sDefFile = '') then
    13580 -    do
    13581 -        say 'error: no definition file to get description from.'
    13582 -        exit(-1);
    13583 -    end
    13584 -
    13585 -    /*
    13586 -     * Open file
    13587 -     */
    13588 -    rc = stream(sDefFile, 'c', 'open read');
    13589 -    if (pos('READY', rc) <> 1) then
    13590 -    do
    13591 -        say 'error: failed to open deffile file.';
    13592 -        exit(-1);
    13593 -    end
    13594 -
    13595 -
    13596 -    /*
    13597 -     * Search for the 'DESCRIPTION' line.
    13598 -     */
    13599 -    do while (lines(sDefFile) > 0)
    13600 -        sLine = strip(linein(sDefFile));
    13601 -        if (sLine = '') then
    13602 -            iterate;
    13603 -        if (translate(word(sLine, 1)) <> 'DESCRIPTION') then
    13604 -            iterate;
    13605 -        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1));
    13606 -
    13607 -        ch = substr(sLine, 1, 1);
    13608 -        if (ch <> "'" & ch <> '"') then
    13609 -        do
    13610 -            say 'syntax error: description line in' sDefFile 'is misformed.';
    13611 -            call stream sDefFile, 'c', 'close';
    13612 -            exit(-10);
    13613 -        end
    13614 -
    13615 -        iEnd = pos(ch, sLine, 2);
    13616 -        if (iEnd <= 0) then
    13617 -        do
    13618 -            say 'syntax error: description line in' sDefFile 'is misformed.';
    13619 -            call stream sDefFile, 'c', 'close';
    13620 -            exit(-10);
    13621 -        end
    13622 -
    13623 -        call stream sDefFile, 'c', 'close';
    13624 -        sValue = substr(sLine, 2, iEnd - 2);
    13625 -        if (iVerbose >= 2) then
    13626 -            say 'Found Description:' sValue;
    13627 -        return sValue;
    13628 -    end
    13629 -
    13630 -    call stream sDefFile, 'c', 'close';
    13631 -    if (iVerbose >= 1) then
    13632 -        say 'info: Didn''t find description line in' sDefFile'.';
    13633 -    return '';
    13634 -
    13635 -
    13636 -/**
    13637 - * This is a function which reads sDefFileIn into and
    13638 - * internal array and changes the DESCRIPTION text if found.
    13639 - * If DESCRIPTION isn't found, it is added at the end.
    13640 - * The array is written to sDefFileOut.
    13641 - * @returns 0 on succes.
    13642 - *          Errorcode on error.
    13643 - * @param   sDefFileIn      Input .def-file.
    13644 - * @param   sDefFileOut     Output .def-file. Overwritten.
    13645 - * @param   sDescription    New description string.
    13646 - * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    13647 - */
    13648 -UpdateDefFile: procedure expose (sGlobals);
    13649 -    parse arg sDefFileIn, sDefFileOut, sDescription
    13650 -
    13651 -    /*
    13652 -     * Validate parameters.
    13653 -     */
    13654 -    if (sDefFileOut = '') then
    13655 -        sDefFileOut = sDefFileIn;
    13656 -
    13657 -    /*
    13658 -     * Open file input file.
    13659 -     */
    13660 -    rc = stream(sDefFileIn, 'c', 'open read');
    13661 -    if (pos('READY', rc) <> 1) then
    13662 -    do
    13663 -        say 'error: failed to open' sDefFileIn 'file.';
    13664 -        return 110;
    13665 -    end
    13666 -
    13667 -
    13668 -    /*
    13669 -     * Search for the 'DESCRIPTION' line.
    13670 -     */
    13671 -    i = 0;
    13672 -    fDescription = 0;
    13673 -    do while (lines(sDefFileIn) > 0)
    13674 -        /*
    13675 -         * Read line.
    13676 -         */
    13677 -        i = i + 1;
    13678 -        asFile.i = strip(linein(sDefFileIn));
    13679 -
    13680 -        /*
    13681 -         * Look for DESCRIPTION;
    13682 -         */
    13683 -        if (asFile.i = '') then
    13684 -            iterate;
    13685 -        if (translate(word(asFile.i, 1)) <> 'DESCRIPTION') then
    13686 -            iterate;
    13687 -        if (fDescription) then
    13688 -        do
    13689 -            say 'warning: multiple descriptions lines. Line' i 'removed';
    13690 -            i = i - 1;
    13691 -            iterate;
    13692 -        end
    13693 -
    13694 -        /*
    13695 -         * Found description - replace with new description.
    13696 -         */
    13697 -        asFile.i = "DESCRIPTION '"||sDescription||"'";
    13698 -        fDescription = 1;
    13699 -    end
    13700 -
    13701 -    /*
    13702 -     * Add description is none was found.
    13703 -     */
    13704 -    if (\fDescription) then
    13705 -    do
    13706 -        i = i + 1;
    13707 -        asFile.i = "DESCRIPTION '"||sDescription||"'";
    13708 -    end
    13709 -    asFile.0 = i;
    13710 -
    13711 -
    13712 -    /*
    13713 -     * Close input file and open output file.
    13714 -     */
    13715 -    call stream sDefFileIn, 'c', 'close';
    13716 -    call SysFileDelete(sDefFileOut);
    13717 -    rc = stream(sDefFileOut, 'c', 'open write');
    13718 -    if (pos('READY', rc) <> 1) then
    13719 -    do
    13720 -        say 'error: failed to open outputfile' sDefFileOut 'file.';
    13721 -        return 110;
    13722 -    end
    13723 -
    13724 -    /*
    13725 -     * Make firstline and write all the lines to the output file.
    13726 -     */
    13727 -    call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;
    13728 -    do i = 1 to asFile.0
    13729 -        rc = lineout(sDefFileOut, asFile.i);
    13730 -        if (rc > 0) then
    13731 -        do
    13732 -            say 'error: failed to write line' i 'to' sDefFileOut'.'
    13733 -            call stream sDefFileOut, 'c', 'close';
    13734 -            return 5;
    13735 -        end
    13736 -    end
    13737 -
    13738 -    /*
    13739 -     * Close output file and return succesfully.
    13740 -     */
    13741 -    call stream sDefFileOut, 'c', 'close';
    13742 -    return 0;
    13743 -
    13744 -
    13745 -/**
    13746 - * Get environment variable value.
    13747 - * @returns Environment variable value if set.
    13748 - *          '' if not set.
    13749 - * @param   sVar    Variable name.
    13750 - */
    13751 -getenv: procedure
    13752 -parse arg sVar
    13753 -return value(sVar,,'OS2ENVIRONMENT');
    13754 -
    13755 -
    13756 -/**
    13757 - * No value handler
    13758 - */
    13759 -NoValueHandler:
    13760 -    say 'NoValueHandler: line 'SIGL;
    13761 -return 0;
    13762 -
    13763 +/* $Id: BldLevelInf.cmd,v 1.6 2002-08-24 04:36:04 bird Exp $
    13764 + *
    13765 + * Adds a Description string to the given .def-file.
    13766 + * Fills in default values; like build time and host.
    13767 + *
    13768 + */
    13769 +
    13770 +signal on novalue name NoValueHandler
    13771 +
    13772 +if RxFuncQuery('SysLoadFuncs') = 1 then
    13773 +do
    13774 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    13775 +    call SysLoadFuncs;
    13776 +end
    13777 +
    13778 +
    13779 +/*
    13780 + * Set default parameter values.
    13781 + */
    13782 +sDefFileIn      = '';
    13783 +sDefFileOut     = '';
    13784 +sASDFeatureId   = '';
    13785 +sCountryCode    = '';
    13786 +sDateTime       = left(' 'date()' 'time(), 26);
    13787 +sDescription    = 'Odin32';
    13788 +sFixPakVer      = '';
    13789 +sHostname       = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11));
    13790 +sLanguageCode   = '';
    13791 +sMiniVer        = '';
    13792 +sVendor         = 'Project Odin';
    13793 +sVersion        = '0.5';
    13794 +
    13795 +
    13796 +/*
    13797 + * Config stuff.
    13798 + */
    13799 +iVerbose        = 1;                    /* 0, 1 or 2. */
    13800 +if (getenv("BUILD_QUIET") <> '') then
    13801 +    iVerbose    = 0;
    13802 +else if (getenv("BUILD_VERBOSE") <> '') then
    13803 +    iVerbose    = 2;
    13804 +sGlobals = 'iVerbose'
    13805 +
    13806 +/*
    13807 + * Parse parameters.
    13808 + */
    13809 +parse arg  sArgs
    13810 +if (sArgs = '') then
    13811 +do
    13812 +    call syntax;
    13813 +    exit(1);
    13814 +end
    13815 +
    13816 +do while (sArgs <> '')
    13817 +    sArgs = strip(sArgs);
    13818 +    if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then
    13819 +    do  /*
    13820 +         * Option.
    13821 +         */
    13822 +        ch = translate(substr(sArgs, 2, 1));
    13823 +        if (pos(ch, 'ACDHLMNPRTV') < 1) then
    13824 +        do
    13825 +            say 'invalid option:' substr(sArgs, 1, 2);
    13826 +            call syntax;
    13827 +            exit(2);
    13828 +        end
    13829 +
    13830 +        /* get value and advance sArgs to next or to end. */
    13831 +        if (substr(sArgs, 3, 1) = '"') then
    13832 +        do
    13833 +            iNext = pos('"', sArgs, 4);
    13834 +            fQuote = 1;
    13835 +        end
    13836 +        else
    13837 +        do
    13838 +            iNext = pos(' ', sArgs, 3);
    13839 +            if (iNext <= 0) then
    13840 +                iNext = length(sArgs);
    13841 +            fQuote = 0;
    13842 +        end
    13843 +
    13844 +        if (iNext > 3 | ch = 'R') then
    13845 +        do
    13846 +            sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote);
    13847 +            sArgs = strip(substr(sArgs, iNext+1));
    13848 +            /*say 'iNext:' iNext  'sValue:' sValue  'sArgs:' sArgs; */
    13849 +
    13850 +            /* check if we're gonna search for something in an file. */
    13851 +            if (sValue <> '' & pos('#define=', sValue) > 0) then
    13852 +                sValue = LookupDefine(sValue);
    13853 +        end
    13854 +        else
    13855 +        do
    13856 +            say 'syntax error near' substr(sArgs, 1, 2)'.';
    13857 +            call syntax;
    13858 +            exit(3);
    13859 +        end
    13860 +
    13861 +
    13862 +        /* set value */
    13863 +        select
    13864 +            when (ch = 'A') then /* ASD Feature Id */
    13865 +                sASDFeatureId   = sValue;
    13866 +
    13867 +            when (ch = 'C') then /* Country code */
    13868 +                sCountryCode    = sValue;
    13869 +
    13870 +            when (ch = 'D') then /* Description */
    13871 +                sDescription    = sValue;
    13872 +
    13873 +            when (ch = 'H') then /* Hostname */
    13874 +                sHostname       = sValue;
    13875 +
    13876 +            when (ch = 'L') then /* Language code */
    13877 +                sLanguageCode   = sValue;
    13878 +
    13879 +            when (ch = 'M') then /* MiniVer */
    13880 +                sMiniVer        = sValue;
    13881 +
    13882 +            when (ch = 'N') then /* Vendor */
    13883 +                sVendor         = sValue;
    13884 +
    13885 +            when (ch = 'R') then /* Description */
    13886 +                sDescription    = ReadDescription(sValue, sDefFileIn);
    13887 +
    13888 +            when (ch = 'P') then /* Fixpak version */
    13889 +                sFixPakVer      = sValue;
    13890 +
    13891 +            when (ch = 'T') then /* Date Time */
    13892 +                sDateTime       = sValue;
    13893 +
    13894 +            when (ch = 'V') then /* Version */
    13895 +                sVersion        = sValue;
    13896 +
    13897 +            /* Otherwise it's an illegal option */
    13898 +            otherwise
    13899 +                say 'invalid option:' substr(sArgs, 1, 2);
    13900 +                call syntax;
    13901 +                exit(2);
    13902 +        end /* select */
    13903 +    end
    13904 +    else
    13905 +    do  /*
    13906 +         * Defition file...
    13907 +         */
    13908 +        if (sDefFileOut <> '') then
    13909 +        do
    13910 +            say 'Syntax error: Can''t specify more than two defintion files!';
    13911 +            exit(4);
    13912 +        end
    13913 +        if (sDefFileIn = '') then
    13914 +            parse value sArgs with sDefFileIn' 'sArgs
    13915 +        else
    13916 +            parse value sArgs with sDefFileOut' 'sArgs
    13917 +        sArgs = strip(sArgs);
    13918 +    end
    13919 +end
    13920 +
    13921 +
    13922 +/* check that a defintion file was specified. */
    13923 +if (sDefFileIn = '') then
    13924 +do
    13925 +    say 'Syntax error: Will have to specify a .def-file to update.';
    13926 +    call syntax;
    13927 +    exit(5);
    13928 +end
    13929 +
    13930 +
    13931 +/*
    13932 + * Trim strings to correct lengths.
    13933 + */
    13934 +sVendor         = strip(substr(sVendor, 1, 31));
    13935 +if (substr(sDateTime, 1, 1) <> ' ') then
    13936 +    sDateTime = ' ' || sDateTime;
    13937 +sDateTime       = left(sDateTime, 26);
    13938 +sHostname       = strip(substr(sHostname, 1, 11));
    13939 +sMiniVer        = strip(substr(sMiniVer, 1, 11));
    13940 +sDescription    = strip(substr(sDescription, 1, 80));
    13941 +sCountryCode    = strip(substr(sCountryCode, 1, 4));
    13942 +sLanguageCode   = strip(substr(sLanguageCode, 1, 4));
    13943 +sASDFeatureId   = strip(substr(sASDFeatureId, 1, 11));
    13944 +sFixPakVer      = strip(substr(sFixPakVer, 1, 11));
    13945 +
    13946 +
    13947 +/*
    13948 + * Signature
    13949 + */
    13950 +sEnhSign = '##1##'
    13951 +
    13952 +/*
    13953 + * Build description string.
    13954 + */
    13955 +sDescription =  '@#'sVendor':'sVersion'#@'sEnhSign||,
    13956 +                sDateTime||sHostname||,
    13957 +                ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||,
    13958 +                '::'sFixPakVer'@@'sDescription;
    13959 +
    13960 +/*
    13961 + * Update .def-file.
    13962 + */
    13963 +rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);
    13964 +if (rc = 0 & iVerbose >= 1) then
    13965 +    say 'BldLevelInf: Applied build info to '''sDefFileOut'''.';
    13966 +exit(rc);
    13967 +
    13968 +
    13969 +/**
    13970 + * Display script syntax.
    13971 + */
    13972 +syntax: procedure expose (sGlobals);
    13973 +    say 'Syntax: MakeDesc.cmd [options] <deffile in> <deffile out> [options]'
    13974 +    say '   <deffile>   Defitionfile which will have an DESCRIPTION appended.'
    13975 +    say 'Options:'
    13976 +    say '   -A<string>  ASD Feature Id.'
    13977 +    say '   -C<string>  Country code.'
    13978 +    say '   -D<string>  Description.'
    13979 +    say '   -R[deffile] Read description from .def file.'
    13980 +    say '   -H<string>  Hostname.'
    13981 +    say '   -L<string>  Language code.'
    13982 +    say '   -M<string>  MiniVer.'
    13983 +    say '   -N<string>  Vendor.'
    13984 +    say '   -P<string>  Fixpak version.'
    13985 +    say '   -T<string>  Date Time.'
    13986 +    say '   -V<string>  Version.'
    13987 +    say '<string> could be a double qoute qouted string or a single word.'
    13988 +    say '       You could also reference #defines in C/C++ include files.'
    13989 +    say '       The string should then have this form:'
    13990 +    say '           "#define=<DEFINE_NAME>,<includefile.h>"'
    13991 +    say '';
    13992 +
    13993 +    return;
    13994 +
    13995 +
    13996 +/**
    13997 + * Search for a #define in an C/C++ header or source file.
    13998 + *
    13999 + * @returns String containing the defined value
    14000 + *          found for the define in the header file.
    14001 + *          Quits on fatal errors.
    14002 + * @param   A string on the form: "#define=DEFINETOFIND,includefile.h"
    14003 + * @remark  Write only code... - let's hope it works.
    14004 + */
    14005 +LookupDefine: procedure expose (sGlobals);
    14006 +    parse arg '#'sDefine'='sMacro','sIncludeFile
    14007 +
    14008 +    /*
    14009 +     * Validate parameters.
    14010 +     */
    14011 +    sMacro = strip(sMacro);
    14012 +    sIncludeFile = strip(sIncludeFile);
    14013 +    if (sMacro = '') then
    14014 +    do
    14015 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    14016 +        say '    <DEFINE_NAME> was empty.';
    14017 +        exit(-20);
    14018 +    end
    14019 +    if (sIncludeFile = '') then
    14020 +    do
    14021 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    14022 +        say '    <includefile.h> was empty.';
    14023 +        exit(-20);
    14024 +    end
    14025 +
    14026 +
    14027 +    sIllegal = translate(translate(sMacro),,
    14028 +                         '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',,
    14029 +                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_');
    14030 +
    14031 +    if (strip(translate(sIllegal, ' ', '!')) <> '') then
    14032 +    do
    14033 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    14034 +        say '    <DEFINE_NAME> contains illegal charater(s).'
    14035 +        say '        'sMacro;
    14036 +        say '        'translate(sIllegal, ' ', '!');
    14037 +        exit(-20);
    14038 +    end
    14039 +
    14040 +    /*
    14041 +     * Open include file.
    14042 +     */
    14043 +    sRc = stream(sIncludeFile, 'c', 'open read');
    14044 +    if (pos('READY', sRc) <> 1) then
    14045 +    do  /* search INCLUDE variable */
    14046 +        sFile = SysSearchPath('INCLUDE', sIncludeFile);
    14047 +        if (sFile = '') then
    14048 +        do
    14049 +            say 'Can''t find include file 'sIncludeFile'.';
    14050 +            exit(-20);
    14051 +        end
    14052 +        sIncludeFile = sFile;
    14053 +
    14054 +        sRc = stream(sIncludeFile, 'c', 'open read');
    14055 +        if (pos('READY', sRc) <> 1) then
    14056 +        do
    14057 +            say 'Failed to open include file' sIncludeFile'.';
    14058 +            exit(-20);
    14059 +        end
    14060 +    end
    14061 +
    14062 +    /*
    14063 +     * Search the file line by line.
    14064 +     *  We'll check for lines starting with a hash (#) char.
    14065 +     *  Then check that the word after the hash is 'define'.
    14066 +     *  Then match the next word with the macro name.
    14067 +     *  Then then get the next rest of the line to comment or continuation char.
    14068 +     *      (continuation is not supported)
    14069 +     *  Finally strip quotes.
    14070 +     */
    14071 +    sValue = '';
    14072 +    do while (lines(sIncludeFile) > 0)
    14073 +        sLine = strip(linein(sIncludeFile));
    14074 +        if (sLine = '') then
    14075 +            iterate;
    14076 +        if (substr(sLine, 1, 1) <> '#') then
    14077 +            iterate;
    14078 +        sLine = substr(sLine, 2);
    14079 +        if (word(sLine, 1) <> 'define') then
    14080 +            iterate;
    14081 +        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1));
    14082 +        if (  substr(sLine, 1, length(sMacro)) <> sMacro,
    14083 +            | substr(sLine, length(sMacro)+1, 1) <> ' ') then
    14084 +            iterate;
    14085 +        sLine = strip(substr(sLine, length(sMacro) + 1));
    14086 +        if (sLine = '') then
    14087 +        do
    14088 +            say 'error: #define' sMacro' is empty.';
    14089 +            call stream sIncludeFile, 'c', 'close';
    14090 +            exit(-20);
    14091 +        end
    14092 +
    14093 +        chQuote = substr(sLine, 1, 1);
    14094 +        if (chQuote = '"' | chQuote = "'") then
    14095 +        do  /* quoted string */
    14096 +            iLastQuote = 0;
    14097 +            do forever
    14098 +                iLast = pos(chQuote, sLine, 2);
    14099 +                if (iLast <= 0) then
    14100 +                    leave;
    14101 +                if (substr(sLine, iLast, 1) = '\') then
    14102 +                    iterate;
    14103 +                iLastQuote = iLast;
    14104 +                leave;
    14105 +            end
    14106 +
    14107 +            if (iLastQuote <= 0) then
    14108 +            do
    14109 +                say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.';
    14110 +                call stream sIncludeFile, 'c', 'close';
    14111 +                exit(-20);
    14112 +            end
    14113 +
    14114 +            call stream sIncludeFile, 'c', 'close';
    14115 +            sValue = substr(sLine, 2, iLastQuote - 2);
    14116 +            if (iVerbose >= 2) then
    14117 +                say 'Found 'sMacro'='sValue;
    14118 +            return sValue;
    14119 +        end
    14120 +        else
    14121 +        do
    14122 +            iCommentCPP = pos('//',sLine);
    14123 +            iCommentC   = pos('/*',sLine);
    14124 +            if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then
    14125 +                iComment = iCommentCPP;
    14126 +            else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then
    14127 +                iComment = iCommentC;
    14128 +            else if (iCommentCPP > 0) then
    14129 +                iComment = iCommentCPP;
    14130 +            else if (iCommentC > 0) then
    14131 +                iComment = iCommentC;
    14132 +            else
    14133 +                iComment = 0;
    14134 +
    14135 +            if (iComment > 0) then
    14136 +                sValue = strip(substr(sLine, 1, iComment-1));
    14137 +            else
    14138 +                sValue = strip(sLine);
    14139 +
    14140 +            if (sValue <> '') then
    14141 +            do
    14142 +                if (substr(sValue, length(sValue)) = '\') then
    14143 +                do
    14144 +                    say 'Found continuation char: Multiline definitions are not supported!\n';
    14145 +                    call stream sIncludeFile, 'c', 'close';
    14146 +                    exit(-20);
    14147 +                end
    14148 +            end
    14149 +
    14150 +            if (sValue = '') then
    14151 +                say 'warning: The #define has no value.';
    14152 +
    14153 +            call stream sIncludeFile, 'c', 'close';
    14154 +            if (iVerbose >= 2) then
    14155 +                say 'Found 'sMacro'='sValue;
    14156 +            return sValue;
    14157 +        end
    14158 +    end
    14159 +
    14160 +    call stream sIncludeFile, 'c', 'close';
    14161 +    say 'error: didn''t find #define' sMacro'.';
    14162 +    exit(-20);
    14163 +
    14164 +
    14165 +
    14166 +/**
    14167 + * Reads the description line for a .def-file.
    14168 + * @returns The Description string, with quotes removed.
    14169 + *          Empty string is acceptable.
    14170 + *          On error we'll terminate the script.
    14171 + * @param   sDefFile    Filaname of .def-file to read the description from.
    14172 + * @param   sDefFile2   Used if sDefFile is empty.
    14173 + * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    14174 + */
    14175 +ReadDescription: procedure expose (sGlobals);
    14176 +    parse arg sDefFile, sDefFile2
    14177 +
    14178 +    /*
    14179 +     * Validate parameters.
    14180 +     */
    14181 +    if (sDefFile = '') then
    14182 +        sDefFile = sDefFile2;
    14183 +    if (sDefFile = '') then
    14184 +    do
    14185 +        say 'error: no definition file to get description from.'
    14186 +        exit(-1);
    14187 +    end
    14188 +
    14189 +    /*
    14190 +     * Open file
    14191 +     */
    14192 +    rc = stream(sDefFile, 'c', 'open read');
    14193 +    if (pos('READY', rc) <> 1) then
    14194 +    do
    14195 +        say 'error: failed to open deffile file.';
    14196 +        exit(-1);
    14197 +    end
    14198 +
    14199 +
    14200 +    /*
    14201 +     * Search for the 'DESCRIPTION' line.
    14202 +     */
    14203 +    do while (lines(sDefFile) > 0)
    14204 +        sLine = strip(linein(sDefFile));
    14205 +        if (sLine = '') then
    14206 +            iterate;
    14207 +        if (translate(word(sLine, 1)) <> 'DESCRIPTION') then
    14208 +            iterate;
    14209 +        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1));
    14210 +
    14211 +        ch = substr(sLine, 1, 1);
    14212 +        if (ch <> "'" & ch <> '"') then
    14213 +        do
    14214 +            say 'syntax error: description line in' sDefFile 'is misformed.';
    14215 +            call stream sDefFile, 'c', 'close';
    14216 +            exit(-10);
    14217 +        end
    14218 +
    14219 +        iEnd = pos(ch, sLine, 2);
    14220 +        if (iEnd <= 0) then
    14221 +        do
    14222 +            say 'syntax error: description line in' sDefFile 'is misformed.';
    14223 +            call stream sDefFile, 'c', 'close';
    14224 +            exit(-10);
    14225 +        end
    14226 +
    14227 +        call stream sDefFile, 'c', 'close';
    14228 +        sValue = substr(sLine, 2, iEnd - 2);
    14229 +        if (iVerbose >= 2) then
    14230 +            say 'Found Description:' sValue;
    14231 +        return sValue;
    14232 +    end
    14233 +
    14234 +    call stream sDefFile, 'c', 'close';
    14235 +    if (iVerbose >= 1) then
    14236 +        say 'info: Didn''t find description line in' sDefFile'.';
    14237 +    return '';
    14238 +
    14239 +
    14240 +/**
    14241 + * This is a function which reads sDefFileIn into and
    14242 + * internal array and changes the DESCRIPTION text if found.
    14243 + * If DESCRIPTION isn't found, it is added at the end.
    14244 + * The array is written to sDefFileOut.
    14245 + * @returns 0 on succes.
    14246 + *          Errorcode on error.
    14247 + * @param   sDefFileIn      Input .def-file.
    14248 + * @param   sDefFileOut     Output .def-file. Overwritten.
    14249 + * @param   sDescription    New description string.
    14250 + * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    14251 + */
    14252 +UpdateDefFile: procedure expose (sGlobals);
    14253 +    parse arg sDefFileIn, sDefFileOut, sDescription
    14254 +
    14255 +    /*
    14256 +     * Validate parameters.
    14257 +     */
    14258 +    if (sDefFileOut = '') then
    14259 +        sDefFileOut = sDefFileIn;
    14260 +
    14261 +    /*
    14262 +     * Open file input file.
    14263 +     */
    14264 +    rc = stream(sDefFileIn, 'c', 'open read');
    14265 +    if (pos('READY', rc) <> 1) then
    14266 +    do
    14267 +        say 'error: failed to open' sDefFileIn 'file.';
    14268 +        return 110;
    14269 +    end
    14270 +
    14271 +
    14272 +    /*
    14273 +     * Search for the 'DESCRIPTION' line.
    14274 +     */
    14275 +    i = 0;
    14276 +    fDescription = 0;
    14277 +    do while (lines(sDefFileIn) > 0)
    14278 +        /*
    14279 +         * Read line.
    14280 +         */
    14281 +        i = i + 1;
    14282 +        asFile.i = strip(linein(sDefFileIn));
    14283 +
    14284 +        /*
    14285 +         * Look for DESCRIPTION;
    14286 +         */
    14287 +        if (asFile.i = '') then
    14288 +            iterate;
    14289 +        if (translate(word(asFile.i, 1)) <> 'DESCRIPTION') then
    14290 +            iterate;
    14291 +        if (fDescription) then
    14292 +        do
    14293 +            say 'warning: multiple descriptions lines. Line' i 'removed';
    14294 +            i = i - 1;
    14295 +            iterate;
    14296 +        end
    14297 +
    14298 +        /*
    14299 +         * Found description - replace with new description.
    14300 +         */
    14301 +        asFile.i = "DESCRIPTION '"||sDescription||"'";
    14302 +        fDescription = 1;
    14303 +    end
    14304 +
    14305 +    /*
    14306 +     * Add description is none was found.
    14307 +     */
    14308 +    if (\fDescription) then
    14309 +    do
    14310 +        i = i + 1;
    14311 +        asFile.i = "DESCRIPTION '"||sDescription||"'";
    14312 +    end
    14313 +    asFile.0 = i;
    14314 +
    14315 +
    14316 +    /*
    14317 +     * Close input file and open output file.
    14318 +     */
    14319 +    call stream sDefFileIn, 'c', 'close';
    14320 +    call SysFileDelete(sDefFileOut);
    14321 +    rc = stream(sDefFileOut, 'c', 'open write');
    14322 +    if (pos('READY', rc) <> 1) then
    14323 +    do
    14324 +        say 'error: failed to open outputfile' sDefFileOut 'file.';
    14325 +        return 110;
    14326 +    end
    14327 +
    14328 +    /*
    14329 +     * Make firstline and write all the lines to the output file.
    14330 +     */
    14331 +    call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;
    14332 +    do i = 1 to asFile.0
    14333 +        rc = lineout(sDefFileOut, asFile.i);
    14334 +        if (rc > 0) then
    14335 +        do
    14336 +            say 'error: failed to write line' i 'to' sDefFileOut'.'
    14337 +            call stream sDefFileOut, 'c', 'close';
    14338 +            return 5;
    14339 +        end
    14340 +    end
    14341 +
    14342 +    /*
    14343 +     * Close output file and return succesfully.
    14344 +     */
    14345 +    call stream sDefFileOut, 'c', 'close';
    14346 +    return 0;
    14347 +
    14348 +
    14349 +/**
    14350 + * Get environment variable value.
    14351 + * @returns Environment variable value if set.
    14352 + *          '' if not set.
    14353 + * @param   sVar    Variable name.
    14354 + */
    14355 +getenv: procedure
    14356 +parse arg sVar
    14357 +return value(sVar,,'OS2ENVIRONMENT');
    14358 +
    14359 +
    14360 +/**
    14361 + * No value handler
    14362 + */
    14363 +NoValueHandler:
    14364 +    say 'NoValueHandler: line 'SIGL;
    14365 +return 0;
    14366 +
    14367 diff --git a/tools/bin/CVSRemoveDeletedDirs.cmd b/tools/bin/CVSRemoveDeletedDirs.cmd
    14368 index 9fd836a..7d98052 100644
    14369 --- a/tools/bin/CVSRemoveDeletedDirs.cmd
    14370 +++ b/tools/bin/CVSRemoveDeletedDirs.cmd
    14371 @@ -1,177 +1,177 @@
    14372 -/*
    14373 - * Cleanup script for directories we removed recently.
    14374 - * Run from root of your odin32 tree.
    14375 - *
    14376 - * Specify 'remove' on the commandline to remove the dirs too.
    14377 - * Default action is only to remove them from the CVS\Entries file.
    14378 - */
    14379 -
    14380 -/*
    14381 - * Import helper functions
    14382 - */
    14383 -call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    14384 -call SysLoadFuncs;
    14385 -
    14386 -
    14387 -/*
    14388 - * Check that current directory is root of Odin32 tree.
    14389 - */
    14390 -if (  \fnExists('.\ChangeLog'),
    14391 -    | \fnExists('.\LICENSE.TXT'),
    14392 -    | \fnExists('.\Configure.cmd'),
    14393 -    | \fnExists('.\rartree.cmd'),
    14394 -    | \fnExists('.\ziptree.cmd'),
    14395 -    | \fnExists('.\makeall.cmd'),
    14396 -    ) then
    14397 -do
    14398 -    say 'Error: You''re not located in the root of the Odin32 tree!'
    14399 -    exit(-1);
    14400 -end
    14401 -
    14402 -
    14403 -/*
    14404 - * Parse arguments.
    14405 - */
    14406 -parse arg sArg1 sArg2
    14407 -
    14408 -fRemoveDir = 0;
    14409 -if (translate(sArg1) = 'REMOVE') then
    14410 -    fRemoveDir = 1;
    14411 -
    14412 -
    14413 -/*
    14414 - * Directories to remove.
    14415 - */
    14416 -asDirs.0 = 5
    14417 -asDirs.1 = 'src\ws2help'
    14418 -asDirs.2 = 'src\win32k\object'
    14419 -asDirs.3 = 'src\win32k\list'
    14420 -asDirs.4 = 'bin\debug'
    14421 -asDirs.5 = 'bin\release'
    14422 -
    14423 -
    14424 -/*
    14425 - * Remove the directories.
    14426 - */
    14427 -do i = 1 to asDirs.0
    14428 -    sSubDir = substr(asDirs.i, lastpos('\', asDirs.i) + 1);
    14429 -    sParentCVSEntries = substr(asDirs.i, 1, lastpos('\', asDirs.i)),
    14430 -                        || 'CVS\Entries';
    14431 -
    14432 -    if (fnExists(sParentCVSEntries)) then
    14433 -    do
    14434 -        /*
    14435 -         * Remove the entry for the given directory.
    14436 -         */
    14437 -        if (fnReadFile(sParentCVSEntries)) then
    14438 -        do
    14439 -            sMatch = translate('D/'||sSubDir||'/');
    14440 -            do j = 1 to asLines.0
    14441 -                if (sMatch = translate(substr(asLines.j, 1, length(sMatch)))) then
    14442 -                    leave
    14443 -            end
    14444 -            do k = j+1 to asLines.0
    14445 -                j = k - 1;
    14446 -                asLines.j = asLines.k;
    14447 -            end
    14448 -            if (j < asLines.0) then /* if directory entry was found. */
    14449 -                asLines.0 = j;
    14450 -            if (fnWriteFile(sParentCVSEntries)) then
    14451 -            do
    14452 -                say 'info: removed '''asDirs.i'''';
    14453 -            end
    14454 -            else
    14455 -                say 'error: failed to write'''||sParentCVSEntries||'''';
    14456 -        end
    14457 -        else
    14458 -            say 'error: failed to read '''||sParentCVSEntries||'''';
    14459 -
    14460 -        /*
    14461 -         * If requested try delete the directory tree.
    14462 -         */
    14463 -        if (fRemoveDir) then
    14464 -        do
    14465 -            call fnRemoveDir asDirs.i;
    14466 -            say 'info: removed the directory(tree) '''asDirs.i'''';
    14467 -        end
    14468 -    end
    14469 -    else
    14470 -        say 'warning: '''||sParentCVSEntries||''' was not found.';
    14471 -end
    14472 -
    14473 -exit(0);
    14474 -
    14475 -
    14476 -
    14477 -/**
    14478 - * Checks if a file exists.
    14479 - * @param   sFile
    14480 - * @returns TRUE if file exists.
    14481 - *          FALSE if file doesn't exists.
    14482 - */
    14483 -fnExists: procedure
    14484 -    parse arg sFile
    14485 -    rc = stream(sFile, 'c', 'query exist');
    14486 -return rc <> '';
    14487 -
    14488 -
    14489 -/**
    14490 - * Read a given file into asLines..
    14491 - * @returns Success indicator.
    14492 - * @param   sFile   Filename to read.
    14493 - */
    14494 -fnReadFile: procedure expose asLines.;
    14495 -    parse arg sFile
    14496 -
    14497 -    asLines.0 = 0;
    14498 -
    14499 -    rc = stream(sFile, 'c', 'open read');
    14500 -    if (pos('READY', rc) <> 1) then
    14501 -        return 0;
    14502 -
    14503 -    iLine = 0;
    14504 -    do while lines(sFile) > 0
    14505 -        iLine = iLine + 1;
    14506 -        asLines.iLine = linein(sFile);
    14507 -    end
    14508 -    asLines.0 = iLine;
    14509 -
    14510 -    call stream sFile, 'c', 'close';
    14511 -return 1;
    14512 -
    14513 -
    14514 -/**
    14515 - * Write the file in asLines. to a real file.
    14516 - * @returns Success indicator.
    14517 - * @param   sFile   Filename to write it to.
    14518 - */
    14519 -fnWriteFile: procedure expose asLines.;
    14520 -    parse arg sFile
    14521 -
    14522 -    rc = SysFileDelete(sFile);
    14523 -    if (rc <> 0) then
    14524 -        say 'sysfiledelete('sFile') -> rc='rc;
    14525 -    rc = stream(sFile, 'c', 'open write');
    14526 -    if (pos('READY', rc) <> 1) then
    14527 -        return 0;
    14528 -    do iLine = 1 to asLines.0
    14529 -        call lineout sFile, asLines.iLine
    14530 -    end
    14531 -
    14532 -    call stream sFile, 'c', 'close';
    14533 -return 1;
    14534 -
    14535 -
    14536 -/**
    14537 - * Removes a given directory tree.
    14538 - * Currently we use 'rm -Rf' for this.
    14539 - *
    14540 - * @returns Successindicator.
    14541 - * @param   sDir    Directory tree to remove.
    14542 - */
    14543 -fnRemoveDir: procedure;
    14544 -    parse arg sDir;
    14545 -    'rm -Rf 'sDir
    14546 -return rc;
    14547 -
    14548 -
    14549 +/*
    14550 + * Cleanup script for directories we removed recently.
    14551 + * Run from root of your odin32 tree.
    14552 + *
    14553 + * Specify 'remove' on the commandline to remove the dirs too.
    14554 + * Default action is only to remove them from the CVS\Entries file.
    14555 + */
    14556 +
    14557 +/*
    14558 + * Import helper functions
    14559 + */
    14560 +call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    14561 +call SysLoadFuncs;
    14562 +
    14563 +
    14564 +/*
    14565 + * Check that current directory is root of Odin32 tree.
    14566 + */
    14567 +if (  \fnExists('.\ChangeLog'),
    14568 +    | \fnExists('.\LICENSE.TXT'),
    14569 +    | \fnExists('.\Configure.cmd'),
    14570 +    | \fnExists('.\rartree.cmd'),
    14571 +    | \fnExists('.\ziptree.cmd'),
    14572 +    | \fnExists('.\makeall.cmd'),
    14573 +    ) then
    14574 +do
    14575 +    say 'Error: You''re not located in the root of the Odin32 tree!'
    14576 +    exit(-1);
    14577 +end
    14578 +
    14579 +
    14580 +/*
    14581 + * Parse arguments.
    14582 + */
    14583 +parse arg sArg1 sArg2
    14584 +
    14585 +fRemoveDir = 0;
    14586 +if (translate(sArg1) = 'REMOVE') then
    14587 +    fRemoveDir = 1;
    14588 +
    14589 +
    14590 +/*
    14591 + * Directories to remove.
    14592 + */
    14593 +asDirs.0 = 5
    14594 +asDirs.1 = 'src\ws2help'
    14595 +asDirs.2 = 'src\win32k\object'
    14596 +asDirs.3 = 'src\win32k\list'
    14597 +asDirs.4 = 'bin\debug'
    14598 +asDirs.5 = 'bin\release'
    14599 +
    14600 +
    14601 +/*
    14602 + * Remove the directories.
    14603 + */
    14604 +do i = 1 to asDirs.0
    14605 +    sSubDir = substr(asDirs.i, lastpos('\', asDirs.i) + 1);
    14606 +    sParentCVSEntries = substr(asDirs.i, 1, lastpos('\', asDirs.i)),
    14607 +                        || 'CVS\Entries';
    14608 +
    14609 +    if (fnExists(sParentCVSEntries)) then
    14610 +    do
    14611 +        /*
    14612 +         * Remove the entry for the given directory.
    14613 +         */
    14614 +        if (fnReadFile(sParentCVSEntries)) then
    14615 +        do
    14616 +            sMatch = translate('D/'||sSubDir||'/');
    14617 +            do j = 1 to asLines.0
    14618 +                if (sMatch = translate(substr(asLines.j, 1, length(sMatch)))) then
    14619 +                    leave
    14620 +            end
    14621 +            do k = j+1 to asLines.0
    14622 +                j = k - 1;
    14623 +                asLines.j = asLines.k;
    14624 +            end
    14625 +            if (j < asLines.0) then /* if directory entry was found. */
    14626 +                asLines.0 = j;
    14627 +            if (fnWriteFile(sParentCVSEntries)) then
    14628 +            do
    14629 +                say 'info: removed '''asDirs.i'''';
    14630 +            end
    14631 +            else
    14632 +                say 'error: failed to write'''||sParentCVSEntries||'''';
    14633 +        end
    14634 +        else
    14635 +            say 'error: failed to read '''||sParentCVSEntries||'''';
    14636 +
    14637 +        /*
    14638 +         * If requested try delete the directory tree.
    14639 +         */
    14640 +        if (fRemoveDir) then
    14641 +        do
    14642 +            call fnRemoveDir asDirs.i;
    14643 +            say 'info: removed the directory(tree) '''asDirs.i'''';
    14644 +        end
    14645 +    end
    14646 +    else
    14647 +        say 'warning: '''||sParentCVSEntries||''' was not found.';
    14648 +end
    14649 +
    14650 +exit(0);
    14651 +
    14652 +
    14653 +
    14654 +/**
    14655 + * Checks if a file exists.
    14656 + * @param   sFile
    14657 + * @returns TRUE if file exists.
    14658 + *          FALSE if file doesn't exists.
    14659 + */
    14660 +fnExists: procedure
    14661 +    parse arg sFile
    14662 +    rc = stream(sFile, 'c', 'query exist');
    14663 +return rc <> '';
    14664 +
    14665 +
    14666 +/**
    14667 + * Read a given file into asLines..
    14668 + * @returns Success indicator.
    14669 + * @param   sFile   Filename to read.
    14670 + */
    14671 +fnReadFile: procedure expose asLines.;
    14672 +    parse arg sFile
    14673 +
    14674 +    asLines.0 = 0;
    14675 +
    14676 +    rc = stream(sFile, 'c', 'open read');
    14677 +    if (pos('READY', rc) <> 1) then
    14678 +        return 0;
    14679 +
    14680 +    iLine = 0;
    14681 +    do while lines(sFile) > 0
    14682 +        iLine = iLine + 1;
    14683 +        asLines.iLine = linein(sFile);
    14684 +    end
    14685 +    asLines.0 = iLine;
    14686 +
    14687 +    call stream sFile, 'c', 'close';
    14688 +return 1;
    14689 +
    14690 +
    14691 +/**
    14692 + * Write the file in asLines. to a real file.
    14693 + * @returns Success indicator.
    14694 + * @param   sFile   Filename to write it to.
    14695 + */
    14696 +fnWriteFile: procedure expose asLines.;
    14697 +    parse arg sFile
    14698 +
    14699 +    rc = SysFileDelete(sFile);
    14700 +    if (rc <> 0) then
    14701 +        say 'sysfiledelete('sFile') -> rc='rc;
    14702 +    rc = stream(sFile, 'c', 'open write');
    14703 +    if (pos('READY', rc) <> 1) then
    14704 +        return 0;
    14705 +    do iLine = 1 to asLines.0
    14706 +        call lineout sFile, asLines.iLine
    14707 +    end
    14708 +
    14709 +    call stream sFile, 'c', 'close';
    14710 +return 1;
    14711 +
    14712 +
    14713 +/**
    14714 + * Removes a given directory tree.
    14715 + * Currently we use 'rm -Rf' for this.
    14716 + *
    14717 + * @returns Successindicator.
    14718 + * @param   sDir    Directory tree to remove.
    14719 + */
    14720 +fnRemoveDir: procedure;
    14721 +    parse arg sDir;
    14722 +    'rm -Rf 'sDir
    14723 +return rc;
    14724 +
    14725 +
    14726 diff --git a/tools/bin/CreatePath.cmd b/tools/bin/CreatePath.cmd
    14727 index 60de5c1..da664ec 100644
    14728 --- a/tools/bin/CreatePath.cmd
    14729 +++ b/tools/bin/CreatePath.cmd
    14730 @@ -1,31 +1,31 @@
    14731 -/* $Id: CreatePath.cmd,v 1.4 2002-05-16 11:50:22 bird Exp $
    14732 - *
    14733 - * Createpath.cmd <pathname>
    14734 - *
    14735 - * Creates a path.
    14736 - *
    14737 - */
    14738 -
    14739 -if RxFuncQuery('SysMkDir')=1 THEN
    14740 -    call RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir'
    14741 -
    14742 -    parse arg sArgs
    14743 -    return createpath(strip(sArgs));
    14744 -
    14745 -createpath: procedure
    14746 -    parse arg sDir
    14747 -
    14748 -    /*
    14749 -     * Any directories above this? If so we'll have to make sure they exists!
    14750 -     */
    14751 -    sPath = filespec('path', sDir);
    14752 -    if (length(sPath) > 0 & sPath <> '\') then
    14753 -        rc = createpath(filespec('drive', sDir) || substr(sPath, 1, length(sPath)-1));
    14754 -
    14755 -    /*
    14756 -     * Create this directory.
    14757 -     */
    14758 -    rc = SysMkDir(sDir);
    14759 -    /*say 'dir:' sDir '- rc='rc;*/
    14760 -
    14761 -    return 0;
    14762 +/* $Id: CreatePath.cmd,v 1.4 2002-05-16 11:50:22 bird Exp $
    14763 + *
    14764 + * Createpath.cmd <pathname>
    14765 + *
    14766 + * Creates a path.
    14767 + *
    14768 + */
    14769 +
    14770 +if RxFuncQuery('SysMkDir')=1 THEN
    14771 +    call RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir'
    14772 +
    14773 +    parse arg sArgs
    14774 +    return createpath(strip(sArgs));
    14775 +
    14776 +createpath: procedure
    14777 +    parse arg sDir
    14778 +
    14779 +    /*
    14780 +     * Any directories above this? If so we'll have to make sure they exists!
    14781 +     */
    14782 +    sPath = filespec('path', sDir);
    14783 +    if (length(sPath) > 0 & sPath <> '\') then
    14784 +        rc = createpath(filespec('drive', sDir) || substr(sPath, 1, length(sPath)-1));
    14785 +
    14786 +    /*
    14787 +     * Create this directory.
    14788 +     */
    14789 +    rc = SysMkDir(sDir);
    14790 +    /*say 'dir:' sDir '- rc='rc;*/
    14791 +
    14792 +    return 0;
    14793 diff --git a/tools/bin/DoDirs.cmd b/tools/bin/DoDirs.cmd
    14794 index 98bfde7..a4b15d7 100644
    14795 --- a/tools/bin/DoDirs.cmd
    14796 +++ b/tools/bin/DoDirs.cmd
    14797 @@ -1,118 +1,118 @@
    14798 -/* $Id: DoDirs.cmd,v 1.7 2002-08-29 11:49:36 bird Exp $
    14799 - *
    14800 - * Rexx script which executes a given command in each of the given
    14801 - * directories. It will fail when a command failes in one of the
    14802 - * directories or if it failes to change to one of the directories.
    14803 - *
    14804 - * Syntax: ProcessDirs.cmd "<sDirs>" <sCommand>
    14805 - *
    14806 - * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    14807 - *
    14808 - * Project Odin Software License can be found in LICENSE.TXT
    14809 - */
    14810 -signal on novalue name NoValueHandler
    14811 -Address CMD '@echo off'
    14812 -
    14813 -parse arg '"'sDirs'" 'sCommand
    14814 -
    14815 -/*
    14816 - * Color config.
    14817 - */
    14818 -if ((getenv('BUILD_NOCOLORS') = '') & (getenv('SLKRUNS') = '')) then
    14819 -do
    14820 -    sClrMak = '[35;1m'
    14821 -    sClrErr = '[31;1m'
    14822 -    sClrRst = '[0m'
    14823 -end
    14824 -else
    14825 -do
    14826 -    sClrMak = ''
    14827 -    sClrErr = ''
    14828 -    sClrRst = ''
    14829 -end
    14830 -
    14831 -
    14832 -/*
    14833 - * Build Pass
    14834 - */
    14835 -sPass = getenv('_BUILD_PASS');
    14836 -if (sPass <> '') then
    14837 -    sPass = 'Pass '||sPass||' - '
    14838 -
    14839 -
    14840 -/*
    14841 - * Save current directory.
    14842 - */
    14843 -sCurrentDir = directory();
    14844 -
    14845 -
    14846 -/*
    14847 - * Loop thru each directory.
    14848 - * The directories are space separated.
    14849 - */
    14850 -iRc = 0;                                /* Returncode */
    14851 -iStart = 1;                             /* Subdirectory Index */
    14852 -do while (iStart <= length(sDirs))
    14853 -    iEnd = pos(' ', sDirs, iStart);
    14854 -    if (iEnd <= 0 & iStart <= length(sDirs)) then
    14855 -        iEnd = length(sDirs) + 1;
    14856 -
    14857 -    if (iEnd > 0) then
    14858 -    do
    14859 -        /*
    14860 -         * Copy out the directory from sDirs. Iterate if empty name.
    14861 -         * Move iStart forward to the next directory i sDirs.
    14862 -         * Try change directory. Complain and fail if this failes.
    14863 -         * Execute command.
    14864 -         * Check return code. Complain and fail if this failes.
    14865 -         */
    14866 -        sDir = substr(sDirs, iStart, iEnd - iStart);
    14867 -        iStart = iEnd + 1;
    14868 -        if (sDir = ' ' | sDir = '') then/* If empty directory name iterate. */
    14869 -            iterate;
    14870 -        if (directory(sDir) <> '') then
    14871 -        do
    14872 -            say sClrMak||'['||sPass||'Entering  Directory:' directory()||']'||sClrRst;
    14873 -            sCommand
    14874 -            if (rc <> 0) then
    14875 -            do
    14876 -                say sClrErr||'['||sPass||'Failed rc='rc' directory:' directory()||']'||sClrRst;
    14877 -                exit(rc);
    14878 -            end
    14879 -            say sClrMak||'['||sPass||'Leaving   Directory:' directory()||']'||sClrRst;
    14880 -        end
    14881 -        else
    14882 -        do
    14883 -            say sClrErr||'['||sPass||'Failed to change directory to' sDir||']'||sClrRst;
    14884 -            exit(267);                  /* ERROR_DIRECTORY */
    14885 -        end
    14886 -        call directory sCurrentDir;     /* Restore start directory. */
    14887 -    end
    14888 -    else
    14889 -        leave;                          /* No more directories left. */
    14890 -end
    14891 -
    14892 -
    14893 -/*
    14894 - * Return successfully.
    14895 - */
    14896 -exit(0);
    14897 -
    14898 -
    14899 -/**
    14900 - * Get environment variable value.
    14901 - * @returns Environment variable value if set.
    14902 - *          '' if not set.
    14903 - * @param   sVar    Variable name.
    14904 - */
    14905 -getenv: procedure
    14906 -parse arg sVar
    14907 -return value(sVar,,'OS2ENVIRONMENT');
    14908 -
    14909 -/**
    14910 - * No value handler
    14911 - */
    14912 -NoValueHandler:
    14913 -    say 'NoValueHandler: line 'SIGL;
    14914 -return 0;
    14915 -
    14916 +/* $Id: DoDirs.cmd,v 1.7 2002-08-29 11:49:36 bird Exp $
    14917 + *
    14918 + * Rexx script which executes a given command in each of the given
    14919 + * directories. It will fail when a command failes in one of the
    14920 + * directories or if it failes to change to one of the directories.
    14921 + *
    14922 + * Syntax: ProcessDirs.cmd "<sDirs>" <sCommand>
    14923 + *
    14924 + * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    14925 + *
    14926 + * Project Odin Software License can be found in LICENSE.TXT
    14927 + */
    14928 +signal on novalue name NoValueHandler
    14929 +Address CMD '@echo off'
    14930 +
    14931 +parse arg '"'sDirs'" 'sCommand
    14932 +
    14933 +/*
    14934 + * Color config.
    14935 + */
    14936 +if ((getenv('BUILD_NOCOLORS') = '') & (getenv('SLKRUNS') = '')) then
    14937 +do
    14938 +    sClrMak = '[35;1m'
    14939 +    sClrErr = '[31;1m'
    14940 +    sClrRst = '[0m'
    14941 +end
    14942 +else
    14943 +do
    14944 +    sClrMak = ''
    14945 +    sClrErr = ''
    14946 +    sClrRst = ''
    14947 +end
    14948 +
    14949 +
    14950 +/*
    14951 + * Build Pass
    14952 + */
    14953 +sPass = getenv('_BUILD_PASS');
    14954 +if (sPass <> '') then
    14955 +    sPass = 'Pass '||sPass||' - '
    14956 +
    14957 +
    14958 +/*
    14959 + * Save current directory.
    14960 + */
    14961 +sCurrentDir = directory();
    14962 +
    14963 +
    14964 +/*
    14965 + * Loop thru each directory.
    14966 + * The directories are space separated.
    14967 + */
    14968 +iRc = 0;                                /* Returncode */
    14969 +iStart = 1;                             /* Subdirectory Index */
    14970 +do while (iStart <= length(sDirs))
    14971 +    iEnd = pos(' ', sDirs, iStart);
    14972 +    if (iEnd <= 0 & iStart <= length(sDirs)) then
    14973 +        iEnd = length(sDirs) + 1;
    14974 +
    14975 +    if (iEnd > 0) then
    14976 +    do
    14977 +        /*
    14978 +         * Copy out the directory from sDirs. Iterate if empty name.
    14979 +         * Move iStart forward to the next directory i sDirs.
    14980 +         * Try change directory. Complain and fail if this failes.
    14981 +         * Execute command.
    14982 +         * Check return code. Complain and fail if this failes.
    14983 +         */
    14984 +        sDir = substr(sDirs, iStart, iEnd - iStart);
    14985 +        iStart = iEnd + 1;
    14986 +        if (sDir = ' ' | sDir = '') then/* If empty directory name iterate. */
    14987 +            iterate;
    14988 +        if (directory(sDir) <> '') then
    14989 +        do
    14990 +            say sClrMak||'['||sPass||'Entering  Directory:' directory()||']'||sClrRst;
    14991 +            sCommand
    14992 +            if (rc <> 0) then
    14993 +            do
    14994 +                say sClrErr||'['||sPass||'Failed rc='rc' directory:' directory()||']'||sClrRst;
    14995 +                exit(rc);
    14996 +            end
    14997 +            say sClrMak||'['||sPass||'Leaving   Directory:' directory()||']'||sClrRst;
    14998 +        end
    14999 +        else
    15000 +        do
    15001 +            say sClrErr||'['||sPass||'Failed to change directory to' sDir||']'||sClrRst;
    15002 +            exit(267);                  /* ERROR_DIRECTORY */
    15003 +        end
    15004 +        call directory sCurrentDir;     /* Restore start directory. */
    15005 +    end
    15006 +    else
    15007 +        leave;                          /* No more directories left. */
    15008 +end
    15009 +
    15010 +
    15011 +/*
    15012 + * Return successfully.
    15013 + */
    15014 +exit(0);
    15015 +
    15016 +
    15017 +/**
    15018 + * Get environment variable value.
    15019 + * @returns Environment variable value if set.
    15020 + *          '' if not set.
    15021 + * @param   sVar    Variable name.
    15022 + */
    15023 +getenv: procedure
    15024 +parse arg sVar
    15025 +return value(sVar,,'OS2ENVIRONMENT');
    15026 +
    15027 +/**
    15028 + * No value handler
    15029 + */
    15030 +NoValueHandler:
    15031 +    say 'NoValueHandler: line 'SIGL;
    15032 +return 0;
    15033 +
    15034 diff --git a/tools/bin/DoMakes.cmd b/tools/bin/DoMakes.cmd
    15035 index 147e32e..9b42fc0 100644
    15036 --- a/tools/bin/DoMakes.cmd
    15037 +++ b/tools/bin/DoMakes.cmd
    15038 @@ -1,101 +1,101 @@
    15039 -/* $Id: DoMakes.cmd,v 1.4 2002-08-29 11:49:36 bird Exp $
    15040 - *
    15041 - * Rexx script which executes a given command with each of
    15042 - * the spesified makefiles using the option -f.
    15043 - *
    15044 - * Syntax: DoMakes.cmd "<sMakefiles>" <sCommand>
    15045 - *
    15046 - * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    15047 - *
    15048 - * Project Odin Software License can be found in LICENSE.TXT
    15049 - */
    15050 -signal on novalue name NoValueHandler
    15051 -Address CMD '@echo off'
    15052 -
    15053 -parse arg '"'sMakefiles'" 'sCommand
    15054 -
    15055 -/*
    15056 - * Color config.
    15057 - */
    15058 -if ((getenv('BUILD_NOCOLORS') = '') & (getenv('SLKRUNS') = '')) then
    15059 -do
    15060 -    sClrMak = '[35;1m'
    15061 -    sClrErr = '[31;1m'
    15062 -    sClrRst = '[0m'
    15063 -end
    15064 -else
    15065 -do
    15066 -    sClrMak = ''
    15067 -    sClrErr = ''
    15068 -    sClrRst = ''
    15069 -end
    15070 -
    15071 -
    15072 -/*
    15073 - * Build Pass
    15074 - */
    15075 -sPass = getenv('_BUILD_PASS');
    15076 -if (sPass <> '') then
    15077 -    sPass = 'Pass '||sPass||' - '
    15078 -
    15079 -
    15080 -/*
    15081 - * Loop thru each directory.
    15082 - * The directories are space separated.
    15083 - */
    15084 -iRc = 0;                                /* Returncode */
    15085 -iStart = 1;                             /* Subdirectory Index */
    15086 -do while (iStart <= length(sMakefiles))
    15087 -    iEnd = pos(' ', sMakefiles, iStart);
    15088 -    if (iEnd <= 0 & iStart <= length(sMakefiles)) then
    15089 -        iEnd = length(sMakefiles) + 1;
    15090 -
    15091 -    if (iEnd > 0) then
    15092 -    do
    15093 -        /*
    15094 -         * Copy out the makefile from sMakefiles. Iterate if empty name.
    15095 -         * Move iStart forward to the next directory i sMakefiles.
    15096 -         * Execute command with makefile as -f argument.
    15097 -         * Check return code. Complain and fail if this failes.
    15098 -         */
    15099 -        sMakefile = substr(sMakefiles, iStart, iEnd - iStart);
    15100 -        iStart = iEnd + 1;
    15101 -        if (sMakefile = ' ' | sMakefile = '') then/* If empty directory name iterate. */
    15102 -            iterate;
    15103 -        say sClrMak||'['||sPass||'Processing Makefile:' sMakefile||']'||sClrRst;
    15104 -        sCommand '-f' sMakefile
    15105 -        if (rc <> 0) then
    15106 -        do
    15107 -            say sClrErr||'['||sPass||'Failed rc='rc' makefile:' sMakefile||']'||sClrRst;
    15108 -            exit(rc);
    15109 -        end
    15110 -        say sClrMak||'['||sPass||'Completed  Makefile:' sMakefile||']'||sClrRst;
    15111 -    end
    15112 -    else
    15113 -        leave;                          /* No more directories left. */
    15114 -end
    15115 -
    15116 -
    15117 -/*
    15118 - * Return successfully.
    15119 - */
    15120 -exit(0);
    15121 -
    15122 -
    15123 -/**
    15124 - * Get environment variable value.
    15125 - * @returns Environment variable value if set.
    15126 - *          '' if not set.
    15127 - * @param   sVar    Variable name.
    15128 - */
    15129 -getenv: procedure
    15130 -parse arg sVar
    15131 -return value(sVar,,'OS2ENVIRONMENT');
    15132 -
    15133 -/**
    15134 - * No value handler
    15135 - */
    15136 -NoValueHandler:
    15137 -    say 'NoValueHandler: line 'SIGL;
    15138 -return 0;
    15139 -
    15140 +/* $Id: DoMakes.cmd,v 1.4 2002-08-29 11:49:36 bird Exp $
    15141 + *
    15142 + * Rexx script which executes a given command with each of
    15143 + * the spesified makefiles using the option -f.
    15144 + *
    15145 + * Syntax: DoMakes.cmd "<sMakefiles>" <sCommand>
    15146 + *
    15147 + * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    15148 + *
    15149 + * Project Odin Software License can be found in LICENSE.TXT
    15150 + */
    15151 +signal on novalue name NoValueHandler
    15152 +Address CMD '@echo off'
    15153 +
    15154 +parse arg '"'sMakefiles'" 'sCommand
    15155 +
    15156 +/*
    15157 + * Color config.
    15158 + */
    15159 +if ((getenv('BUILD_NOCOLORS') = '') & (getenv('SLKRUNS') = '')) then
    15160 +do
    15161 +    sClrMak = '[35;1m'
    15162 +    sClrErr = '[31;1m'
    15163 +    sClrRst = '[0m'
    15164 +end
    15165 +else
    15166 +do
    15167 +    sClrMak = ''
    15168 +    sClrErr = ''
    15169 +    sClrRst = ''
    15170 +end
    15171 +
    15172 +
    15173 +/*
    15174 + * Build Pass
    15175 + */
    15176 +sPass = getenv('_BUILD_PASS');
    15177 +if (sPass <> '') then
    15178 +    sPass = 'Pass '||sPass||' - '
    15179 +
    15180 +
    15181 +/*
    15182 + * Loop thru each directory.
    15183 + * The directories are space separated.
    15184 + */
    15185 +iRc = 0;                                /* Returncode */
    15186 +iStart = 1;                             /* Subdirectory Index */
    15187 +do while (iStart <= length(sMakefiles))
    15188 +    iEnd = pos(' ', sMakefiles, iStart);
    15189 +    if (iEnd <= 0 & iStart <= length(sMakefiles)) then
    15190 +        iEnd = length(sMakefiles) + 1;
    15191 +
    15192 +    if (iEnd > 0) then
    15193 +    do
    15194 +        /*
    15195 +         * Copy out the makefile from sMakefiles. Iterate if empty name.
    15196 +         * Move iStart forward to the next directory i sMakefiles.
    15197 +         * Execute command with makefile as -f argument.
    15198 +         * Check return code. Complain and fail if this failes.
    15199 +         */
    15200 +        sMakefile = substr(sMakefiles, iStart, iEnd - iStart);
    15201 +        iStart = iEnd + 1;
    15202 +        if (sMakefile = ' ' | sMakefile = '') then/* If empty directory name iterate. */
    15203 +            iterate;
    15204 +        say sClrMak||'['||sPass||'Processing Makefile:' sMakefile||']'||sClrRst;
    15205 +        sCommand '-f' sMakefile
    15206 +        if (rc <> 0) then
    15207 +        do
    15208 +            say sClrErr||'['||sPass||'Failed rc='rc' makefile:' sMakefile||']'||sClrRst;
    15209 +            exit(rc);
    15210 +        end
    15211 +        say sClrMak||'['||sPass||'Completed  Makefile:' sMakefile||']'||sClrRst;
    15212 +    end
    15213 +    else
    15214 +        leave;                          /* No more directories left. */
    15215 +end
    15216 +
    15217 +
    15218 +/*
    15219 + * Return successfully.
    15220 + */
    15221 +exit(0);
    15222 +
    15223 +
    15224 +/**
    15225 + * Get environment variable value.
    15226 + * @returns Environment variable value if set.
    15227 + *          '' if not set.
    15228 + * @param   sVar    Variable name.
    15229 + */
    15230 +getenv: procedure
    15231 +parse arg sVar
    15232 +return value(sVar,,'OS2ENVIRONMENT');
    15233 +
    15234 +/**
    15235 + * No value handler
    15236 + */
    15237 +NoValueHandler:
    15238 +    say 'NoValueHandler: line 'SIGL;
    15239 +return 0;
    15240 +
    15241 diff --git a/tools/bin/DoWithDirs.cmd b/tools/bin/DoWithDirs.cmd
    15242 index 4f717f1..368c6b0 100644
    15243 --- a/tools/bin/DoWithDirs.cmd
    15244 +++ b/tools/bin/DoWithDirs.cmd
    15245 @@ -1,300 +1,300 @@
    15246 -/* $Id: DoWithDirs.cmd,v 1.15 2002-08-29 11:49:37 bird Exp $
    15247 - *
    15248 - * Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l] [-r] <cmd with args...>
    15249 - *    -e      Exclude directories.
    15250 - *    <list of excludes> is a INCLUDE-path styled list of directories.
    15251 - *    -c      CD into the directory and execute the command.
    15252 - *            Default action is to pass the directory name as last argument.
    15253 - *    -i      Ignore command failure (rc=0)
    15254 - *    -r      Process diretories in reverse order.
    15255 - *    -l<tag> Lock directories for other dowithdirs.cmd processes. (-c required!)
    15256 - *            Processing stops (rc=0) on the first locked directory.
    15257 - *            <tag> is a name of the lock.
    15258 - *    -s      Skip locked directories in stead of stopping.
    15259 - *
    15260 - * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    15261 - */
    15262 -signal on novalue name NoValueHandler
    15263 -Address CMD '@echo off'
    15264 -
    15265 -if (RxFuncQuery('SysLoadFuncs') = 1) then
    15266 -do
    15267 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
    15268 -    call SysLoadFuncs
    15269 -end
    15270 -
    15271 -
    15272 -/*
    15273 - * Color config.
    15274 - */
    15275 -if ((getenv('BUILD_NOCOLORS') = '') & (getenv('SLKRUNS') = '')) then
    15276 -do
    15277 -    sClrMak = '[35;1m'
    15278 -    sClrErr = '[31;1m'
    15279 -    sClrRst = '[0m'
    15280 -end
    15281 -else
    15282 -do
    15283 -    sClrMak = ''
    15284 -    sClrErr = ''
    15285 -    sClrRst = ''
    15286 -end
    15287 -
    15288 -
    15289 -/*
    15290 - * Build Pass
    15291 - */
    15292 -sPass = getenv('_BUILD_PASS');
    15293 -if (sPass <> '') then
    15294 -    sPass = 'Pass '||sPass||' - '
    15295 -
    15296 -
    15297 -/* init options */
    15298 -fIgnoreFailure = 0;
    15299 -asIgnore.0 = 0;
    15300 -fCD = 0;
    15301 -fLocking = 0;
    15302 -fDontStop = 0;
    15303 -fReverse = 0;
    15304 -fExitOnLock = 1;
    15305 -sLockTag = '';
    15306 -
    15307 -/* parse arguments */
    15308 -parse arg sArg.1 sArg.2 sArg.3 sArg.4 sArg.5 sArg.6 sArg.7 sArg.8 sArg.9
    15309 -sArg.0 = 9;
    15310 -do i = 1 to sArg.0
    15311 -    if (sArg.i <> '') then
    15312 -    do
    15313 -        if (substr(sArg.i, 1, 1) = '-') then
    15314 -        do
    15315 -            ch = translate(substr(sArg.i, 2, 1));
    15316 -            select
    15317 -                when ch = 'E' then
    15318 -                do
    15319 -                    sLeft = substr(sArg.i, 3);
    15320 -                    do while (sLeft <> '' & sLeft <> ';')
    15321 -                        j = asIgnore.0 + 1;
    15322 -                        iPos = pos(';', sLeft);
    15323 -                        if (iPos < 1) then do
    15324 -                            asIgnore.j = sLeft;
    15325 -                            sLeft = '';
    15326 -                            asIgnore.0 = j;
    15327 -                        end
    15328 -                        else do
    15329 -                            asIgnore.j = substr(sLeft, 1, iPos - 1);
    15330 -                            sLeft = substr(sLeft, iPos + 1);
    15331 -                            asIgnore.0 = j;
    15332 -                        end
    15333 -                    end
    15334 -                    /*
    15335 -                    do j = 1 to asIgnore.0
    15336 -                        say 'dbg:' asIgnore.j;
    15337 -                    end
    15338 -                    */
    15339 -                end
    15340 -
    15341 -                when ch = 'C' then
    15342 -                do
    15343 -                    fCD = 1;
    15344 -                end
    15345 -
    15346 -                when ch = 'I' then
    15347 -                do
    15348 -                    fIgnoreFailure = 1;
    15349 -                end
    15350 -
    15351 -                when ch = 'R' then
    15352 -                do
    15353 -                    fReverse = 1;
    15354 -                end
    15355 -
    15356 -                when ch = 'L' then
    15357 -                do
    15358 -                    fLocking = 1;
    15359 -                    sLockTag = substr(sArg.i, 3);
    15360 -                end
    15361 -
    15362 -                when ch = 'S' then
    15363 -                do
    15364 -                    fExitOnLock = 0;
    15365 -                end
    15366 -
    15367 -                otherwise
    15368 -                    say 'unknown argument:' sArg.i;
    15369 -                    call syntax;
    15370 -            end
    15371 -        end
    15372 -        else
    15373 -        do  /* the rest of the args is part of the cmd */
    15374 -            sCmds = '';
    15375 -            do j = i to sArg.0;
    15376 -                if (sArg.j <> '') then
    15377 -                sCmds = sCmds || ' ' || sArg.j;
    15378 -            end
    15379 -            i = sArg.0;
    15380 -        end
    15381 -    end
    15382 -    else
    15383 -    do
    15384 -        say 'missing cmd.';
    15385 -        call syntax;
    15386 -    end
    15387 -end
    15388 -
    15389 -/* sanity check */
    15390 -if (fLocking & \fCD) then
    15391 -do
    15392 -    say '-l (Locking) requires -cd to be specified!';
    15393 -    call syntax;
    15394 -end
    15395 -
    15396 -/* process directories */
    15397 -rc = SysFileTree('*.', 'asDirs', 'DO');
    15398 -if rc <> 0 then do
    15399 -    say sClrErr||'SysFileTree failed rc='rc||sClrRst;
    15400 -    exit(rc);
    15401 -end
    15402 -
    15403 -sArgDirs = ' ';
    15404 -do ii = 1 to asDirs.0
    15405 -    /* calculate index */
    15406 -    if (fReverse) then
    15407 -        i = asDirs.0 - ii + 1;
    15408 -    else
    15409 -        i = ii;
    15410 -
    15411 -    /* ignore the directory? */
    15412 -    fFound = 0;
    15413 -    do j = 1 to asIgnore.0
    15414 -        if translate(asIgnore.j) = translate(filespec('name', asDirs.i)) then
    15415 -        do
    15416 -            fFound = 1;
    15417 -            leave;
    15418 -        end
    15419 -    end
    15420 -
    15421 -    if \fFound then
    15422 -    do
    15423 -        /* switch execution type. */
    15424 -        if (fCD) then
    15425 -        do
    15426 -            /* exectute the command in the directory */
    15427 -            say sClrMak||'['||sPass||'Entering Directory: '||asDirs.i']'||sClrRst;
    15428 -            /* save old dir and enter the new dir. */
    15429 -            sOldDir = directory();
    15430 -            call directory asDirs.i;
    15431 -
    15432 -            /* Lock the directory? */
    15433 -            fOK = 1;
    15434 -            if (fLocking) then
    15435 -                if (\lockdir(sLockTag)) then
    15436 -                do
    15437 -                    if (fExitOnLock) then
    15438 -                    do
    15439 -                        /* restore old directory and return sucessfully */
    15440 -                        call directory sOldDir;
    15441 -                        say sClrMak||'['||sPass||'!Lock found, stops processing.'||']'||sClrRst;
    15442 -                        exit(0);
    15443 -                    end
    15444 -                    say sClrMak||'['||sPass||'!Skipping '||asDirs.i||' - Directory was locked.'||']'||sClrRst;
    15445 -                    fOK = 0;
    15446 -                end
    15447 -
    15448 -            /* continue only if locking was successful. */
    15449 -            if (fOK) then
    15450 -            do
    15451 -                /* execute command */
    15452 -                'call' sCmds;
    15453 -                ret = rc;
    15454 -
    15455 -                /* unlock directory */
    15456 -                if (fLocking & fOk) then
    15457 -                    call unlockdir sLockTag;
    15458 -
    15459 -                /* check for return? */
    15460 -                if (ret <> 0) then
    15461 -                do
    15462 -                    /* complain and fail if errors aren't ignored. */
    15463 -                    if (\fIgnoreFailure) then
    15464 -                    do
    15465 -                        say sClrErr||'['||sPass||'rc = 'ret' '||asDirs.i||']'||sClrErr;
    15466 -                        exit(rc);
    15467 -                    end
    15468 -                    say sClrMak||'['||sPass||'rc = 'ret' '||asDirs.i||']'||sClrRst;
    15469 -                end
    15470 -            end
    15471 -
    15472 -            /* restore old directory */
    15473 -            say sClrMak||'['||sPass||'Leaving  Directory:' directory()||']'||sClrRst;
    15474 -            call directory sOldDir;
    15475 -        end
    15476 -        else
    15477 -        do
    15478 -            /* execute the command with the directory as the last parameter */
    15479 -            'call' sCmds filespec('name', asDirs.i);
    15480 -            if (rc <> 0) then
    15481 -            do
    15482 -                say sClrErr||'['||sPass||'rc = '||rc||']'||sClrRst;
    15483 -                if (\fIgnoreFailure) then
    15484 -                    exit(rc);
    15485 -            end
    15486 -        end
    15487 -    end /* loop */
    15488 -end
    15489 -
    15490 -exit(rc);
    15491 -
    15492 -
    15493 -syntax:
    15494 -    say 'Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l<tag>] [-r] <cmd with args...>';
    15495 -    say '   -e      Exclude directories.';
    15496 -    say '   <list of excludes> is a INCLUDE-path styled list of directories.';
    15497 -    say '   -c      CD into the directory and execute the command.';
    15498 -    say '           Default action is to pass the directory name as last argument.';
    15499 -    say '   -i      Ignore command failure (rc=0)';
    15500 -    say '   -r      Process diretories in reverse order.';
    15501 -    say '   -l<tag> Lock directories for other dowithdirs.cmd processes. (-c required!)';
    15502 -    say '           Processing stops (rc=0) on the first locked directory.';
    15503 -    say '           <tag> is a name of the lock.';
    15504 -    say '   -s      Skip locked directories in stead of stopping.'
    15505 -    exit(-1)
    15506 -
    15507 -
    15508 -/*
    15509 - * Locks the directory by creating a .dirlocked file in the directory.
    15510 - * Returns  1 on success
    15511 - *          0 on error
    15512 - */
    15513 -lockdir: procedure
    15514 -    parse arg sTag
    15515 -    rc = stream('.dirlocked' || sTag, 'c', 'open write');
    15516 -    return substr(rc, 1, 5) = 'READY';
    15517 -
    15518 -
    15519 -/*
    15520 - * Unlocks thedirectory by deleting the .dirlocked file.
    15521 - */
    15522 -unlockdir: procedure
    15523 -    parse arg sTag
    15524 -    rc = stream('.dirlocked' || sTag, 'c', 'close');
    15525 -    call SysFileDelete '.dirlocked' || sTag;
    15526 -    return 0;
    15527 -
    15528 -
    15529 -/**
    15530 - * Get environment variable value.
    15531 - * @returns Environment variable value if set.
    15532 - *          '' if not set.
    15533 - * @param   sVar    Variable name.
    15534 - */
    15535 -getenv: procedure
    15536 -parse arg sVar
    15537 -return value(sVar,,'OS2ENVIRONMENT');
    15538 -
    15539 -/**
    15540 - * No value handler
    15541 - */
    15542 -NoValueHandler:
    15543 -    say 'NoValueHandler: line 'SIGL;
    15544 -return 0;
    15545 -
    15546 +/* $Id: DoWithDirs.cmd,v 1.15 2002-08-29 11:49:37 bird Exp $
    15547 + *
    15548 + * Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l] [-r] <cmd with args...>
    15549 + *    -e      Exclude directories.
    15550 + *    <list of excludes> is a INCLUDE-path styled list of directories.
    15551 + *    -c      CD into the directory and execute the command.
    15552 + *            Default action is to pass the directory name as last argument.
    15553 + *    -i      Ignore command failure (rc=0)
    15554 + *    -r      Process diretories in reverse order.
    15555 + *    -l<tag> Lock directories for other dowithdirs.cmd processes. (-c required!)
    15556 + *            Processing stops (rc=0) on the first locked directory.
    15557 + *            <tag> is a name of the lock.
    15558 + *    -s      Skip locked directories in stead of stopping.
    15559 + *
    15560 + * Copyright (c) 1999-2002 knut st. osmundsen (bird@anduin.net)
    15561 + */
    15562 +signal on novalue name NoValueHandler
    15563 +Address CMD '@echo off'
    15564 +
    15565 +if (RxFuncQuery('SysLoadFuncs') = 1) then
    15566 +do
    15567 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
    15568 +    call SysLoadFuncs
    15569 +end
    15570 +
    15571 +
    15572 +/*
    15573 + * Color config.
    15574 + */
    15575 +if ((getenv('BUILD_NOCOLORS') = '') & (getenv('SLKRUNS') = '')) then
    15576 +do
    15577 +    sClrMak = '[35;1m'
    15578 +    sClrErr = '[31;1m'
    15579 +    sClrRst = '[0m'
    15580 +end
    15581 +else
    15582 +do
    15583 +    sClrMak = ''
    15584 +    sClrErr = ''
    15585 +    sClrRst = ''
    15586 +end
    15587 +
    15588 +
    15589 +/*
    15590 + * Build Pass
    15591 + */
    15592 +sPass = getenv('_BUILD_PASS');
    15593 +if (sPass <> '') then
    15594 +    sPass = 'Pass '||sPass||' - '
    15595 +
    15596 +
    15597 +/* init options */
    15598 +fIgnoreFailure = 0;
    15599 +asIgnore.0 = 0;
    15600 +fCD = 0;
    15601 +fLocking = 0;
    15602 +fDontStop = 0;
    15603 +fReverse = 0;
    15604 +fExitOnLock = 1;
    15605 +sLockTag = '';
    15606 +
    15607 +/* parse arguments */
    15608 +parse arg sArg.1 sArg.2 sArg.3 sArg.4 sArg.5 sArg.6 sArg.7 sArg.8 sArg.9
    15609 +sArg.0 = 9;
    15610 +do i = 1 to sArg.0
    15611 +    if (sArg.i <> '') then
    15612 +    do
    15613 +        if (substr(sArg.i, 1, 1) = '-') then
    15614 +        do
    15615 +            ch = translate(substr(sArg.i, 2, 1));
    15616 +            select
    15617 +                when ch = 'E' then
    15618 +                do
    15619 +                    sLeft = substr(sArg.i, 3);
    15620 +                    do while (sLeft <> '' & sLeft <> ';')
    15621 +                        j = asIgnore.0 + 1;
    15622 +                        iPos = pos(';', sLeft);
    15623 +                        if (iPos < 1) then do
    15624 +                            asIgnore.j = sLeft;
    15625 +                            sLeft = '';
    15626 +                            asIgnore.0 = j;
    15627 +                        end
    15628 +                        else do
    15629 +                            asIgnore.j = substr(sLeft, 1, iPos - 1);
    15630 +                            sLeft = substr(sLeft, iPos + 1);
    15631 +                            asIgnore.0 = j;
    15632 +                        end
    15633 +                    end
    15634 +                    /*
    15635 +                    do j = 1 to asIgnore.0
    15636 +                        say 'dbg:' asIgnore.j;
    15637 +                    end
    15638 +                    */
    15639 +                end
    15640 +
    15641 +                when ch = 'C' then
    15642 +                do
    15643 +                    fCD = 1;
    15644 +                end
    15645 +
    15646 +                when ch = 'I' then
    15647 +                do
    15648 +                    fIgnoreFailure = 1;
    15649 +                end
    15650 +
    15651 +                when ch = 'R' then
    15652 +                do
    15653 +                    fReverse = 1;
    15654 +                end
    15655 +
    15656 +                when ch = 'L' then
    15657 +                do
    15658 +                    fLocking = 1;
    15659 +                    sLockTag = substr(sArg.i, 3);
    15660 +                end
    15661 +
    15662 +                when ch = 'S' then
    15663 +                do
    15664 +                    fExitOnLock = 0;
    15665 +                end
    15666 +
    15667 +                otherwise
    15668 +                    say 'unknown argument:' sArg.i;
    15669 +                    call syntax;
    15670 +            end
    15671 +        end
    15672 +        else
    15673 +        do  /* the rest of the args is part of the cmd */
    15674 +            sCmds = '';
    15675 +            do j = i to sArg.0;
    15676 +                if (sArg.j <> '') then
    15677 +                sCmds = sCmds || ' ' || sArg.j;
    15678 +            end
    15679 +            i = sArg.0;
    15680 +        end
    15681 +    end
    15682 +    else
    15683 +    do
    15684 +        say 'missing cmd.';
    15685 +        call syntax;
    15686 +    end
    15687 +end
    15688 +
    15689 +/* sanity check */
    15690 +if (fLocking & \fCD) then
    15691 +do
    15692 +    say '-l (Locking) requires -cd to be specified!';
    15693 +    call syntax;
    15694 +end
    15695 +
    15696 +/* process directories */
    15697 +rc = SysFileTree('*.', 'asDirs', 'DO');
    15698 +if rc <> 0 then do
    15699 +    say sClrErr||'SysFileTree failed rc='rc||sClrRst;
    15700 +    exit(rc);
    15701 +end
    15702 +
    15703 +sArgDirs = ' ';
    15704 +do ii = 1 to asDirs.0
    15705 +    /* calculate index */
    15706 +    if (fReverse) then
    15707 +        i = asDirs.0 - ii + 1;
    15708 +    else
    15709 +        i = ii;
    15710 +
    15711 +    /* ignore the directory? */
    15712 +    fFound = 0;
    15713 +    do j = 1 to asIgnore.0
    15714 +        if translate(asIgnore.j) = translate(filespec('name', asDirs.i)) then
    15715 +        do
    15716 +            fFound = 1;
    15717 +            leave;
    15718 +        end
    15719 +    end
    15720 +
    15721 +    if \fFound then
    15722 +    do
    15723 +        /* switch execution type. */
    15724 +        if (fCD) then
    15725 +        do
    15726 +            /* exectute the command in the directory */
    15727 +            say sClrMak||'['||sPass||'Entering Directory: '||asDirs.i']'||sClrRst;
    15728 +            /* save old dir and enter the new dir. */
    15729 +            sOldDir = directory();
    15730 +            call directory asDirs.i;
    15731 +
    15732 +            /* Lock the directory? */
    15733 +            fOK = 1;
    15734 +            if (fLocking) then
    15735 +                if (\lockdir(sLockTag)) then
    15736 +                do
    15737 +                    if (fExitOnLock) then
    15738 +                    do
    15739 +                        /* restore old directory and return sucessfully */
    15740 +                        call directory sOldDir;
    15741 +                        say sClrMak||'['||sPass||'!Lock found, stops processing.'||']'||sClrRst;
    15742 +                        exit(0);
    15743 +                    end
    15744 +                    say sClrMak||'['||sPass||'!Skipping '||asDirs.i||' - Directory was locked.'||']'||sClrRst;
    15745 +                    fOK = 0;
    15746 +                end
    15747 +
    15748 +            /* continue only if locking was successful. */
    15749 +            if (fOK) then
    15750 +            do
    15751 +                /* execute command */
    15752 +                'call' sCmds;
    15753 +                ret = rc;
    15754 +
    15755 +                /* unlock directory */
    15756 +                if (fLocking & fOk) then
    15757 +                    call unlockdir sLockTag;
    15758 +
    15759 +                /* check for return? */
    15760 +                if (ret <> 0) then
    15761 +                do
    15762 +                    /* complain and fail if errors aren't ignored. */
    15763 +                    if (\fIgnoreFailure) then
    15764 +                    do
    15765 +                        say sClrErr||'['||sPass||'rc = 'ret' '||asDirs.i||']'||sClrErr;
    15766 +                        exit(rc);
    15767 +                    end
    15768 +                    say sClrMak||'['||sPass||'rc = 'ret' '||asDirs.i||']'||sClrRst;
    15769 +                end
    15770 +            end
    15771 +
    15772 +            /* restore old directory */
    15773 +            say sClrMak||'['||sPass||'Leaving  Directory:' directory()||']'||sClrRst;
    15774 +            call directory sOldDir;
    15775 +        end
    15776 +        else
    15777 +        do
    15778 +            /* execute the command with the directory as the last parameter */
    15779 +            'call' sCmds filespec('name', asDirs.i);
    15780 +            if (rc <> 0) then
    15781 +            do
    15782 +                say sClrErr||'['||sPass||'rc = '||rc||']'||sClrRst;
    15783 +                if (\fIgnoreFailure) then
    15784 +                    exit(rc);
    15785 +            end
    15786 +        end
    15787 +    end /* loop */
    15788 +end
    15789 +
    15790 +exit(rc);
    15791 +
    15792 +
    15793 +syntax:
    15794 +    say 'Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l<tag>] [-r] <cmd with args...>';
    15795 +    say '   -e      Exclude directories.';
    15796 +    say '   <list of excludes> is a INCLUDE-path styled list of directories.';
    15797 +    say '   -c      CD into the directory and execute the command.';
    15798 +    say '           Default action is to pass the directory name as last argument.';
    15799 +    say '   -i      Ignore command failure (rc=0)';
    15800 +    say '   -r      Process diretories in reverse order.';
    15801 +    say '   -l<tag> Lock directories for other dowithdirs.cmd processes. (-c required!)';
    15802 +    say '           Processing stops (rc=0) on the first locked directory.';
    15803 +    say '           <tag> is a name of the lock.';
    15804 +    say '   -s      Skip locked directories in stead of stopping.'
    15805 +    exit(-1)
    15806 +
    15807 +
    15808 +/*
    15809 + * Locks the directory by creating a .dirlocked file in the directory.
    15810 + * Returns  1 on success
    15811 + *          0 on error
    15812 + */
    15813 +lockdir: procedure
    15814 +    parse arg sTag
    15815 +    rc = stream('.dirlocked' || sTag, 'c', 'open write');
    15816 +    return substr(rc, 1, 5) = 'READY';
    15817 +
    15818 +
    15819 +/*
    15820 + * Unlocks thedirectory by deleting the .dirlocked file.
    15821 + */
    15822 +unlockdir: procedure
    15823 +    parse arg sTag
    15824 +    rc = stream('.dirlocked' || sTag, 'c', 'close');
    15825 +    call SysFileDelete '.dirlocked' || sTag;
    15826 +    return 0;
    15827 +
    15828 +
    15829 +/**
    15830 + * Get environment variable value.
    15831 + * @returns Environment variable value if set.
    15832 + *          '' if not set.
    15833 + * @param   sVar    Variable name.
    15834 + */
    15835 +getenv: procedure
    15836 +parse arg sVar
    15837 +return value(sVar,,'OS2ENVIRONMENT');
    15838 +
    15839 +/**
    15840 + * No value handler
    15841 + */
    15842 +NoValueHandler:
    15843 +    say 'NoValueHandler: line 'SIGL;
    15844 +return 0;
    15845 +
    15846 diff --git a/tools/bin/ExecExcl.cmd b/tools/bin/ExecExcl.cmd
    15847 index b493652..4f0c348 100644
    15848 --- a/tools/bin/ExecExcl.cmd
    15849 +++ b/tools/bin/ExecExcl.cmd
    15850 @@ -1,85 +1,85 @@
    15851 -/* $Id: ExecExcl.cmd,v 1.1 2000-11-20 03:49:59 bird Exp $
    15852 - *
    15853 - * Exclusive execute. Intented to fix ILINK problem.
    15854 - *
    15855 - * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    15856 - *
    15857 - * Project Odin Software License can be found in LICENSE.TXT
    15858 - *
    15859 - */
    15860 -
    15861 -parse arg sLockFile sCmd
    15862 -
    15863 -if (sCmd = '') then
    15864 -do
    15865 -    call syntax;
    15866 -    exit(1);
    15867 -end
    15868 -
    15869 -/*
    15870 - * Try get the lockfile.
    15871 - *      25 retries, with 3 seconds wait inbetween.
    15872 - */
    15873 -fLocked = 0;
    15874 -do i = 1 to 25
    15875 -    rc = stream(sLockFile, 'c', 'open write');
    15876 -    if (substr(rc, 1, 5) = 'READY') then do
    15877 -        fLocked = 1;
    15878 -        leave;
    15879 -    end
    15880 -    if (i = 1) then
    15881 -        call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep';
    15882 -    call SysSleep 3;                    /* Sleep for three seconds before retrying. */
    15883 -end
    15884 -if (\fLocked) then
    15885 -do
    15886 -    say 'Error: Failed to get hold of the lockfile "' ||sLockFile|| '"."';
    15887 -    exit(2);                            /* We exit here! */
    15888 -end
    15889 -
    15890 -
    15891 -/*
    15892 - * Execute the command and save the result.
    15893 - */
    15894 -sCmd
    15895 -retRc = rc;
    15896 -
    15897 -
    15898 -/*
    15899 - * Unlock the file and return saved result.
    15900 - */
    15901 -rc = stream(sLockFile, 'c', 'close');
    15902 -exit(retRc);
    15903 -
    15904 -
    15905 -
    15906 -
    15907 -/**
    15908 - * Display syntax.
    15909 - */
    15910 -syntax: procedure
    15911 -    say 'ExecExcl.cmd <lockfilename> <command with arguments>'
    15912 -    return;
    15913 -
    15914 -
    15915 -
    15916 -/*
    15917 - * Establishes the lock.
    15918 - * Returns  1 on success
    15919 - *          0 on error
    15920 - */
    15921 -lock: procedure
    15922 -    parse arg sTag
    15923 -    rc = stream('.dirlocked' || sTag, 'c', 'open write');
    15924 -    return substr(rc, 1, 5) = 'READY';
    15925 -
    15926 -
    15927 -/*
    15928 - * Releases the lock.
    15929 - */
    15930 -unlock: procedure
    15931 -    parse arg sTag
    15932 -    rc = stream('.dirlocked' || sTag, 'c', 'close');
    15933 -    call SysFileDelete '.dirlocked' || sTag;
    15934 -    return 0;
    15935 -
    15936 +/* $Id: ExecExcl.cmd,v 1.1 2000-11-20 03:49:59 bird Exp $
    15937 + *
    15938 + * Exclusive execute. Intented to fix ILINK problem.
    15939 + *
    15940 + * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    15941 + *
    15942 + * Project Odin Software License can be found in LICENSE.TXT
    15943 + *
    15944 + */
    15945 +
    15946 +parse arg sLockFile sCmd
    15947 +
    15948 +if (sCmd = '') then
    15949 +do
    15950 +    call syntax;
    15951 +    exit(1);
    15952 +end
    15953 +
    15954 +/*
    15955 + * Try get the lockfile.
    15956 + *      25 retries, with 3 seconds wait inbetween.
    15957 + */
    15958 +fLocked = 0;
    15959 +do i = 1 to 25
    15960 +    rc = stream(sLockFile, 'c', 'open write');
    15961 +    if (substr(rc, 1, 5) = 'READY') then do
    15962 +        fLocked = 1;
    15963 +        leave;
    15964 +    end
    15965 +    if (i = 1) then
    15966 +        call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep';
    15967 +    call SysSleep 3;                    /* Sleep for three seconds before retrying. */
    15968 +end
    15969 +if (\fLocked) then
    15970 +do
    15971 +    say 'Error: Failed to get hold of the lockfile "' ||sLockFile|| '"."';
    15972 +    exit(2);                            /* We exit here! */
    15973 +end
    15974 +
    15975 +
    15976 +/*
    15977 + * Execute the command and save the result.
    15978 + */
    15979 +sCmd
    15980 +retRc = rc;
    15981 +
    15982 +
    15983 +/*
    15984 + * Unlock the file and return saved result.
    15985 + */
    15986 +rc = stream(sLockFile, 'c', 'close');
    15987 +exit(retRc);
    15988 +
    15989 +
    15990 +
    15991 +
    15992 +/**
    15993 + * Display syntax.
    15994 + */
    15995 +syntax: procedure
    15996 +    say 'ExecExcl.cmd <lockfilename> <command with arguments>'
    15997 +    return;
    15998 +
    15999 +
    16000 +
    16001 +/*
    16002 + * Establishes the lock.
    16003 + * Returns  1 on success
    16004 + *          0 on error
    16005 + */
    16006 +lock: procedure
    16007 +    parse arg sTag
    16008 +    rc = stream('.dirlocked' || sTag, 'c', 'open write');
    16009 +    return substr(rc, 1, 5) = 'READY';
    16010 +
    16011 +
    16012 +/*
    16013 + * Releases the lock.
    16014 + */
    16015 +unlock: procedure
    16016 +    parse arg sTag
    16017 +    rc = stream('.dirlocked' || sTag, 'c', 'close');
    16018 +    call SysFileDelete '.dirlocked' || sTag;
    16019 +    return 0;
    16020 +
    16021 diff --git a/tools/bin/ExecTestcase.cmd b/tools/bin/ExecTestcase.cmd
    16022 index 7eabefb..17abf70 100644
    16023 --- a/tools/bin/ExecTestcase.cmd
    16024 +++ b/tools/bin/ExecTestcase.cmd
    16025 @@ -1,62 +1,62 @@
    16026 -/* $Id: ExecTestcase.cmd,v 1.2 2002-06-20 02:30:31 bird Exp $
    16027 - *
    16028 - * Executes a testcase writing result to the logfile.
    16029 - *
    16030 - * Note. The testcase succeeds if rc=0.
    16031 - *
    16032 - * The makefile is appended with the -f option to the commandline.
    16033 - */
    16034 -
    16035 -/*
    16036 - * Parse arguments.
    16037 - */
    16038 -parse arg sLogfile sMakefile '"'sDescription'"' sCmd
    16039 -sMakefile = strip(sMakefile);
    16040 -sLogFile = strip(sLogFile);
    16041 -sCmd = strip(sCmd);
    16042 -sDescription = strip(sDescription);
    16043 -if (sCmd = '' | sDescription = '') then
    16044 -do  /*usage*/
    16045 -    say 'syntax error!'
    16046 -    say 'syntax: ExecTestcase.cmd <logfile> <Makefile> "<Description>" <Command>'
    16047 -    exit(16);
    16048 -end
    16049 -
    16050 -
    16051 -/*
    16052 - * Color config.
    16053 - */
    16054 -if (  (value('BUILD_NOCOLOR',,'OS2ENVIRONMENT') = ''),
    16055 -    & (value('SLKRUNS',,'OS2ENVIRONMENT') = '')) then
    16056 -do
    16057 -    sClrMak = '[35;1m'
    16058 -    sClrErr = '[31;1m'
    16059 -    sClrRst = '[0m'
    16060 -end
    16061 -else
    16062 -do
    16063 -    sClrMak = ''
    16064 -    sClrErr = ''
    16065 -    sClrRst = ''
    16066 -end
    16067 -
    16068 -
    16069 -/*
    16070 - * Execute testcase and log the result.
    16071 - * Allways return 0.
    16072 - */
    16073 -say sClrMak'  ! Executing testcase 'sMakefile'/'sDescription'...'sClrRst
    16074 -Address CMD sCmd '-f' sMakefile
    16075 -rcCmd = rc;
    16076 -if (rcCmd = '0') then
    16077 -do
    16078 -    Address CMD '@echo Ok -' sMakefile'/'sDescription' >> 'sLogfile
    16079 -    say sClrMak'  ! Ok! ('sMakefile'/'sDescription')'sClrRst
    16080 -end
    16081 -else
    16082 -do
    16083 -    Address CMD '@echo Failed - 'sMakefile'/'sDescription' (rc='rcCmd') >> 'sLogfile
    16084 -    say sClrErr'  ! Failed! ('sMakefile'/'sDescription')'sClrRst
    16085 -end
    16086 -exit(0);
    16087 -
    16088 +/* $Id: ExecTestcase.cmd,v 1.2 2002-06-20 02:30:31 bird Exp $
    16089 + *
    16090 + * Executes a testcase writing result to the logfile.
    16091 + *
    16092 + * Note. The testcase succeeds if rc=0.
    16093 + *
    16094 + * The makefile is appended with the -f option to the commandline.
    16095 + */
    16096 +
    16097 +/*
    16098 + * Parse arguments.
    16099 + */
    16100 +parse arg sLogfile sMakefile '"'sDescription'"' sCmd
    16101 +sMakefile = strip(sMakefile);
    16102 +sLogFile = strip(sLogFile);
    16103 +sCmd = strip(sCmd);
    16104 +sDescription = strip(sDescription);
    16105 +if (sCmd = '' | sDescription = '') then
    16106 +do  /*usage*/
    16107 +    say 'syntax error!'
    16108 +    say 'syntax: ExecTestcase.cmd <logfile> <Makefile> "<Description>" <Command>'
    16109 +    exit(16);
    16110 +end
    16111 +
    16112 +
    16113 +/*
    16114 + * Color config.
    16115 + */
    16116 +if (  (value('BUILD_NOCOLOR',,'OS2ENVIRONMENT') = ''),
    16117 +    & (value('SLKRUNS',,'OS2ENVIRONMENT') = '')) then
    16118 +do
    16119 +    sClrMak = '[35;1m'
    16120 +    sClrErr = '[31;1m'
    16121 +    sClrRst = '[0m'
    16122 +end
    16123 +else
    16124 +do
    16125 +    sClrMak = ''
    16126 +    sClrErr = ''
    16127 +    sClrRst = ''
    16128 +end
    16129 +
    16130 +
    16131 +/*
    16132 + * Execute testcase and log the result.
    16133 + * Allways return 0.
    16134 + */
    16135 +say sClrMak'  ! Executing testcase 'sMakefile'/'sDescription'...'sClrRst
    16136 +Address CMD sCmd '-f' sMakefile
    16137 +rcCmd = rc;
    16138 +if (rcCmd = '0') then
    16139 +do
    16140 +    Address CMD '@echo Ok -' sMakefile'/'sDescription' >> 'sLogfile
    16141 +    say sClrMak'  ! Ok! ('sMakefile'/'sDescription')'sClrRst
    16142 +end
    16143 +else
    16144 +do
    16145 +    Address CMD '@echo Failed - 'sMakefile'/'sDescription' (rc='rcCmd') >> 'sLogfile
    16146 +    say sClrErr'  ! Failed! ('sMakefile'/'sDescription')'sClrRst
    16147 +end
    16148 +exit(0);
    16149 +
    16150 diff --git a/tools/bin/Exists.cmd b/tools/bin/Exists.cmd
    16151 index a73ee7d..c307b20 100644
    16152 --- a/tools/bin/Exists.cmd
    16153 +++ b/tools/bin/Exists.cmd
    16154 @@ -1,29 +1,29 @@
    16155 -/* $Id: Exists.cmd,v 1.3 2002-05-16 11:50:23 bird Exp $
    16156 - *
    16157 - * Simple rexx util which checks if a file or directory exists.
    16158 - *
    16159 - * Syntax: exists.cmd <filename>
    16160 - * Return code: 0 - file exists
    16161 - *              1 - file doesn't exist.
    16162 - *
    16163 - * Copyright (c) 2000-2002 knut st. osmundsen (bird@anduin.net)
    16164 - *
    16165 - * GPL
    16166 - *
    16167 - */
    16168 -    parse arg sFile
    16169 -
    16170 -    if (sFile = '.' | sFile = '..') then
    16171 -        exit(0);
    16172 -
    16173 -    if (stream(sFile, 'c', 'query exists') = '') then
    16174 -    do  /* directory ? */
    16175 -        if (RxFuncQuery('SysFileTree') = 1) then
    16176 -            call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree';
    16177 -        rc = SysFileTree(sFile, 'sDirs', 'DO');
    16178 -        if (rc = 0 & sDirs.0 = 1) then
    16179 -            exit(0);
    16180 -        exit(1);
    16181 -    end
    16182 -    exit(0);
    16183 -
    16184 +/* $Id: Exists.cmd,v 1.3 2002-05-16 11:50:23 bird Exp $
    16185 + *
    16186 + * Simple rexx util which checks if a file or directory exists.
    16187 + *
    16188 + * Syntax: exists.cmd <filename>
    16189 + * Return code: 0 - file exists
    16190 + *              1 - file doesn't exist.
    16191 + *
    16192 + * Copyright (c) 2000-2002 knut st. osmundsen (bird@anduin.net)
    16193 + *
    16194 + * GPL
    16195 + *
    16196 + */
    16197 +    parse arg sFile
    16198 +
    16199 +    if (sFile = '.' | sFile = '..') then
    16200 +        exit(0);
    16201 +
    16202 +    if (stream(sFile, 'c', 'query exists') = '') then
    16203 +    do  /* directory ? */
    16204 +        if (RxFuncQuery('SysFileTree') = 1) then
    16205 +            call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree';
    16206 +        rc = SysFileTree(sFile, 'sDirs', 'DO');
    16207 +        if (rc = 0 & sDirs.0 = 1) then
    16208 +            exit(0);
    16209 +        exit(1);
    16210 +    end
    16211 +    exit(0);
    16212 +
    16213 diff --git a/tools/bin/MakeBldLevelInfo.cmd b/tools/bin/MakeBldLevelInfo.cmd
    16214 index 2e60dc6..d5897da 100644
    16215 --- a/tools/bin/MakeBldLevelInfo.cmd
    16216 +++ b/tools/bin/MakeBldLevelInfo.cmd
    16217 @@ -1,566 +1,566 @@
    16218 -/* $Id: MakeBldLevelInfo.cmd,v 1.4 2001-01-26 21:34:28 phaller Exp $
    16219 - *
    16220 - * Adds a Description string to the given .def-file.
    16221 - * Fills in default values; like build time and host.
    16222 - *
    16223 - */
    16224 -
    16225 -if RxFuncQuery('SysLoadFuncs')=1 THEN
    16226 -DO
    16227 -  call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    16228 -  call SysLoadFuncs;
    16229 -END
    16230 
    16231 -/*
    16232 - * Set default parameter values.
    16233 - */
    16234 -sDefFileIn      = '';
    16235 -sDefFileOut     = '';
    16236 -sASDFeatureId   = '';
    16237 -sCountryCode    = '';
    16238 -sDateTime       = left(' 'date()' 'time(), 26);
    16239 -sDescription    = 'Odin32';
    16240 -sFixPakVer      = '';
    16241 -sHostname       = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11));
    16242 -sLanguageCode   = '';
    16243 -sMiniVer        = '';
    16244 -sVendor         = 'Project Odin';
    16245 -sVersion        = '0.5';
    16246 -
    16247 -
    16248 -/*
    16249 - * Parse parameters.
    16250 - */
    16251 -parse arg  sArgs
    16252 -if (sArgs = '') then
    16253 -do
    16254 -    call syntax;
    16255 -    exit(1);
    16256 -end
    16257 -
    16258 -do while (sArgs <> '')
    16259 -    sArgs = strip(sArgs);
    16260 -    if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then
    16261 -    do  /*
    16262 -         * Option.
    16263 -         */
    16264 -        ch = translate(substr(sArgs, 2, 1));
    16265 -        if (pos(ch, 'ACDHLMNPRTV') < 1) then
    16266 -        do
    16267 -            say 'invalid option:' substr(sArgs, 1, 2);
    16268 -            call syntax;
    16269 -            exit(2);
    16270 -        end
    16271 -
    16272 -        /* get value and advance sArgs to next or to end. */
    16273 -        if (substr(sArgs, 3, 1) = '"') then
    16274 -        do
    16275 -            iNext = pos('"', sArgs, 4);
    16276 -            fQuote = 1;
    16277 -        end
    16278 -        else
    16279 -        do
    16280 -            iNext = pos(' ', sArgs, 3);
    16281 -            if (iNext <= 0) then
    16282 -                iNext = length(sArgs);
    16283 -            fQuote = 0;
    16284 -        end
    16285 -
    16286 -        if (iNext > 3 | ch = 'R') then
    16287 -        do
    16288 -            sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote);
    16289 -            sArgs = strip(substr(sArgs, iNext+1));
    16290 -            /*say 'iNext:' iNext  'sValue:' sValue  'sArgs:' sArgs; */
    16291 -
    16292 -            /* check if we're gonna search for something in an file. */
    16293 -            if (sValue <> '' & pos('#define=', sValue) > 0) then
    16294 -                sValue = LookupDefine(sValue);
    16295 -        end
    16296 -        else
    16297 -        do
    16298 -            say 'syntax error near' substr(sArgs, 1, 2)'.';
    16299 -            call syntax;
    16300 -            exit(3);
    16301 -        end
    16302 -
    16303 -
    16304 -        /* set value */
    16305 -        select
    16306 -            when (ch = 'A') then /* ASD Feature Id */
    16307 -                sASDFeatureId   = sValue;
    16308 -
    16309 -            when (ch = 'C') then /* Country code */
    16310 -                sCountryCode    = sValue;
    16311 -
    16312 -            when (ch = 'D') then /* Description */
    16313 -                sDescription    = sValue;
    16314 -
    16315 -            when (ch = 'H') then /* Hostname */
    16316 -                sHostname       = sValue;
    16317 -
    16318 -            when (ch = 'L') then /* Language code */
    16319 -                sLanguageCode   = sValue;
    16320 -
    16321 -            when (ch = 'M') then /* MiniVer */
    16322 -                sMiniVer        = sValue;
    16323 -
    16324 -            when (ch = 'N') then /* Vendor */
    16325 -                sVendor         = sValue;
    16326 -
    16327 -            when (ch = 'R') then /* Vendor */
    16328 -                sDescription    = ReadDescription(sValue, sDefFile);
    16329 -
    16330 -            when (ch = 'P') then /* Fixpak version */
    16331 -                sFixPakVer      = sValue;
    16332 -
    16333 -            when (ch = 'T') then /* Date Time */
    16334 -                sDateTime       = sValue;
    16335 -
    16336 -            when (ch = 'V') then /* Version */
    16337 -                sVersion        = sValue;
    16338 -
    16339 -            /* Otherwise it's an illegal option */
    16340 -            otherwise:
    16341 -                say 'invalid option:' substr(sArgs, 1, 2);
    16342 -                call syntax;
    16343 -                exit(2);
    16344 -        end /* select */
    16345 -    end
    16346 -    else
    16347 -    do  /*
    16348 -         * Defition file...
    16349 -         */
    16350 -        if (sDefFileOut <> '') then
    16351 -        do
    16352 -            say 'Syntax error: Can''t specify more than two defintion files!';
    16353 -            exit(4);
    16354 -        end
    16355 -        if (sDefFileIn = '') then
    16356 -            parse value sArgs with sDefFileIn' 'sArgs
    16357 -        else
    16358 -            parse value sArgs with sDefFileOut' 'sArgs
    16359 -        sArgs = strip(sArgs);
    16360 -    end
    16361 -end
    16362 -
    16363 -
    16364 -/* check that a defintion file was specified. */
    16365 -if (sDefFileIn = '') then
    16366 -do
    16367 -    say 'Syntax error: Will have to specify a .def-file to update.';
    16368 -    call syntax;
    16369 -    exit(5);
    16370 -end
    16371 -
    16372 -
    16373 -/*
    16374 - * Trim strings to correct lengths.
    16375 - */
    16376 -sVendor         = strip(substr(sVendor, 1, 31));
    16377 -if (substr(sDateTime, 1, 1) <> ' ') then
    16378 -    sDateTime = ' ' || sDateTime;
    16379 -sDateTime       = left(sDateTime, 26);
    16380 -sHostname       = strip(substr(sHostname, 1, 11));
    16381 -sMiniVer        = strip(substr(sMiniVer, 1, 11));
    16382 -sDescription    = strip(substr(sDescription, 1, 80));
    16383 -sCountryCode    = strip(substr(sCountryCode, 1, 4));
    16384 -sLanguageCode   = strip(substr(sLanguageCode, 1, 4));
    16385 -sASDFeatureId   = strip(substr(sASDFeatureId, 1, 11));
    16386 -sFixPakVer      = strip(substr(sFixPakVer, 1, 11));
    16387 -
    16388 -
    16389 -/*
    16390 - * Signature
    16391 - */
    16392 -sEnhSign = '##1##'
    16393 -
    16394 -/*
    16395 - * Build description string.
    16396 - */
    16397 -sDescription =  '@#'sVendor':'sVersion'#@'sEnhSign||,
    16398 -                sDateTime||sHostname||,
    16399 -                ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||,
    16400 -                '::'sFixPakVer'@@'sDescription;
    16401 -
    16402 -/*
    16403 - * Update .def-file.
    16404 - */
    16405 -rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);
    16406 -exit(rc);
    16407 -
    16408 -
    16409 -/**
    16410 - * Display script syntax.
    16411 - */
    16412 -syntax: procedure
    16413 -    say 'Syntax: MakeDesc.cmd [options] <deffile in> <deffile out> [options]'
    16414 -    say '   <deffile>   Defitionfile which will have an DESCRIPTION appended.'
    16415 -    say 'Options:'
    16416 -    say '   -A<string>  ASD Feature Id.'
    16417 -    say '   -C<string>  Country code.'
    16418 -    say '   -D<string>  Description.'
    16419 -    say '   -R[deffile] Read description from .def file.'
    16420 -    say '   -H<string>  Hostname.'
    16421 -    say '   -L<string>  Language code.'
    16422 -    say '   -M<string>  MiniVer.'
    16423 -    say '   -N<string>  Vendor.'
    16424 -    say '   -P<string>  Fixpak version.'
    16425 -    say '   -T<string>  Date Time.'
    16426 -    say '   -V<string>  Version.'
    16427 -    say '<string> could be a double qoute qouted string or a single word.'
    16428 -    say '       You could also reference #defines in C/C++ include files.'
    16429 -    say '       The string should then have this form:'
    16430 -    say '           "#define=<DEFINE_NAME>,<includefile.h>"'
    16431 -    say '';
    16432 -
    16433 -    return;
    16434 -
    16435 -
    16436 -/**
    16437 - * Search for a #define in an C/C++ header or source file.
    16438 - *
    16439 - * @returns String containing the defined value
    16440 - *          found for the define in the header file.
    16441 - *          Quits on fatal errors.
    16442 - * @param   A string on the form: "#define=DEFINETOFIND,includefile.h"
    16443 - * @remark  Write only code... - let's hope it works.
    16444 - */
    16445 -LookupDefine: procedure
    16446 -    parse arg '#'sDefine'='sMacro','sIncludeFile
    16447 -
    16448 -    /*
    16449 -     * Validate parameters.
    16450 -     */
    16451 -    sMacro = strip(sMacro);
    16452 -    sIncludeFile = strip(sIncludeFile);
    16453 -    if (sMacro = '') then
    16454 -    do
    16455 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    16456 -        say '    <DEFINE_NAME> was empty.';
    16457 -        exit(-20);
    16458 -    end
    16459 -    if (sIncludeFile = '') then
    16460 -    do
    16461 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    16462 -        say '    <includefile.h> was empty.';
    16463 -        exit(-20);
    16464 -    end
    16465 -
    16466 -
    16467 -    sIllegal = translate(translate(sMacro),,
    16468 -                         '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',,
    16469 -                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_');
    16470 -
    16471 -    if (strip(translate(sIllegal, ' ', '!')) <> '') then
    16472 -    do
    16473 -        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    16474 -        say '    <DEFINE_NAME> contains illegal charater(s).'
    16475 -        say '        'sMacro;
    16476 -        say '        'translate(sIllegal, ' ', '!');
    16477 -        exit(-20);
    16478 -    end
    16479 -
    16480 -    /*
    16481 -     * Open include file.
    16482 -     */
    16483 -    sRc = stream(sIncludeFile, 'c', 'open read');
    16484 -    if (pos('READY', sRc) <> 1) then
    16485 -    do  /* search INCLUDE variable */
    16486 -        sFile = SysSearchPath('INCLUDE', sIncludeFile);
    16487 -        if (sFile = '') then
    16488 -        do
    16489 -            say 'Can''t find include file 'sIncludeFile'.';
    16490 -            exit(-20);
    16491 -        end
    16492 -        sIncludeFile = sFile;
    16493 -
    16494 -        sRc = stream(sIncludeFile, 'c', 'open read');
    16495 -        if (pos('READY', sRc) <> 1) then
    16496 -        do
    16497 -            say 'Failed to open include file' sIncludeFile'.';
    16498 -            exit(-20);
    16499 -        end
    16500 -    end
    16501 -
    16502 -    /*
    16503 -     * Search the file line by line.
    16504 -     *  We'll check for lines starting with a hash (#) char.
    16505 -     *  Then check that the word after the hash is 'define'.
    16506 -     *  Then match the next word with the macro name.
    16507 -     *  Then then get the next rest of the line to comment or continuation char.
    16508 -     *      (continuation is not supported)
    16509 -     *  Finally strip quotes.
    16510 -     */
    16511 -    sValue = '';
    16512 -    do while (lines(sIncludeFile) > 0)
    16513 -        sLine = strip(linein(sIncludeFile));
    16514 -        if (sLine = '') then
    16515 -            iterate;
    16516 -        if (substr(sLine, 1, 1) <> '#') then
    16517 -            iterate;
    16518 -        sLine = substr(sLine, 2);
    16519 -        if (word(sLine, 1) <> 'define') then
    16520 -            iterate;
    16521 -        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1));
    16522 -        if (  substr(sLine, 1, length(sMacro)) <> sMacro,
    16523 -            | substr(sLine, length(sMacro)+1, 1) <> ' ') then
    16524 -            iterate;
    16525 -        sLine = strip(substr(sLine, length(sMacro) + 1));
    16526 -        if (sLine = '') then
    16527 -        do
    16528 -            say 'error: #define' sMacro' is empty.';
    16529 -            call stream sIncludeFile, 'c', 'close';
    16530 -            exit(-20);
    16531 -        end
    16532 -
    16533 -        chQuote = substr(sLine, 1, 1);
    16534 -        if (chQuote = '"' | chQuote = "'") then
    16535 -        do  /* quoted string */
    16536 -            iLastQuote = 0;
    16537 -            do forever
    16538 -                iLast = pos(chQuote, sLine, 2);
    16539 -                if (iLast <= 0) then
    16540 -                    leave;
    16541 -                if (substr(sLine, iLast, 1) = '\') then
    16542 -                    iterate;
    16543 -                iLastQuote = iLast;
    16544 -                leave;
    16545 -            end
    16546 -
    16547 -            if (iLastQuote <= 0) then
    16548 -            do
    16549 -                say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.';
    16550 -                call stream sIncludeFile, 'c', 'close';
    16551 -                exit(-20);
    16552 -            end
    16553 -
    16554 -            call stream sIncludeFile, 'c', 'close';
    16555 -            sValue = substr(sLine, 2, iLastQuote - 2);
    16556 -            say 'Found 'sMacro'='sValue;
    16557 -            return sValue;
    16558 -        end
    16559 -        else
    16560 -        do
    16561 -            iCommentCPP = pos('//',sLine);
    16562 -            iCommentC   = pos('/*',sLine);
    16563 -            if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then
    16564 -                iComment = iCommentCPP;
    16565 -            else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then
    16566 -                iComment = iCommentC;
    16567 -            else if (iCommentCPP > 0) then
    16568 -                iComment = iCommentCPP;
    16569 -            else if (iCommentC > 0) then
    16570 -                iComment = iCommentC;
    16571 -            else
    16572 -                iComment = 0;
    16573 -
    16574 -            if (iComment > 0) then
    16575 -                sValue = strip(substr(sLine, 1, iComment-1));
    16576 -            else
    16577 -                sValue = strip(sLine);
    16578 -
    16579 -            if (sValue <> '') then
    16580 -            do
    16581 -                if (substr(sValue, length(sValue)) = '\') then
    16582 -                do
    16583 -                    say 'Found continuation char: Multiline definitions are not supported!\n';
    16584 -                    call stream sIncludeFile, 'c', 'close';
    16585 -                    exit(-20);
    16586 -                end
    16587 -            end
    16588 -
    16589 -            if (sValue = '') then
    16590 -                say 'warning: The #define has no value.';
    16591 -
    16592 -            call stream sIncludeFile, 'c', 'close';
    16593 -            say 'Found 'sMacro'='sValue;
    16594 -            return sValue;
    16595 -        end
    16596 -    end
    16597 -
    16598 -    call stream sIncludeFile, 'c', 'close';
    16599 -    say 'error: didn''t find #define' sMacro'.';
    16600 -    exit(-20);
    16601 -
    16602 -
    16603 -
    16604 -/**
    16605 - * Reads the description line for a .def-file.
    16606 - * @returns The Description string, with quotes removed.
    16607 - *          Empty string is acceptable.
    16608 - *          On error we'll terminate the script.
    16609 - * @param   sDefFile    Filaname of .def-file to read the description from.
    16610 - * @param   sDefFile2   Used if sDefFile is empty.
    16611 - * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    16612 - */
    16613 -ReadDescription: procedure;
    16614 -    parse arg sDefFile, sDefFile2
    16615 -
    16616 -    /*
    16617 -     * Validate parameters.
    16618 -     */
    16619 -    if (sDefFile = '') then
    16620 -        sDefFile = sDefFile2;
    16621 -    if (sDefFile = '') then
    16622 -    do
    16623 -        say 'error: no definition file to get description from.'
    16624 -        exit(-1);
    16625 -    end
    16626 -
    16627 -    /*
    16628 -     * Open file
    16629 -     */
    16630 -    rc = stream(sDefFile, 'c', 'open read');
    16631 -    if (pos('READY', rc) <> 1) then
    16632 -    do
    16633 -        say 'error: failed to open deffile file.';
    16634 -        exit(-1);
    16635 -    end
    16636 -
    16637 -
    16638 -    /*
    16639 -     * Search for the 'DESCRIPTION' line.
    16640 -     */
    16641 -    do while (lines(sDefFile) > 0)
    16642 -        sLine = strip(linein(sDefFile));
    16643 -        if (sLine = '') then
    16644 -            iterate;
    16645 -        if (translate(word(sLine, 1)) <> 'DESCRIPTION') then
    16646 -            iterate;
    16647 -        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1));
    16648 -
    16649 -        ch = substr(sLine, 1, 1);
    16650 -        if (ch <> "'" & ch <> '"') then
    16651 -        do
    16652 -            say 'syntax error: description line in' sDefFile 'is misformed.';
    16653 -            call stream sDefFile, 'c', 'close';
    16654 -            exit(-10);
    16655 -        end
    16656 -
    16657 -        iEnd = pos(ch, sLine, 2);
    16658 -        if (iEnd <= 0) then
    16659 -        do
    16660 -            say 'syntax error: description line in' sDefFile 'is misformed.';
    16661 -            call stream sDefFile, 'c', 'close';
    16662 -            exit(-10);
    16663 -        end
    16664 -
    16665 -        call stream sDefFile, 'c', 'close';
    16666 -        sValue = substr(sLine, 2, iEnd - 2);
    16667 -        say 'Found Description:' sValue;
    16668 -        return sValue;
    16669 -    end
    16670 -
    16671 -    call stream sDefFile, 'c', 'close';
    16672 -    say 'info: Didn''t find description line in' sDefFile'.';
    16673 -    return '';
    16674 -
    16675 -
    16676 -/**
    16677 - * This is a function which reads sDefFileIn into and
    16678 - * internal array and changes the DESCRIPTION text if found.
    16679 - * If DESCRIPTION isn't found, it is added at the end.
    16680 - * The array is written to sDefFileOut.
    16681 - * @returns 0 on succes.
    16682 - *          Errorcode on error.
    16683 - * @param   sDefFileIn      Input .def-file.
    16684 - * @param   sDefFileOut     Output .def-file. Overwritten.
    16685 - * @param   sDescription    New description string.
    16686 - * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    16687 - */
    16688 -UpdateDefFile: procedure;
    16689 -    parse arg sDefFileIn, sDefFileOut, sDescription
    16690 -
    16691 -    /*
    16692 -     * Validate parameters.
    16693 -     */
    16694 -    if (sDefFileOut = '') then
    16695 -        sDefFileOut = sDefFileIn;
    16696 -
    16697 -    /*
    16698 -     * Open file input file.
    16699 -     */
    16700 -    rc = stream(sDefFileIn, 'c', 'open read');
    16701 -    if (pos('READY', rc) <> 1) then
    16702 -    do
    16703 -        say 'error: failed to open' sDefFileIn 'file.';
    16704 -        return 110;
    16705 -    end
    16706 -
    16707 -
    16708 -    /*
    16709 -     * Search for the 'DESCRIPTION' line.
    16710 -     */
    16711 -    i = 0;
    16712 -    fDescription = 0;
    16713 -    do while (lines(sDefFileIn) > 0)
    16714 -        /*
    16715 -         * Read line.
    16716 -         */
    16717 -        i = i + 1;
    16718 -        asFile.i = strip(linein(sDefFileIn));
    16719 -
    16720 -        /*
    16721 -         * Look for DESCRIPTION;
    16722 -         */
    16723 -        if (asFile.i = '') then
    16724 -            iterate;
    16725 -        if (translate(word(asFile.i, 1)) <> 'DESCRIPTION') then
    16726 -            iterate;
    16727 -        if (fDescription) then
    16728 -        do
    16729 -            say 'warning: multiple descriptions lines. Line' i 'removed';
    16730 -            i = i - 1;
    16731 -            iterate;
    16732 -        end
    16733 -
    16734 -        /*
    16735 -         * Found description - replace with new description.
    16736 -         */
    16737 -        asFile.i = "DESCRIPTION '"||sDescription||"'";
    16738 -        fDescription = 1;
    16739 -    end
    16740 -
    16741 -    /*
    16742 -     * Add description is none was found.
    16743 -     */
    16744 -    if (\fDescription) then
    16745 -    do
    16746 -        i = i + 1;
    16747 -        asFile.i = "DESCRIPTION '"||sDescription||"'";
    16748 -    end
    16749 -    asFile.0 = i;
    16750 -
    16751 -
    16752 -    /*
    16753 -     * Close input file and open output file.
    16754 -     */
    16755 -    call stream sDefFileIn, 'c', 'close';
    16756 -    call SysFileDelete(sDefFileOut);
    16757 -    rc = stream(sDefFileOut, 'c', 'open write');
    16758 -    if (pos('READY', rc) <> 1) then
    16759 -    do
    16760 -        say 'error: failed to open outputfile' sDefFileOut 'file.';
    16761 -        return 110;
    16762 -    end
    16763 -
    16764 -    /*
    16765 -     * Make firstline and write all the lines to the output file.
    16766 -     */
    16767 -    call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;
    16768 -    do i = 1 to asFile.0
    16769 -        rc = lineout(sDefFileOut, asFile.i);
    16770 -        if (rc > 0) then
    16771 -        do
    16772 -            say 'error: failed to write line' i 'to' sDefFileOut'.'
    16773 -            call stream sDefFileOut, 'c', 'close';
    16774 -            return 5;
    16775 -        end
    16776 -    end
    16777 -
    16778 -    /*
    16779 -     * Close output file and return succesfully.
    16780 -     */
    16781 -    call stream sDefFileOut, 'c', 'close';
    16782 -    return 0;
    16783 -
    16784 +/* $Id: MakeBldLevelInfo.cmd,v 1.4 2001-01-26 21:34:28 phaller Exp $
    16785 + *
    16786 + * Adds a Description string to the given .def-file.
    16787 + * Fills in default values; like build time and host.
    16788 + *
    16789 + */
    16790 +
    16791 +if RxFuncQuery('SysLoadFuncs')=1 THEN
    16792 +DO
    16793 +  call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    16794 +  call SysLoadFuncs;
    16795 +END
    16796 
    16797 +/*
    16798 + * Set default parameter values.
    16799 + */
    16800 +sDefFileIn      = '';
    16801 +sDefFileOut     = '';
    16802 +sASDFeatureId   = '';
    16803 +sCountryCode    = '';
    16804 +sDateTime       = left(' 'date()' 'time(), 26);
    16805 +sDescription    = 'Odin32';
    16806 +sFixPakVer      = '';
    16807 +sHostname       = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11));
    16808 +sLanguageCode   = '';
    16809 +sMiniVer        = '';
    16810 +sVendor         = 'Project Odin';
    16811 +sVersion        = '0.5';
    16812 +
    16813 +
    16814 +/*
    16815 + * Parse parameters.
    16816 + */
    16817 +parse arg  sArgs
    16818 +if (sArgs = '') then
    16819 +do
    16820 +    call syntax;
    16821 +    exit(1);
    16822 +end
    16823 +
    16824 +do while (sArgs <> '')
    16825 +    sArgs = strip(sArgs);
    16826 +    if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then
    16827 +    do  /*
    16828 +         * Option.
    16829 +         */
    16830 +        ch = translate(substr(sArgs, 2, 1));
    16831 +        if (pos(ch, 'ACDHLMNPRTV') < 1) then
    16832 +        do
    16833 +            say 'invalid option:' substr(sArgs, 1, 2);
    16834 +            call syntax;
    16835 +            exit(2);
    16836 +        end
    16837 +
    16838 +        /* get value and advance sArgs to next or to end. */
    16839 +        if (substr(sArgs, 3, 1) = '"') then
    16840 +        do
    16841 +            iNext = pos('"', sArgs, 4);
    16842 +            fQuote = 1;
    16843 +        end
    16844 +        else
    16845 +        do
    16846 +            iNext = pos(' ', sArgs, 3);
    16847 +            if (iNext <= 0) then
    16848 +                iNext = length(sArgs);
    16849 +            fQuote = 0;
    16850 +        end
    16851 +
    16852 +        if (iNext > 3 | ch = 'R') then
    16853 +        do
    16854 +            sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote);
    16855 +            sArgs = strip(substr(sArgs, iNext+1));
    16856 +            /*say 'iNext:' iNext  'sValue:' sValue  'sArgs:' sArgs; */
    16857 +
    16858 +            /* check if we're gonna search for something in an file. */
    16859 +            if (sValue <> '' & pos('#define=', sValue) > 0) then
    16860 +                sValue = LookupDefine(sValue);
    16861 +        end
    16862 +        else
    16863 +        do
    16864 +            say 'syntax error near' substr(sArgs, 1, 2)'.';
    16865 +            call syntax;
    16866 +            exit(3);
    16867 +        end
    16868 +
    16869 +
    16870 +        /* set value */
    16871 +        select
    16872 +            when (ch = 'A') then /* ASD Feature Id */
    16873 +                sASDFeatureId   = sValue;
    16874 +
    16875 +            when (ch = 'C') then /* Country code */
    16876 +                sCountryCode    = sValue;
    16877 +
    16878 +            when (ch = 'D') then /* Description */
    16879 +                sDescription    = sValue;
    16880 +
    16881 +            when (ch = 'H') then /* Hostname */
    16882 +                sHostname       = sValue;
    16883 +
    16884 +            when (ch = 'L') then /* Language code */
    16885 +                sLanguageCode   = sValue;
    16886 +
    16887 +            when (ch = 'M') then /* MiniVer */
    16888 +                sMiniVer        = sValue;
    16889 +
    16890 +            when (ch = 'N') then /* Vendor */
    16891 +                sVendor         = sValue;
    16892 +
    16893 +            when (ch = 'R') then /* Vendor */
    16894 +                sDescription    = ReadDescription(sValue, sDefFile);
    16895 +
    16896 +            when (ch = 'P') then /* Fixpak version */
    16897 +                sFixPakVer      = sValue;
    16898 +
    16899 +            when (ch = 'T') then /* Date Time */
    16900 +                sDateTime       = sValue;
    16901 +
    16902 +            when (ch = 'V') then /* Version */
    16903 +                sVersion        = sValue;
    16904 +
    16905 +            /* Otherwise it's an illegal option */
    16906 +            otherwise:
    16907 +                say 'invalid option:' substr(sArgs, 1, 2);
    16908 +                call syntax;
    16909 +                exit(2);
    16910 +        end /* select */
    16911 +    end
    16912 +    else
    16913 +    do  /*
    16914 +         * Defition file...
    16915 +         */
    16916 +        if (sDefFileOut <> '') then
    16917 +        do
    16918 +            say 'Syntax error: Can''t specify more than two defintion files!';
    16919 +            exit(4);
    16920 +        end
    16921 +        if (sDefFileIn = '') then
    16922 +            parse value sArgs with sDefFileIn' 'sArgs
    16923 +        else
    16924 +            parse value sArgs with sDefFileOut' 'sArgs
    16925 +        sArgs = strip(sArgs);
    16926 +    end
    16927 +end
    16928 +
    16929 +
    16930 +/* check that a defintion file was specified. */
    16931 +if (sDefFileIn = '') then
    16932 +do
    16933 +    say 'Syntax error: Will have to specify a .def-file to update.';
    16934 +    call syntax;
    16935 +    exit(5);
    16936 +end
    16937 +
    16938 +
    16939 +/*
    16940 + * Trim strings to correct lengths.
    16941 + */
    16942 +sVendor         = strip(substr(sVendor, 1, 31));
    16943 +if (substr(sDateTime, 1, 1) <> ' ') then
    16944 +    sDateTime = ' ' || sDateTime;
    16945 +sDateTime       = left(sDateTime, 26);
    16946 +sHostname       = strip(substr(sHostname, 1, 11));
    16947 +sMiniVer        = strip(substr(sMiniVer, 1, 11));
    16948 +sDescription    = strip(substr(sDescription, 1, 80));
    16949 +sCountryCode    = strip(substr(sCountryCode, 1, 4));
    16950 +sLanguageCode   = strip(substr(sLanguageCode, 1, 4));
    16951 +sASDFeatureId   = strip(substr(sASDFeatureId, 1, 11));
    16952 +sFixPakVer      = strip(substr(sFixPakVer, 1, 11));
    16953 +
    16954 +
    16955 +/*
    16956 + * Signature
    16957 + */
    16958 +sEnhSign = '##1##'
    16959 +
    16960 +/*
    16961 + * Build description string.
    16962 + */
    16963 +sDescription =  '@#'sVendor':'sVersion'#@'sEnhSign||,
    16964 +                sDateTime||sHostname||,
    16965 +                ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||,
    16966 +                '::'sFixPakVer'@@'sDescription;
    16967 +
    16968 +/*
    16969 + * Update .def-file.
    16970 + */
    16971 +rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);
    16972 +exit(rc);
    16973 +
    16974 +
    16975 +/**
    16976 + * Display script syntax.
    16977 + */
    16978 +syntax: procedure
    16979 +    say 'Syntax: MakeDesc.cmd [options] <deffile in> <deffile out> [options]'
    16980 +    say '   <deffile>   Defitionfile which will have an DESCRIPTION appended.'
    16981 +    say 'Options:'
    16982 +    say '   -A<string>  ASD Feature Id.'
    16983 +    say '   -C<string>  Country code.'
    16984 +    say '   -D<string>  Description.'
    16985 +    say '   -R[deffile] Read description from .def file.'
    16986 +    say '   -H<string>  Hostname.'
    16987 +    say '   -L<string>  Language code.'
    16988 +    say '   -M<string>  MiniVer.'
    16989 +    say '   -N<string>  Vendor.'
    16990 +    say '   -P<string>  Fixpak version.'
    16991 +    say '   -T<string>  Date Time.'
    16992 +    say '   -V<string>  Version.'
    16993 +    say '<string> could be a double qoute qouted string or a single word.'
    16994 +    say '       You could also reference #defines in C/C++ include files.'
    16995 +    say '       The string should then have this form:'
    16996 +    say '           "#define=<DEFINE_NAME>,<includefile.h>"'
    16997 +    say '';
    16998 +
    16999 +    return;
    17000 +
    17001 +
    17002 +/**
    17003 + * Search for a #define in an C/C++ header or source file.
    17004 + *
    17005 + * @returns String containing the defined value
    17006 + *          found for the define in the header file.
    17007 + *          Quits on fatal errors.
    17008 + * @param   A string on the form: "#define=DEFINETOFIND,includefile.h"
    17009 + * @remark  Write only code... - let's hope it works.
    17010 + */
    17011 +LookupDefine: procedure
    17012 +    parse arg '#'sDefine'='sMacro','sIncludeFile
    17013 +
    17014 +    /*
    17015 +     * Validate parameters.
    17016 +     */
    17017 +    sMacro = strip(sMacro);
    17018 +    sIncludeFile = strip(sIncludeFile);
    17019 +    if (sMacro = '') then
    17020 +    do
    17021 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    17022 +        say '    <DEFINE_NAME> was empty.';
    17023 +        exit(-20);
    17024 +    end
    17025 +    if (sIncludeFile = '') then
    17026 +    do
    17027 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    17028 +        say '    <includefile.h> was empty.';
    17029 +        exit(-20);
    17030 +    end
    17031 +
    17032 +
    17033 +    sIllegal = translate(translate(sMacro),,
    17034 +                         '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',,
    17035 +                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_');
    17036 +
    17037 +    if (strip(translate(sIllegal, ' ', '!')) <> '') then
    17038 +    do
    17039 +        say 'syntax error: #define=<DEFINE_NAME>,<includefile.h>.';
    17040 +        say '    <DEFINE_NAME> contains illegal charater(s).'
    17041 +        say '        'sMacro;
    17042 +        say '        'translate(sIllegal, ' ', '!');
    17043 +        exit(-20);
    17044 +    end
    17045 +
    17046 +    /*
    17047 +     * Open include file.
    17048 +     */
    17049 +    sRc = stream(sIncludeFile, 'c', 'open read');
    17050 +    if (pos('READY', sRc) <> 1) then
    17051 +    do  /* search INCLUDE variable */
    17052 +        sFile = SysSearchPath('INCLUDE', sIncludeFile);
    17053 +        if (sFile = '') then
    17054 +        do
    17055 +            say 'Can''t find include file 'sIncludeFile'.';
    17056 +            exit(-20);
    17057 +        end
    17058 +        sIncludeFile = sFile;
    17059 +
    17060 +        sRc = stream(sIncludeFile, 'c', 'open read');
    17061 +        if (pos('READY', sRc) <> 1) then
    17062 +        do
    17063 +            say 'Failed to open include file' sIncludeFile'.';
    17064 +            exit(-20);
    17065 +        end
    17066 +    end
    17067 +
    17068 +    /*
    17069 +     * Search the file line by line.
    17070 +     *  We'll check for lines starting with a hash (#) char.
    17071 +     *  Then check that the word after the hash is 'define'.
    17072 +     *  Then match the next word with the macro name.
    17073 +     *  Then then get the next rest of the line to comment or continuation char.
    17074 +     *      (continuation is not supported)
    17075 +     *  Finally strip quotes.
    17076 +     */
    17077 +    sValue = '';
    17078 +    do while (lines(sIncludeFile) > 0)
    17079 +        sLine = strip(linein(sIncludeFile));
    17080 +        if (sLine = '') then
    17081 +            iterate;
    17082 +        if (substr(sLine, 1, 1) <> '#') then
    17083 +            iterate;
    17084 +        sLine = substr(sLine, 2);
    17085 +        if (word(sLine, 1) <> 'define') then
    17086 +            iterate;
    17087 +        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1));
    17088 +        if (  substr(sLine, 1, length(sMacro)) <> sMacro,
    17089 +            | substr(sLine, length(sMacro)+1, 1) <> ' ') then
    17090 +            iterate;
    17091 +        sLine = strip(substr(sLine, length(sMacro) + 1));
    17092 +        if (sLine = '') then
    17093 +        do
    17094 +            say 'error: #define' sMacro' is empty.';
    17095 +            call stream sIncludeFile, 'c', 'close';
    17096 +            exit(-20);
    17097 +        end
    17098 +
    17099 +        chQuote = substr(sLine, 1, 1);
    17100 +        if (chQuote = '"' | chQuote = "'") then
    17101 +        do  /* quoted string */
    17102 +            iLastQuote = 0;
    17103 +            do forever
    17104 +                iLast = pos(chQuote, sLine, 2);
    17105 +                if (iLast <= 0) then
    17106 +                    leave;
    17107 +                if (substr(sLine, iLast, 1) = '\') then
    17108 +                    iterate;
    17109 +                iLastQuote = iLast;
    17110 +                leave;
    17111 +            end
    17112 +
    17113 +            if (iLastQuote <= 0) then
    17114 +            do
    17115 +                say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.';
    17116 +                call stream sIncludeFile, 'c', 'close';
    17117 +                exit(-20);
    17118 +            end
    17119 +
    17120 +            call stream sIncludeFile, 'c', 'close';
    17121 +            sValue = substr(sLine, 2, iLastQuote - 2);
    17122 +            say 'Found 'sMacro'='sValue;
    17123 +            return sValue;
    17124 +        end
    17125 +        else
    17126 +        do
    17127 +            iCommentCPP = pos('//',sLine);
    17128 +            iCommentC   = pos('/*',sLine);
    17129 +            if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then
    17130 +                iComment = iCommentCPP;
    17131 +            else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then
    17132 +                iComment = iCommentC;
    17133 +            else if (iCommentCPP > 0) then
    17134 +                iComment = iCommentCPP;
    17135 +            else if (iCommentC > 0) then
    17136 +                iComment = iCommentC;
    17137 +            else
    17138 +                iComment = 0;
    17139 +
    17140 +            if (iComment > 0) then
    17141 +                sValue = strip(substr(sLine, 1, iComment-1));
    17142 +            else
    17143 +                sValue = strip(sLine);
    17144 +
    17145 +            if (sValue <> '') then
    17146 +            do
    17147 +                if (substr(sValue, length(sValue)) = '\') then
    17148 +                do
    17149 +                    say 'Found continuation char: Multiline definitions are not supported!\n';
    17150 +                    call stream sIncludeFile, 'c', 'close';
    17151 +                    exit(-20);
    17152 +                end
    17153 +            end
    17154 +
    17155 +            if (sValue = '') then
    17156 +                say 'warning: The #define has no value.';
    17157 +
    17158 +            call stream sIncludeFile, 'c', 'close';
    17159 +            say 'Found 'sMacro'='sValue;
    17160 +            return sValue;
    17161 +        end
    17162 +    end
    17163 +
    17164 +    call stream sIncludeFile, 'c', 'close';
    17165 +    say 'error: didn''t find #define' sMacro'.';
    17166 +    exit(-20);
    17167 +
    17168 +
    17169 +
    17170 +/**
    17171 + * Reads the description line for a .def-file.
    17172 + * @returns The Description string, with quotes removed.
    17173 + *          Empty string is acceptable.
    17174 + *          On error we'll terminate the script.
    17175 + * @param   sDefFile    Filaname of .def-file to read the description from.
    17176 + * @param   sDefFile2   Used if sDefFile is empty.
    17177 + * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    17178 + */
    17179 +ReadDescription: procedure;
    17180 +    parse arg sDefFile, sDefFile2
    17181 +
    17182 +    /*
    17183 +     * Validate parameters.
    17184 +     */
    17185 +    if (sDefFile = '') then
    17186 +        sDefFile = sDefFile2;
    17187 +    if (sDefFile = '') then
    17188 +    do
    17189 +        say 'error: no definition file to get description from.'
    17190 +        exit(-1);
    17191 +    end
    17192 +
    17193 +    /*
    17194 +     * Open file
    17195 +     */
    17196 +    rc = stream(sDefFile, 'c', 'open read');
    17197 +    if (pos('READY', rc) <> 1) then
    17198 +    do
    17199 +        say 'error: failed to open deffile file.';
    17200 +        exit(-1);
    17201 +    end
    17202 +
    17203 +
    17204 +    /*
    17205 +     * Search for the 'DESCRIPTION' line.
    17206 +     */
    17207 +    do while (lines(sDefFile) > 0)
    17208 +        sLine = strip(linein(sDefFile));
    17209 +        if (sLine = '') then
    17210 +            iterate;
    17211 +        if (translate(word(sLine, 1)) <> 'DESCRIPTION') then
    17212 +            iterate;
    17213 +        sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1));
    17214 +
    17215 +        ch = substr(sLine, 1, 1);
    17216 +        if (ch <> "'" & ch <> '"') then
    17217 +        do
    17218 +            say 'syntax error: description line in' sDefFile 'is misformed.';
    17219 +            call stream sDefFile, 'c', 'close';
    17220 +            exit(-10);
    17221 +        end
    17222 +
    17223 +        iEnd = pos(ch, sLine, 2);
    17224 +        if (iEnd <= 0) then
    17225 +        do
    17226 +            say 'syntax error: description line in' sDefFile 'is misformed.';
    17227 +            call stream sDefFile, 'c', 'close';
    17228 +            exit(-10);
    17229 +        end
    17230 +
    17231 +        call stream sDefFile, 'c', 'close';
    17232 +        sValue = substr(sLine, 2, iEnd - 2);
    17233 +        say 'Found Description:' sValue;
    17234 +        return sValue;
    17235 +    end
    17236 +
    17237 +    call stream sDefFile, 'c', 'close';
    17238 +    say 'info: Didn''t find description line in' sDefFile'.';
    17239 +    return '';
    17240 +
    17241 +
    17242 +/**
    17243 + * This is a function which reads sDefFileIn into and
    17244 + * internal array and changes the DESCRIPTION text if found.
    17245 + * If DESCRIPTION isn't found, it is added at the end.
    17246 + * The array is written to sDefFileOut.
    17247 + * @returns 0 on succes.
    17248 + *          Errorcode on error.
    17249 + * @param   sDefFileIn      Input .def-file.
    17250 + * @param   sDefFileOut     Output .def-file. Overwritten.
    17251 + * @param   sDescription    New description string.
    17252 + * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    17253 + */
    17254 +UpdateDefFile: procedure;
    17255 +    parse arg sDefFileIn, sDefFileOut, sDescription
    17256 +
    17257 +    /*
    17258 +     * Validate parameters.
    17259 +     */
    17260 +    if (sDefFileOut = '') then
    17261 +        sDefFileOut = sDefFileIn;
    17262 +
    17263 +    /*
    17264 +     * Open file input file.
    17265 +     */
    17266 +    rc = stream(sDefFileIn, 'c', 'open read');
    17267 +    if (pos('READY', rc) <> 1) then
    17268 +    do
    17269 +        say 'error: failed to open' sDefFileIn 'file.';
    17270 +        return 110;
    17271 +    end
    17272 +
    17273 +
    17274 +    /*
    17275 +     * Search for the 'DESCRIPTION' line.
    17276 +     */
    17277 +    i = 0;
    17278 +    fDescription = 0;
    17279 +    do while (lines(sDefFileIn) > 0)
    17280 +        /*
    17281 +         * Read line.
    17282 +         */
    17283 +        i = i + 1;
    17284 +        asFile.i = strip(linein(sDefFileIn));
    17285 +
    17286 +        /*
    17287 +         * Look for DESCRIPTION;
    17288 +         */
    17289 +        if (asFile.i = '') then
    17290 +            iterate;
    17291 +        if (translate(word(asFile.i, 1)) <> 'DESCRIPTION') then
    17292 +            iterate;
    17293 +        if (fDescription) then
    17294 +        do
    17295 +            say 'warning: multiple descriptions lines. Line' i 'removed';
    17296 +            i = i - 1;
    17297 +            iterate;
    17298 +        end
    17299 +
    17300 +        /*
    17301 +         * Found description - replace with new description.
    17302 +         */
    17303 +        asFile.i = "DESCRIPTION '"||sDescription||"'";
    17304 +        fDescription = 1;
    17305 +    end
    17306 +
    17307 +    /*
    17308 +     * Add description is none was found.
    17309 +     */
    17310 +    if (\fDescription) then
    17311 +    do
    17312 +        i = i + 1;
    17313 +        asFile.i = "DESCRIPTION '"||sDescription||"'";
    17314 +    end
    17315 +    asFile.0 = i;
    17316 +
    17317 +
    17318 +    /*
    17319 +     * Close input file and open output file.
    17320 +     */
    17321 +    call stream sDefFileIn, 'c', 'close';
    17322 +    call SysFileDelete(sDefFileOut);
    17323 +    rc = stream(sDefFileOut, 'c', 'open write');
    17324 +    if (pos('READY', rc) <> 1) then
    17325 +    do
    17326 +        say 'error: failed to open outputfile' sDefFileOut 'file.';
    17327 +        return 110;
    17328 +    end
    17329 +
    17330 +    /*
    17331 +     * Make firstline and write all the lines to the output file.
    17332 +     */
    17333 +    call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;
    17334 +    do i = 1 to asFile.0
    17335 +        rc = lineout(sDefFileOut, asFile.i);
    17336 +        if (rc > 0) then
    17337 +        do
    17338 +            say 'error: failed to write line' i 'to' sDefFileOut'.'
    17339 +            call stream sDefFileOut, 'c', 'close';
    17340 +            return 5;
    17341 +        end
    17342 +    end
    17343 +
    17344 +    /*
    17345 +     * Close output file and return succesfully.
    17346 +     */
    17347 +    call stream sDefFileOut, 'c', 'close';
    17348 +    return 0;
    17349 +
    17350 diff --git a/tools/bin/MapSym.cmd b/tools/bin/MapSym.cmd
    17351 index cf74d99..c187eaf 100644
    17352 --- a/tools/bin/MapSym.cmd
    17353 +++ b/tools/bin/MapSym.cmd
    17354 @@ -1,692 +1,692 @@
    17355 -/* $Id: MapSym.cmd,v 1.8 2002-08-29 10:04:10 bird Exp $
    17356 - *
    17357 - * Helper script for calling MAPSYM.EXE.
    17358 - *
    17359 - * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    17360 - *
    17361 - * Project Odin Software License can be found in LICENSE.TXT
    17362 - *
    17363 - */
    17364 -
    17365 -/*
    17366 - * Configuration.
    17367 - */
    17368 -sWatcom = ';wat11c;wat11;watcom;wat11c-16;wat11-16;wlink;wlink.exe;'
    17369 -sIBMOld = ';vac3xx;vac365;vac308;emx;emxpgcc;mscv6;mscv6-16;ilink;ilink.exe;link386;link386.exe;link;link.exe;ibmold;'
    17370 -sVAC40  = ';vac40;'
    17371 -sLinkers = strip(sVAC40, 'T', ';')||strip(sIBMOld, 'T', ';')||strip(sWatcom, 'T', ';')||';'
    17372 -/* look for 4os2 */
    17373 -f4OS2   = 0;
    17374 -Address CMD 'set 4os2test_env=%@eval[2 + 2]';
    17375 -if (value('4os2test_env',, 'OS2ENVIRONMENT') = '4') then
    17376 -    f4OS2 = 1;
    17377 -sCopy = '@copy'
    17378 -if (f4OS2) then
    17379 -    sCopy = '@copy /Q'
    17380 -
    17381 -/*
    17382 - * Parse arguments.
    17383 - */
    17384 -parse arg sLinker sMapfile sSymFile sDummy
    17385 -
    17386 -if (  (sDummy <> '') ,
    17387 -    | (sMapFile = '') ,
    17388 -    | (pos(';'translate(sLinker)';', translate(sLinkers)) <= 0) ,
    17389 -    )
    17390 -then
    17391 -do
    17392 -    say 'syntax error';
    17393 -    call syntax;
    17394 -    exit(16);
    17395 -end
    17396 -if (stream(sMapFile, 'c', 'query exist') = '') then
    17397 -do
    17398 -    say 'error: the mapfile '''sMapFile''' doesn''t exist.';
    17399 -    call syntax;
    17400 -    exit(16);
    17401 -end
    17402 -
    17403 -sMapBaseName = filespec('name', sMapFile);
    17404 -if (pos('.', sMapBaseName) > 0) then
    17405 -    sMapBaseName = left(sMapBaseName, pos('.', sMapBaseName) - 1);
    17406 -
    17407 -if (sSymFile = '') then
    17408 -do
    17409 -    if (lastpos('.', filespec('name', sMapFile)) > 0) then
    17410 -        sSymFile = left(sMapFile, lastpos('.', sMapFile)) || 'sym';
    17411 -    else
    17412 -        sSymFile = sMapFile || '.sym';
    17413 -end
    17414 -
    17415 -
    17416 -/*
    17417 - * Convert linker input.
    17418 - */
    17419 -sLinker = translate(sLinker);           /* easier to compare */
    17420 -if (pos(';'||sLinker||';', translate(sWatcom)) > 0) then
    17421 -    sLinker = 'WATCOM';
    17422 -if (pos(';'||sLinker||';', translate(sIBMOld)) > 0) then
    17423 -    sLinker = 'IBMOLD';
    17424 -if (pos(';'||sLinker||';', translate(sVAC40)) > 0) then
    17425 -    sLinker = 'VAC40';
    17426 -
    17427 -/*
    17428 - * Load rexxutil functions.
    17429 - */
    17430 -call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
    17431 -call SysLoadFuncs
    17432 -
    17433 -
    17434 -/*
    17435 - * Get the temp directory.
    17436 - */
    17437 -sTmp = value('TMP',, 'OS2ENVIRONMENT');
    17438 -if (sTmp = '') then
    17439 -    sTmp = value('TEMP',, 'OS2ENVIRONMENT');
    17440 -if (sTmp = '') then
    17441 -    sTmp = value('TMPDIR',, 'OS2ENVIRONMENT');
    17442 -if (sTmp = '') then
    17443 -    sTmp = value('TEMPDIR',, 'OS2ENVIRONMENT');
    17444 -if (sTmp = '') then
    17445 -do
    17446 -    say 'Fatal error: Hey mister! don''t you have a tmp directory?'
    17447 -    exit(16);
    17448 -end
    17449 -sTmp = strip(strip(sTmp, 'T', '\'), 'T','/');
    17450 -
    17451 -
    17452 -/*
    17453 - * Make temporary filename.
    17454 - * (We'll make a workcopy, modified for some linkers, of the mapfile
    17455 - *  to this file. And call mapsym on it.)
    17456 - */
    17457 -sTmpMapFile = SysTempFileName(sTmp'\'||sMapBaseName||'.???');
    17458 -if (sTmpMapFile = '') then
    17459 -do
    17460 -    say 'error: failed to make temporary file!';
    17461 -    exit(16);
    17462 -end
    17463 -
    17464 -
    17465 -/*
    17466 - * Do pre mapsym.exe processing of the sym file.
    17467 - */
    17468 -select
    17469 -    when (sLinker = 'IBMOLD') then
    17470 -    do
    17471 -        sCopy sMapFile sTmpMapFile
    17472 -        if (rc <> 0) then
    17473 -        do
    17474 -            say 'error: failed to copy '''sMapFile''' to '''sTmpMapFile'''. (rc='rc')';
    17475 -            exit(16);
    17476 -        end
    17477 -    end
    17478 -
    17479 -    when (sLinker = 'WATCOM') then
    17480 -    do
    17481 -        /*sTmpMapFile = 'watos2.map'*/
    17482 -        rc = wat2map(sMapFile, sTmpMapFile);
    17483 -        if (rc <> 0) then
    17484 -        do
    17485 -            say 'error: wat2map failed. (rc='rc')';
    17486 -            exit(16);
    17487 -        end
    17488 -    end
    17489 -
    17490 -    when (sLinker = 'VAC40') then
    17491 -    do
    17492 -        rc = vac40conv(sMapFile, sTmpMapFile);
    17493 -        if (rc <> 0) then
    17494 -        do
    17495 -            say 'error: vac40conv failed. (rc='rc')';
    17496 -            exit(16);
    17497 -        end
    17498 -    end
    17499 -
    17500 -    otherwise
    17501 -    say 'bad linker, sLinker='sLinker;
    17502 -    exit(16);
    17503 -end
    17504 -
    17505 -
    17506 -/*
    17507 - * Call mapsym.exe
    17508 - */
    17509 -sOldDir = directory();
    17510 -call directory(sTmp);
    17511 -'@mapsym.exe' sTmpMapFile
    17512 -if (rc <> 0) then
    17513 -do
    17514 -    say 'error: mapsym.exe '''sTmpMapFile''' failed with rc='rc'.';
    17515 -    call directory(sOldDir);
    17516 -    exit(rc);
    17517 -end
    17518 -call directory(sOldDir);
    17519 -
    17520 -
    17521 -
    17522 -/*
    17523 - * Copy the symfile to the target path.
    17524 - */
    17525 -sCopy left(sTmpMapFile, length(sTmpMapFile) - 4)||'.sym' sSymFile;
    17526 -if (rc <> 0) then
    17527 -do
    17528 -    say 'error: failed to copy '''left(sTmpMapFile, length(sTmpMapFile) - 4)||'.sym'' to '''sSymFile'''. (rc='rc')';
    17529 -    exit(16);
    17530 -end
    17531 -
    17532 -/*
    17533 - * Delete temporary files.
    17534 - */
    17535 -call SysFileDelete sTmpMapFile;
    17536 -call SysFileDelete left(sTmpMapFile, length(sTmpMapFile) - 4)||'.sym';
    17537 -
    17538 -exit(0);
    17539 -
    17540 -
    17541 -
    17542 -/*******************************************************************************
    17543 -*   Function Area                                                              *
    17544 -*******************************************************************************/
    17545 -
    17546 -
    17547 -/**
    17548 - * Display usage info.
    17549 - */
    17550 -syntax: procedure;
    17551 -    say 'syntax: MapSym.cmd <linker> <mapfile> [symfile]';
    17552 -    say '   linker      watcom, vac3xx, link386 or vac40. All $(BUILD_ENV).';
    17553 -    say '   mapfile     Name of the input map file.';
    17554 -    say '   symfile     Name of the output sym file. If not specified';
    17555 -    say '               mapfile is used as a base name.';
    17556 -return 0;
    17557 -
    17558 -
    17559 -/**
    17560 - * Converts a vac40 mapfile to a file readable for mapsym.exe.
    17561 - * @returns 0 on success.
    17562 - *          !0 on error.
    17563 - * @param   sInFile     Input vac40 mapfile.
    17564 - * @param   sOutFile    Output filename.
    17565 - * @status  completely implemented.
    17566 - * @author  knut st. osmundsen (bird@anduin.net)
    17567 - * @remark  Make some assume about the module name. Not sure if it matters.
    17568 - */
    17569 -vac40conv: procedure;
    17570 -    parse arg sInFile, sOutFile;
    17571 -
    17572 -    /*
    17573 -     * variables.
    17574 -     */
    17575 -    rc = 0;
    17576 -    sState = 'Init';                    /* shows the current content status. */
    17577 -
    17578 -    /*
    17579 -     * Read file line by line.
    17580 -     */
    17581 -    do while ((rc = 0) & (lines(sInFile) > 0))
    17582 -        /*
    17583 -         * Read the line and look for state change.
    17584 -         */
    17585 -        sLine = linein(sInFile);
    17586 -        sNewState = vac40ProbeState(sState, sLine);
    17587 -
    17588 -        /*
    17589 -         * State switch.
    17590 -         */
    17591 -        select
    17592 -            /*
    17593 -             * First line.
    17594 -             */
    17595 -            when (sState = 'Init') then
    17596 -            do
    17597 -                if (pos('Link Map...', sLine) <= 0) then
    17598 -                do
    17599 -                    say 'error: Not VAC40 map file.'
    17600 -                    rc = 1;
    17601 -                end
    17602 -
    17603 -                call lineout sOutFile, '';
    17604 -                sModName = translate(filespec('name',sInFile));
    17605 -                if (lastpos('.', sModName) > 0) then sModName = left(sModName, lastpos('.', sModName) - 1);
    17606 -                call lineout sOutFile, ' '||sModName;
    17607 -                call lineout sOutFile, '';
    17608 -                sNewState = 'AnyState';
    17609 -            end
    17610 -
    17611 -            /*
    17612 -             * Segments - let's try copy then raw.
    17613 -             */
    17614 -            when ((sNewState = 'Segments') | (sState = 'Segments')) then
    17615 -            do
    17616 -                if (sState <> 'Segments') then
    17617 -                do
    17618 -                    sSegment = '';
    17619 -                    cbSegment = 0;
    17620 -                    call lineout sOutFile, ' Start         Length     Name                   Class'
    17621 -                end
    17622 -                else
    17623 -                do
    17624 -                    if (pos('at offset', sLine) > 0) then
    17625 -                    do  /*
    17626 -                         * At offset line:
    17627 -                            *          at offset 000006A8 bytes 00006H for "@197"
    17628 -                         */
    17629 -                         parse var sLine . 'offset' sOffset 'bytes' sLength'H' . .
    17630 -                         /*say 'off='sOffset 'len='sLength 'line:' left(sLine, 40);*/
    17631 -                         cbSegment = HexToDec(sOffset) + HexToDec(sLength);
    17632 -                    end
    17633 -                    else if ( (sNewState = 'Segments') & (sSegment = ''),
    17634 -                             & (strip(sLine) <> '') & (pos(':', sLine) > 0) ) then
    17635 -                    do  /*
    17636 -                         * New segment.
    17637 -                         */
    17638 -                        /*say 'NewSeg:' sLine*/
    17639 -                        sSegment = sLine;
    17640 -                    end
    17641 -                    else if ((strip(sLine) = '') & (sSegment <> '')) then
    17642 -                    do  /*
    17643 -                         * Time to write segment line:
    17644 -                         *    0001:00000000            DATA32          DATA
    17645 -                         */
    17646 -                        sSegment = translate(sSegment, ' ', '09'x);
    17647 -                        parse var sSegment iSeg':'iSegOffset sSegName sSegClass
    17648 -                        /*say 'SegLn: seg='iSeg 'off='iSegOffset 'name='sSegName 'class='sSegClass; say sSegment*/
    17649 -                        if (length(sSegName) < 22) then sSegName = left(sSegName, 22, ' ');
    17650 -                        call lineout sOutFile, ' '||strip(iSeg)':'iSegOffset right(DecToHex(cbSegment), 9, '0'),
    17651 -                                     ||'H     '||sSegName||' '||strip(sSegClass);
    17652 -                        sSegment = '';
    17653 -                        cbSegment = 0;
    17654 -                    end
    17655 -                end
    17656 -            end
    17657 -
    17658 -            /*
    17659 -             * Publics by value - filter out some of the stupid stuff.
    17660 -             */
    17661 -            when ((sNewState = 'PublicValue') | (sState = 'PublicValue')) then
    17662 -            do
    17663 -                if (sState = sNewState) then
    17664 -                do
    17665 -                    sLine = translate(sLine, '', '"'||d2c(9));
    17666 -                    if ((strip(sLine) <> '') & (pos('|', sLine) <= 0) & (pos('@', sLine) <= 0)) then
    17667 -                        call lineout sOutFile, ' '||word(sLine, 1)||'       '||word(sLine, 2);
    17668 -                end
    17669 -                else if (sNewState = 'PublicValue') then
    17670 -                do  /* first call */
    17671 -                    call lineout sOutFile, '';
    17672 -                    call lineout sOutFile, '  Address         Publics by Value';
    17673 -                end
    17674 -            end
    17675 -
    17676 -            /*
    17677 -             * Entry pointe - raw copy.
    17678 -             */
    17679 -            when (sNewState = 'EntryPoint') then
    17680 -            do
    17681 -                call lineout sOutFile, '';
    17682 -                call lineout sOutFile, sLine;
    17683 -                sNewState = 'Stop';
    17684 -            end
    17685 -
    17686 -            /*
    17687 -             * Got to next state.
    17688 -             */
    17689 -            when (sState = 'AnyState') then
    17690 -            do
    17691 -                if (strip(sLine) = '') then
    17692 -                    iterate;
    17693 -                if (sNewState = sState) then
    17694 -                do
    17695 -                    say 'state error, bad input?';
    17696 -                    rc = 2;
    17697 -                end
    17698 -            end
    17699 -
    17700 -            /*
    17701 -             * Skips till we hit a new state.
    17702 -             */
    17703 -            when (sState = 'Skip') then
    17704 -                nop;
    17705 -            /* debug */
    17706 -            when ((sState = 'ImportsName') | (sState = 'PublicNames') | (sState = 'ImportLibs') | (sState = 'ConstDest')) then
    17707 -                nop;
    17708 -
    17709 -            /*
    17710 -             * Final.
    17711 -             */
    17712 -            when (sState = 'Stop') then
    17713 -                leave;
    17714 -
    17715 -            /*
    17716 -             * Should not happen.
    17717 -             */
    17718 -            otherwise
    17719 -            do
    17720 -                say 'bad state, sState='sState;
    17721 -                rc = 3;
    17722 -            end
    17723 -        end /* select */
    17724 -
    17725 -        /*
    17726 -         * next state
    17727 -         */
    17728 -        /*say 'state debug:' sState '->' sNewState 'ln:' left(sLine, 40)*/
    17729 -        sState = sNewState;
    17730 -    end /* do while */
    17731 -
    17732 -    /*
    17733 -     * cleanup.
    17734 -     */
    17735 -    call stream sOutFile, 'c', 'close'
    17736 -    call stream sMapfile, 'c', 'close'
    17737 -
    17738 -return rc;
    17739 -
    17740 -
    17741 -/**
    17742 - * Checks if this line is recognizes as a state change line.
    17743 - * @returns New state.
    17744 - * @param   sState      The current state.
    17745 - * @param   sLine       The input line we're processing.
    17746 - */
    17747 -vac40ProbeState: procedure
    17748 -    parse arg sState, sLine
    17749 -    select
    17750 -        when (pos('...Options...', sLine) > 0)              then sState = 'Skip';
    17751 -        when (pos('...Segments...', sLine) > 0)             then sState = 'Segments';
    17752 -        when (pos('...Constructor/Destructor pairs to run...', sLine) > 0) then sState = 'ConstDest';
    17753 -        when (pos('Imports by name', sLine) > 0)            then sState = 'ImportsName';
    17754 -        when (pos('Publics by name', sLine) > 0)            then sState = 'PublicNames';
    17755 -        when (pos('Publics by value', sLine) > 0)           then sState = 'PublicValue';
    17756 -        when (pos('...Import library list...', sLine) > 0)  then sState = 'ImportLibs';
    17757 -        when (pos('Line numbers for', sLine) > 0)           then sState = 'Skip';
    17758 -        when (pos('Program entry point', sLine) > 0)        then sState = 'EntryPoint';
    17759 -        otherwise
    17760 -            nop;
    17761 -    end
    17762 -return sState;
    17763 -
    17764 -
    17765 -
    17766 -/**
    17767 - * Converts a hex string (no prefix/postfix) to a decimal value.
    17768 - * @returns decimal value.
    17769 - * @param   sStringHex  Hexstring to convert. (no 0x prefix or H postfix!)
    17770 - * @status  completely implemented.
    17771 - * @author  knut st. osmundsen (bird@anduin.net)
    17772 - */
    17773 -HexToDec: procedure
    17774 -    parse arg sStringHex
    17775 -/*    say 'HexToDec('sStringHex'):' strip(strip(sStringHex), 'L', '0')*/
    17776 -    sStringHex = strip(strip(sStringHex), 'L', '0');
    17777 -    if (sStringHex = '') then
    17778 -        sStringHex = 0;
    17779 -return x2d(sStringHex);
    17780 -
    17781 -
    17782 -/**
    17783 - * Converts a dec string to a hex string.
    17784 - * @returns hex string value.
    17785 - * @param   sStringDec    Decstring to convert.
    17786 - * @status  completely implemented.
    17787 - * @author  knut st. osmundsen (bird@anduin.net)
    17788 - */
    17789 -DecToHex: procedure
    17790 -    parse arg sStringDec
    17791 -    sStringDec = strip(strip(sStringDec), 'L', '0');
    17792 -    if (sStringDec = '') then
    17793 -        sStringDec = 0;
    17794 -return d2x(sStringDec);
    17795 -
    17796 -
    17797 -/* SCCSID = %W% %E% */
    17798 -/****************************************************************************
    17799 - *                                                                          *
    17800 - * Copyright (c) IBM Corporation 1994 - 1997.                               *
    17801 - *                                                                          *
    17802 - * The following IBM OS/2 source code is provided to you solely for the     *
    17803 - * the purpose of assisting you in your development of OS/2 device drivers. *
    17804 - * You may use this code in accordance with the IBM License Agreement       *
    17805 - * provided in the IBM Device Driver Source Kit for OS/2.                   *
    17806 - *                                                                          *
    17807 - ****************************************************************************/
    17808 -/**@internal %W%
    17809 - * WAT2MAP - translate symbol map from Watcom format to MS format.
    17810 - * @version %I%
    17811 - * @context
    17812 - *  Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
    17813 - * @notes
    17814 - *  Usage:  WAT2MAP <watcom_mapfile >ms_mapfile
    17815 - *               - or -
    17816 - *          type watcom_mapfile | WAT2MAP >ms_mapfile
    17817 - *
    17818 - *          Reads from stdin, writes to stdout.  Will accept the Watcom map filename
    17819 - *          as an argument (in place of reading from stdin).  Eg.,
    17820 - *
    17821 - *          WAT2MAP watcom_mapfile >ms_mapfile
    17822 - *
    17823 - *  Notes:
    17824 - *    1.)  The symbol handling in the debug kernel won't work for some of the
    17825 - *         characters used in the C++ name space.  WAT2MAP handles these symbols
    17826 - *         as follows.
    17827 - *             Scoping operator symbol '::' is translated to '__'.
    17828 - *             Destructor symbol '~' is translated to 'd'.
    17829 - *             Symbols for operators '::operator' are not provided.
    17830 - *
    17831 - *         Eg., for user defined class 'A', the symbol for constructor A::A is
    17832 - *         translated to A__A, and the destructor symbol A::~A becomes A__dA, and
    17833 - *         the assignment operator, 'A::operator =', is not translated.
    17834 - *
    17835 - *    2.)  Bug - C++ provides for defining multiple functions with same fn name
    17836 - *         but different function signatures (different parameter lists).  This
    17837 - *         utility just translates all the address / symbol combinations it finds,
    17838 - *         so you can end up with several addresses for a given fn name.
    17839 - * @history
    17840 -*/
    17841 -/* <End of helpText> - don't modify this string - used to flag end of help. */
    17842 -/****************************************************************************/
    17843 -
    17844 -wat2map: procedure
    17845 -Parse Arg arg1, arg2
    17846 -If (Length( arg1 ) = 0) | (Verify( arg1, '/-?' ) = 0) Then Do;
    17847 -   Do i = 1 to 1000
    17848 -      helpText = Sourceline(i)
    17849 -      If Pos( '<End of helpText>', helpText ) <> 0 Then Leave;       /* quit loop */
    17850 -      Say helpText
    17851 -   End;
    17852 -   Return 1
    17853 -End;
    17854 -If Length( arg2 ) = 0 Then Do;
    17855 -   Say " Way to go Beaver... How about an out-put file name ?"
    17856 -   Return 2
    17857 -End;
    17858 -mapFile = arg1          /* Can be Null, in which case we pull from stdin. */
    17859 -outFile = arg2
    17860 -fFlatMode = 0;
    17861 -
    17862 -/* erase outfile */  /* kill the old map file */
    17863 -rc=SysFileDelete(outfile)
    17864 -
    17865 -
    17866 -/*--- 1.  Find & translate module name.  ---*/
    17867 -Do While Lines( mapFile ) <> 0
    17868 -   watcomText = LineIn( mapFile )
    17869 -   /*Parse Value watcomText With "Executable Image: " fileName "." fileExt*/
    17870 -   Parse Value watcomText With "Executable Image: " sFilename
    17871 -   If (sFilename <> '') Then Do;
    17872 -      sFilename = filespec('name', sFilename);
    17873 -      Parse Var sFilename fileName "." fileExt
    17874 -      If fileName <> "" Then Do;   /* Found match */
    17875 -         call lineout outfile ,' '
    17876 -         call lineout outfile ,' ' || fileName
    17877 -         call lineout outfile ,' '
    17878 -         Leave;                    /* Break from loop. */
    17879 -      End;
    17880 -   End;
    17881 -End
    17882 -If Lines( mapFile ) = 0 Then Do;        /* If end of file ... */
    17883 -   Say "Error:  Expected to find line with text 'Executable Image:' "
    17884 -   Return 3
    17885 -End
    17886 -
    17887 -/*--- 2.  Skip the group definitions - Rob's notes say we don't need them. -*/
    17888 -
    17889 -/*--- 3.  Skip to the start of the segment table.  ---*/
    17890 -Do While Lines( mapFile ) <> 0
    17891 -   watcomText = LineIn( mapFile )
    17892 -   Parse Value watcomText With "Segment" header_2_3 "Address" header_5
    17893 -   If Strip( header_5 ) = "Size" Then Leave;      /* Found header line for Segment table. */
    17894 -End
    17895 -If Lines( mapFile ) = 0 Then Do;        /* If end of file ... */
    17896 -   Say "Error:  Expected to find line with text 'Segments ... Size' "
    17897 -   Return 4
    17898 -End
    17899 -
    17900 -
    17901 -junk = LineIn( mapFile )      /* Discard a couple lines of formatting. */
    17902 -junk = LineIn( mapFile )      /* Discard a couple lines of formatting. */
    17903 -/*--- 4.  Translate segment table.  ---*/
    17904 -/*"Segment                Class          Group          Address         Size"*/
    17905 -iClass = pos('Class', watcomText);
    17906 -iGroup = pos('Group', watcomText);
    17907 -iAddress = pos('Address', watcomText);
    17908 -iSize = pos('Size', watcomText);
    17909 -
    17910 -call lineout outfile , " Start         Length     Name                   Class"  /* bird bird bird fixed!!! */
    17911 -Do While Lines( mapFile ) <> 0
    17912 -   watcomText = LineIn( mapFile )
    17913 -   /* do it the hard way to make sure we support spaces segment names. */
    17914 -   segName = strip(substr(watcomText, 1, iClass-1));
    17915 -   If segName = "" Then Leave;          /* Empty line, break from loop. */
    17916 -   className = strip(substr(watcomText, iClass, iGroup-iClass));
    17917 -   groupName = strip(substr(watcomText, iGroup, iAddress-iGroup));
    17918 -   address = strip(substr(watcomText, iAddress, iSize-iAddress));
    17919 -   size = strip(substr(watcomText, iSize));
    17920 -   if (pos(':', address) <= 0) then     /* NT binaries doesn't have a segment number. */
    17921 -   do
    17922 -      fFlatMode = 1;
    17923 -      address = '0001:'||address;
    17924 -   end
    17925 -   length = right(strip(strip(size), 'L', '0'), 9, '0') || 'H     '
    17926 -   segName = Left( segName, 23 )
    17927 -   call lineout outfile ,' ' || address || ' ' || length || segName || className
    17928 -End
    17929 -call lineout outfile ,' '     /* Extra line feed. */
    17930 -
    17931 -
    17932 -/*--- 5.  For all remaining lines in the input file:  if the line starts
    17933 -   with a 16:16 address, assume it's a symbol declaration and translate
    17934 -   it into MS format.  ---*/
    17935 -
    17936 -call lineout outfile ,'  Address         Publics by Value'
    17937 -/* call lineout outfile ,' '*/
    17938 -
    17939 -Do While Lines( mapFile ) <> 0
    17940 -   watcomText = LineIn( mapFile )
    17941 -   Parse Value watcomText With seg ':' ofs 14 . 16 declaration
    17942 -   if (fFlatMode) then
    17943 -   do
    17944 -      seg = '0001';
    17945 -      Parse Value watcomText With ofs 9 . 16 declaration
    17946 -   end
    17947 -   else
    17948 -   do  /* kso: more workarounds */
    17949 -       if (is_Hex(seg) & length(ofs) > 4 & \is_Hex(substr(ofs,5,1))) then
    17950 -           ofs = '0000'||left(ofs,4);
    17951 -   end
    17952 -   /*say ofs  '-'declaration*/
    17953 -   is_Adress = (is_Hex(seg) = 1) & (is_Hex(ofs) = 1)
    17954 -   If ((is_Adress = 1) & (seg <> '0000')) Then Do;          /* bird: skip symbols with segment 0. (__DOSseg__) */
    17955 -      /*--- Haven't done the work to xlate operator symbols - skip the line. */
    17956 -      If Pos( '::operator', declaration ) <> 0 Then Iterate;
    17957 -
    17958 -      /*--- Strip any arguement list if this is a function prototype.  */
    17959 -      declaration = StripMatchedParen( declaration )
    17960 -
    17961 -      /*--- Strip array brackets if this is an array. */
    17962 -      sqBracket = Pos( '[', declaration )
    17963 -      If sqBracket <> 0
    17964 -         Then declaration = Substr(declaration, 1, sqBracket-1);
    17965 -
    17966 -      /*--- Strip leading tokens from the function name.
    17967 -         Eg., remove function return type, near/far, etc.  */
    17968 -      declaration = Word( declaration, Words(declaration) )
    17969 -
    17970 -      /*--- Strip any remaining parens around function name. ---*/
    17971 -      declaration = ReplaceSubstr( '(', ' ', declaration )
    17972 -      declaration = ReplaceSubstr( ')', ' ', declaration )
    17973 -
    17974 -      /*--- Debug kernel doesn't like symbol for scoping operator "::"
    17975 -         in symbol names.  Replace :: with double underscore "__". ---*/
    17976 -      declaration = ReplaceSubstr( '::', '__', declaration )
    17977 -
    17978 -      /*--- Debug kernel doesn't like symbol for destructor "~"
    17979 -         in symbol names.  Replace ~ with character "d" for "destructor.
    17980 -         Note destructor for a class will translate "A::~A" -> "A__dA". ---*/
    17981 -      declaration = ReplaceSubstr( '~', 'd', declaration )
    17982 -
    17983 -      call lineout outfile ,' ' || seg || ':' || ofs || '       ' || declaration
    17984 -   End;
    17985 -
    17986 -   /* check for entry point, if found we add it and quit. */
    17987 -   if (pos('Entry point address', watcomText) > 0) then
    17988 -   do
    17989 -       parse var watcomText 'Entry point address:' sEntryPoint
    17990 -       if (pos(':', sEntryPoint) <= 0) then
    17991 -           sEntryPoint = '0001:'||strip(sEntryPoint);
    17992 -       call lineout outfile, ''
    17993 -       call lineout outfile, 'Program entry point at' strip(sEntryPoint)
    17994 -       leave;
    17995 -   end
    17996 -End; /* End While through symbol section, end of input file. */
    17997 -
    17998 -call stream outfile, 'c', 'close';
    17999 -call stream mapfile, 'c', 'close';
    18000 -
    18001 -Return 0;  /* End of program.  */
    18002 -
    18003 -/*--- Helper subroutines. ---*/
    18004 -
    18005 -StripMatchedParen:
    18006 -/* Strips matched "( )" from end of string.  Returns
    18007 -   a substring with the trailing, matched parens deleted. */
    18008 -
    18009 -   Parse Arg string
    18010 -
    18011 -   ixOpenParen = LastPos( "(", string );
    18012 -   ixCloseParen = LastPos( ")", Substr( string, 1, Length(string)-1 ));
    18013 -
    18014 -   If (ixOpenParen = 0)                     /* No match. */
    18015 -      Then Return string
    18016 -   Else If ixCloseParen < ixOpenParen       /* Found match, no imbedded "()". */
    18017 -      Then Return Substr( string, 1, ixOpenParen-1 )
    18018 -   Else Do;                                 /* Imbedded (), must skip over them. */
    18019 -      /* Parse Value string With first ixCloseParen+1 rest */
    18020 -      first = Substr( string, 1, ixCloseParen)
    18021 -      rest = Substr( string, ixCloseParen+1 )
    18022 -      string = StripMatchedParen( first ) || rest
    18023 -      Return StripMatchedParen( string )
    18024 -   End;
    18025 -End;
    18026 -
    18027 -ReplaceSubstr:
    18028 -/* Replaces oldPat (old pattern) with newPat (new pattern) in string. */
    18029 -
    18030 -   Parse Arg oldPat , newPat , string
    18031 -
    18032 -   ix = Pos( oldPat, string )
    18033 -   if ix <> 0 Then Do;
    18034 -      first = Substr( string, 1, ix-1 )
    18035 -      rest  = Substr( string, ix + Length( oldPat ) )
    18036 -      string = first || newPat || rest
    18037 -   End;
    18038 -   Return string
    18039 -End;
    18040 -
    18041 -is_Hex:
    18042 -/* Returns 1 if String is valid hex number, 0 otherwise. */
    18043 -   Parse Arg string
    18044 -   Return (Length(string) > 0) &  (Verify( string, '0123456789abcdefABCDEF' ) = 0)
    18045 -End;
    18046 -
    18047 +/* $Id: MapSym.cmd,v 1.8 2002-08-29 10:04:10 bird Exp $
    18048 + *
    18049 + * Helper script for calling MAPSYM.EXE.
    18050 + *
    18051 + * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    18052 + *
    18053 + * Project Odin Software License can be found in LICENSE.TXT
    18054 + *
    18055 + */
    18056 +
    18057 +/*
    18058 + * Configuration.
    18059 + */
    18060 +sWatcom = ';wat11c;wat11;watcom;wat11c-16;wat11-16;wlink;wlink.exe;'
    18061 +sIBMOld = ';vac3xx;vac365;vac308;emx;emxpgcc;mscv6;mscv6-16;ilink;ilink.exe;link386;link386.exe;link;link.exe;ibmold;'
    18062 +sVAC40  = ';vac40;'
    18063 +sLinkers = strip(sVAC40, 'T', ';')||strip(sIBMOld, 'T', ';')||strip(sWatcom, 'T', ';')||';'
    18064 +/* look for 4os2 */
    18065 +f4OS2   = 0;
    18066 +Address CMD 'set 4os2test_env=%@eval[2 + 2]';
    18067 +if (value('4os2test_env',, 'OS2ENVIRONMENT') = '4') then
    18068 +    f4OS2 = 1;
    18069 +sCopy = '@copy'
    18070 +if (f4OS2) then
    18071 +    sCopy = '@copy /Q'
    18072 +
    18073 +/*
    18074 + * Parse arguments.
    18075 + */
    18076 +parse arg sLinker sMapfile sSymFile sDummy
    18077 +
    18078 +if (  (sDummy <> '') ,
    18079 +    | (sMapFile = '') ,
    18080 +    | (pos(';'translate(sLinker)';', translate(sLinkers)) <= 0) ,
    18081 +    )
    18082 +then
    18083 +do
    18084 +    say 'syntax error';
    18085 +    call syntax;
    18086 +    exit(16);
    18087 +end
    18088 +if (stream(sMapFile, 'c', 'query exist') = '') then
    18089 +do
    18090 +    say 'error: the mapfile '''sMapFile''' doesn''t exist.';
    18091 +    call syntax;
    18092 +    exit(16);
    18093 +end
    18094 +
    18095 +sMapBaseName = filespec('name', sMapFile);
    18096 +if (pos('.', sMapBaseName) > 0) then
    18097 +    sMapBaseName = left(sMapBaseName, pos('.', sMapBaseName) - 1);
    18098 +
    18099 +if (sSymFile = '') then
    18100 +do
    18101 +    if (lastpos('.', filespec('name', sMapFile)) > 0) then
    18102 +        sSymFile = left(sMapFile, lastpos('.', sMapFile)) || 'sym';
    18103 +    else
    18104 +        sSymFile = sMapFile || '.sym';
    18105 +end
    18106 +
    18107 +
    18108 +/*
    18109 + * Convert linker input.
    18110 + */
    18111 +sLinker = translate(sLinker);           /* easier to compare */
    18112 +if (pos(';'||sLinker||';', translate(sWatcom)) > 0) then
    18113 +    sLinker = 'WATCOM';
    18114 +if (pos(';'||sLinker||';', translate(sIBMOld)) > 0) then
    18115 +    sLinker = 'IBMOLD';
    18116 +if (pos(';'||sLinker||';', translate(sVAC40)) > 0) then
    18117 +    sLinker = 'VAC40';
    18118 +
    18119 +/*
    18120 + * Load rexxutil functions.
    18121 + */
    18122 +call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
    18123 +call SysLoadFuncs
    18124 +
    18125 +
    18126 +/*
    18127 + * Get the temp directory.
    18128 + */
    18129 +sTmp = value('TMP',, 'OS2ENVIRONMENT');
    18130 +if (sTmp = '') then
    18131 +    sTmp = value('TEMP',, 'OS2ENVIRONMENT');
    18132 +if (sTmp = '') then
    18133 +    sTmp = value('TMPDIR',, 'OS2ENVIRONMENT');
    18134 +if (sTmp = '') then
    18135 +    sTmp = value('TEMPDIR',, 'OS2ENVIRONMENT');
    18136 +if (sTmp = '') then
    18137 +do
    18138 +    say 'Fatal error: Hey mister! don''t you have a tmp directory?'
    18139 +    exit(16);
    18140 +end
    18141 +sTmp = strip(strip(sTmp, 'T', '\'), 'T','/');
    18142 +
    18143 +
    18144 +/*
    18145 + * Make temporary filename.
    18146 + * (We'll make a workcopy, modified for some linkers, of the mapfile
    18147 + *  to this file. And call mapsym on it.)
    18148 + */
    18149 +sTmpMapFile = SysTempFileName(sTmp'\'||sMapBaseName||'.???');
    18150 +if (sTmpMapFile = '') then
    18151 +do
    18152 +    say 'error: failed to make temporary file!';
    18153 +    exit(16);
    18154 +end
    18155 +
    18156 +
    18157 +/*
    18158 + * Do pre mapsym.exe processing of the sym file.
    18159 + */
    18160 +select
    18161 +    when (sLinker = 'IBMOLD') then
    18162 +    do
    18163 +        sCopy sMapFile sTmpMapFile
    18164 +        if (rc <> 0) then
    18165 +        do
    18166 +            say 'error: failed to copy '''sMapFile''' to '''sTmpMapFile'''. (rc='rc')';
    18167 +            exit(16);
    18168 +        end
    18169 +    end
    18170 +
    18171 +    when (sLinker = 'WATCOM') then
    18172 +    do
    18173 +        /*sTmpMapFile = 'watos2.map'*/
    18174 +        rc = wat2map(sMapFile, sTmpMapFile);
    18175 +        if (rc <> 0) then
    18176 +        do
    18177 +            say 'error: wat2map failed. (rc='rc')';
    18178 +            exit(16);
    18179 +        end
    18180 +    end
    18181 +
    18182 +    when (sLinker = 'VAC40') then
    18183 +    do
    18184 +        rc = vac40conv(sMapFile, sTmpMapFile);
    18185 +        if (rc <> 0) then
    18186 +        do
    18187 +            say 'error: vac40conv failed. (rc='rc')';
    18188 +            exit(16);
    18189 +        end
    18190 +    end
    18191 +
    18192 +    otherwise
    18193 +    say 'bad linker, sLinker='sLinker;
    18194 +    exit(16);
    18195 +end
    18196 +
    18197 +
    18198 +/*
    18199 + * Call mapsym.exe
    18200 + */
    18201 +sOldDir = directory();
    18202 +call directory(sTmp);
    18203 +'@mapsym.exe' sTmpMapFile
    18204 +if (rc <> 0) then
    18205 +do
    18206 +    say 'error: mapsym.exe '''sTmpMapFile''' failed with rc='rc'.';
    18207 +    call directory(sOldDir);
    18208 +    exit(rc);
    18209 +end
    18210 +call directory(sOldDir);
    18211 +
    18212 +
    18213 +
    18214 +/*
    18215 + * Copy the symfile to the target path.
    18216 + */
    18217 +sCopy left(sTmpMapFile, length(sTmpMapFile) - 4)||'.sym' sSymFile;
    18218 +if (rc <> 0) then
    18219 +do
    18220 +    say 'error: failed to copy '''left(sTmpMapFile, length(sTmpMapFile) - 4)||'.sym'' to '''sSymFile'''. (rc='rc')';
    18221 +    exit(16);
    18222 +end
    18223 +
    18224 +/*
    18225 + * Delete temporary files.
    18226 + */
    18227 +call SysFileDelete sTmpMapFile;
    18228 +call SysFileDelete left(sTmpMapFile, length(sTmpMapFile) - 4)||'.sym';
    18229 +
    18230 +exit(0);
    18231 +
    18232 +
    18233 +
    18234 +/*******************************************************************************
    18235 +*   Function Area                                                              *
    18236 +*******************************************************************************/
    18237 +
    18238 +
    18239 +/**
    18240 + * Display usage info.
    18241 + */
    18242 +syntax: procedure;
    18243 +    say 'syntax: MapSym.cmd <linker> <mapfile> [symfile]';
    18244 +    say '   linker      watcom, vac3xx, link386 or vac40. All $(BUILD_ENV).';
    18245 +    say '   mapfile     Name of the input map file.';
    18246 +    say '   symfile     Name of the output sym file. If not specified';
    18247 +    say '               mapfile is used as a base name.';
    18248 +return 0;
    18249 +
    18250 +
    18251 +/**
    18252 + * Converts a vac40 mapfile to a file readable for mapsym.exe.
    18253 + * @returns 0 on success.
    18254 + *          !0 on error.
    18255 + * @param   sInFile     Input vac40 mapfile.
    18256 + * @param   sOutFile    Output filename.
    18257 + * @status  completely implemented.
    18258 + * @author  knut st. osmundsen (bird@anduin.net)
    18259 + * @remark  Make some assume about the module name. Not sure if it matters.
    18260 + */
    18261 +vac40conv: procedure;
    18262 +    parse arg sInFile, sOutFile;
    18263 +
    18264 +    /*
    18265 +     * variables.
    18266 +     */
    18267 +    rc = 0;
    18268 +    sState = 'Init';                    /* shows the current content status. */
    18269 +
    18270 +    /*
    18271 +     * Read file line by line.
    18272 +     */
    18273 +    do while ((rc = 0) & (lines(sInFile) > 0))
    18274 +        /*
    18275 +         * Read the line and look for state change.
    18276 +         */
    18277 +        sLine = linein(sInFile);
    18278 +        sNewState = vac40ProbeState(sState, sLine);
    18279 +
    18280 +        /*
    18281 +         * State switch.
    18282 +         */
    18283 +        select
    18284 +            /*
    18285 +             * First line.
    18286 +             */
    18287 +            when (sState = 'Init') then
    18288 +            do
    18289 +                if (pos('Link Map...', sLine) <= 0) then
    18290 +                do
    18291 +                    say 'error: Not VAC40 map file.'
    18292 +                    rc = 1;
    18293 +                end
    18294 +
    18295 +                call lineout sOutFile, '';
    18296 +                sModName = translate(filespec('name',sInFile));
    18297 +                if (lastpos('.', sModName) > 0) then sModName = left(sModName, lastpos('.', sModName) - 1);
    18298 +                call lineout sOutFile, ' '||sModName;
    18299 +                call lineout sOutFile, '';
    18300 +                sNewState = 'AnyState';
    18301 +            end
    18302 +
    18303 +            /*
    18304 +             * Segments - let's try copy then raw.
    18305 +             */
    18306 +            when ((sNewState = 'Segments') | (sState = 'Segments')) then
    18307 +            do
    18308 +                if (sState <> 'Segments') then
    18309 +                do
    18310 +                    sSegment = '';
    18311 +                    cbSegment = 0;
    18312 +                    call lineout sOutFile, ' Start         Length     Name                   Class'
    18313 +                end
    18314 +                else
    18315 +                do
    18316 +                    if (pos('at offset', sLine) > 0) then
    18317 +                    do  /*
    18318 +                         * At offset line:
    18319 +                            *          at offset 000006A8 bytes 00006H for "@197"
    18320 +                         */
    18321 +                         parse var sLine . 'offset' sOffset 'bytes' sLength'H' . .
    18322 +                         /*say 'off='sOffset 'len='sLength 'line:' left(sLine, 40);*/
    18323 +                         cbSegment = HexToDec(sOffset) + HexToDec(sLength);
    18324 +                    end
    18325 +                    else if ( (sNewState = 'Segments') & (sSegment = ''),
    18326 +                             & (strip(sLine) <> '') & (pos(':', sLine) > 0) ) then
    18327 +                    do  /*
    18328 +                         * New segment.
    18329 +                         */
    18330 +                        /*say 'NewSeg:' sLine*/
    18331 +                        sSegment = sLine;
    18332 +                    end
    18333 +                    else if ((strip(sLine) = '') & (sSegment <> '')) then
    18334 +                    do  /*
    18335 +                         * Time to write segment line:
    18336 +                         *    0001:00000000            DATA32          DATA
    18337 +                         */
    18338 +                        sSegment = translate(sSegment, ' ', '09'x);
    18339 +                        parse var sSegment iSeg':'iSegOffset sSegName sSegClass
    18340 +                        /*say 'SegLn: seg='iSeg 'off='iSegOffset 'name='sSegName 'class='sSegClass; say sSegment*/
    18341 +                        if (length(sSegName) < 22) then sSegName = left(sSegName, 22, ' ');
    18342 +                        call lineout sOutFile, ' '||strip(iSeg)':'iSegOffset right(DecToHex(cbSegment), 9, '0'),
    18343 +                                     ||'H     '||sSegName||' '||strip(sSegClass);
    18344 +                        sSegment = '';
    18345 +                        cbSegment = 0;
    18346 +                    end
    18347 +                end
    18348 +            end
    18349 +
    18350 +            /*
    18351 +             * Publics by value - filter out some of the stupid stuff.
    18352 +             */
    18353 +            when ((sNewState = 'PublicValue') | (sState = 'PublicValue')) then
    18354 +            do
    18355 +                if (sState = sNewState) then
    18356 +                do
    18357 +                    sLine = translate(sLine, '', '"'||d2c(9));
    18358 +                    if ((strip(sLine) <> '') & (pos('|', sLine) <= 0) & (pos('@', sLine) <= 0)) then
    18359 +                        call lineout sOutFile, ' '||word(sLine, 1)||'       '||word(sLine, 2);
    18360 +                end
    18361 +                else if (sNewState = 'PublicValue') then
    18362 +                do  /* first call */
    18363 +                    call lineout sOutFile, '';
    18364 +                    call lineout sOutFile, '  Address         Publics by Value';
    18365 +                end
    18366 +            end
    18367 +
    18368 +            /*
    18369 +             * Entry pointe - raw copy.
    18370 +             */
    18371 +            when (sNewState = 'EntryPoint') then
    18372 +            do
    18373 +                call lineout sOutFile, '';
    18374 +                call lineout sOutFile, sLine;
    18375 +                sNewState = 'Stop';
    18376 +            end
    18377 +
    18378 +            /*
    18379 +             * Got to next state.
    18380 +             */
    18381 +            when (sState = 'AnyState') then
    18382 +            do
    18383 +                if (strip(sLine) = '') then
    18384 +                    iterate;
    18385 +                if (sNewState = sState) then
    18386 +                do
    18387 +                    say 'state error, bad input?';
    18388 +                    rc = 2;
    18389 +                end
    18390 +            end
    18391 +
    18392 +            /*
    18393 +             * Skips till we hit a new state.
    18394 +             */
    18395 +            when (sState = 'Skip') then
    18396 +                nop;
    18397 +            /* debug */
    18398 +            when ((sState = 'ImportsName') | (sState = 'PublicNames') | (sState = 'ImportLibs') | (sState = 'ConstDest')) then
    18399 +                nop;
    18400 +
    18401 +            /*
    18402 +             * Final.
    18403 +             */
    18404 +            when (sState = 'Stop') then
    18405 +                leave;
    18406 +
    18407 +            /*
    18408 +             * Should not happen.
    18409 +             */
    18410 +            otherwise
    18411 +            do
    18412 +                say 'bad state, sState='sState;
    18413 +                rc = 3;
    18414 +            end
    18415 +        end /* select */
    18416 +
    18417 +        /*
    18418 +         * next state
    18419 +         */
    18420 +        /*say 'state debug:' sState '->' sNewState 'ln:' left(sLine, 40)*/
    18421 +        sState = sNewState;
    18422 +    end /* do while */
    18423 +
    18424 +    /*
    18425 +     * cleanup.
    18426 +     */
    18427 +    call stream sOutFile, 'c', 'close'
    18428 +    call stream sMapfile, 'c', 'close'
    18429 +
    18430 +return rc;
    18431 +
    18432 +
    18433 +/**
    18434 + * Checks if this line is recognizes as a state change line.
    18435 + * @returns New state.
    18436 + * @param   sState      The current state.
    18437 + * @param   sLine       The input line we're processing.
    18438 + */
    18439 +vac40ProbeState: procedure
    18440 +    parse arg sState, sLine
    18441 +    select
    18442 +        when (pos('...Options...', sLine) > 0)              then sState = 'Skip';
    18443 +        when (pos('...Segments...', sLine) > 0)             then sState = 'Segments';
    18444 +        when (pos('...Constructor/Destructor pairs to run...', sLine) > 0) then sState = 'ConstDest';
    18445 +        when (pos('Imports by name', sLine) > 0)            then sState = 'ImportsName';
    18446 +        when (pos('Publics by name', sLine) > 0)            then sState = 'PublicNames';
    18447 +        when (pos('Publics by value', sLine) > 0)           then sState = 'PublicValue';
    18448 +        when (pos('...Import library list...', sLine) > 0)  then sState = 'ImportLibs';
    18449 +        when (pos('Line numbers for', sLine) > 0)           then sState = 'Skip';
    18450 +        when (pos('Program entry point', sLine) > 0)        then sState = 'EntryPoint';
    18451 +        otherwise
    18452 +            nop;
    18453 +    end
    18454 +return sState;
    18455 +
    18456 +
    18457 +
    18458 +/**
    18459 + * Converts a hex string (no prefix/postfix) to a decimal value.
    18460 + * @returns decimal value.
    18461 + * @param   sStringHex  Hexstring to convert. (no 0x prefix or H postfix!)
    18462 + * @status  completely implemented.
    18463 + * @author  knut st. osmundsen (bird@anduin.net)
    18464 + */
    18465 +HexToDec: procedure
    18466 +    parse arg sStringHex
    18467 +/*    say 'HexToDec('sStringHex'):' strip(strip(sStringHex), 'L', '0')*/
    18468 +    sStringHex = strip(strip(sStringHex), 'L', '0');
    18469 +    if (sStringHex = '') then
    18470 +        sStringHex = 0;
    18471 +return x2d(sStringHex);
    18472 +
    18473 +
    18474 +/**
    18475 + * Converts a dec string to a hex string.
    18476 + * @returns hex string value.
    18477 + * @param   sStringDec    Decstring to convert.
    18478 + * @status  completely implemented.
    18479 + * @author  knut st. osmundsen (bird@anduin.net)
    18480 + */
    18481 +DecToHex: procedure
    18482 +    parse arg sStringDec
    18483 +    sStringDec = strip(strip(sStringDec), 'L', '0');
    18484 +    if (sStringDec = '') then
    18485 +        sStringDec = 0;
    18486 +return d2x(sStringDec);
    18487 +
    18488 +
    18489 +/* SCCSID = %W% %E% */
    18490 +/****************************************************************************
    18491 + *                                                                          *
    18492 + * Copyright (c) IBM Corporation 1994 - 1997.                               *
    18493 + *                                                                          *
    18494 + * The following IBM OS/2 source code is provided to you solely for the     *
    18495 + * the purpose of assisting you in your development of OS/2 device drivers. *
    18496 + * You may use this code in accordance with the IBM License Agreement       *
    18497 + * provided in the IBM Device Driver Source Kit for OS/2.                   *
    18498 + *                                                                          *
    18499 + ****************************************************************************/
    18500 +/**@internal %W%
    18501 + * WAT2MAP - translate symbol map from Watcom format to MS format.
    18502 + * @version %I%
    18503 + * @context
    18504 + *  Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
    18505 + * @notes
    18506 + *  Usage:  WAT2MAP <watcom_mapfile >ms_mapfile
    18507 + *               - or -
    18508 + *          type watcom_mapfile | WAT2MAP >ms_mapfile
    18509 + *
    18510 + *          Reads from stdin, writes to stdout.  Will accept the Watcom map filename
    18511 + *          as an argument (in place of reading from stdin).  Eg.,
    18512 + *
    18513 + *          WAT2MAP watcom_mapfile >ms_mapfile
    18514 + *
    18515 + *  Notes:
    18516 + *    1.)  The symbol handling in the debug kernel won't work for some of the
    18517 + *         characters used in the C++ name space.  WAT2MAP handles these symbols
    18518 + *         as follows.
    18519 + *             Scoping operator symbol '::' is translated to '__'.
    18520 + *             Destructor symbol '~' is translated to 'd'.
    18521 + *             Symbols for operators '::operator' are not provided.
    18522 + *
    18523 + *         Eg., for user defined class 'A', the symbol for constructor A::A is
    18524 + *         translated to A__A, and the destructor symbol A::~A becomes A__dA, and
    18525 + *         the assignment operator, 'A::operator =', is not translated.
    18526 + *
    18527 + *    2.)  Bug - C++ provides for defining multiple functions with same fn name
    18528 + *         but different function signatures (different parameter lists).  This
    18529 + *         utility just translates all the address / symbol combinations it finds,
    18530 + *         so you can end up with several addresses for a given fn name.
    18531 + * @history
    18532 +*/
    18533 +/* <End of helpText> - don't modify this string - used to flag end of help. */
    18534 +/****************************************************************************/
    18535 +
    18536 +wat2map: procedure
    18537 +Parse Arg arg1, arg2
    18538 +If (Length( arg1 ) = 0) | (Verify( arg1, '/-?' ) = 0) Then Do;
    18539 +   Do i = 1 to 1000
    18540 +      helpText = Sourceline(i)
    18541 +      If Pos( '<End of helpText>', helpText ) <> 0 Then Leave;       /* quit loop */
    18542 +      Say helpText
    18543 +   End;
    18544 +   Return 1
    18545 +End;
    18546 +If Length( arg2 ) = 0 Then Do;
    18547 +   Say " Way to go Beaver... How about an out-put file name ?"
    18548 +   Return 2
    18549 +End;
    18550 +mapFile = arg1          /* Can be Null, in which case we pull from stdin. */
    18551 +outFile = arg2
    18552 +fFlatMode = 0;
    18553 +
    18554 +/* erase outfile */  /* kill the old map file */
    18555 +rc=SysFileDelete(outfile)
    18556 +
    18557 +
    18558 +/*--- 1.  Find & translate module name.  ---*/
    18559 +Do While Lines( mapFile ) <> 0
    18560 +   watcomText = LineIn( mapFile )
    18561 +   /*Parse Value watcomText With "Executable Image: " fileName "." fileExt*/
    18562 +   Parse Value watcomText With "Executable Image: " sFilename
    18563 +   If (sFilename <> '') Then Do;
    18564 +      sFilename = filespec('name', sFilename);
    18565 +      Parse Var sFilename fileName "." fileExt
    18566 +      If fileName <> "" Then Do;   /* Found match */
    18567 +         call lineout outfile ,' '
    18568 +         call lineout outfile ,' ' || fileName
    18569 +         call lineout outfile ,' '
    18570 +         Leave;                    /* Break from loop. */
    18571 +      End;
    18572 +   End;
    18573 +End
    18574 +If Lines( mapFile ) = 0 Then Do;        /* If end of file ... */
    18575 +   Say "Error:  Expected to find line with text 'Executable Image:' "
    18576 +   Return 3
    18577 +End
    18578 +
    18579 +/*--- 2.  Skip the group definitions - Rob's notes say we don't need them. -*/
    18580 +
    18581 +/*--- 3.  Skip to the start of the segment table.  ---*/
    18582 +Do While Lines( mapFile ) <> 0
    18583 +   watcomText = LineIn( mapFile )
    18584 +   Parse Value watcomText With "Segment" header_2_3 "Address" header_5
    18585 +   If Strip( header_5 ) = "Size" Then Leave;      /* Found header line for Segment table. */
    18586 +End
    18587 +If Lines( mapFile ) = 0 Then Do;        /* If end of file ... */
    18588 +   Say "Error:  Expected to find line with text 'Segments ... Size' "
    18589 +   Return 4
    18590 +End
    18591 +
    18592 +
    18593 +junk = LineIn( mapFile )      /* Discard a couple lines of formatting. */
    18594 +junk = LineIn( mapFile )      /* Discard a couple lines of formatting. */
    18595 +/*--- 4.  Translate segment table.  ---*/
    18596 +/*"Segment                Class          Group          Address         Size"*/
    18597 +iClass = pos('Class', watcomText);
    18598 +iGroup = pos('Group', watcomText);
    18599 +iAddress = pos('Address', watcomText);
    18600 +iSize = pos('Size', watcomText);
    18601 +
    18602 +call lineout outfile , " Start         Length     Name                   Class"  /* bird bird bird fixed!!! */
    18603 +Do While Lines( mapFile ) <> 0
    18604 +   watcomText = LineIn( mapFile )
    18605 +   /* do it the hard way to make sure we support spaces segment names. */
    18606 +   segName = strip(substr(watcomText, 1, iClass-1));
    18607 +   If segName = "" Then Leave;          /* Empty line, break from loop. */
    18608 +   className = strip(substr(watcomText, iClass, iGroup-iClass));
    18609 +   groupName = strip(substr(watcomText, iGroup, iAddress-iGroup));
    18610 +   address = strip(substr(watcomText, iAddress, iSize-iAddress));
    18611 +   size = strip(substr(watcomText, iSize));
    18612 +   if (pos(':', address) <= 0) then     /* NT binaries doesn't have a segment number. */
    18613 +   do
    18614 +      fFlatMode = 1;
    18615 +      address = '0001:'||address;
    18616 +   end
    18617 +   length = right(strip(strip(size), 'L', '0'), 9, '0') || 'H     '
    18618 +   segName = Left( segName, 23 )
    18619 +   call lineout outfile ,' ' || address || ' ' || length || segName || className
    18620 +End
    18621 +call lineout outfile ,' '     /* Extra line feed. */
    18622 +
    18623 +
    18624 +/*--- 5.  For all remaining lines in the input file:  if the line starts
    18625 +   with a 16:16 address, assume it's a symbol declaration and translate
    18626 +   it into MS format.  ---*/
    18627 +
    18628 +call lineout outfile ,'  Address         Publics by Value'
    18629 +/* call lineout outfile ,' '*/
    18630 +
    18631 +Do While Lines( mapFile ) <> 0
    18632 +   watcomText = LineIn( mapFile )
    18633 +   Parse Value watcomText With seg ':' ofs 14 . 16 declaration
    18634 +   if (fFlatMode) then
    18635 +   do
    18636 +      seg = '0001';
    18637 +      Parse Value watcomText With ofs 9 . 16 declaration
    18638 +   end
    18639 +   else
    18640 +   do  /* kso: more workarounds */
    18641 +       if (is_Hex(seg) & length(ofs) > 4 & \is_Hex(substr(ofs,5,1))) then
    18642 +           ofs = '0000'||left(ofs,4);
    18643 +   end
    18644 +   /*say ofs  '-'declaration*/
    18645 +   is_Adress = (is_Hex(seg) = 1) & (is_Hex(ofs) = 1)
    18646 +   If ((is_Adress = 1) & (seg <> '0000')) Then Do;          /* bird: skip symbols with segment 0. (__DOSseg__) */
    18647 +      /*--- Haven't done the work to xlate operator symbols - skip the line. */
    18648 +      If Pos( '::operator', declaration ) <> 0 Then Iterate;
    18649 +
    18650 +      /*--- Strip any arguement list if this is a function prototype.  */
    18651 +      declaration = StripMatchedParen( declaration )
    18652 +
    18653 +      /*--- Strip array brackets if this is an array. */
    18654 +      sqBracket = Pos( '[', declaration )
    18655 +      If sqBracket <> 0
    18656 +         Then declaration = Substr(declaration, 1, sqBracket-1);
    18657 +
    18658 +      /*--- Strip leading tokens from the function name.
    18659 +         Eg., remove function return type, near/far, etc.  */
    18660 +      declaration = Word( declaration, Words(declaration) )
    18661 +
    18662 +      /*--- Strip any remaining parens around function name. ---*/
    18663 +      declaration = ReplaceSubstr( '(', ' ', declaration )
    18664 +      declaration = ReplaceSubstr( ')', ' ', declaration )
    18665 +
    18666 +      /*--- Debug kernel doesn't like symbol for scoping operator "::"
    18667 +         in symbol names.  Replace :: with double underscore "__". ---*/
    18668 +      declaration = ReplaceSubstr( '::', '__', declaration )
    18669 +
    18670 +      /*--- Debug kernel doesn't like symbol for destructor "~"
    18671 +         in symbol names.  Replace ~ with character "d" for "destructor.
    18672 +         Note destructor for a class will translate "A::~A" -> "A__dA". ---*/
    18673 +      declaration = ReplaceSubstr( '~', 'd', declaration )
    18674 +
    18675 +      call lineout outfile ,' ' || seg || ':' || ofs || '       ' || declaration
    18676 +   End;
    18677 +
    18678 +   /* check for entry point, if found we add it and quit. */
    18679 +   if (pos('Entry point address', watcomText) > 0) then
    18680 +   do
    18681 +       parse var watcomText 'Entry point address:' sEntryPoint
    18682 +       if (pos(':', sEntryPoint) <= 0) then
    18683 +           sEntryPoint = '0001:'||strip(sEntryPoint);
    18684 +       call lineout outfile, ''
    18685 +       call lineout outfile, 'Program entry point at' strip(sEntryPoint)
    18686 +       leave;
    18687 +   end
    18688 +End; /* End While through symbol section, end of input file. */
    18689 +
    18690 +call stream outfile, 'c', 'close';
    18691 +call stream mapfile, 'c', 'close';
    18692 +
    18693 +Return 0;  /* End of program.  */
    18694 +
    18695 +/*--- Helper subroutines. ---*/
    18696 +
    18697 +StripMatchedParen:
    18698 +/* Strips matched "( )" from end of string.  Returns
    18699 +   a substring with the trailing, matched parens deleted. */
    18700 +
    18701 +   Parse Arg string
    18702 +
    18703 +   ixOpenParen = LastPos( "(", string );
    18704 +   ixCloseParen = LastPos( ")", Substr( string, 1, Length(string)-1 ));
    18705 +
    18706 +   If (ixOpenParen = 0)                     /* No match. */
    18707 +      Then Return string
    18708 +   Else If ixCloseParen < ixOpenParen       /* Found match, no imbedded "()". */
    18709 +      Then Return Substr( string, 1, ixOpenParen-1 )
    18710 +   Else Do;                                 /* Imbedded (), must skip over them. */
    18711 +      /* Parse Value string With first ixCloseParen+1 rest */
    18712 +      first = Substr( string, 1, ixCloseParen)
    18713 +      rest = Substr( string, ixCloseParen+1 )
    18714 +      string = StripMatchedParen( first ) || rest
    18715 +      Return StripMatchedParen( string )
    18716 +   End;
    18717 +End;
    18718 +
    18719 +ReplaceSubstr:
    18720 +/* Replaces oldPat (old pattern) with newPat (new pattern) in string. */
    18721 +
    18722 +   Parse Arg oldPat , newPat , string
    18723 +
    18724 +   ix = Pos( oldPat, string )
    18725 +   if ix <> 0 Then Do;
    18726 +      first = Substr( string, 1, ix-1 )
    18727 +      rest  = Substr( string, ix + Length( oldPat ) )
    18728 +      string = first || newPat || rest
    18729 +   End;
    18730 +   Return string
    18731 +End;
    18732 +
    18733 +is_Hex:
    18734 +/* Returns 1 if String is valid hex number, 0 otherwise. */
    18735 +   Parse Arg string
    18736 +   Return (Length(string) > 0) &  (Verify( string, '0123456789abcdefABCDEF' ) = 0)
    18737 +End;
    18738 +
    18739 diff --git a/tools/bin/PreloadTools.cmd b/tools/bin/PreloadTools.cmd
    18740 index 18af127..c9755fc 100644
    18741 --- a/tools/bin/PreloadTools.cmd
    18742 +++ b/tools/bin/PreloadTools.cmd
    18743 @@ -1,46 +1,46 @@
    18744 -/* $Id: PreloadTools.cmd,v 1.2 2001-12-19 01:50:06 bird Exp $
    18745 - *
    18746 - * Preloads all the tools which we might turn into using.
    18747 - * Specify '-u' to unload the tools.
    18748 - */
    18749 -'@echo off'
    18750 -
    18751 -/*
    18752 - * Parse argument(s).
    18753 - */
    18754 -parse arg '-'chUnload
    18755 -
    18756 -sEmxloadArgs = '-e';
    18757 -if (translate(substr(chUnload,1,1)) = 'U') then
    18758 -    sEmxloadArgs = '-u';
    18759 -
    18760 -
    18761 -/*
    18762 - * Find the tools directory.
    18763 - */
    18764 -parse source sOS sCMD sSrc;
    18765 -sToolsDir = filespec('drive', sSrc) || filespec('path', sSrc); /* with slash */
    18766 -
    18767 -
    18768 -/*
    18769 - * Do the preloading or unloading.
    18770 - */
    18771 -'emxload' sEmxloadArgs 'rm.exe';
    18772 -'emxload' sEmxloadArgs,
    18773 -    sToolsDir'impdef.exe',
    18774 -    sToolsDir'lxlite.exe',
    18775 -    sToolsDir'fastdep.exe',
    18776 -    sToolsDir'wrc.exe';
    18777 -
    18778 -/*
    18779 - * Compiler specific stuff.
    18780 - */
    18781 -sCCEnv = translate(value('CCENV',,'OS2ENVIRONMENT'));
    18782 -if (sCCEnv = '') then sCCenv = 'VAC3';
    18783 -
    18784 -/* Visual Age */
    18785 -if ((sCCEnv = 'VAC3') | (sCCEnv = 'VAC36')) then
    18786 -    'emxload' sEmxloadArgs 'implib.exe ilib.exe nmake.exe alp.exe rc.exe';
    18787 -
    18788 -
    18789 -
    18790 +/* $Id: PreloadTools.cmd,v 1.2 2001-12-19 01:50:06 bird Exp $
    18791 + *
    18792 + * Preloads all the tools which we might turn into using.
    18793 + * Specify '-u' to unload the tools.
    18794 + */
    18795 +'@echo off'
    18796 +
    18797 +/*
    18798 + * Parse argument(s).
    18799 + */
    18800 +parse arg '-'chUnload
    18801 +
    18802 +sEmxloadArgs = '-e';
    18803 +if (translate(substr(chUnload,1,1)) = 'U') then
    18804 +    sEmxloadArgs = '-u';
    18805 +
    18806 +
    18807 +/*
    18808 + * Find the tools directory.
    18809 + */
    18810 +parse source sOS sCMD sSrc;
    18811 +sToolsDir = filespec('drive', sSrc) || filespec('path', sSrc); /* with slash */
    18812 +
    18813 +
    18814 +/*
    18815 + * Do the preloading or unloading.
    18816 + */
    18817 +'emxload' sEmxloadArgs 'rm.exe';
    18818 +'emxload' sEmxloadArgs,
    18819 +    sToolsDir'impdef.exe',
    18820 +    sToolsDir'lxlite.exe',
    18821 +    sToolsDir'fastdep.exe',
    18822 +    sToolsDir'wrc.exe';
    18823 +
    18824 +/*
    18825 + * Compiler specific stuff.
    18826 + */
    18827 +sCCEnv = translate(value('CCENV',,'OS2ENVIRONMENT'));
    18828 +if (sCCEnv = '') then sCCenv = 'VAC3';
    18829 +
    18830 +/* Visual Age */
    18831 +if ((sCCEnv = 'VAC3') | (sCCEnv = 'VAC36')) then
    18832 +    'emxload' sEmxloadArgs 'implib.exe ilib.exe nmake.exe alp.exe rc.exe';
    18833 +
    18834 +
    18835 +
    18836 diff --git a/tools/bin/StateUpd.cmd b/tools/bin/StateUpd.cmd
    18837 index 84e02eb..15f031f 100644
    18838 --- a/tools/bin/StateUpd.cmd
    18839 +++ b/tools/bin/StateUpd.cmd
    18840 @@ -1,46 +1,46 @@
    18841 -/* $Id: StateUpd.cmd,v 1.4 2000-08-02 20:25:50 bird Exp $
    18842 - *
    18843 - * Helper script which invokes StateUpd.cmd.
    18844 - * This was created to hold special rules for dirs like OpenGl.
    18845 - *
    18846 - * Copyright (c) 2000 knut st. osmundsen
    18847 - *
    18848 - */
    18849 -    /* find (possible) dll name from directory name */
    18850 -    sDllName = filespec('name', directory());
    18851 -
    18852 -    /* find StateUpd exe path assuming it's in the same dir as this script. */
    18853 -    parse source sD1 sD2 sSrc;
    18854 -    sSrc = filespec('drive', sSrc) || filespec('path', sSrc);
    18855 -    sStateUpd = sSrc||'StateUpd.exe';
    18856 -
    18857 -    /* parse arguments */
    18858 -    parse arg sAllArgs
    18859 -
    18860 -    /* apecial cases and general case */
    18861 -    if (translate(sDllName) = 'OPENGL') then
    18862 -    do
    18863 -        /* save dir and change dir into mesa */
    18864 -        /*sOldDir = directory();
    18865 -        call directory('mesa'); */
    18866 -
    18867 -        /* execute update  */
    18868 -        sStateUpd || ' -dll:opengl32 -s ' || sAllArgs;
    18869 -        lRc = rc;
    18870 -
    18871 -        /* restore dir */
    18872 -        /*call directory sOldDir;*/
    18873 -    end
    18874 -    else if (translate(sDllName) = 'WNETAP32') then
    18875 -    do
    18876 -        /* execute update  */
    18877 -        sStateUpd || ' -dll:netapi32 ' || sAllArgs;
    18878 -        lRc = rc;
    18879 -    end
    18880 -    else
    18881 -    do
    18882 -        /* execute update  */
    18883 -        sStateUpd || ' ' || sAllArgs;
    18884 -        lRc = rc;
    18885 -    end
    18886 -    exit(lRc);
    18887 +/* $Id: StateUpd.cmd,v 1.4 2000-08-02 20:25:50 bird Exp $
    18888 + *
    18889 + * Helper script which invokes StateUpd.cmd.
    18890 + * This was created to hold special rules for dirs like OpenGl.
    18891 + *
    18892 + * Copyright (c) 2000 knut st. osmundsen
    18893 + *
    18894 + */
    18895 +    /* find (possible) dll name from directory name */
    18896 +    sDllName = filespec('name', directory());
    18897 +
    18898 +    /* find StateUpd exe path assuming it's in the same dir as this script. */
    18899 +    parse source sD1 sD2 sSrc;
    18900 +    sSrc = filespec('drive', sSrc) || filespec('path', sSrc);
    18901 +    sStateUpd = sSrc||'StateUpd.exe';
    18902 +
    18903 +    /* parse arguments */
    18904 +    parse arg sAllArgs
    18905 +
    18906 +    /* apecial cases and general case */
    18907 +    if (translate(sDllName) = 'OPENGL') then
    18908 +    do
    18909 +        /* save dir and change dir into mesa */
    18910 +        /*sOldDir = directory();
    18911 +        call directory('mesa'); */
    18912 +
    18913 +        /* execute update  */
    18914 +        sStateUpd || ' -dll:opengl32 -s ' || sAllArgs;
    18915 +        lRc = rc;
    18916 +
    18917 +        /* restore dir */
    18918 +        /*call directory sOldDir;*/
    18919 +    end
    18920 +    else if (translate(sDllName) = 'WNETAP32') then
    18921 +    do
    18922 +        /* execute update  */
    18923 +        sStateUpd || ' -dll:netapi32 ' || sAllArgs;
    18924 +        lRc = rc;
    18925 +    end
    18926 +    else
    18927 +    do
    18928 +        /* execute update  */
    18929 +        sStateUpd || ' ' || sAllArgs;
    18930 +        lRc = rc;
    18931 +    end
    18932 +    exit(lRc);
    18933 diff --git a/tools/bin/buildenv.cmd b/tools/bin/buildenv.cmd
    18934 index 33ab8a8..3600e03 100644
    18935 --- a/tools/bin/buildenv.cmd
    18936 +++ b/tools/bin/buildenv.cmd
    18937 @@ -1,4259 +1,4259 @@
    18938 -/* $Id: buildenv.cmd,v 1.59 2006-03-31 21:47:03 bird Exp $
    18939 - *
    18940 - * This is the master tools environment script. It contains environment
    18941 - * configurations for many development tools. Each tool can be installed
    18942 - * and uninstalled from the environment interchangably.
    18943 - *
    18944 - * Note:    Of historic reasons, there are some environments here which
    18945 - *          isn't normally used by normal code trees.
    18946 - *
    18947 - *
    18948 - * Known problems:
    18949 - *     - LANG is set to en_US by both VAC36 and TOOLKIT45. When unsetting
    18950 - *       those the original value, for example of no_NO, is not restored.
    18951 - *     - Same goes for some other stuff, we have no stack of previous values.
    18952 - *
    18953 - * Copyright (c) 1999-2005 knut st. osmundsen (bird@anduin.net)
    18954 - *
    18955 - * GPL v2
    18956 - *
    18957 - */
    18958 -
    18959 -    Address CMD '@echo off';
    18960 -
    18961 -    signal on novalue name NoValueHandler
    18962 -
    18963 -    /*
    18964 -     * Version
    18965 -     */
    18966 -    sVersion = '1.1.4 [2005-12-18]';
    18967 -
    18968 -    /*
    18969 -     * Create argument array with lowercase arguments.
    18970 -     */
    18971 -    parse arg sEnv.1 sEnv.2 sEnv.3 sEnv.4 sEnv.5 sEnv.6 sEnv.7 sEnv.8 sEnv.9 sEnv.10 sEnv.11 sEnv.12 sEnv.13 sEnv.14 sEnv.15 sEnv.16 sEnv.17 sEnv.18 sEnv.19 sEnv.20 sEnv.21 sEnv.22 sEnv.23
    18972 -
    18973 -    i = 1;
    18974 -    do while (sEnv.i <> '')
    18975 -        sEnv.i = translate(strip(sEnv.i), 'abcdefghijklmnopqrstuvwxyz‘›†', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ’');
    18976 -        i = i + 1;
    18977 -    end
    18978 -    sEnv.0 = i - 1;
    18979 -
    18980 -    /*
    18981 -     * Syntax
    18982 -     */
    18983 -    if (sEnv.0 = 0) then
    18984 -    do
    18985 -        say 'BuildEnv v'||sVersion
    18986 -        say '-------------------------------'
    18987 -        say ''
    18988 -        say 'Synopsis: Environment configuration utility written to maintain'
    18989 -        say 'many different versions of compilers and toolkits on the same'
    18990 -        say 'workstation. '
    18991 -        say ''
    18992 -        say 'Syntax: BuildEnv.cmd <environments>[action]'
    18993 -        say ''
    18994 -        say 'Actions:'
    18995 -        say '   +   Install tool in environment. Default action.'
    18996 -        say '   ~   Install tool in environment if it''s configured.'
    18997 -        say '   -   Remove tool from environment.'
    18998 -        say '   õ   Remove tool from environment if it''s configured.'
    18999 -        say '   *   Configure tool if needed.'
    19000 -        say '   !   Forced tool configuretion.'
    19001 -        say '   @   Verify tool configuration.'
    19002 -        say '   ?   Query if a tool is configured.'
    19003 -        say ''
    19004 -        say 'Special environments (commands):'
    19005 -        say '   allconfig       Configure all tools which fails verify.'
    19006 -        say '   allreconfig     Reconfigure all tools.'
    19007 -        say '   allverify       Verify all configured tools.'
    19008 -        say '   alluninstall    Removed all configured tools from environment.'
    19009 -        say '   showall         Show all tools.'
    19010 -        say '   showconfigured  Show all configured tools.'
    19011 -        say '   shownotconfigured   Show all tools which isn''t configured.'
    19012 -        say ''
    19013 -        say 'Copyright (c) 1999-2003 knut st. osmundsen'
    19014 -        say 'Published under GPL v2'
    19015 -        return 8;
    19016 -    end
    19017 -
    19018 -    /*
    19019 -     * Load REXX Util Functions.
    19020 -     * (Need Sys[Query|Set]ExtLibPath.)
    19021 -     */
    19022 -    if (RxFuncQuery('SysLoadFuncs') = 1) then
    19023 -    do
    19024 -        call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    19025 -        call SysLoadFuncs;
    19026 -    end
    19027 -
    19028 -
    19029 -    /*
    19030 -     * Apply CMD.EXE workaround.
    19031 -     */
    19032 -    call FixCMDEnv;
    19033 -
    19034 -
    19035 -    /*
    19036 -     * Configuration - sorted please!
    19037 -     */
    19038 -    aPath.0 = 0;
    19039 -
    19040 -    i = 1;
    19041 -    /* Tool id                      The tool's group            The function with args.                 Optional verify data.                       increment index */
    19042 -    aCfg.i.sId = 'cvs';             aCfg.i.sGrp = 'version';    aCfg.i.sSet = 'CVS';                    aCfg.i.sDesc = 'CVS v1.10 or later';        i = i + 1;
    19043 -    aCfg.i.sId = 'db2v52';          aCfg.i.sGrp = 'database';   aCfg.i.sSet = 'db2v52';                 aCfg.i.sDesc = 'DB2 v5.2 Dev Edition';      i = i + 1;
    19044 -    aCfg.i.sId = 'ddk';             aCfg.i.sGrp = 'ddk';        aCfg.i.sSet = 'DDK';                    aCfg.i.sDesc = 'OS/2 DDK (recent)';         i = i + 1;
    19045 -    aCfg.i.sId = 'ddkbase';         aCfg.i.sGrp = 'ddk';        aCfg.i.sSet = 'DDKBase';                aCfg.i.sDesc = 'DDK Base (recent)';         i = i + 1;
    19046 -    aCfg.i.sId = 'ddkvideo';        aCfg.i.sGrp = 'ddk';        aCfg.i.sSet = 'DDKVideo';               aCfg.i.sDesc = 'DDK Video (recent)';        i = i + 1;
    19047 -    aCfg.i.sId = 'doxygen';         aCfg.i.sGrp = 'doc';        aCfg.i.sSet = 'DoxyGen';                aCfg.i.sDesc = 'Doxygen v1.2.11 for OS/2';        i = i + 1;
    19048 -    aCfg.i.sId = 'emx';             aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'EMX';                    aCfg.i.sDesc = 'EMX v0.9d fixpack 04';      i = i + 1;
    19049 -    aCfg.i.sId = 'emxpgcc';         aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'EMXPGCC';                aCfg.i.sDesc = 'Pentium Optimized GCC/EMX v1.1.1 r2 with binutils 2.9.1'; i = i + 1;
    19050 -    aCfg.i.sId = 'freetypeemx';     aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'FreeTypeEMX';            aCfg.i.sDesc = 'FreeType v1.3.1 for EMX.'; i = i + 1;
    19051 -    aCfg.i.sId = 'gcc302';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC3xx,''gcc302''';      aCfg.i.sDesc = 'GCC/EMX v3.0.2beta with binutils 2.11.2'; i = i + 1;
    19052 -    aCfg.i.sId = 'gcc303';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC3xx,''gcc303''';      aCfg.i.sDesc = 'GCC/EMX v3.0.3beta with binutils 2.11.2'; i = i + 1;
    19053 -    aCfg.i.sId = 'gcc321';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC3xx,''gcc321''';      aCfg.i.sDesc = 'GCC/EMX v3.2.1beta with binutils 2.11.2'; i = i + 1;
    19054 -    aCfg.i.sId = 'gcc322';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc322''';  aCfg.i.sDesc = 'Innotek GCC v3.2.2';        i = i + 1;
    19055 -    aCfg.i.sId = 'gcc334';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc334''';  aCfg.i.sDesc = 'Innotek GCC v3.3.4';        i = i + 1;
    19056 -    aCfg.i.sId = 'gcc335';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc335''';  aCfg.i.sDesc = 'Innotek GCC v3.3.4';        i = i + 1;
    19057 -    aCfg.i.sId = 'gcc343';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc343''';  aCfg.i.sDesc = 'Innotek GCC v3.4.3';        i = i + 1;
    19058 -    aCfg.i.sId = 'icatgam';         aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'ICATGam';                aCfg.i.sDesc = 'ICAT for OS/2 latest';      i = i + 1;
    19059 -    aCfg.i.sId = 'icatgam406rc1';   aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'ICATGam406RC1';          aCfg.i.sDesc = 'ICAT for OS/2 v4.0.6 release candidate 1'; i = i + 1;
    19060 -    aCfg.i.sId = 'icatpe';          aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'ICATPe';                 aCfg.i.sDesc = 'ICAT for OS/2 with PE support (test version)'; i = i + 1;
    19061 -    aCfg.i.sId = 'ida';             aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA414';                 aCfg.i.sDesc = 'Interactive DisAssembler (IDA) (latest)'; i = i + 1;
    19062 -    aCfg.i.sId = 'ida38';           aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA38';                  aCfg.i.sDesc = 'Interactive DisAssembler (IDA) v3.80 (historical)'; i = i + 1;
    19063 -    aCfg.i.sId = 'ida40';           aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA40';                  aCfg.i.sDesc = 'Interactive DisAssembler (IDA) v4.0 (historical)'; i = i + 1;
    19064 -    aCfg.i.sId = 'ida414';          aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA414';                 aCfg.i.sDesc = 'Interactive DisAssembler (IDA) v4.14'; i = i + 1;
    19065 -    aCfg.i.sId = 'idasdk';          aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDASDK';                 aCfg.i.sDesc = 'Interactive DisAssembler (IDA) SDK'; i = i + 1;
    19066 -    aCfg.i.sId = 'icsdebug';        aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'icsdebug';               aCfg.i.sDesc = 'icsdebug from VAC308'; i = i + 1;
    19067 -    aCfg.i.sId = 'idebug';          aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'idebug';                 aCfg.i.sDesc = 'idebug from VAC365'; i = i + 1;
    19068 -    aCfg.i.sId = 'java131';         aCfg.i.sGrp = 'java';       aCfg.i.sSet = 'Java131';                aCfg.i.sDesc = 'Java v1.3.1 (co131-20020710)'; i = i + 1;
    19069 -    aCfg.i.sId = 'jitdbg';          aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'jitdbg';                 aCfg.i.sDesc = 'jitdbg (secret)'; i = i + 1;
    19070 -    aCfg.i.sId = 'jpeg';            aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'JPEG';                   aCfg.i.sDesc = '(lib)JPEG v6b';             i = i + 1;
    19071 -    aCfg.i.sId = 'mode12050';       aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'Mode,120,50';            aCfg.i.sDesc = 'mode 120,50';               i = i + 1;
    19072 -    aCfg.i.sId = 'mode8050';        aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'Mode,80,50';             aCfg.i.sDesc = 'mode 80,50';                i = i + 1;
    19073 -    aCfg.i.sId = 'mscv6';           aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'MSCV6_32';               aCfg.i.sDesc = 'MicroSoft C v6.0 32-bit';   i = i + 1;
    19074 -    aCfg.i.sId = 'mscv6-16';        aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'MSCV6_16';               aCfg.i.sDesc = 'MicroSoft C v6.0a 16-bit';  i = i + 1;
    19075 -    aCfg.i.sId = 'mscv7-16';        aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'MSCV7_16';               aCfg.i.sDesc = 'MicroSoft C v7.0 16-bit with OS/2 support';  i = i + 1;
    19076 -    aCfg.i.sId = 'mysql';           aCfg.i.sGrp = 'database';   aCfg.i.sSet = 'mySQL';                  aCfg.i.sDesc = 'MySql any version (latest from Yuri is recommended)'; i = i + 1;
    19077 -    aCfg.i.sId = 'nasm9833';        aCfg.i.sGrp = 'asm';        aCfg.i.sSet = 'NASM,''nasm9833''';      aCfg.i.sDesc = 'NASM version 0.98.33 compiled on May 28 2002'; i = i + 1;
    19078 -    aCfg.i.sId = 'netqos2';         aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'NetQOS2';                aCfg.i.sDesc = 'NetQOS2 - help system for VAC40,VAC365,DB2 and more.'; i = i + 1;
    19079 -    aCfg.i.sId = 'odin32testcase';  aCfg.i.sGrp = 'tests';      aCfg.i.sSet = 'Odin32Testcase';         aCfg.i.sDesc = 'Odin32 testcase setup'; i = i + 1;
    19080 -    aCfg.i.sId = 'owc14';           aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'OpenWatcomC14,32,';      aCfg.i.sDesc = 'Open Watcom C/C++ v1.4 32-bit'; i = i + 1;
    19081 -    aCfg.i.sId = 'owc14-16';        aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'OpenWatcomC14,16,';      aCfg.i.sDesc = 'Open Watcom C/C++ v1.4 16-bit'; i = i + 1;
    19082 -    aCfg.i.sId = 'perl';            aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Perl580';                aCfg.i.sDesc = 'Perl v5.8.0'; i = i + 1;
    19083 -    aCfg.i.sId = 'perl580';         aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Perl580';                aCfg.i.sDesc = 'Perl v5.8.0'; i = i + 1;
    19084 -    aCfg.i.sId = 'perl50053';       aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Perl50xxx';              aCfg.i.sDesc = 'Perl v5.0053'; i = i + 1;
    19085 -    aCfg.i.sId = 'python';          aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Python';                 aCfg.i.sDesc = 'Python v1.5'; i = i + 1;
    19086 -    aCfg.i.sId = 'svn';             aCfg.i.sGrp = 'version';    aCfg.i.sSet = 'Subversion';             aCfg.i.sDesc = 'Subversion 1.0.6 or later.';  i = i + 1;
    19087 -    aCfg.i.sId = 'toolkit40';       aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit40';              aCfg.i.sDesc = 'Toolkit v4.0 CSD 4'; i = i + 1;
    19088 -    aCfg.i.sId = 'toolkit40';       aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit40';              aCfg.i.sDesc = 'Toolkit v4.0 CSD 4'; i = i + 1;
    19089 -    aCfg.i.sId = 'toolkit45';       aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit45';              aCfg.i.sDesc = 'Toolkit v4.5'; i = i + 1;
    19090 -    aCfg.i.sId = 'toolkit451';      aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit451';             aCfg.i.sDesc = 'Toolkit v4.5.1'; i = i + 1;
    19091 -    aCfg.i.sId = 'toolkit452';      aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit452';             aCfg.i.sDesc = 'Toolkit v4.5.2'; i = i + 1;
    19092 -    aCfg.i.sId = 'unix';            aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'Unix';                   aCfg.i.sDesc = 'Misc unix stuff.'; i = i + 1;
    19093 -    aCfg.i.sId = 'vac308';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'VAC308';                 aCfg.i.sDesc = 'VisualAge for C++ v3.08'; i = i + 1;
    19094 -    aCfg.i.sId = 'vac365';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'VAC365';                 aCfg.i.sDesc = 'VisualAge for C++ v3.6.5 FP2 with latest optimizer fixes.'; i = i + 1;
    19095 -    aCfg.i.sId = 'vac40';           aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'VAC40';                  aCfg.i.sDesc = 'VisualAge for C++ v4.0 FP2(??)'; i = i + 1;
    19096 -    aCfg.i.sId = 'warpin';          aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'WarpIn';                 aCfg.i.sDesc = 'WarpIn 0.9.18+ (for Odin32 18 with fix is required)'; i = i + 1;
    19097 -    aCfg.i.sId = 'watcomc11';       aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'WatcomC11,32,';          aCfg.i.sDesc = 'Watcom C/C++ v11.0 32-bit (no fixes)'; i = i + 1;
    19098 -    aCfg.i.sId = 'watcomc11-16';    aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'WatcomC11,16';           aCfg.i.sDesc = 'Watcom C/C++ v11.0 16-bit (no fixes)'; i = i + 1;
    19099 -    aCfg.i.sId = 'watcomc11c';      aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'WatcomC11c,32';          aCfg.i.sDesc = 'Watcom C/C++ v11.0c 32-bit (beta)'; i = i + 1;
    19100 -    aCfg.i.sId = 'watcomc11c-16';   aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'WatcomC11c,16';          aCfg.i.sDesc = 'Watcom C/C++ v11.0c 16-bit (beta)'; i = i + 1;
    19101 -    aCfg.0 = i - 1;
    19102 -
    19103 -
    19104 -
    19105 -    /*
    19106 -     * Parse arguments
    19107 -     */
    19108 -    do i = 1 to sEnv.0
    19109 -        /* uses dash to mark end of arguments */
    19110 -        if ((sEnv.i = '-') | (sEnv.i = '*')) then
    19111 -            leave;
    19112 -
    19113 -        /*
    19114 -         * Get last char.
    19115 -         * Dash means remove, pluss means add, asterix means verify and configure.
    19116 -         * Pluss is default and optional.
    19117 -         *
    19118 -         */
    19119 -        ch = substr(sEnv.i, length(sEnv.i), 1);
    19120 -        if (pos(ch, '+~-õ*!?@') > 0) then
    19121 -            sEnv.i = substr(sEnv.i, 1, length(sEnv.i) - 1);
    19122 -        else
    19123 -            ch = '+';
    19124 -        fRM = (ch = '-' | ch = 'õ');
    19125 -        fOptional = (ch = '~' | ch = 'õ')
    19126 -        fCfg = (ch = '*');
    19127 -        fForcedCfg = (ch = '!');
    19128 -        fVerify = (ch = '@')
    19129 -        fQuery = (ch = '?')
    19130 -
    19131 -        /*
    19132 -         * do the switch.
    19133 -         */
    19134 -        rc = 0;
    19135 -        select
    19136 -
    19137 -            /*
    19138 -             * Multi tool operations.
    19139 -             */
    19140 -            when (sEnv.i = 'allconfig') then do
    19141 -                do j = 1 to aCfg.0
    19142 -                    if (CfgVerify(j, 0, 1) <> 0) then
    19143 -                    do
    19144 -                        rc = CfgConfigure(j, 1);
    19145 -                        if (rc >= 8) then
    19146 -                            exit(rc);
    19147 -                    end
    19148 -                end
    19149 -            end
    19150 -
    19151 -            when (sEnv.i = 'allreconfig') then do
    19152 -                do j = 1 to aCfg.0
    19153 -                    rc = CfgConfigure(j, 1);
    19154 -                    if (rc >= 8) then
    19155 -                        exit(rc);
    19156 -                end
    19157 -            end
    19158 -
    19159 -            when (sEnv.i = 'allverify') then do
    19160 -                do j = 1 to aCfg.0
    19161 -                    if (CfgIsConfigured(j)) then
    19162 -                        call CfgVerify j, 0, 1;
    19163 -                end
    19164 -            end
    19165 -
    19166 -            when (sEnv.i = 'alluninstall') then do
    19167 -                do j = 1 to aCfg.0
    19168 -                    if (CfgIsConfigured(j)) then
    19169 -                        call CfgInstallUninstall j, 1;
    19170 -                end
    19171 -            end
    19172 -
    19173 -            when (sEnv.i = 'showall') then do
    19174 -                do j = 1 to aCfg.0
    19175 -                    say left(aCfg.j.sId, 15) '-' left(aCfg.j.sGrp, 8) '-' aCfg.j.sDesc
    19176 -                    sPath = PathQuery(aCfg.j.sId, aCfg.j.sId, 'quietisconfig');
    19177 -                    if (sPath <> '') then
    19178 -                        say '    'sPath;
    19179 -                end
    19180 -            end
    19181 -            when (sEnv.i = 'showconfigured') then do
    19182 -                do j = 1 to aCfg.0
    19183 -                    if (CfgIsConfigured(j)) then
    19184 -                    do
    19185 -                        say left(aCfg.j.sId, 15) '-' left(aCfg.j.sGrp, 8) '-' aCfg.j.sDesc
    19186 -                        sPath = PathQuery(aCfg.j.sId, aCfg.j.sId, 'quietisconfig');
    19187 -                        if (sPath <> '') then
    19188 -                            say '    'sPath;
    19189 -                    end
    19190 -                end
    19191 -            end
    19192 -
    19193 -            when (sEnv.i = 'shownotconfigured') then do
    19194 -                do j = 1 to aCfg.0
    19195 -                    if (\CfgIsConfigured(j)) then
    19196 -                        say left(aCfg.j.sId, 15) '-' left(aCfg.j.sGrp, 8) '-' aCfg.j.sDesc
    19197 -                end
    19198 -            end
    19199 -
    19200 -
    19201 -            /*
    19202 -             * Special 'tools'.
    19203 -             */
    19204 -            when (sEnv.i = 'debug') then do
    19205 -                rc = EnvSet(0, 'DEBUG','1');
    19206 -                rc = EnvSet(0, 'RELEASE','');
    19207 -                rc = EnvSet(0, 'BUILD_MODE','DEBUG');
    19208 -            end
    19209 -            when (sEnv.i = 'profile') then do
    19210 -                rc = EnvSet(0, 'DEBUG','1');
    19211 -                rc = EnvSet(0, 'RELEASE','');
    19212 -                rc = EnvSet(0, 'BUILD_MODE','PROFILE');
    19213 -            end
    19214 -            when (sEnv.i = 'release') then do
    19215 -                rc = EnvSet(0, 'DEBUG','');
    19216 -                rc = EnvSet(0, 'RELEASE','1');
    19217 -                rc = EnvSet(0, 'BUILD_MODE','RELEASE');
    19218 -            end
    19219 -
    19220 -            when (sEnv.i = 'buildsetup') then
    19221 -                rc = EnvSet(0, 'BUILD_SETUP_MAK','make\setup.mak');
    19222 -
    19223 -            /*
    19224 -             * Generic
    19225 -             */
    19226 -            otherwise
    19227 -            do
    19228 -                fFound = 0;
    19229 -                do j = 1 to aCfg.0
    19230 -                    if (aCfg.j.sId = sEnv.i) then
    19231 -                    do
    19232 -                        /*
    19233 -                         * Found the environment.
    19234 -                         */
    19235 -                        fFound = 1;
    19236 -
    19237 -                        /*
    19238 -                         * Take requested action.
    19239 -                         */
    19240 -                        rc = -16;
    19241 -                        if (fCfg | fForcedCfg) then
    19242 -                            rc = CfgConfigure(j, fForcedCfg);
    19243 -                        else if (fVerify) then
    19244 -                            rc = CfgVerify(j, 0, 1);
    19245 -                        else if (fQuery) then
    19246 -                        do
    19247 -                            rc = 0;
    19248 -                            if (\CfgIsConfigured(j)) then
    19249 -                                return 3;
    19250 -                        end
    19251 -                        else
    19252 -                        do
    19253 -                            if (\fOptional) then
    19254 -                                rc = CfgInstallUninstall(j, fRM);
    19255 -                            else if (CfgIsConfigured(j)) then
    19256 -                                rc = CfgInstallUninstall(j, fRM);
    19257 -                        end
    19258 -                        leave;
    19259 -                    end
    19260 -                end /* loop */
    19261 -
    19262 -                if (\fFound) then
    19263 -                do
    19264 -                    say 'error: unknown tool! - 'sEnv.i;
    19265 -                    call SysSleep 2;
    19266 -                    exit(16)
    19267 -                end
    19268 -            end /* otherwise */
    19269 -        end /* select */
    19270 -    end /* sEnv.i loop */
    19271 -
    19272 -
    19273 -    /*
    19274 -     * Check for command to execute.
    19275 -     * (I.e. if there are more arguments left. after the dash/star.)
    19276 -     */
    19277 -    if (i < sEnv.0) then
    19278 -    do
    19279 -        chType = sEnv.i;
    19280 -
    19281 -        sCmd = '';
    19282 -        do while (i < sEnv.0)
    19283 -            i = i + 1;
    19284 -            sCmd = sCmd ||' '||sEnv.i;
    19285 -        end
    19286 -
    19287 -        if (chType = '-') then
    19288 -        do
    19289 -            Address CMD 'start /F' sCMD;
    19290 -            Address CMD 'exit';
    19291 -        end
    19292 -        else
    19293 -            Address CMD sCMD;
    19294 -        exit(rc);
    19295 -    end
    19296 -
    19297 -exit(0);
    19298 -
    19299 -
    19300 -/**
    19301 - * No value handler
    19302 - */
    19303 -NoValueHandler:
    19304 -    say 'NoValueHandler: line 'SIGL;
    19305 -exit(16);
    19306 -
    19307 -
    19308 -
    19309 -/**
    19310 - * Get the description of an tool.
    19311 - * @returns Description string.
    19312 - *          '' if not found.
    19313 - * @param   sToolId      Tool id.
    19314 - */
    19315 -CfgDesc: procedure expose aCfg. aPath.
    19316 -    parse arg sToolId
    19317 -    do i = 1 to aCfg.0
    19318 -        if (aCfg.i.sId = sToolId) then
    19319 -            return aCfg.i.sDesc;
    19320 -    end
    19321 -return sToolId;
    19322 -
    19323 -
    19324 -/**
    19325 - * Lookups up an env. config in the aCfg. array.
    19326 - * @return  Index of sToolId.
    19327 - *          aCfg.0+1 on error.
    19328 - * @param   sToolId      Tool id.
    19329 - */
    19330 -CfgLookup: procedure expose aCfg. aPath.
    19331 -    parse arg sToolId
    19332 -    iTool = 1;
    19333 -    do while ((iTool <= aCfg.0) & (aCfg.iTool.sId <> sToolId))
    19334 -        iTool = iTool + 1;
    19335 -    end
    19336 -return iTool;
    19337 -
    19338 -
    19339 -/**
    19340 - * Verifies a configuration.
    19341 - * @returns 0 on success.
    19342 - *          4 on error/warnings which is continuable.
    19343 - *          8 or higher or on fatal errors.
    19344 - * @param   iTool   The tool index in aCfg.
    19345 - * @param   fRM     If set we'll uninstall the tool from the environment.
    19346 - */
    19347 -CfgInstallUninstall: procedure expose aCfg. aPath.
    19348 -    parse arg iTool, fRM
    19349 -
    19350 -    /* make rexx expression */
    19351 -    if (pos(',', aCfg.iTool.sSet) > 0) then
    19352 -        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,sOperation,fRM,fQuiet',
    19353 -             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    19354 -    else
    19355 -        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,sOperation,fRM,fQuiet)';
    19356 -    fQuiet = 0;
    19357 -    if (\fRM) then  sOperation = 'install';
    19358 -    else            sOperation = 'uninstall';
    19359 -
    19360 -    /* call the tool procedure with a verify operation. */
    19361 -    interpret 'iRc = '||sRexx;
    19362 -
    19363 -    /* On failure we'll complain and quietly uninstall the tool. */
    19364 -    if (iRc <> 0) then
    19365 -    do
    19366 -        /* complain */
    19367 -        if (\fQuiet) then
    19368 -        do
    19369 -            select
    19370 -                when (iRc = 1) then
    19371 -                    say 'error - 'aCfg.iTool.sId': 'sOperation' not configured - ie. no path.';
    19372 -                when (iRc = 2) then
    19373 -                    say 'error - 'aCfg.iTool.sId': 'sOperation' failed ''cause some vital file/dir wasn''t found.';
    19374 -                when (iRc = 49) then
    19375 -                    say 'error - 'aCfg.iTool.sId': 'sOperation' failed ''cause some vital command didn''t return as expected.';
    19376 -                when (iRc = 99) then
    19377 -                    say 'error - 'aCfg.iTool.sId': 'sOperation' failed ''cause some vital command didn''t return the expected output.';
    19378 -                otherwise
    19379 -                    say 'internal error- 'aCfg.iTool.sId': bad return code from '''sRexx''' rc=' iRc'.';
    19380 -            end
    19381 -        end
    19382 -
    19383 -        /* uninstall silently */
    19384 -        fRM = 1;
    19385 -        fQuiet = 1;
    19386 -        sOperation = 'quietuninstall';
    19387 -        interpret 'rcignore = '||sRexx;
    19388 -    end
    19389 -return iRc;
    19390 -
    19391 -
    19392 -
    19393 -
    19394 -/**
    19395 - * Configures an tool.
    19396 - * @returns 0 on success.
    19397 - *          4 on error/warnings which is continuable.
    19398 - *          8 or higher or on fatal errors.
    19399 - * @param   iTool       The tool configuration to configure.
    19400 - * @param   fForced     If set, we'll force a reconfiguration of the tool.
    19401 - */
    19402 -CfgConfigure: procedure expose aCfg. aPath.
    19403 -    parse arg iTool, fForced
    19404 -
    19405 -    /*
    19406 -     * First verfiy the configuration quietly, we don't have to do anything if it's ok.
    19407 -     */
    19408 -    if (\fForced & (CfgVerify(iTool, 1, 1) = 0)) then
    19409 -        return 0;
    19410 -
    19411 -    /*
    19412 -     * We have to configure it!
    19413 -     */
    19414 -    say '- Config of the 'aCfg.iTool.sId' ('CfgDesc(aCfg.iTool.sId)') tool.';
    19415 -
    19416 -    /* make rexx expression */
    19417 -    if (pos(',', aCfg.iTool.sSet) > 0) then
    19418 -        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,sOperation,fRM,fQuiet',
    19419 -             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    19420 -    else
    19421 -        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,sOperation,fRM,fQuiet)';
    19422 -    if (fForced) then   sOperation = 'forcedconfig';
    19423 -    else                sOperation = 'config';
    19424 -    fRM = 0;
    19425 -    fQuiet = 0;
    19426 -
    19427 -
    19428 -    /*
    19429 -     * Loop till rc=0 or user gives up.
    19430 -     */
    19431 -    rc = -1
    19432 -    do while (rc <> 0)
    19433 -        /* configure */
    19434 -        interpret 'rc = '||sRexx;
    19435 -
    19436 -        if (rc <> 0) then do
    19437 -            say 'warning: The user refused to give a path, continuing.';
    19438 -            return 4;
    19439 -        end
    19440 -
    19441 -        /* verifying */
    19442 -        rc = CfgVerify(iTool, 0, 1);
    19443 -        sOperation = 'verify';
    19444 -        if (rc = 0) then
    19445 -            leave;
    19446 -
    19447 -        /* Retry the config if the user wanna do so. */
    19448 -        say ''
    19449 -        say 'Retry configuring the tool' aCfg.iTool.sId '('CfgDesc(aCfg.iTool.sId)')? (y/N)';
    19450 -        sAnswer = PullUser(1);
    19451 -        if (substr(strip(sAnswer),1,1) <> 'Y') then
    19452 -            return 4;
    19453 -        sOperation = 'forcedconfig';
    19454 -    end
    19455 -
    19456 -    /*
    19457 -     * Write path file and return successfully.
    19458 -     */
    19459 -    call PathWrite;
    19460 -return 0;
    19461 -
    19462 -
    19463 -/**
    19464 - * Verifies a configuration.
    19465 - * @returns Return code from the environment procedure.
    19466 - * @param   iTool       The tool index in aCfg.
    19467 - * @param   fQuiet      If set we'll to a quiet verify.
    19468 - * @param   fCleanup    If set we'll clean properly.
    19469 - */
    19470 -CfgVerify: procedure expose aCfg. aPath.
    19471 -    parse arg iTool, fQuiet, fCleanup
    19472 -
    19473 -    /* make rexx expression */
    19474 -    if (pos(',', aCfg.iTool.sSet) > 0) then
    19475 -        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,sOperation,fRM,fQuiet',
    19476 -             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    19477 -    else
    19478 -        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,sOperation,fRM,fQuiet)';
    19479 -    if (fQuiet) then    sOperation = 'quietverify';
    19480 -    else                sOperation = 'verify';
    19481 -    fRM = 0;
    19482 -
    19483 -    /* call the tool procedure with a verify operation. */
    19484 -    interpret 'iRc = '||sRexx;
    19485 -
    19486 -    /* On failure we'll complain and quietly uninstall the tool. */
    19487 -    if (iRc <> 0) then
    19488 -    do
    19489 -        /* complain */
    19490 -        if (\fQuiet) then
    19491 -        do
    19492 -            select
    19493 -                when (iRc = 1) then
    19494 -                    say 'warning - 'aCfg.iTool.sId': The user refused to give a path, continuing.';
    19495 -                when (iRc = 2) then
    19496 -                    say 'error - 'aCfg.iTool.sId': verify failed ''cause some vital file/dir wasn''t found.';
    19497 -                when (iRc = 49) then
    19498 -                    say 'error - 'aCfg.iTool.sId': verify failed ''cause some vital command didn''t return as expected.';
    19499 -                when (iRc = 99) then
    19500 -                    say 'error - 'aCfg.iTool.sId': verify failed ''cause some vital command didn''t return the expected output.';
    19501 -                otherwise
    19502 -                    say 'internal error- 'aCfg.iTool.sId': bad return code from '''sRexx''' iRc=' iRc'.';
    19503 -            end
    19504 -        end
    19505 -        fCleanup = 1;
    19506 -    end
    19507 -
    19508 -    /* uninstall */
    19509 -    if (fCleanup) then
    19510 -    do
    19511 -        fRM = 1;
    19512 -        fQuiet = 1;
    19513 -        sOperation = 'quietuninstall';
    19514 -        interpret 'rcignore = '||sRexx;
    19515 -    end
    19516 -return iRc;
    19517 -
    19518 -
    19519 -/**
    19520 - * Verifies a configuration.
    19521 - * @returns True if configured.
    19522 - *          False if not configured.
    19523 - * @param   iTool   The tool index in aCfg.
    19524 - * @param   fQuiet  If set we'll to a quiet verify.
    19525 - */
    19526 -CfgIsConfigured: procedure expose aCfg. aPath.
    19527 -    parse arg iTool
    19528 -
    19529 -    /* make rexx expression */
    19530 -    if (pos(',', aCfg.iTool.sSet) > 0) then
    19531 -        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,''quietisconfig'',0,1',
    19532 -             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    19533 -    else
    19534 -        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,''quietisconfig'',0,1)';
    19535 -    interpret 'iRc = '||sRexx;
    19536 -return (iRc = 0);
    19537 -
    19538 -
    19539 -
    19540 -/**
    19541 - * Checks if a file exists.
    19542 - * @param   sFile       Name of the file to look for.
    19543 - * @param   fQuiet      Flag which tells whether to be quiet or not.
    19544 - * @param   fOptional   Flag to say that this file is optional.
    19545 - * @returns TRUE if file exists.
    19546 - *          FALSE if file doesn't exists.
    19547 - */
    19548 -CfgVerifyFile: procedure expose aCfg. aPath.
    19549 -    parse arg sFile, fQuiet, fOptional
    19550 -    if (fOptional = '') then fOptional = 0;
    19551 -    rc = stream(sFile, 'c', 'query exist');
    19552 -    if ((rc = '') & \fQuiet) then
    19553 -    do
    19554 -        if (fOptional) then
    19555 -            say 'Warning: Installation is missing '''sFile'''.';
    19556 -        else
    19557 -            say 'Verify existance of '''sFile''' failed.';
    19558 -    end
    19559 -return rc <> '' | fOptional;
    19560 -
    19561 -
    19562 -/**
    19563 - * Checks if a directory exists.
    19564 - * @param   sDir   Name of the dir to look for.
    19565 - * @param   fQuiet  Flag which tells whether to be quiet or not.
    19566 - * @returns TRUE if file exists.
    19567 - *          FALSE if file doesn't exists.
    19568 - */
    19569 -CfgVerifyDir: procedure expose aCfg. aPath.
    19570 -    parse arg sDir, fQuiet
    19571 -    rc = SysFileTree(sDir, 'sDirs', 'DO');
    19572 -    if (rc = 0 & sDirs.0 = 1) then
    19573 -        return 1;
    19574 -    if (\fQuiet) then
    19575 -        say 'Verify existance of '''sDir''' failed.';
    19576 -return 0;
    19577 -
    19578 -
    19579 -
    19580 -
    19581 -
    19582 -/**
    19583 - * The Directory Configuration Function.
    19584 - *
    19585 - * @returns Lower cased, absolute, backward slashed, path to program.
    19586 - * @param   sPathId     Program identifier. (lowercase!)
    19587 - */
    19588 -PathQuery: procedure expose aCfg. aPath.
    19589 -    parse arg sPathId, sToolId, sOperation, fOptional
    19590 -
    19591 -    if (fOptional = '') then
    19592 -        fOptional = 0;
    19593 -
    19594 -    if (aPath.0 = 0) then
    19595 -    do  /*
    19596 -         * Read path config file
    19597 -         */
    19598 -        call PathRead;
    19599 -
    19600 -        /*
    19601 -         * If no data found fill in defaults (if known host).
    19602 -         */
    19603 -        if (aPath.0 = 0) then
    19604 -        do
    19605 -            call PathSetDefault;
    19606 -            call PathWrite;
    19607 -        end
    19608 -    end
    19609 -
    19610 -    /*
    19611 -     * Check for forced config.
    19612 -     */
    19613 -    if (sOperation = 'forcedconfig') then
    19614 -        call PathRemove sPathId;
    19615 -    else
    19616 -    do
    19617 -        /*
    19618 -         * Search for the path.
    19619 -         */
    19620 -        do i = 1 to aPath.0
    19621 -            if (aPath.i.sPId = sPathId) then
    19622 -            do
    19623 -                return aPath.i.sPath;
    19624 -                leave;
    19625 -            end
    19626 -        end
    19627 -    end
    19628 -
    19629 -    /*
    19630 -     * Path wasn't found!
    19631 -     */
    19632 -
    19633 -    /* for quiet verify, configured test and uninstall, fail sliently. */
    19634 -    if ((sOperation = 'quietisconfig') | (sOperation = 'quietverify') | (sOperation = 'quietuninstall')) then
    19635 -        return '';
    19636 -
    19637 -    /* if configure operation the configure it. */
    19638 -    if (pos('config', sOperation) > 0) then
    19639 -        return PathConfig(sOperation, sPathId, sToolId);
    19640 -
    19641 -    /* elsewise this is an fatal error */
    19642 -    if (\fOptional) then
    19643 -    do
    19644 -        say 'Fatal error: Path information for '''sPathId''' was not found.';
    19645 -        call SysSleep 5;
    19646 -        exit(16);
    19647 -    end
    19648 -
    19649 -return '';
    19650 -
    19651 -
    19652 -/**
    19653 - * Determins the full name of the path file to use.
    19654 - * @returns Path to the pathfile to use. The file may not exist.
    19655 - */
    19656 -PathGetFile: procedure
    19657 -
    19658 -    /*
    19659 -     * Project Specific?
    19660 -     */
    19661 -    parse source . . sPathFile .
    19662 -    sPathFile = sPathFile||'.paths';
    19663 -    if (FileExists(sPathFile)) then
    19664 -        return sPathFile;
    19665 -
    19666 -    /*
    19667 -     * ETC?
    19668 -     */
    19669 -    sEtc = EnvGet('ETC');
    19670 -    if (sEtc <> '') then
    19671 -        return sEtc||'\BuildEnv.cfg';
    19672 -return sPathFile;
    19673 -
    19674 -
    19675 -/**
    19676 - * Reads the path file into the 'aPath.' stem.
    19677 - */
    19678 -PathRead: procedure expose aCfg. aPath.
    19679 -
    19680 -    i = 1;                              /* Path index */
    19681 -    iLine = 0;                          /* Line # in file */
    19682 -
    19683 -
    19684 -    sPathFile = PathGetFile();
    19685 -
    19686 -    /*
    19687 -     * Read loop.
    19688 -     */
    19689 -    do while (lines(sPathFile) > 0)
    19690 -        iLine = iLine + 1;
    19691 -        sLine = strip(linein(sPathFile));
    19692 -
    19693 -        /*
    19694 -         * Skip empty lines and comment lines, ie. starting with '#' or ';'.
    19695 -         */
    19696 -        if ((sLine <> '') & (substr(sLine, 1, 1) <> '#') & (substr(sLine, 1, 1) <> ';')) then
    19697 -        do
    19698 -            /*
    19699 -             * Parse the line.
    19700 -             */
    19701 -            parse var sLine aPath.i.sPId '=' aPath.i.sPath
    19702 -            aPath.i.sPId = strip(aPath.i.sPId);
    19703 -            aPath.i.sPath = strip(aPath.i.sPath);
    19704 -
    19705 -            /*
    19706 -             * Validate the input.
    19707 -             */
    19708 -            if ((aPath.i.sPath = '') | (aPath.i.sPId = '') | (translate(sLine,'','#!$@%|<>;õ&Ï') <> sLine) ) then
    19709 -            do
    19710 -                say 'fatal error: missformed line in path file at line 'iLine'!'
    19711 -                call stream sPathFile, 'c', 'close';
    19712 -                call SysSleep 5;
    19713 -                exit(16);
    19714 -            end
    19715 -            i = i + 1;
    19716 -        end
    19717 -    end
    19718 -    call stream sPathFile, 'c', 'close';
    19719 -    aPath.0 = i - 1;
    19720 -return 0;
    19721 -
    19722 -
    19723 -/**
    19724 - * Writes the path file from what's in the 'aPath.' stem.
    19725 - */
    19726 -PathWrite: procedure expose aCfg. aPath.
    19727 -    sPathFile = PathGetFile();
    19728 -    call SysFileDelete(sPathFile);
    19729 -    do i = 1 to aPath.0
    19730 -        /* skip if already written */
    19731 -        j = 1;
    19732 -        do while (aPath.j.sPId <> aPath.i.sPId)
    19733 -            j = j + 1;
    19734 -        end
    19735 -        if (j >= i) then
    19736 -            call lineout sPathFile, aPath.i.sPId'='aPath.i.sPath;
    19737 -    end
    19738 -    call stream sPathFile, 'c', 'close';
    19739 -return 0;
    19740 -
    19741 -
    19742 -/**
    19743 - * Remove a path from the 'aPath.' stem.
    19744 - * @returns 0
    19745 - * @param   sPathId     The id of the path to remove.
    19746 - */
    19747 -PathRemove: procedure expose aCfg. aPath.
    19748 -    parse arg sPathId
    19749 -
    19750 -    /*
    19751 -     * Find.
    19752 -     */
    19753 -    i = 1;
    19754 -    do while (i <= aPath.0)
    19755 -        if (aPath.i.sPId = sPathId) then
    19756 -            leave;
    19757 -        i = i + 1;
    19758 -    end
    19759 -
    19760 -    /*
    19761 -     * Move.
    19762 -     */
    19763 -    if (i <= aPath.0) then
    19764 -    do
    19765 -        j = i + 1;
    19766 -        do while (j <= aPath.0)
    19767 -            aPath.i.sPId = aPath.j.sPId;
    19768 -            aPath.i.sPath = aPath.j.sPath;
    19769 -            j = j + 1;
    19770 -            i = i + 1;
    19771 -        end
    19772 -        aPath.0 = aPath.0 - 1;
    19773 -    end
    19774 -return 0;
    19775 -
    19776 -
    19777 -/**
    19778 - * Sets a given path.
    19779 - * @param   sPathId     Path id.
    19780 - * @param   sNewPath    Path.
    19781 - */
    19782 -PathSet: procedure expose aCfg. aPath.
    19783 -parse arg sPathId, sNewPath
    19784 -
    19785 -    /*
    19786 -     * Search for the path.
    19787 -     */
    19788 -    do i = 1 to aPath.0
    19789 -        if (aPath.i.sPId = sPathId) then
    19790 -        do
    19791 -            aPath.i.sPath = sNewPath;
    19792 -            return 0;
    19793 -        end
    19794 -    end
    19795 -
    19796 -    /*
    19797 -     * Not found, so add it.
    19798 -     */
    19799 -    i = aPath.0 + 1;
    19800 -    aPath.i.sPId = sPathId;
    19801 -    aPath.i.sPath = sNewPath;
    19802 -    aPath.0 = i;
    19803 -return 0;
    19804 -
    19805 -
    19806 -
    19807 -/**
    19808 - * Fills 'aPath.' with default settings overwriting anything in the table.
    19809 - */
    19810 -PathSetDefault: procedure expose aCfg. aPath.
    19811 -    i = 1;
    19812 -
    19813 -    /*
    19814 -     * Bird: home boxes.
    19815 -     */
    19816 -    if ((translate(EnvGet('HOSTNAME')) = 'UNIVAC') | (translate(EnvGet('HOSTNAME')) = 'ENIAC')) then
    19817 -    do
    19818 -        say 'Info: No or empty path file, using birds defaults.';
    19819 -        aPath.i.sPId = 'cvs';                       aPath.i.sPath = 'f:\cvs\v1.11.2_os2';           i = i + 1;
    19820 -        aPath.i.sPId = 'db2v52';                    aPath.i.sPath = 'f:\sqllib52';                  i = i + 1;
    19821 -        aPath.i.sPId = 'ddk';                       aPath.i.sPath = 'f:\DDK_os2\200204';            i = i + 1;
    19822 -        aPath.i.sPId = 'ddkbase';                   aPath.i.sPath = 'f:\DDK_os2\200204\base';       i = i + 1;
    19823 -        aPath.i.sPId = 'ddkvideo';                  aPath.i.sPath = 'f:\DDK_os2\200204\video';      i = i + 1;
    19824 -        aPath.i.sPId = 'doxygen';                   aPath.i.sPath = 'f:\doxygen\v1.2.11-OS2';       i = i + 1;
    19825 -        aPath.i.sPId = 'emx';                       aPath.i.sPath = 'f:\emx';                       i = i + 1;
    19826 -        aPath.i.sPId = 'emxpgcc';                   aPath.i.sPath = 'f:\GCC\v2.95.3_os2';           i = i + 1;
    19827 -        aPath.i.sPId = 'freetypeemx';               aPath.i.sPath = 'f:\Freetype\v1.3.1-emx\emx';   i = i + 1;
    19828 -        aPath.i.sPId = 'gcc302';                    aPath.i.sPath = 'f:\GCC\v3.0.2beta_os2\emx';    i = i + 1;
    19829 -        aPath.i.sPId = 'gcc303';                    aPath.i.sPath = 'f:\GCC\v3.0.3beta_os2\emx';    i = i + 1;
    19830 -        aPath.i.sPId = 'gcc321';                    aPath.i.sPath = 'f:\GCC\v3.2.1beta_os2\emx';    i = i + 1;
    19831 -        aPath.i.sPId = 'gcc322';                    aPath.i.sPath = 'f:\GCC\v3.2.2beta2_os2\usr';   i = i + 1;
    19832 -        aPath.i.sPId = 'home';                      aPath.i.sPath = 'e:\user\kso';                  i = i + 1;
    19833 -        aPath.i.sPId = 'icatgam';                   aPath.i.sPath = 'f:\Icat\v4.0.6rc1_os2';        i = i + 1;
    19834 -        aPath.i.sPId = 'icatgam406rc1';             aPath.i.sPath = 'f:\Icat\v4.0.6rc1_os2';        i = i + 1;
    19835 -        aPath.i.sPId = 'icatpe';                    aPath.i.sPath = 'f:\Icat\v4.0.5pe';             i = i + 1;
    19836 -        aPath.i.sPId = 'ida38';                     aPath.i.sPath = 'f:\ida\v3.8';                  i = i + 1;
    19837 -        aPath.i.sPId = 'ida40';                     aPath.i.sPath = 'f:\ida\v4.0.1';                i = i + 1;
    19838 -        aPath.i.sPId = 'ida414';                    aPath.i.sPath = 'f:\ida\v4.1.4';                i = i + 1;
    19839 -        aPath.i.sPId = 'idasdk';                    aPath.i.sPath = 'f:\idasdk';                    i = i + 1;
    19840 -        aPath.i.sPId = 'java131';                   aPath.i.sPath = 'e:\java131';                   i = i + 1;
    19841 -        aPath.i.sPId = 'jpeg';                      aPath.i.sPath = 'f:\jpeg\v6b';                  i = i + 1;
    19842 -        aPath.i.sPId = 'mscv6-16';                  aPath.i.sPath = 'f:\msc\v6.0a_ibm';             i = i + 1;
    19843 -        aPath.i.sPId = 'mscv7-16';                  aPath.i.sPath = 'f:\msc\v7.0';                  i = i + 1;
    19844 -        aPath.i.sPId = 'mysql';                     aPath.i.sPath = 'f:\mysql2';                    i = i + 1;
    19845 -        aPath.i.sPId = 'nasm9833';                  aPath.i.sPath = 'f:\nasm\v0.98.33_os2';         i = i + 1;
    19846 -        aPath.i.sPId = 'netqos2';                   aPath.i.sPath = 'f:\netqos2';                   i = i + 1;
    19847 -        aPath.i.sPId = 'perl50xxx';                 aPath.i.sPath = 'f:\perl\v5.005_53_os2';        i = i + 1;
    19848 -        aPath.i.sPId = 'perl580';                   aPath.i.sPath = 'f:\perl\v5.8.0_os2';           i = i + 1;
    19849 -        aPath.i.sPId = 'python';                    aPath.i.sPath = 'f:\python\v1.5.2_os2';         i = i + 1;
    19850 -        aPath.i.sPId = 'svn';                       aPath.i.sPath = 'f:\subversion\v1.0.6_os2';     i = i + 1;
    19851 -        aPath.i.sPId = 'toolkit40';                 aPath.i.sPath = 'f:\toolkit\v4.0csd4';          i = i + 1;
    19852 -        aPath.i.sPId = 'toolkit45';                 aPath.i.sPath = 'f:\toolkit\v4.5';              i = i + 1;
    19853 -        aPath.i.sPId = 'toolkit451';                aPath.i.sPath = 'f:\toolkit\v4.51';             i = i + 1;
    19854 -        aPath.i.sPId = 'toolkit452';                aPath.i.sPath = 'f:\toolkit\v4.52';             i = i + 1;
    19855 -        aPath.i.sPId = 'unixroot';                  aPath.i.sPath = 'e:\unix';                      i = i + 1;
    19856 -        aPath.i.sPId = 'vac308';                    aPath.i.sPath = 'f:\VACpp\v3.08_os2';           i = i + 1;
    19857 -        aPath.i.sPId = 'vac365';                    aPath.i.sPath = 'f:\VACpp\v3.65_os2';           i = i + 1;
    19858 -        aPath.i.sPId = 'vac40';                     aPath.i.sPath = 'f:\VACpp\v4.0_os2';            i = i + 1;
    19859 -        aPath.i.sPId = 'warpin';                    aPath.i.sPath = 'f:\WarpIn\current';            i = i + 1;
    19860 -        aPath.i.sPId = 'watcom11';                  aPath.i.sPath = 'f:\watcom\v11.0';              i = i + 1;
    19861 -        aPath.i.sPId = 'watcom11c';                 aPath.i.sPath = 'f:\watcom\v11.0c';             i = i + 1;
    19862 -        aPath.i.sPId = 'xfree86';                   aPath.i.sPath = 'e:\xfree86';                   i = i + 1;
    19863 -        aPath.i.sPId = 'testcase_drive_unused';     aPath.i.sPath = 'l'; /* reqired */              i = i + 1;
    19864 -        aPath.i.sPId = 'testcase_drive_fixed';      aPath.i.sPath = 'c'; /* reqired */              i = i + 1;
    19865 -        aPath.i.sPId = 'testcase_drive_floppy';     aPath.i.sPath = 'a'; /* reqired */              i = i + 1;
    19866 -        aPath.i.sPId = 'testcase_drive_cdrom';      aPath.i.sPath = 'i'; /* optional */             i = i + 1;
    19867 -        aPath.i.sPId = 'testcase_drive_network';    aPath.i.sPath = 'y'; /* optional */             i = i + 1;
    19868 -        aPath.i.sPId = 'testcase_drive_ramdisk';    aPath.i.sPath = 'r'; /* optional */             i = i + 1;
    19869 -        /*aPath.i.sPId = '';          aPath.i.sPath =      i = i + 1;*/
    19870 -    end
    19871 -
    19872 -
    19873 -    /*
    19874 -     * Bird: laptop box.
    19875 -     */
    19876 -    if (translate(EnvGet('HOSTNAME')) = 'DELIRIUM') then
    19877 -    do
    19878 -        say 'Info: No or empty path file, using birds work defaults.';
    19879 -        aPath.i.sPId = 'cvs';                       aPath.i.sPath = 'e:\dev\cvs\v11.1';             i = i + 1;
    19880 -        aPath.i.sPId = 'emx';                       aPath.i.sPath = 'e:\emx';                       i = i + 1;
    19881 -        aPath.i.sPId = 'emxpgcc';                   aPath.i.sPath = 'e:\dev\emxpgcc\v2.95.2';       i = i + 1;
    19882 -        aPath.i.sPId = 'gcc303';                    aPath.i.sPath = 'e:\dev\gcc\v3.0.3\emx';        i = i + 1;
    19883 -        aPath.i.sPId = 'gcc321';                    aPath.i.sPath = 'e:\dev\gcc\v3.2.1\emx';        i = i + 1;
    19884 -      /*aPath.i.sPId = 'db2v52';                    aPath.i.sPath = 'e:\sqllib52';                  i = i + 1;
    19885 -        aPath.i.sPId = 'icatgam';                   aPath.i.sPath = 'e:\icatos2';                   i = i + 1;
    19886 -        aPath.i.sPId = 'icatgam406rc1';             aPath.i.sPath = 'e:\icatos2.4.0.6.rc1';         i = i + 1;
    19887 -        aPath.i.sPId = 'icatpe';                    aPath.i.sPath = 'e:\icatpe';                    i = i + 1;
    19888 -        aPath.i.sPId = 'ida38';                     aPath.i.sPath = 'e:\ida38';                     i = i + 1;
    19889 -        aPath.i.sPId = 'ida40';                     aPath.i.sPath = 'e:\ida401';                    i = i + 1; */
    19890 -        aPath.i.sPId = 'ida414';                    aPath.i.sPath = 'e:\dev\ida\v414';                    i = i + 1;
    19891 -      /*aPath.i.sPId = 'idasdk';                    aPath.i.sPath = 'e:\idasdk';                    i = i + 1; */
    19892 -        aPath.i.sPId = 'ddk';                       aPath.i.sPath = 'e:\dev\ddk\june02';                       i = i + 1;
    19893 -        aPath.i.sPId = 'ddkbase';                   aPath.i.sPath = 'e:\dev\ddk\june02\base';                  i = i + 1;
    19894 -        aPath.i.sPId = 'ddkvideo';                  aPath.i.sPath = 'e:\dev\ddk\june02\video';                 i = i + 1;
    19895 -        aPath.i.sPId = 'home';                      aPath.i.sPath = 'e:\home';                      i = i + 1;
    19896 -        aPath.i.sPId = 'mscv6-16';                  aPath.i.sPath = 'e:\dev\ddktools\toolkits\msc60';   i = i + 1;
    19897 -      /*aPath.i.sPId = 'mscv7-16';                  aPath.i.sPath = 'e:\msc\v7.0';                  i = i + 1;
    19898 -        aPath.i.sPId = 'mysql';                     aPath.i.sPath = 'e:\mysql2';                    i = i + 1;
    19899 -        aPath.i.sPId = 'netqos2';                   aPath.i.sPath = 'e:\netqos2';                   i = i + 1;
    19900 -        aPath.i.sPId = 'perl50xxx';                 aPath.i.sPath = 'e:\perllib';                   i = i + 1;
    19901 -        aPath.i.sPId = 'perl580';                   aPath.i.sPath = 'e:\dev\perl\v5.8.0';           i = i + 1;
    19902 -        aPath.i.sPId = 'python';                    aPath.i.sPath = 'e:\python';                    i = i + 1;
    19903 -        aPath.i.sPId = 'toolkit40';                 aPath.i.sPath = 'e:\toolkit';                   i = i + 1;
    19904 -        aPath.i.sPId = 'toolkit45';                 aPath.i.sPath = 'e:\toolkit45';                 i = i + 1;
    19905 -        aPath.i.sPId = 'toolkit451';                aPath.i.sPath = 'e:\toolkit451';                i = i + 1; */
    19906 -        aPath.i.sPId = 'toolkit452';                aPath.i.sPath = 'e:\dev\toolkit\v452';                i = i + 1;
    19907 -        aPath.i.sPId = 'unixroot';                  aPath.i.sPath = 'e:\unix';                      i = i + 1;
    19908 -        aPath.i.sPId = 'xfree86';                   aPath.i.sPath = 'e:\xfree86';                   i = i + 1;
    19909 -        aPath.i.sPId = 'vac308';                    aPath.i.sPath = 'e:\dev\vacpp\v308';                 i = i + 1;
    19910 -        aPath.i.sPId = 'vac365';                    aPath.i.sPath = 'e:\dev\vacpp\v365';                   i = i + 1;
    19911 -      /*aPath.i.sPId = 'vac40';                     aPath.i.sPath = 'e:\ibmcpp40';                  i = i + 1;*/
    19912 -        aPath.i.sPId = 'warpin';                    aPath.i.sPath = 'e:\warpin';                    i = i + 1;
    19913 -      /*aPath.i.sPId = 'watcom11';                  aPath.i.sPath = 'e:\watcom';                    i = i + 1;*/
    19914 -/*        aPath.i.sPId = 'watcom11c';                 aPath.i.sPath = 'e:\dev\watcom\v11c';                 i = i + 1; */
    19915 -        aPath.i.sPId = 'testcase_drive_unused';     aPath.i.sPath = 't'; /* reqired */              i = i + 1;
    19916 -        aPath.i.sPId = 'testcase_drive_fixed';      aPath.i.sPath = 'd'; /* reqired */              i = i + 1;
    19917 -        aPath.i.sPId = 'testcase_drive_floppy';     aPath.i.sPath = 'a'; /* reqired */              i = i + 1;
    19918 -        aPath.i.sPId = 'testcase_drive_cdrom';      aPath.i.sPath = 'f'; /* optional */             i = i + 1;
    19919 -        aPath.i.sPId = 'testcase_drive_network';    aPath.i.sPath = 'x'; /* optional */             i = i + 1;
    19920 -        /*aPath.i.sPId = 'testcase_drive_ramdisk';    aPath.i.sPath = '';  /* optional */             i = i + 1;*/
    19921 -        /*aPath.i.sPId = '';          aPath.i.sPath =      i = i + 1;*/
    19922 -    end
    19923 -
    19924 -
    19925 -    /*
    19926 -     * Bird: work boxes.
    19927 -     */
    19928 -    if ((translate(EnvGet('HOSTNAME')) = 'DREAM')  | (translate(EnvGet('HOSTNAME')) = 'DESPAIR')) then
    19929 -    do
    19930 -        say 'Info: No or empty path file, using birds work defaults.';
    19931 -        aPath.i.sPId = 'cvs';                       aPath.i.sPath = 'd:\dev\cvs\v11.1';             i = i + 1;
    19932 -        aPath.i.sPId = 'emx';                       aPath.i.sPath = 'd:\emx';                       i = i + 1;
    19933 -        aPath.i.sPId = 'emxpgcc';                   aPath.i.sPath = 'd:\dev\emxpgcc\v2.95.2';       i = i + 1;
    19934 -        aPath.i.sPId = 'gcc303';                    aPath.i.sPath = 'd:\dev\gcc\v3.0.3\emx';        i = i + 1;
    19935 -        aPath.i.sPId = 'gcc321';                    aPath.i.sPath = 'd:\dev\gcc\v3.2.1\emx';        i = i + 1;
    19936 -      /*aPath.i.sPId = 'db2v52';                    aPath.i.sPath = 'e:\sqllib52';                  i = i + 1;
    19937 -        aPath.i.sPId = 'icatgam';                   aPath.i.sPath = 'e:\icatos2';                   i = i + 1;
    19938 -        aPath.i.sPId = 'icatgam406rc1';             aPath.i.sPath = 'e:\icatos2.4.0.6.rc1';         i = i + 1;
    19939 -        aPath.i.sPId = 'icatpe';                    aPath.i.sPath = 'e:\icatpe';                    i = i + 1;
    19940 -        aPath.i.sPId = 'ida38';                     aPath.i.sPath = 'e:\ida38';                     i = i + 1;
    19941 -        aPath.i.sPId = 'ida40';                     aPath.i.sPath = 'e:\ida401';                    i = i + 1; */
    19942 -        aPath.i.sPId = 'ida414';                    aPath.i.sPath = 'd:\dev\ida\v414';              i = i + 1;
    19943 -      /*aPath.i.sPId = 'idasdk';                    aPath.i.sPath = 'e:\idasdk';                    i = i + 1; */
    19944 -        aPath.i.sPId = 'java131';                   aPath.i.sPath = 'd:\java131';                   i = i + 1;
    19945 -        aPath.i.sPId = 'ddk';                       aPath.i.sPath = 'd:\dev\ddk\june02';            i = i + 1;
    19946 -        aPath.i.sPId = 'ddkbase';                   aPath.i.sPath = 'd:\dev\ddk\june02\base';       i = i + 1;
    19947 -        aPath.i.sPId = 'ddkvideo';                  aPath.i.sPath = 'd:\dev\ddk\june02\video';      i = i + 1;
    19948 -        aPath.i.sPId = 'home';                      aPath.i.sPath = 'd:\home\bird';                 i = i + 1;
    19949 -        aPath.i.sPId = 'mscv6-16';                  aPath.i.sPath = 'd:\dev\ddktools\toolkits\msc60'; i = i + 1;
    19950 -        aPath.i.sPId = 'mscv7-16';                  aPath.i.sPath = 'd:\dev\msc\v7.0';              i = i + 1;
    19951 -        aPath.i.sPId = 'mysql';                     aPath.i.sPath = 'd:\apps\mysql\v3.23.50b1';     i = i + 1;
    19952 -      /*aPath.i.sPId = 'netqos2';                   aPath.i.sPath = 'e:\netqos2';                   i = i + 1;*/
    19953 -        aPath.i.sPId = 'perl50xxx';                 aPath.i.sPath = 'd:\dev\perl\v5.00455';         i = i + 1;
    19954 -        aPath.i.sPId = 'perl580';                   aPath.i.sPath = 'd:\dev\perl\v5.8.0';           i = i + 1;
    19955 -      /*aPath.i.sPId = 'python';                    aPath.i.sPath = 'e:\python';                    i = i + 1;*/
    19956 -        aPath.i.sPId = 'svn';                       aPath.i.sPath = 'd:\dev\subversion\v1.0.6';     i = i + 1;
    19957 -        aPath.i.sPId = 'toolkit40';                 aPath.i.sPath = 'd:\dev\toolkit\v40csd1';       i = i + 1;
    19958 -      /*aPath.i.sPId = 'toolkit45';                 aPath.i.sPath = 'e:\toolkit45';                 i = i + 1;
    19959 -        aPath.i.sPId = 'toolkit451';                aPath.i.sPath = 'e:\toolkit451';                i = i + 1; */
    19960 -        aPath.i.sPId = 'toolkit452';                aPath.i.sPath = 'd:\dev\toolkit\v452';          i = i + 1;
    19961 -        aPath.i.sPId = 'unixroot';                  aPath.i.sPath = 'd:\unix';                      i = i + 1;
    19962 -        aPath.i.sPId = 'xfree86';                   aPath.i.sPath = 'd:\xfree86';                   i = i + 1;
    19963 -        aPath.i.sPId = 'vac308';                    aPath.i.sPath = 'd:\dev\VACpp\v308';            i = i + 1;
    19964 -        aPath.i.sPId = 'vac365';                    aPath.i.sPath = 'd:\dev\VACpp\v365';            i = i + 1;
    19965 -        aPath.i.sPId = 'vac40';                     aPath.i.sPath = 'd:\dev\VACpp\v40ga';           i = i + 1;
    19966 -        aPath.i.sPId = 'warpin';                    aPath.i.sPath = 'c:\warpin';                    i = i + 1;
    19967 -        aPath.i.sPId = 'watcom11';                  aPath.i.sPath = 'd:\dev\watcom\v110';           i = i + 1;
    19968 -        aPath.i.sPId = 'watcom11c';                 aPath.i.sPath = 'd:\dev\watcom\v110c';          i = i + 1;
    19969 -        aPath.i.sPId = 'testcase_drive_unused';     aPath.i.sPath = 't'; /* reqired */              i = i + 1;
    19970 -        aPath.i.sPId = 'testcase_drive_fixed';      aPath.i.sPath = 'f'; /* reqired */              i = i + 1;
    19971 -        aPath.i.sPId = 'testcase_drive_floppy';     aPath.i.sPath = 'a'; /* reqired */              i = i + 1;
    19972 -        aPath.i.sPId = 'testcase_drive_cdrom';      aPath.i.sPath = 'g'; /* optional */             i = i + 1;
    19973 -        aPath.i.sPId = 'testcase_drive_network';    aPath.i.sPath = 'x'; /* optional */             i = i + 1;
    19974 -        aPath.i.sPId = 'testcase_drive_ramdisk';    aPath.i.sPath = 'r'; /* optional */             i = i + 1;
    19975 -        /*aPath.i.sPId = '';          aPath.i.sPath =      i = i + 1;*/
    19976 -    end
    19977 -
    19978 -    /* add your own stuff here.. */
    19979 -    aPath.0 = i - 1;
    19980 -return 0;
    19981 -
    19982 -
    19983 -/**
    19984 - * Configure a path.
    19985 - * @returns Path on success.
    19986 - *          '' on failure.
    19987 - * @param   sOperation  The operation - 'config' or 'forcedconfig'
    19988 - * @param   sPathId     The path to configure.
    19989 - * @param   sToolId     The tool Id.
    19990 - */
    19991 -PathConfig: procedure expose aCfg. aPath.
    19992 -    parse arg sOperation, sPathId, sToolId
    19993 -
    19994 -    /*
    19995 -     * If not forced we'll ask first.
    19996 -     */
    19997 -    if (sOperation <> 'forcedconfig') then
    19998 -    do
    19999 -        say 'Do you want to configure the path '''sPathId''/* for the '''sToolId'''('CfgDesc(sToolId)') tool?*/ '(y/N)';
    20000 -        sAnswer = PullUser(1);
    20001 -        if (substr(strip(sAnswer),1,1) <> 'Y') then
    20002 -            return '';
    20003 -    end
    20004 -
    20005 -    /*
    20006 -     * Config loop.
    20007 -     */
    20008 -    do i = 1 to 128
    20009 -
    20010 -        say 'Give us the path for '''sPathId'''('''sToolId'''/'CfgDesc(sToolId)'):'
    20011 -        sThePath = translate(strip(strip(strip(PullUser()), 'T','\'),'T','/'), '\', '/');
    20012 -        /*say 'Debug: sThePath='sThePath;*/
    20013 -        if ((sThePath <> '') & (sThePath = translate(sThePath,'','#!$@%|<>;õ&Ï='))) then
    20014 -        do
    20015 -            /*
    20016 -             * Add it to internal struct.
    20017 -             */
    20018 -            call PathRemove(sPathId);
    20019 -            j = aPath.0 + 1;
    20020 -            aPath.j.sPId = strip(sPathId);
    20021 -            aPath.j.sPath = translate(strip(strip(strip(sThePath), 'T','\'),'T','/'), '\', '/');
    20022 -            aPath.0 = j;
    20023 -            return sThePath;
    20024 -        end
    20025 -        else
    20026 -            say 'error: invalid path name.';
    20027 -        say 'Debug 9'
    20028 -
    20029 -        /* ask if retry */
    20030 -        if (i >= 2) then
    20031 -            say 'You''re not trying hard, are you?';
    20032 -        say 'Wanna try giving us an *valid* path for the path '''sPathId''' for the '''sToolId'''('CfgDesc(sToolId)') tool? (y/N)';
    20033 -        sAnswer = PullUser(1);
    20034 -        if (substr(strip(sAnswer),1,1) <> 'Y') then
    20035 -            leave;
    20036 -    end
    20037 -
    20038 -    say 'Giving up!';
    20039 -return '';
    20040 -
    20041 -
    20042 -/**
    20043 - * Get user response and empties the input queue.
    20044 - * @returns     User input.
    20045 - * @param       fUpper  If present and set uppercase the user response.
    20046 - */
    20047 -PullUser: procedure
    20048 -    parse arg fUpper
    20049 -    if (fUpper = '') then
    20050 -        fUpper = 0;
    20051 -
    20052 -    signal on halt name PullUser_Handler
    20053 -    signal on syntax name PullUser_Handler
    20054 -    signal on notready name PullUser_Handler
    20055 -    parse pull sAnswer;
    20056 -    signal off syntax
    20057 -    signal off halt
    20058 -    signal off notready
    20059 -    /*say 'Debug: sAnswer='c2x(sAnswer);
    20060 -    sAnswer = strip(strip(sAnswer, 'T', '0A'x), 'T', '0D'x);*/
    20061 -
    20062 -    if (fUpper) then
    20063 -        sAnswer = translate(sAnswer);
    20064 -    /* flush input */
    20065 -    do while (Queued())
    20066 -        pull dummy;
    20067 -    end
    20068 -return sAnswer;
    20069 -
    20070 -
    20071 -/**
    20072 - * No value handler
    20073 - */
    20074 -PullUser_Handler:
    20075 -    say 'fatal error: Believe Ctrl-Break/C might have been pressed.';
    20076 -    signal off syntax
    20077 -    signal off halt
    20078 -    signal off syntax
    20079 -    signal off notready
    20080 -    do while (Queued())
    20081 -        pull dummy;
    20082 -    end
    20083 -exit(16);
    20084 -
    20085 -
    20086 -/**
    20087 - * Checks if a file exists.
    20088 - * @param   sFile       Name of the file to look for.
    20089 - * @param   sComplain   Complaint text. Complain if non empty and not found.
    20090 - * @returns TRUE if file exists.
    20091 - *          FALSE if file doesn't exists.
    20092 - */
    20093 -FileExists: procedure
    20094 -    parse arg sFile, sComplain
    20095 -    rc = stream(sFile, 'c', 'query exist');
    20096 -    if ((rc = '') & (sComplain <> '')) then
    20097 -        say sComplain ''''sFile'''.';
    20098 -return rc <> '';
    20099 -
    20100 -
    20101 -/**
    20102 - * Checks if a directory exists.
    20103 - * @param   sDir        Name of the directory to look for.
    20104 - * @param   sComplain   Complaint text. Complain if non empty and not found.
    20105 - * @returns TRUE if file exists.
    20106 - *          FALSE if file doesn't exists.
    20107 - */
    20108 -DirExists: procedure
    20109 -    parse arg sDir, sComplain
    20110 -    rc = SysFileTree(sDir, 'sDirs', 'DO');
    20111 -    if (rc = 0 & sDirs.0 = 1) then
    20112 -        return 1;
    20113 -    if (sComplain <> '') then do
    20114 -        say sComplain ''''sDir'''.';
    20115 -return 0;
    20116 -
    20117 -
    20118 -/**
    20119 - * Add sToAdd in front of sEnvVar.
    20120 - * Note: sToAdd now is allowed to be alist!
    20121 - *
    20122 - * Known features: Don't remove sToAdd from original value if sToAdd
    20123 - *                 is at the end and don't end with a ';'.
    20124 - */
    20125 -EnvAddFront: procedure
    20126 -    parse arg fRM, sEnvVar, sToAdd, sSeparator
    20127 -
    20128 -    /* sets default separator if not specified. */
    20129 -    if (sSeparator = '') then sSeparator = ';';
    20130 -
    20131 -    /* checks that sToAdd ends with an ';'. Adds one if not. */
    20132 -    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    20133 -        sToAdd = sToAdd || sSeparator;
    20134 -
    20135 -    /* check and evt. remove ';' at start of sToAdd */
    20136 -    if (substr(sToAdd, 1, 1) = ';') then
    20137 -        sToAdd = substr(sToAdd, 2);
    20138 -
    20139 -    /* loop thru sToAdd */
    20140 -    rc = 0;
    20141 -    i = length(sToAdd);
    20142 -    do while i > 1 & rc = 0
    20143 -        j = lastpos(sSeparator, sToAdd, i-1);
    20144 -        rc = EnvAddFront2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
    20145 -        i = j;
    20146 -    end
    20147 -
    20148 -return rc;
    20149 -
    20150 -/**
    20151 - * Add sToAdd in front of sEnvVar.
    20152 - *
    20153 - * Known features: Don't remove sToAdd from original value if sToAdd
    20154 - *                 is at the end and don't end with a ';'.
    20155 - */
    20156 -EnvAddFront2: procedure
    20157 -    parse arg fRM, sEnvVar, sToAdd, sSeparator
    20158 -
    20159 -    /* sets default separator if not specified. */
    20160 -    if (sSeparator = '') then sSeparator = ';';
    20161 -
    20162 -    /* checks that sToAdd ends with a separator. Adds one if not. */
    20163 -    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    20164 -        sToAdd = sToAdd || sSeparator;
    20165 -
    20166 -    /* check and evt. remove the separator at start of sToAdd */
    20167 -    if (substr(sToAdd, 1, 1) = sSeparator) then
    20168 -        sToAdd = substr(sToAdd, 2);
    20169 -
    20170 -    /* Get original variable value */
    20171 -    sOrgEnvVar = EnvGet(sEnvVar);
    20172 -
    20173 -    /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
    20174 -    i = pos(translate(sToAdd), translate(sOrgEnvVar));
    20175 -    if (i > 0) then
    20176 -        sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
    20177 -
    20178 -    /* set environment */
    20179 -    if (fRM) then
    20180 -        return EnvSet(0, sEnvVar, sOrgEnvVar);
    20181 -return EnvSet(0, sEnvVar, sToAdd||sOrgEnvVar);
    20182 -
    20183 -
    20184 -/**
    20185 - * Add sToAdd as the end of sEnvVar.
    20186 - * Note: sToAdd now is allowed to be alist!
    20187 - *
    20188 - * Known features: Don't remove sToAdd from original value if sToAdd
    20189 - *                 is at the end and don't end with a ';'.
    20190 - */
    20191 -EnvAddEnd: procedure
    20192 -    parse arg fRM, sEnvVar, sToAdd, sSeparator
    20193 -
    20194 -    /* sets default separator if not specified. */
    20195 -    if (sSeparator = '') then sSeparator = ';';
    20196 -
    20197 -    /* checks that sToAdd ends with a separator. Adds one if not. */
    20198 -    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    20199 -        sToAdd = sToAdd || sSeparator;
    20200 -
    20201 -    /* check and evt. remove ';' at start of sToAdd */
    20202 -    if (substr(sToAdd, 1, 1) = sSeparator) then
    20203 -        sToAdd = substr(sToAdd, 2);
    20204 -
    20205 -    /* loop thru sToAdd */
    20206 -    rc = 0;
    20207 -    i = length(sToAdd);
    20208 -    do while i > 1 & rc = 0
    20209 -        j = lastpos(sSeparator, sToAdd, i-1);
    20210 -        rc = EnvAddEnd2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
    20211 -        i = j;
    20212 -    end
    20213 -
    20214 -return rc;
    20215 -
    20216 -/**
    20217 - * Add sToAdd as the end of sEnvVar.
    20218 - *
    20219 - * Known features: Don't remove sToAdd from original value if sToAdd
    20220 - *                 is at the end and don't end with a ';'.
    20221 - */
    20222 -EnvAddEnd2: procedure
    20223 -    parse arg fRM, sEnvVar, sToAdd, sSeparator
    20224 -
    20225 -    /* sets default separator if not specified. */
    20226 -    if (sSeparator = '') then sSeparator = ';';
    20227 -
    20228 -    /* checks that sToAdd ends with a separator. Adds one if not. */
    20229 -    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    20230 -        sToAdd = sToAdd || sSeparator;
    20231 -
    20232 -    /* check and evt. remove separator at start of sToAdd */
    20233 -    if (substr(sToAdd, 1, 1) = sSeparator) then
    20234 -        sToAdd = substr(sToAdd, 2);
    20235 -
    20236 -    /* Get original variable value */
    20237 -    sOrgEnvVar = EnvGet(sEnvVar);
    20238 -
    20239 -    if (sOrgEnvVar <> '') then
    20240 -    do
    20241 -        /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
    20242 -        i = pos(translate(sToAdd), translate(sOrgEnvVar));
    20243 -        if (i > 0) then
    20244 -            sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
    20245 -
    20246 -        /* checks that sOrgEnvVar ends with a separator. Adds one if not. */
    20247 -        if (sOrgEnvVar = '') then
    20248 -            if (right(sOrgEnvVar,1) <> sSeparator) then
    20249 -                sOrgEnvVar = sOrgEnvVar || sSeparator;
    20250 -    end
    20251 -
    20252 -    /* set environment */
    20253 -    if (fRM) then return EnvSet(0, sEnvVar, sOrgEnvVar);
    20254 -return EnvSet(0, sEnvVar, sOrgEnvVar||sToAdd);
    20255 -
    20256 -
    20257 -/**
    20258 - * Sets sEnvVar to sValue.
    20259 - */
    20260 -EnvSet: procedure
    20261 -    parse arg fRM, sEnvVar, sValue
    20262 -
    20263 -    /* if we're to remove this, make valuestring empty! */
    20264 -    if (fRM) then
    20265 -        sValue = '';
    20266 -    sEnvVar = translate(sEnvVar);
    20267 -
    20268 -    /*
    20269 -     * Begin/EndLibpath fix:
    20270 -     *      We'll have to set internal these using both commandline 'SET'
    20271 -     *      and internal VALUE in order to export it and to be able to
    20272 -     *      get it (with EnvGet) again.
    20273 -     */
    20274 -    if ((sEnvVar = 'BEGINLIBPATH') | (sEnvVar = 'ENDLIBPATH')) then
    20275 -    do
    20276 -        if (length(sValue) >= 1024) then
    20277 -            say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
    20278 -        return SysSetExtLibPath(sValue, substr(sEnvVar, 1, 1));
    20279 -    end
    20280 -
    20281 -    if (length(sValue) >= 1024) then
    20282 -    do
    20283 -        say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
    20284 -        say '    This may make CMD.EXE unstable after a SET operation to print the environment.';
    20285 -    end
    20286 -    sRc = VALUE(sEnvVar, sValue, 'OS2ENVIRONMENT');
    20287 -return 0;
    20288 -
    20289 -/**
    20290 - * Gets the value of sEnvVar.
    20291 - */
    20292 -EnvGet: procedure
    20293 -    parse arg sEnvVar
    20294 -    if ((translate(sEnvVar) = 'BEGINLIBPATH') | (translate(sEnvVar) = 'ENDLIBPATH')) then
    20295 -        return SysQueryExtLibPath(substr(sEnvVar, 1, 1));
    20296 -return value(sEnvVar,, 'OS2ENVIRONMENT');
    20297 -
    20298 -
    20299 -/**
    20300 - *  Workaround for bug in CMD.EXE.
    20301 - *  It messes up when REXX have expanded the environment.
    20302 - */
    20303 -FixCMDEnv: procedure
    20304 -    /* check for 4OS2 first */
    20305 -    Address CMD 'set 4os2test_env=%@eval[2 + 2]';
    20306 -    if (value('4os2test_env',, 'OS2ENVIRONMENT') = '4') then
    20307 -        return 0;
    20308 -
    20309 -    /* force environment expansion by setting a lot of variables and freeing them. */
    20310 -    do i = 1 to 100
    20311 -        Address CMD '@set dummyenvvar'||i'=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    20312 -    end
    20313 -    do i = 1 to 100
    20314 -        Address CMD '@set dummyenvvar'||i'=';
    20315 -    end
    20316 -return 0;
    20317 -
    20318 -
    20319 -/**
    20320 - * Execute a command and match output and return code.
    20321 - *
    20322 - * @returns  0 on match.
    20323 - *          49 on return code mismatch.
    20324 - *          99 on output mistmatch.
    20325 - * @param   sCmd                    The command to execute.
    20326 - * @param   rcCmdExepcted           The expected return code from the command.
    20327 - * @param   sOutputPartExpected     A 'needle' of the output 'haystack'.
    20328 - */
    20329 -CheckCmdOutput: procedure
    20330 -    parse arg sCmd, rcCmdExpected, fQuiet, sOutputPartExpected
    20331 -
    20332 -    /*
    20333 -     * Try execute the command
    20334 -     */
    20335 -    queTmp = RxQueue('Create');
    20336 -    queOld = RxQueue('Set', queTmp);
    20337 -    Address CMD sCmd || ' 2>&1 | RxQueue' queTmp;
    20338 -    rcCmd = rc;
    20339 -
    20340 -    /* get output */
    20341 -    sOutput = '';
    20342 -    do while (queued() > 0)
    20343 -        parse pull sLine
    20344 -        sOutput = sOutput || sLine || '0d0a'x
    20345 -    end
    20346 -    call RxQueue 'Delete', RxQueue('Set', queOld);
    20347 -
    20348 -    /*
    20349 -     * If command
    20350 -     */
    20351 -    rc = 0;
    20352 -    if (/*rcCmd = rcCmdExpected*/ 1) then /* doesn't work with cmd.exe */
    20353 -    do
    20354 -        if (pos(sOutputPartExpected, sOutput) <= 0) then
    20355 -        do
    20356 -            say 'Debug - start'
    20357 -            say 'Debug:' sOutputPartExpected
    20358 -            say 'Debug: not found in:'
    20359 -            say sOutput
    20360 -            say 'Debug - end'
    20361 -            rc = 99
    20362 -        end
    20363 -    end
    20364 -    else
    20365 -        rc = 49
    20366 -
    20367 -    if (\fQuiet & rc <> 0) then
    20368 -        say 'Debug:' sCmd 'rc='rc' rcCmd='rcCmd 'rcCmdExpected='rcCmdExpected;
    20369 -return rc;
    20370 -
    20371 -
    20372 -/**
    20373 - * Checks syslevel info.
    20374 - * @returns 0 if match.
    20375 - *          <>0 if mismatch.
    20376 - * @param   sFile           Name of the syslevel file.
    20377 - * @param   fQuiet          Quiet / verbose flag.
    20378 - * @param   sMatchCid       Component id. (optional)
    20379 - * @param   sMatchVer       Version id. (optional)
    20380 - * @param   sMatchLevel     Current Level. (optional)
    20381 - * @param   sMatchTitle     Product title. (optional)
    20382 - * @param   sMatchKind      Product kind. (optional)
    20383 - * @param   sMatchType      Product type. (optional)
    20384 - */
    20385 -CheckSyslevel: procedure
    20386 -parse arg sFile, fQuiet, sMatchCId,sMatchVer,sMatchLevel,sMatchTitle,iMatchKind,sMatchType,dummy
    20387 -
    20388 -    iRc = -1;
    20389 -
    20390 -    /* Open the file */
    20391 -    rc = stream(sFile, 'c', 'open read');
    20392 -    if (pos('READY', rc) = 1) then
    20393 -    do
    20394 -        if (charin(sFile, 1, 11) = 'FF'x'FF'x'SYSLEVEL'||'00'x) then
    20395 -        do
    20396 -            /* read base offset (binary long) */
    20397 -            iBase = c2x(charin(sFile, 34, 4));
    20398 -            iBase = 1 + x2d(right(iBase,2)||substr(iBase,5,2)||substr(iBase,3,2)||left(iBase,2));
    20399 -
    20400 -            /* Read fields...
    20401 -             *
    20402 -             *  typedef struct _SYSLEVELDATA {      offset
    20403 -             *     unsigned char d_reserved1[2];     0
    20404 -             *     unsigned char d_kind;             2
    20405 -             *     unsigned char d_version[2];       3
    20406 -             *     unsigned char d_reserved2[2];     5
    20407 -             *     unsigned char d_clevel[7];        7
    20408 -             *     unsigned char d_reserved3;       14
    20409 -             *     unsigned char d_plevel[7];       15
    20410 -             *     unsigned char d_reserved4;       22
    20411 -             *     unsigned char d_title[80];       23
    20412 -             *     unsigned char d_cid[9];         103
    20413 -             *     unsigned char d_revision;       112
    20414 -             *     unsigned char d_type[1];        113
    20415 -             *  } SYSLEVELDATA;
    20416 -             */
    20417 -            iKind       =   c2d(charin(sFile, iBase+  2,  1));
    20418 -            iVer        =       charin(sFile, iBase+  3,  2);
    20419 -            sCurLevel   = strip(charin(sFile, iBase+  7,  7), 'T', '00'x);
    20420 -            sPreLevel   = strip(charin(sFile, iBase+ 15,  7), 'T', '00'x);
    20421 -            sTitle      = strip(charin(sFile, iBase+ 23, 80), 'T', '00'x);
    20422 -            sCId        =       charin(sFile, iBase+103,  9);
    20423 -            iRev        =       charin(sFile, iBase+112,  1);
    20424 -            sType       = strip(charin(sFile, iBase+113, 10), 'T', '00'x);
    20425 -
    20426 -            sVer = substr(c2x(substr(iVer, 1, 1)), 1, 1)||,
    20427 -                   '.'||,
    20428 -                   substr(c2x(substr(iVer, 1, 1)), 2, 1)||,
    20429 -                   d2c(c2d(substr(iVer, 2, 1)) + 48);
    20430 -            if (iRev <> 0) then
    20431 -                sVer = sVer ||'.'|| d2c(c2d(iRev) + 48);
    20432 -
    20433 -            /*
    20434 -             * Compare.
    20435 -             */
    20436 -            iRc = 0;
    20437 -            if (sMatchCId <> '' & sMatchCId <> sCid) then
    20438 -            do
    20439 -                if (\fQuiet) then
    20440 -                    say 'syslevel '''sFile''': cid '''sCId''' != '''sMatchCId'''.';
    20441 -                iRc = 2;
    20442 -            end
    20443 -            if (sMatchVer <> '' & sMatchVer <> sVer) then
    20444 -            do
    20445 -                if (\fQuiet) then
    20446 -                    say 'syslevel '''sFile''': ver '''sVer''' != '''sMatchVer'''.';
    20447 -                iRc = 3;
    20448 -            end
    20449 -            if (sMatchLevel <> '' & sMatchLevel <> sCurLevel) then
    20450 -            do
    20451 -                if (\fQuiet) then
    20452 -                    say 'syslevel '''sFile''': level '''sCurLevel''' != '''sMatchLevel'''.';
    20453 -                iRc = 4;
    20454 -            end
    20455 -            if (sMatchTitle <> '' & sMatchTitle <> sTitle) then
    20456 -            do
    20457 -                if (\fQuiet) then
    20458 -                    say 'syslevel '''sFile''': title '''sTitle''' != '''sMatchTitle'''.';
    20459 -                iRc = 5;
    20460 -            end
    20461 -            if (iMatchKind <> '' & iMatchKind <> iKind) then
    20462 -            do
    20463 -                if (\fQuiet) then
    20464 -                    say 'syslevel '''sFile''': kind '''iKind''' != '''iMatchKind'''.';
    20465 -                iRc = 6;
    20466 -            end
    20467 -            if (sMatchType <> '' & sMatchType <> sType) then
    20468 -            do
    20469 -                if (\fQuiet) then
    20470 -                    say 'syslevel '''sFile''': type '''sType''' != '''sMatchType'''.';
    20471 -                iRc = 7;
    20472 -            end
    20473 -            /*
    20474 -            say 'debug:'
    20475 -            say 'iKind       =' iKind
    20476 -            say 'sCurLevel   =' sCurLevel
    20477 -            say 'sPreLevel   =' sPreLevel
    20478 -            say 'sTitle      =' sTitle
    20479 -            say 'sCId        =' sCId
    20480 -            say 'sType       =' sType
    20481 -            say 'sVer        =' sVer
    20482 -            */
    20483 -        end
    20484 -        else
    20485 -            say 'bad signature';
    20486 -
    20487 -        /* finished, close file */
    20488 -        call stream sFile, 'c', 'close';
    20489 -    end
    20490 -    else say 'open failed, rc='rc;
    20491 -return iRc;
    20492 -
    20493 -
    20494 -
    20495 -/**
    20496 - * Tool procedures section
    20497 - * @returns 0 on success.
    20498 - *          1 if PathQuery() failed.
    20499 - *          2 if some vital file/dir wasn't found in the config verify.
    20500 - *          49 if verify command rc mismatched.
    20501 - *          99 if verify command output mismatched.
    20502 - **/
    20503 -
    20504 -
    20505 -/*
    20506 - * Concurrent Versions System (CVS)
    20507 - */
    20508 -CVS: procedure expose aCfg. aPath.
    20509 -    parse arg sToolId,sOperation,fRM,fQuiet
    20510 -
    20511 -
    20512 -    /*
    20513 -     * The directories.
    20514 -     */
    20515 -    sPathCVS = PathQuery('cvs', sToolId, sOperation);
    20516 -    if (sPathCVS = '') then
    20517 -        return 1;
    20518 -    sPathHome = PathQuery('home', sToolId, sOperation);
    20519 -    if (sPathHome = '') then
    20520 -        return 1;
    20521 -    /* If config operation we're done now. */
    20522 -    if (pos('config', sOperation) > 0) then
    20523 -        return 0;
    20524 -
    20525 -    /*
    20526 -     * Installing the environment variables.
    20527 -     */
    20528 -    call EnvSet      fRM, 'PATH_CVS',    sPathCVS;
    20529 -    call EnvAddFront fRM, 'path',        sPathCVS'\bin;'
    20530 -    call EnvAddFront fRM, 'bookshelf',   sPathCVS'\book;'
    20531 -    call EnvAddFront fRM, 'bookshelf',   sPathCVS'\book;'
    20532 -    call EnvSet      fRM, 'home',        translate(sPathHome, '/','\');
    20533 -
    20534 -    /*
    20535 -     * Verify.
    20536 -     */
    20537 -    if (pos('verify', sOperation) <= 0) then
    20538 -        return 0;
    20539 -
    20540 -    if (\CfgVerifyFile(sPathCVS'\bin\cvs.exe',fQuiet)) then
    20541 -            return 2;
    20542 -    if (length(sPathHome) <= 2) then
    20543 -    do
    20544 -        if (\fQuiet) then
    20545 -            say 'Error: The home directory is to short!';
    20546 -        return 2;
    20547 -    end
    20548 -    if (\CfgVerifyDir(sPathHome, fQuiet)) then
    20549 -        return 2;
    20550 -return CheckCmdOutput('cvs --version', 0, fQuiet, 'Concurrent Versions System (CVS) 1.1');
    20551 -
    20552 -
    20553 -/*
    20554 - * EMX
    20555 - */
    20556 -EMX: procedure expose aCfg. aPath.
    20557 -    parse arg sToolId,sOperation,fRM,fQuiet
    20558 -
    20559 -    /*
    20560 -     * EMX/GCC main directory.
    20561 -     */
    20562 -    sEMX = PathQuery('emx', sToolId, sOperation);
    20563 -    if (sEMX = '') then
    20564 -        return 1;
    20565 -    /* If config operation we're done now. */
    20566 -    if (pos('config', sOperation) > 0) then
    20567 -        return 0;
    20568 -
    20569 -    sEMXBack    = translate(sEMX, '\', '/');
    20570 -    sEMXForw    = translate(sEMX, '/', '\');
    20571 -    call EnvSet      fRM, 'PATH_EMX', sEMXBack;
    20572 -    call EnvSet      fRM, 'CCENV',      'EMX'
    20573 -    call EnvSet      fRM, 'BUILD_ENV',  'EMX'
    20574 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    20575 -
    20576 -    call EnvAddFront fRM, 'BEGINLIBPATH',       sEMXBack'\dll;'
    20577 -    call EnvAddFront fRM, 'PATH',               sEMXBack'\bin;'
    20578 -    call EnvAddFront fRM, 'DPATH',              sEMXBack'\book;'
    20579 -    call EnvAddFront fRM, 'BOOKSHELF',          sEMXBack'\book;'
    20580 -    call EnvAddFront fRM, 'HELP',               sEMXBack'\help;'
    20581 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sEMXForw'/include'
    20582 -    call EnvAddFront fRM, 'LIBRARY_PATH',       sEMXForw'/lib'
    20583 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sEMXForw'/include/cpp;'sEMXForw'/include'
    20584 -    call EnvSet      fRM, 'PROTODIR',           sEMXForw'/include/cpp/gen'
    20585 -    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sEMXForw'/include'
    20586 -    call EnvSet      fRM, 'GCCLOAD',            '5'
    20587 -    call EnvSet      fRM, 'GCCOPT',             '-pipe'
    20588 -    call EnvAddFront fRM, 'INFOPATH',           sEMXForw'/info'
    20589 -    call EnvSet      fRM, 'EMXBOOK',            'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf'
    20590 -    call EnvAddFront fRM, 'HELPNDX',            'emxbook.ndx', '+', 1
    20591 -    call EnvSet      fRM, 'EMXOPT',             '-c -n -h1024'
    20592 -    if EnvGet('TERM') = '' then do
    20593 -        call EnvSet  fRM, 'TERM',               'ansi'
    20594 -        call EnvSet  fRM, 'TERMCAP',            sEMXForw'/etc/termcap.dat'
    20595 -    end
    20596 -
    20597 -    /*
    20598 -     * Verify.
    20599 -     */
    20600 -    if (pos('verify', sOperation) <= 0) then
    20601 -        return 0;
    20602 -    if (    \CfgVerifyFile(sEmxBack'\bin\gcc.exe', fQuiet),
    20603 -        |   \CfgVerifyFile(sEmxBack'\bin\emxomf.exe', fQuiet),
    20604 -        |   \CfgVerifyFile(sEmxBack'\bin\emxrev.cmd', fQuiet),
    20605 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\c.a', fQuiet),
    20606 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\c.lib', fQuiet),
    20607 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\sys.lib', fQuiet),
    20608 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\emx.a', fQuiet),
    20609 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\emx.lib', fQuiet),
    20610 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\c_import.a', fQuiet),
    20611 -        |   \CfgVerifyFile(sEmxBack'\lib\mt\c_import.lib', fQuiet),
    20612 -        |   \CfgVerifyFile(sEmxBack'\lib\c_alias.a', fQuiet),
    20613 -        |   \CfgVerifyFile(sEmxBack'\lib\c_alias.lib', fQuiet),
    20614 -        |   \CfgVerifyFile(sEmxBack'\lib\emx2.a', fQuiet),
    20615 -        |   \CfgVerifyFile(sEmxBack'\lib\emx2.lib', fQuiet),
    20616 -        ) then
    20617 -        return 2;
    20618 -    rc = CheckCmdOutput('gcc --version', 0, fQuiet, '2.8.1');
    20619 -    if (rc = 0) then
    20620 -        rc = CheckCmdOutput('emxrev.cmd', 0, fQuiet,,
    20621 -                            'EMX : revision = 61'||'0d0a'x ||,
    20622 -                            'EMXIO : revision = 60'||'0d0a'x||,
    20623 -                            'EMXLIBC : revision = 63'||'0d0a'x||,
    20624 -                            'EMXLIBCM : revision = 64'||'0d0a'x||,
    20625 -                            'EMXLIBCS : revision = 64'||'0d0a'x||,
    20626 -                            'EMXWRAP : revision = 60'||'0d0a'x);
    20627 -    return rc;
    20628 -return 0;
    20629 -
    20630 -
    20631 -/*
    20632 - * EMX PGCC - must be installed on to the ordinar EMX.
    20633 - */
    20634 -EMXPGCC: procedure expose aCfg. aPath.
    20635 -    parse arg sToolId,sOperation,fRM,fQuiet
    20636 -
    20637 -    /*
    20638 -     * EMX/GCC main directory.
    20639 -     */
    20640 -    sEMXPGCC    = PathQuery('emxpgcc', sToolId, sOperation);
    20641 -    if (sEMXPGCC = '') then
    20642 -        return 1;
    20643 -    /* If config operation we're done now. */
    20644 -    if (pos('config', sOperation) > 0) then
    20645 -        return 0;
    20646 -
    20647 -    sEMXBack    = translate(sEMXPGCC, '\', '/');
    20648 -    sEMXForw    = translate(sEMXPGCC, '/', '\');
    20649 -    call EnvSet      fRM, 'PATH_EMXPGCC',   sEMXBack;
    20650 -    call EnvSet      fRM, 'CCENV',          'EMX'
    20651 -    call EnvSet      fRM, 'BUILD_ENV',      'EMX'
    20652 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    20653 -
    20654 -    call EnvAddFront fRM, 'BEGINLIBPATH',       sEMXBack'\dll;'
    20655 -    call EnvAddFront fRM, 'PATH',               sEMXBack'\bin;'
    20656 -    call EnvAddFront fRM, 'DPATH',              sEMXBack'\book;'
    20657 -    call EnvAddFront fRM, 'BOOKSHELF',          sEMXBack'\book;'
    20658 -    call EnvAddFront fRM, 'HELP',               sEMXBack'\help;'
    20659 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sEMXForw'/include'
    20660 -    call EnvAddFront fRM, 'LIBRARY_PATH',       sEMXForw'/lib'
    20661 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sEMXForw'/include/cpp;'sEMXForw'/include'
    20662 -    call EnvSet      fRM, 'PROTODIR',           sEMXForw'/include/cpp/gen'
    20663 -    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sEMXForw'/include'
    20664 -    call EnvAddFront fRM, 'INFOPATH',           sEMXForw'/info'
    20665 -    call EnvSet      fRM, 'EMXBOOK',            'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf'
    20666 -    call EnvAddFront fRM, 'HELPNDX',            'emxbook.ndx', '+', 1
    20667 -
    20668 -    /*
    20669 -     * Verify.
    20670 -     */
    20671 -    if (pos('verify', sOperation) <= 0) then
    20672 -        return 0;
    20673 -    if (    \CfgVerifyFile(sEmxBack'\bin\gcc.exe', fQuiet),
    20674 -        |   \CfgVerifyFile(sEmxBack'\bin\g++.exe', fQuiet),
    20675 -        |   \CfgVerifyFile(sEmxBack'\bin\as.exe', fQuiet),
    20676 -        |   \CfgVerifyFile(sEmxBack'\bin\emxomf.exe', fQuiet),
    20677 -        |   \CfgVerifyFile(sEmxBack'\lib\gcc29160.a', fQuiet),
    20678 -        |   \CfgVerifyFile(sEmxBack'\lib\gcc29160.lib', fQuiet),
    20679 -        |   \CfgVerifyFile(sEmxBack'\lib\iberty.a', fQuiet),
    20680 -        |   \CfgVerifyFile(sEmxBack'\lib\iberty.lib', fQuiet),
    20681 -        |   \CfgVerifyFile(sEmxBack'\lib\iberty_s.a', fQuiet),
    20682 -        |   \CfgVerifyFile(sEmxBack'\lib\iberty_s.lib', fQuiet),
    20683 -        |   \CfgVerifyFile(sEmxBack'\lib\opcodes.a', fQuiet),
    20684 -        |   \CfgVerifyFile(sEmxBack'\lib\opcodes.lib', fQuiet),
    20685 -        |   \CfgVerifyFile(sEmxBack'\lib\opcodes_s.a', fQuiet),
    20686 -        |   \CfgVerifyFile(sEmxBack'\lib\opcodes_s.lib', fQuiet),
    20687 -        ) then
    20688 -        return 2;
    20689 -    rc = CheckCmdOutput('gcc --version', 0, fQuiet, 'pgcc-2.95.2');
    20690 -    if (rc = 0) then
    20691 -        rc = CheckCmdOutput('g++ --version', 0, fQuiet, 'pgcc-2.95.2');
    20692 -    if (rc = 0) then
    20693 -        rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 2.9.1');
    20694 -return rc;
    20695 -
    20696 -
    20697 -/*
    20698 - * FreeType v1.3.1 EMX release.
    20699 - */
    20700 -FreeTypeEMX: procedure expose aCfg. aPath.
    20701 -    parse arg sToolId,sOperation,fRM,fQuiet
    20702 -    sPathFreeType = PathQuery('freetypeemx', sToolId, sOperation);
    20703 -    if (sPathFreeType = '') then
    20704 -        return 1;
    20705 -    /* If config operation we're done now. */
    20706 -    if (pos('config', sOperation) > 0) then
    20707 -        return 0;
    20708 -    call EnvSet      fRm, 'PATH_FREETYPE', sPathFreeType;
    20709 -    call EnvAddFront fRm, 'beginlibpath',sPathFreeType'\dll;'
    20710 -    call EnvAddFront fRm, 'path',        sPathFreeType'\bin;'
    20711 -    call EnvAddFront fRM, 'include',     sPathFreeType'\include;'
    20712 -    call EnvAddFront fRM, 'C_INCLUDE_PATH', sPathFreeType'\include;'
    20713 -    call EnvAddFront fRM, 'lib',         sPathFreeType'\lib;'
    20714 -
    20715 -    /*
    20716 -     * Verify.
    20717 -     */
    20718 -    if (pos('verify', sOperation) <= 0) then
    20719 -        return 0;
    20720 -
    20721 -    if (    \CfgVerifyFile(sPathFreeType'\bin\ftsbit.exe', fQuiet),
    20722 -        |   \CfgVerifyFile(sPathFreeType'\bin\ftzoom.exe', fQuiet),
    20723 -        |   \CfgVerifyFile(sPathFreeType'\dll\ttf.dll', fQuiet),
    20724 -        ) then
    20725 -        return 2;
    20726 -return 0;
    20727 -
    20728 -
    20729 -/*
    20730 - * IBM DB2 v5.2
    20731 - */
    20732 -db2v52: procedure expose aCfg. aPath.
    20733 -    parse arg sToolId,sOperation,fRM,fQuiet
    20734 -    sPathDB2   = PathQuery('db2v52', sToolId, sOperation);
    20735 -    if (sPathDB2 = '') then
    20736 -        return 1;
    20737 -    /* If config operation we're done now. */
    20738 -    if (pos('config', sOperation) > 0) then
    20739 -        return 0;
    20740 -    call EnvSet      fRm, 'PATH_DB2',    sPathDB2;
    20741 -    call EnvSet      fRm, 'db2path',     sPathDB2;
    20742 -    call EnvAddFront fRm, 'beginlibpath',sPathDB2'\dll;'sPathDB2'\alt;'
    20743 -    call EnvAddFront fRm, 'path',        sPathDB2'\bin;'sPathDB2'\alt;'
    20744 -    call EnvAddFront fRm, 'dpath',       sPathDB2'\bin;'sPathDB2';'
    20745 -    call EnvAddFront fRm, 'help',        sPathDB2'\help;'
    20746 -    call EnvAddEnd   fRm, 'classpath',   '.;'sPathDB2'\JAVA\DB2JAVA.ZIP;'sPathDB2'\JAVA\RUNTIME.ZIP;'sPathDB2'\JAVA\SQLJ.ZIP;'
    20747 -    call EnvSet      fRM, 'db2instace',  'DB2'
    20748 -    /*call EnvSet      fRM, 'odbc_path',   'f:\odbc' -- huh? what's this? */
    20749 -    call EnvAddFront fRM, 'cobcpy',      sPathDB2'\include\cobol_mf'
    20750 -    call EnvSet      fRM, 'finclude',    sPathDB2'\include'
    20751 -    call EnvAddFront fRM, 'include',     sPathDB2'\include;'
    20752 -    call EnvAddFront fRM, 'lib',         sPathDB2'\lib;'
    20753 -
    20754 -    /*
    20755 -     * Verify.
    20756 -     */
    20757 -    if (pos('verify', sOperation) <= 0) then
    20758 -        return 0;
    20759 -
    20760 -    if (    \CfgVerifyFile(sPathDB2'\bin\db2.exe', fQuiet),
    20761 -        |   \CfgVerifyFile(sPathDB2'\bin\sqlbind.exe', fQuiet),
    20762 -        |   \CfgVerifyFile(sPathDB2'\bin\sqlprep.exe', fQuiet),
    20763 -        |   \CfgVerifyFile(sPathDB2'\lib\db2api.lib', fQuiet),
    20764 -        |   \CfgVerifyFile(sPathDB2'\lib\db2cli.lib', fQuiet),
    20765 -        |   \CfgVerifyFile(sPathDB2'\lib\db2gmf32.lib', fQuiet),
    20766 -        |   \CfgVerifyFile(sPathDB2'\include\sql.h', fQuiet),
    20767 -        |   \CfgVerifyFile(sPathDB2'\include\sqlcodes.h', fQuiet),
    20768 -        |   \CfgVerifyFile(sPathDB2'\include\sqlsystm.h', fQuiet),
    20769 -        |   \CfgVerifyFile(sPathDB2'\include\sqlcli.h', fQuiet),
    20770 -        ) then
    20771 -        return 2;
    20772 -    rc = CheckCmdOutput('echo quit | db2', 0, fQuiet, 'Command Line Processor for DB2 SDK 5.2.0');
    20773 -return rc;
    20774 -
    20775 -
    20776 -
    20777 -/*
    20778 - *  Device Driver Kit (DDK) base.
    20779 - */
    20780 -DDK: procedure expose aCfg. aPath.
    20781 -    parse arg sToolId,sOperation,fRM,fQuiet
    20782 -
    20783 -    /*
    20784 -     * Device Driver Kit (DDK) (v4.0+) Main Directory.
    20785 -     */
    20786 -    sPathDDK    = PathQuery('ddk', sToolId, sOperation);
    20787 -    if (sPathDDK = '') then
    20788 -        return 1;
    20789 -    /* If config operation we're done now. */
    20790 -    if (pos('config', sOperation) > 0) then
    20791 -    do
    20792 -        /* Set the ddk subpaths */
    20793 -        if (PathQuery('ddkbase', 'ddkbase', 'quietisconfig') = '') then
    20794 -            call PathSet 'ddkbase', sPathDDK'\base';
    20795 -        if (PathQuery('ddkvideo', 'ddkvideo', 'quietisconfig') = '') then
    20796 -            call PathSet 'ddkvideo', sPathDDK'\video';
    20797 -        if (PathQuery('ddkprint', 'ddkvideo', 'quietisconfig') = '') then
    20798 -            call PathSet 'ddkprint', sPathDDK'\print';
    20799 -        return 0;
    20800 -    end
    20801 -    call EnvSet      fRM, 'PATH_DDK',    sPathDDK;
    20802 -    rc = DDKBase('ddkbase',sOperation,fRM,fQuiet)
    20803 -    if (rc = 0) then
    20804 -        rc = DDKVideo('ddkvideo',sOperation,fRM,fQuiet)
    20805 -return rc;
    20806 -
    20807 -
    20808 -/*
    20809 - *  Device Driver Kit (DDK) base.
    20810 - */
    20811 -DDKBase: procedure expose aCfg. aPath.
    20812 -    parse arg sToolId,sOperation,fRM,fQuiet
    20813 -
    20814 -    /*
    20815 -     * Device Driver Kit (DDK) (v4.0+) base (important not main) directory.
    20816 -     */
    20817 -    sPathDDKBase    = PathQuery('ddkbase', sToolId, sOperation);
    20818 -    if (sPathDDKBase = '') then
    20819 -        return 1;
    20820 -    /* If config operation we're done now. */
    20821 -    if (pos('config', sOperation) > 0) then
    20822 -        return 0;
    20823 -    call EnvSet      fRM, 'PATH_DDKBASE',sPathDDKBase;
    20824 -    call EnvAddFront fRM, 'path',        sPathDDKBase'\tools;'
    20825 -    call EnvAddFront fRM, 'include',     sPathDDKBase'\h;'sPathDDKBase'\inc;'sPathDDKBase'\inc32;'
    20826 -    call EnvAddFront fRM, 'include16',   sPathDDKBase'\h;'
    20827 -    call EnvAddFront fRM, 'lib',         sPathDDKBase'\lib;'
    20828 -    call EnvAddFront fRM, 'bookshelf',   sPathDDKBase'\..\docs;'
    20829 -
    20830 -    /*
    20831 -     * Verify.
    20832 -     */
    20833 -    if (pos('verify', sOperation) <= 0) then
    20834 -        return 0;
    20835 -    if (    \CfgVerifyFile(sPathDDKBase'\tools\link.exe', fQuiet),
    20836 -        |   \CfgVerifyFile(sPathDDKBase'\tools\link386.exe', fQuiet),
    20837 -        |   \CfgVerifyFile(sPathDDKBase'\tools\cl386.exe', fQuiet),
    20838 -        |   \CfgVerifyFile(sPathDDKBase'\tools\masm.exe', fQuiet),
    20839 -        |   \CfgVerifyFile(sPathDDKBase'\tools\h2inc.exe', fQuiet),
    20840 -        |   \CfgVerifyFile(sPathDDKBase'\tools\lib.exe', fQuiet),
    20841 -        |   \CfgVerifyFile(sPathDDKBase'\lib\os2286.lib', fQuiet),
    20842 -        |   \CfgVerifyFile(sPathDDKBase'\lib\os2286p.lib', fQuiet),
    20843 -        |   \CfgVerifyFile(sPathDDKBase'\lib\os2386.lib', fQuiet),
    20844 -        |   \CfgVerifyFile(sPathDDKBase'\lib\os2386p.lib', fQuiet),
    20845 -        |   \CfgVerifyFile(sPathDDKBase'\lib\doscalls.lib', fQuiet),
    20846 -        |   \CfgVerifyFile(sPathDDKBase'\lib\dhcalls.lib', fQuiet),
    20847 -        |   \CfgVerifyFile(sPathDDKBase'\lib\addcalls.lib', fQuiet),
    20848 -        |   \CfgVerifyFile(sPathDDKBase'\lib\rmcalls.lib', fQuiet),
    20849 -        |   \CfgVerifyFile(sPathDDKBase'\lib\vdh.lib', fQuiet),
    20850 -        |   \CfgVerifyFile(sPathDDKBase'\h\infoseg.h', fQuiet),
    20851 -        |   \CfgVerifyFile(sPathDDKBase'\h\include.h', fQuiet),
    20852 -        |   \CfgVerifyFile(sPathDDKBase'\h386\pmddi.h', fQuiet),
    20853 -        |   \CfgVerifyFile(sPathDDKBase'\h386\pmddim.h', fQuiet),
    20854 -        |   \CfgVerifyFile(sPathDDKBase'\h386\limits.h', fQuiet),
    20855 -        |   \CfgVerifyFile(sPathDDKBase'\h386\string.h', fQuiet),
    20856 -        |   \CfgVerifyFile(sPathDDKBase'\inc\v8086.inc', fQuiet),
    20857 -        |   \CfgVerifyFile(sPathDDKBase'\inc\sas.inc', fQuiet),
    20858 -        |   \CfgVerifyFile(sPathDDKBase'\inc\pmwinx.inc', fQuiet),
    20859 -        |   \CfgVerifyFile(sPathDDKBase'\inc\infoseg.inc', fQuiet),
    20860 -        |   \CfgVerifyFile(sPathDDKBase'\inc\devhlp.inc', fQuiet),
    20861 -        |   \CfgVerifyFile(sPathDDKBase'\inc\devhlpp.inc', fQuiet),
    20862 -        ) then
    20863 -        return 2;
    20864 -    rc = CheckCmdOutput('cl386', 0, fQuiet, 'Microsoft (R) Microsoft 386 C Compiler. Version 6.00.054');
    20865 -    if (rc = 0) then
    20866 -        rc = CheckCmdOutput('masm nul,nul,nul,nul;', 2, fQuiet, 'Microsoft (R) Macro Assembler Version 5.10A.15 Jul 07 15:25:03 1989');
    20867 -    if (rc = 0) then
    20868 -        rc = CheckCmdOutput('h2inc -?', 0, fQuiet, 'h2inc - .H to .INC file translator (version 13.29)');
    20869 -    if (rc = 0) then
    20870 -        rc = CheckCmdOutput('type' sPathDDKBase'\inc\devhlp.inc', 0, fQuiet, 'DevHlp_ReadFileAt');
    20871 -return rc;
    20872 -
    20873 -
    20874 -/*
    20875 - *  Device Driver Kit (DDK) Video.
    20876 - */
    20877 -DDKVideo: procedure expose aCfg. aPath.
    20878 -    parse arg sToolId,sOperation,fRM,fQuiet
    20879 -
    20880 -    /*
    20881 -     * Device Driver Kit (DDK) (v4.0+) Video (important not main) directory.
    20882 -     */
    20883 -    sPathDDKVideo   = PathQuery('ddkvideo', sToolId, sOperation);
    20884 -    if (sPathDDKVideo = '') then
    20885 -        return 1;
    20886 -    /* If config operation we're done now. */
    20887 -    if (pos('config', sOperation) > 0) then
    20888 -        return 0;
    20889 -    call EnvSet      fRM, 'PATH_DDKVIDEO',sPathDDKVideo;
    20890 -    call EnvAddFront fRM, 'path',        sPathDDKVideo'\tools\os2.386\bin;'sPathDDKVideo'\tools\os2.386\lx.386\bin;' /* might not need this... */
    20891 -    call EnvAddFront fRM, 'include',     sPathDDKVideo'\rel\os2c\include\base\os2;'/*sPathDDKVideo'\rel\os2c\include\base\os2\16bit;'sPathDDKVideo'\rel\os2c\include\base\os2\inc;'sPathDDKVideo'\rel\os2c\include\base\os2\inc32;' /* might be over kill!! */  - it is! */
    20892 -    call EnvAddFront fRM, 'include16',   sPathDDKVideo'\rel\os2c\include\base\os2\16bit;'
    20893 -    call EnvAddFront fRM, 'lib',         sPathDDKVideo'\rel\os2c\lib\os2;'sPathDDKVideo'\rel\os2c\lib\os2\priv;'
    20894 -    call EnvAddFront fRM, 'bookshelf',   sPathDDKVideo'\..\docs;'
    20895 -
    20896 -    /*
    20897 -     * Verify.
    20898 -     */
    20899 -    if (pos('verify', sOperation) <= 0) then
    20900 -        return 0;
    20901 -    if (    \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\doscalls.lib', fQuiet),
    20902 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\gradd.lib', fQuiet),
    20903 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\os2386.lib', fQuiet),
    20904 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\libh.lib', fQuiet),
    20905 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\vdh.lib', fQuiet),
    20906 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\thunkrt.lib', fQuiet),
    20907 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\dbcs32.lib', fQuiet),
    20908 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\priv\pmwp.lib', fQuiet),
    20909 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\priv\os2286p.lib', fQuiet),
    20910 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\vvga.def', fQuiet),
    20911 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\vvga.def', fQuiet),
    20912 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\gradd.h', fQuiet),
    20913 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\pmwp.h', fQuiet),
    20914 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\os2p.h', fQuiet),
    20915 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\pmgpip.h', fQuiet),
    20916 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\pmdevp.h', fQuiet),
    20917 -        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\inc32\pmp.inc', fQuiet),
    20918 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\bin\rc.exe', fQuiet),
    20919 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\bin\nmake.exe', fQuiet),
    20920 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\bin\h2inc.exe', fQuiet),
    20921 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\link386.exe', fQuiet),
    20922 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\masm.exe', fQuiet),
    20923 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\masm.exe', fQuiet),
    20924 -        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\mcl386\bin\c3_386.exe', fQuiet),
    20925 -        ) then
    20926 -        return 2;
    20927 -    rc = CheckCmdOutput('nmake -?', 0, fQuiet, 'Version 2.001.000 Jan 28 1994');
    20928 -    if (rc = 0) then
    20929 -        rc = CheckCmdOutput('masm nul,nul,nul,nul;', 2, fQuiet, 'Microsoft (R) Macro Assembler Version 5.10A.15 Jul 07 15:25:03 1989');
    20930 -    if (rc = 0) then
    20931 -        rc = CheckCmdOutput('h2inc -?', 0, fQuiet, 'h2inc - .H to .INC file translator (version 13.29)');
    20932 -    if (rc = 0) then
    20933 -        rc = CheckCmdOutput('type 'sPathDDKVideo'\rel\os2c\include\base\os2\gradd.h', 0, fQuiet, 'GHI_CMD_POLYGON');
    20934 -return rc;
    20935 -
    20936 -
    20937 -/*
    20938 - * Doxygen v1.2.11.1 for OS/2.
    20939 - */
    20940 -DoxyGen: procedure expose aCfg. aPath.
    20941 -    parse arg sToolId,sOperation,fRM,fQuiet
    20942 -
    20943 -    /*
    20944 -     * Get base directory.
    20945 -     */
    20946 -    sPathDoxyGen   = PathQuery('doxygen', sToolId, sOperation);
    20947 -    if (sPathDoxyGen = '') then
    20948 -        return 1;
    20949 -    /* If config operation we're done now. */
    20950 -    if (pos('config', sOperation) > 0) then
    20951 -        return 0;
    20952 -    call EnvSet      fRM, 'PATH_DOXYGEN',sPathDoxyGen;
    20953 -    call EnvAddFront fRM, 'path',        sPathDoxyGen'\bin;'
    20954 -
    20955 -    /*
    20956 -     * Verify.
    20957 -     */
    20958 -    if (pos('verify', sOperation) <= 0) then
    20959 -        return 0;
    20960 -    if (    \CfgVerifyFile(sPathDoxyGen'\bin\dot.exe', fQuiet),
    20961 -        |   \CfgVerifyFile(sPathDoxyGen'\bin\doxygen.exe', fQuiet),
    20962 -        ) then
    20963 -        return 2;
    20964 -    rc = CheckCmdOutput('doxygen', 1, fQuiet, 'Doxygen version 1.2.11.1');
    20965 -return rc;
    20966 -
    20967 -
    20968 -/*
    20969 - * EMX/GCC 3.x.x - this environment must be used 'on' the ordinary EMX.
    20970 - * Note! bin.new has been renamed to bin!
    20971 - * Note! make .lib of every .a! in 4OS2: for /R %i in (*.a) do if not exist %@NAME[%i].lib emxomf %i
    20972 - */
    20973 -GCC3xx: procedure expose aCfg. aPath.
    20974 -    parse arg sToolId,sOperation,fRM,fQuiet,sPathId
    20975 -
    20976 -    /*
    20977 -     * EMX/GCC main directory.
    20978 -     */
    20979 -    sGCC = PathQuery(sPathId, sToolId, sOperation);
    20980 -    if (sGCC = '') then
    20981 -        return 1;
    20982 -    /* If config operation we're done now. */
    20983 -    if (pos('config', sOperation) > 0) then
    20984 -        return 0;
    20985 -
    20986 -    sGCCBack    = translate(sGCC, '\', '/');
    20987 -    sGCCForw    = translate(sGCC, '/', '\');
    20988 -    call EnvSet      fRM, 'PATH_EMXPGCC',   sGCCBack;
    20989 -    call EnvSet      fRM, 'CCENV',          'EMX'
    20990 -    call EnvSet      fRM, 'BUILD_ENV',      'EMX'
    20991 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    20992 -
    20993 -    call EnvAddFront fRM, 'BEGINLIBPATH',       sGCCBack'\dll;'
    20994 -    call EnvAddFront fRM, 'PATH',               sGCCBack'\bin.new;'sGCCBack'\bin;'
    20995 -    call EnvAddFront fRM, 'DPATH',              sGCCBack'\book;'
    20996 -    call EnvAddFront fRM, 'BOOKSHELF',          sGCCBack'\book;'
    20997 -    call EnvAddFront fRM, 'HELP',               sGCCBack'\help;'
    20998 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/include'
    20999 -    call EnvAddFront fRM, 'LIBRARY_PATH',       sGCCForw'/lib'
    21000 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/cpp;'sGCCForw'/include'
    21001 -    call EnvSet      fRM, 'PROTODIR',           sGCCForw'/include/cpp/gen'
    21002 -    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sGCCForw'/include'
    21003 -    call EnvAddFront fRM, 'INFOPATH',           sGCCForw'/info'
    21004 -    call EnvSet      fRM, 'EMXBOOK',            'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf'
    21005 -    call EnvAddFront fRM, 'HELPNDX',            'emxbook.ndx', '+', 1
    21006 -
    21007 -    /*
    21008 -     * Verify.
    21009 -     */
    21010 -    chMajor = '3';
    21011 -    chMinor = left(right(sToolId, 2), 1);
    21012 -    chRel   = right(sToolId, 1);
    21013 -    sVer = chMajor'.'chMinor'.'chRel
    21014 -    if (pos('verify', sOperation) <= 0) then
    21015 -        return 0;
    21016 -    if (    \CfgVerifyFile(sGCCBack'\bin.new\gcc.exe', fQuiet),
    21017 -        |   \CfgVerifyFile(sGCCBack'\bin.new\g++.exe', fQuiet),
    21018 -        |   \CfgVerifyFile(sGCCBack'\bin.new\as.exe', fQuiet),
    21019 -        |   \CfgVerifyFile(sGCCBack'\bin.new\readelf.exe', fQuiet),
    21020 -        |   \CfgVerifyFile(sGCCBack'\bin.new\emxomf.exe', fQuiet),
    21021 -        |   \CfgVerifyFile(sGCCBack'\dll\bfd211.dll', fQuiet),
    21022 -        |   \CfgVerifyFile(sGCCBack'\lib\iberty.a', fQuiet),
    21023 -        |   \CfgVerifyFile(sGCCBack'\lib\iberty.lib', fQuiet),
    21024 -        |   \CfgVerifyFile(sGCCBack'\lib\iberty_s.a', fQuiet),
    21025 -        |   \CfgVerifyFile(sGCCBack'\lib\iberty_s.lib', fQuiet),
    21026 -        |   \CfgVerifyFile(sGCCBack'\lib\opcodes.a', fQuiet),
    21027 -        |   \CfgVerifyFile(sGCCBack'\lib\opcodes.lib', fQuiet),
    21028 -        |   \CfgVerifyFile(sGCCBack'\lib\opcodes_s.a', fQuiet),
    21029 -        |   \CfgVerifyFile(sGCCBack'\lib\opcodes_s.lib', fQuiet),
    21030 -        ) then
    21031 -        return 2;
    21032 -
    21033 -    if (chMinor > 0) then
    21034 -    do
    21035 -        if (    \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2-emx\'sVer'\st\'sToolId'.lib', fQuiet),
    21036 -            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2-emx\'sVer'\st\stdcxx.lib', fQuiet),
    21037 -            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2-emx\'sVer'\st\stdcxx.a', fQuiet),
    21038 -            ) then
    21039 -            return 2;
    21040 -    end
    21041 -    else
    21042 -    do
    21043 -        if (    \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2_emx\'sVer'\st\gcc_dll.lib', fQuiet),
    21044 -            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2_emx\'sVer'\st\stdcxx.lib', fQuiet),
    21045 -            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2_emx\'sVer'\st\stdcxx.a', fQuiet),
    21046 -            ) then
    21047 -            return 2;
    21048 -    end
    21049 -
    21050 -
    21051 -    rc = CheckCmdOutput('gcc --version', 0, fQuiet, sVer);
    21052 -    if (rc = 0) then
    21053 -        rc = CheckCmdOutput('g++ --version', 0, fQuiet, sVer);
    21054 -    if (rc = 0) then
    21055 -    do
    21056 -        sVerAS = '2.11.2';
    21057 -        rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 'sVerAS);
    21058 -    end
    21059 -return rc;
    21060 -
    21061 -
    21062 -/*
    21063 - * Innotek GCC 3.2.x and higher - this environment is EMX RT free.
    21064 - * Note! make .lib of every .a! in 4OS2: for /R %i in (*.a) do if not exist %@NAME[%i].lib emxomf %i
    21065 - */
    21066 -GCC322plus: procedure expose aCfg. aPath.
    21067 -    parse arg sToolId,sOperation,fRM,fQuiet,sPathId
    21068 -
    21069 -    /*
    21070 -     * EMX/GCC main directory.
    21071 -     */
    21072 -    sGCC = PathQuery(sPathId, sToolId, sOperation);
    21073 -    if (sGCC = '') then
    21074 -        return 1;
    21075 -    /* If config operation we're done now. */
    21076 -    if (pos('config', sOperation) > 0) then
    21077 -        return 0;
    21078 -
    21079 -    /* parse out the version / constants */
    21080 -    chMajor = '3';
    21081 -    chMinor = left(right(sToolId, 2), 1);
    21082 -    chRel   = right(sToolId, 1);
    21083 -    sVer    = chMajor'.'chMinor'.'chRel
    21084 -    sVerShrt= chMajor||chMinor||chRel;
    21085 -    sTrgt   = 'i386-pc-os2-emx'
    21086 -
    21087 -    sGCCBack    = translate(sGCC, '\', '/');
    21088 -    sGCCForw    = translate(sGCC, '/', '\');
    21089 -    call EnvSet      fRM, 'PATH_IGCC',       sGCCBack;
    21090 -    call EnvSet      fRM, 'CCENV',          'IGCC'
    21091 -    call EnvSet      fRM, 'BUILD_ENV',      'IGCC'
    21092 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    21093 -
    21094 -    call EnvAddFront fRM, 'BEGINLIBPATH',       sGCCBack'\'sTrgt'\lib;'sGCCBack'\lib;'
    21095 -    call EnvAddFront fRM, 'DPATH',              sGCCBack'\lib;'
    21096 -    /*call EnvAddFront fRM, 'HELP',               sGCCBack'\lib;'*/
    21097 -    call EnvAddFront fRM, 'PATH',               sGCCForw'\'sTrgt'\bin;'sGCCBack'\'sTrgt'\bin;'sGCCForw'\bin;'sGCCBack'\bin;'
    21098 -    /*call EnvAddFront fRM, 'DPATH',              sGCCBack'\book;'
    21099 -    call EnvAddFront fRM, 'BOOKSHELF',          sGCCBack'\book;'
    21100 -    call EnvAddFront fRM, 'HELP',               sGCCBack'\help;' */
    21101 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/include;'
    21102 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/lib/gcc-lib/'sTrgt'/'sVer'/include;'
    21103 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/lib/gcc-lib/'sTrgt'/'sVer'/include;'
    21104 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include;'
    21105 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/backward;'
    21106 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/'sTrgt';'
    21107 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/;'
    21108 -    call EnvAddFront fRM, 'LIBRARY_PATH',       sGCCForw'/lib'
    21109 -    call EnvAddFront fRM, 'LIBRARY_PATH',       sGCCForw'/lib/gcc-lib/'sTrgt'/'sVer';'
    21110 -    call EnvAddFront fRM, 'INFOPATH',           sGCCForw'/info'
    21111 -    /* is this used? */
    21112 -    call EnvSet      fRM, 'PROTODIR',           sGCCForw'/include/c++/gen'
    21113 -
    21114 -    /*
    21115 -     * Verify.
    21116 -     */
    21117 -    if (pos('verify', sOperation) <= 0) then
    21118 -        return 0;
    21119 -    if (    \CfgVerifyFile(sGCCBack'\bin\gcc.exe', fQuiet),
    21120 -        |   \CfgVerifyFile(sGCCBack'\bin\g++.exe', fQuiet),
    21121 -        |   \CfgVerifyFile(sGCCBack'\bin\as.exe', fQuiet),
    21122 -        |   \CfgVerifyFile(sGCCBack'\bin\readelf.exe', fQuiet),
    21123 -        |   \CfgVerifyFile(sGCCBack'\bin\emxomf.exe', fQuiet),
    21124 -        |   \CfgVerifyFile(sGCCBack'\bin\ilink.exe', fQuiet),
    21125 -        |   \CfgVerifyFile(sGCCBack'\lib\bfd2E.dll', fQuiet),
    21126 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc'sVerShrt'.dll', fQuiet),
    21127 -        |   \CfgVerifyFile(sGCCBack'\lib\libiberty.a', fQuiet),
    21128 -        |   \CfgVerifyFile(sGCCBack'\lib\libiberty.lib', fQuiet),
    21129 -        |   \CfgVerifyFile(sGCCBack'\lib\opcode2E.dll', fQuiet),
    21130 -        |   \CfgVerifyFile(sGCCBack'\lib\libopcodes.a', fQuiet),
    21131 -        |   \CfgVerifyFile(sGCCBack'\lib\libopcodes.lib', fQuiet),
    21132 -        |   \CfgVerifyFile(sGCCBack'\include\unikbd.h', fQuiet),
    21133 -        |   \CfgVerifyFile(sGCCBack'\include\c++\'sVer'\streambuf', fQuiet),
    21134 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\specs', fQuiet),
    21135 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\cc1plus.exe', fQuiet),
    21136 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\gcc'sVerShrt'.a', fQuiet),
    21137 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\gcc'sVerShrt'.lib', fQuiet),
    21138 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc.a', fQuiet),
    21139 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc.lib', fQuiet),
    21140 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc_eh.a', fQuiet),
    21141 -        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc_eh.lib', fQuiet),
    21142 -        ) then
    21143 -        return 2;
    21144 -
    21145 -    rc = CheckCmdOutput('gcc --version', 0, fQuiet, sVer);
    21146 -    if (rc = 0) then
    21147 -        rc = CheckCmdOutput('g++ --version', 0, fQuiet, sVer);
    21148 -    if (rc = 0) then
    21149 -    do
    21150 -        sVerAS = '2.14';
    21151 -        rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 'sVerAS);
    21152 -    end
    21153 -    if (rc = 0) then
    21154 -        rc = CheckCmdOutput('ilink /?', 0, fQuiet, 'IBM(R) Linker for OS/2(R), Version 5.0');
    21155 -
    21156 -return rc;
    21157 -
    21158 -
    21159 -/*
    21160 - * ICAT Debugger
    21161 - */
    21162 -ICATGam: procedure expose aCfg. aPath.
    21163 -    parse arg sToolId,sOperation,fRM,fQuiet
    21164 -    sPathICAT   = PathQuery('icatgam', sToolId, sOperation);
    21165 -    if (sPathICAT = '') then
    21166 -        return 1;
    21167 -    /* If config operation we're done now. */
    21168 -    if (pos('config', sOperation) > 0) then
    21169 -        return 0;
    21170 -
    21171 -    /*
    21172 -     * Installing the environment variables.
    21173 -     */
    21174 -    call EnvSet      fRm, 'PATH_ICATGAM', sPathICAT;
    21175 -    call EnvAddFront fRm, 'beginlibpath',sPathICAT'\dll;'
    21176 -    call EnvAddFront fRm, 'path',        sPathICAT'\bin;'
    21177 -    call EnvAddFront fRm, 'dpath',       sPathICAT'\help;'
    21178 -    call EnvAddFront fRm, 'help',        sPathICAT'\help;'
    21179 -
    21180 -    /*
    21181 -     * Verify.
    21182 -     */
    21183 -    if (pos('verify', sOperation) <= 0) then
    21184 -        return 0;
    21185 -    if (    \CfgVerifyFile(sPathICAT'\bin\icatgam.exe', fQuiet),
    21186 -        |   \CfgVerifyFile(sPathICAT'\dll\gamoou3.dll', fQuiet),
    21187 -        |   \CfgVerifyFile(sPathICAT'\dll\gam5lde.dll', fQuiet),
    21188 -        |   \CfgVerifyFile(sPathICAT'\dll\gam5cx.dll', fQuiet),
    21189 -        ) then
    21190 -        return 2;
    21191 -return 0;
    21192 -
    21193 -
    21194 -/*
    21195 - * ICAT Debugger
    21196 - */
    21197 -ICATGam406RC1: procedure expose aCfg. aPath.
    21198 -    parse arg sToolId,sOperation,fRM,fQuiet
    21199 -    sPathICAT   = PathQuery('icatgam406rc1', sToolId, sOperation);
    21200 -    if (sPathICAT = '') then
    21201 -        return 1;
    21202 -    /* If config operation we're done now. */
    21203 -    if (pos('config', sOperation) > 0) then
    21204 -        return 0;
    21205 -
    21206 -    /*
    21207 -     * Installing the environment variables.
    21208 -     */
    21209 -    call EnvSet      fRm, 'PATH_ICATGAM', sPathICAT;
    21210 -    call EnvAddFront fRm, 'beginlibpath',sPathICAT'\dll;'
    21211 -    call EnvAddFront fRm, 'path',        sPathICAT'\bin;'
    21212 -    call EnvAddFront fRm, 'dpath',       sPathICAT'\help;'
    21213 -    call EnvAddFront fRm, 'help',        sPathICAT'\help;'
    21214 -
    21215 -    /*
    21216 -     * Verify.
    21217 -     */
    21218 -    if (pos('verify', sOperation) <= 0) then
    21219 -        return 0;
    21220 -    if (    \CfgVerifyFile(sPathICAT'\bin\icatgam.exe', fQuiet),
    21221 -        |   \CfgVerifyFile(sPathICAT'\dll\gamoou3.dll', fQuiet),
    21222 -        |   \CfgVerifyFile(sPathICAT'\dll\gam5lde.dll', fQuiet),
    21223 -        |   \CfgVerifyFile(sPathICAT'\dll\gam5cx.dll', fQuiet),
    21224 -        ) then
    21225 -        return 2;
    21226 -return 0;
    21227 -
    21228 -
    21229 -
    21230 -/*
    21231 - * ICAT Debugger for PE images.
    21232 - */
    21233 -ICATPe: procedure expose aCfg. aPath.
    21234 -    parse arg sToolId,sOperation,fRM,fQuiet
    21235 -    sPathICAT   = PathQuery('icatgam', sToolId, sOperation);
    21236 -    if (sPathICAT = '') then
    21237 -        return 1;
    21238 -    sPathICATPe = PathQuery('icatpe', sToolId, sOperation);
    21239 -    if (sPathICATPe = '') then
    21240 -        return 1;
    21241 -    /* If config operation we're done now. */
    21242 -    if (pos('config', sOperation) > 0) then
    21243 -        return 0;
    21244 -
    21245 -    /*
    21246 -     * Installing the environment variables.
    21247 -     */
    21248 -    call EnvSet      fRm, 'PATH_ICATGAM',sPathICAT;
    21249 -    call EnvSet      fRm, 'PATH_ICATPE', sPathICATPe;
    21250 -    call EnvAddFront fRm, 'beginlibpath',sPathICATPe'\bin;'sPathICAT'\dll;'
    21251 -    call EnvAddFront fRm, 'path',        sPathICATPe'\bin;'sPathICAT'\bin;'
    21252 -    call EnvAddFront fRm, 'dpath',       sPathICATPe'\bin;'sPathICAT'\help;'
    21253 -    call EnvAddFront fRm, 'help',        sPathICATPe'\bin;'sPathICAT'\help;'
    21254 -
    21255 -    /*
    21256 -     * Verify.
    21257 -     */
    21258 -    if (pos('verify', sOperation) <= 0) then
    21259 -        return 0;
    21260 -    if (    \CfgVerifyFile(sPathICAT'\bin\icatgam.exe', fQuiet),
    21261 -        |   \CfgVerifyFile(sPathICAT'\dll\gamoou3.dll', fQuiet),
    21262 -        |   \CfgVerifyFile(sPathICAT'\dll\gam5lde.dll', fQuiet),
    21263 -        |   \CfgVerifyFile(sPathICAT'\dll\gam5cx.dll', fQuiet),
    21264 -        |   \CfgVerifyFile(sPathICATPe'\bin\icatgam.exe', fQuiet),
    21265 -        |   \CfgVerifyFile(sPathICATPe'\bin\gamoou3.dll', fQuiet),
    21266 -        |   \CfgVerifyFile(sPathICATPe'\bin\gam5lde.dll', fQuiet),
    21267 -        |   \CfgVerifyFile(sPathICATPe'\bin\gam5cx.dll', fQuiet),
    21268 -        ) then
    21269 -        return 2;
    21270 -return 0;
    21271 -
    21272 -
    21273 -
    21274 -/*
    21275 - * Interactive Disassembler (IDA) v3.80a
    21276 - */
    21277 -IDA38: procedure expose aCfg. aPath.
    21278 -    parse arg sToolId,sOperation,fRM,fQuiet
    21279 -    /*
    21280 -     * IDA main directory.
    21281 -     */
    21282 -    sPathIDA = PathQuery('ida38', sToolId, sOperation);
    21283 -    if (sPathIDA = '') then
    21284 -        return 1;
    21285 -    /* If config operation we're done now. */
    21286 -    if (pos('config', sOperation) > 0) then
    21287 -        return 0;
    21288 -
    21289 -    /*
    21290 -     * Installing the environment variables.
    21291 -     */
    21292 -    call EnvSet      fRM, 'PATH_IDA',       sPathIDA
    21293 -    call EnvAddFront fRM, 'path',           sPathIDA
    21294 -    call EnvAddFront fRM, 'beginlibpath',   sPathIDA
    21295 -
    21296 -    /*
    21297 -     * Verify.
    21298 -     */
    21299 -    if (pos('verify', sOperation) <= 0) then
    21300 -        return 0;
    21301 -    if (    \CfgVerifyFile(sPathIDA'\ida2.exe', fQuiet),
    21302 -        |   \CfgVerifyFile(sPathIDA'\idaw.exe', fQuiet),
    21303 -        |   \CfgVerifyFile(sPathIDA'\ida.dll', fQuiet),
    21304 -        |   \CfgVerifyFile(sPathIDA'\pc.dll', fQuiet),
    21305 -        ) then
    21306 -        return 2;
    21307 -return 0;
    21308 -
    21309 -
    21310 -/*
    21311 - * Interactive Disassembler (IDA) v4.01
    21312 - */
    21313 -IDA40: procedure expose aCfg. aPath.
    21314 -    parse arg sToolId,sOperation,fRM,fQuiet
    21315 -    /*
    21316 -     * IDA main directory.
    21317 -     */
    21318 -    sPathIDA = PathQuery('ida40', sToolId, sOperation);
    21319 -    if (sPathIDA = '') then
    21320 -        return 1;
    21321 -    /* If config operation we're done now. */
    21322 -    if (pos('config', sOperation) > 0) then
    21323 -        return 0;
    21324 -
    21325 -    /*
    21326 -     * Installing the environment variables.
    21327 -     */
    21328 -    call EnvSet      fRM, 'PATH_IDA',       sPathIDA
    21329 -    call EnvAddFront fRM, 'path',           sPathIDA
    21330 -    call EnvAddFront fRM, 'beginlibpath',   sPathIDA
    21331 -
    21332 -    /*
    21333 -     * Verify.
    21334 -     */
    21335 -    if (pos('verify', sOperation) <= 0) then
    21336 -        return 0;
    21337 -    if (    \CfgVerifyFile(sPathIDA'\ida2.exe', fQuiet),
    21338 -        |   \CfgVerifyFile(sPathIDA'\idaw.exe', fQuiet),
    21339 -        |   \CfgVerifyFile(sPathIDA'\ida.dll', fQuiet),
    21340 -        |   \CfgVerifyFile(sPathIDA'\pc.dll', fQuiet),
    21341 -        ) then
    21342 -        return 2;
    21343 -return 0;
    21344 -
    21345 -
    21346 -/*
    21347 - * Interactive Disassembler (IDA) v4.14
    21348 - */
    21349 -IDA414: procedure expose aCfg. aPath.
    21350 -    parse arg sToolId,sOperation,fRM,fQuiet
    21351 -    /*
    21352 -     * IDA main directory.
    21353 -     */
    21354 -    sPathIDA = PathQuery('ida414', sToolId, sOperation);
    21355 -    if (sPathIDA = '') then
    21356 -        return 1;
    21357 -    /* If config operation we're done now. */
    21358 -    if (pos('config', sOperation) > 0) then
    21359 -        return 0;
    21360 -
    21361 -    /*
    21362 -     * Installing the environment variables.
    21363 -     */
    21364 -    call EnvSet      fRM, 'PATH_IDA',       sPathIDA
    21365 -    call EnvAddFront fRM, 'path',           sPathIDA
    21366 -    call EnvAddFront fRM, 'beginlibpath',   sPathIDA
    21367 -
    21368 -    /*
    21369 -     * Verify.
    21370 -     */
    21371 -    if (pos('verify', sOperation) <= 0) then
    21372 -        return 0;
    21373 -    if (    \CfgVerifyFile(sPathIDA'\ida2.exe', fQuiet),
    21374 -        |   \CfgVerifyFile(sPathIDA'\idaw.exe', fQuiet),
    21375 -        |   \CfgVerifyFile(sPathIDA'\ida.dll', fQuiet),
    21376 -        |   \CfgVerifyFile(sPathIDA'\pc.dll', fQuiet),
    21377 -        ) then
    21378 -        return 2;
    21379 -return 0;
    21380 -
    21381 -
    21382 -/*
    21383 - * Interactive Disassembler (IDA) Plugin SDK (v5.0?)
    21384 - */
    21385 -IDASDK: procedure expose aCfg. aPath.
    21386 -    parse arg sToolId,sOperation,fRM,fQuiet
    21387 -    /*
    21388 -     * IDA main directory.
    21389 -     */
    21390 -    sPathIDASDK = PathQuery('idasdk', sToolId, sOperation);
    21391 -    if (sPathIDASDK = '') then
    21392 -        return 1;
    21393 -    /* If config operation we're done now. */
    21394 -    if (pos('config', sOperation) > 0) then
    21395 -        return 0;
    21396 -
    21397 -    /*
    21398 -     * Installing the environment variables.
    21399 -     */
    21400 -    call EnvSet      fRM, 'PATH_IDASDK',    sPathIDASDK
    21401 -    call EnvAddFront fRM, 'include',        sPathIDASDK'\include;'
    21402 -    call EnvAddFront fRM, 'lib',            sPathIDASDK'\libwat.os2;'
    21403 -    call EnvAddFront fRM, 'path',           sPathIDASDK'\bin\os2;'
    21404 -    call EnvAddFront fRM, 'beginlibpath',   sPathIDASDK'\bin\os2;'
    21405 -
    21406 -    /*
    21407 -     * Verify.
    21408 -     */
    21409 -    if (pos('verify', sOperation) <= 0) then
    21410 -        return 0;
    21411 -    if (    \CfgVerifyFile(sPathIDASDK'\os2wat.cfg', fQuiet),
    21412 -        |   \CfgVerifyFile(sPathIDASDK'\d32wat.cfg', fQuiet),
    21413 -        |   \CfgVerifyFile(sPathIDASDK'\include\exehdr.h', fQuiet),
    21414 -        |   \CfgVerifyFile(sPathIDASDK'\include\ida.hpp', fQuiet),
    21415 -        |   \CfgVerifyFile(sPathIDASDK'\include\vm.hpp', fQuiet),
    21416 -        |   \CfgVerifyFile(sPathIDASDK'\libwat.os2\ida.lib', fQuiet),
    21417 -        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\ida.lib', fQuiet),
    21418 -        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\INIRT386.OBJ', fQuiet),
    21419 -      /*  |   \CfgVerifyFile(sPathIDASDK'\libbor.d32\ida.lib', fQuiet)*/,
    21420 -        ) then
    21421 -        return 2;
    21422 -return 0;
    21423 -
    21424 -
    21425 -/*
    21426 - * Interactive Disassembler (IDA) Plugin SDK (v5.0?)
    21427 - */
    21428 -IDASDK: procedure expose aCfg. aPath.
    21429 -    parse arg sToolId,sOperation,fRM,fQuiet
    21430 -    /*
    21431 -     * IDA main directory.
    21432 -     */
    21433 -    sPathIDASDK = PathQuery('idasdk', sToolId, sOperation);
    21434 -    if (sPathIDASDK = '') then
    21435 -        return 1;
    21436 -    /* If config operation we're done now. */
    21437 -    if (pos('config', sOperation) > 0) then
    21438 -        return 0;
    21439 -
    21440 -    /*
    21441 -     * Installing the environment variables.
    21442 -     */
    21443 -    call EnvSet      fRM, 'PATH_IDASDK',    sPathIDASDK
    21444 -    call EnvAddFront fRM, 'include',        sPathIDASDK'\include;'
    21445 -    call EnvAddFront fRM, 'lib',            sPathIDASDK'\libwat.os2;'
    21446 -    call EnvAddFront fRM, 'path',           sPathIDASDK'\bin\os2;'
    21447 -    call EnvAddFront fRM, 'beginlibpath',   sPathIDASDK'\bin\os2;'
    21448 -
    21449 -    /*
    21450 -     * Verify.
    21451 -     */
    21452 -    if (pos('verify', sOperation) <= 0) then
    21453 -        return 0;
    21454 -    if (    \CfgVerifyFile(sPathIDASDK'\os2wat.cfg', fQuiet),
    21455 -        |   \CfgVerifyFile(sPathIDASDK'\d32wat.cfg', fQuiet),
    21456 -        |   \CfgVerifyFile(sPathIDASDK'\include\exehdr.h', fQuiet),
    21457 -        |   \CfgVerifyFile(sPathIDASDK'\include\ida.hpp', fQuiet),
    21458 -        |   \CfgVerifyFile(sPathIDASDK'\include\vm.hpp', fQuiet),
    21459 -        |   \CfgVerifyFile(sPathIDASDK'\libwat.os2\ida.lib', fQuiet),
    21460 -        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\ida.lib', fQuiet),
    21461 -        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\INIRT386.OBJ', fQuiet),
    21462 -      /*  |   \CfgVerifyFile(sPathIDASDK'\libbor.d32\ida.lib', fQuiet)*/,
    21463 -        ) then
    21464 -        return 2;
    21465 -return 0;
    21466 -
    21467 -/*
    21468 - * icsdebug (IBM Visual Age for C++ v3.08 for OS/2)
    21469 - */
    21470 -icsdebug: procedure expose aCfg. aPath.
    21471 -    parse arg sToolId,sOperation,fRM,fQuiet
    21472 -
    21473 -    /*
    21474 -     * icsdebug (IBM Visual Age for C++ Version 3.08) main directory.
    21475 -     */
    21476 -    sPath = PathQuery('icsdebug', sToolId, sOperation);
    21477 -    if (sPath = '') then
    21478 -        return 1;
    21479 -    /* If config operation we're done now. */
    21480 -    if (pos('config', sOperation) > 0) then
    21481 -        return 0;
    21482 -
    21483 -    /*
    21484 -     * Installing the environment variables.
    21485 -     */
    21486 -    call EnvSet      fRM, 'PATH_ICSDEBUG',  sPath
    21487 -
    21488 -    call EnvAddFront fRM, 'beginlibpath',   sPath'\DLL;'
    21489 -    call EnvAddFront fRM, 'path',           sPath'\BIN;'
    21490 -    call EnvAddFront fRM, 'dpath',          sPath'\HELP;'sPath';'sPath'\LOCALE;'
    21491 -
    21492 -    /*
    21493 -     * Verify.
    21494 -     */
    21495 -    if (pos('verify', sOperation) <= 0) then
    21496 -        return 0;
    21497 -    if (    \CfgVerifyFile(sPath'\bin\icsdebug.exe', fQuiet),
    21498 -        |   \CfgVerifyFile(sPath'\help\dde4.msg', fQuiet),
    21499 -        |   \CfgVerifyFile(sPath'\help\dde4lde.msg', fQuiet),
    21500 -        |   \CfgVerifyFile(sPath'\dll\cppibs30.dll', fQuiet),
    21501 -        |   \CfgVerifyFile(sPath'\dll\cppom30.dll', fQuiet),
    21502 -        |   \CfgVerifyFile(sPath'\dll\cppoob3.dll', fQuiet),
    21503 -        |   \CfgVerifyFile(sPath'\dll\cppood3.dll', fQuiet),
    21504 -        |   \CfgVerifyFile(sPath'\dll\cppoou3.dll', fQuiet),
    21505 -        |   \CfgVerifyFile(sPath'\dll\dde4brsc.dll', fQuiet),
    21506 -        |   \CfgVerifyFile(sPath'\dll\dde4cr.dll', fQuiet),
    21507 -        |   \CfgVerifyFile(sPath'\dll\dde4cx.dll', fQuiet),
    21508 -        |   \CfgVerifyFile(sPath'\dll\dde4dsl.dll', fQuiet),
    21509 -        |   \CfgVerifyFile(sPath'\dll\dde4lde.dll', fQuiet),
    21510 -        |   \CfgVerifyFile(sPath'\dll\dde4modl.dll', fQuiet),
    21511 -        |   \CfgVerifyFile(sPath'\dll\dde4mth.dll', fQuiet),
    21512 -        |   \CfgVerifyFile(sPath'\dll\dde4pmdb.dll', fQuiet),
    21513 -        |   \CfgVerifyFile(sPath'\dll\dde4prt.dll', fQuiet),
    21514 -        |   \CfgVerifyFile(sPath'\dll\dde4ress.dll', fQuiet),
    21515 -        |   \CfgVerifyFile(sPath'\dll\dde4tk.dll', fQuiet),
    21516 -        |   \CfgVerifyFile(sPath'\dll\dde4trib.dll', fQuiet),
    21517 -        ) then
    21518 -        return 2;
    21519 -return 0;
    21520 -
    21521 -
    21522 -/*
    21523 - * idebug (Visual Age / C and C++ tools v3.6.5 for OS/2)
    21524 - */
    21525 -idebug: procedure expose aCfg. aPath.
    21526 -    parse arg sToolId,sOperation,fRM,fQuiet
    21527 -
    21528 -    /*
    21529 -     * IBM C/C++ Compiler and Tools Version 3.6.5 main directory.
    21530 -     */
    21531 -    sPath    = PathQuery('idebug', sToolId, sOperation);
    21532 -    if (sPath = '') then
    21533 -        return 1;
    21534 -    /* If config operation we're done now. */
    21535 -    if (pos('config', sOperation) > 0) then
    21536 -        return 0;
    21537 -
    21538 -    /*
    21539 -     * Installing the environment variables.
    21540 -     */
    21541 -    call EnvSet      fRM, 'PATH_IDEBUG', sPath;
    21542 -
    21543 -    call EnvAddFront fRM, 'path',        sPath'\bin;'
    21544 -    call EnvAddFront fRM, 'dpath',       sPath'\local;'sPath'\help;'
    21545 -    call EnvAddFront fRM, 'beginlibpath',sPath'\dll;'
    21546 -
    21547 -    /*
    21548 -     * Verify.
    21549 -     */
    21550 -    if (pos('verify', sOperation) <= 0) then
    21551 -        return 0;
    21552 -    if (    \CfgVerifyFile(sPath'\bin\idebug.exe', fQuiet),
    21553 -        |   \CfgVerifyFile(sPath'\dll\cppbhg36.dll', fQuiet),
    21554 -        |   \CfgVerifyFile(sPath'\dll\cppbpg36.dll', fQuiet),
    21555 -        |   \CfgVerifyFile(sPath'\dll\cppddle1.dll', fQuiet),
    21556 -        |   \CfgVerifyFile(sPath'\dll\cppddpm1.dll', fQuiet),
    21557 -        |   \CfgVerifyFile(sPath'\dll\cppdfer1.dll', fQuiet),
    21558 -        |   \CfgVerifyFile(sPath'\dll\cppdfhp1.dll', fQuiet),
    21559 -        |   \CfgVerifyFile(sPath'\dll\cppdfiw1.dll', fQuiet),
    21560 -        |   \CfgVerifyFile(sPath'\dll\cppdfpw1.dll', fQuiet),
    21561 -        |   \CfgVerifyFile(sPath'\dll\cppdftk1.dll', fQuiet),
    21562 -        |   \CfgVerifyFile(sPath'\dll\cppdqmq1.dll', fQuiet),
    21563 -        |   \CfgVerifyFile(sPath'\dll\cppdrq1.dll', fQuiet),
    21564 -        |   \CfgVerifyFile(sPath'\dll\cppdrx1.dll', fQuiet),
    21565 -        |   \CfgVerifyFile(sPath'\dll\cppdtcp1.dll', fQuiet),
    21566 -        |   \CfgVerifyFile(sPath'\dll\cppdunf1.dll', fQuiet),
    21567 -        |   \CfgVerifyFile(sPath'\dll\cppdxcx1.dll', fQuiet),
    21568 -        |   \CfgVerifyFile(sPath'\dll\cppdxsm1.dll', fQuiet),
    21569 -        |   \CfgVerifyFile(sPath'\dll\cpprdi36.dll', fQuiet),
    21570 -        |   \CfgVerifyFile(sPath'\dll\cpprmi36.dll', fQuiet),
    21571 -        |   \CfgVerifyFile(sPath'\dll\cpptb30.dll', fQuiet),
    21572 -        |   \CfgVerifyFile(sPath'\dll\cpptd30.dll', fQuiet),
    21573 -        |   \CfgVerifyFile(sPath'\dll\cpptu30.dll', fQuiet),
    21574 -        |   \CfgVerifyFile(sPath'\dll\cppxb30.dll', fQuiet),
    21575 -        |   \CfgVerifyFile(sPath'\dll\cppxd30.dll', fQuiet),
    21576 -        |   \CfgVerifyFile(sPath'\dll\cppxm30.dll', fQuiet),
    21577 -        |   \CfgVerifyFile(sPath'\dll\cppxm36.dll', fQuiet),
    21578 -        |   \CfgVerifyFile(sPath'\dll\cppxu30.dll', fQuiet),
    21579 -        |   \CfgVerifyFile(sPath'\help\cppdmg1.msg', fQuiet),
    21580 -        |   \CfgVerifyFile(sPath'\msg\cppdcc1.cat', fQuiet),
    21581 -        ) then
    21582 -        return 2;
    21583 -return 0;
    21584 -
    21585 -
    21586 -/*
    21587 - * JAVA v1.3.1 (latest)
    21588 - */
    21589 -Java131: procedure expose aCfg. aPath.
    21590 -    parse arg sToolId,sOperation,fRM,fQuiet
    21591 -    /*
    21592 -     * JAVA main directory.
    21593 -     */
    21594 -    sPathJava = PathQuery('java131', sToolId, sOperation);
    21595 -    if (sPathJava = '') then
    21596 -        return 1;
    21597 -    /* If config operation we're done now. */
    21598 -    if (pos('config', sOperation) > 0) then
    21599 -        return 0;
    21600 -
    21601 -    /*
    21602 -     * Installing the environment variables.
    21603 -     */
    21604 -    call EnvSet      fRM, 'PATH_JAVA',      sPathJava
    21605 -    call EnvSet      fRM, 'PATH_JAVA131',   sPathJava
    21606 -    call EnvAddFront fRM, 'path',           sPathJava'\bin;'sPathJava'\jre\bin;'
    21607 -    call EnvAddFront fRM, 'beginlibpath',   sPathJava'\jre\dll;'sPathJava'\jre\bin;'sPathJava'\icatjava\dll;'
    21608 -/*    call EnvAddFront fRM, 'classpath',      sPathJava'\jre\dll;'sPathJava'\jre\bin;'sPathJava'\icatjava\dll;'
    21609 -*/
    21610 -    /*
    21611 -     * Verify.
    21612 -     */
    21613 -    if (pos('verify', sOperation) <= 0) then
    21614 -        return 0;
    21615 -    if (    \CfgVerifyFile(sPathJava'\bin\javac.exe', fQuiet),
    21616 -        |   \CfgVerifyFile(sPathJava'\bin\jar.exe', fQuiet),
    21617 -        |   \CfgVerifyFile(sPathJava'\lib\tools.jar', fQuiet),
    21618 -        |   \CfgVerifyFile(sPathJava'\lib\javai.lib', fQuiet),
    21619 -        |   \CfgVerifyFile(sPathJava'\jre\dll\jv12mi36.dll', fQuiet),
    21620 -        |   \CfgVerifyFile(sPathJava'\jre\bin\java.exe', fQuiet),
    21621 -        |   \CfgVerifyFile(sPathJava'\jre\bin\jitc.dll', fQuiet),
    21622 -        |   \CfgVerifyFile(sPathJava'\jre\bin\javaw.exe', fQuiet),
    21623 -        |   \CfgVerifyFile(sPathJava'\jre\bin\rmid.exe', fQuiet),
    21624 -        |   \CfgVerifyFile(sPathJava'\jre\bin\classic\jvm.dll', fQuiet),
    21625 -        |   \CfgVerifyFile(sPathJava'\include\int64_md.h', fQuiet),
    21626 -        |   \CfgVerifyFile(sPathJava'\include\jawt.h', fQuiet),
    21627 -        |   \CfgVerifyFile(sPathJava'\include\jawt_md.h', fQuiet),
    21628 -        |   \CfgVerifyFile(sPathJava'\include\jni.h', fQuiet),
    21629 -        |   \CfgVerifyFile(sPathJava'\include\jniproto_md.h', fQuiet),
    21630 -        |   \CfgVerifyFile(sPathJava'\include\jni_md.h', fQuiet),
    21631 -        |   \CfgVerifyFile(sPathJava'\include\jvmdi.h', fQuiet),
    21632 -        |   \CfgVerifyFile(sPathJava'\include\jvmpi.h', fQuiet),
    21633 -        |   \CfgVerifyFile(sPathJava'\jre\bin\jitc_g.dll', fQuiet, 1),
    21634 -        |   \CfgVerifyFile(sPathJava'\jre\bin\classic\jvm_g.dll', fQuiet, 1),
    21635 -        ) then
    21636 -        return 2;
    21637 -
    21638 -return 0;
    21639 -
    21640 -
    21641 -/*
    21642 - * jitdbg (secret)
    21643 - */
    21644 -jitdbg: procedure expose aCfg. aPath.
    21645 -    parse arg sToolId,sOperation,fRM,fQuiet
    21646 -
    21647 -    /*
    21648 -     * IBM C/C++ Compiler and Tools Version 3.6.5 main directory.
    21649 -     */
    21650 -    sPath    = PathQuery('jitdbg', sToolId, sOperation);
    21651 -    if (sPath = '') then
    21652 -        return 1;
    21653 -    /* If config operation we're done now. */
    21654 -    if (pos('config', sOperation) > 0) then
    21655 -        return 0;
    21656 -
    21657 -    /*
    21658 -     * Installing the environment variables.
    21659 -     */
    21660 -    call EnvSet      fRM, 'PATH_JITDBG', sPath;
    21661 -
    21662 -    call EnvAddFront fRM, 'path',        sPath'\bin;'
    21663 -    call EnvAddFront fRM, 'dpath',       sPath'\msg;'sPath'\help;'
    21664 -    call EnvAddFront fRM, 'beginlibpath',sPath'\dll;'sPath'\extradlls;'
    21665 -    call EnvAddFront fRM, 'help',        sPath'\help;'
    21666 -
    21667 -    /*
    21668 -     * Verify.
    21669 -     */
    21670 -    if (pos('verify', sOperation) <= 0) then
    21671 -        return 0;
    21672 -    if (    \CfgVerifyFile(sPath'\bin\idbug.exe', fQuiet),
    21673 -        ) then
    21674 -        return 2;
    21675 -return 0;
    21676 -
    21677 -
    21678 -/*
    21679 - * (lib) JPEG v6b port.
    21680 - */
    21681 -JPEG: procedure expose aCfg. aPath.
    21682 -    parse arg sToolId,sOperation,fRM,fQuiet
    21683 -    sPathJPEG = PathQuery('jpeg', sToolId, sOperation);
    21684 -    if (sPathJPEG = '') then
    21685 -        return 1;
    21686 -    /* If config operation we're done now. */
    21687 -    if (pos('config', sOperation) > 0) then
    21688 -        return 0;
    21689 -    call EnvSet      fRm, 'PATH_JPEG',   sPathJPEG;
    21690 -    call EnvAddFront fRm, 'beginlibpath',sPathJPEG'\dll;'
    21691 -    call EnvAddFront fRm, 'path',        sPathJPEG'\bin;'
    21692 -    call EnvAddFront fRM, 'include',     sPathJPEG'\include;'
    21693 -    call EnvAddFront fRM, 'C_INCLUDE_PATH', sPathJPEG'\include;'
    21694 -    call EnvAddFront fRM, 'lib',         sPathJPEG'\lib;'
    21695 -
    21696 -    /*
    21697 -     * Verify.
    21698 -     */
    21699 -    if (pos('verify', sOperation) <= 0) then
    21700 -        return 0;
    21701 -
    21702 -    if (    \CfgVerifyFile(sPathJPEG'\bin\cjpeg.exe', fQuiet),
    21703 -        |   \CfgVerifyFile(sPathJPEG'\dll\jpeg.dll', fQuiet),
    21704 -        |   \CfgVerifyFile(sPathJPEG'\include\jpeglib.h', fQuiet),
    21705 -        |   \CfgVerifyFile(sPathJPEG'\lib\jpeg.a', fQuiet),
    21706 -        |   \CfgVerifyFile(sPathJPEG'\lib\jpeg.lib', fQuiet),
    21707 -        ) then
    21708 -        return 2;
    21709 -return 0;
    21710 -
    21711 -
    21712 -
    21713 -
    21714 -/*
    21715 - * Mode commandline.
    21716 - */
    21717 -Mode: procedure expose aCfg. aPath.
    21718 -    parse arg sToolId,sOperation,fRM,fQuiet,cols,rows
    21719 -
    21720 -    if (pos('install', sOperation) > 0 & pos('uninstall', sOperation) <= 0) then
    21721 -    do
    21722 -        say "ok!"
    21723 -        Address CMD 'mode' cols','rows
    21724 -    end
    21725 -    /* TODO
    21726 -    else if ((pos('uninstall', sOperation) > 0) | \fRM) then
    21727 -    do
    21728 -        say 'Huh?'
    21729 -        cols = 80;
    21730 -        rows = 25;
    21731 -    end
    21732 -    */
    21733 -return 0;
    21734 -
    21735 -
    21736 -/*
    21737 - * Microsoft C v6.0a 16-bit
    21738 - */
    21739 -MSCV6_16: procedure expose aCfg. aPath.
    21740 -    parse arg sToolId,sOperation,fRM,fQuiet
    21741 -
    21742 -    /*
    21743 -     * Microsoft C v6.0a main directory.
    21744 -     */
    21745 -    sPathMSC    = PathQuery('mscv6-16', sToolId, sOperation);
    21746 -    if (sPathMSC = '') then
    21747 -        return 1;
    21748 -    /* If config operation we're done now. */
    21749 -    if (pos('config', sOperation) > 0) then
    21750 -        return 0;
    21751 -
    21752 -    /*
    21753 -     * Installing the environment variables.
    21754 -     */
    21755 -    call EnvSet      fRM, 'BUILD_ENV',  'MSCV6-16'
    21756 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    21757 -    call EnvSet      fRM, 'PATH_MSC',   sPathMSC;
    21758 -    call EnvAddFront fRM, 'path',       sPathMSC'\binp;'
    21759 -    call EnvAddFront fRM, 'endlibpath', sPathMSC'\dll;'
    21760 -    call EnvAddFront fRM, 'helpfiles',  sPathMSC'\help;'
    21761 -    call EnvAddFront fRM, 'include',    sPathMSC'\include;'
    21762 -    call EnvAddFront fRM, 'include16',  sPathMSC'\include;'
    21763 -    call EnvAddFront fRM, 'lib',        sPathMSC'\lib;'
    21764 -
    21765 -    /*
    21766 -     * Verify.
    21767 -     */
    21768 -    if (pos('verify', sOperation) <= 0) then
    21769 -        return 0;
    21770 -    if (    \CfgVerifyFile(sPathMSC'\binp\cl.exe', fQuiet),
    21771 -        |   \CfgVerifyFile(sPathMSC'\lib\clibcep.lib', fQuiet),
    21772 -        |   \CfgVerifyFile(sPathMSC'\lib\llibcep.lib', fQuiet),
    21773 -        |   \CfgVerifyFile(sPathMSC'\lib\mlibcep.lib', fQuiet),
    21774 -        |   \CfgVerifyFile(sPathMSC'\lib\slibcep.lib', fQuiet),
    21775 -        |   \CfgVerifyFile(sPathMSC'\include\sysbits.h', fQuiet),
    21776 -        |   \CfgVerifyFile(sPathMSC'\include\dos.h', fQuiet),
    21777 -        |   \CfgVerifyFile(sPathMSC'\include\bios.h', fQuiet),
    21778 -        |   \CfgVerifyFile(sPathMSC'\include\string.h', fQuiet),
    21779 -        |   \CfgVerifyFile(sPathMSC'\include\stdio.h', fQuiet),
    21780 -        ) then
    21781 -        return 2;
    21782 -    rc = CheckCmdOutput('cl', 0, fQuiet, 'Microsoft (R) C Optimizing Compiler Version 6.00A.04');
    21783 -return rc;
    21784 -
    21785 -
    21786 -/*
    21787 - * Microsoft C v6.0a 32-bit
    21788 - */
    21789 -MSCV6_32: procedure expose aCfg. aPath.
    21790 -    parse arg sToolId,sOperation,fRM,fQuiet
    21791 -
    21792 -    /*
    21793 -     * Microsoft C v6.0a 32-bit main directory.
    21794 -     */
    21795 -    sPathDDKBase = PathQuery('ddkbase', sToolId, sOperation);
    21796 -    if (sPathDDKBase = '') then
    21797 -        return 1;
    21798 -    /* If config operation we're done now. */
    21799 -    if (pos('config', sOperation) > 0) then
    21800 -        return 0;
    21801 -
    21802 -    /*
    21803 -     * This is where the compiler really is.
    21804 -     */
    21805 -    call DDKBase 'ddkbase',sOperation,fRM,fQuiet;
    21806 -
    21807 -    /*
    21808 -     * Installing the environment variables.
    21809 -     */
    21810 -    call EnvSet      fRM, 'BUILD_ENV',  'MSCV6'
    21811 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    21812 -    call EnvSet      fRM, 'PATH_MSC',   sPathDDKBase;
    21813 -    call EnvAddFront fRM, 'include',    sPathDDKBase'\h386;'
    21814 -    call EnvAddFront fRM, 'lib',        sPathDDKBase'\lib;'
    21815 -
    21816 -    /*
    21817 -     * Verify.
    21818 -     */
    21819 -    if (pos('verify', sOperation) <= 0) then
    21820 -        return 0;
    21821 -    if (    \CfgVerifyFile(sPathDDKBase'\tools\cl386.exe', fQuiet),
    21822 -        |   \CfgVerifyFile(sPathDDKBase'\h386\limits.h', fQuiet),
    21823 -        |   \CfgVerifyFile(sPathDDKBase'\h386\string.h', fQuiet),
    21824 -        ) then
    21825 -        return 2;
    21826 -    rc = CheckCmdOutput('cl386', 0, fQuiet, 'Microsoft (R) Microsoft 386 C Compiler. Version 6.00.054');
    21827 -return rc;
    21828 -
    21829 -
    21830 -/*
    21831 - * Microsoft C v7.0 16-bit with OS/2 support.
    21832 - */
    21833 -MSCV7_16: procedure expose aCfg. aPath.
    21834 -    parse arg sToolId,sOperation,fRM,fQuiet
    21835 -
    21836 -    /*
    21837 -     * Microsoft C v6.0a main directory.
    21838 -     */
    21839 -    sPathMSC    = PathQuery('mscv7-16', sToolId, sOperation);
    21840 -    if (sPathMSC = '') then
    21841 -        return 1;
    21842 -    /* If config operation we're done now. */
    21843 -    if (pos('config', sOperation) > 0) then
    21844 -        return 0;
    21845 -
    21846 -    /*
    21847 -     * Installing the environment variables.
    21848 -     */
    21849 -    call EnvSet      fRM, 'BUILD_ENV',  'MSCV7-16'
    21850 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    21851 -    call EnvSet      fRM, 'PATH_MSC',   sPathMSC;
    21852 -    call EnvAddFront fRM, 'path',       sPathMSC'\binp;'
    21853 -    call EnvAddFront fRM, 'endlibpath', sPathMSC'\dll;'
    21854 -    call EnvAddFront fRM, 'helpfiles',  sPathMSC'\help;'
    21855 -    call EnvAddFront fRM, 'include',    sPathMSC'\include;'
    21856 -    call EnvAddFront fRM, 'include16',  sPathMSC'\include;'
    21857 -    call EnvAddFront fRM, 'lib',        sPathMSC'\lib;'
    21858 -
    21859 -    /*
    21860 -     * Verify.
    21861 -     */
    21862 -    if (pos('verify', sOperation) <= 0) then
    21863 -        return 0;
    21864 -    if (    \CfgVerifyFile(sPathMSC'\binp\cl.exe', fQuiet),
    21865 -        |   \CfgVerifyFile(sPathMSC'\binp\link.exe', fQuiet),
    21866 -        |   \CfgVerifyFile(sPathMSC'\binp\ilink.exe', fQuiet),
    21867 -       /* |   \CfgVerifyFile(sPathMSC'\lib\clibcep.lib', fQuiet),
    21868 -        |   \CfgVerifyFile(sPathMSC'\lib\llibcep.lib', fQuiet),
    21869 -        |   \CfgVerifyFile(sPathMSC'\lib\mlibcep.lib', fQuiet),
    21870 -        |   \CfgVerifyFile(sPathMSC'\lib\slibcep.lib', fQuiet)*/,
    21871 -        |   \CfgVerifyFile(sPathMSC'\include\dos.h', fQuiet),
    21872 -        |   \CfgVerifyFile(sPathMSC'\include\bios.h', fQuiet),
    21873 -        |   \CfgVerifyFile(sPathMSC'\include\locale.h', fQuiet),
    21874 -        |   \CfgVerifyFile(sPathMSC'\include\stdiostr.h', fQuiet),
    21875 -        |   \CfgVerifyFile(sPathMSC'\include\string.h', fQuiet),
    21876 -        |   \CfgVerifyFile(sPathMSC'\include\vmemory.h', fQuiet),
    21877 -        |   \CfgVerifyFile(sPathMSC'\include\stdio.h', fQuiet),
    21878 -        ) then
    21879 -        return 2;
    21880 -    rc = CheckCmdOutput('cl', 0, fQuiet, 'Microsoft (R) C/C++ Optimizing Compiler Version 7.00');
    21881 -return rc;
    21882 -
    21883 -
    21884 -
    21885 -
    21886 -/*
    21887 - * mySQL Database system
    21888 - */
    21889 -mySQL: procedure expose aCfg. aPath.
    21890 -    parse arg sToolId,sOperation,fRM,fQuiet
    21891 -
    21892 -    /*
    21893 -     * mySQL Database system main directory.
    21894 -     */
    21895 -    sPathMySQL    = PathQuery('mysql', sToolId, sOperation);
    21896 -    if (sPathMySQL = '') then
    21897 -        return 1;
    21898 -    /* If config operation we're done now. */
    21899 -    if (pos('config', sOperation) > 0) then
    21900 -        return 0;
    21901 -
    21902 -    /*
    21903 -     * Installing the environment variables.
    21904 -     */
    21905 -    call EnvSet      fRM, 'PATH_MYSQL',     sPathMySQL;
    21906 -    call EnvAddFront fRM, 'path',           sPathMySQL'\bin;'
    21907 -    call EnvAddFront fRM, 'beginlibpath',   sPathMySQL'\dll;'
    21908 -    call EnvAddFront fRM, 'include',        sPathMySQL'\include;'
    21909 -    call EnvAddFront fRM, 'bookshelf',      sPathMySQL'\doc;'sPathMySQL'\book';
    21910 -    /*call EnvAddFront fRM, 'lib',            sPathMySQL'\lib;'*/
    21911 -
    21912 -    /*
    21913 -     * Verify.
    21914 -     */
    21915 -    if (pos('verify', sOperation) <= 0) then
    21916 -        return 0;
    21917 -    if (    \CfgVerifyFile(sPathMySQL'\bin\mysql.exe', fQuiet),
    21918 -        |   \CfgVerifyFile(sPathMySQL'\bin\mysqld.exe', fQuiet),
    21919 -        |   \CfgVerifyFile(sPathMySQL'\bin\mysqladmin.exe', fQuiet),
    21920 -        |   \CfgVerifyFile(sPathMySQL'\dll\mysql.dll', fQuiet),
    21921 -        |   \CfgVerifyFile(sPathMySQL'\include\mysql.h', fQuiet),
    21922 -        |   \CfgVerifyFile(sPathMySQL'\include\mysql_com.h', fQuiet),
    21923 -        |   \CfgVerifyFile(sPathMySQL'\include\mysql_version.h', fQuiet),
    21924 -        ) then
    21925 -        return 2;
    21926 -    rc = CheckCmdOutput('mysql --version', 0, fQuiet, ', for ');
    21927 -return rc;
    21928 -
    21929 -
    21930 -
    21931 -/*
    21932 - * NASM - NetWide Assembler (all versions)
    21933 - */
    21934 -NASM: procedure expose aCfg. aPath.
    21935 -    parse arg sToolId,sOperation,fRM,fQuiet,sPathId
    21936 -
    21937 -    /*
    21938 -     * Get NASM directory
    21939 -     */
    21940 -    sPathNASM = PathQuery(sPathId, sToolId, sOperation);
    21941 -    if (sPathNASM = '') then
    21942 -        return 1;
    21943 -    /* If config operation we're done now. */
    21944 -    if (pos('config', sOperation) > 0) then
    21945 -        return 0;
    21946 -
    21947 -    /*
    21948 -     * Installing the environment variables.
    21949 -     */
    21950 -    call EnvSet      fRM, 'PATH_NASM',      sPathNASM;
    21951 -    call EnvAddFront fRM, 'path',           sPathNASM
    21952 -
    21953 -    /*
    21954 -     * Verify.
    21955 -     */
    21956 -    if (pos('verify', sOperation) <= 0) then
    21957 -        return 0;
    21958 -    if (    \CfgVerifyFile(sPathNASM'\nasm.exe', fQuiet),
    21959 -        |   \CfgVerifyFile(sPathNASM'\ndisasm.exe', fQuiet),
    21960 -        ) then
    21961 -        return 2;
    21962 -    select
    21963 -        when (sPathId = 'nasm9833') then    sVer = '0.98.33 compiled';
    21964 -        otherwise do; say 'internal error invalid pathid! sPathId='sPathId; exit(16); end
    21965 -    end
    21966 -    rc = CheckCmdOutput('nasm -version', 0, fQuiet, 'NASM version '||sVer);
    21967 -    if (rc = 0) then
    21968 -        rc = CheckCmdOutput('ndisasm -version', 0, fQuiet, 'NDISASM version '||sVer);
    21969 -return rc;
    21970 -
    21971 -
    21972 -
    21973 -/*
    21974 - * NetQOS2 - help subsystem++ for VAC 3.6.5 and VAC 4.0
    21975 - */
    21976 -NetQOS2: procedure expose aCfg. aPath.
    21977 -    parse arg sToolId,sOperation,fRM,fQuiet
    21978 -    sPathNetQOS2 = PathQuery('netqos2', sToolId, sOperation);
    21979 -    if (sPathNetQOS2 = '') then
    21980 -        return 1;
    21981 -    /* If config operation we're done now. */
    21982 -    if (pos('config', sOperation) > 0) then
    21983 -        return 0;
    21984 -
    21985 -    /*
    21986 -     * Installing the environment variables.
    21987 -     */
    21988 -    call EnvSet      fRM, 'PATH_NETQOS2',   sPathNetQOS2
    21989 -    call EnvAddFront fRM, 'path',           sPathNetQOS2';'
    21990 -    call EnvAddFront fRM, 'dpath',          sPathNetQOS2';'
    21991 -    call EnvAddFront fRM, 'beginlibpath',   sPathNetQOS2';'
    21992 -    call EnvSet      fRM, 'imndatasrv',     sPathNetQOS2'\DATA'
    21993 -    call EnvSet      fRM, 'imndatacl',      sPathNetQOS2'\DATA'
    21994 -    call EnvSet      fRM, 'imnworksrv',     sPathNetQOS2'\WORK'
    21995 -    call EnvSet      fRM, 'imnworkcl',      sPathNetQOS2'\WORK'
    21996 -    call EnvSet      fRM, 'imnnlpssrv',     sPathNetQOS2
    21997 -    call EnvSet      fRM, 'imnnlpscl',      sPathNetQOS2
    21998 -    call EnvSet      fRM, 'imncccfgfile',   'NETQ.CFG'
    21999 -    call EnvSet      fRM, 'imncscfgfile',   'NETQ.CFG'
    22000 -    call EnvSet      fRM, 'imqconfigsrv',   sPathNetQOS2'\instance'
    22001 -    call EnvSet      fRM, 'imqconfigcl',    sPathNetQOS2'\instance\dbcshelp'
    22002 -
    22003 -    /*
    22004 -     * Verify.
    22005 -     */
    22006 -    if (pos('verify', sOperation) <= 0) then
    22007 -        return 0;
    22008 -    if (    \CfgVerifyFile(sPathNetQOS2'\netq.exe', fQuiet),
    22009 -        ) then
    22010 -        return 2;
    22011 -    rc = CheckCmdOutput('netq', 999, fQuiet, 'NETQ {START | STOP');
    22012 -return rc;
    22013 -
    22014 -
    22015 -/*
    22016 - * Odin32 testcase setup.
    22017 - */
    22018 -Odin32Testcase: procedure expose aCfg. aPath.
    22019 -    parse arg sToolId,sOperation,fRM,fQuiet
    22020 -    if (  PathQuery('testcase_drive_unused', sToolId, sOperation) = '',
    22021 -        | PathQuery('testcase_drive_fixed', sToolId, sOperation) = '',
    22022 -        | PathQuery('testcase_drive_floppy', sToolId, sOperation) = '',
    22023 -        | PathQuery('testcase_drive_cdrom', sToolId, sOperation) = '',
    22024 -        ) then
    22025 -        return 1;
    22026 -    /* If config operation we're done now. */
    22027 -    if (pos('config', sOperation) > 0) then
    22028 -        return 0;
    22029 -
    22030 -    /*
    22031 -     * Installing the environment variables.
    22032 -     */
    22033 -    call EnvSet      fRM, 'odin32_testcase_drive_unused',       PathQuery('testcase_drive_unused', sToolId, sOperation);
    22034 -    call EnvSet      fRM, 'odin32_testcase_drive_fixed',        PathQuery('testcase_drive_fixed', sToolId, sOperation);
    22035 -    call EnvSet      fRM, 'odin32_testcase_drive_floppy',       PathQuery('testcase_drive_floppy', sToolId, sOperation);
    22036 -    call EnvSet      fRM, 'odin32_testcase_drive_cdrom',        PathQuery('testcase_drive_cdrom', sToolId, sOperation);
    22037 -    call EnvSet      fRM, 'odin32_testcase_drive_network',      PathQuery('testcase_drive_network', sToolId, sOperation, 1);
    22038 -    call EnvSet      fRM, 'odin32_testcase_drive_ramdisk',      PathQuery('testcase_drive_ramdisk', sToolId, sOperation, 1);
    22039 -
    22040 -    /*
    22041 -     * Verify.
    22042 -     */
    22043 -    if (pos('verify', sOperation) <= 0) then
    22044 -        return 0;
    22045 -return 0;
    22046 -
    22047 -
    22048 -/*
    22049 - * PERL 5005_53 or 5.004_55
    22050 - */
    22051 -Perl50xxx: procedure expose aCfg. aPath.
    22052 -    parse arg sToolId,sOperation,fRM,fQuiet
    22053 -
    22054 -    /*
    22055 -     * Perl main directory.
    22056 -     */
    22057 -    sPathPerl       = PathQuery('perl50xxx', sToolId, sOperation);
    22058 -    if (sPathPerl = '') then
    22059 -        return 1;
    22060 -    /* If config operation we're done now. */
    22061 -    if (pos('config', sOperation) > 0) then
    22062 -        return 0;
    22063 -
    22064 -    /*
    22065 -     * Installing the environment variables.
    22066 -     */
    22067 -    sPathPerlForw   = translate(sPathPerl, '/', '\');
    22068 -    call EnvSet      fRM, 'PATH_PERL',      sPathPerl;
    22069 -    call EnvAddFront fRM, 'path',           sPathPerl'\bin;'
    22070 -    call EnvAddFront fRM, 'beginlibpath',   sPathPerl'\dll;'
    22071 -    call EnvAddEnd   fRM, 'bookshelf',      sPathPerl'\book;'
    22072 -    call EnvSet      fRM, 'perllib_prefix', sPathPerlForw'/lib;'sPathPerlForw'/lib'
    22073 -    call EnvSet      fRM, 'perl_sh_dir',    sPathPerlForw'/bin_sh'
    22074 -    call EnvSet      fRM, 'manpath',        sPathPerlForw'/man'
    22075 -    call EnvSet      fRM, 'perl5lib',       sPathPerlForw'/lib'
    22076 -    call EnvSet      fRM, 'perl_badlang',   '0'
    22077 -
    22078 -    /*
    22079 -     * Verify.
    22080 -     */
    22081 -    if (pos('verify', sOperation) <= 0) then
    22082 -        return 0;
    22083 -
    22084 -    sPerlDLL = 'perl.dll';
    22085 -    sVer     = '5.004_55';
    22086 -    f5005_53 = FileExists(sPathPerl'\dll\perlE0AC.dll');
    22087 -    if (f5005_53) then
    22088 -    do
    22089 -        sPerlDLL = 'perlE0AC.dll';
    22090 -        sVer     = '5.005_53';
    22091 -    end
    22092 -    if (    \CfgVerifyFile(sPathPerl'\bin\perl.exe', fQuiet),
    22093 -        |   \CfgVerifyFile(sPathPerl'\dll\'||sPerlDLL, fQuiet),
    22094 -        ) then
    22095 -        return 2;
    22096 -    rc = CheckCmdOutput('perl --version', 0, fQuiet, 'This is perl, version '||sVer||' built for os2');
    22097 -return rc;
    22098 -
    22099 -
    22100 -/*
    22101 - * PERL v5.8.0
    22102 - */
    22103 -Perl580: procedure expose aCfg. aPath.
    22104 -    parse arg sToolId,sOperation,fRM,fQuiet
    22105 -
    22106 -    /*
    22107 -     * Perl main directory.
    22108 -     */
    22109 -    sPathPerl       = PathQuery('perl580', sToolId, sOperation);
    22110 -    if (sPathPerl = '') then
    22111 -        return 1;
    22112 -    /* If config operation we're done now. */
    22113 -    if (pos('config', sOperation) > 0) then
    22114 -        return 0;
    22115 -
    22116 -    /*
    22117 -     * Installing the environment variables.
    22118 -     */
    22119 -    sPathPerlForw   = translate(sPathPerl, '/', '\');
    22120 -    call EnvSet      fRM, 'PATH_PERL',      sPathPerl;
    22121 -    call EnvAddFront fRM, 'path',           sPathPerl'\bin\5.8.0;'
    22122 -    call EnvAddFront fRM, 'beginlibpath',   sPathPerl'\lib;'
    22123 -    call EnvAddEnd   fRM, 'bookshelf',      sPathPerl'\doc;'
    22124 -    call EnvSet      fRM, 'perllib_prefix', 'L:/Perl/lib;'sPathPerlForw'/lib'
    22125 -    call EnvSet      fRM, 'perl_sh_dir',    sPathPerlForw'/bin/5.8.0'
    22126 -    call EnvSet      fRM, 'manpath',        sPathPerlForw'/man'
    22127 -    call EnvSet      fRM, 'perl_badlang',   '0'
    22128 -
    22129 -    /*
    22130 -     * Verify.
    22131 -     */
    22132 -    if (pos('verify', sOperation) <= 0) then
    22133 -        return 0;
    22134 -
    22135 -    if (    \CfgVerifyFile(sPathPerl'\bin\5.8.0\perl.exe', fQuiet),
    22136 -        |   \CfgVerifyFile(sPathPerl'\lib\perlB12E.dll', fQuiet),
    22137 -        |   \CfgVerifyFile(sPathPerl'\bin\5.8.0\sh.exe', fQuiet),
    22138 -        ) then
    22139 -        return 2;
    22140 -    rc = CheckCmdOutput('perl --version', 0, fQuiet, 'This is perl, v5.8.0 built for os2_emx');
    22141 -
    22142 -return rc;
    22143 -
    22144 -
    22145 -/*
    22146 - * Python/2 v1.5.2
    22147 - */
    22148 -Python: procedure expose aCfg. aPath.
    22149 -    parse arg sToolId,sOperation,fRM,fQuiet
    22150 -
    22151 -    /*
    22152 -     * The Python Home directory
    22153 -     */
    22154 -    sPythonHome = PathQuery('python', sToolId, sOperation);
    22155 -    if (sPythonHome = '') then
    22156 -        return 1;
    22157 -    /* If config operation we're done now. */
    22158 -    if (pos('config', sOperation) > 0) then
    22159 -        return 0;
    22160 -
    22161 -    /*
    22162 -     * Installing the environment variables.
    22163 -     */
    22164 -    call EnvSet      fRM, 'PATH_PYTHON',    sPythonHome
    22165 -    call EnvSet      fRM, 'pythonhome',     sPythonHome
    22166 -    call EnvSet      fRM, 'pythonpath',     '.;'sPythonHome'\Lib;'sPythonHome'\Lib\plat-win;'sPythonHome'\Lib\lib-tk;'sPythonHome'\Lib\lib-dynload;'sPythonHome'\Lib\site-packages;'sPythonHome'\Lib\dos-8x3'
    22167 -    call EnvAddFront fRM, 'beginlibpath',   sPythonHome
    22168 -    call EnvAddFront fRM, 'path',           sPythonHome
    22169 -
    22170 -    /*
    22171 -     * Verify.
    22172 -     */
    22173 -    if (pos('verify', sOperation) <= 0) then
    22174 -        return 0;
    22175 -    if (    \CfgVerifyFile(sPythonHome'\Python.exe', fQuiet),
    22176 -        |   \CfgVerifyFile(sPythonHome'\Python15.dll', fQuiet),
    22177 -        ) then
    22178 -        return 2;
    22179 -    rc = CheckCmdOutput('echo print "hello world" | python', 0, fQuiet, 'hello world');
    22180 -return rc;
    22181 -
    22182 -
    22183 -/*
    22184 - * Subversion (svn)
    22185 - */
    22186 -Subversion: procedure expose aCfg. aPath.
    22187 -    parse arg sToolId,sOperation,fRM,fQuiet
    22188 -
    22189 -
    22190 -    /*
    22191 -     * The directories.
    22192 -     */
    22193 -    sPathCVS = PathQuery('svn', sToolId, sOperation);
    22194 -    if (sPathCVS = '') then
    22195 -        return 1;
    22196 -    sPathHome = PathQuery('home', sToolId, sOperation);
    22197 -    if (sPathHome = '') then
    22198 -        return 1;
    22199 -    /* If config operation we're done now. */
    22200 -    if (pos('config', sOperation) > 0) then
    22201 -        return 0;
    22202 -
    22203 -    /*
    22204 -     * Installing the environment variables.
    22205 -     */
    22206 -    call EnvSet      fRM, 'PATH_SVN',    sPathCVS;
    22207 -    call EnvAddFront fRM, 'path',        sPathCVS';'
    22208 -    call EnvSet      fRM, 'home',        translate(sPathHome, '/','\');
    22209 -
    22210 -    /*
    22211 -     * Verify.
    22212 -     */
    22213 -    if (pos('verify', sOperation) <= 0) then
    22214 -        return 0;
    22215 -
    22216 -    if (\CfgVerifyFile(sPathCVS'\svn.exe',fQuiet)) then
    22217 -            return 2;
    22218 -    if (length(sPathHome) <= 2) then
    22219 -    do
    22220 -        if (\fQuiet) then
    22221 -            say 'Error: The home directory is to short!';
    22222 -        return 2;
    22223 -    end
    22224 -    if (\CfgVerifyDir(sPathHome, fQuiet)) then
    22225 -        return 2;
    22226 -return CheckCmdOutput('svn.exe --version', 0, fQuiet, 'svn, version 1.');
    22227 -
    22228 -
    22229 -
    22230 -/*
    22231 - * OS/2 Programmers Toolkit v4.0 (CSD1/4)
    22232 - */
    22233 -Toolkit40: procedure expose aCfg. aPath.
    22234 -    parse arg sToolId,sOperation,fRM,fQuiet
    22235 -
    22236 -    /*
    22237 -     * Toolkit (4.0) main directory.
    22238 -     */
    22239 -    sPathTK    = PathQuery('toolkit40', sToolId, sOperation);
    22240 -    if (sPathTK = '') then
    22241 -        return 1;
    22242 -    /* If config operation we're done now. */
    22243 -    if (pos('config', sOperation) > 0) then
    22244 -        return 0;
    22245 -
    22246 -    /*
    22247 -     * Installing the environment variables.
    22248 -     */
    22249 -    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    22250 -    call EnvAddFront fRM, 'beginlibpath',   sPathTK'\archived;'sPathTK'\SAMPLES\MM\DLL;'sPathTK'\SAMPLES\OPENDOC\PARTS\DLL;'sPathTK'\SOM\COMMON\DLL;'sPathTK'\SOM\LIB;'sPathTK'\OPENDOC\BASE\DLL;'sPathTK'\OPENDOC\BASE\LOCALE\EN_US;'sPathTK'\DLL;'
    22251 -    call EnvAddFront fRM, 'path',           sPathTK'\archived;'sPathTK'\SOM\COMMON;'sPathTK'\SOM\BIN;.;'sPathTK'\OPENDOC\BASE\BIN;'sPathTK'\BIN;'
    22252 -    call EnvAddFront fRM, 'dpath',          sPathTK'\SOM\COMMON\SYSTEM;'sPathTK'\SOM\MSG;'sPathTK'\OPENDOC\BASE\MSG;'sPathTK'\BOOK;'sPathTK'\MSG;'
    22253 -    call EnvAddFront fRM, 'help',           sPathTK'\archived;'sPathTK'\OPENDOC\BASE\LOCALE\EN_US;'sPathTK'\HELP;'
    22254 -    call EnvAddFront fRM, 'bookshelf',      sPathTK'\archived;'sPathTK'\BOOK;'sPathTK'\ARCHIVED;'
    22255 -    call EnvAddFront fRM, 'somir',          sPathTK'\SOM\COMMON\ETC\214\SOM.IR;'sPathTK'\OPENDOC\BASE\AVLSHELL.IR;'
    22256 -    call EnvAddEnd   fRM, 'somir',          sPathTK'\OPENDOC\CUSTOM\OD.IR;'sPathTK'\SAMPLES\REXX\SOM\ANIMAL\ORXSMP.IR;'
    22257 -/*    call EnvAddFront fRM, 'include',        sPathTK'\SPEECH\H;''sPathTK'\SAMPLES\OPENDOC\PARTS\INCLUDE;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'sPathTK'\H\GL;'sPathTK'\H;' */
    22258 -    call EnvAddFront fRM, 'include',        /*sPathTK'\SPEECH\H;'*/sPathTK'\SAMPLES\OPENDOC\PARTS\INCLUDE;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'sPathTK'\H\GL;'sPathTK'\H;'
    22259 -    call EnvAddEnd   fRM, 'include',        sPathTK'\H\LIBC;.;'
    22260 -    call EnvAddFront fRM, 'lib',            sPathTK'\SPEECH\LIB;'sPathTK'\SAMPLES\MM\LIB;'sPathTK'\LIB;'sPathTK'\SOM\LIB;'sPathTK'\OPENDOC\BASE\LIB;'
    22261 -    call EnvAddFront fRM, 'nlspath',        sPathTK'\OPENDOC\BASE\LOCALE\EN_US\%N;'sPathTK'\MSG\%N;C:\MPTN\MSG\NLS\%N;C:\TCPIP\msg\ENUS850\%N;'
    22262 -    call EnvAddFront fRM, 'locpath',        sPathTK'\OPENDOC\BASE\LOCALE;'
    22263 -    call EnvAddFront fRM, 'ipfc',           sPathTK'\IPFC;'
    22264 -    call EnvSet      fRM, 'odbase',         sPathTK'\OPENDOC\BASE'
    22265 -    call EnvSet      fRM, 'odlang',         'en_US'
    22266 -    call EnvAddFront fRM, 'odbasepaths',    sPathTK'\OPENDOC\BASE;'
    22267 -    call EnvSet      fRM, 'odcfg',          sPathTK'\OPENDOC\CUSTOM'
    22268 -    call EnvSet      fRM, 'odtmp',          EnvGet('tmp');
    22269 -    call EnvSet      fRM, 'sombase',        sPathTK'\SOM'
    22270 -    call EnvSet      fRM, 'somruntime',     sPathTK'\SOM\COMMON'
    22271 -
    22272 -    call EnvSet      fRM, 'cpref',          'CP1.INF+CP2.INF+CP3.INF'
    22273 -    call EnvSet      fRM, 'gpiref',         'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    22274 -    call EnvSet      fRM, 'mmref',          'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    22275 -    call EnvSet      fRM, 'pmref',          'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    22276 -    call EnvSet      fRM, 'wpsref',         'WPS1.INF+WPS2.INF+WPS3.INF'
    22277 -    call EnvAddFront fRM, 'sminclude',      sPathTK'\H;'sPathTK'\IDL;'sPathTK'\SOM\INCLUDE;.;'sPathTK'\OPENDOC\BASE\INCLUDE;'sPathTK'\SAMPLES\OPENDOC\PARTS\INCLUDE;'
    22278 -    call EnvSet      fRM, 'smaddstar',      '1'
    22279 -    call EnvSet      fRM, 'smemit',         'h;ih;c'
    22280 -    call EnvSet      fRM, 'smtmp',          EnvGet('tmp');
    22281 -    call EnvSet      fRM, 'smclasses',      'WPTYPES.IDL'
    22282 -    call EnvSet      fRM, 'odparts',        sPathTK'\SAMPLES\OPENDOC\PARTS'
    22283 -    call EnvSet      fRM, 'odsrc',          sPathTK'\SAMPLES\OPENDOC\PARTS'
    22284 -    call EnvAddFront fRM, 'odpartspaths',   sPathTK'\SAMPLES\OPENDOC\PARTS;'
    22285 -    call EnvAddFront fRM, 'odsrcpaths',     sPathTK'\SAMPLES\OPENDOC\PARTS;'
    22286 -    /*
    22287 -    call EnvSet      fRM, 'CAT_MACHINE=COM1:57600'
    22288 -    call EnvSet      fRM, 'CAT_HOST_BIN_PATH='sPathTK'\BIN'
    22289 -    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE=ASYNC_SIGBRK'
    22290 -    call EnvAddFront fRM, 'CAT_HOST_SOURCE_PATH='sPathTK'\BIN;'
    22291 -    */
    22292 -
    22293 -    /*
    22294 -     * Verify.
    22295 -     */
    22296 -    if (pos('verify', sOperation) <= 0) then
    22297 -        return 0;
    22298 -    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    22299 -        |   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet),
    22300 -        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    22301 -        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    22302 -        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    22303 -        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    22304 -        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    22305 -        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    22306 -        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    22307 -        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    22308 -        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    22309 -        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    22310 -        |   \CfgVerifyFile(sPathTK'\som\bin\sc.exe', fQuiet),
    22311 -        ) then
    22312 -        return 2;
    22313 -
    22314 -    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,,,,
    22315 -                       'IBM Developer''s Toolkit for OS/2 Warp Version 4',,
    22316 -                       15, '0');
    22317 -    if (rc = 0) then
    22318 -        rc = CheckCmdOutput('sc -V', -1, fQuiet, '", Version: 2.54.');
    22319 -    if (rc = 0) then
    22320 -        rc = CheckCmdOutput('rc', 0, fQuiet, 'IBM RC (Resource Compiler) Version 5.00.00');
    22321 -    if (rc = 0) then
    22322 -        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.00');
    22323 -
    22324 -return rc;
    22325 -
    22326 -
    22327 -
    22328 -/*
    22329 - * OS/2 Programmers Toolkit v4.5
    22330 - */
    22331 -Toolkit45: procedure expose aCfg. aPath.
    22332 -    parse arg sToolId,sOperation,fRM,fQuiet
    22333 -
    22334 -    /*
    22335 -     * Toolkit (4.5) main directory.
    22336 -     */
    22337 -     sPathTK    = PathQuery('toolkit45', sToolId, sOperation);
    22338 -    if (sPathTK = '') then
    22339 -        return 1;
    22340 -    /* If config operation we're done now. */
    22341 -    if (pos('config', sOperation) > 0) then
    22342 -        return 0;
    22343 -
    22344 -    /*
    22345 -     * Installing the environment variables.
    22346 -     */
    22347 -    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    22348 -    call EnvAddFront fRM, 'path',        sPathTK'\bin;'
    22349 -    call EnvAddFront fRM, 'dpath',       sPathTK'\book;'
    22350 -    call EnvAddFront fRM, 'dpath',       sPathTK'\msg;'
    22351 -    call EnvAddFront fRM, 'beginlibpath', sPathTK'\dll;'
    22352 -    call EnvAddFront fRM, 'help',        sPathTK'\help;'
    22353 -    call EnvAddFront fRM, 'bookshelf',   sPathTK'\archived;'
    22354 -    call EnvAddFront fRM, 'bookshelf',   sPathTK'\book;'
    22355 -    call EnvAddFront fRM, 'nlspath',     sPathTK'\msg\%N;'
    22356 -    call EnvAddEnd   fRM, 'ulspath',     sPathTK'\language;'
    22357 -    call EnvAddFront fRM, 'include',     sPathTK'\H;'
    22358 -/*    call EnvAddFront fRM, 'include',     sPathTK'\H\GL;' */
    22359 -/*    call EnvAddFront fRM, 'include',     sPathTK'\SPEECH\H;' includes tend to get too long :-( */
    22360 -    call EnvAddFront fRM, 'include',     sPathTK'\H\RPC;'
    22361 -    call EnvAddFront fRM, 'include',     sPathTK'\H\NETNB;'
    22362 -    call EnvAddFront fRM, 'include',     sPathTK'\H\NETINET;'
    22363 -    call EnvAddFront fRM, 'include',     sPathTK'\H\NET;'
    22364 -    call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'
    22365 -    call EnvAddFront fRM, 'include',     sPathTK'\INC;'
    22366 -    call EnvAddEnd   fRM, 'lib',         sPathTK'\SAMPLES\MM\LIB;'
    22367 -    call EnvAddEnd   fRM, 'lib',         sPathTK'\SPEECH\LIB;'
    22368 -    call EnvAddFront fRM, 'lib',         sPathTK'\lib;'
    22369 -    call EnvAddFront fRM, 'helpndx',     'EPMKWHLP.NDX+', '+'
    22370 -    call EnvAddFront fRM, 'ipfc',        sPathTK'\ipfc;'
    22371 -    call EnvSet      fRM, 'LANG',        'en_us'
    22372 -    call EnvSet      fRM, 'CPREF',       'CP1.INF+CP2.INF+CP3.INF'
    22373 -    call EnvSet      fRM, 'GPIREF',      'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    22374 -    call EnvSet      fRM, 'MMREF',       'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    22375 -    call EnvSet      fRM, 'PMREF',       'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    22376 -    call EnvSet      fRM, 'WPSREF',      'WPS1.INF+WPS2.INF+WPS3.INF'
    22377 -    /*
    22378 -    call EnvSet      fRM, 'CAT_MACHINE', 'COM1:57600'
    22379 -    call EnvSet      fRM, 'CAT_HOST_BIN_PATH', TKMAIN'\BIN'
    22380 -    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE', 'ASYNC_SIGBRK'
    22381 -    call EnvSet      fRM, 'CAT_HOST_SOURCE_PATH',TKMAIN'\BIN;'
    22382 -    */
    22383 -
    22384 -    /*
    22385 -     * Verify.
    22386 -     */
    22387 -    if (pos('verify', sOperation) <= 0) then
    22388 -        return 0;
    22389 -    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    22390 -        |   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet),
    22391 -        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    22392 -        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    22393 -        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    22394 -        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    22395 -        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    22396 -        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    22397 -        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    22398 -        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    22399 -        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    22400 -        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    22401 -        |    FileExists(sPathTK'\som\bin\sc.exe'),
    22402 -        ) then
    22403 -        return 2;
    22404 -
    22405 -    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,
    22406 -                       '5639F9300', '4.50.0', 'XR04500',,
    22407 -                       'IBM OS/2 Developer''s Toolkit Version 4.5',,
    22408 -                       15, '0');
    22409 -    if (rc = 0) then
    22410 -        rc = CheckCmdOutput('rc', 0, fQuiet, 'IBM RC (Resource Compiler) Version 5.00.004');
    22411 -    if (rc = 0) then
    22412 -        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.006 July 21 1998');
    22413 -return rc;
    22414 -
    22415 -
    22416 -/*
    22417 - * OS/2 Programmers Toolkit v4.5.1
    22418 - */
    22419 -Toolkit451: procedure expose aCfg. aPath.
    22420 -    parse arg sToolId,sOperation,fRM,fQuiet
    22421 -
    22422 -    /*
    22423 -     * Toolkit (4.5.1) main directory.
    22424 -     */
    22425 -     sPathTK    = PathQuery('toolkit451', sToolId, sOperation);
    22426 -    if (sPathTK = '') then
    22427 -        return 1;
    22428 -    /* If config operation we're done now. */
    22429 -    if (pos('config', sOperation) > 0) then
    22430 -        return 0;
    22431 -
    22432 -    /*
    22433 -     * Installing the environment variables.
    22434 -     */
    22435 -    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    22436 -    call EnvAddFront fRM, 'path',        sPathTK'\bin;'sPathTK'\som\common;'sPathTK'\som\bin'
    22437 -    call EnvAddFront fRM, 'dpath',       sPathTK'\msg;'sPathTK'\book;'sPathTK'\SOM\COMMON\SYSTEM;'sPathTK'\SOM\MSG;'
    22438 -    call EnvAddFront fRM, 'beginlibpath', sPathTK'\dll;'sPathTK'\som\common\dll;'sPathTK'\som\lib;'
    22439 -    call EnvAddFront fRM, 'help',        sPathTK'\help;'
    22440 -    call EnvAddFront fRM, 'bookshelf',   sPathTK'\book;'sPathTK'\archived;'
    22441 -    call EnvAddFront fRM, 'somir',       sPathTK'\SOM\COMMON\ETC\214\SOM.IR;'
    22442 -    call EnvAddEnd   fRM, 'somir',       sPathTK'\SAMPLES\REXX\SOM\ANIMAL\ORXSMP.IR;'
    22443 -    call EnvAddFront fRM, 'nlspath',     sPathTK'\msg\%N;'
    22444 -    call EnvAddEnd   fRM, 'ulspath',     sPathTK'\language;'
    22445 -    /*call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'sPathTK'\SPEECH\H;'sPathTK'\H\GL;'sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'*/
    22446 -    call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'/*sPathTK'\SPEECH\H;'sPathTK'\H\GL;'*/sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'
    22447 -    call EnvAddFront fRM, 'lib',         sPathTK'\lib;'sPathTK'\som\lib;'
    22448 -    call EnvAddEnd   fRM, 'lib',         sPathTK'\SAMPLES\MM\LIB;'sPathTK'\SPEECH\LIB;'
    22449 -    call EnvAddFront fRM, 'helpndx',     'EPMKWHLP.NDX+', '+'
    22450 -    call EnvAddFront fRM, 'ipfc',        sPathTK'\ipfc;'
    22451 -    call EnvSet      fRM, 'sombase',     sPathTK'\SOM'
    22452 -    call EnvSet      fRM, 'somruntime',  sPathTK'\SOM\COMMON'
    22453 -    call EnvSet      fRM, 'LANG',        'en_us'
    22454 -
    22455 -    call EnvSet      fRM, 'CPREF',       'CP1.INF+CP2.INF+CP3.INF'
    22456 -    call EnvSet      fRM, 'GPIREF',      'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    22457 -    call EnvSet      fRM, 'MMREF',       'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    22458 -    call EnvSet      fRM, 'PMREF',       'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    22459 -    call EnvSet      fRM, 'WPSREF',      'WPS1.INF+WPS2.INF+WPS3.INF'
    22460 -    call EnvAddFront fRM, 'sminclude',   sPathTK'\H;'sPathTK'\IDL;'sPathTK'\SOM\INCLUDE;.;'
    22461 -    call EnvSet      fRM, 'smaddstar',   '1'
    22462 -    call EnvSet      fRM, 'smemit',      'h;ih;c'
    22463 -    call EnvSet      fRM, 'smtmp',       EnvGet('tmp');
    22464 -    call EnvSet      fRM, 'smclasses',   'WPTYPES.IDL'
    22465 -    /*
    22466 -    call EnvSet      fRM, 'CAT_MACHINE', 'COM1:57600'
    22467 -    call EnvSet      fRM, 'CAT_HOST_BIN_PATH', TKMAIN'\BIN'
    22468 -    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE', 'ASYNC_SIGBRK'
    22469 -    call EnvSet      fRM, 'CAT_HOST_SOURCE_PATH',TKMAIN'\BIN;'
    22470 -    */
    22471 -
    22472 -    /*
    22473 -     * Verify.
    22474 -     */
    22475 -    if (pos('verify', sOperation) <= 0) then
    22476 -        return 0;
    22477 -    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    22478 -        |   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet),
    22479 -        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    22480 -        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    22481 -        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    22482 -        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    22483 -        |   \CfgVerifyFile(sPathTK'\bin\nmake.exe', fQuiet),
    22484 -        |   \CfgVerifyFile(sPathTK'\bin\nmake32.exe', fQuiet),
    22485 -        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    22486 -        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    22487 -        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    22488 -        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    22489 -        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    22490 -        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    22491 -        |   \CfgVerifyFile(sPathTK'\som\bin\sc.exe', fQuiet),
    22492 -        ) then
    22493 -        return 2;
    22494 -
    22495 -    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,
    22496 -                       '5639F9300', '4.50.1', 'XR04510',,
    22497 -                       'IBM OS/2 Developer''s Toolkit Version 4.5',,
    22498 -                       15, '0');
    22499 -    if (rc = 0) then
    22500 -        rc = CheckCmdOutput('sc -V', -1, fQuiet, '", Version: 2.54.');
    22501 -    if (rc = 0) then
    22502 -        rc = CheckCmdOutput('rc', 0, fQuiet, 'IBM RC (Resource Compiler) Version 5.00.006 Oct 20 2000');
    22503 -    if (rc = 0) then
    22504 -        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.007 Oct 02 2000');
    22505 -    if (rc = 0) then
    22506 -        rc = CheckCmdOutput('nmake -?', 0, fQuiet, 'Version 4.00.000 Oct 20 2000');
    22507 -    if (rc = 0) then
    22508 -        rc = CheckCmdOutput('nmake32 -?', 0, fQuiet, 'Version 5.00.003 Oct 20 2000');
    22509 -return rc;
    22510 -
    22511 -
    22512 -
    22513 -/*
    22514 - * OS/2 Programmers Toolkit v4.5.2
    22515 - */
    22516 -Toolkit452: procedure expose aCfg. aPath.
    22517 -    parse arg sToolId,sOperation,fRM,fQuiet
    22518 -
    22519 -    /*
    22520 -     * Toolkit (4.5.1) main directory.
    22521 -     */
    22522 -     sPathTK    = PathQuery('toolkit452', sToolId, sOperation);
    22523 -    if (sPathTK = '') then
    22524 -        return 1;
    22525 -    /* If config operation we're done now. */
    22526 -    if (pos('config', sOperation) > 0) then
    22527 -        return 0;
    22528 -
    22529 -    /*
    22530 -     * Installing the environment variables.
    22531 -     */
    22532 -    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    22533 -    call EnvAddFront fRM, 'path',        sPathTK'\bin;'sPathTK'\som\common;'sPathTK'\som\bin'
    22534 -    call EnvAddFront fRM, 'dpath',       sPathTK'\msg;'sPathTK'\book;'sPathTK'\SOM\COMMON\SYSTEM;'sPathTK'\SOM\MSG;'
    22535 -    call EnvAddFront fRM, 'beginlibpath', sPathTK'\dll;'sPathTK'\som\common\dll;'sPathTK'\som\lib;'
    22536 -    call EnvAddFront fRM, 'help',        sPathTK'\help;'
    22537 -    call EnvAddFront fRM, 'bookshelf',   sPathTK'\book;'sPathTK'\archived;'
    22538 -    call EnvAddFront fRM, 'somir',       sPathTK'\SOM\COMMON\ETC\214\SOM.IR;'
    22539 -    call EnvAddEnd   fRM, 'somir',       sPathTK'\SAMPLES\REXX\SOM\ANIMAL\ORXSMP.IR;'
    22540 -    call EnvAddFront fRM, 'nlspath',     sPathTK'\msg\%N;'
    22541 -    call EnvAddEnd   fRM, 'ulspath',     sPathTK'\language;'
    22542 -    /*call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'sPathTK'\SPEECH\H;'sPathTK'\H\GL;'sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'*/
    22543 -    /* the include mustn't be too long :-/ */
    22544 -    call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'/*sPathTK'\SPEECH\H;'sPathTK'\H\GL;'*/sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'
    22545 -    call EnvAddFront fRM, 'lib',         sPathTK'\lib;'sPathTK'\som\lib;'
    22546 -    call EnvAddEnd   fRM, 'lib',         sPathTK'\SAMPLES\MM\LIB;'sPathTK'\SPEECH\LIB;'
    22547 -    call EnvAddFront fRM, 'helpndx',     'EPMKWHLP.NDX+', '+'
    22548 -    call EnvAddFront fRM, 'ipfc',        sPathTK'\ipfc;'
    22549 -    call EnvSet      fRM, 'sombase',     sPathTK'\SOM'
    22550 -    call EnvSet      fRM, 'somruntime',  sPathTK'\SOM\COMMON'
    22551 -    call EnvSet      fRM, 'LANG',        'en_us'
    22552 -
    22553 -    call EnvSet      fRM, 'CPREF',       'CP1.INF+CP2.INF+CP3.INF'
    22554 -    call EnvSet      fRM, 'GPIREF',      'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    22555 -    call EnvSet      fRM, 'MMREF',       'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    22556 -    call EnvSet      fRM, 'PMREF',       'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    22557 -    call EnvSet      fRM, 'WPSREF',      'WPS1.INF+WPS2.INF+WPS3.INF'
    22558 -    call EnvAddFront fRM, 'sminclude',   sPathTK'\H;'sPathTK'\IDL;'sPathTK'\SOM\INCLUDE;.;'
    22559 -    call EnvSet      fRM, 'smaddstar',   '1'
    22560 -    call EnvSet      fRM, 'smemit',      'h;ih;c'
    22561 -    call EnvSet      fRM, 'smtmp',       EnvGet('tmp');
    22562 -    call EnvSet      fRM, 'smclasses',   'WPTYPES.IDL'
    22563 -    /*
    22564 -    call EnvSet      fRM, 'CAT_MACHINE', 'COM1:57600'
    22565 -    call EnvSet      fRM, 'CAT_HOST_BIN_PATH', TKMAIN'\BIN'
    22566 -    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE', 'ASYNC_SIGBRK'
    22567 -    call EnvSet      fRM, 'CAT_HOST_SOURCE_PATH',TKMAIN'\BIN;'
    22568 -    */
    22569 -
    22570 -    /*
    22571 -     * Verify.
    22572 -     */
    22573 -    if (pos('verify', sOperation) <= 0) then
    22574 -        return 0;
    22575 -    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    22576 -        /*|   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet)*/,
    22577 -        |   \CfgVerifyFile(sPathTK'\bin\rc16.exe', fQuiet),
    22578 -        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    22579 -        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    22580 -        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    22581 -        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    22582 -        |   \CfgVerifyFile(sPathTK'\bin\nmake.exe', fQuiet),
    22583 -        |   \CfgVerifyFile(sPathTK'\bin\nmake32.exe', fQuiet),
    22584 -        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    22585 -        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    22586 -        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    22587 -        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    22588 -        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    22589 -        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    22590 -        |   \CfgVerifyFile(sPathTK'\som\bin\sc.exe', fQuiet),
    22591 -        ) then
    22592 -        return 2;
    22593 -
    22594 -    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,
    22595 -                       '5639F9300', '4.50.2', 'XR04520',,
    22596 -                       'IBM OS/2 Developer''s Toolkit Version 4.5',,
    22597 -                       15, '0');
    22598 -    if (rc = 0) then
    22599 -        rc = CheckCmdOutput('sc -V', -1, fQuiet, '", Version: 2.54.');
    22600 -    /*if (rc = 0) then
    22601 -        rc = CheckCmdOutput('rc', 1, fQuiet, 'Version 4.00.011 Oct 04 2001');*/
    22602 -    if (rc = 0) then
    22603 -        rc = CheckCmdOutput('rc16', 1, fQuiet, 'Version 4.00.011 Oct 04 2001');
    22604 -    if (rc = 0) then
    22605 -        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.007 Oct 02 2000');
    22606 -    if (rc = 0) then
    22607 -        rc = CheckCmdOutput('nmake -?', 0, fQuiet, 'Version 4.00.001 Oct  4 2001');
    22608 -    if (rc = 0) then
    22609 -        rc = CheckCmdOutput('nmake32 -?', 0, fQuiet, 'Version 5.00.003 Oct  4 2001');
    22610 -return rc;
    22611 -
    22612 -
    22613 -
    22614 -/**
    22615 - * This will envolve into an full UNIX like environment some day perhaps...
    22616 - */
    22617 -Unix: procedure expose aCfg. aPath.
    22618 -    parse arg sToolId,sOperation,fRM,fQuiet
    22619 -
    22620 -    /*
    22621 -     * Unix root directory and XFree86 main directory.
    22622 -     */
    22623 -    sUnixBack = PathQuery('unixroot', sToolId, sOperation);
    22624 -    if (sUnixBack = '') then
    22625 -        return 1;
    22626 -    sXF86Back = PathQuery('xfree86', sToolId, sOperation);
    22627 -    if (sXF86Back = '') then
    22628 -        return 1;
    22629 -    /* If config operation we're done now. */
    22630 -    if (pos('config', sOperation) > 0) then
    22631 -        return 0;
    22632 -
    22633 -    /*
    22634 -     * Installing the environment variables.
    22635 -     */
    22636 -    sUnixForw = translate(sUnixBack, '/', '\');
    22637 -    call EnvSet      fRM, 'PATH_UNIX',          sUnixBack
    22638 -    call EnvSet      fRM, 'unixroot',           sUnixBack
    22639 -    call EnvAddFront fRM, 'path',               sUnixBack'\bin;'sUnixBack'\usr\local\bin;'
    22640 -    call EnvAddFront fRM, 'beginlibpath',       sUnixBack'\dll;'
    22641 -    call EnvSet      fRM, 'groff_font_path',    sUnixForw'/lib/groff/font'
    22642 -    call EnvSet      fRM, 'groff_tmac_path',    sUnixForw'/lib/groff/tmac'
    22643 -    call EnvSet      fRM, 'refer',              sUnixForw'/lib/groff/dict/papers/ind'
    22644 -
    22645 -/*    call EnvSet      fRM, 'editor',             'TEDIT' - don't change it */
    22646 -
    22647 -    sXF86Forw = translate(sXF86Back, '/', '\');
    22648 -    call EnvSet      fRM, 'PATH_XFREE86',       sXF86Back
    22649 -    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sXF86Forw'/include'
    22650 -    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sXF86Forw'/include'
    22651 -    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sXF86Forw'/include'
    22652 -    call EnvAddFront fRM, 'LIBRARY_PATH',       sXF86Forw'/lib'
    22653 -
    22654 -    /*
    22655 -     * Verify.
    22656 -     */
    22657 -    if (pos('verify', sOperation) <= 0) then
    22658 -        return 0;
    22659 -    if (    \CfgVerifyFile(sUnixBack'\bin\bash.exe', fQuiet, 1),
    22660 -        |   \CfgVerifyFile(sUnixBack'\bin\sh.exe', fQuiet),
    22661 -        |   \CfgVerifyFile(sUnixBack'\bin\yes.exe', fQuiet),
    22662 -        |   \CfgVerifyFile(sUnixBack'\bin\rm.exe', fQuiet),
    22663 -        |   \CfgVerifyFile(sUnixBack'\bin\cp.exe', fQuiet, 1),
    22664 -        |   \CfgVerifyFile(sUnixBack'\bin\mv.exe', fQuiet. 1),
    22665 -        |   \CfgVerifyFile(sXF86Back'\bin\xf86config.exe', fQuiet, 1),
    22666 -        ) then
    22667 -        return 2;
    22668 -return 0;
    22669 -
    22670 -
    22671 -
    22672 -/*
    22673 - * IBM Visual Age for C++ v3.08 for OS/2
    22674 - */
    22675 -VAC308: procedure expose aCfg. aPath.
    22676 -    parse arg sToolId,sOperation,fRM,fQuiet
    22677 -
    22678 -    /*
    22679 -     * IBM Visual Age for C++ Version 3.08 main directory.
    22680 -     */
    22681 -    sPathCPP = PathQuery('vac308', sToolId, sOperation);
    22682 -    if (sPathCPP = '') then
    22683 -        return 1;
    22684 -    /* If config operation we're done now. */
    22685 -    if (pos('config', sOperation) > 0) then
    22686 -        return 0;
    22687 -
    22688 -    /*
    22689 -     * Installing the environment variables.
    22690 -     */
    22691 -    call EnvSet      fRM, 'PATH_VAC308',    sPathCPP
    22692 -    call EnvSet      fRM, 'CCENV',      'VAC3'
    22693 -    call EnvSet      fRM, 'BUILD_ENV',  'VAC308'
    22694 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    22695 -
    22696 -    call EnvAddFront fRM, 'beginlibpath',   sPathCPP'\DLL;'sPathCPP'\SAMPLES\TOOLKIT\DLL;'
    22697 -    call EnvAddFront fRM, 'path',           sPathCPP'\BIN;'sPathCPP'\SMARTS\SCRIPTS;'sPathCPP'\HELP;'
    22698 -    call EnvAddFront fRM, 'dpath',          sPathCPP'\HELP;'sPathCPP';'sPathCPP'\LOCALE;'sPathCPP'\MACROS;'sPathCPP'\BND;'
    22699 -    call EnvAddFront fRM, 'help',           sPathCPP'\HELP;'sPathCPP'\SAMPLES\TOOLKIT\HELP;'
    22700 -    call EnvAddFront fRM, 'bookshelf',      sPathCPP'\HELP;'
    22701 -    call EnvAddFront fRM, 'somir',          sPathCPP'\ETC\SOM.IR;'
    22702 -    call EnvAddFront fRM, 'cpphelp_ini',    'C:\OS2\SYSTEM'
    22703 -    call EnvAddFront fRM, 'locpath',        sPathCPP'\LOCALE;%LOCPATH%;'
    22704 -    call EnvAddFront fRM, 'include',        sPathCPP'\INCLUDE;'sPathCPP'\INCLUDE\OS2;'sPathCPP'\INC;'sPathCPP'\INCLUDE\SOM;'
    22705 -    call EnvAddFront fRM, 'sminclude',      sPathCPP'\INCLUDE\OS2;'sPathCPP'\INCLUDE;'sPathCPP'\INCLUDE\SOM;'
    22706 -
    22707 -    call EnvAddFront fRM, 'vbpath',         '.;'sPathCPP'\DDE4VB;'
    22708 -    call EnvSet      fRM, 'tmpdir',         EnvGet('tmp')
    22709 -    call EnvSet      fRM, 'lxevfref',       'EVFELREF.INF+LPXCREF.INF'
    22710 -    call EnvSet      fRM, 'lxevfhdi',       'EVFELHDI.INF+LPEXHDI.INF'
    22711 -    call EnvAddFront fRM, 'lpath',          sPathCPP'\MACROS;'
    22712 -    call EnvAddFront fRM, 'codelpath',      sPathCPP'\CODE\MACROS;'sPathCPP'\MACROS;'
    22713 -    call EnvSet      fRM, 'clref',          'CPPCLRF.INF+CPPDAT.INF+CPPAPP.INF+CPPWIN.INF+CPPCTL.INF+CPPADV.INF+CPP2DG.INF+CPPDDE.INF+CPPDM.INF+CPPMM.INF+CPPCLRB.INF'
    22714 -    call EnvAddFront fRM, 'ipfc',           sPathCPP'\IPFC'
    22715 -    call EnvAddFront fRM, 'lib',            sPathCPP'\LIB;'sPathCPP'\DLL;'
    22716 -    call EnvSet      fRM, 'cpplocal',       sPathCPP
    22717 -    call EnvSet      fRM, 'cppmain',        sPathCPP
    22718 -    call EnvSet      fRM, 'cppwork',        sPathCPP
    22719 -    call EnvSet      fRM, 'iwf.default_prj','CPPDFTPRJ'
    22720 -
    22721 -    call EnvSet      fRM, 'iwf.solution_lang_support', 'CPPIBS30;ENG'
    22722 -    call EnvSet      fRM, 'vacpp_shared'    'FALSE'
    22723 -    call EnvSet      fRM, 'iwfhelp',        'IWFHDI.INF'
    22724 -    call EnvSet      fRM, 'iwfopt',         sPathCPP
    22725 -
    22726 -    call EnvSet      fRM, 'somruntime',     sPathCPP'\DLL'
    22727 -    call EnvSet      fRM, 'smaddstar',      '1'
    22728 -    call EnvSet      fRM, 'smemit',         'h;ih;c'
    22729 -    call EnvSet      fRM, 'sombase',        sPathCPP
    22730 -    call EnvSet      fRM, 'smtmp',          EnvGet('tmp')
    22731 -    call EnvSet      fRM, 'smclasses',      'WPTYPES.IDL'
    22732 -
    22733 -    call EnvAddFront fRM, 'helpndx',        'EPMKWHLP.NDX+CPP.NDX+CPPBRS.NDX', '+'
    22734 -    call EnvAddFront fRM, 'ipf_keys',       'SHOWNAV'
    22735 -
    22736 -    /*
    22737 -     * Verify.
    22738 -     */
    22739 -    if (pos('verify', sOperation) <= 0) then
    22740 -        return 0;
    22741 -    if (    \CfgVerifyFile(sPathCPP'\bin\icc.exe', fQuiet),
    22742 -        |   \CfgVerifyFile(sPathCPP'\bin\ilib.exe', fQuiet),
    22743 -        |   \CfgVerifyFile(sPathCPP'\bin\ilink.exe', fQuiet),
    22744 -        |   \CfgVerifyFile(sPathCPP'\bin\icsperf.exe', fQuiet,1),
    22745 -        |   \CfgVerifyFile(sPathCPP'\bin\icsdebug.exe', fQuiet),
    22746 -        |   \CfgVerifyFile(sPathCPP'\bin\cppfilt.exe', fQuiet),
    22747 -        |   \CfgVerifyFile(sPathCPP'\bin\dllrname.exe', fQuiet),
    22748 -        |   \CfgVerifyFile(sPathCPP'\lib\demangl.lib', fQuiet),
    22749 -        |   \CfgVerifyFile(sPathCPP'\lib\cppom30.lib', fQuiet),
    22750 -        |   \CfgVerifyFile(sPathCPP'\lib\cppom30i.lib', fQuiet),
    22751 -        |   \CfgVerifyFile(sPathCPP'\lib\cppom30o.lib', fQuiet),
    22752 -        |   \CfgVerifyFile(sPathCPP'\lib\cppon30i.lib', fQuiet),
    22753 -        |   \CfgVerifyFile(sPathCPP'\lib\cppon30o.lib', fQuiet),
    22754 -        |   \CfgVerifyFile(sPathCPP'\lib\_doscall.lib', fQuiet, 1),
    22755 -        |   \CfgVerifyFile(sPathCPP'\lib\_pmwin.lib', fQuiet, 1),
    22756 -        |   \CfgVerifyFile(sPathCPP'\include\builtin.h', fQuiet),
    22757 -        |   \CfgVerifyFile(sPathCPP'\include\conio.h', fQuiet),
    22758 -        |   \CfgVerifyFile(sPathCPP'\include\ismkss.h', fQuiet),
    22759 -        |    FileExists(sPathCPP'\include\os2.h'),
    22760 -        |    FileExists(sPathCPP'\include\os2win.h'),
    22761 -        |    FileExists(sPathCPP'\include\pm.h'),
    22762 -        |   \CfgVerifyFile(sPathCPP'\include\sys\utime.h', fQuiet),
    22763 -        |   \CfgVerifyFile(sPathCPP'\help\cpplib.inf', fQuiet),
    22764 -        ) then
    22765 -        return 2;
    22766 -
    22767 -
    22768 -    rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.ct3', fQuiet,'562201703',,'CTC308',);
    22769 -    if (rc = 0) then
    22770 -        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.ct4', fQuiet,'562201704',,'CTU308',);
    22771 -    /*if (rc = 0) then
    22772 -        rc = CheckCmdOutput('syslevel '||sPathCPP||'\syslevel', 0, fQuiet, 'Version 3.00     Component ID 562201707'||'0d0a'x||'Current CSD level: CTV308');
    22773 -    if (rc = 0) then
    22774 -        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.ct8', fQuiet,'562201708',,'CTD308',);
    22775 -        */
    22776 -    if (rc = 0) then
    22777 -        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.wf5', fQuiet,'562201605',,'CTC308',);
    22778 -    /*if (rc = 0) then
    22779 -        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.wf2', fQuiet,'562201602',,'CTO308',);
    22780 -        */
    22781 -    if (rc = 0) then
    22782 -        rc = CheckCmdOutput('icc', 0, fQuiet, 'IBM VisualAge C++ for OS/2, Version 3');
    22783 -    if (rc = 0) then
    22784 -        rc = CheckCmdOutput('ilink', 16, fQuiet, 'IBM(R) Linker for OS/2(R), Version 01.08.r1a_CTC308c');
    22785 -    if (rc = 0) then
    22786 -        rc = CheckCmdOutput('ilib /?', 8, fQuiet, 'IBM(R) Library Manager for OS/2(R), Version 01.00.03 cc_CTC308c');
    22787 -return rc;
    22788 -
    22789 -
    22790 -
    22791 -/*
    22792 - * Visual Age / C and C++ tools v3.6.5 for OS/2
    22793 - */
    22794 -VAC365: procedure expose aCfg. aPath.
    22795 -    parse arg sToolId,sOperation,fRM,fQuiet
    22796 -
    22797 -    /*
    22798 -     * IBM C/C++ Compiler and Tools Version 3.6.5 main directory.
    22799 -     */
    22800 -    sPathCxx    = PathQuery('vac365', sToolId, sOperation);
    22801 -    if (sPathCxx = '') then
    22802 -        return 1;
    22803 -    /* If config operation we're done now. */
    22804 -    if (pos('config', sOperation) > 0) then
    22805 -        return 0;
    22806 -
    22807 -    /*
    22808 -     * Installing the environment variables.
    22809 -     */
    22810 -    call EnvSet      fRM, 'PATH_VAC365', sPathCxx;
    22811 -    call EnvSet      fRM, 'CCENV',      'VAC36'
    22812 -    call EnvSet      fRM, 'BUILD_ENV',  'VAC365'
    22813 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    22814 -
    22815 -    call EnvSet      fRM, 'cxxmain',     sPathCxx;
    22816 -    call EnvAddFront fRM, 'path',        sPathCxx'\bin;'
    22817 -    call EnvAddFront fRM, 'dpath',       sPathCxx'\local;'sPathCxx'\help;'
    22818 -    call EnvAddFront fRM, 'beginlibpath',sPathCxx'\dll;'sPathCxx'\runtime;'
    22819 -    call EnvAddFront fRM, 'nlspath',     sPathCxx'\msg\%N;'
    22820 -    call EnvAddFront fRM, 'include',     sPathCxx'\include;'
    22821 -    call EnvAddFront fRM, 'lib',         sPathCxx'\lib;'
    22822 -    call EnvAddFront fRM, 'ipfc',        sPathCxx'\ipfc;'
    22823 -    call EnvSet      fRM, 'LANG',        'en_us'
    22824 -    call EnvSet      fRM, 'CPP_DBG_LANG', 'CPP'
    22825 -
    22826 -    /*
    22827 -     * Verify.
    22828 -     */
    22829 -    if (pos('verify', sOperation) <= 0) then
    22830 -        return 0;
    22831 -    if (    \CfgVerifyFile(sPathCxx'\bin\icc.exe', fQuiet),
    22832 -        |   \CfgVerifyFile(sPathCxx'\bin\ilib.exe', fQuiet),
    22833 -        |   \CfgVerifyFile(sPathCxx'\bin\ilink.exe', fQuiet),
    22834 -        |   \CfgVerifyFile(sPathCxx'\bin\idebug.exe', fQuiet),
    22835 -        |   \CfgVerifyFile(sPathCxx'\bin\cppfilt.exe', fQuiet),
    22836 -        |   \CfgVerifyFile(sPathCxx'\bin\dllrname.exe', fQuiet),
    22837 -        |   \CfgVerifyFile(sPathCxx'\bin\cppcbe36.exe', fQuiet),
    22838 -        |   \CfgVerifyFile(sPathCxx'\lib\cpprms36.lib', fQuiet),
    22839 -        |   \CfgVerifyFile(sPathCxx'\lib\cpprmi36.lib', fQuiet),
    22840 -        |   \CfgVerifyFile(sPathCxx'\lib\cpprmo36.lib', fQuiet),
    22841 -        |   \CfgVerifyFile(sPathCxx'\lib\cpprni36.lib', fQuiet),
    22842 -        |   \CfgVerifyFile(sPathCxx'\lib\cpprds36.lib', fQuiet),
    22843 -        |   \CfgVerifyFile(sPathCxx'\include\builtin.h', fQuiet),
    22844 -        |   \CfgVerifyFile(sPathCxx'\include\conio.h', fQuiet),
    22845 -        |   \CfgVerifyFile(sPathCxx'\include\ismavl.h', fQuiet),
    22846 -        |    FileExists(sPathCxx'\include\os2.h'),
    22847 -        |    FileExists(sPathCxx'\include\os2win.h'),
    22848 -        |    FileExists(sPathCxx'\include\pm.h'),
    22849 -        |   \CfgVerifyFile(sPathCxx'\include\sys\utime.h', fQuiet),
    22850 -        |   \CfgVerifyFile(sPathCxx'\help\cpplbm36.msg', fQuiet),
    22851 -        ) then
    22852 -        return 2;
    22853 -    rc = CheckCmdOutput('icc', 0, fQuiet, 'IBM* C and C++ Compilers for OS/2*, AIX* and for Windows NT**, Version 3.6');
    22854 -    if (rc = 0) then
    22855 -        rc = CheckCmdOutput('ilink', 16, fQuiet, 'IBM(R) Linker for OS/2(R), Version 03.06.PPK1010917.011116ilink');
    22856 -    if (rc = 0) then
    22857 -        rc = CheckCmdOutput('ilib /?', 0, fQuiet, 'IBM Librarian for OS/2(R) Version 03.99.PPK1001123');
    22858 -    if (stream(sPathCxx'\bin\cppcbe36.exe', 'c', 'query size') <> 603122) then
    22859 -    do
    22860 -        say 'Error!!! Get latest vac365 optimizer fixes from the OS2 Mozilla project.';
    22861 -        say '         http://www.mozilla.org/ports/os2/setup.html';
    22862 -        rc = 99;
    22863 -    end
    22864 -return rc;
    22865 -
    22866 -
    22867 -/*
    22868 - * Visual Age for C++ v4.0 for OS/2
    22869 - */
    22870 -VAC40: procedure expose aCfg. aPath.
    22871 -    parse arg sToolId,sOperation,fRM,fQuiet
    22872 -
    22873 -    /*
    22874 -     * IBM VisualAge for C++ v4.0 main directory.
    22875 -     */
    22876 -    sPathCPP    = PathQuery('vac40', sToolId, sOperation);
    22877 -    if (sPathCPP = '') then
    22878 -        return 1;
    22879 -    /* If config operation we're done now. */
    22880 -    if (pos('config', sOperation) > 0) then
    22881 -        return 0;
    22882 -
    22883 -    /*
    22884 -     * Installing the environment variables.
    22885 -     */
    22886 -    call EnvSet      fRM, 'PATH_VAC40',  sPathCPP;
    22887 -    call EnvSet      fRM, 'CCENV',      'VAC40'
    22888 -    call EnvSet      fRM, 'BUILD_ENV',  'VAC40'
    22889 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    22890 -
    22891 -    call EnvAddFront fRM, 'path',        sPathCPP'\bin;'
    22892 -    call EnvAddFront fRM, 'dpath',       sPathCPP'\etc;'sPathCPP'\help;'
    22893 -    call EnvAddFront fRM, 'beginlibpath',sPathCPP'\dll;'sPathCPP'\runtime;'
    22894 -    call EnvAddFront fRM, 'help',        sPathCPP'\help;'
    22895 -    call EnvAddFront fRM, 'nlspath',     sPathCPP'\msg\%N;'
    22896 -    call EnvAddFront fRM, 'locpath',     sPathCPP'\locale;'sPathCPP'\runtime\locale;'
    22897 -    call EnvAddFront fRM, 'include',     sPathCPP'\ivb;'sPathCPP'\include;'
    22898 -    call EnvAddFront fRM, 'lib',         sPathCPP'\lib;'
    22899 -    call EnvAddFront fRM, 'ipfc',        sPathCPP'\bin;'
    22900 -    call EnvAddFront fRM, 'cpplpath4',   sPathCPP'\macros;'
    22901 -    call EnvSet      fRM, 'system_ice',  sPathCPP'\etc\system.ice'
    22902 -    call EnvSet      fRM, 'vbpath',      sPathCPP'\ivb'
    22903 -    call EnvSet      fRM, 'vacppmain',   sPathCPP;
    22904 -    call EnvSet      fRM, 'os2',         '1'
    22905 -
    22906 -    /*
    22907 -     * Verify.
    22908 -     */
    22909 -    if (pos('verify', sOperation) <= 0) then
    22910 -        return 0;
    22911 -    if (    \CfgVerifyFile(sPathCPP'\bin\iccv4.exe', fQuiet),
    22912 -        |   \CfgVerifyFile(sPathCPP'\bin\ilib.exe', fQuiet),
    22913 -        |   \CfgVerifyFile(sPathCPP'\bin\ire.exe', fQuiet),
    22914 -        |   \CfgVerifyFile(sPathCPP'\bin\vacide.exe', fQuiet),
    22915 -        |   \CfgVerifyFile(sPathCPP'\bin\cppfilt.exe', fQuiet),
    22916 -        |   \CfgVerifyFile(sPathCPP'\bin\dllrname.exe', fQuiet),
    22917 -        |   \CfgVerifyFile(sPathCPP'\bin\patrace.exe', fQuiet),
    22918 -        |   \CfgVerifyFile(sPathCPP'\lib\cpprms40.lib', fQuiet),
    22919 -        |   \CfgVerifyFile(sPathCPP'\lib\cpprmi40.lib', fQuiet),
    22920 -        |   \CfgVerifyFile(sPathCPP'\lib\cpprmo40.lib', fQuiet),
    22921 -        |   \CfgVerifyFile(sPathCPP'\lib\cpprni40.lib', fQuiet),
    22922 -        |   \CfgVerifyFile(sPathCPP'\lib\cpprds40.lib', fQuiet),
    22923 -        |   \CfgVerifyFile(sPathCPP'\include\builtin.h', fQuiet),
    22924 -        |   \CfgVerifyFile(sPathCPP'\include\conio.h', fQuiet),
    22925 -        |   \CfgVerifyFile(sPathCPP'\include\ismavl.h', fQuiet),
    22926 -        |    FileExists(sPathCPP'\include\os2.h'),
    22927 -        |    FileExists(sPathCPP'\include\os2win.h'),
    22928 -        |    FileExists(sPathCPP'\include\pm.h'),
    22929 -        |   \CfgVerifyFile(sPathCPP'\include\sys\utime.h', fQuiet),
    22930 -        |   \CfgVerifyFile(sPathCPP'\help\cpplbm40.msg', fQuiet),
    22931 -        ) then
    22932 -        return 2;
    22933 -    rc = CheckCmdOutput('iccv4', 0, fQuiet, 'IBM VisualAge for C++ Version 4.0 C Compiler');
    22934 -    if (rc = 0) then
    22935 -        rc = CheckCmdOutput('ilib /?', 0, fQuiet, 'IBM Librarian for OS/2(R) Version 03.99.cc_981110'); /* is this really FP2?????? */
    22936 -    if (rc = 0) then
    22937 -        rc = CheckCmdOutput('vacbld -?', 0, fQuiet, 'IBM(R) VisualAge(R) C++ Professional, Version 4.0 (981117)'); /* is this really FP2?????? */
    22938 -return rc;
    22939 -
    22940 -
    22941 -
    22942 -
    22943 -/*
    22944 - * WarpIn
    22945 - */
    22946 -WarpIn: procedure expose aCfg. aPath.
    22947 -    parse arg sToolId,sOperation,fRM,fQuiet
    22948 -
    22949 -    /*
    22950 -     * WarpIn main directory.
    22951 -     */
    22952 -    sPathWarpIn = PathQuery('warpin', sToolId, sOperation);
    22953 -    if (sPathWarpIn = '') then
    22954 -        return 1;
    22955 -    /* If config operation we're done now. */
    22956 -    if (pos('config', sOperation) > 0) then
    22957 -        return 0;
    22958 -
    22959 -    /*
    22960 -     * Installing the environment variables.
    22961 -     */
    22962 -    call EnvSet      fRM, 'PATH_WARPIN', sPathWarpIn;
    22963 -    call EnvAddFront fRM, 'path',        sPathWarpIn';'
    22964 -    call EnvAddFront fRM, 'beginlibpath',sPathWarpIn';'
    22965 -    call EnvAddFront fRM, 'bookshelf',   sPathWarpIn';'
    22966 -
    22967 -    /*
    22968 -     * Verify.
    22969 -     */
    22970 -    if (pos('verify', sOperation) <= 0) then
    22971 -        return 0;
    22972 -    if (    \CfgVerifyFile(sPathWarpIn'\wic.exe', fQuiet),
    22973 -        |   \CfgVerifyFile(sPathWarpIn'\wpirtl.dll', fQuiet),
    22974 -        |   \CfgVerifyFile(sPathWarpIn'\warpin.exe', fQuiet),
    22975 -        ) then
    22976 -        return 2;
    22977 -    rc = CheckCmdOutput('wic', 1, fQuiet, '2002 - WarpIn archive creation and maintenance');
    22978 -return rc;
    22979 -
    22980 -
    22981 -
    22982 -/*
    22983 - * Watcom C/C++ v11.0
    22984 - */
    22985 -WatcomC11: procedure expose aCfg. aPath.
    22986 -    parse arg sToolId,sOperation,fRM,fQuiet, iBits
    22987 -
    22988 -    /*
    22989 -     * Watcom C/C++ v11.0 main directory
    22990 -     */
    22991 -    sPathWatcom = PathQuery('watcom11', sToolId, sOperation);
    22992 -    if (sPathWatcom = '') then
    22993 -        return 1;
    22994 -    /* If config operation we're done now. */
    22995 -    if (pos('config', sOperation) > 0) then
    22996 -        return 0;
    22997 -
    22998 -    /*
    22999 -     * Installing the environment variables.
    23000 -     */
    23001 -    call EnvSet      fRM, 'PATH_WATCOM', sPathWatcom
    23002 -    call EnvSet      fRM, 'CCENV',      'WAT'
    23003 -    call EnvSet      fRM, 'BUILD_ENV',  'WAT11'
    23004 -    if (iBits == 16) then
    23005 -        call EnvSet      fRM, 'BUILD_ENV',  'WAT11-16'
    23006 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    23007 -
    23008 -    call EnvSet      fRM, 'watcom',      sPathWatcom
    23009 -    call EnvAddFront fRM, 'path',        sPathWatcom'\binp;'sPathWatcom'\binw;'
    23010 -    call EnvAddFront fRM, 'beginlibpath',sPathWatcom'\binp\dll;'
    23011 -    call EnvAddFront fRM, 'help',        sPathWatcom'\binp\help;'
    23012 -    call EnvAddEnd   fRM, 'bookshelf',   sPathWatcom'\binp\help;'
    23013 -    call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os2;'sPathWatcom'\h\nt;'
    23014 -    call EnvAddFront fRM, 'lib',         sPathWatcom'\lib386;'sPathWatcom'\lib386\os2;'sPathWatcom'\lib286;'sPathWatcom'\lib286\os2;'
    23015 -    call EnvSet      fRM, 'edpath',      sPathWatcom'EDDAT;'
    23016 -    /*
    23017 -    rem detach %watcom%\BINP\BATSERV.EXE
    23018 -    rem detach %watcom%\BINP\NMPBIND.EXE
    23019 -    */
    23020 -
    23021 -    /*
    23022 -     * Verify.
    23023 -     */
    23024 -    if (pos('verify', sOperation) <= 0) then
    23025 -        return 0;
    23026 -    if (    \CfgVerifyFile(sPathWatcom'\binp\wpp.exe', fQuiet),
    23027 -        |   \CfgVerifyFile(sPathWatcom'\binp\wcc.exe', fQuiet),
    23028 -        |   \CfgVerifyFile(sPathWatcom'\binp\wcc386.exe', fQuiet),
    23029 -        |   \CfgVerifyFile(sPathWatcom'\binp\wpp386.exe', fQuiet),
    23030 -        |   \CfgVerifyFile(sPathWatcom'\binp\wlink.exe', fQuiet),
    23031 -        |   \CfgVerifyFile(sPathWatcom'\lib286\os2\os2.lib', fQuiet),
    23032 -        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clbrdll.lib', fQuiet),
    23033 -        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clib3r.lib', fQuiet),
    23034 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\kernel32.lib', fQuiet,1),
    23035 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clbrdll.lib', fQuiet,1),
    23036 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clib3r.lib', fQuiet,1),
    23037 -        ) then
    23038 -        return 2;
    23039 -    rc = CheckCmdOutput('wcc', 8, fQuiet, 'Watcom C16 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    23040 -    if (rc = 0) then
    23041 -        rc = CheckCmdOutput('wpp', 8, fQuiet, 'Watcom C++16 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    23042 -    if (rc = 0) then
    23043 -        rc = CheckCmdOutput('wcc386', 8, fQuiet, 'Watcom C32 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    23044 -    if (rc = 0) then
    23045 -        rc = CheckCmdOutput('wpp386', 8, fQuiet, 'Watcom C++32 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    23046 -    if (rc = 0) then
    23047 -        rc = CheckCmdOutput('wlink form ELF', 1, fQuiet, 'WATCOM Linker Version 11.0'||'0d0a'x);
    23048 -return rc;
    23049 -
    23050 -
    23051 -/*
    23052 - * Watcom C/C++ v11.0c
    23053 - */
    23054 -WatcomC11c: procedure expose aCfg. aPath.
    23055 -    parse arg sToolId,sOperation,fRM,fQuiet, iBits
    23056 -
    23057 -    /*
    23058 -     * Watcom C/C++ v11.0c main directory
    23059 -     */
    23060 -    sPathWatcom = PathQuery('watcom11c', sToolId, sOperation);
    23061 -    if (sPathWatcom = '') then
    23062 -        return 1;
    23063 -    /* If config operation we're done now. */
    23064 -    if (pos('config', sOperation) > 0) then
    23065 -        return 0;
    23066 -
    23067 -    /*
    23068 -     * Installing the environment variables.
    23069 -     */
    23070 -    call EnvSet      fRM, 'PATH_WATCOM', sPathWatcom
    23071 -    call EnvSet      fRM, 'CCENV',      'WAT'
    23072 -    call EnvSet      fRM, 'BUILD_ENV',  'WAT11C'
    23073 -    if (iBits = 16) then
    23074 -        call EnvSet      fRM, 'BUILD_ENV',  'WAT11C-16'
    23075 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    23076 -
    23077 -    call EnvSet      fRM, 'watcom',      sPathWatcom
    23078 -    call EnvAddFront fRM, 'path',        sPathWatcom'\binp;'sPathWatcom'\binw;'
    23079 -    call EnvAddFront fRM, 'beginlibpath',sPathWatcom'\binp\dll;'
    23080 -    call EnvAddFront fRM, 'help',        sPathWatcom'\binp\help;'
    23081 -    call EnvAddEnd   fRM, 'bookshelf',   sPathWatcom'\binp\help;'
    23082 -    if (iBits = 16) then
    23083 -        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os21x;'
    23084 -    else
    23085 -        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os2;'sPathWatcom'\h\nt;'
    23086 -    call EnvAddFront fRM, 'lib',         sPathWatcom'\lib386;'sPathWatcom'\lib386\os2;'sPathWatcom'\lib286;'sPathWatcom'\lib286\os2;'
    23087 -    call EnvSet      fRM, 'edpath',      sPathWatcom'EDDAT;'
    23088 -    /*
    23089 -    rem detach %watcom%\BINP\BATSERV.EXE
    23090 -    rem detach %watcom%\BINP\NMPBIND.EXE
    23091 -    */
    23092 -
    23093 -    /*
    23094 -     * Verify.
    23095 -     */
    23096 -    if (pos('verify', sOperation) <= 0) then
    23097 -        return 0;
    23098 -    if (    \CfgVerifyFile(sPathWatcom'\binp\wpp.exe', fQuiet),
    23099 -        |   \CfgVerifyFile(sPathWatcom'\binp\wcc.exe', fQuiet),
    23100 -        |   \CfgVerifyFile(sPathWatcom'\binp\wcc386.exe', fQuiet),
    23101 -        |   \CfgVerifyFile(sPathWatcom'\binp\wpp386.exe', fQuiet),
    23102 -        |   \CfgVerifyFile(sPathWatcom'\binp\wlink.exe', fQuiet),
    23103 -        |   \CfgVerifyFile(sPathWatcom'\lib286\os2\os2.lib', fQuiet, 1),
    23104 -        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clbrdll.lib', fQuiet),
    23105 -        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clib3r.lib', fQuiet),
    23106 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\kernel32.lib', fQuiet, 1),
    23107 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clbrdll.lib', fQuiet, 1),
    23108 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clib3r.lib', fQuiet, 1),
    23109 -        ) then
    23110 -        return 2;
    23111 -    rc = CheckCmdOutput('wcc', 8, fQuiet, 'Watcom C16 Optimizing Compiler  Version 11.0c');
    23112 -    if (rc = 0) then
    23113 -        rc = CheckCmdOutput('wpp', 8, fQuiet, 'Watcom C++16 Optimizing Compiler  Version 11.0c');
    23114 -    if (rc = 0) then
    23115 -        rc = CheckCmdOutput('wcc386', 8, fQuiet, 'Watcom C32 Optimizing Compiler  Version 11.0c');
    23116 -    if (rc = 0) then
    23117 -        rc = CheckCmdOutput('wpp386', 8, fQuiet, 'Watcom C++32 Optimizing Compiler  Version 11.0c');
    23118 -    if (rc = 0) then
    23119 -        rc = CheckCmdOutput('wlink form ELF', 1, fQuiet, 'WATCOM Linker Version 11.0c');
    23120 -return rc;
    23121 -
    23122 -
    23123 -/*
    23124 - * Open Watcom C/C++ v1.4 and higher
    23125 - */
    23126 -OpenWatcomC14: procedure expose aCfg. aPath.
    23127 -    parse arg sToolId,sOperation,fRM,fQuiet, iBits
    23128 -
    23129 -    /*
    23130 -     * Watcom C/C++ v1.4 (and higher) main directory
    23131 -     */
    23132 -    sPathId = sToolId;
    23133 -    if (pos('-', sToolId) > 0) then
    23134 -        sPathId = substr(sToolId, 1, pos('-', sToolId));
    23135 -    sPathWatcom = PathQuery(sPathId, sToolId, sOperation);
    23136 -    if (sPathWatcom = '') then
    23137 -        return 1;
    23138 -    /* If config operation we're done now. */
    23139 -    if (pos('config', sOperation) > 0) then
    23140 -        return 0;
    23141 -
    23142 -    /*
    23143 -     * Installing the environment variables.
    23144 -     */
    23145 -    call EnvSet      fRM, 'PATH_WATCOM', sPathWatcom
    23146 -    call EnvSet      fRM, 'CCENV',      'WAT'
    23147 -    call EnvSet      fRM, 'BUILD_ENV',  'OW14'
    23148 -    if (iBits = 16) then
    23149 -        call EnvSet      fRM, 'BUILD_ENV',  'OW14-16'
    23150 -    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    23151 -
    23152 -    call EnvSet      fRM, 'watcom',      sPathWatcom
    23153 -    call EnvAddFront fRM, 'path',        sPathWatcom'\binp;'sPathWatcom'\binw;'
    23154 -    call EnvAddFront fRM, 'beginlibpath',sPathWatcom'\binp\dll;'
    23155 -    call EnvAddFront fRM, 'help',        sPathWatcom'\binp\help;'
    23156 -    call EnvAddEnd   fRM, 'bookshelf',   sPathWatcom'\binp\help;'
    23157 -    if (iBits = 16) then
    23158 -        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os21x;'
    23159 -    else
    23160 -        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os2;'sPathWatcom'\h\nt;'
    23161 -    call EnvAddFront fRM, 'lib',         sPathWatcom'\lib386;'sPathWatcom'\lib386\os2;'sPathWatcom'\lib286;'sPathWatcom'\lib286\os2;'
    23162 -    call EnvSet      fRM, 'edpath',      sPathWatcom'EDDAT;'
    23163 -    /*
    23164 -    rem detach %watcom%\BINP\BATSERV.EXE
    23165 -    rem detach %watcom%\BINP\NMPBIND.EXE
    23166 -    */
    23167 -
    23168 -    /*
    23169 -     * Verify.
    23170 -     */
    23171 -    if (pos('verify', sOperation) <= 0) then
    23172 -        return 0;
    23173 -    if (    \CfgVerifyFile(sPathWatcom'\binp\wpp.exe', fQuiet),
    23174 -        |   \CfgVerifyFile(sPathWatcom'\binp\wcc.exe', fQuiet),
    23175 -        |   \CfgVerifyFile(sPathWatcom'\binp\wcc386.exe', fQuiet),
    23176 -        |   \CfgVerifyFile(sPathWatcom'\binp\wpp386.exe', fQuiet),
    23177 -        |   \CfgVerifyFile(sPathWatcom'\binp\wlink.exe', fQuiet),
    23178 -        |   \CfgVerifyFile(sPathWatcom'\lib286\os2\os2.lib', fQuiet, 1),
    23179 -        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clbrdll.lib', fQuiet),
    23180 -        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clib3r.lib', fQuiet),
    23181 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\kernel32.lib', fQuiet, 1),
    23182 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clbrdll.lib', fQuiet, 1),
    23183 -        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clib3r.lib', fQuiet, 1),
    23184 -        ) then
    23185 -        return 2;
    23186 -    rc = CheckCmdOutput('wcc', 8, fQuiet, 'Open Watcom C16 Optimizing Compiler Version 1.4');
    23187 -    if (rc = 0) then
    23188 -        rc = CheckCmdOutput('wpp', 8, fQuiet, 'Open Watcom C++16 Optimizing Compiler Version 1.4');
    23189 -    if (rc = 0) then
    23190 -        rc = CheckCmdOutput('wcc386', 8, fQuiet, 'Open Watcom C32 Optimizing Compiler Version 1.4');
    23191 -    if (rc = 0) then
    23192 -        rc = CheckCmdOutput('wpp386', 8, fQuiet, 'Open Watcom C++32 Optimizing Compiler Version 1.4');
    23193 -    if (rc = 0) then
    23194 -        rc = CheckCmdOutput('wlink form ELF', 1, fQuiet, 'Open Watcom Linker Version 1.4');
    23195 -return rc;
    23196 -
    23197 +/* $Id: buildenv.cmd,v 1.59 2006-03-31 21:47:03 bird Exp $
    23198 + *
    23199 + * This is the master tools environment script. It contains environment
    23200 + * configurations for many development tools. Each tool can be installed
    23201 + * and uninstalled from the environment interchangably.
    23202 + *
    23203 + * Note:    Of historic reasons, there are some environments here which
    23204 + *          isn't normally used by normal code trees.
    23205 + *
    23206 + *
    23207 + * Known problems:
    23208 + *     - LANG is set to en_US by both VAC36 and TOOLKIT45. When unsetting
    23209 + *       those the original value, for example of no_NO, is not restored.
    23210 + *     - Same goes for some other stuff, we have no stack of previous values.
    23211 + *
    23212 + * Copyright (c) 1999-2005 knut st. osmundsen (bird@anduin.net)
    23213 + *
    23214 + * GPL v2
    23215 + *
    23216 + */
    23217 +
    23218 +    Address CMD '@echo off';
    23219 +
    23220 +    signal on novalue name NoValueHandler
    23221 +
    23222 +    /*
    23223 +     * Version
    23224 +     */
    23225 +    sVersion = '1.1.4 [2005-12-18]';
    23226 +
    23227 +    /*
    23228 +     * Create argument array with lowercase arguments.
    23229 +     */
    23230 +    parse arg sEnv.1 sEnv.2 sEnv.3 sEnv.4 sEnv.5 sEnv.6 sEnv.7 sEnv.8 sEnv.9 sEnv.10 sEnv.11 sEnv.12 sEnv.13 sEnv.14 sEnv.15 sEnv.16 sEnv.17 sEnv.18 sEnv.19 sEnv.20 sEnv.21 sEnv.22 sEnv.23
    23231 +
    23232 +    i = 1;
    23233 +    do while (sEnv.i <> '')
    23234 +        sEnv.i = translate(strip(sEnv.i), 'abcdefghijklmnopqrstuvwxyz‘›†', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ’');
    23235 +        i = i + 1;
    23236 +    end
    23237 +    sEnv.0 = i - 1;
    23238 +
    23239 +    /*
    23240 +     * Syntax
    23241 +     */
    23242 +    if (sEnv.0 = 0) then
    23243 +    do
    23244 +        say 'BuildEnv v'||sVersion
    23245 +        say '-------------------------------'
    23246 +        say ''
    23247 +        say 'Synopsis: Environment configuration utility written to maintain'
    23248 +        say 'many different versions of compilers and toolkits on the same'
    23249 +        say 'workstation. '
    23250 +        say ''
    23251 +        say 'Syntax: BuildEnv.cmd <environments>[action]'
    23252 +        say ''
    23253 +        say 'Actions:'
    23254 +        say '   +   Install tool in environment. Default action.'
    23255 +        say '   ~   Install tool in environment if it''s configured.'
    23256 +        say '   -   Remove tool from environment.'
    23257 +        say '   õ   Remove tool from environment if it''s configured.'
    23258 +        say '   *   Configure tool if needed.'
    23259 +        say '   !   Forced tool configuretion.'
    23260 +        say '   @   Verify tool configuration.'
    23261 +        say '   ?   Query if a tool is configured.'
    23262 +        say ''
    23263 +        say 'Special environments (commands):'
    23264 +        say '   allconfig       Configure all tools which fails verify.'
    23265 +        say '   allreconfig     Reconfigure all tools.'
    23266 +        say '   allverify       Verify all configured tools.'
    23267 +        say '   alluninstall    Removed all configured tools from environment.'
    23268 +        say '   showall         Show all tools.'
    23269 +        say '   showconfigured  Show all configured tools.'
    23270 +        say '   shownotconfigured   Show all tools which isn''t configured.'
    23271 +        say ''
    23272 +        say 'Copyright (c) 1999-2003 knut st. osmundsen'
    23273 +        say 'Published under GPL v2'
    23274 +        return 8;
    23275 +    end
    23276 +
    23277 +    /*
    23278 +     * Load REXX Util Functions.
    23279 +     * (Need Sys[Query|Set]ExtLibPath.)
    23280 +     */
    23281 +    if (RxFuncQuery('SysLoadFuncs') = 1) then
    23282 +    do
    23283 +        call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    23284 +        call SysLoadFuncs;
    23285 +    end
    23286 +
    23287 +
    23288 +    /*
    23289 +     * Apply CMD.EXE workaround.
    23290 +     */
    23291 +    call FixCMDEnv;
    23292 +
    23293 +
    23294 +    /*
    23295 +     * Configuration - sorted please!
    23296 +     */
    23297 +    aPath.0 = 0;
    23298 +
    23299 +    i = 1;
    23300 +    /* Tool id                      The tool's group            The function with args.                 Optional verify data.                       increment index */
    23301 +    aCfg.i.sId = 'cvs';             aCfg.i.sGrp = 'version';    aCfg.i.sSet = 'CVS';                    aCfg.i.sDesc = 'CVS v1.10 or later';        i = i + 1;
    23302 +    aCfg.i.sId = 'db2v52';          aCfg.i.sGrp = 'database';   aCfg.i.sSet = 'db2v52';                 aCfg.i.sDesc = 'DB2 v5.2 Dev Edition';      i = i + 1;
    23303 +    aCfg.i.sId = 'ddk';             aCfg.i.sGrp = 'ddk';        aCfg.i.sSet = 'DDK';                    aCfg.i.sDesc = 'OS/2 DDK (recent)';         i = i + 1;
    23304 +    aCfg.i.sId = 'ddkbase';         aCfg.i.sGrp = 'ddk';        aCfg.i.sSet = 'DDKBase';                aCfg.i.sDesc = 'DDK Base (recent)';         i = i + 1;
    23305 +    aCfg.i.sId = 'ddkvideo';        aCfg.i.sGrp = 'ddk';        aCfg.i.sSet = 'DDKVideo';               aCfg.i.sDesc = 'DDK Video (recent)';        i = i + 1;
    23306 +    aCfg.i.sId = 'doxygen';         aCfg.i.sGrp = 'doc';        aCfg.i.sSet = 'DoxyGen';                aCfg.i.sDesc = 'Doxygen v1.2.11 for OS/2';        i = i + 1;
    23307 +    aCfg.i.sId = 'emx';             aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'EMX';                    aCfg.i.sDesc = 'EMX v0.9d fixpack 04';      i = i + 1;
    23308 +    aCfg.i.sId = 'emxpgcc';         aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'EMXPGCC';                aCfg.i.sDesc = 'Pentium Optimized GCC/EMX v1.1.1 r2 with binutils 2.9.1'; i = i + 1;
    23309 +    aCfg.i.sId = 'freetypeemx';     aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'FreeTypeEMX';            aCfg.i.sDesc = 'FreeType v1.3.1 for EMX.'; i = i + 1;
    23310 +    aCfg.i.sId = 'gcc302';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC3xx,''gcc302''';      aCfg.i.sDesc = 'GCC/EMX v3.0.2beta with binutils 2.11.2'; i = i + 1;
    23311 +    aCfg.i.sId = 'gcc303';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC3xx,''gcc303''';      aCfg.i.sDesc = 'GCC/EMX v3.0.3beta with binutils 2.11.2'; i = i + 1;
    23312 +    aCfg.i.sId = 'gcc321';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC3xx,''gcc321''';      aCfg.i.sDesc = 'GCC/EMX v3.2.1beta with binutils 2.11.2'; i = i + 1;
    23313 +    aCfg.i.sId = 'gcc322';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc322''';  aCfg.i.sDesc = 'Innotek GCC v3.2.2';        i = i + 1;
    23314 +    aCfg.i.sId = 'gcc334';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc334''';  aCfg.i.sDesc = 'Innotek GCC v3.3.4';        i = i + 1;
    23315 +    aCfg.i.sId = 'gcc335';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc335''';  aCfg.i.sDesc = 'Innotek GCC v3.3.4';        i = i + 1;
    23316 +    aCfg.i.sId = 'gcc343';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'GCC322plus,''gcc343''';  aCfg.i.sDesc = 'Innotek GCC v3.4.3';        i = i + 1;
    23317 +    aCfg.i.sId = 'icatgam';         aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'ICATGam';                aCfg.i.sDesc = 'ICAT for OS/2 latest';      i = i + 1;
    23318 +    aCfg.i.sId = 'icatgam406rc1';   aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'ICATGam406RC1';          aCfg.i.sDesc = 'ICAT for OS/2 v4.0.6 release candidate 1'; i = i + 1;
    23319 +    aCfg.i.sId = 'icatpe';          aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'ICATPe';                 aCfg.i.sDesc = 'ICAT for OS/2 with PE support (test version)'; i = i + 1;
    23320 +    aCfg.i.sId = 'ida';             aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA414';                 aCfg.i.sDesc = 'Interactive DisAssembler (IDA) (latest)'; i = i + 1;
    23321 +    aCfg.i.sId = 'ida38';           aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA38';                  aCfg.i.sDesc = 'Interactive DisAssembler (IDA) v3.80 (historical)'; i = i + 1;
    23322 +    aCfg.i.sId = 'ida40';           aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA40';                  aCfg.i.sDesc = 'Interactive DisAssembler (IDA) v4.0 (historical)'; i = i + 1;
    23323 +    aCfg.i.sId = 'ida414';          aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDA414';                 aCfg.i.sDesc = 'Interactive DisAssembler (IDA) v4.14'; i = i + 1;
    23324 +    aCfg.i.sId = 'idasdk';          aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'IDASDK';                 aCfg.i.sDesc = 'Interactive DisAssembler (IDA) SDK'; i = i + 1;
    23325 +    aCfg.i.sId = 'icsdebug';        aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'icsdebug';               aCfg.i.sDesc = 'icsdebug from VAC308'; i = i + 1;
    23326 +    aCfg.i.sId = 'idebug';          aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'idebug';                 aCfg.i.sDesc = 'idebug from VAC365'; i = i + 1;
    23327 +    aCfg.i.sId = 'java131';         aCfg.i.sGrp = 'java';       aCfg.i.sSet = 'Java131';                aCfg.i.sDesc = 'Java v1.3.1 (co131-20020710)'; i = i + 1;
    23328 +    aCfg.i.sId = 'jitdbg';          aCfg.i.sGrp = 'debugger';   aCfg.i.sSet = 'jitdbg';                 aCfg.i.sDesc = 'jitdbg (secret)'; i = i + 1;
    23329 +    aCfg.i.sId = 'jpeg';            aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'JPEG';                   aCfg.i.sDesc = '(lib)JPEG v6b';             i = i + 1;
    23330 +    aCfg.i.sId = 'mode12050';       aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'Mode,120,50';            aCfg.i.sDesc = 'mode 120,50';               i = i + 1;
    23331 +    aCfg.i.sId = 'mode8050';        aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'Mode,80,50';             aCfg.i.sDesc = 'mode 80,50';                i = i + 1;
    23332 +    aCfg.i.sId = 'mscv6';           aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'MSCV6_32';               aCfg.i.sDesc = 'MicroSoft C v6.0 32-bit';   i = i + 1;
    23333 +    aCfg.i.sId = 'mscv6-16';        aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'MSCV6_16';               aCfg.i.sDesc = 'MicroSoft C v6.0a 16-bit';  i = i + 1;
    23334 +    aCfg.i.sId = 'mscv7-16';        aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'MSCV7_16';               aCfg.i.sDesc = 'MicroSoft C v7.0 16-bit with OS/2 support';  i = i + 1;
    23335 +    aCfg.i.sId = 'mysql';           aCfg.i.sGrp = 'database';   aCfg.i.sSet = 'mySQL';                  aCfg.i.sDesc = 'MySql any version (latest from Yuri is recommended)'; i = i + 1;
    23336 +    aCfg.i.sId = 'nasm9833';        aCfg.i.sGrp = 'asm';        aCfg.i.sSet = 'NASM,''nasm9833''';      aCfg.i.sDesc = 'NASM version 0.98.33 compiled on May 28 2002'; i = i + 1;
    23337 +    aCfg.i.sId = 'netqos2';         aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'NetQOS2';                aCfg.i.sDesc = 'NetQOS2 - help system for VAC40,VAC365,DB2 and more.'; i = i + 1;
    23338 +    aCfg.i.sId = 'odin32testcase';  aCfg.i.sGrp = 'tests';      aCfg.i.sSet = 'Odin32Testcase';         aCfg.i.sDesc = 'Odin32 testcase setup'; i = i + 1;
    23339 +    aCfg.i.sId = 'owc14';           aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'OpenWatcomC14,32,';      aCfg.i.sDesc = 'Open Watcom C/C++ v1.4 32-bit'; i = i + 1;
    23340 +    aCfg.i.sId = 'owc14-16';        aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'OpenWatcomC14,16,';      aCfg.i.sDesc = 'Open Watcom C/C++ v1.4 16-bit'; i = i + 1;
    23341 +    aCfg.i.sId = 'perl';            aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Perl580';                aCfg.i.sDesc = 'Perl v5.8.0'; i = i + 1;
    23342 +    aCfg.i.sId = 'perl580';         aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Perl580';                aCfg.i.sDesc = 'Perl v5.8.0'; i = i + 1;
    23343 +    aCfg.i.sId = 'perl50053';       aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Perl50xxx';              aCfg.i.sDesc = 'Perl v5.0053'; i = i + 1;
    23344 +    aCfg.i.sId = 'python';          aCfg.i.sGrp = 'script';     aCfg.i.sSet = 'Python';                 aCfg.i.sDesc = 'Python v1.5'; i = i + 1;
    23345 +    aCfg.i.sId = 'svn';             aCfg.i.sGrp = 'version';    aCfg.i.sSet = 'Subversion';             aCfg.i.sDesc = 'Subversion 1.0.6 or later.';  i = i + 1;
    23346 +    aCfg.i.sId = 'toolkit40';       aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit40';              aCfg.i.sDesc = 'Toolkit v4.0 CSD 4'; i = i + 1;
    23347 +    aCfg.i.sId = 'toolkit40';       aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit40';              aCfg.i.sDesc = 'Toolkit v4.0 CSD 4'; i = i + 1;
    23348 +    aCfg.i.sId = 'toolkit45';       aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit45';              aCfg.i.sDesc = 'Toolkit v4.5'; i = i + 1;
    23349 +    aCfg.i.sId = 'toolkit451';      aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit451';             aCfg.i.sDesc = 'Toolkit v4.5.1'; i = i + 1;
    23350 +    aCfg.i.sId = 'toolkit452';      aCfg.i.sGrp = 'tlktos2';    aCfg.i.sSet = 'Toolkit452';             aCfg.i.sDesc = 'Toolkit v4.5.2'; i = i + 1;
    23351 +    aCfg.i.sId = 'unix';            aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'Unix';                   aCfg.i.sDesc = 'Misc unix stuff.'; i = i + 1;
    23352 +    aCfg.i.sId = 'vac308';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'VAC308';                 aCfg.i.sDesc = 'VisualAge for C++ v3.08'; i = i + 1;
    23353 +    aCfg.i.sId = 'vac365';          aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'VAC365';                 aCfg.i.sDesc = 'VisualAge for C++ v3.6.5 FP2 with latest optimizer fixes.'; i = i + 1;
    23354 +    aCfg.i.sId = 'vac40';           aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'VAC40';                  aCfg.i.sDesc = 'VisualAge for C++ v4.0 FP2(??)'; i = i + 1;
    23355 +    aCfg.i.sId = 'warpin';          aCfg.i.sGrp = 'misc';       aCfg.i.sSet = 'WarpIn';                 aCfg.i.sDesc = 'WarpIn 0.9.18+ (for Odin32 18 with fix is required)'; i = i + 1;
    23356 +    aCfg.i.sId = 'watcomc11';       aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'WatcomC11,32,';          aCfg.i.sDesc = 'Watcom C/C++ v11.0 32-bit (no fixes)'; i = i + 1;
    23357 +    aCfg.i.sId = 'watcomc11-16';    aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'WatcomC11,16';           aCfg.i.sDesc = 'Watcom C/C++ v11.0 16-bit (no fixes)'; i = i + 1;
    23358 +    aCfg.i.sId = 'watcomc11c';      aCfg.i.sGrp = 'comp32';     aCfg.i.sSet = 'WatcomC11c,32';          aCfg.i.sDesc = 'Watcom C/C++ v11.0c 32-bit (beta)'; i = i + 1;
    23359 +    aCfg.i.sId = 'watcomc11c-16';   aCfg.i.sGrp = 'comp16';     aCfg.i.sSet = 'WatcomC11c,16';          aCfg.i.sDesc = 'Watcom C/C++ v11.0c 16-bit (beta)'; i = i + 1;
    23360 +    aCfg.0 = i - 1;
    23361 +
    23362 +
    23363 +
    23364 +    /*
    23365 +     * Parse arguments
    23366 +     */
    23367 +    do i = 1 to sEnv.0
    23368 +        /* uses dash to mark end of arguments */
    23369 +        if ((sEnv.i = '-') | (sEnv.i = '*')) then
    23370 +            leave;
    23371 +
    23372 +        /*
    23373 +         * Get last char.
    23374 +         * Dash means remove, pluss means add, asterix means verify and configure.
    23375 +         * Pluss is default and optional.
    23376 +         *
    23377 +         */
    23378 +        ch = substr(sEnv.i, length(sEnv.i), 1);
    23379 +        if (pos(ch, '+~-õ*!?@') > 0) then
    23380 +            sEnv.i = substr(sEnv.i, 1, length(sEnv.i) - 1);
    23381 +        else
    23382 +            ch = '+';
    23383 +        fRM = (ch = '-' | ch = 'õ');
    23384 +        fOptional = (ch = '~' | ch = 'õ')
    23385 +        fCfg = (ch = '*');
    23386 +        fForcedCfg = (ch = '!');
    23387 +        fVerify = (ch = '@')
    23388 +        fQuery = (ch = '?')
    23389 +
    23390 +        /*
    23391 +         * do the switch.
    23392 +         */
    23393 +        rc = 0;
    23394 +        select
    23395 +
    23396 +            /*
    23397 +             * Multi tool operations.
    23398 +             */
    23399 +            when (sEnv.i = 'allconfig') then do
    23400 +                do j = 1 to aCfg.0
    23401 +                    if (CfgVerify(j, 0, 1) <> 0) then
    23402 +                    do
    23403 +                        rc = CfgConfigure(j, 1);
    23404 +                        if (rc >= 8) then
    23405 +                            exit(rc);
    23406 +                    end
    23407 +                end
    23408 +            end
    23409 +
    23410 +            when (sEnv.i = 'allreconfig') then do
    23411 +                do j = 1 to aCfg.0
    23412 +                    rc = CfgConfigure(j, 1);
    23413 +                    if (rc >= 8) then
    23414 +                        exit(rc);
    23415 +                end
    23416 +            end
    23417 +
    23418 +            when (sEnv.i = 'allverify') then do
    23419 +                do j = 1 to aCfg.0
    23420 +                    if (CfgIsConfigured(j)) then
    23421 +                        call CfgVerify j, 0, 1;
    23422 +                end
    23423 +            end
    23424 +
    23425 +            when (sEnv.i = 'alluninstall') then do
    23426 +                do j = 1 to aCfg.0
    23427 +                    if (CfgIsConfigured(j)) then
    23428 +                        call CfgInstallUninstall j, 1;
    23429 +                end
    23430 +            end
    23431 +
    23432 +            when (sEnv.i = 'showall') then do
    23433 +                do j = 1 to aCfg.0
    23434 +                    say left(aCfg.j.sId, 15) '-' left(aCfg.j.sGrp, 8) '-' aCfg.j.sDesc
    23435 +                    sPath = PathQuery(aCfg.j.sId, aCfg.j.sId, 'quietisconfig');
    23436 +                    if (sPath <> '') then
    23437 +                        say '    'sPath;
    23438 +                end
    23439 +            end
    23440 +            when (sEnv.i = 'showconfigured') then do
    23441 +                do j = 1 to aCfg.0
    23442 +                    if (CfgIsConfigured(j)) then
    23443 +                    do
    23444 +                        say left(aCfg.j.sId, 15) '-' left(aCfg.j.sGrp, 8) '-' aCfg.j.sDesc
    23445 +                        sPath = PathQuery(aCfg.j.sId, aCfg.j.sId, 'quietisconfig');
    23446 +                        if (sPath <> '') then
    23447 +                            say '    'sPath;
    23448 +                    end
    23449 +                end
    23450 +            end
    23451 +
    23452 +            when (sEnv.i = 'shownotconfigured') then do
    23453 +                do j = 1 to aCfg.0
    23454 +                    if (\CfgIsConfigured(j)) then
    23455 +                        say left(aCfg.j.sId, 15) '-' left(aCfg.j.sGrp, 8) '-' aCfg.j.sDesc
    23456 +                end
    23457 +            end
    23458 +
    23459 +
    23460 +            /*
    23461 +             * Special 'tools'.
    23462 +             */
    23463 +            when (sEnv.i = 'debug') then do
    23464 +                rc = EnvSet(0, 'DEBUG','1');
    23465 +                rc = EnvSet(0, 'RELEASE','');
    23466 +                rc = EnvSet(0, 'BUILD_MODE','DEBUG');
    23467 +            end
    23468 +            when (sEnv.i = 'profile') then do
    23469 +                rc = EnvSet(0, 'DEBUG','1');
    23470 +                rc = EnvSet(0, 'RELEASE','');
    23471 +                rc = EnvSet(0, 'BUILD_MODE','PROFILE');
    23472 +            end
    23473 +            when (sEnv.i = 'release') then do
    23474 +                rc = EnvSet(0, 'DEBUG','');
    23475 +                rc = EnvSet(0, 'RELEASE','1');
    23476 +                rc = EnvSet(0, 'BUILD_MODE','RELEASE');
    23477 +            end
    23478 +
    23479 +            when (sEnv.i = 'buildsetup') then
    23480 +                rc = EnvSet(0, 'BUILD_SETUP_MAK','make\setup.mak');
    23481 +
    23482 +            /*
    23483 +             * Generic
    23484 +             */
    23485 +            otherwise
    23486 +            do
    23487 +                fFound = 0;
    23488 +                do j = 1 to aCfg.0
    23489 +                    if (aCfg.j.sId = sEnv.i) then
    23490 +                    do
    23491 +                        /*
    23492 +                         * Found the environment.
    23493 +                         */
    23494 +                        fFound = 1;
    23495 +
    23496 +                        /*
    23497 +                         * Take requested action.
    23498 +                         */
    23499 +                        rc = -16;
    23500 +                        if (fCfg | fForcedCfg) then
    23501 +                            rc = CfgConfigure(j, fForcedCfg);
    23502 +                        else if (fVerify) then
    23503 +                            rc = CfgVerify(j, 0, 1);
    23504 +                        else if (fQuery) then
    23505 +                        do
    23506 +                            rc = 0;
    23507 +                            if (\CfgIsConfigured(j)) then
    23508 +                                return 3;
    23509 +                        end
    23510 +                        else
    23511 +                        do
    23512 +                            if (\fOptional) then
    23513 +                                rc = CfgInstallUninstall(j, fRM);
    23514 +                            else if (CfgIsConfigured(j)) then
    23515 +                                rc = CfgInstallUninstall(j, fRM);
    23516 +                        end
    23517 +                        leave;
    23518 +                    end
    23519 +                end /* loop */
    23520 +
    23521 +                if (\fFound) then
    23522 +                do
    23523 +                    say 'error: unknown tool! - 'sEnv.i;
    23524 +                    call SysSleep 2;
    23525 +                    exit(16)
    23526 +                end
    23527 +            end /* otherwise */
    23528 +        end /* select */
    23529 +    end /* sEnv.i loop */
    23530 +
    23531 +
    23532 +    /*
    23533 +     * Check for command to execute.
    23534 +     * (I.e. if there are more arguments left. after the dash/star.)
    23535 +     */
    23536 +    if (i < sEnv.0) then
    23537 +    do
    23538 +        chType = sEnv.i;
    23539 +
    23540 +        sCmd = '';
    23541 +        do while (i < sEnv.0)
    23542 +            i = i + 1;
    23543 +            sCmd = sCmd ||' '||sEnv.i;
    23544 +        end
    23545 +
    23546 +        if (chType = '-') then
    23547 +        do
    23548 +            Address CMD 'start /F' sCMD;
    23549 +            Address CMD 'exit';
    23550 +        end
    23551 +        else
    23552 +            Address CMD sCMD;
    23553 +        exit(rc);
    23554 +    end
    23555 +
    23556 +exit(0);
    23557 +
    23558 +
    23559 +/**
    23560 + * No value handler
    23561 + */
    23562 +NoValueHandler:
    23563 +    say 'NoValueHandler: line 'SIGL;
    23564 +exit(16);
    23565 +
    23566 +
    23567 +
    23568 +/**
    23569 + * Get the description of an tool.
    23570 + * @returns Description string.
    23571 + *          '' if not found.
    23572 + * @param   sToolId      Tool id.
    23573 + */
    23574 +CfgDesc: procedure expose aCfg. aPath.
    23575 +    parse arg sToolId
    23576 +    do i = 1 to aCfg.0
    23577 +        if (aCfg.i.sId = sToolId) then
    23578 +            return aCfg.i.sDesc;
    23579 +    end
    23580 +return sToolId;
    23581 +
    23582 +
    23583 +/**
    23584 + * Lookups up an env. config in the aCfg. array.
    23585 + * @return  Index of sToolId.
    23586 + *          aCfg.0+1 on error.
    23587 + * @param   sToolId      Tool id.
    23588 + */
    23589 +CfgLookup: procedure expose aCfg. aPath.
    23590 +    parse arg sToolId
    23591 +    iTool = 1;
    23592 +    do while ((iTool <= aCfg.0) & (aCfg.iTool.sId <> sToolId))
    23593 +        iTool = iTool + 1;
    23594 +    end
    23595 +return iTool;
    23596 +
    23597 +
    23598 +/**
    23599 + * Verifies a configuration.
    23600 + * @returns 0 on success.
    23601 + *          4 on error/warnings which is continuable.
    23602 + *          8 or higher or on fatal errors.
    23603 + * @param   iTool   The tool index in aCfg.
    23604 + * @param   fRM     If set we'll uninstall the tool from the environment.
    23605 + */
    23606 +CfgInstallUninstall: procedure expose aCfg. aPath.
    23607 +    parse arg iTool, fRM
    23608 +
    23609 +    /* make rexx expression */
    23610 +    if (pos(',', aCfg.iTool.sSet) > 0) then
    23611 +        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,sOperation,fRM,fQuiet',
    23612 +             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    23613 +    else
    23614 +        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,sOperation,fRM,fQuiet)';
    23615 +    fQuiet = 0;
    23616 +    if (\fRM) then  sOperation = 'install';
    23617 +    else            sOperation = 'uninstall';
    23618 +
    23619 +    /* call the tool procedure with a verify operation. */
    23620 +    interpret 'iRc = '||sRexx;
    23621 +
    23622 +    /* On failure we'll complain and quietly uninstall the tool. */
    23623 +    if (iRc <> 0) then
    23624 +    do
    23625 +        /* complain */
    23626 +        if (\fQuiet) then
    23627 +        do
    23628 +            select
    23629 +                when (iRc = 1) then
    23630 +                    say 'error - 'aCfg.iTool.sId': 'sOperation' not configured - ie. no path.';
    23631 +                when (iRc = 2) then
    23632 +                    say 'error - 'aCfg.iTool.sId': 'sOperation' failed ''cause some vital file/dir wasn''t found.';
    23633 +                when (iRc = 49) then
    23634 +                    say 'error - 'aCfg.iTool.sId': 'sOperation' failed ''cause some vital command didn''t return as expected.';
    23635 +                when (iRc = 99) then
    23636 +                    say 'error - 'aCfg.iTool.sId': 'sOperation' failed ''cause some vital command didn''t return the expected output.';
    23637 +                otherwise
    23638 +                    say 'internal error- 'aCfg.iTool.sId': bad return code from '''sRexx''' rc=' iRc'.';
    23639 +            end
    23640 +        end
    23641 +
    23642 +        /* uninstall silently */
    23643 +        fRM = 1;
    23644 +        fQuiet = 1;
    23645 +        sOperation = 'quietuninstall';
    23646 +        interpret 'rcignore = '||sRexx;
    23647 +    end
    23648 +return iRc;
    23649 +
    23650 +
    23651 +
    23652 +
    23653 +/**
    23654 + * Configures an tool.
    23655 + * @returns 0 on success.
    23656 + *          4 on error/warnings which is continuable.
    23657 + *          8 or higher or on fatal errors.
    23658 + * @param   iTool       The tool configuration to configure.
    23659 + * @param   fForced     If set, we'll force a reconfiguration of the tool.
    23660 + */
    23661 +CfgConfigure: procedure expose aCfg. aPath.
    23662 +    parse arg iTool, fForced
    23663 +
    23664 +    /*
    23665 +     * First verfiy the configuration quietly, we don't have to do anything if it's ok.
    23666 +     */
    23667 +    if (\fForced & (CfgVerify(iTool, 1, 1) = 0)) then
    23668 +        return 0;
    23669 +
    23670 +    /*
    23671 +     * We have to configure it!
    23672 +     */
    23673 +    say '- Config of the 'aCfg.iTool.sId' ('CfgDesc(aCfg.iTool.sId)') tool.';
    23674 +
    23675 +    /* make rexx expression */
    23676 +    if (pos(',', aCfg.iTool.sSet) > 0) then
    23677 +        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,sOperation,fRM,fQuiet',
    23678 +             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    23679 +    else
    23680 +        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,sOperation,fRM,fQuiet)';
    23681 +    if (fForced) then   sOperation = 'forcedconfig';
    23682 +    else                sOperation = 'config';
    23683 +    fRM = 0;
    23684 +    fQuiet = 0;
    23685 +
    23686 +
    23687 +    /*
    23688 +     * Loop till rc=0 or user gives up.
    23689 +     */
    23690 +    rc = -1
    23691 +    do while (rc <> 0)
    23692 +        /* configure */
    23693 +        interpret 'rc = '||sRexx;
    23694 +
    23695 +        if (rc <> 0) then do
    23696 +            say 'warning: The user refused to give a path, continuing.';
    23697 +            return 4;
    23698 +        end
    23699 +
    23700 +        /* verifying */
    23701 +        rc = CfgVerify(iTool, 0, 1);
    23702 +        sOperation = 'verify';
    23703 +        if (rc = 0) then
    23704 +            leave;
    23705 +
    23706 +        /* Retry the config if the user wanna do so. */
    23707 +        say ''
    23708 +        say 'Retry configuring the tool' aCfg.iTool.sId '('CfgDesc(aCfg.iTool.sId)')? (y/N)';
    23709 +        sAnswer = PullUser(1);
    23710 +        if (substr(strip(sAnswer),1,1) <> 'Y') then
    23711 +            return 4;
    23712 +        sOperation = 'forcedconfig';
    23713 +    end
    23714 +
    23715 +    /*
    23716 +     * Write path file and return successfully.
    23717 +     */
    23718 +    call PathWrite;
    23719 +return 0;
    23720 +
    23721 +
    23722 +/**
    23723 + * Verifies a configuration.
    23724 + * @returns Return code from the environment procedure.
    23725 + * @param   iTool       The tool index in aCfg.
    23726 + * @param   fQuiet      If set we'll to a quiet verify.
    23727 + * @param   fCleanup    If set we'll clean properly.
    23728 + */
    23729 +CfgVerify: procedure expose aCfg. aPath.
    23730 +    parse arg iTool, fQuiet, fCleanup
    23731 +
    23732 +    /* make rexx expression */
    23733 +    if (pos(',', aCfg.iTool.sSet) > 0) then
    23734 +        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,sOperation,fRM,fQuiet',
    23735 +             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    23736 +    else
    23737 +        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,sOperation,fRM,fQuiet)';
    23738 +    if (fQuiet) then    sOperation = 'quietverify';
    23739 +    else                sOperation = 'verify';
    23740 +    fRM = 0;
    23741 +
    23742 +    /* call the tool procedure with a verify operation. */
    23743 +    interpret 'iRc = '||sRexx;
    23744 +
    23745 +    /* On failure we'll complain and quietly uninstall the tool. */
    23746 +    if (iRc <> 0) then
    23747 +    do
    23748 +        /* complain */
    23749 +        if (\fQuiet) then
    23750 +        do
    23751 +            select
    23752 +                when (iRc = 1) then
    23753 +                    say 'warning - 'aCfg.iTool.sId': The user refused to give a path, continuing.';
    23754 +                when (iRc = 2) then
    23755 +                    say 'error - 'aCfg.iTool.sId': verify failed ''cause some vital file/dir wasn''t found.';
    23756 +                when (iRc = 49) then
    23757 +                    say 'error - 'aCfg.iTool.sId': verify failed ''cause some vital command didn''t return as expected.';
    23758 +                when (iRc = 99) then
    23759 +                    say 'error - 'aCfg.iTool.sId': verify failed ''cause some vital command didn''t return the expected output.';
    23760 +                otherwise
    23761 +                    say 'internal error- 'aCfg.iTool.sId': bad return code from '''sRexx''' iRc=' iRc'.';
    23762 +            end
    23763 +        end
    23764 +        fCleanup = 1;
    23765 +    end
    23766 +
    23767 +    /* uninstall */
    23768 +    if (fCleanup) then
    23769 +    do
    23770 +        fRM = 1;
    23771 +        fQuiet = 1;
    23772 +        sOperation = 'quietuninstall';
    23773 +        interpret 'rcignore = '||sRexx;
    23774 +    end
    23775 +return iRc;
    23776 +
    23777 +
    23778 +/**
    23779 + * Verifies a configuration.
    23780 + * @returns True if configured.
    23781 + *          False if not configured.
    23782 + * @param   iTool   The tool index in aCfg.
    23783 + * @param   fQuiet  If set we'll to a quiet verify.
    23784 + */
    23785 +CfgIsConfigured: procedure expose aCfg. aPath.
    23786 +    parse arg iTool
    23787 +
    23788 +    /* make rexx expression */
    23789 +    if (pos(',', aCfg.iTool.sSet) > 0) then
    23790 +        sRexx = substr(aCfg.iTool.sSet, 1, pos(',', aCfg.iTool.sSet) - 1) || '(aCfg.iTool.sId,''quietisconfig'',0,1',
    23791 +             || substr(aCfg.iTool.sSet, pos(',', aCfg.iTool.sSet)) || ')';
    23792 +    else
    23793 +        sRexx = aCfg.iTool.sSet || '(aCfg.iTool.sId,''quietisconfig'',0,1)';
    23794 +    interpret 'iRc = '||sRexx;
    23795 +return (iRc = 0);
    23796 +
    23797 +
    23798 +
    23799 +/**
    23800 + * Checks if a file exists.
    23801 + * @param   sFile       Name of the file to look for.
    23802 + * @param   fQuiet      Flag which tells whether to be quiet or not.
    23803 + * @param   fOptional   Flag to say that this file is optional.
    23804 + * @returns TRUE if file exists.
    23805 + *          FALSE if file doesn't exists.
    23806 + */
    23807 +CfgVerifyFile: procedure expose aCfg. aPath.
    23808 +    parse arg sFile, fQuiet, fOptional
    23809 +    if (fOptional = '') then fOptional = 0;
    23810 +    rc = stream(sFile, 'c', 'query exist');
    23811 +    if ((rc = '') & \fQuiet) then
    23812 +    do
    23813 +        if (fOptional) then
    23814 +            say 'Warning: Installation is missing '''sFile'''.';
    23815 +        else
    23816 +            say 'Verify existance of '''sFile''' failed.';
    23817 +    end
    23818 +return rc <> '' | fOptional;
    23819 +
    23820 +
    23821 +/**
    23822 + * Checks if a directory exists.
    23823 + * @param   sDir   Name of the dir to look for.
    23824 + * @param   fQuiet  Flag which tells whether to be quiet or not.
    23825 + * @returns TRUE if file exists.
    23826 + *          FALSE if file doesn't exists.
    23827 + */
    23828 +CfgVerifyDir: procedure expose aCfg. aPath.
    23829 +    parse arg sDir, fQuiet
    23830 +    rc = SysFileTree(sDir, 'sDirs', 'DO');
    23831 +    if (rc = 0 & sDirs.0 = 1) then
    23832 +        return 1;
    23833 +    if (\fQuiet) then
    23834 +        say 'Verify existance of '''sDir''' failed.';
    23835 +return 0;
    23836 +
    23837 +
    23838 +
    23839 +
    23840 +
    23841 +/**
    23842 + * The Directory Configuration Function.
    23843 + *
    23844 + * @returns Lower cased, absolute, backward slashed, path to program.
    23845 + * @param   sPathId     Program identifier. (lowercase!)
    23846 + */
    23847 +PathQuery: procedure expose aCfg. aPath.
    23848 +    parse arg sPathId, sToolId, sOperation, fOptional
    23849 +
    23850 +    if (fOptional = '') then
    23851 +        fOptional = 0;
    23852 +
    23853 +    if (aPath.0 = 0) then
    23854 +    do  /*
    23855 +         * Read path config file
    23856 +         */
    23857 +        call PathRead;
    23858 +
    23859 +        /*
    23860 +         * If no data found fill in defaults (if known host).
    23861 +         */
    23862 +        if (aPath.0 = 0) then
    23863 +        do
    23864 +            call PathSetDefault;
    23865 +            call PathWrite;
    23866 +        end
    23867 +    end
    23868 +
    23869 +    /*
    23870 +     * Check for forced config.
    23871 +     */
    23872 +    if (sOperation = 'forcedconfig') then
    23873 +        call PathRemove sPathId;
    23874 +    else
    23875 +    do
    23876 +        /*
    23877 +         * Search for the path.
    23878 +         */
    23879 +        do i = 1 to aPath.0
    23880 +            if (aPath.i.sPId = sPathId) then
    23881 +            do
    23882 +                return aPath.i.sPath;
    23883 +                leave;
    23884 +            end
    23885 +        end
    23886 +    end
    23887 +
    23888 +    /*
    23889 +     * Path wasn't found!
    23890 +     */
    23891 +
    23892 +    /* for quiet verify, configured test and uninstall, fail sliently. */
    23893 +    if ((sOperation = 'quietisconfig') | (sOperation = 'quietverify') | (sOperation = 'quietuninstall')) then
    23894 +        return '';
    23895 +
    23896 +    /* if configure operation the configure it. */
    23897 +    if (pos('config', sOperation) > 0) then
    23898 +        return PathConfig(sOperation, sPathId, sToolId);
    23899 +
    23900 +    /* elsewise this is an fatal error */
    23901 +    if (\fOptional) then
    23902 +    do
    23903 +        say 'Fatal error: Path information for '''sPathId''' was not found.';
    23904 +        call SysSleep 5;
    23905 +        exit(16);
    23906 +    end
    23907 +
    23908 +return '';
    23909 +
    23910 +
    23911 +/**
    23912 + * Determins the full name of the path file to use.
    23913 + * @returns Path to the pathfile to use. The file may not exist.
    23914 + */
    23915 +PathGetFile: procedure
    23916 +
    23917 +    /*
    23918 +     * Project Specific?
    23919 +     */
    23920 +    parse source . . sPathFile .
    23921 +    sPathFile = sPathFile||'.paths';
    23922 +    if (FileExists(sPathFile)) then
    23923 +        return sPathFile;
    23924 +
    23925 +    /*
    23926 +     * ETC?
    23927 +     */
    23928 +    sEtc = EnvGet('ETC');
    23929 +    if (sEtc <> '') then
    23930 +        return sEtc||'\BuildEnv.cfg';
    23931 +return sPathFile;
    23932 +
    23933 +
    23934 +/**
    23935 + * Reads the path file into the 'aPath.' stem.
    23936 + */
    23937 +PathRead: procedure expose aCfg. aPath.
    23938 +
    23939 +    i = 1;                              /* Path index */
    23940 +    iLine = 0;                          /* Line # in file */
    23941 +
    23942 +
    23943 +    sPathFile = PathGetFile();
    23944 +
    23945 +    /*
    23946 +     * Read loop.
    23947 +     */
    23948 +    do while (lines(sPathFile) > 0)
    23949 +        iLine = iLine + 1;
    23950 +        sLine = strip(linein(sPathFile));
    23951 +
    23952 +        /*
    23953 +         * Skip empty lines and comment lines, ie. starting with '#' or ';'.
    23954 +         */
    23955 +        if ((sLine <> '') & (substr(sLine, 1, 1) <> '#') & (substr(sLine, 1, 1) <> ';')) then
    23956 +        do
    23957 +            /*
    23958 +             * Parse the line.
    23959 +             */
    23960 +            parse var sLine aPath.i.sPId '=' aPath.i.sPath
    23961 +            aPath.i.sPId = strip(aPath.i.sPId);
    23962 +            aPath.i.sPath = strip(aPath.i.sPath);
    23963 +
    23964 +            /*
    23965 +             * Validate the input.
    23966 +             */
    23967 +            if ((aPath.i.sPath = '') | (aPath.i.sPId = '') | (translate(sLine,'','#!$@%|<>;õ&Ï') <> sLine) ) then
    23968 +            do
    23969 +                say 'fatal error: missformed line in path file at line 'iLine'!'
    23970 +                call stream sPathFile, 'c', 'close';
    23971 +                call SysSleep 5;
    23972 +                exit(16);
    23973 +            end
    23974 +            i = i + 1;
    23975 +        end
    23976 +    end
    23977 +    call stream sPathFile, 'c', 'close';
    23978 +    aPath.0 = i - 1;
    23979 +return 0;
    23980 +
    23981 +
    23982 +/**
    23983 + * Writes the path file from what's in the 'aPath.' stem.
    23984 + */
    23985 +PathWrite: procedure expose aCfg. aPath.
    23986 +    sPathFile = PathGetFile();
    23987 +    call SysFileDelete(sPathFile);
    23988 +    do i = 1 to aPath.0
    23989 +        /* skip if already written */
    23990 +        j = 1;
    23991 +        do while (aPath.j.sPId <> aPath.i.sPId)
    23992 +            j = j + 1;
    23993 +        end
    23994 +        if (j >= i) then
    23995 +            call lineout sPathFile, aPath.i.sPId'='aPath.i.sPath;
    23996 +    end
    23997 +    call stream sPathFile, 'c', 'close';
    23998 +return 0;
    23999 +
    24000 +
    24001 +/**
    24002 + * Remove a path from the 'aPath.' stem.
    24003 + * @returns 0
    24004 + * @param   sPathId     The id of the path to remove.
    24005 + */
    24006 +PathRemove: procedure expose aCfg. aPath.
    24007 +    parse arg sPathId
    24008 +
    24009 +    /*
    24010 +     * Find.
    24011 +     */
    24012 +    i = 1;
    24013 +    do while (i <= aPath.0)
    24014 +        if (aPath.i.sPId = sPathId) then
    24015 +            leave;
    24016 +        i = i + 1;
    24017 +    end
    24018 +
    24019 +    /*
    24020 +     * Move.
    24021 +     */
    24022 +    if (i <= aPath.0) then
    24023 +    do
    24024 +        j = i + 1;
    24025 +        do while (j <= aPath.0)
    24026 +            aPath.i.sPId = aPath.j.sPId;
    24027 +            aPath.i.sPath = aPath.j.sPath;
    24028 +            j = j + 1;
    24029 +            i = i + 1;
    24030 +        end
    24031 +        aPath.0 = aPath.0 - 1;
    24032 +    end
    24033 +return 0;
    24034 +
    24035 +
    24036 +/**
    24037 + * Sets a given path.
    24038 + * @param   sPathId     Path id.
    24039 + * @param   sNewPath    Path.
    24040 + */
    24041 +PathSet: procedure expose aCfg. aPath.
    24042 +parse arg sPathId, sNewPath
    24043 +
    24044 +    /*
    24045 +     * Search for the path.
    24046 +     */
    24047 +    do i = 1 to aPath.0
    24048 +        if (aPath.i.sPId = sPathId) then
    24049 +        do
    24050 +            aPath.i.sPath = sNewPath;
    24051 +            return 0;
    24052 +        end
    24053 +    end
    24054 +
    24055 +    /*
    24056 +     * Not found, so add it.
    24057 +     */
    24058 +    i = aPath.0 + 1;
    24059 +    aPath.i.sPId = sPathId;
    24060 +    aPath.i.sPath = sNewPath;
    24061 +    aPath.0 = i;
    24062 +return 0;
    24063 +
    24064 +
    24065 +
    24066 +/**
    24067 + * Fills 'aPath.' with default settings overwriting anything in the table.
    24068 + */
    24069 +PathSetDefault: procedure expose aCfg. aPath.
    24070 +    i = 1;
    24071 +
    24072 +    /*
    24073 +     * Bird: home boxes.
    24074 +     */
    24075 +    if ((translate(EnvGet('HOSTNAME')) = 'UNIVAC') | (translate(EnvGet('HOSTNAME')) = 'ENIAC')) then
    24076 +    do
    24077 +        say 'Info: No or empty path file, using birds defaults.';
    24078 +        aPath.i.sPId = 'cvs';                       aPath.i.sPath = 'f:\cvs\v1.11.2_os2';           i = i + 1;
    24079 +        aPath.i.sPId = 'db2v52';                    aPath.i.sPath = 'f:\sqllib52';                  i = i + 1;
    24080 +        aPath.i.sPId = 'ddk';                       aPath.i.sPath = 'f:\DDK_os2\200204';            i = i + 1;
    24081 +        aPath.i.sPId = 'ddkbase';                   aPath.i.sPath = 'f:\DDK_os2\200204\base';       i = i + 1;
    24082 +        aPath.i.sPId = 'ddkvideo';                  aPath.i.sPath = 'f:\DDK_os2\200204\video';      i = i + 1;
    24083 +        aPath.i.sPId = 'doxygen';                   aPath.i.sPath = 'f:\doxygen\v1.2.11-OS2';       i = i + 1;
    24084 +        aPath.i.sPId = 'emx';                       aPath.i.sPath = 'f:\emx';                       i = i + 1;
    24085 +        aPath.i.sPId = 'emxpgcc';                   aPath.i.sPath = 'f:\GCC\v2.95.3_os2';           i = i + 1;
    24086 +        aPath.i.sPId = 'freetypeemx';               aPath.i.sPath = 'f:\Freetype\v1.3.1-emx\emx';   i = i + 1;
    24087 +        aPath.i.sPId = 'gcc302';                    aPath.i.sPath = 'f:\GCC\v3.0.2beta_os2\emx';    i = i + 1;
    24088 +        aPath.i.sPId = 'gcc303';                    aPath.i.sPath = 'f:\GCC\v3.0.3beta_os2\emx';    i = i + 1;
    24089 +        aPath.i.sPId = 'gcc321';                    aPath.i.sPath = 'f:\GCC\v3.2.1beta_os2\emx';    i = i + 1;
    24090 +        aPath.i.sPId = 'gcc322';                    aPath.i.sPath = 'f:\GCC\v3.2.2beta2_os2\usr';   i = i + 1;
    24091 +        aPath.i.sPId = 'home';                      aPath.i.sPath = 'e:\user\kso';                  i = i + 1;
    24092 +        aPath.i.sPId = 'icatgam';                   aPath.i.sPath = 'f:\Icat\v4.0.6rc1_os2';        i = i + 1;
    24093 +        aPath.i.sPId = 'icatgam406rc1';             aPath.i.sPath = 'f:\Icat\v4.0.6rc1_os2';        i = i + 1;
    24094 +        aPath.i.sPId = 'icatpe';                    aPath.i.sPath = 'f:\Icat\v4.0.5pe';             i = i + 1;
    24095 +        aPath.i.sPId = 'ida38';                     aPath.i.sPath = 'f:\ida\v3.8';                  i = i + 1;
    24096 +        aPath.i.sPId = 'ida40';                     aPath.i.sPath = 'f:\ida\v4.0.1';                i = i + 1;
    24097 +        aPath.i.sPId = 'ida414';                    aPath.i.sPath = 'f:\ida\v4.1.4';                i = i + 1;
    24098 +        aPath.i.sPId = 'idasdk';                    aPath.i.sPath = 'f:\idasdk';                    i = i + 1;
    24099 +        aPath.i.sPId = 'java131';                   aPath.i.sPath = 'e:\java131';                   i = i + 1;
    24100 +        aPath.i.sPId = 'jpeg';                      aPath.i.sPath = 'f:\jpeg\v6b';                  i = i + 1;
    24101 +        aPath.i.sPId = 'mscv6-16';                  aPath.i.sPath = 'f:\msc\v6.0a_ibm';             i = i + 1;
    24102 +        aPath.i.sPId = 'mscv7-16';                  aPath.i.sPath = 'f:\msc\v7.0';                  i = i + 1;
    24103 +        aPath.i.sPId = 'mysql';                     aPath.i.sPath = 'f:\mysql2';                    i = i + 1;
    24104 +        aPath.i.sPId = 'nasm9833';                  aPath.i.sPath = 'f:\nasm\v0.98.33_os2';         i = i + 1;
    24105 +        aPath.i.sPId = 'netqos2';                   aPath.i.sPath = 'f:\netqos2';                   i = i + 1;
    24106 +        aPath.i.sPId = 'perl50xxx';                 aPath.i.sPath = 'f:\perl\v5.005_53_os2';        i = i + 1;
    24107 +        aPath.i.sPId = 'perl580';                   aPath.i.sPath = 'f:\perl\v5.8.0_os2';           i = i + 1;
    24108 +        aPath.i.sPId = 'python';                    aPath.i.sPath = 'f:\python\v1.5.2_os2';         i = i + 1;
    24109 +        aPath.i.sPId = 'svn';                       aPath.i.sPath = 'f:\subversion\v1.0.6_os2';     i = i + 1;
    24110 +        aPath.i.sPId = 'toolkit40';                 aPath.i.sPath = 'f:\toolkit\v4.0csd4';          i = i + 1;
    24111 +        aPath.i.sPId = 'toolkit45';                 aPath.i.sPath = 'f:\toolkit\v4.5';              i = i + 1;
    24112 +        aPath.i.sPId = 'toolkit451';                aPath.i.sPath = 'f:\toolkit\v4.51';             i = i + 1;
    24113 +        aPath.i.sPId = 'toolkit452';                aPath.i.sPath = 'f:\toolkit\v4.52';             i = i + 1;
    24114 +        aPath.i.sPId = 'unixroot';                  aPath.i.sPath = 'e:\unix';                      i = i + 1;
    24115 +        aPath.i.sPId = 'vac308';                    aPath.i.sPath = 'f:\VACpp\v3.08_os2';           i = i + 1;
    24116 +        aPath.i.sPId = 'vac365';                    aPath.i.sPath = 'f:\VACpp\v3.65_os2';           i = i + 1;
    24117 +        aPath.i.sPId = 'vac40';                     aPath.i.sPath = 'f:\VACpp\v4.0_os2';            i = i + 1;
    24118 +        aPath.i.sPId = 'warpin';                    aPath.i.sPath = 'f:\WarpIn\current';            i = i + 1;
    24119 +        aPath.i.sPId = 'watcom11';                  aPath.i.sPath = 'f:\watcom\v11.0';              i = i + 1;
    24120 +        aPath.i.sPId = 'watcom11c';                 aPath.i.sPath = 'f:\watcom\v11.0c';             i = i + 1;
    24121 +        aPath.i.sPId = 'xfree86';                   aPath.i.sPath = 'e:\xfree86';                   i = i + 1;
    24122 +        aPath.i.sPId = 'testcase_drive_unused';     aPath.i.sPath = 'l'; /* reqired */              i = i + 1;
    24123 +        aPath.i.sPId = 'testcase_drive_fixed';      aPath.i.sPath = 'c'; /* reqired */              i = i + 1;
    24124 +        aPath.i.sPId = 'testcase_drive_floppy';     aPath.i.sPath = 'a'; /* reqired */              i = i + 1;
    24125 +        aPath.i.sPId = 'testcase_drive_cdrom';      aPath.i.sPath = 'i'; /* optional */             i = i + 1;
    24126 +        aPath.i.sPId = 'testcase_drive_network';    aPath.i.sPath = 'y'; /* optional */             i = i + 1;
    24127 +        aPath.i.sPId = 'testcase_drive_ramdisk';    aPath.i.sPath = 'r'; /* optional */             i = i + 1;
    24128 +        /*aPath.i.sPId = '';          aPath.i.sPath =      i = i + 1;*/
    24129 +    end
    24130 +
    24131 +
    24132 +    /*
    24133 +     * Bird: laptop box.
    24134 +     */
    24135 +    if (translate(EnvGet('HOSTNAME')) = 'DELIRIUM') then
    24136 +    do
    24137 +        say 'Info: No or empty path file, using birds work defaults.';
    24138 +        aPath.i.sPId = 'cvs';                       aPath.i.sPath = 'e:\dev\cvs\v11.1';             i = i + 1;
    24139 +        aPath.i.sPId = 'emx';                       aPath.i.sPath = 'e:\emx';                       i = i + 1;
    24140 +        aPath.i.sPId = 'emxpgcc';                   aPath.i.sPath = 'e:\dev\emxpgcc\v2.95.2';       i = i + 1;
    24141 +        aPath.i.sPId = 'gcc303';                    aPath.i.sPath = 'e:\dev\gcc\v3.0.3\emx';        i = i + 1;
    24142 +        aPath.i.sPId = 'gcc321';                    aPath.i.sPath = 'e:\dev\gcc\v3.2.1\emx';        i = i + 1;
    24143 +      /*aPath.i.sPId = 'db2v52';                    aPath.i.sPath = 'e:\sqllib52';                  i = i + 1;
    24144 +        aPath.i.sPId = 'icatgam';                   aPath.i.sPath = 'e:\icatos2';                   i = i + 1;
    24145 +        aPath.i.sPId = 'icatgam406rc1';             aPath.i.sPath = 'e:\icatos2.4.0.6.rc1';         i = i + 1;
    24146 +        aPath.i.sPId = 'icatpe';                    aPath.i.sPath = 'e:\icatpe';                    i = i + 1;
    24147 +        aPath.i.sPId = 'ida38';                     aPath.i.sPath = 'e:\ida38';                     i = i + 1;
    24148 +        aPath.i.sPId = 'ida40';                     aPath.i.sPath = 'e:\ida401';                    i = i + 1; */
    24149 +        aPath.i.sPId = 'ida414';                    aPath.i.sPath = 'e:\dev\ida\v414';                    i = i + 1;
    24150 +      /*aPath.i.sPId = 'idasdk';                    aPath.i.sPath = 'e:\idasdk';                    i = i + 1; */
    24151 +        aPath.i.sPId = 'ddk';                       aPath.i.sPath = 'e:\dev\ddk\june02';                       i = i + 1;
    24152 +        aPath.i.sPId = 'ddkbase';                   aPath.i.sPath = 'e:\dev\ddk\june02\base';                  i = i + 1;
    24153 +        aPath.i.sPId = 'ddkvideo';                  aPath.i.sPath = 'e:\dev\ddk\june02\video';                 i = i + 1;
    24154 +        aPath.i.sPId = 'home';                      aPath.i.sPath = 'e:\home';                      i = i + 1;
    24155 +        aPath.i.sPId = 'mscv6-16';                  aPath.i.sPath = 'e:\dev\ddktools\toolkits\msc60';   i = i + 1;
    24156 +      /*aPath.i.sPId = 'mscv7-16';                  aPath.i.sPath = 'e:\msc\v7.0';                  i = i + 1;
    24157 +        aPath.i.sPId = 'mysql';                     aPath.i.sPath = 'e:\mysql2';                    i = i + 1;
    24158 +        aPath.i.sPId = 'netqos2';                   aPath.i.sPath = 'e:\netqos2';                   i = i + 1;
    24159 +        aPath.i.sPId = 'perl50xxx';                 aPath.i.sPath = 'e:\perllib';                   i = i + 1;
    24160 +        aPath.i.sPId = 'perl580';                   aPath.i.sPath = 'e:\dev\perl\v5.8.0';           i = i + 1;
    24161 +        aPath.i.sPId = 'python';                    aPath.i.sPath = 'e:\python';                    i = i + 1;
    24162 +        aPath.i.sPId = 'toolkit40';                 aPath.i.sPath = 'e:\toolkit';                   i = i + 1;
    24163 +        aPath.i.sPId = 'toolkit45';                 aPath.i.sPath = 'e:\toolkit45';                 i = i + 1;
    24164 +        aPath.i.sPId = 'toolkit451';                aPath.i.sPath = 'e:\toolkit451';                i = i + 1; */
    24165 +        aPath.i.sPId = 'toolkit452';                aPath.i.sPath = 'e:\dev\toolkit\v452';                i = i + 1;
    24166 +        aPath.i.sPId = 'unixroot';                  aPath.i.sPath = 'e:\unix';                      i = i + 1;
    24167 +        aPath.i.sPId = 'xfree86';                   aPath.i.sPath = 'e:\xfree86';                   i = i + 1;
    24168 +        aPath.i.sPId = 'vac308';                    aPath.i.sPath = 'e:\dev\vacpp\v308';                 i = i + 1;
    24169 +        aPath.i.sPId = 'vac365';                    aPath.i.sPath = 'e:\dev\vacpp\v365';                   i = i + 1;
    24170 +      /*aPath.i.sPId = 'vac40';                     aPath.i.sPath = 'e:\ibmcpp40';                  i = i + 1;*/
    24171 +        aPath.i.sPId = 'warpin';                    aPath.i.sPath = 'e:\warpin';                    i = i + 1;
    24172 +      /*aPath.i.sPId = 'watcom11';                  aPath.i.sPath = 'e:\watcom';                    i = i + 1;*/
    24173 +/*        aPath.i.sPId = 'watcom11c';                 aPath.i.sPath = 'e:\dev\watcom\v11c';                 i = i + 1; */
    24174 +        aPath.i.sPId = 'testcase_drive_unused';     aPath.i.sPath = 't'; /* reqired */              i = i + 1;
    24175 +        aPath.i.sPId = 'testcase_drive_fixed';      aPath.i.sPath = 'd'; /* reqired */              i = i + 1;
    24176 +        aPath.i.sPId = 'testcase_drive_floppy';     aPath.i.sPath = 'a'; /* reqired */              i = i + 1;
    24177 +        aPath.i.sPId = 'testcase_drive_cdrom';      aPath.i.sPath = 'f'; /* optional */             i = i + 1;
    24178 +        aPath.i.sPId = 'testcase_drive_network';    aPath.i.sPath = 'x'; /* optional */             i = i + 1;
    24179 +        /*aPath.i.sPId = 'testcase_drive_ramdisk';    aPath.i.sPath = '';  /* optional */             i = i + 1;*/
    24180 +        /*aPath.i.sPId = '';          aPath.i.sPath =      i = i + 1;*/
    24181 +    end
    24182 +
    24183 +
    24184 +    /*
    24185 +     * Bird: work boxes.
    24186 +     */
    24187 +    if ((translate(EnvGet('HOSTNAME')) = 'DREAM')  | (translate(EnvGet('HOSTNAME')) = 'DESPAIR')) then
    24188 +    do
    24189 +        say 'Info: No or empty path file, using birds work defaults.';
    24190 +        aPath.i.sPId = 'cvs';                       aPath.i.sPath = 'd:\dev\cvs\v11.1';             i = i + 1;
    24191 +        aPath.i.sPId = 'emx';                       aPath.i.sPath = 'd:\emx';                       i = i + 1;
    24192 +        aPath.i.sPId = 'emxpgcc';                   aPath.i.sPath = 'd:\dev\emxpgcc\v2.95.2';       i = i + 1;
    24193 +        aPath.i.sPId = 'gcc303';                    aPath.i.sPath = 'd:\dev\gcc\v3.0.3\emx';        i = i + 1;
    24194 +        aPath.i.sPId = 'gcc321';                    aPath.i.sPath = 'd:\dev\gcc\v3.2.1\emx';        i = i + 1;
    24195 +      /*aPath.i.sPId = 'db2v52';                    aPath.i.sPath = 'e:\sqllib52';                  i = i + 1;
    24196 +        aPath.i.sPId = 'icatgam';                   aPath.i.sPath = 'e:\icatos2';                   i = i + 1;
    24197 +        aPath.i.sPId = 'icatgam406rc1';             aPath.i.sPath = 'e:\icatos2.4.0.6.rc1';         i = i + 1;
    24198 +        aPath.i.sPId = 'icatpe';                    aPath.i.sPath = 'e:\icatpe';                    i = i + 1;
    24199 +        aPath.i.sPId = 'ida38';                     aPath.i.sPath = 'e:\ida38';                     i = i + 1;
    24200 +        aPath.i.sPId = 'ida40';                     aPath.i.sPath = 'e:\ida401';                    i = i + 1; */
    24201 +        aPath.i.sPId = 'ida414';                    aPath.i.sPath = 'd:\dev\ida\v414';              i = i + 1;
    24202 +      /*aPath.i.sPId = 'idasdk';                    aPath.i.sPath = 'e:\idasdk';                    i = i + 1; */
    24203 +        aPath.i.sPId = 'java131';                   aPath.i.sPath = 'd:\java131';                   i = i + 1;
    24204 +        aPath.i.sPId = 'ddk';                       aPath.i.sPath = 'd:\dev\ddk\june02';            i = i + 1;
    24205 +        aPath.i.sPId = 'ddkbase';                   aPath.i.sPath = 'd:\dev\ddk\june02\base';       i = i + 1;
    24206 +        aPath.i.sPId = 'ddkvideo';                  aPath.i.sPath = 'd:\dev\ddk\june02\video';      i = i + 1;
    24207 +        aPath.i.sPId = 'home';                      aPath.i.sPath = 'd:\home\bird';                 i = i + 1;
    24208 +        aPath.i.sPId = 'mscv6-16';                  aPath.i.sPath = 'd:\dev\ddktools\toolkits\msc60'; i = i + 1;
    24209 +        aPath.i.sPId = 'mscv7-16';                  aPath.i.sPath = 'd:\dev\msc\v7.0';              i = i + 1;
    24210 +        aPath.i.sPId = 'mysql';                     aPath.i.sPath = 'd:\apps\mysql\v3.23.50b1';     i = i + 1;
    24211 +      /*aPath.i.sPId = 'netqos2';                   aPath.i.sPath = 'e:\netqos2';                   i = i + 1;*/
    24212 +        aPath.i.sPId = 'perl50xxx';                 aPath.i.sPath = 'd:\dev\perl\v5.00455';         i = i + 1;
    24213 +        aPath.i.sPId = 'perl580';                   aPath.i.sPath = 'd:\dev\perl\v5.8.0';           i = i + 1;
    24214 +      /*aPath.i.sPId = 'python';                    aPath.i.sPath = 'e:\python';                    i = i + 1;*/
    24215 +        aPath.i.sPId = 'svn';                       aPath.i.sPath = 'd:\dev\subversion\v1.0.6';     i = i + 1;
    24216 +        aPath.i.sPId = 'toolkit40';                 aPath.i.sPath = 'd:\dev\toolkit\v40csd1';       i = i + 1;
    24217 +      /*aPath.i.sPId = 'toolkit45';                 aPath.i.sPath = 'e:\toolkit45';                 i = i + 1;
    24218 +        aPath.i.sPId = 'toolkit451';                aPath.i.sPath = 'e:\toolkit451';                i = i + 1; */
    24219 +        aPath.i.sPId = 'toolkit452';                aPath.i.sPath = 'd:\dev\toolkit\v452';          i = i + 1;
    24220 +        aPath.i.sPId = 'unixroot';                  aPath.i.sPath = 'd:\unix';                      i = i + 1;
    24221 +        aPath.i.sPId = 'xfree86';                   aPath.i.sPath = 'd:\xfree86';                   i = i + 1;
    24222 +        aPath.i.sPId = 'vac308';                    aPath.i.sPath = 'd:\dev\VACpp\v308';            i = i + 1;
    24223 +        aPath.i.sPId = 'vac365';                    aPath.i.sPath = 'd:\dev\VACpp\v365';            i = i + 1;
    24224 +        aPath.i.sPId = 'vac40';                     aPath.i.sPath = 'd:\dev\VACpp\v40ga';           i = i + 1;
    24225 +        aPath.i.sPId = 'warpin';                    aPath.i.sPath = 'c:\warpin';                    i = i + 1;
    24226 +        aPath.i.sPId = 'watcom11';                  aPath.i.sPath = 'd:\dev\watcom\v110';           i = i + 1;
    24227 +        aPath.i.sPId = 'watcom11c';                 aPath.i.sPath = 'd:\dev\watcom\v110c';          i = i + 1;
    24228 +        aPath.i.sPId = 'testcase_drive_unused';     aPath.i.sPath = 't'; /* reqired */              i = i + 1;
    24229 +        aPath.i.sPId = 'testcase_drive_fixed';      aPath.i.sPath = 'f'; /* reqired */              i = i + 1;
    24230 +        aPath.i.sPId = 'testcase_drive_floppy';     aPath.i.sPath = 'a'; /* reqired */              i = i + 1;
    24231 +        aPath.i.sPId = 'testcase_drive_cdrom';      aPath.i.sPath = 'g'; /* optional */             i = i + 1;
    24232 +        aPath.i.sPId = 'testcase_drive_network';    aPath.i.sPath = 'x'; /* optional */             i = i + 1;
    24233 +        aPath.i.sPId = 'testcase_drive_ramdisk';    aPath.i.sPath = 'r'; /* optional */             i = i + 1;
    24234 +        /*aPath.i.sPId = '';          aPath.i.sPath =      i = i + 1;*/
    24235 +    end
    24236 +
    24237 +    /* add your own stuff here.. */
    24238 +    aPath.0 = i - 1;
    24239 +return 0;
    24240 +
    24241 +
    24242 +/**
    24243 + * Configure a path.
    24244 + * @returns Path on success.
    24245 + *          '' on failure.
    24246 + * @param   sOperation  The operation - 'config' or 'forcedconfig'
    24247 + * @param   sPathId     The path to configure.
    24248 + * @param   sToolId     The tool Id.
    24249 + */
    24250 +PathConfig: procedure expose aCfg. aPath.
    24251 +    parse arg sOperation, sPathId, sToolId
    24252 +
    24253 +    /*
    24254 +     * If not forced we'll ask first.
    24255 +     */
    24256 +    if (sOperation <> 'forcedconfig') then
    24257 +    do
    24258 +        say 'Do you want to configure the path '''sPathId''/* for the '''sToolId'''('CfgDesc(sToolId)') tool?*/ '(y/N)';
    24259 +        sAnswer = PullUser(1);
    24260 +        if (substr(strip(sAnswer),1,1) <> 'Y') then
    24261 +            return '';
    24262 +    end
    24263 +
    24264 +    /*
    24265 +     * Config loop.
    24266 +     */
    24267 +    do i = 1 to 128
    24268 +
    24269 +        say 'Give us the path for '''sPathId'''('''sToolId'''/'CfgDesc(sToolId)'):'
    24270 +        sThePath = translate(strip(strip(strip(PullUser()), 'T','\'),'T','/'), '\', '/');
    24271 +        /*say 'Debug: sThePath='sThePath;*/
    24272 +        if ((sThePath <> '') & (sThePath = translate(sThePath,'','#!$@%|<>;õ&Ï='))) then
    24273 +        do
    24274 +            /*
    24275 +             * Add it to internal struct.
    24276 +             */
    24277 +            call PathRemove(sPathId);
    24278 +            j = aPath.0 + 1;
    24279 +            aPath.j.sPId = strip(sPathId);
    24280 +            aPath.j.sPath = translate(strip(strip(strip(sThePath), 'T','\'),'T','/'), '\', '/');
    24281 +            aPath.0 = j;
    24282 +            return sThePath;
    24283 +        end
    24284 +        else
    24285 +            say 'error: invalid path name.';
    24286 +        say 'Debug 9'
    24287 +
    24288 +        /* ask if retry */
    24289 +        if (i >= 2) then
    24290 +            say 'You''re not trying hard, are you?';
    24291 +        say 'Wanna try giving us an *valid* path for the path '''sPathId''' for the '''sToolId'''('CfgDesc(sToolId)') tool? (y/N)';
    24292 +        sAnswer = PullUser(1);
    24293 +        if (substr(strip(sAnswer),1,1) <> 'Y') then
    24294 +            leave;
    24295 +    end
    24296 +
    24297 +    say 'Giving up!';
    24298 +return '';
    24299 +
    24300 +
    24301 +/**
    24302 + * Get user response and empties the input queue.
    24303 + * @returns     User input.
    24304 + * @param       fUpper  If present and set uppercase the user response.
    24305 + */
    24306 +PullUser: procedure
    24307 +    parse arg fUpper
    24308 +    if (fUpper = '') then
    24309 +        fUpper = 0;
    24310 +
    24311 +    signal on halt name PullUser_Handler
    24312 +    signal on syntax name PullUser_Handler
    24313 +    signal on notready name PullUser_Handler
    24314 +    parse pull sAnswer;
    24315 +    signal off syntax
    24316 +    signal off halt
    24317 +    signal off notready
    24318 +    /*say 'Debug: sAnswer='c2x(sAnswer);
    24319 +    sAnswer = strip(strip(sAnswer, 'T', '0A'x), 'T', '0D'x);*/
    24320 +
    24321 +    if (fUpper) then
    24322 +        sAnswer = translate(sAnswer);
    24323 +    /* flush input */
    24324 +    do while (Queued())
    24325 +        pull dummy;
    24326 +    end
    24327 +return sAnswer;
    24328 +
    24329 +
    24330 +/**
    24331 + * No value handler
    24332 + */
    24333 +PullUser_Handler:
    24334 +    say 'fatal error: Believe Ctrl-Break/C might have been pressed.';
    24335 +    signal off syntax
    24336 +    signal off halt
    24337 +    signal off syntax
    24338 +    signal off notready
    24339 +    do while (Queued())
    24340 +        pull dummy;
    24341 +    end
    24342 +exit(16);
    24343 +
    24344 +
    24345 +/**
    24346 + * Checks if a file exists.
    24347 + * @param   sFile       Name of the file to look for.
    24348 + * @param   sComplain   Complaint text. Complain if non empty and not found.
    24349 + * @returns TRUE if file exists.
    24350 + *          FALSE if file doesn't exists.
    24351 + */
    24352 +FileExists: procedure
    24353 +    parse arg sFile, sComplain
    24354 +    rc = stream(sFile, 'c', 'query exist');
    24355 +    if ((rc = '') & (sComplain <> '')) then
    24356 +        say sComplain ''''sFile'''.';
    24357 +return rc <> '';
    24358 +
    24359 +
    24360 +/**
    24361 + * Checks if a directory exists.
    24362 + * @param   sDir        Name of the directory to look for.
    24363 + * @param   sComplain   Complaint text. Complain if non empty and not found.
    24364 + * @returns TRUE if file exists.
    24365 + *          FALSE if file doesn't exists.
    24366 + */
    24367 +DirExists: procedure
    24368 +    parse arg sDir, sComplain
    24369 +    rc = SysFileTree(sDir, 'sDirs', 'DO');
    24370 +    if (rc = 0 & sDirs.0 = 1) then
    24371 +        return 1;
    24372 +    if (sComplain <> '') then do
    24373 +        say sComplain ''''sDir'''.';
    24374 +return 0;
    24375 +
    24376 +
    24377 +/**
    24378 + * Add sToAdd in front of sEnvVar.
    24379 + * Note: sToAdd now is allowed to be alist!
    24380 + *
    24381 + * Known features: Don't remove sToAdd from original value if sToAdd
    24382 + *                 is at the end and don't end with a ';'.
    24383 + */
    24384 +EnvAddFront: procedure
    24385 +    parse arg fRM, sEnvVar, sToAdd, sSeparator
    24386 +
    24387 +    /* sets default separator if not specified. */
    24388 +    if (sSeparator = '') then sSeparator = ';';
    24389 +
    24390 +    /* checks that sToAdd ends with an ';'. Adds one if not. */
    24391 +    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    24392 +        sToAdd = sToAdd || sSeparator;
    24393 +
    24394 +    /* check and evt. remove ';' at start of sToAdd */
    24395 +    if (substr(sToAdd, 1, 1) = ';') then
    24396 +        sToAdd = substr(sToAdd, 2);
    24397 +
    24398 +    /* loop thru sToAdd */
    24399 +    rc = 0;
    24400 +    i = length(sToAdd);
    24401 +    do while i > 1 & rc = 0
    24402 +        j = lastpos(sSeparator, sToAdd, i-1);
    24403 +        rc = EnvAddFront2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
    24404 +        i = j;
    24405 +    end
    24406 +
    24407 +return rc;
    24408 +
    24409 +/**
    24410 + * Add sToAdd in front of sEnvVar.
    24411 + *
    24412 + * Known features: Don't remove sToAdd from original value if sToAdd
    24413 + *                 is at the end and don't end with a ';'.
    24414 + */
    24415 +EnvAddFront2: procedure
    24416 +    parse arg fRM, sEnvVar, sToAdd, sSeparator
    24417 +
    24418 +    /* sets default separator if not specified. */
    24419 +    if (sSeparator = '') then sSeparator = ';';
    24420 +
    24421 +    /* checks that sToAdd ends with a separator. Adds one if not. */
    24422 +    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    24423 +        sToAdd = sToAdd || sSeparator;
    24424 +
    24425 +    /* check and evt. remove the separator at start of sToAdd */
    24426 +    if (substr(sToAdd, 1, 1) = sSeparator) then
    24427 +        sToAdd = substr(sToAdd, 2);
    24428 +
    24429 +    /* Get original variable value */
    24430 +    sOrgEnvVar = EnvGet(sEnvVar);
    24431 +
    24432 +    /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
    24433 +    i = pos(translate(sToAdd), translate(sOrgEnvVar));
    24434 +    if (i > 0) then
    24435 +        sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
    24436 +
    24437 +    /* set environment */
    24438 +    if (fRM) then
    24439 +        return EnvSet(0, sEnvVar, sOrgEnvVar);
    24440 +return EnvSet(0, sEnvVar, sToAdd||sOrgEnvVar);
    24441 +
    24442 +
    24443 +/**
    24444 + * Add sToAdd as the end of sEnvVar.
    24445 + * Note: sToAdd now is allowed to be alist!
    24446 + *
    24447 + * Known features: Don't remove sToAdd from original value if sToAdd
    24448 + *                 is at the end and don't end with a ';'.
    24449 + */
    24450 +EnvAddEnd: procedure
    24451 +    parse arg fRM, sEnvVar, sToAdd, sSeparator
    24452 +
    24453 +    /* sets default separator if not specified. */
    24454 +    if (sSeparator = '') then sSeparator = ';';
    24455 +
    24456 +    /* checks that sToAdd ends with a separator. Adds one if not. */
    24457 +    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    24458 +        sToAdd = sToAdd || sSeparator;
    24459 +
    24460 +    /* check and evt. remove ';' at start of sToAdd */
    24461 +    if (substr(sToAdd, 1, 1) = sSeparator) then
    24462 +        sToAdd = substr(sToAdd, 2);
    24463 +
    24464 +    /* loop thru sToAdd */
    24465 +    rc = 0;
    24466 +    i = length(sToAdd);
    24467 +    do while i > 1 & rc = 0
    24468 +        j = lastpos(sSeparator, sToAdd, i-1);
    24469 +        rc = EnvAddEnd2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
    24470 +        i = j;
    24471 +    end
    24472 +
    24473 +return rc;
    24474 +
    24475 +/**
    24476 + * Add sToAdd as the end of sEnvVar.
    24477 + *
    24478 + * Known features: Don't remove sToAdd from original value if sToAdd
    24479 + *                 is at the end and don't end with a ';'.
    24480 + */
    24481 +EnvAddEnd2: procedure
    24482 +    parse arg fRM, sEnvVar, sToAdd, sSeparator
    24483 +
    24484 +    /* sets default separator if not specified. */
    24485 +    if (sSeparator = '') then sSeparator = ';';
    24486 +
    24487 +    /* checks that sToAdd ends with a separator. Adds one if not. */
    24488 +    if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
    24489 +        sToAdd = sToAdd || sSeparator;
    24490 +
    24491 +    /* check and evt. remove separator at start of sToAdd */
    24492 +    if (substr(sToAdd, 1, 1) = sSeparator) then
    24493 +        sToAdd = substr(sToAdd, 2);
    24494 +
    24495 +    /* Get original variable value */
    24496 +    sOrgEnvVar = EnvGet(sEnvVar);
    24497 +
    24498 +    if (sOrgEnvVar <> '') then
    24499 +    do
    24500 +        /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
    24501 +        i = pos(translate(sToAdd), translate(sOrgEnvVar));
    24502 +        if (i > 0) then
    24503 +            sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
    24504 +
    24505 +        /* checks that sOrgEnvVar ends with a separator. Adds one if not. */
    24506 +        if (sOrgEnvVar = '') then
    24507 +            if (right(sOrgEnvVar,1) <> sSeparator) then
    24508 +                sOrgEnvVar = sOrgEnvVar || sSeparator;
    24509 +    end
    24510 +
    24511 +    /* set environment */
    24512 +    if (fRM) then return EnvSet(0, sEnvVar, sOrgEnvVar);
    24513 +return EnvSet(0, sEnvVar, sOrgEnvVar||sToAdd);
    24514 +
    24515 +
    24516 +/**
    24517 + * Sets sEnvVar to sValue.
    24518 + */
    24519 +EnvSet: procedure
    24520 +    parse arg fRM, sEnvVar, sValue
    24521 +
    24522 +    /* if we're to remove this, make valuestring empty! */
    24523 +    if (fRM) then
    24524 +        sValue = '';
    24525 +    sEnvVar = translate(sEnvVar);
    24526 +
    24527 +    /*
    24528 +     * Begin/EndLibpath fix:
    24529 +     *      We'll have to set internal these using both commandline 'SET'
    24530 +     *      and internal VALUE in order to export it and to be able to
    24531 +     *      get it (with EnvGet) again.
    24532 +     */
    24533 +    if ((sEnvVar = 'BEGINLIBPATH') | (sEnvVar = 'ENDLIBPATH')) then
    24534 +    do
    24535 +        if (length(sValue) >= 1024) then
    24536 +            say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
    24537 +        return SysSetExtLibPath(sValue, substr(sEnvVar, 1, 1));
    24538 +    end
    24539 +
    24540 +    if (length(sValue) >= 1024) then
    24541 +    do
    24542 +        say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
    24543 +        say '    This may make CMD.EXE unstable after a SET operation to print the environment.';
    24544 +    end
    24545 +    sRc = VALUE(sEnvVar, sValue, 'OS2ENVIRONMENT');
    24546 +return 0;
    24547 +
    24548 +/**
    24549 + * Gets the value of sEnvVar.
    24550 + */
    24551 +EnvGet: procedure
    24552 +    parse arg sEnvVar
    24553 +    if ((translate(sEnvVar) = 'BEGINLIBPATH') | (translate(sEnvVar) = 'ENDLIBPATH')) then
    24554 +        return SysQueryExtLibPath(substr(sEnvVar, 1, 1));
    24555 +return value(sEnvVar,, 'OS2ENVIRONMENT');
    24556 +
    24557 +
    24558 +/**
    24559 + *  Workaround for bug in CMD.EXE.
    24560 + *  It messes up when REXX have expanded the environment.
    24561 + */
    24562 +FixCMDEnv: procedure
    24563 +    /* check for 4OS2 first */
    24564 +    Address CMD 'set 4os2test_env=%@eval[2 + 2]';
    24565 +    if (value('4os2test_env',, 'OS2ENVIRONMENT') = '4') then
    24566 +        return 0;
    24567 +
    24568 +    /* force environment expansion by setting a lot of variables and freeing them. */
    24569 +    do i = 1 to 100
    24570 +        Address CMD '@set dummyenvvar'||i'=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    24571 +    end
    24572 +    do i = 1 to 100
    24573 +        Address CMD '@set dummyenvvar'||i'=';
    24574 +    end
    24575 +return 0;
    24576 +
    24577 +
    24578 +/**
    24579 + * Execute a command and match output and return code.
    24580 + *
    24581 + * @returns  0 on match.
    24582 + *          49 on return code mismatch.
    24583 + *          99 on output mistmatch.
    24584 + * @param   sCmd                    The command to execute.
    24585 + * @param   rcCmdExepcted           The expected return code from the command.
    24586 + * @param   sOutputPartExpected     A 'needle' of the output 'haystack'.
    24587 + */
    24588 +CheckCmdOutput: procedure
    24589 +    parse arg sCmd, rcCmdExpected, fQuiet, sOutputPartExpected
    24590 +
    24591 +    /*
    24592 +     * Try execute the command
    24593 +     */
    24594 +    queTmp = RxQueue('Create');
    24595 +    queOld = RxQueue('Set', queTmp);
    24596 +    Address CMD sCmd || ' 2>&1 | RxQueue' queTmp;
    24597 +    rcCmd = rc;
    24598 +
    24599 +    /* get output */
    24600 +    sOutput = '';
    24601 +    do while (queued() > 0)
    24602 +        parse pull sLine
    24603 +        sOutput = sOutput || sLine || '0d0a'x
    24604 +    end
    24605 +    call RxQueue 'Delete', RxQueue('Set', queOld);
    24606 +
    24607 +    /*
    24608 +     * If command
    24609 +     */
    24610 +    rc = 0;
    24611 +    if (/*rcCmd = rcCmdExpected*/ 1) then /* doesn't work with cmd.exe */
    24612 +    do
    24613 +        if (pos(sOutputPartExpected, sOutput) <= 0) then
    24614 +        do
    24615 +            say 'Debug - start'
    24616 +            say 'Debug:' sOutputPartExpected
    24617 +            say 'Debug: not found in:'
    24618 +            say sOutput
    24619 +            say 'Debug - end'
    24620 +            rc = 99
    24621 +        end
    24622 +    end
    24623 +    else
    24624 +        rc = 49
    24625 +
    24626 +    if (\fQuiet & rc <> 0) then
    24627 +        say 'Debug:' sCmd 'rc='rc' rcCmd='rcCmd 'rcCmdExpected='rcCmdExpected;
    24628 +return rc;
    24629 +
    24630 +
    24631 +/**
    24632 + * Checks syslevel info.
    24633 + * @returns 0 if match.
    24634 + *          <>0 if mismatch.
    24635 + * @param   sFile           Name of the syslevel file.
    24636 + * @param   fQuiet          Quiet / verbose flag.
    24637 + * @param   sMatchCid       Component id. (optional)
    24638 + * @param   sMatchVer       Version id. (optional)
    24639 + * @param   sMatchLevel     Current Level. (optional)
    24640 + * @param   sMatchTitle     Product title. (optional)
    24641 + * @param   sMatchKind      Product kind. (optional)
    24642 + * @param   sMatchType      Product type. (optional)
    24643 + */
    24644 +CheckSyslevel: procedure
    24645 +parse arg sFile, fQuiet, sMatchCId,sMatchVer,sMatchLevel,sMatchTitle,iMatchKind,sMatchType,dummy
    24646 +
    24647 +    iRc = -1;
    24648 +
    24649 +    /* Open the file */
    24650 +    rc = stream(sFile, 'c', 'open read');
    24651 +    if (pos('READY', rc) = 1) then
    24652 +    do
    24653 +        if (charin(sFile, 1, 11) = 'FF'x'FF'x'SYSLEVEL'||'00'x) then
    24654 +        do
    24655 +            /* read base offset (binary long) */
    24656 +            iBase = c2x(charin(sFile, 34, 4));
    24657 +            iBase = 1 + x2d(right(iBase,2)||substr(iBase,5,2)||substr(iBase,3,2)||left(iBase,2));
    24658 +
    24659 +            /* Read fields...
    24660 +             *
    24661 +             *  typedef struct _SYSLEVELDATA {      offset
    24662 +             *     unsigned char d_reserved1[2];     0
    24663 +             *     unsigned char d_kind;             2
    24664 +             *     unsigned char d_version[2];       3
    24665 +             *     unsigned char d_reserved2[2];     5
    24666 +             *     unsigned char d_clevel[7];        7
    24667 +             *     unsigned char d_reserved3;       14
    24668 +             *     unsigned char d_plevel[7];       15
    24669 +             *     unsigned char d_reserved4;       22
    24670 +             *     unsigned char d_title[80];       23
    24671 +             *     unsigned char d_cid[9];         103
    24672 +             *     unsigned char d_revision;       112
    24673 +             *     unsigned char d_type[1];        113
    24674 +             *  } SYSLEVELDATA;
    24675 +             */
    24676 +            iKind       =   c2d(charin(sFile, iBase+  2,  1));
    24677 +            iVer        =       charin(sFile, iBase+  3,  2);
    24678 +            sCurLevel   = strip(charin(sFile, iBase+  7,  7), 'T', '00'x);
    24679 +            sPreLevel   = strip(charin(sFile, iBase+ 15,  7), 'T', '00'x);
    24680 +            sTitle      = strip(charin(sFile, iBase+ 23, 80), 'T', '00'x);
    24681 +            sCId        =       charin(sFile, iBase+103,  9);
    24682 +            iRev        =       charin(sFile, iBase+112,  1);
    24683 +            sType       = strip(charin(sFile, iBase+113, 10), 'T', '00'x);
    24684 +
    24685 +            sVer = substr(c2x(substr(iVer, 1, 1)), 1, 1)||,
    24686 +                   '.'||,
    24687 +                   substr(c2x(substr(iVer, 1, 1)), 2, 1)||,
    24688 +                   d2c(c2d(substr(iVer, 2, 1)) + 48);
    24689 +            if (iRev <> 0) then
    24690 +                sVer = sVer ||'.'|| d2c(c2d(iRev) + 48);
    24691 +
    24692 +            /*
    24693 +             * Compare.
    24694 +             */
    24695 +            iRc = 0;
    24696 +            if (sMatchCId <> '' & sMatchCId <> sCid) then
    24697 +            do
    24698 +                if (\fQuiet) then
    24699 +                    say 'syslevel '''sFile''': cid '''sCId''' != '''sMatchCId'''.';
    24700 +                iRc = 2;
    24701 +            end
    24702 +            if (sMatchVer <> '' & sMatchVer <> sVer) then
    24703 +            do
    24704 +                if (\fQuiet) then
    24705 +                    say 'syslevel '''sFile''': ver '''sVer''' != '''sMatchVer'''.';
    24706 +                iRc = 3;
    24707 +            end
    24708 +            if (sMatchLevel <> '' & sMatchLevel <> sCurLevel) then
    24709 +            do
    24710 +                if (\fQuiet) then
    24711 +                    say 'syslevel '''sFile''': level '''sCurLevel''' != '''sMatchLevel'''.';
    24712 +                iRc = 4;
    24713 +            end
    24714 +            if (sMatchTitle <> '' & sMatchTitle <> sTitle) then
    24715 +            do
    24716 +                if (\fQuiet) then
    24717 +                    say 'syslevel '''sFile''': title '''sTitle''' != '''sMatchTitle'''.';
    24718 +                iRc = 5;
    24719 +            end
    24720 +            if (iMatchKind <> '' & iMatchKind <> iKind) then
    24721 +            do
    24722 +                if (\fQuiet) then
    24723 +                    say 'syslevel '''sFile''': kind '''iKind''' != '''iMatchKind'''.';
    24724 +                iRc = 6;
    24725 +            end
    24726 +            if (sMatchType <> '' & sMatchType <> sType) then
    24727 +            do
    24728 +                if (\fQuiet) then
    24729 +                    say 'syslevel '''sFile''': type '''sType''' != '''sMatchType'''.';
    24730 +                iRc = 7;
    24731 +            end
    24732 +            /*
    24733 +            say 'debug:'
    24734 +            say 'iKind       =' iKind
    24735 +            say 'sCurLevel   =' sCurLevel
    24736 +            say 'sPreLevel   =' sPreLevel
    24737 +            say 'sTitle      =' sTitle
    24738 +            say 'sCId        =' sCId
    24739 +            say 'sType       =' sType
    24740 +            say 'sVer        =' sVer
    24741 +            */
    24742 +        end
    24743 +        else
    24744 +            say 'bad signature';
    24745 +
    24746 +        /* finished, close file */
    24747 +        call stream sFile, 'c', 'close';
    24748 +    end
    24749 +    else say 'open failed, rc='rc;
    24750 +return iRc;
    24751 +
    24752 +
    24753 +
    24754 +/**
    24755 + * Tool procedures section
    24756 + * @returns 0 on success.
    24757 + *          1 if PathQuery() failed.
    24758 + *          2 if some vital file/dir wasn't found in the config verify.
    24759 + *          49 if verify command rc mismatched.
    24760 + *          99 if verify command output mismatched.
    24761 + **/
    24762 +
    24763 +
    24764 +/*
    24765 + * Concurrent Versions System (CVS)
    24766 + */
    24767 +CVS: procedure expose aCfg. aPath.
    24768 +    parse arg sToolId,sOperation,fRM,fQuiet
    24769 +
    24770 +
    24771 +    /*
    24772 +     * The directories.
    24773 +     */
    24774 +    sPathCVS = PathQuery('cvs', sToolId, sOperation);
    24775 +    if (sPathCVS = '') then
    24776 +        return 1;
    24777 +    sPathHome = PathQuery('home', sToolId, sOperation);
    24778 +    if (sPathHome = '') then
    24779 +        return 1;
    24780 +    /* If config operation we're done now. */
    24781 +    if (pos('config', sOperation) > 0) then
    24782 +        return 0;
    24783 +
    24784 +    /*
    24785 +     * Installing the environment variables.
    24786 +     */
    24787 +    call EnvSet      fRM, 'PATH_CVS',    sPathCVS;
    24788 +    call EnvAddFront fRM, 'path',        sPathCVS'\bin;'
    24789 +    call EnvAddFront fRM, 'bookshelf',   sPathCVS'\book;'
    24790 +    call EnvAddFront fRM, 'bookshelf',   sPathCVS'\book;'
    24791 +    call EnvSet      fRM, 'home',        translate(sPathHome, '/','\');
    24792 +
    24793 +    /*
    24794 +     * Verify.
    24795 +     */
    24796 +    if (pos('verify', sOperation) <= 0) then
    24797 +        return 0;
    24798 +
    24799 +    if (\CfgVerifyFile(sPathCVS'\bin\cvs.exe',fQuiet)) then
    24800 +            return 2;
    24801 +    if (length(sPathHome) <= 2) then
    24802 +    do
    24803 +        if (\fQuiet) then
    24804 +            say 'Error: The home directory is to short!';
    24805 +        return 2;
    24806 +    end
    24807 +    if (\CfgVerifyDir(sPathHome, fQuiet)) then
    24808 +        return 2;
    24809 +return CheckCmdOutput('cvs --version', 0, fQuiet, 'Concurrent Versions System (CVS) 1.1');
    24810 +
    24811 +
    24812 +/*
    24813 + * EMX
    24814 + */
    24815 +EMX: procedure expose aCfg. aPath.
    24816 +    parse arg sToolId,sOperation,fRM,fQuiet
    24817 +
    24818 +    /*
    24819 +     * EMX/GCC main directory.
    24820 +     */
    24821 +    sEMX = PathQuery('emx', sToolId, sOperation);
    24822 +    if (sEMX = '') then
    24823 +        return 1;
    24824 +    /* If config operation we're done now. */
    24825 +    if (pos('config', sOperation) > 0) then
    24826 +        return 0;
    24827 +
    24828 +    sEMXBack    = translate(sEMX, '\', '/');
    24829 +    sEMXForw    = translate(sEMX, '/', '\');
    24830 +    call EnvSet      fRM, 'PATH_EMX', sEMXBack;
    24831 +    call EnvSet      fRM, 'CCENV',      'EMX'
    24832 +    call EnvSet      fRM, 'BUILD_ENV',  'EMX'
    24833 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    24834 +
    24835 +    call EnvAddFront fRM, 'BEGINLIBPATH',       sEMXBack'\dll;'
    24836 +    call EnvAddFront fRM, 'PATH',               sEMXBack'\bin;'
    24837 +    call EnvAddFront fRM, 'DPATH',              sEMXBack'\book;'
    24838 +    call EnvAddFront fRM, 'BOOKSHELF',          sEMXBack'\book;'
    24839 +    call EnvAddFront fRM, 'HELP',               sEMXBack'\help;'
    24840 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sEMXForw'/include'
    24841 +    call EnvAddFront fRM, 'LIBRARY_PATH',       sEMXForw'/lib'
    24842 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sEMXForw'/include/cpp;'sEMXForw'/include'
    24843 +    call EnvSet      fRM, 'PROTODIR',           sEMXForw'/include/cpp/gen'
    24844 +    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sEMXForw'/include'
    24845 +    call EnvSet      fRM, 'GCCLOAD',            '5'
    24846 +    call EnvSet      fRM, 'GCCOPT',             '-pipe'
    24847 +    call EnvAddFront fRM, 'INFOPATH',           sEMXForw'/info'
    24848 +    call EnvSet      fRM, 'EMXBOOK',            'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf'
    24849 +    call EnvAddFront fRM, 'HELPNDX',            'emxbook.ndx', '+', 1
    24850 +    call EnvSet      fRM, 'EMXOPT',             '-c -n -h1024'
    24851 +    if EnvGet('TERM') = '' then do
    24852 +        call EnvSet  fRM, 'TERM',               'ansi'
    24853 +        call EnvSet  fRM, 'TERMCAP',            sEMXForw'/etc/termcap.dat'
    24854 +    end
    24855 +
    24856 +    /*
    24857 +     * Verify.
    24858 +     */
    24859 +    if (pos('verify', sOperation) <= 0) then
    24860 +        return 0;
    24861 +    if (    \CfgVerifyFile(sEmxBack'\bin\gcc.exe', fQuiet),
    24862 +        |   \CfgVerifyFile(sEmxBack'\bin\emxomf.exe', fQuiet),
    24863 +        |   \CfgVerifyFile(sEmxBack'\bin\emxrev.cmd', fQuiet),
    24864 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\c.a', fQuiet),
    24865 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\c.lib', fQuiet),
    24866 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\sys.lib', fQuiet),
    24867 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\emx.a', fQuiet),
    24868 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\emx.lib', fQuiet),
    24869 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\c_import.a', fQuiet),
    24870 +        |   \CfgVerifyFile(sEmxBack'\lib\mt\c_import.lib', fQuiet),
    24871 +        |   \CfgVerifyFile(sEmxBack'\lib\c_alias.a', fQuiet),
    24872 +        |   \CfgVerifyFile(sEmxBack'\lib\c_alias.lib', fQuiet),
    24873 +        |   \CfgVerifyFile(sEmxBack'\lib\emx2.a', fQuiet),
    24874 +        |   \CfgVerifyFile(sEmxBack'\lib\emx2.lib', fQuiet),
    24875 +        ) then
    24876 +        return 2;
    24877 +    rc = CheckCmdOutput('gcc --version', 0, fQuiet, '2.8.1');
    24878 +    if (rc = 0) then
    24879 +        rc = CheckCmdOutput('emxrev.cmd', 0, fQuiet,,
    24880 +                            'EMX : revision = 61'||'0d0a'x ||,
    24881 +                            'EMXIO : revision = 60'||'0d0a'x||,
    24882 +                            'EMXLIBC : revision = 63'||'0d0a'x||,
    24883 +                            'EMXLIBCM : revision = 64'||'0d0a'x||,
    24884 +                            'EMXLIBCS : revision = 64'||'0d0a'x||,
    24885 +                            'EMXWRAP : revision = 60'||'0d0a'x);
    24886 +    return rc;
    24887 +return 0;
    24888 +
    24889 +
    24890 +/*
    24891 + * EMX PGCC - must be installed on to the ordinar EMX.
    24892 + */
    24893 +EMXPGCC: procedure expose aCfg. aPath.
    24894 +    parse arg sToolId,sOperation,fRM,fQuiet
    24895 +
    24896 +    /*
    24897 +     * EMX/GCC main directory.
    24898 +     */
    24899 +    sEMXPGCC    = PathQuery('emxpgcc', sToolId, sOperation);
    24900 +    if (sEMXPGCC = '') then
    24901 +        return 1;
    24902 +    /* If config operation we're done now. */
    24903 +    if (pos('config', sOperation) > 0) then
    24904 +        return 0;
    24905 +
    24906 +    sEMXBack    = translate(sEMXPGCC, '\', '/');
    24907 +    sEMXForw    = translate(sEMXPGCC, '/', '\');
    24908 +    call EnvSet      fRM, 'PATH_EMXPGCC',   sEMXBack;
    24909 +    call EnvSet      fRM, 'CCENV',          'EMX'
    24910 +    call EnvSet      fRM, 'BUILD_ENV',      'EMX'
    24911 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    24912 +
    24913 +    call EnvAddFront fRM, 'BEGINLIBPATH',       sEMXBack'\dll;'
    24914 +    call EnvAddFront fRM, 'PATH',               sEMXBack'\bin;'
    24915 +    call EnvAddFront fRM, 'DPATH',              sEMXBack'\book;'
    24916 +    call EnvAddFront fRM, 'BOOKSHELF',          sEMXBack'\book;'
    24917 +    call EnvAddFront fRM, 'HELP',               sEMXBack'\help;'
    24918 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sEMXForw'/include'
    24919 +    call EnvAddFront fRM, 'LIBRARY_PATH',       sEMXForw'/lib'
    24920 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sEMXForw'/include/cpp;'sEMXForw'/include'
    24921 +    call EnvSet      fRM, 'PROTODIR',           sEMXForw'/include/cpp/gen'
    24922 +    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sEMXForw'/include'
    24923 +    call EnvAddFront fRM, 'INFOPATH',           sEMXForw'/info'
    24924 +    call EnvSet      fRM, 'EMXBOOK',            'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf'
    24925 +    call EnvAddFront fRM, 'HELPNDX',            'emxbook.ndx', '+', 1
    24926 +
    24927 +    /*
    24928 +     * Verify.
    24929 +     */
    24930 +    if (pos('verify', sOperation) <= 0) then
    24931 +        return 0;
    24932 +    if (    \CfgVerifyFile(sEmxBack'\bin\gcc.exe', fQuiet),
    24933 +        |   \CfgVerifyFile(sEmxBack'\bin\g++.exe', fQuiet),
    24934 +        |   \CfgVerifyFile(sEmxBack'\bin\as.exe', fQuiet),
    24935 +        |   \CfgVerifyFile(sEmxBack'\bin\emxomf.exe', fQuiet),
    24936 +        |   \CfgVerifyFile(sEmxBack'\lib\gcc29160.a', fQuiet),
    24937 +        |   \CfgVerifyFile(sEmxBack'\lib\gcc29160.lib', fQuiet),
    24938 +        |   \CfgVerifyFile(sEmxBack'\lib\iberty.a', fQuiet),
    24939 +        |   \CfgVerifyFile(sEmxBack'\lib\iberty.lib', fQuiet),
    24940 +        |   \CfgVerifyFile(sEmxBack'\lib\iberty_s.a', fQuiet),
    24941 +        |   \CfgVerifyFile(sEmxBack'\lib\iberty_s.lib', fQuiet),
    24942 +        |   \CfgVerifyFile(sEmxBack'\lib\opcodes.a', fQuiet),
    24943 +        |   \CfgVerifyFile(sEmxBack'\lib\opcodes.lib', fQuiet),
    24944 +        |   \CfgVerifyFile(sEmxBack'\lib\opcodes_s.a', fQuiet),
    24945 +        |   \CfgVerifyFile(sEmxBack'\lib\opcodes_s.lib', fQuiet),
    24946 +        ) then
    24947 +        return 2;
    24948 +    rc = CheckCmdOutput('gcc --version', 0, fQuiet, 'pgcc-2.95.2');
    24949 +    if (rc = 0) then
    24950 +        rc = CheckCmdOutput('g++ --version', 0, fQuiet, 'pgcc-2.95.2');
    24951 +    if (rc = 0) then
    24952 +        rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 2.9.1');
    24953 +return rc;
    24954 +
    24955 +
    24956 +/*
    24957 + * FreeType v1.3.1 EMX release.
    24958 + */
    24959 +FreeTypeEMX: procedure expose aCfg. aPath.
    24960 +    parse arg sToolId,sOperation,fRM,fQuiet
    24961 +    sPathFreeType = PathQuery('freetypeemx', sToolId, sOperation);
    24962 +    if (sPathFreeType = '') then
    24963 +        return 1;
    24964 +    /* If config operation we're done now. */
    24965 +    if (pos('config', sOperation) > 0) then
    24966 +        return 0;
    24967 +    call EnvSet      fRm, 'PATH_FREETYPE', sPathFreeType;
    24968 +    call EnvAddFront fRm, 'beginlibpath',sPathFreeType'\dll;'
    24969 +    call EnvAddFront fRm, 'path',        sPathFreeType'\bin;'
    24970 +    call EnvAddFront fRM, 'include',     sPathFreeType'\include;'
    24971 +    call EnvAddFront fRM, 'C_INCLUDE_PATH', sPathFreeType'\include;'
    24972 +    call EnvAddFront fRM, 'lib',         sPathFreeType'\lib;'
    24973 +
    24974 +    /*
    24975 +     * Verify.
    24976 +     */
    24977 +    if (pos('verify', sOperation) <= 0) then
    24978 +        return 0;
    24979 +
    24980 +    if (    \CfgVerifyFile(sPathFreeType'\bin\ftsbit.exe', fQuiet),
    24981 +        |   \CfgVerifyFile(sPathFreeType'\bin\ftzoom.exe', fQuiet),
    24982 +        |   \CfgVerifyFile(sPathFreeType'\dll\ttf.dll', fQuiet),
    24983 +        ) then
    24984 +        return 2;
    24985 +return 0;
    24986 +
    24987 +
    24988 +/*
    24989 + * IBM DB2 v5.2
    24990 + */
    24991 +db2v52: procedure expose aCfg. aPath.
    24992 +    parse arg sToolId,sOperation,fRM,fQuiet
    24993 +    sPathDB2   = PathQuery('db2v52', sToolId, sOperation);
    24994 +    if (sPathDB2 = '') then
    24995 +        return 1;
    24996 +    /* If config operation we're done now. */
    24997 +    if (pos('config', sOperation) > 0) then
    24998 +        return 0;
    24999 +    call EnvSet      fRm, 'PATH_DB2',    sPathDB2;
    25000 +    call EnvSet      fRm, 'db2path',     sPathDB2;
    25001 +    call EnvAddFront fRm, 'beginlibpath',sPathDB2'\dll;'sPathDB2'\alt;'
    25002 +    call EnvAddFront fRm, 'path',        sPathDB2'\bin;'sPathDB2'\alt;'
    25003 +    call EnvAddFront fRm, 'dpath',       sPathDB2'\bin;'sPathDB2';'
    25004 +    call EnvAddFront fRm, 'help',        sPathDB2'\help;'
    25005 +    call EnvAddEnd   fRm, 'classpath',   '.;'sPathDB2'\JAVA\DB2JAVA.ZIP;'sPathDB2'\JAVA\RUNTIME.ZIP;'sPathDB2'\JAVA\SQLJ.ZIP;'
    25006 +    call EnvSet      fRM, 'db2instace',  'DB2'
    25007 +    /*call EnvSet      fRM, 'odbc_path',   'f:\odbc' -- huh? what's this? */
    25008 +    call EnvAddFront fRM, 'cobcpy',      sPathDB2'\include\cobol_mf'
    25009 +    call EnvSet      fRM, 'finclude',    sPathDB2'\include'
    25010 +    call EnvAddFront fRM, 'include',     sPathDB2'\include;'
    25011 +    call EnvAddFront fRM, 'lib',         sPathDB2'\lib;'
    25012 +
    25013 +    /*
    25014 +     * Verify.
    25015 +     */
    25016 +    if (pos('verify', sOperation) <= 0) then
    25017 +        return 0;
    25018 +
    25019 +    if (    \CfgVerifyFile(sPathDB2'\bin\db2.exe', fQuiet),
    25020 +        |   \CfgVerifyFile(sPathDB2'\bin\sqlbind.exe', fQuiet),
    25021 +        |   \CfgVerifyFile(sPathDB2'\bin\sqlprep.exe', fQuiet),
    25022 +        |   \CfgVerifyFile(sPathDB2'\lib\db2api.lib', fQuiet),
    25023 +        |   \CfgVerifyFile(sPathDB2'\lib\db2cli.lib', fQuiet),
    25024 +        |   \CfgVerifyFile(sPathDB2'\lib\db2gmf32.lib', fQuiet),
    25025 +        |   \CfgVerifyFile(sPathDB2'\include\sql.h', fQuiet),
    25026 +        |   \CfgVerifyFile(sPathDB2'\include\sqlcodes.h', fQuiet),
    25027 +        |   \CfgVerifyFile(sPathDB2'\include\sqlsystm.h', fQuiet),
    25028 +        |   \CfgVerifyFile(sPathDB2'\include\sqlcli.h', fQuiet),
    25029 +        ) then
    25030 +        return 2;
    25031 +    rc = CheckCmdOutput('echo quit | db2', 0, fQuiet, 'Command Line Processor for DB2 SDK 5.2.0');
    25032 +return rc;
    25033 +
    25034 +
    25035 +
    25036 +/*
    25037 + *  Device Driver Kit (DDK) base.
    25038 + */
    25039 +DDK: procedure expose aCfg. aPath.
    25040 +    parse arg sToolId,sOperation,fRM,fQuiet
    25041 +
    25042 +    /*
    25043 +     * Device Driver Kit (DDK) (v4.0+) Main Directory.
    25044 +     */
    25045 +    sPathDDK    = PathQuery('ddk', sToolId, sOperation);
    25046 +    if (sPathDDK = '') then
    25047 +        return 1;
    25048 +    /* If config operation we're done now. */
    25049 +    if (pos('config', sOperation) > 0) then
    25050 +    do
    25051 +        /* Set the ddk subpaths */
    25052 +        if (PathQuery('ddkbase', 'ddkbase', 'quietisconfig') = '') then
    25053 +            call PathSet 'ddkbase', sPathDDK'\base';
    25054 +        if (PathQuery('ddkvideo', 'ddkvideo', 'quietisconfig') = '') then
    25055 +            call PathSet 'ddkvideo', sPathDDK'\video';
    25056 +        if (PathQuery('ddkprint', 'ddkvideo', 'quietisconfig') = '') then
    25057 +            call PathSet 'ddkprint', sPathDDK'\print';
    25058 +        return 0;
    25059 +    end
    25060 +    call EnvSet      fRM, 'PATH_DDK',    sPathDDK;
    25061 +    rc = DDKBase('ddkbase',sOperation,fRM,fQuiet)
    25062 +    if (rc = 0) then
    25063 +        rc = DDKVideo('ddkvideo',sOperation,fRM,fQuiet)
    25064 +return rc;
    25065 +
    25066 +
    25067 +/*
    25068 + *  Device Driver Kit (DDK) base.
    25069 + */
    25070 +DDKBase: procedure expose aCfg. aPath.
    25071 +    parse arg sToolId,sOperation,fRM,fQuiet
    25072 +
    25073 +    /*
    25074 +     * Device Driver Kit (DDK) (v4.0+) base (important not main) directory.
    25075 +     */
    25076 +    sPathDDKBase    = PathQuery('ddkbase', sToolId, sOperation);
    25077 +    if (sPathDDKBase = '') then
    25078 +        return 1;
    25079 +    /* If config operation we're done now. */
    25080 +    if (pos('config', sOperation) > 0) then
    25081 +        return 0;
    25082 +    call EnvSet      fRM, 'PATH_DDKBASE',sPathDDKBase;
    25083 +    call EnvAddFront fRM, 'path',        sPathDDKBase'\tools;'
    25084 +    call EnvAddFront fRM, 'include',     sPathDDKBase'\h;'sPathDDKBase'\inc;'sPathDDKBase'\inc32;'
    25085 +    call EnvAddFront fRM, 'include16',   sPathDDKBase'\h;'
    25086 +    call EnvAddFront fRM, 'lib',         sPathDDKBase'\lib;'
    25087 +    call EnvAddFront fRM, 'bookshelf',   sPathDDKBase'\..\docs;'
    25088 +
    25089 +    /*
    25090 +     * Verify.
    25091 +     */
    25092 +    if (pos('verify', sOperation) <= 0) then
    25093 +        return 0;
    25094 +    if (    \CfgVerifyFile(sPathDDKBase'\tools\link.exe', fQuiet),
    25095 +        |   \CfgVerifyFile(sPathDDKBase'\tools\link386.exe', fQuiet),
    25096 +        |   \CfgVerifyFile(sPathDDKBase'\tools\cl386.exe', fQuiet),
    25097 +        |   \CfgVerifyFile(sPathDDKBase'\tools\masm.exe', fQuiet),
    25098 +        |   \CfgVerifyFile(sPathDDKBase'\tools\h2inc.exe', fQuiet),
    25099 +        |   \CfgVerifyFile(sPathDDKBase'\tools\lib.exe', fQuiet),
    25100 +        |   \CfgVerifyFile(sPathDDKBase'\lib\os2286.lib', fQuiet),
    25101 +        |   \CfgVerifyFile(sPathDDKBase'\lib\os2286p.lib', fQuiet),
    25102 +        |   \CfgVerifyFile(sPathDDKBase'\lib\os2386.lib', fQuiet),
    25103 +        |   \CfgVerifyFile(sPathDDKBase'\lib\os2386p.lib', fQuiet),
    25104 +        |   \CfgVerifyFile(sPathDDKBase'\lib\doscalls.lib', fQuiet),
    25105 +        |   \CfgVerifyFile(sPathDDKBase'\lib\dhcalls.lib', fQuiet),
    25106 +        |   \CfgVerifyFile(sPathDDKBase'\lib\addcalls.lib', fQuiet),
    25107 +        |   \CfgVerifyFile(sPathDDKBase'\lib\rmcalls.lib', fQuiet),
    25108 +        |   \CfgVerifyFile(sPathDDKBase'\lib\vdh.lib', fQuiet),
    25109 +        |   \CfgVerifyFile(sPathDDKBase'\h\infoseg.h', fQuiet),
    25110 +        |   \CfgVerifyFile(sPathDDKBase'\h\include.h', fQuiet),
    25111 +        |   \CfgVerifyFile(sPathDDKBase'\h386\pmddi.h', fQuiet),
    25112 +        |   \CfgVerifyFile(sPathDDKBase'\h386\pmddim.h', fQuiet),
    25113 +        |   \CfgVerifyFile(sPathDDKBase'\h386\limits.h', fQuiet),
    25114 +        |   \CfgVerifyFile(sPathDDKBase'\h386\string.h', fQuiet),
    25115 +        |   \CfgVerifyFile(sPathDDKBase'\inc\v8086.inc', fQuiet),
    25116 +        |   \CfgVerifyFile(sPathDDKBase'\inc\sas.inc', fQuiet),
    25117 +        |   \CfgVerifyFile(sPathDDKBase'\inc\pmwinx.inc', fQuiet),
    25118 +        |   \CfgVerifyFile(sPathDDKBase'\inc\infoseg.inc', fQuiet),
    25119 +        |   \CfgVerifyFile(sPathDDKBase'\inc\devhlp.inc', fQuiet),
    25120 +        |   \CfgVerifyFile(sPathDDKBase'\inc\devhlpp.inc', fQuiet),
    25121 +        ) then
    25122 +        return 2;
    25123 +    rc = CheckCmdOutput('cl386', 0, fQuiet, 'Microsoft (R) Microsoft 386 C Compiler. Version 6.00.054');
    25124 +    if (rc = 0) then
    25125 +        rc = CheckCmdOutput('masm nul,nul,nul,nul;', 2, fQuiet, 'Microsoft (R) Macro Assembler Version 5.10A.15 Jul 07 15:25:03 1989');
    25126 +    if (rc = 0) then
    25127 +        rc = CheckCmdOutput('h2inc -?', 0, fQuiet, 'h2inc - .H to .INC file translator (version 13.29)');
    25128 +    if (rc = 0) then
    25129 +        rc = CheckCmdOutput('type' sPathDDKBase'\inc\devhlp.inc', 0, fQuiet, 'DevHlp_ReadFileAt');
    25130 +return rc;
    25131 +
    25132 +
    25133 +/*
    25134 + *  Device Driver Kit (DDK) Video.
    25135 + */
    25136 +DDKVideo: procedure expose aCfg. aPath.
    25137 +    parse arg sToolId,sOperation,fRM,fQuiet
    25138 +
    25139 +    /*
    25140 +     * Device Driver Kit (DDK) (v4.0+) Video (important not main) directory.
    25141 +     */
    25142 +    sPathDDKVideo   = PathQuery('ddkvideo', sToolId, sOperation);
    25143 +    if (sPathDDKVideo = '') then
    25144 +        return 1;
    25145 +    /* If config operation we're done now. */
    25146 +    if (pos('config', sOperation) > 0) then
    25147 +        return 0;
    25148 +    call EnvSet      fRM, 'PATH_DDKVIDEO',sPathDDKVideo;
    25149 +    call EnvAddFront fRM, 'path',        sPathDDKVideo'\tools\os2.386\bin;'sPathDDKVideo'\tools\os2.386\lx.386\bin;' /* might not need this... */
    25150 +    call EnvAddFront fRM, 'include',     sPathDDKVideo'\rel\os2c\include\base\os2;'/*sPathDDKVideo'\rel\os2c\include\base\os2\16bit;'sPathDDKVideo'\rel\os2c\include\base\os2\inc;'sPathDDKVideo'\rel\os2c\include\base\os2\inc32;' /* might be over kill!! */  - it is! */
    25151 +    call EnvAddFront fRM, 'include16',   sPathDDKVideo'\rel\os2c\include\base\os2\16bit;'
    25152 +    call EnvAddFront fRM, 'lib',         sPathDDKVideo'\rel\os2c\lib\os2;'sPathDDKVideo'\rel\os2c\lib\os2\priv;'
    25153 +    call EnvAddFront fRM, 'bookshelf',   sPathDDKVideo'\..\docs;'
    25154 +
    25155 +    /*
    25156 +     * Verify.
    25157 +     */
    25158 +    if (pos('verify', sOperation) <= 0) then
    25159 +        return 0;
    25160 +    if (    \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\doscalls.lib', fQuiet),
    25161 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\gradd.lib', fQuiet),
    25162 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\os2386.lib', fQuiet),
    25163 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\libh.lib', fQuiet),
    25164 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\vdh.lib', fQuiet),
    25165 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\thunkrt.lib', fQuiet),
    25166 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\dbcs32.lib', fQuiet),
    25167 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\priv\pmwp.lib', fQuiet),
    25168 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\priv\os2286p.lib', fQuiet),
    25169 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\vvga.def', fQuiet),
    25170 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\lib\os2\vvga.def', fQuiet),
    25171 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\gradd.h', fQuiet),
    25172 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\pmwp.h', fQuiet),
    25173 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\os2p.h', fQuiet),
    25174 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\pmgpip.h', fQuiet),
    25175 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\pmdevp.h', fQuiet),
    25176 +        |   \CfgVerifyFile(sPathDDKVideo'\rel\os2c\include\base\os2\inc32\pmp.inc', fQuiet),
    25177 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\bin\rc.exe', fQuiet),
    25178 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\bin\nmake.exe', fQuiet),
    25179 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\bin\h2inc.exe', fQuiet),
    25180 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\link386.exe', fQuiet),
    25181 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\masm.exe', fQuiet),
    25182 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\masm.exe', fQuiet),
    25183 +        |   \CfgVerifyFile(sPathDDKVideo'\tools\os2.386\lx.386\bin\mcl386\bin\c3_386.exe', fQuiet),
    25184 +        ) then
    25185 +        return 2;
    25186 +    rc = CheckCmdOutput('nmake -?', 0, fQuiet, 'Version 2.001.000 Jan 28 1994');
    25187 +    if (rc = 0) then
    25188 +        rc = CheckCmdOutput('masm nul,nul,nul,nul;', 2, fQuiet, 'Microsoft (R) Macro Assembler Version 5.10A.15 Jul 07 15:25:03 1989');
    25189 +    if (rc = 0) then
    25190 +        rc = CheckCmdOutput('h2inc -?', 0, fQuiet, 'h2inc - .H to .INC file translator (version 13.29)');
    25191 +    if (rc = 0) then
    25192 +        rc = CheckCmdOutput('type 'sPathDDKVideo'\rel\os2c\include\base\os2\gradd.h', 0, fQuiet, 'GHI_CMD_POLYGON');
    25193 +return rc;
    25194 +
    25195 +
    25196 +/*
    25197 + * Doxygen v1.2.11.1 for OS/2.
    25198 + */
    25199 +DoxyGen: procedure expose aCfg. aPath.
    25200 +    parse arg sToolId,sOperation,fRM,fQuiet
    25201 +
    25202 +    /*
    25203 +     * Get base directory.
    25204 +     */
    25205 +    sPathDoxyGen   = PathQuery('doxygen', sToolId, sOperation);
    25206 +    if (sPathDoxyGen = '') then
    25207 +        return 1;
    25208 +    /* If config operation we're done now. */
    25209 +    if (pos('config', sOperation) > 0) then
    25210 +        return 0;
    25211 +    call EnvSet      fRM, 'PATH_DOXYGEN',sPathDoxyGen;
    25212 +    call EnvAddFront fRM, 'path',        sPathDoxyGen'\bin;'
    25213 +
    25214 +    /*
    25215 +     * Verify.
    25216 +     */
    25217 +    if (pos('verify', sOperation) <= 0) then
    25218 +        return 0;
    25219 +    if (    \CfgVerifyFile(sPathDoxyGen'\bin\dot.exe', fQuiet),
    25220 +        |   \CfgVerifyFile(sPathDoxyGen'\bin\doxygen.exe', fQuiet),
    25221 +        ) then
    25222 +        return 2;
    25223 +    rc = CheckCmdOutput('doxygen', 1, fQuiet, 'Doxygen version 1.2.11.1');
    25224 +return rc;
    25225 +
    25226 +
    25227 +/*
    25228 + * EMX/GCC 3.x.x - this environment must be used 'on' the ordinary EMX.
    25229 + * Note! bin.new has been renamed to bin!
    25230 + * Note! make .lib of every .a! in 4OS2: for /R %i in (*.a) do if not exist %@NAME[%i].lib emxomf %i
    25231 + */
    25232 +GCC3xx: procedure expose aCfg. aPath.
    25233 +    parse arg sToolId,sOperation,fRM,fQuiet,sPathId
    25234 +
    25235 +    /*
    25236 +     * EMX/GCC main directory.
    25237 +     */
    25238 +    sGCC = PathQuery(sPathId, sToolId, sOperation);
    25239 +    if (sGCC = '') then
    25240 +        return 1;
    25241 +    /* If config operation we're done now. */
    25242 +    if (pos('config', sOperation) > 0) then
    25243 +        return 0;
    25244 +
    25245 +    sGCCBack    = translate(sGCC, '\', '/');
    25246 +    sGCCForw    = translate(sGCC, '/', '\');
    25247 +    call EnvSet      fRM, 'PATH_EMXPGCC',   sGCCBack;
    25248 +    call EnvSet      fRM, 'CCENV',          'EMX'
    25249 +    call EnvSet      fRM, 'BUILD_ENV',      'EMX'
    25250 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    25251 +
    25252 +    call EnvAddFront fRM, 'BEGINLIBPATH',       sGCCBack'\dll;'
    25253 +    call EnvAddFront fRM, 'PATH',               sGCCBack'\bin.new;'sGCCBack'\bin;'
    25254 +    call EnvAddFront fRM, 'DPATH',              sGCCBack'\book;'
    25255 +    call EnvAddFront fRM, 'BOOKSHELF',          sGCCBack'\book;'
    25256 +    call EnvAddFront fRM, 'HELP',               sGCCBack'\help;'
    25257 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/include'
    25258 +    call EnvAddFront fRM, 'LIBRARY_PATH',       sGCCForw'/lib'
    25259 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/cpp;'sGCCForw'/include'
    25260 +    call EnvSet      fRM, 'PROTODIR',           sGCCForw'/include/cpp/gen'
    25261 +    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sGCCForw'/include'
    25262 +    call EnvAddFront fRM, 'INFOPATH',           sGCCForw'/info'
    25263 +    call EnvSet      fRM, 'EMXBOOK',            'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf'
    25264 +    call EnvAddFront fRM, 'HELPNDX',            'emxbook.ndx', '+', 1
    25265 +
    25266 +    /*
    25267 +     * Verify.
    25268 +     */
    25269 +    chMajor = '3';
    25270 +    chMinor = left(right(sToolId, 2), 1);
    25271 +    chRel   = right(sToolId, 1);
    25272 +    sVer = chMajor'.'chMinor'.'chRel
    25273 +    if (pos('verify', sOperation) <= 0) then
    25274 +        return 0;
    25275 +    if (    \CfgVerifyFile(sGCCBack'\bin.new\gcc.exe', fQuiet),
    25276 +        |   \CfgVerifyFile(sGCCBack'\bin.new\g++.exe', fQuiet),
    25277 +        |   \CfgVerifyFile(sGCCBack'\bin.new\as.exe', fQuiet),
    25278 +        |   \CfgVerifyFile(sGCCBack'\bin.new\readelf.exe', fQuiet),
    25279 +        |   \CfgVerifyFile(sGCCBack'\bin.new\emxomf.exe', fQuiet),
    25280 +        |   \CfgVerifyFile(sGCCBack'\dll\bfd211.dll', fQuiet),
    25281 +        |   \CfgVerifyFile(sGCCBack'\lib\iberty.a', fQuiet),
    25282 +        |   \CfgVerifyFile(sGCCBack'\lib\iberty.lib', fQuiet),
    25283 +        |   \CfgVerifyFile(sGCCBack'\lib\iberty_s.a', fQuiet),
    25284 +        |   \CfgVerifyFile(sGCCBack'\lib\iberty_s.lib', fQuiet),
    25285 +        |   \CfgVerifyFile(sGCCBack'\lib\opcodes.a', fQuiet),
    25286 +        |   \CfgVerifyFile(sGCCBack'\lib\opcodes.lib', fQuiet),
    25287 +        |   \CfgVerifyFile(sGCCBack'\lib\opcodes_s.a', fQuiet),
    25288 +        |   \CfgVerifyFile(sGCCBack'\lib\opcodes_s.lib', fQuiet),
    25289 +        ) then
    25290 +        return 2;
    25291 +
    25292 +    if (chMinor > 0) then
    25293 +    do
    25294 +        if (    \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2-emx\'sVer'\st\'sToolId'.lib', fQuiet),
    25295 +            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2-emx\'sVer'\st\stdcxx.lib', fQuiet),
    25296 +            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2-emx\'sVer'\st\stdcxx.a', fQuiet),
    25297 +            ) then
    25298 +            return 2;
    25299 +    end
    25300 +    else
    25301 +    do
    25302 +        if (    \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2_emx\'sVer'\st\gcc_dll.lib', fQuiet),
    25303 +            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2_emx\'sVer'\st\stdcxx.lib', fQuiet),
    25304 +            |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\i386-pc-os2_emx\'sVer'\st\stdcxx.a', fQuiet),
    25305 +            ) then
    25306 +            return 2;
    25307 +    end
    25308 +
    25309 +
    25310 +    rc = CheckCmdOutput('gcc --version', 0, fQuiet, sVer);
    25311 +    if (rc = 0) then
    25312 +        rc = CheckCmdOutput('g++ --version', 0, fQuiet, sVer);
    25313 +    if (rc = 0) then
    25314 +    do
    25315 +        sVerAS = '2.11.2';
    25316 +        rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 'sVerAS);
    25317 +    end
    25318 +return rc;
    25319 +
    25320 +
    25321 +/*
    25322 + * Innotek GCC 3.2.x and higher - this environment is EMX RT free.
    25323 + * Note! make .lib of every .a! in 4OS2: for /R %i in (*.a) do if not exist %@NAME[%i].lib emxomf %i
    25324 + */
    25325 +GCC322plus: procedure expose aCfg. aPath.
    25326 +    parse arg sToolId,sOperation,fRM,fQuiet,sPathId
    25327 +
    25328 +    /*
    25329 +     * EMX/GCC main directory.
    25330 +     */
    25331 +    sGCC = PathQuery(sPathId, sToolId, sOperation);
    25332 +    if (sGCC = '') then
    25333 +        return 1;
    25334 +    /* If config operation we're done now. */
    25335 +    if (pos('config', sOperation) > 0) then
    25336 +        return 0;
    25337 +
    25338 +    /* parse out the version / constants */
    25339 +    chMajor = '3';
    25340 +    chMinor = left(right(sToolId, 2), 1);
    25341 +    chRel   = right(sToolId, 1);
    25342 +    sVer    = chMajor'.'chMinor'.'chRel
    25343 +    sVerShrt= chMajor||chMinor||chRel;
    25344 +    sTrgt   = 'i386-pc-os2-emx'
    25345 +
    25346 +    sGCCBack    = translate(sGCC, '\', '/');
    25347 +    sGCCForw    = translate(sGCC, '/', '\');
    25348 +    call EnvSet      fRM, 'PATH_IGCC',       sGCCBack;
    25349 +    call EnvSet      fRM, 'CCENV',          'IGCC'
    25350 +    call EnvSet      fRM, 'BUILD_ENV',      'IGCC'
    25351 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    25352 +
    25353 +    call EnvAddFront fRM, 'BEGINLIBPATH',       sGCCBack'\'sTrgt'\lib;'sGCCBack'\lib;'
    25354 +    call EnvAddFront fRM, 'DPATH',              sGCCBack'\lib;'
    25355 +    /*call EnvAddFront fRM, 'HELP',               sGCCBack'\lib;'*/
    25356 +    call EnvAddFront fRM, 'PATH',               sGCCForw'\'sTrgt'\bin;'sGCCBack'\'sTrgt'\bin;'sGCCForw'\bin;'sGCCBack'\bin;'
    25357 +    /*call EnvAddFront fRM, 'DPATH',              sGCCBack'\book;'
    25358 +    call EnvAddFront fRM, 'BOOKSHELF',          sGCCBack'\book;'
    25359 +    call EnvAddFront fRM, 'HELP',               sGCCBack'\help;' */
    25360 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/include;'
    25361 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/lib/gcc-lib/'sTrgt'/'sVer'/include;'
    25362 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sGCCForw'/lib/gcc-lib/'sTrgt'/'sVer'/include;'
    25363 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include;'
    25364 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/backward;'
    25365 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/'sTrgt';'
    25366 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/;'
    25367 +    call EnvAddFront fRM, 'LIBRARY_PATH',       sGCCForw'/lib'
    25368 +    call EnvAddFront fRM, 'LIBRARY_PATH',       sGCCForw'/lib/gcc-lib/'sTrgt'/'sVer';'
    25369 +    call EnvAddFront fRM, 'INFOPATH',           sGCCForw'/info'
    25370 +    /* is this used? */
    25371 +    call EnvSet      fRM, 'PROTODIR',           sGCCForw'/include/c++/gen'
    25372 +
    25373 +    /*
    25374 +     * Verify.
    25375 +     */
    25376 +    if (pos('verify', sOperation) <= 0) then
    25377 +        return 0;
    25378 +    if (    \CfgVerifyFile(sGCCBack'\bin\gcc.exe', fQuiet),
    25379 +        |   \CfgVerifyFile(sGCCBack'\bin\g++.exe', fQuiet),
    25380 +        |   \CfgVerifyFile(sGCCBack'\bin\as.exe', fQuiet),
    25381 +        |   \CfgVerifyFile(sGCCBack'\bin\readelf.exe', fQuiet),
    25382 +        |   \CfgVerifyFile(sGCCBack'\bin\emxomf.exe', fQuiet),
    25383 +        |   \CfgVerifyFile(sGCCBack'\bin\ilink.exe', fQuiet),
    25384 +        |   \CfgVerifyFile(sGCCBack'\lib\bfd2E.dll', fQuiet),
    25385 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc'sVerShrt'.dll', fQuiet),
    25386 +        |   \CfgVerifyFile(sGCCBack'\lib\libiberty.a', fQuiet),
    25387 +        |   \CfgVerifyFile(sGCCBack'\lib\libiberty.lib', fQuiet),
    25388 +        |   \CfgVerifyFile(sGCCBack'\lib\opcode2E.dll', fQuiet),
    25389 +        |   \CfgVerifyFile(sGCCBack'\lib\libopcodes.a', fQuiet),
    25390 +        |   \CfgVerifyFile(sGCCBack'\lib\libopcodes.lib', fQuiet),
    25391 +        |   \CfgVerifyFile(sGCCBack'\include\unikbd.h', fQuiet),
    25392 +        |   \CfgVerifyFile(sGCCBack'\include\c++\'sVer'\streambuf', fQuiet),
    25393 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\specs', fQuiet),
    25394 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\cc1plus.exe', fQuiet),
    25395 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\gcc'sVerShrt'.a', fQuiet),
    25396 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\gcc'sVerShrt'.lib', fQuiet),
    25397 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc.a', fQuiet),
    25398 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc.lib', fQuiet),
    25399 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc_eh.a', fQuiet),
    25400 +        |   \CfgVerifyFile(sGCCBack'\lib\gcc-lib\'sTrgt'\'sVer'\libgcc_eh.lib', fQuiet),
    25401 +        ) then
    25402 +        return 2;
    25403 +
    25404 +    rc = CheckCmdOutput('gcc --version', 0, fQuiet, sVer);
    25405 +    if (rc = 0) then
    25406 +        rc = CheckCmdOutput('g++ --version', 0, fQuiet, sVer);
    25407 +    if (rc = 0) then
    25408 +    do
    25409 +        sVerAS = '2.14';
    25410 +        rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 'sVerAS);
    25411 +    end
    25412 +    if (rc = 0) then
    25413 +        rc = CheckCmdOutput('ilink /?', 0, fQuiet, 'IBM(R) Linker for OS/2(R), Version 5.0');
    25414 +
    25415 +return rc;
    25416 +
    25417 +
    25418 +/*
    25419 + * ICAT Debugger
    25420 + */
    25421 +ICATGam: procedure expose aCfg. aPath.
    25422 +    parse arg sToolId,sOperation,fRM,fQuiet
    25423 +    sPathICAT   = PathQuery('icatgam', sToolId, sOperation);
    25424 +    if (sPathICAT = '') then
    25425 +        return 1;
    25426 +    /* If config operation we're done now. */
    25427 +    if (pos('config', sOperation) > 0) then
    25428 +        return 0;
    25429 +
    25430 +    /*
    25431 +     * Installing the environment variables.
    25432 +     */
    25433 +    call EnvSet      fRm, 'PATH_ICATGAM', sPathICAT;
    25434 +    call EnvAddFront fRm, 'beginlibpath',sPathICAT'\dll;'
    25435 +    call EnvAddFront fRm, 'path',        sPathICAT'\bin;'
    25436 +    call EnvAddFront fRm, 'dpath',       sPathICAT'\help;'
    25437 +    call EnvAddFront fRm, 'help',        sPathICAT'\help;'
    25438 +
    25439 +    /*
    25440 +     * Verify.
    25441 +     */
    25442 +    if (pos('verify', sOperation) <= 0) then
    25443 +        return 0;
    25444 +    if (    \CfgVerifyFile(sPathICAT'\bin\icatgam.exe', fQuiet),
    25445 +        |   \CfgVerifyFile(sPathICAT'\dll\gamoou3.dll', fQuiet),
    25446 +        |   \CfgVerifyFile(sPathICAT'\dll\gam5lde.dll', fQuiet),
    25447 +        |   \CfgVerifyFile(sPathICAT'\dll\gam5cx.dll', fQuiet),
    25448 +        ) then
    25449 +        return 2;
    25450 +return 0;
    25451 +
    25452 +
    25453 +/*
    25454 + * ICAT Debugger
    25455 + */
    25456 +ICATGam406RC1: procedure expose aCfg. aPath.
    25457 +    parse arg sToolId,sOperation,fRM,fQuiet
    25458 +    sPathICAT   = PathQuery('icatgam406rc1', sToolId, sOperation);
    25459 +    if (sPathICAT = '') then
    25460 +        return 1;
    25461 +    /* If config operation we're done now. */
    25462 +    if (pos('config', sOperation) > 0) then
    25463 +        return 0;
    25464 +
    25465 +    /*
    25466 +     * Installing the environment variables.
    25467 +     */
    25468 +    call EnvSet      fRm, 'PATH_ICATGAM', sPathICAT;
    25469 +    call EnvAddFront fRm, 'beginlibpath',sPathICAT'\dll;'
    25470 +    call EnvAddFront fRm, 'path',        sPathICAT'\bin;'
    25471 +    call EnvAddFront fRm, 'dpath',       sPathICAT'\help;'
    25472 +    call EnvAddFront fRm, 'help',        sPathICAT'\help;'
    25473 +
    25474 +    /*
    25475 +     * Verify.
    25476 +     */
    25477 +    if (pos('verify', sOperation) <= 0) then
    25478 +        return 0;
    25479 +    if (    \CfgVerifyFile(sPathICAT'\bin\icatgam.exe', fQuiet),
    25480 +        |   \CfgVerifyFile(sPathICAT'\dll\gamoou3.dll', fQuiet),
    25481 +        |   \CfgVerifyFile(sPathICAT'\dll\gam5lde.dll', fQuiet),
    25482 +        |   \CfgVerifyFile(sPathICAT'\dll\gam5cx.dll', fQuiet),
    25483 +        ) then
    25484 +        return 2;
    25485 +return 0;
    25486 +
    25487 +
    25488 +
    25489 +/*
    25490 + * ICAT Debugger for PE images.
    25491 + */
    25492 +ICATPe: procedure expose aCfg. aPath.
    25493 +    parse arg sToolId,sOperation,fRM,fQuiet
    25494 +    sPathICAT   = PathQuery('icatgam', sToolId, sOperation);
    25495 +    if (sPathICAT = '') then
    25496 +        return 1;
    25497 +    sPathICATPe = PathQuery('icatpe', sToolId, sOperation);
    25498 +    if (sPathICATPe = '') then
    25499 +        return 1;
    25500 +    /* If config operation we're done now. */
    25501 +    if (pos('config', sOperation) > 0) then
    25502 +        return 0;
    25503 +
    25504 +    /*
    25505 +     * Installing the environment variables.
    25506 +     */
    25507 +    call EnvSet      fRm, 'PATH_ICATGAM',sPathICAT;
    25508 +    call EnvSet      fRm, 'PATH_ICATPE', sPathICATPe;
    25509 +    call EnvAddFront fRm, 'beginlibpath',sPathICATPe'\bin;'sPathICAT'\dll;'
    25510 +    call EnvAddFront fRm, 'path',        sPathICATPe'\bin;'sPathICAT'\bin;'
    25511 +    call EnvAddFront fRm, 'dpath',       sPathICATPe'\bin;'sPathICAT'\help;'
    25512 +    call EnvAddFront fRm, 'help',        sPathICATPe'\bin;'sPathICAT'\help;'
    25513 +
    25514 +    /*
    25515 +     * Verify.
    25516 +     */
    25517 +    if (pos('verify', sOperation) <= 0) then
    25518 +        return 0;
    25519 +    if (    \CfgVerifyFile(sPathICAT'\bin\icatgam.exe', fQuiet),
    25520 +        |   \CfgVerifyFile(sPathICAT'\dll\gamoou3.dll', fQuiet),
    25521 +        |   \CfgVerifyFile(sPathICAT'\dll\gam5lde.dll', fQuiet),
    25522 +        |   \CfgVerifyFile(sPathICAT'\dll\gam5cx.dll', fQuiet),
    25523 +        |   \CfgVerifyFile(sPathICATPe'\bin\icatgam.exe', fQuiet),
    25524 +        |   \CfgVerifyFile(sPathICATPe'\bin\gamoou3.dll', fQuiet),
    25525 +        |   \CfgVerifyFile(sPathICATPe'\bin\gam5lde.dll', fQuiet),
    25526 +        |   \CfgVerifyFile(sPathICATPe'\bin\gam5cx.dll', fQuiet),
    25527 +        ) then
    25528 +        return 2;
    25529 +return 0;
    25530 +
    25531 +
    25532 +
    25533 +/*
    25534 + * Interactive Disassembler (IDA) v3.80a
    25535 + */
    25536 +IDA38: procedure expose aCfg. aPath.
    25537 +    parse arg sToolId,sOperation,fRM,fQuiet
    25538 +    /*
    25539 +     * IDA main directory.
    25540 +     */
    25541 +    sPathIDA = PathQuery('ida38', sToolId, sOperation);
    25542 +    if (sPathIDA = '') then
    25543 +        return 1;
    25544 +    /* If config operation we're done now. */
    25545 +    if (pos('config', sOperation) > 0) then
    25546 +        return 0;
    25547 +
    25548 +    /*
    25549 +     * Installing the environment variables.
    25550 +     */
    25551 +    call EnvSet      fRM, 'PATH_IDA',       sPathIDA
    25552 +    call EnvAddFront fRM, 'path',           sPathIDA
    25553 +    call EnvAddFront fRM, 'beginlibpath',   sPathIDA
    25554 +
    25555 +    /*
    25556 +     * Verify.
    25557 +     */
    25558 +    if (pos('verify', sOperation) <= 0) then
    25559 +        return 0;
    25560 +    if (    \CfgVerifyFile(sPathIDA'\ida2.exe', fQuiet),
    25561 +        |   \CfgVerifyFile(sPathIDA'\idaw.exe', fQuiet),
    25562 +        |   \CfgVerifyFile(sPathIDA'\ida.dll', fQuiet),
    25563 +        |   \CfgVerifyFile(sPathIDA'\pc.dll', fQuiet),
    25564 +        ) then
    25565 +        return 2;
    25566 +return 0;
    25567 +
    25568 +
    25569 +/*
    25570 + * Interactive Disassembler (IDA) v4.01
    25571 + */
    25572 +IDA40: procedure expose aCfg. aPath.
    25573 +    parse arg sToolId,sOperation,fRM,fQuiet
    25574 +    /*
    25575 +     * IDA main directory.
    25576 +     */
    25577 +    sPathIDA = PathQuery('ida40', sToolId, sOperation);
    25578 +    if (sPathIDA = '') then
    25579 +        return 1;
    25580 +    /* If config operation we're done now. */
    25581 +    if (pos('config', sOperation) > 0) then
    25582 +        return 0;
    25583 +
    25584 +    /*
    25585 +     * Installing the environment variables.
    25586 +     */
    25587 +    call EnvSet      fRM, 'PATH_IDA',       sPathIDA
    25588 +    call EnvAddFront fRM, 'path',           sPathIDA
    25589 +    call EnvAddFront fRM, 'beginlibpath',   sPathIDA
    25590 +
    25591 +    /*
    25592 +     * Verify.
    25593 +     */
    25594 +    if (pos('verify', sOperation) <= 0) then
    25595 +        return 0;
    25596 +    if (    \CfgVerifyFile(sPathIDA'\ida2.exe', fQuiet),
    25597 +        |   \CfgVerifyFile(sPathIDA'\idaw.exe', fQuiet),
    25598 +        |   \CfgVerifyFile(sPathIDA'\ida.dll', fQuiet),
    25599 +        |   \CfgVerifyFile(sPathIDA'\pc.dll', fQuiet),
    25600 +        ) then
    25601 +        return 2;
    25602 +return 0;
    25603 +
    25604 +
    25605 +/*
    25606 + * Interactive Disassembler (IDA) v4.14
    25607 + */
    25608 +IDA414: procedure expose aCfg. aPath.
    25609 +    parse arg sToolId,sOperation,fRM,fQuiet
    25610 +    /*
    25611 +     * IDA main directory.
    25612 +     */
    25613 +    sPathIDA = PathQuery('ida414', sToolId, sOperation);
    25614 +    if (sPathIDA = '') then
    25615 +        return 1;
    25616 +    /* If config operation we're done now. */
    25617 +    if (pos('config', sOperation) > 0) then
    25618 +        return 0;
    25619 +
    25620 +    /*
    25621 +     * Installing the environment variables.
    25622 +     */
    25623 +    call EnvSet      fRM, 'PATH_IDA',       sPathIDA
    25624 +    call EnvAddFront fRM, 'path',           sPathIDA
    25625 +    call EnvAddFront fRM, 'beginlibpath',   sPathIDA
    25626 +
    25627 +    /*
    25628 +     * Verify.
    25629 +     */
    25630 +    if (pos('verify', sOperation) <= 0) then
    25631 +        return 0;
    25632 +    if (    \CfgVerifyFile(sPathIDA'\ida2.exe', fQuiet),
    25633 +        |   \CfgVerifyFile(sPathIDA'\idaw.exe', fQuiet),
    25634 +        |   \CfgVerifyFile(sPathIDA'\ida.dll', fQuiet),
    25635 +        |   \CfgVerifyFile(sPathIDA'\pc.dll', fQuiet),
    25636 +        ) then
    25637 +        return 2;
    25638 +return 0;
    25639 +
    25640 +
    25641 +/*
    25642 + * Interactive Disassembler (IDA) Plugin SDK (v5.0?)
    25643 + */
    25644 +IDASDK: procedure expose aCfg. aPath.
    25645 +    parse arg sToolId,sOperation,fRM,fQuiet
    25646 +    /*
    25647 +     * IDA main directory.
    25648 +     */
    25649 +    sPathIDASDK = PathQuery('idasdk', sToolId, sOperation);
    25650 +    if (sPathIDASDK = '') then
    25651 +        return 1;
    25652 +    /* If config operation we're done now. */
    25653 +    if (pos('config', sOperation) > 0) then
    25654 +        return 0;
    25655 +
    25656 +    /*
    25657 +     * Installing the environment variables.
    25658 +     */
    25659 +    call EnvSet      fRM, 'PATH_IDASDK',    sPathIDASDK
    25660 +    call EnvAddFront fRM, 'include',        sPathIDASDK'\include;'
    25661 +    call EnvAddFront fRM, 'lib',            sPathIDASDK'\libwat.os2;'
    25662 +    call EnvAddFront fRM, 'path',           sPathIDASDK'\bin\os2;'
    25663 +    call EnvAddFront fRM, 'beginlibpath',   sPathIDASDK'\bin\os2;'
    25664 +
    25665 +    /*
    25666 +     * Verify.
    25667 +     */
    25668 +    if (pos('verify', sOperation) <= 0) then
    25669 +        return 0;
    25670 +    if (    \CfgVerifyFile(sPathIDASDK'\os2wat.cfg', fQuiet),
    25671 +        |   \CfgVerifyFile(sPathIDASDK'\d32wat.cfg', fQuiet),
    25672 +        |   \CfgVerifyFile(sPathIDASDK'\include\exehdr.h', fQuiet),
    25673 +        |   \CfgVerifyFile(sPathIDASDK'\include\ida.hpp', fQuiet),
    25674 +        |   \CfgVerifyFile(sPathIDASDK'\include\vm.hpp', fQuiet),
    25675 +        |   \CfgVerifyFile(sPathIDASDK'\libwat.os2\ida.lib', fQuiet),
    25676 +        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\ida.lib', fQuiet),
    25677 +        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\INIRT386.OBJ', fQuiet),
    25678 +      /*  |   \CfgVerifyFile(sPathIDASDK'\libbor.d32\ida.lib', fQuiet)*/,
    25679 +        ) then
    25680 +        return 2;
    25681 +return 0;
    25682 +
    25683 +
    25684 +/*
    25685 + * Interactive Disassembler (IDA) Plugin SDK (v5.0?)
    25686 + */
    25687 +IDASDK: procedure expose aCfg. aPath.
    25688 +    parse arg sToolId,sOperation,fRM,fQuiet
    25689 +    /*
    25690 +     * IDA main directory.
    25691 +     */
    25692 +    sPathIDASDK = PathQuery('idasdk', sToolId, sOperation);
    25693 +    if (sPathIDASDK = '') then
    25694 +        return 1;
    25695 +    /* If config operation we're done now. */
    25696 +    if (pos('config', sOperation) > 0) then
    25697 +        return 0;
    25698 +
    25699 +    /*
    25700 +     * Installing the environment variables.
    25701 +     */
    25702 +    call EnvSet      fRM, 'PATH_IDASDK',    sPathIDASDK
    25703 +    call EnvAddFront fRM, 'include',        sPathIDASDK'\include;'
    25704 +    call EnvAddFront fRM, 'lib',            sPathIDASDK'\libwat.os2;'
    25705 +    call EnvAddFront fRM, 'path',           sPathIDASDK'\bin\os2;'
    25706 +    call EnvAddFront fRM, 'beginlibpath',   sPathIDASDK'\bin\os2;'
    25707 +
    25708 +    /*
    25709 +     * Verify.
    25710 +     */
    25711 +    if (pos('verify', sOperation) <= 0) then
    25712 +        return 0;
    25713 +    if (    \CfgVerifyFile(sPathIDASDK'\os2wat.cfg', fQuiet),
    25714 +        |   \CfgVerifyFile(sPathIDASDK'\d32wat.cfg', fQuiet),
    25715 +        |   \CfgVerifyFile(sPathIDASDK'\include\exehdr.h', fQuiet),
    25716 +        |   \CfgVerifyFile(sPathIDASDK'\include\ida.hpp', fQuiet),
    25717 +        |   \CfgVerifyFile(sPathIDASDK'\include\vm.hpp', fQuiet),
    25718 +        |   \CfgVerifyFile(sPathIDASDK'\libwat.os2\ida.lib', fQuiet),
    25719 +        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\ida.lib', fQuiet),
    25720 +        |   \CfgVerifyFile(sPathIDASDK'\libwat.d32\INIRT386.OBJ', fQuiet),
    25721 +      /*  |   \CfgVerifyFile(sPathIDASDK'\libbor.d32\ida.lib', fQuiet)*/,
    25722 +        ) then
    25723 +        return 2;
    25724 +return 0;
    25725 +
    25726 +/*
    25727 + * icsdebug (IBM Visual Age for C++ v3.08 for OS/2)
    25728 + */
    25729 +icsdebug: procedure expose aCfg. aPath.
    25730 +    parse arg sToolId,sOperation,fRM,fQuiet
    25731 +
    25732 +    /*
    25733 +     * icsdebug (IBM Visual Age for C++ Version 3.08) main directory.
    25734 +     */
    25735 +    sPath = PathQuery('icsdebug', sToolId, sOperation);
    25736 +    if (sPath = '') then
    25737 +        return 1;
    25738 +    /* If config operation we're done now. */
    25739 +    if (pos('config', sOperation) > 0) then
    25740 +        return 0;
    25741 +
    25742 +    /*
    25743 +     * Installing the environment variables.
    25744 +     */
    25745 +    call EnvSet      fRM, 'PATH_ICSDEBUG',  sPath
    25746 +
    25747 +    call EnvAddFront fRM, 'beginlibpath',   sPath'\DLL;'
    25748 +    call EnvAddFront fRM, 'path',           sPath'\BIN;'
    25749 +    call EnvAddFront fRM, 'dpath',          sPath'\HELP;'sPath';'sPath'\LOCALE;'
    25750 +
    25751 +    /*
    25752 +     * Verify.
    25753 +     */
    25754 +    if (pos('verify', sOperation) <= 0) then
    25755 +        return 0;
    25756 +    if (    \CfgVerifyFile(sPath'\bin\icsdebug.exe', fQuiet),
    25757 +        |   \CfgVerifyFile(sPath'\help\dde4.msg', fQuiet),
    25758 +        |   \CfgVerifyFile(sPath'\help\dde4lde.msg', fQuiet),
    25759 +        |   \CfgVerifyFile(sPath'\dll\cppibs30.dll', fQuiet),
    25760 +        |   \CfgVerifyFile(sPath'\dll\cppom30.dll', fQuiet),
    25761 +        |   \CfgVerifyFile(sPath'\dll\cppoob3.dll', fQuiet),
    25762 +        |   \CfgVerifyFile(sPath'\dll\cppood3.dll', fQuiet),
    25763 +        |   \CfgVerifyFile(sPath'\dll\cppoou3.dll', fQuiet),
    25764 +        |   \CfgVerifyFile(sPath'\dll\dde4brsc.dll', fQuiet),
    25765 +        |   \CfgVerifyFile(sPath'\dll\dde4cr.dll', fQuiet),
    25766 +        |   \CfgVerifyFile(sPath'\dll\dde4cx.dll', fQuiet),
    25767 +        |   \CfgVerifyFile(sPath'\dll\dde4dsl.dll', fQuiet),
    25768 +        |   \CfgVerifyFile(sPath'\dll\dde4lde.dll', fQuiet),
    25769 +        |   \CfgVerifyFile(sPath'\dll\dde4modl.dll', fQuiet),
    25770 +        |   \CfgVerifyFile(sPath'\dll\dde4mth.dll', fQuiet),
    25771 +        |   \CfgVerifyFile(sPath'\dll\dde4pmdb.dll', fQuiet),
    25772 +        |   \CfgVerifyFile(sPath'\dll\dde4prt.dll', fQuiet),
    25773 +        |   \CfgVerifyFile(sPath'\dll\dde4ress.dll', fQuiet),
    25774 +        |   \CfgVerifyFile(sPath'\dll\dde4tk.dll', fQuiet),
    25775 +        |   \CfgVerifyFile(sPath'\dll\dde4trib.dll', fQuiet),
    25776 +        ) then
    25777 +        return 2;
    25778 +return 0;
    25779 +
    25780 +
    25781 +/*
    25782 + * idebug (Visual Age / C and C++ tools v3.6.5 for OS/2)
    25783 + */
    25784 +idebug: procedure expose aCfg. aPath.
    25785 +    parse arg sToolId,sOperation,fRM,fQuiet
    25786 +
    25787 +    /*
    25788 +     * IBM C/C++ Compiler and Tools Version 3.6.5 main directory.
    25789 +     */
    25790 +    sPath    = PathQuery('idebug', sToolId, sOperation);
    25791 +    if (sPath = '') then
    25792 +        return 1;
    25793 +    /* If config operation we're done now. */
    25794 +    if (pos('config', sOperation) > 0) then
    25795 +        return 0;
    25796 +
    25797 +    /*
    25798 +     * Installing the environment variables.
    25799 +     */
    25800 +    call EnvSet      fRM, 'PATH_IDEBUG', sPath;
    25801 +
    25802 +    call EnvAddFront fRM, 'path',        sPath'\bin;'
    25803 +    call EnvAddFront fRM, 'dpath',       sPath'\local;'sPath'\help;'
    25804 +    call EnvAddFront fRM, 'beginlibpath',sPath'\dll;'
    25805 +
    25806 +    /*
    25807 +     * Verify.
    25808 +     */
    25809 +    if (pos('verify', sOperation) <= 0) then
    25810 +        return 0;
    25811 +    if (    \CfgVerifyFile(sPath'\bin\idebug.exe', fQuiet),
    25812 +        |   \CfgVerifyFile(sPath'\dll\cppbhg36.dll', fQuiet),
    25813 +        |   \CfgVerifyFile(sPath'\dll\cppbpg36.dll', fQuiet),
    25814 +        |   \CfgVerifyFile(sPath'\dll\cppddle1.dll', fQuiet),
    25815 +        |   \CfgVerifyFile(sPath'\dll\cppddpm1.dll', fQuiet),
    25816 +        |   \CfgVerifyFile(sPath'\dll\cppdfer1.dll', fQuiet),
    25817 +        |   \CfgVerifyFile(sPath'\dll\cppdfhp1.dll', fQuiet),
    25818 +        |   \CfgVerifyFile(sPath'\dll\cppdfiw1.dll', fQuiet),
    25819 +        |   \CfgVerifyFile(sPath'\dll\cppdfpw1.dll', fQuiet),
    25820 +        |   \CfgVerifyFile(sPath'\dll\cppdftk1.dll', fQuiet),
    25821 +        |   \CfgVerifyFile(sPath'\dll\cppdqmq1.dll', fQuiet),
    25822 +        |   \CfgVerifyFile(sPath'\dll\cppdrq1.dll', fQuiet),
    25823 +        |   \CfgVerifyFile(sPath'\dll\cppdrx1.dll', fQuiet),
    25824 +        |   \CfgVerifyFile(sPath'\dll\cppdtcp1.dll', fQuiet),
    25825 +        |   \CfgVerifyFile(sPath'\dll\cppdunf1.dll', fQuiet),
    25826 +        |   \CfgVerifyFile(sPath'\dll\cppdxcx1.dll', fQuiet),
    25827 +        |   \CfgVerifyFile(sPath'\dll\cppdxsm1.dll', fQuiet),
    25828 +        |   \CfgVerifyFile(sPath'\dll\cpprdi36.dll', fQuiet),
    25829 +        |   \CfgVerifyFile(sPath'\dll\cpprmi36.dll', fQuiet),
    25830 +        |   \CfgVerifyFile(sPath'\dll\cpptb30.dll', fQuiet),
    25831 +        |   \CfgVerifyFile(sPath'\dll\cpptd30.dll', fQuiet),
    25832 +        |   \CfgVerifyFile(sPath'\dll\cpptu30.dll', fQuiet),
    25833 +        |   \CfgVerifyFile(sPath'\dll\cppxb30.dll', fQuiet),
    25834 +        |   \CfgVerifyFile(sPath'\dll\cppxd30.dll', fQuiet),
    25835 +        |   \CfgVerifyFile(sPath'\dll\cppxm30.dll', fQuiet),
    25836 +        |   \CfgVerifyFile(sPath'\dll\cppxm36.dll', fQuiet),
    25837 +        |   \CfgVerifyFile(sPath'\dll\cppxu30.dll', fQuiet),
    25838 +        |   \CfgVerifyFile(sPath'\help\cppdmg1.msg', fQuiet),
    25839 +        |   \CfgVerifyFile(sPath'\msg\cppdcc1.cat', fQuiet),
    25840 +        ) then
    25841 +        return 2;
    25842 +return 0;
    25843 +
    25844 +
    25845 +/*
    25846 + * JAVA v1.3.1 (latest)
    25847 + */
    25848 +Java131: procedure expose aCfg. aPath.
    25849 +    parse arg sToolId,sOperation,fRM,fQuiet
    25850 +    /*
    25851 +     * JAVA main directory.
    25852 +     */
    25853 +    sPathJava = PathQuery('java131', sToolId, sOperation);
    25854 +    if (sPathJava = '') then
    25855 +        return 1;
    25856 +    /* If config operation we're done now. */
    25857 +    if (pos('config', sOperation) > 0) then
    25858 +        return 0;
    25859 +
    25860 +    /*
    25861 +     * Installing the environment variables.
    25862 +     */
    25863 +    call EnvSet      fRM, 'PATH_JAVA',      sPathJava
    25864 +    call EnvSet      fRM, 'PATH_JAVA131',   sPathJava
    25865 +    call EnvAddFront fRM, 'path',           sPathJava'\bin;'sPathJava'\jre\bin;'
    25866 +    call EnvAddFront fRM, 'beginlibpath',   sPathJava'\jre\dll;'sPathJava'\jre\bin;'sPathJava'\icatjava\dll;'
    25867 +/*    call EnvAddFront fRM, 'classpath',      sPathJava'\jre\dll;'sPathJava'\jre\bin;'sPathJava'\icatjava\dll;'
    25868 +*/
    25869 +    /*
    25870 +     * Verify.
    25871 +     */
    25872 +    if (pos('verify', sOperation) <= 0) then
    25873 +        return 0;
    25874 +    if (    \CfgVerifyFile(sPathJava'\bin\javac.exe', fQuiet),
    25875 +        |   \CfgVerifyFile(sPathJava'\bin\jar.exe', fQuiet),
    25876 +        |   \CfgVerifyFile(sPathJava'\lib\tools.jar', fQuiet),
    25877 +        |   \CfgVerifyFile(sPathJava'\lib\javai.lib', fQuiet),
    25878 +        |   \CfgVerifyFile(sPathJava'\jre\dll\jv12mi36.dll', fQuiet),
    25879 +        |   \CfgVerifyFile(sPathJava'\jre\bin\java.exe', fQuiet),
    25880 +        |   \CfgVerifyFile(sPathJava'\jre\bin\jitc.dll', fQuiet),
    25881 +        |   \CfgVerifyFile(sPathJava'\jre\bin\javaw.exe', fQuiet),
    25882 +        |   \CfgVerifyFile(sPathJava'\jre\bin\rmid.exe', fQuiet),
    25883 +        |   \CfgVerifyFile(sPathJava'\jre\bin\classic\jvm.dll', fQuiet),
    25884 +        |   \CfgVerifyFile(sPathJava'\include\int64_md.h', fQuiet),
    25885 +        |   \CfgVerifyFile(sPathJava'\include\jawt.h', fQuiet),
    25886 +        |   \CfgVerifyFile(sPathJava'\include\jawt_md.h', fQuiet),
    25887 +        |   \CfgVerifyFile(sPathJava'\include\jni.h', fQuiet),
    25888 +        |   \CfgVerifyFile(sPathJava'\include\jniproto_md.h', fQuiet),
    25889 +        |   \CfgVerifyFile(sPathJava'\include\jni_md.h', fQuiet),
    25890 +        |   \CfgVerifyFile(sPathJava'\include\jvmdi.h', fQuiet),
    25891 +        |   \CfgVerifyFile(sPathJava'\include\jvmpi.h', fQuiet),
    25892 +        |   \CfgVerifyFile(sPathJava'\jre\bin\jitc_g.dll', fQuiet, 1),
    25893 +        |   \CfgVerifyFile(sPathJava'\jre\bin\classic\jvm_g.dll', fQuiet, 1),
    25894 +        ) then
    25895 +        return 2;
    25896 +
    25897 +return 0;
    25898 +
    25899 +
    25900 +/*
    25901 + * jitdbg (secret)
    25902 + */
    25903 +jitdbg: procedure expose aCfg. aPath.
    25904 +    parse arg sToolId,sOperation,fRM,fQuiet
    25905 +
    25906 +    /*
    25907 +     * IBM C/C++ Compiler and Tools Version 3.6.5 main directory.
    25908 +     */
    25909 +    sPath    = PathQuery('jitdbg', sToolId, sOperation);
    25910 +    if (sPath = '') then
    25911 +        return 1;
    25912 +    /* If config operation we're done now. */
    25913 +    if (pos('config', sOperation) > 0) then
    25914 +        return 0;
    25915 +
    25916 +    /*
    25917 +     * Installing the environment variables.
    25918 +     */
    25919 +    call EnvSet      fRM, 'PATH_JITDBG', sPath;
    25920 +
    25921 +    call EnvAddFront fRM, 'path',        sPath'\bin;'
    25922 +    call EnvAddFront fRM, 'dpath',       sPath'\msg;'sPath'\help;'
    25923 +    call EnvAddFront fRM, 'beginlibpath',sPath'\dll;'sPath'\extradlls;'
    25924 +    call EnvAddFront fRM, 'help',        sPath'\help;'
    25925 +
    25926 +    /*
    25927 +     * Verify.
    25928 +     */
    25929 +    if (pos('verify', sOperation) <= 0) then
    25930 +        return 0;
    25931 +    if (    \CfgVerifyFile(sPath'\bin\idbug.exe', fQuiet),
    25932 +        ) then
    25933 +        return 2;
    25934 +return 0;
    25935 +
    25936 +
    25937 +/*
    25938 + * (lib) JPEG v6b port.
    25939 + */
    25940 +JPEG: procedure expose aCfg. aPath.
    25941 +    parse arg sToolId,sOperation,fRM,fQuiet
    25942 +    sPathJPEG = PathQuery('jpeg', sToolId, sOperation);
    25943 +    if (sPathJPEG = '') then
    25944 +        return 1;
    25945 +    /* If config operation we're done now. */
    25946 +    if (pos('config', sOperation) > 0) then
    25947 +        return 0;
    25948 +    call EnvSet      fRm, 'PATH_JPEG',   sPathJPEG;
    25949 +    call EnvAddFront fRm, 'beginlibpath',sPathJPEG'\dll;'
    25950 +    call EnvAddFront fRm, 'path',        sPathJPEG'\bin;'
    25951 +    call EnvAddFront fRM, 'include',     sPathJPEG'\include;'
    25952 +    call EnvAddFront fRM, 'C_INCLUDE_PATH', sPathJPEG'\include;'
    25953 +    call EnvAddFront fRM, 'lib',         sPathJPEG'\lib;'
    25954 +
    25955 +    /*
    25956 +     * Verify.
    25957 +     */
    25958 +    if (pos('verify', sOperation) <= 0) then
    25959 +        return 0;
    25960 +
    25961 +    if (    \CfgVerifyFile(sPathJPEG'\bin\cjpeg.exe', fQuiet),
    25962 +        |   \CfgVerifyFile(sPathJPEG'\dll\jpeg.dll', fQuiet),
    25963 +        |   \CfgVerifyFile(sPathJPEG'\include\jpeglib.h', fQuiet),
    25964 +        |   \CfgVerifyFile(sPathJPEG'\lib\jpeg.a', fQuiet),
    25965 +        |   \CfgVerifyFile(sPathJPEG'\lib\jpeg.lib', fQuiet),
    25966 +        ) then
    25967 +        return 2;
    25968 +return 0;
    25969 +
    25970 +
    25971 +
    25972 +
    25973 +/*
    25974 + * Mode commandline.
    25975 + */
    25976 +Mode: procedure expose aCfg. aPath.
    25977 +    parse arg sToolId,sOperation,fRM,fQuiet,cols,rows
    25978 +
    25979 +    if (pos('install', sOperation) > 0 & pos('uninstall', sOperation) <= 0) then
    25980 +    do
    25981 +        say "ok!"
    25982 +        Address CMD 'mode' cols','rows
    25983 +    end
    25984 +    /* TODO
    25985 +    else if ((pos('uninstall', sOperation) > 0) | \fRM) then
    25986 +    do
    25987 +        say 'Huh?'
    25988 +        cols = 80;
    25989 +        rows = 25;
    25990 +    end
    25991 +    */
    25992 +return 0;
    25993 +
    25994 +
    25995 +/*
    25996 + * Microsoft C v6.0a 16-bit
    25997 + */
    25998 +MSCV6_16: procedure expose aCfg. aPath.
    25999 +    parse arg sToolId,sOperation,fRM,fQuiet
    26000 +
    26001 +    /*
    26002 +     * Microsoft C v6.0a main directory.
    26003 +     */
    26004 +    sPathMSC    = PathQuery('mscv6-16', sToolId, sOperation);
    26005 +    if (sPathMSC = '') then
    26006 +        return 1;
    26007 +    /* If config operation we're done now. */
    26008 +    if (pos('config', sOperation) > 0) then
    26009 +        return 0;
    26010 +
    26011 +    /*
    26012 +     * Installing the environment variables.
    26013 +     */
    26014 +    call EnvSet      fRM, 'BUILD_ENV',  'MSCV6-16'
    26015 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    26016 +    call EnvSet      fRM, 'PATH_MSC',   sPathMSC;
    26017 +    call EnvAddFront fRM, 'path',       sPathMSC'\binp;'
    26018 +    call EnvAddFront fRM, 'endlibpath', sPathMSC'\dll;'
    26019 +    call EnvAddFront fRM, 'helpfiles',  sPathMSC'\help;'
    26020 +    call EnvAddFront fRM, 'include',    sPathMSC'\include;'
    26021 +    call EnvAddFront fRM, 'include16',  sPathMSC'\include;'
    26022 +    call EnvAddFront fRM, 'lib',        sPathMSC'\lib;'
    26023 +
    26024 +    /*
    26025 +     * Verify.
    26026 +     */
    26027 +    if (pos('verify', sOperation) <= 0) then
    26028 +        return 0;
    26029 +    if (    \CfgVerifyFile(sPathMSC'\binp\cl.exe', fQuiet),
    26030 +        |   \CfgVerifyFile(sPathMSC'\lib\clibcep.lib', fQuiet),
    26031 +        |   \CfgVerifyFile(sPathMSC'\lib\llibcep.lib', fQuiet),
    26032 +        |   \CfgVerifyFile(sPathMSC'\lib\mlibcep.lib', fQuiet),
    26033 +        |   \CfgVerifyFile(sPathMSC'\lib\slibcep.lib', fQuiet),
    26034 +        |   \CfgVerifyFile(sPathMSC'\include\sysbits.h', fQuiet),
    26035 +        |   \CfgVerifyFile(sPathMSC'\include\dos.h', fQuiet),
    26036 +        |   \CfgVerifyFile(sPathMSC'\include\bios.h', fQuiet),
    26037 +        |   \CfgVerifyFile(sPathMSC'\include\string.h', fQuiet),
    26038 +        |   \CfgVerifyFile(sPathMSC'\include\stdio.h', fQuiet),
    26039 +        ) then
    26040 +        return 2;
    26041 +    rc = CheckCmdOutput('cl', 0, fQuiet, 'Microsoft (R) C Optimizing Compiler Version 6.00A.04');
    26042 +return rc;
    26043 +
    26044 +
    26045 +/*
    26046 + * Microsoft C v6.0a 32-bit
    26047 + */
    26048 +MSCV6_32: procedure expose aCfg. aPath.
    26049 +    parse arg sToolId,sOperation,fRM,fQuiet
    26050 +
    26051 +    /*
    26052 +     * Microsoft C v6.0a 32-bit main directory.
    26053 +     */
    26054 +    sPathDDKBase = PathQuery('ddkbase', sToolId, sOperation);
    26055 +    if (sPathDDKBase = '') then
    26056 +        return 1;
    26057 +    /* If config operation we're done now. */
    26058 +    if (pos('config', sOperation) > 0) then
    26059 +        return 0;
    26060 +
    26061 +    /*
    26062 +     * This is where the compiler really is.
    26063 +     */
    26064 +    call DDKBase 'ddkbase',sOperation,fRM,fQuiet;
    26065 +
    26066 +    /*
    26067 +     * Installing the environment variables.
    26068 +     */
    26069 +    call EnvSet      fRM, 'BUILD_ENV',  'MSCV6'
    26070 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    26071 +    call EnvSet      fRM, 'PATH_MSC',   sPathDDKBase;
    26072 +    call EnvAddFront fRM, 'include',    sPathDDKBase'\h386;'
    26073 +    call EnvAddFront fRM, 'lib',        sPathDDKBase'\lib;'
    26074 +
    26075 +    /*
    26076 +     * Verify.
    26077 +     */
    26078 +    if (pos('verify', sOperation) <= 0) then
    26079 +        return 0;
    26080 +    if (    \CfgVerifyFile(sPathDDKBase'\tools\cl386.exe', fQuiet),
    26081 +        |   \CfgVerifyFile(sPathDDKBase'\h386\limits.h', fQuiet),
    26082 +        |   \CfgVerifyFile(sPathDDKBase'\h386\string.h', fQuiet),
    26083 +        ) then
    26084 +        return 2;
    26085 +    rc = CheckCmdOutput('cl386', 0, fQuiet, 'Microsoft (R) Microsoft 386 C Compiler. Version 6.00.054');
    26086 +return rc;
    26087 +
    26088 +
    26089 +/*
    26090 + * Microsoft C v7.0 16-bit with OS/2 support.
    26091 + */
    26092 +MSCV7_16: procedure expose aCfg. aPath.
    26093 +    parse arg sToolId,sOperation,fRM,fQuiet
    26094 +
    26095 +    /*
    26096 +     * Microsoft C v6.0a main directory.
    26097 +     */
    26098 +    sPathMSC    = PathQuery('mscv7-16', sToolId, sOperation);
    26099 +    if (sPathMSC = '') then
    26100 +        return 1;
    26101 +    /* If config operation we're done now. */
    26102 +    if (pos('config', sOperation) > 0) then
    26103 +        return 0;
    26104 +
    26105 +    /*
    26106 +     * Installing the environment variables.
    26107 +     */
    26108 +    call EnvSet      fRM, 'BUILD_ENV',  'MSCV7-16'
    26109 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    26110 +    call EnvSet      fRM, 'PATH_MSC',   sPathMSC;
    26111 +    call EnvAddFront fRM, 'path',       sPathMSC'\binp;'
    26112 +    call EnvAddFront fRM, 'endlibpath', sPathMSC'\dll;'
    26113 +    call EnvAddFront fRM, 'helpfiles',  sPathMSC'\help;'
    26114 +    call EnvAddFront fRM, 'include',    sPathMSC'\include;'
    26115 +    call EnvAddFront fRM, 'include16',  sPathMSC'\include;'
    26116 +    call EnvAddFront fRM, 'lib',        sPathMSC'\lib;'
    26117 +
    26118 +    /*
    26119 +     * Verify.
    26120 +     */
    26121 +    if (pos('verify', sOperation) <= 0) then
    26122 +        return 0;
    26123 +    if (    \CfgVerifyFile(sPathMSC'\binp\cl.exe', fQuiet),
    26124 +        |   \CfgVerifyFile(sPathMSC'\binp\link.exe', fQuiet),
    26125 +        |   \CfgVerifyFile(sPathMSC'\binp\ilink.exe', fQuiet),
    26126 +       /* |   \CfgVerifyFile(sPathMSC'\lib\clibcep.lib', fQuiet),
    26127 +        |   \CfgVerifyFile(sPathMSC'\lib\llibcep.lib', fQuiet),
    26128 +        |   \CfgVerifyFile(sPathMSC'\lib\mlibcep.lib', fQuiet),
    26129 +        |   \CfgVerifyFile(sPathMSC'\lib\slibcep.lib', fQuiet)*/,
    26130 +        |   \CfgVerifyFile(sPathMSC'\include\dos.h', fQuiet),
    26131 +        |   \CfgVerifyFile(sPathMSC'\include\bios.h', fQuiet),
    26132 +        |   \CfgVerifyFile(sPathMSC'\include\locale.h', fQuiet),
    26133 +        |   \CfgVerifyFile(sPathMSC'\include\stdiostr.h', fQuiet),
    26134 +        |   \CfgVerifyFile(sPathMSC'\include\string.h', fQuiet),
    26135 +        |   \CfgVerifyFile(sPathMSC'\include\vmemory.h', fQuiet),
    26136 +        |   \CfgVerifyFile(sPathMSC'\include\stdio.h', fQuiet),
    26137 +        ) then
    26138 +        return 2;
    26139 +    rc = CheckCmdOutput('cl', 0, fQuiet, 'Microsoft (R) C/C++ Optimizing Compiler Version 7.00');
    26140 +return rc;
    26141 +
    26142 +
    26143 +
    26144 +
    26145 +/*
    26146 + * mySQL Database system
    26147 + */
    26148 +mySQL: procedure expose aCfg. aPath.
    26149 +    parse arg sToolId,sOperation,fRM,fQuiet
    26150 +
    26151 +    /*
    26152 +     * mySQL Database system main directory.
    26153 +     */
    26154 +    sPathMySQL    = PathQuery('mysql', sToolId, sOperation);
    26155 +    if (sPathMySQL = '') then
    26156 +        return 1;
    26157 +    /* If config operation we're done now. */
    26158 +    if (pos('config', sOperation) > 0) then
    26159 +        return 0;
    26160 +
    26161 +    /*
    26162 +     * Installing the environment variables.
    26163 +     */
    26164 +    call EnvSet      fRM, 'PATH_MYSQL',     sPathMySQL;
    26165 +    call EnvAddFront fRM, 'path',           sPathMySQL'\bin;'
    26166 +    call EnvAddFront fRM, 'beginlibpath',   sPathMySQL'\dll;'
    26167 +    call EnvAddFront fRM, 'include',        sPathMySQL'\include;'
    26168 +    call EnvAddFront fRM, 'bookshelf',      sPathMySQL'\doc;'sPathMySQL'\book';
    26169 +    /*call EnvAddFront fRM, 'lib',            sPathMySQL'\lib;'*/
    26170 +
    26171 +    /*
    26172 +     * Verify.
    26173 +     */
    26174 +    if (pos('verify', sOperation) <= 0) then
    26175 +        return 0;
    26176 +    if (    \CfgVerifyFile(sPathMySQL'\bin\mysql.exe', fQuiet),
    26177 +        |   \CfgVerifyFile(sPathMySQL'\bin\mysqld.exe', fQuiet),
    26178 +        |   \CfgVerifyFile(sPathMySQL'\bin\mysqladmin.exe', fQuiet),
    26179 +        |   \CfgVerifyFile(sPathMySQL'\dll\mysql.dll', fQuiet),
    26180 +        |   \CfgVerifyFile(sPathMySQL'\include\mysql.h', fQuiet),
    26181 +        |   \CfgVerifyFile(sPathMySQL'\include\mysql_com.h', fQuiet),
    26182 +        |   \CfgVerifyFile(sPathMySQL'\include\mysql_version.h', fQuiet),
    26183 +        ) then
    26184 +        return 2;
    26185 +    rc = CheckCmdOutput('mysql --version', 0, fQuiet, ', for ');
    26186 +return rc;
    26187 +
    26188 +
    26189 +
    26190 +/*
    26191 + * NASM - NetWide Assembler (all versions)
    26192 + */
    26193 +NASM: procedure expose aCfg. aPath.
    26194 +    parse arg sToolId,sOperation,fRM,fQuiet,sPathId
    26195 +
    26196 +    /*
    26197 +     * Get NASM directory
    26198 +     */
    26199 +    sPathNASM = PathQuery(sPathId, sToolId, sOperation);
    26200 +    if (sPathNASM = '') then
    26201 +        return 1;
    26202 +    /* If config operation we're done now. */
    26203 +    if (pos('config', sOperation) > 0) then
    26204 +        return 0;
    26205 +
    26206 +    /*
    26207 +     * Installing the environment variables.
    26208 +     */
    26209 +    call EnvSet      fRM, 'PATH_NASM',      sPathNASM;
    26210 +    call EnvAddFront fRM, 'path',           sPathNASM
    26211 +
    26212 +    /*
    26213 +     * Verify.
    26214 +     */
    26215 +    if (pos('verify', sOperation) <= 0) then
    26216 +        return 0;
    26217 +    if (    \CfgVerifyFile(sPathNASM'\nasm.exe', fQuiet),
    26218 +        |   \CfgVerifyFile(sPathNASM'\ndisasm.exe', fQuiet),
    26219 +        ) then
    26220 +        return 2;
    26221 +    select
    26222 +        when (sPathId = 'nasm9833') then    sVer = '0.98.33 compiled';
    26223 +        otherwise do; say 'internal error invalid pathid! sPathId='sPathId; exit(16); end
    26224 +    end
    26225 +    rc = CheckCmdOutput('nasm -version', 0, fQuiet, 'NASM version '||sVer);
    26226 +    if (rc = 0) then
    26227 +        rc = CheckCmdOutput('ndisasm -version', 0, fQuiet, 'NDISASM version '||sVer);
    26228 +return rc;
    26229 +
    26230 +
    26231 +
    26232 +/*
    26233 + * NetQOS2 - help subsystem++ for VAC 3.6.5 and VAC 4.0
    26234 + */
    26235 +NetQOS2: procedure expose aCfg. aPath.
    26236 +    parse arg sToolId,sOperation,fRM,fQuiet
    26237 +    sPathNetQOS2 = PathQuery('netqos2', sToolId, sOperation);
    26238 +    if (sPathNetQOS2 = '') then
    26239 +        return 1;
    26240 +    /* If config operation we're done now. */
    26241 +    if (pos('config', sOperation) > 0) then
    26242 +        return 0;
    26243 +
    26244 +    /*
    26245 +     * Installing the environment variables.
    26246 +     */
    26247 +    call EnvSet      fRM, 'PATH_NETQOS2',   sPathNetQOS2
    26248 +    call EnvAddFront fRM, 'path',           sPathNetQOS2';'
    26249 +    call EnvAddFront fRM, 'dpath',          sPathNetQOS2';'
    26250 +    call EnvAddFront fRM, 'beginlibpath',   sPathNetQOS2';'
    26251 +    call EnvSet      fRM, 'imndatasrv',     sPathNetQOS2'\DATA'
    26252 +    call EnvSet      fRM, 'imndatacl',      sPathNetQOS2'\DATA'
    26253 +    call EnvSet      fRM, 'imnworksrv',     sPathNetQOS2'\WORK'
    26254 +    call EnvSet      fRM, 'imnworkcl',      sPathNetQOS2'\WORK'
    26255 +    call EnvSet      fRM, 'imnnlpssrv',     sPathNetQOS2
    26256 +    call EnvSet      fRM, 'imnnlpscl',      sPathNetQOS2
    26257 +    call EnvSet      fRM, 'imncccfgfile',   'NETQ.CFG'
    26258 +    call EnvSet      fRM, 'imncscfgfile',   'NETQ.CFG'
    26259 +    call EnvSet      fRM, 'imqconfigsrv',   sPathNetQOS2'\instance'
    26260 +    call EnvSet      fRM, 'imqconfigcl',    sPathNetQOS2'\instance\dbcshelp'
    26261 +
    26262 +    /*
    26263 +     * Verify.
    26264 +     */
    26265 +    if (pos('verify', sOperation) <= 0) then
    26266 +        return 0;
    26267 +    if (    \CfgVerifyFile(sPathNetQOS2'\netq.exe', fQuiet),
    26268 +        ) then
    26269 +        return 2;
    26270 +    rc = CheckCmdOutput('netq', 999, fQuiet, 'NETQ {START | STOP');
    26271 +return rc;
    26272 +
    26273 +
    26274 +/*
    26275 + * Odin32 testcase setup.
    26276 + */
    26277 +Odin32Testcase: procedure expose aCfg. aPath.
    26278 +    parse arg sToolId,sOperation,fRM,fQuiet
    26279 +    if (  PathQuery('testcase_drive_unused', sToolId, sOperation) = '',
    26280 +        | PathQuery('testcase_drive_fixed', sToolId, sOperation) = '',
    26281 +        | PathQuery('testcase_drive_floppy', sToolId, sOperation) = '',
    26282 +        | PathQuery('testcase_drive_cdrom', sToolId, sOperation) = '',
    26283 +        ) then
    26284 +        return 1;
    26285 +    /* If config operation we're done now. */
    26286 +    if (pos('config', sOperation) > 0) then
    26287 +        return 0;
    26288 +
    26289 +    /*
    26290 +     * Installing the environment variables.
    26291 +     */
    26292 +    call EnvSet      fRM, 'odin32_testcase_drive_unused',       PathQuery('testcase_drive_unused', sToolId, sOperation);
    26293 +    call EnvSet      fRM, 'odin32_testcase_drive_fixed',        PathQuery('testcase_drive_fixed', sToolId, sOperation);
    26294 +    call EnvSet      fRM, 'odin32_testcase_drive_floppy',       PathQuery('testcase_drive_floppy', sToolId, sOperation);
    26295 +    call EnvSet      fRM, 'odin32_testcase_drive_cdrom',        PathQuery('testcase_drive_cdrom', sToolId, sOperation);
    26296 +    call EnvSet      fRM, 'odin32_testcase_drive_network',      PathQuery('testcase_drive_network', sToolId, sOperation, 1);
    26297 +    call EnvSet      fRM, 'odin32_testcase_drive_ramdisk',      PathQuery('testcase_drive_ramdisk', sToolId, sOperation, 1);
    26298 +
    26299 +    /*
    26300 +     * Verify.
    26301 +     */
    26302 +    if (pos('verify', sOperation) <= 0) then
    26303 +        return 0;
    26304 +return 0;
    26305 +
    26306 +
    26307 +/*
    26308 + * PERL 5005_53 or 5.004_55
    26309 + */
    26310 +Perl50xxx: procedure expose aCfg. aPath.
    26311 +    parse arg sToolId,sOperation,fRM,fQuiet
    26312 +
    26313 +    /*
    26314 +     * Perl main directory.
    26315 +     */
    26316 +    sPathPerl       = PathQuery('perl50xxx', sToolId, sOperation);
    26317 +    if (sPathPerl = '') then
    26318 +        return 1;
    26319 +    /* If config operation we're done now. */
    26320 +    if (pos('config', sOperation) > 0) then
    26321 +        return 0;
    26322 +
    26323 +    /*
    26324 +     * Installing the environment variables.
    26325 +     */
    26326 +    sPathPerlForw   = translate(sPathPerl, '/', '\');
    26327 +    call EnvSet      fRM, 'PATH_PERL',      sPathPerl;
    26328 +    call EnvAddFront fRM, 'path',           sPathPerl'\bin;'
    26329 +    call EnvAddFront fRM, 'beginlibpath',   sPathPerl'\dll;'
    26330 +    call EnvAddEnd   fRM, 'bookshelf',      sPathPerl'\book;'
    26331 +    call EnvSet      fRM, 'perllib_prefix', sPathPerlForw'/lib;'sPathPerlForw'/lib'
    26332 +    call EnvSet      fRM, 'perl_sh_dir',    sPathPerlForw'/bin_sh'
    26333 +    call EnvSet      fRM, 'manpath',        sPathPerlForw'/man'
    26334 +    call EnvSet      fRM, 'perl5lib',       sPathPerlForw'/lib'
    26335 +    call EnvSet      fRM, 'perl_badlang',   '0'
    26336 +
    26337 +    /*
    26338 +     * Verify.
    26339 +     */
    26340 +    if (pos('verify', sOperation) <= 0) then
    26341 +        return 0;
    26342 +
    26343 +    sPerlDLL = 'perl.dll';
    26344 +    sVer     = '5.004_55';
    26345 +    f5005_53 = FileExists(sPathPerl'\dll\perlE0AC.dll');
    26346 +    if (f5005_53) then
    26347 +    do
    26348 +        sPerlDLL = 'perlE0AC.dll';
    26349 +        sVer     = '5.005_53';
    26350 +    end
    26351 +    if (    \CfgVerifyFile(sPathPerl'\bin\perl.exe', fQuiet),
    26352 +        |   \CfgVerifyFile(sPathPerl'\dll\'||sPerlDLL, fQuiet),
    26353 +        ) then
    26354 +        return 2;
    26355 +    rc = CheckCmdOutput('perl --version', 0, fQuiet, 'This is perl, version '||sVer||' built for os2');
    26356 +return rc;
    26357 +
    26358 +
    26359 +/*
    26360 + * PERL v5.8.0
    26361 + */
    26362 +Perl580: procedure expose aCfg. aPath.
    26363 +    parse arg sToolId,sOperation,fRM,fQuiet
    26364 +
    26365 +    /*
    26366 +     * Perl main directory.
    26367 +     */
    26368 +    sPathPerl       = PathQuery('perl580', sToolId, sOperation);
    26369 +    if (sPathPerl = '') then
    26370 +        return 1;
    26371 +    /* If config operation we're done now. */
    26372 +    if (pos('config', sOperation) > 0) then
    26373 +        return 0;
    26374 +
    26375 +    /*
    26376 +     * Installing the environment variables.
    26377 +     */
    26378 +    sPathPerlForw   = translate(sPathPerl, '/', '\');
    26379 +    call EnvSet      fRM, 'PATH_PERL',      sPathPerl;
    26380 +    call EnvAddFront fRM, 'path',           sPathPerl'\bin\5.8.0;'
    26381 +    call EnvAddFront fRM, 'beginlibpath',   sPathPerl'\lib;'
    26382 +    call EnvAddEnd   fRM, 'bookshelf',      sPathPerl'\doc;'
    26383 +    call EnvSet      fRM, 'perllib_prefix', 'L:/Perl/lib;'sPathPerlForw'/lib'
    26384 +    call EnvSet      fRM, 'perl_sh_dir',    sPathPerlForw'/bin/5.8.0'
    26385 +    call EnvSet      fRM, 'manpath',        sPathPerlForw'/man'
    26386 +    call EnvSet      fRM, 'perl_badlang',   '0'
    26387 +
    26388 +    /*
    26389 +     * Verify.
    26390 +     */
    26391 +    if (pos('verify', sOperation) <= 0) then
    26392 +        return 0;
    26393 +
    26394 +    if (    \CfgVerifyFile(sPathPerl'\bin\5.8.0\perl.exe', fQuiet),
    26395 +        |   \CfgVerifyFile(sPathPerl'\lib\perlB12E.dll', fQuiet),
    26396 +        |   \CfgVerifyFile(sPathPerl'\bin\5.8.0\sh.exe', fQuiet),
    26397 +        ) then
    26398 +        return 2;
    26399 +    rc = CheckCmdOutput('perl --version', 0, fQuiet, 'This is perl, v5.8.0 built for os2_emx');
    26400 +
    26401 +return rc;
    26402 +
    26403 +
    26404 +/*
    26405 + * Python/2 v1.5.2
    26406 + */
    26407 +Python: procedure expose aCfg. aPath.
    26408 +    parse arg sToolId,sOperation,fRM,fQuiet
    26409 +
    26410 +    /*
    26411 +     * The Python Home directory
    26412 +     */
    26413 +    sPythonHome = PathQuery('python', sToolId, sOperation);
    26414 +    if (sPythonHome = '') then
    26415 +        return 1;
    26416 +    /* If config operation we're done now. */
    26417 +    if (pos('config', sOperation) > 0) then
    26418 +        return 0;
    26419 +
    26420 +    /*
    26421 +     * Installing the environment variables.
    26422 +     */
    26423 +    call EnvSet      fRM, 'PATH_PYTHON',    sPythonHome
    26424 +    call EnvSet      fRM, 'pythonhome',     sPythonHome
    26425 +    call EnvSet      fRM, 'pythonpath',     '.;'sPythonHome'\Lib;'sPythonHome'\Lib\plat-win;'sPythonHome'\Lib\lib-tk;'sPythonHome'\Lib\lib-dynload;'sPythonHome'\Lib\site-packages;'sPythonHome'\Lib\dos-8x3'
    26426 +    call EnvAddFront fRM, 'beginlibpath',   sPythonHome
    26427 +    call EnvAddFront fRM, 'path',           sPythonHome
    26428 +
    26429 +    /*
    26430 +     * Verify.
    26431 +     */
    26432 +    if (pos('verify', sOperation) <= 0) then
    26433 +        return 0;
    26434 +    if (    \CfgVerifyFile(sPythonHome'\Python.exe', fQuiet),
    26435 +        |   \CfgVerifyFile(sPythonHome'\Python15.dll', fQuiet),
    26436 +        ) then
    26437 +        return 2;
    26438 +    rc = CheckCmdOutput('echo print "hello world" | python', 0, fQuiet, 'hello world');
    26439 +return rc;
    26440 +
    26441 +
    26442 +/*
    26443 + * Subversion (svn)
    26444 + */
    26445 +Subversion: procedure expose aCfg. aPath.
    26446 +    parse arg sToolId,sOperation,fRM,fQuiet
    26447 +
    26448 +
    26449 +    /*
    26450 +     * The directories.
    26451 +     */
    26452 +    sPathCVS = PathQuery('svn', sToolId, sOperation);
    26453 +    if (sPathCVS = '') then
    26454 +        return 1;
    26455 +    sPathHome = PathQuery('home', sToolId, sOperation);
    26456 +    if (sPathHome = '') then
    26457 +        return 1;
    26458 +    /* If config operation we're done now. */
    26459 +    if (pos('config', sOperation) > 0) then
    26460 +        return 0;
    26461 +
    26462 +    /*
    26463 +     * Installing the environment variables.
    26464 +     */
    26465 +    call EnvSet      fRM, 'PATH_SVN',    sPathCVS;
    26466 +    call EnvAddFront fRM, 'path',        sPathCVS';'
    26467 +    call EnvSet      fRM, 'home',        translate(sPathHome, '/','\');
    26468 +
    26469 +    /*
    26470 +     * Verify.
    26471 +     */
    26472 +    if (pos('verify', sOperation) <= 0) then
    26473 +        return 0;
    26474 +
    26475 +    if (\CfgVerifyFile(sPathCVS'\svn.exe',fQuiet)) then
    26476 +            return 2;
    26477 +    if (length(sPathHome) <= 2) then
    26478 +    do
    26479 +        if (\fQuiet) then
    26480 +            say 'Error: The home directory is to short!';
    26481 +        return 2;
    26482 +    end
    26483 +    if (\CfgVerifyDir(sPathHome, fQuiet)) then
    26484 +        return 2;
    26485 +return CheckCmdOutput('svn.exe --version', 0, fQuiet, 'svn, version 1.');
    26486 +
    26487 +
    26488 +
    26489 +/*
    26490 + * OS/2 Programmers Toolkit v4.0 (CSD1/4)
    26491 + */
    26492 +Toolkit40: procedure expose aCfg. aPath.
    26493 +    parse arg sToolId,sOperation,fRM,fQuiet
    26494 +
    26495 +    /*
    26496 +     * Toolkit (4.0) main directory.
    26497 +     */
    26498 +    sPathTK    = PathQuery('toolkit40', sToolId, sOperation);
    26499 +    if (sPathTK = '') then
    26500 +        return 1;
    26501 +    /* If config operation we're done now. */
    26502 +    if (pos('config', sOperation) > 0) then
    26503 +        return 0;
    26504 +
    26505 +    /*
    26506 +     * Installing the environment variables.
    26507 +     */
    26508 +    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    26509 +    call EnvAddFront fRM, 'beginlibpath',   sPathTK'\archived;'sPathTK'\SAMPLES\MM\DLL;'sPathTK'\SAMPLES\OPENDOC\PARTS\DLL;'sPathTK'\SOM\COMMON\DLL;'sPathTK'\SOM\LIB;'sPathTK'\OPENDOC\BASE\DLL;'sPathTK'\OPENDOC\BASE\LOCALE\EN_US;'sPathTK'\DLL;'
    26510 +    call EnvAddFront fRM, 'path',           sPathTK'\archived;'sPathTK'\SOM\COMMON;'sPathTK'\SOM\BIN;.;'sPathTK'\OPENDOC\BASE\BIN;'sPathTK'\BIN;'
    26511 +    call EnvAddFront fRM, 'dpath',          sPathTK'\SOM\COMMON\SYSTEM;'sPathTK'\SOM\MSG;'sPathTK'\OPENDOC\BASE\MSG;'sPathTK'\BOOK;'sPathTK'\MSG;'
    26512 +    call EnvAddFront fRM, 'help',           sPathTK'\archived;'sPathTK'\OPENDOC\BASE\LOCALE\EN_US;'sPathTK'\HELP;'
    26513 +    call EnvAddFront fRM, 'bookshelf',      sPathTK'\archived;'sPathTK'\BOOK;'sPathTK'\ARCHIVED;'
    26514 +    call EnvAddFront fRM, 'somir',          sPathTK'\SOM\COMMON\ETC\214\SOM.IR;'sPathTK'\OPENDOC\BASE\AVLSHELL.IR;'
    26515 +    call EnvAddEnd   fRM, 'somir',          sPathTK'\OPENDOC\CUSTOM\OD.IR;'sPathTK'\SAMPLES\REXX\SOM\ANIMAL\ORXSMP.IR;'
    26516 +/*    call EnvAddFront fRM, 'include',        sPathTK'\SPEECH\H;''sPathTK'\SAMPLES\OPENDOC\PARTS\INCLUDE;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'sPathTK'\H\GL;'sPathTK'\H;' */
    26517 +    call EnvAddFront fRM, 'include',        /*sPathTK'\SPEECH\H;'*/sPathTK'\SAMPLES\OPENDOC\PARTS\INCLUDE;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'sPathTK'\H\GL;'sPathTK'\H;'
    26518 +    call EnvAddEnd   fRM, 'include',        sPathTK'\H\LIBC;.;'
    26519 +    call EnvAddFront fRM, 'lib',            sPathTK'\SPEECH\LIB;'sPathTK'\SAMPLES\MM\LIB;'sPathTK'\LIB;'sPathTK'\SOM\LIB;'sPathTK'\OPENDOC\BASE\LIB;'
    26520 +    call EnvAddFront fRM, 'nlspath',        sPathTK'\OPENDOC\BASE\LOCALE\EN_US\%N;'sPathTK'\MSG\%N;C:\MPTN\MSG\NLS\%N;C:\TCPIP\msg\ENUS850\%N;'
    26521 +    call EnvAddFront fRM, 'locpath',        sPathTK'\OPENDOC\BASE\LOCALE;'
    26522 +    call EnvAddFront fRM, 'ipfc',           sPathTK'\IPFC;'
    26523 +    call EnvSet      fRM, 'odbase',         sPathTK'\OPENDOC\BASE'
    26524 +    call EnvSet      fRM, 'odlang',         'en_US'
    26525 +    call EnvAddFront fRM, 'odbasepaths',    sPathTK'\OPENDOC\BASE;'
    26526 +    call EnvSet      fRM, 'odcfg',          sPathTK'\OPENDOC\CUSTOM'
    26527 +    call EnvSet      fRM, 'odtmp',          EnvGet('tmp');
    26528 +    call EnvSet      fRM, 'sombase',        sPathTK'\SOM'
    26529 +    call EnvSet      fRM, 'somruntime',     sPathTK'\SOM\COMMON'
    26530 +
    26531 +    call EnvSet      fRM, 'cpref',          'CP1.INF+CP2.INF+CP3.INF'
    26532 +    call EnvSet      fRM, 'gpiref',         'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    26533 +    call EnvSet      fRM, 'mmref',          'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    26534 +    call EnvSet      fRM, 'pmref',          'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    26535 +    call EnvSet      fRM, 'wpsref',         'WPS1.INF+WPS2.INF+WPS3.INF'
    26536 +    call EnvAddFront fRM, 'sminclude',      sPathTK'\H;'sPathTK'\IDL;'sPathTK'\SOM\INCLUDE;.;'sPathTK'\OPENDOC\BASE\INCLUDE;'sPathTK'\SAMPLES\OPENDOC\PARTS\INCLUDE;'
    26537 +    call EnvSet      fRM, 'smaddstar',      '1'
    26538 +    call EnvSet      fRM, 'smemit',         'h;ih;c'
    26539 +    call EnvSet      fRM, 'smtmp',          EnvGet('tmp');
    26540 +    call EnvSet      fRM, 'smclasses',      'WPTYPES.IDL'
    26541 +    call EnvSet      fRM, 'odparts',        sPathTK'\SAMPLES\OPENDOC\PARTS'
    26542 +    call EnvSet      fRM, 'odsrc',          sPathTK'\SAMPLES\OPENDOC\PARTS'
    26543 +    call EnvAddFront fRM, 'odpartspaths',   sPathTK'\SAMPLES\OPENDOC\PARTS;'
    26544 +    call EnvAddFront fRM, 'odsrcpaths',     sPathTK'\SAMPLES\OPENDOC\PARTS;'
    26545 +    /*
    26546 +    call EnvSet      fRM, 'CAT_MACHINE=COM1:57600'
    26547 +    call EnvSet      fRM, 'CAT_HOST_BIN_PATH='sPathTK'\BIN'
    26548 +    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE=ASYNC_SIGBRK'
    26549 +    call EnvAddFront fRM, 'CAT_HOST_SOURCE_PATH='sPathTK'\BIN;'
    26550 +    */
    26551 +
    26552 +    /*
    26553 +     * Verify.
    26554 +     */
    26555 +    if (pos('verify', sOperation) <= 0) then
    26556 +        return 0;
    26557 +    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    26558 +        |   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet),
    26559 +        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    26560 +        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    26561 +        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    26562 +        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    26563 +        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    26564 +        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    26565 +        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    26566 +        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    26567 +        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    26568 +        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    26569 +        |   \CfgVerifyFile(sPathTK'\som\bin\sc.exe', fQuiet),
    26570 +        ) then
    26571 +        return 2;
    26572 +
    26573 +    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,,,,
    26574 +                       'IBM Developer''s Toolkit for OS/2 Warp Version 4',,
    26575 +                       15, '0');
    26576 +    if (rc = 0) then
    26577 +        rc = CheckCmdOutput('sc -V', -1, fQuiet, '", Version: 2.54.');
    26578 +    if (rc = 0) then
    26579 +        rc = CheckCmdOutput('rc', 0, fQuiet, 'IBM RC (Resource Compiler) Version 5.00.00');
    26580 +    if (rc = 0) then
    26581 +        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.00');
    26582 +
    26583 +return rc;
    26584 +
    26585 +
    26586 +
    26587 +/*
    26588 + * OS/2 Programmers Toolkit v4.5
    26589 + */
    26590 +Toolkit45: procedure expose aCfg. aPath.
    26591 +    parse arg sToolId,sOperation,fRM,fQuiet
    26592 +
    26593 +    /*
    26594 +     * Toolkit (4.5) main directory.
    26595 +     */
    26596 +     sPathTK    = PathQuery('toolkit45', sToolId, sOperation);
    26597 +    if (sPathTK = '') then
    26598 +        return 1;
    26599 +    /* If config operation we're done now. */
    26600 +    if (pos('config', sOperation) > 0) then
    26601 +        return 0;
    26602 +
    26603 +    /*
    26604 +     * Installing the environment variables.
    26605 +     */
    26606 +    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    26607 +    call EnvAddFront fRM, 'path',        sPathTK'\bin;'
    26608 +    call EnvAddFront fRM, 'dpath',       sPathTK'\book;'
    26609 +    call EnvAddFront fRM, 'dpath',       sPathTK'\msg;'
    26610 +    call EnvAddFront fRM, 'beginlibpath', sPathTK'\dll;'
    26611 +    call EnvAddFront fRM, 'help',        sPathTK'\help;'
    26612 +    call EnvAddFront fRM, 'bookshelf',   sPathTK'\archived;'
    26613 +    call EnvAddFront fRM, 'bookshelf',   sPathTK'\book;'
    26614 +    call EnvAddFront fRM, 'nlspath',     sPathTK'\msg\%N;'
    26615 +    call EnvAddEnd   fRM, 'ulspath',     sPathTK'\language;'
    26616 +    call EnvAddFront fRM, 'include',     sPathTK'\H;'
    26617 +/*    call EnvAddFront fRM, 'include',     sPathTK'\H\GL;' */
    26618 +/*    call EnvAddFront fRM, 'include',     sPathTK'\SPEECH\H;' includes tend to get too long :-( */
    26619 +    call EnvAddFront fRM, 'include',     sPathTK'\H\RPC;'
    26620 +    call EnvAddFront fRM, 'include',     sPathTK'\H\NETNB;'
    26621 +    call EnvAddFront fRM, 'include',     sPathTK'\H\NETINET;'
    26622 +    call EnvAddFront fRM, 'include',     sPathTK'\H\NET;'
    26623 +    call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'
    26624 +    call EnvAddFront fRM, 'include',     sPathTK'\INC;'
    26625 +    call EnvAddEnd   fRM, 'lib',         sPathTK'\SAMPLES\MM\LIB;'
    26626 +    call EnvAddEnd   fRM, 'lib',         sPathTK'\SPEECH\LIB;'
    26627 +    call EnvAddFront fRM, 'lib',         sPathTK'\lib;'
    26628 +    call EnvAddFront fRM, 'helpndx',     'EPMKWHLP.NDX+', '+'
    26629 +    call EnvAddFront fRM, 'ipfc',        sPathTK'\ipfc;'
    26630 +    call EnvSet      fRM, 'LANG',        'en_us'
    26631 +    call EnvSet      fRM, 'CPREF',       'CP1.INF+CP2.INF+CP3.INF'
    26632 +    call EnvSet      fRM, 'GPIREF',      'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    26633 +    call EnvSet      fRM, 'MMREF',       'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    26634 +    call EnvSet      fRM, 'PMREF',       'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    26635 +    call EnvSet      fRM, 'WPSREF',      'WPS1.INF+WPS2.INF+WPS3.INF'
    26636 +    /*
    26637 +    call EnvSet      fRM, 'CAT_MACHINE', 'COM1:57600'
    26638 +    call EnvSet      fRM, 'CAT_HOST_BIN_PATH', TKMAIN'\BIN'
    26639 +    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE', 'ASYNC_SIGBRK'
    26640 +    call EnvSet      fRM, 'CAT_HOST_SOURCE_PATH',TKMAIN'\BIN;'
    26641 +    */
    26642 +
    26643 +    /*
    26644 +     * Verify.
    26645 +     */
    26646 +    if (pos('verify', sOperation) <= 0) then
    26647 +        return 0;
    26648 +    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    26649 +        |   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet),
    26650 +        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    26651 +        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    26652 +        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    26653 +        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    26654 +        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    26655 +        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    26656 +        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    26657 +        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    26658 +        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    26659 +        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    26660 +        |    FileExists(sPathTK'\som\bin\sc.exe'),
    26661 +        ) then
    26662 +        return 2;
    26663 +
    26664 +    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,
    26665 +                       '5639F9300', '4.50.0', 'XR04500',,
    26666 +                       'IBM OS/2 Developer''s Toolkit Version 4.5',,
    26667 +                       15, '0');
    26668 +    if (rc = 0) then
    26669 +        rc = CheckCmdOutput('rc', 0, fQuiet, 'IBM RC (Resource Compiler) Version 5.00.004');
    26670 +    if (rc = 0) then
    26671 +        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.006 July 21 1998');
    26672 +return rc;
    26673 +
    26674 +
    26675 +/*
    26676 + * OS/2 Programmers Toolkit v4.5.1
    26677 + */
    26678 +Toolkit451: procedure expose aCfg. aPath.
    26679 +    parse arg sToolId,sOperation,fRM,fQuiet
    26680 +
    26681 +    /*
    26682 +     * Toolkit (4.5.1) main directory.
    26683 +     */
    26684 +     sPathTK    = PathQuery('toolkit451', sToolId, sOperation);
    26685 +    if (sPathTK = '') then
    26686 +        return 1;
    26687 +    /* If config operation we're done now. */
    26688 +    if (pos('config', sOperation) > 0) then
    26689 +        return 0;
    26690 +
    26691 +    /*
    26692 +     * Installing the environment variables.
    26693 +     */
    26694 +    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    26695 +    call EnvAddFront fRM, 'path',        sPathTK'\bin;'sPathTK'\som\common;'sPathTK'\som\bin'
    26696 +    call EnvAddFront fRM, 'dpath',       sPathTK'\msg;'sPathTK'\book;'sPathTK'\SOM\COMMON\SYSTEM;'sPathTK'\SOM\MSG;'
    26697 +    call EnvAddFront fRM, 'beginlibpath', sPathTK'\dll;'sPathTK'\som\common\dll;'sPathTK'\som\lib;'
    26698 +    call EnvAddFront fRM, 'help',        sPathTK'\help;'
    26699 +    call EnvAddFront fRM, 'bookshelf',   sPathTK'\book;'sPathTK'\archived;'
    26700 +    call EnvAddFront fRM, 'somir',       sPathTK'\SOM\COMMON\ETC\214\SOM.IR;'
    26701 +    call EnvAddEnd   fRM, 'somir',       sPathTK'\SAMPLES\REXX\SOM\ANIMAL\ORXSMP.IR;'
    26702 +    call EnvAddFront fRM, 'nlspath',     sPathTK'\msg\%N;'
    26703 +    call EnvAddEnd   fRM, 'ulspath',     sPathTK'\language;'
    26704 +    /*call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'sPathTK'\SPEECH\H;'sPathTK'\H\GL;'sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'*/
    26705 +    call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'/*sPathTK'\SPEECH\H;'sPathTK'\H\GL;'*/sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'
    26706 +    call EnvAddFront fRM, 'lib',         sPathTK'\lib;'sPathTK'\som\lib;'
    26707 +    call EnvAddEnd   fRM, 'lib',         sPathTK'\SAMPLES\MM\LIB;'sPathTK'\SPEECH\LIB;'
    26708 +    call EnvAddFront fRM, 'helpndx',     'EPMKWHLP.NDX+', '+'
    26709 +    call EnvAddFront fRM, 'ipfc',        sPathTK'\ipfc;'
    26710 +    call EnvSet      fRM, 'sombase',     sPathTK'\SOM'
    26711 +    call EnvSet      fRM, 'somruntime',  sPathTK'\SOM\COMMON'
    26712 +    call EnvSet      fRM, 'LANG',        'en_us'
    26713 +
    26714 +    call EnvSet      fRM, 'CPREF',       'CP1.INF+CP2.INF+CP3.INF'
    26715 +    call EnvSet      fRM, 'GPIREF',      'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    26716 +    call EnvSet      fRM, 'MMREF',       'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    26717 +    call EnvSet      fRM, 'PMREF',       'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    26718 +    call EnvSet      fRM, 'WPSREF',      'WPS1.INF+WPS2.INF+WPS3.INF'
    26719 +    call EnvAddFront fRM, 'sminclude',   sPathTK'\H;'sPathTK'\IDL;'sPathTK'\SOM\INCLUDE;.;'
    26720 +    call EnvSet      fRM, 'smaddstar',   '1'
    26721 +    call EnvSet      fRM, 'smemit',      'h;ih;c'
    26722 +    call EnvSet      fRM, 'smtmp',       EnvGet('tmp');
    26723 +    call EnvSet      fRM, 'smclasses',   'WPTYPES.IDL'
    26724 +    /*
    26725 +    call EnvSet      fRM, 'CAT_MACHINE', 'COM1:57600'
    26726 +    call EnvSet      fRM, 'CAT_HOST_BIN_PATH', TKMAIN'\BIN'
    26727 +    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE', 'ASYNC_SIGBRK'
    26728 +    call EnvSet      fRM, 'CAT_HOST_SOURCE_PATH',TKMAIN'\BIN;'
    26729 +    */
    26730 +
    26731 +    /*
    26732 +     * Verify.
    26733 +     */
    26734 +    if (pos('verify', sOperation) <= 0) then
    26735 +        return 0;
    26736 +    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    26737 +        |   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet),
    26738 +        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    26739 +        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    26740 +        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    26741 +        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    26742 +        |   \CfgVerifyFile(sPathTK'\bin\nmake.exe', fQuiet),
    26743 +        |   \CfgVerifyFile(sPathTK'\bin\nmake32.exe', fQuiet),
    26744 +        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    26745 +        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    26746 +        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    26747 +        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    26748 +        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    26749 +        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    26750 +        |   \CfgVerifyFile(sPathTK'\som\bin\sc.exe', fQuiet),
    26751 +        ) then
    26752 +        return 2;
    26753 +
    26754 +    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,
    26755 +                       '5639F9300', '4.50.1', 'XR04510',,
    26756 +                       'IBM OS/2 Developer''s Toolkit Version 4.5',,
    26757 +                       15, '0');
    26758 +    if (rc = 0) then
    26759 +        rc = CheckCmdOutput('sc -V', -1, fQuiet, '", Version: 2.54.');
    26760 +    if (rc = 0) then
    26761 +        rc = CheckCmdOutput('rc', 0, fQuiet, 'IBM RC (Resource Compiler) Version 5.00.006 Oct 20 2000');
    26762 +    if (rc = 0) then
    26763 +        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.007 Oct 02 2000');
    26764 +    if (rc = 0) then
    26765 +        rc = CheckCmdOutput('nmake -?', 0, fQuiet, 'Version 4.00.000 Oct 20 2000');
    26766 +    if (rc = 0) then
    26767 +        rc = CheckCmdOutput('nmake32 -?', 0, fQuiet, 'Version 5.00.003 Oct 20 2000');
    26768 +return rc;
    26769 +
    26770 +
    26771 +
    26772 +/*
    26773 + * OS/2 Programmers Toolkit v4.5.2
    26774 + */
    26775 +Toolkit452: procedure expose aCfg. aPath.
    26776 +    parse arg sToolId,sOperation,fRM,fQuiet
    26777 +
    26778 +    /*
    26779 +     * Toolkit (4.5.1) main directory.
    26780 +     */
    26781 +     sPathTK    = PathQuery('toolkit452', sToolId, sOperation);
    26782 +    if (sPathTK = '') then
    26783 +        return 1;
    26784 +    /* If config operation we're done now. */
    26785 +    if (pos('config', sOperation) > 0) then
    26786 +        return 0;
    26787 +
    26788 +    /*
    26789 +     * Installing the environment variables.
    26790 +     */
    26791 +    call EnvSet      fRM, 'PATH_TOOLKIT',  sPathTK;
    26792 +    call EnvAddFront fRM, 'path',        sPathTK'\bin;'sPathTK'\som\common;'sPathTK'\som\bin'
    26793 +    call EnvAddFront fRM, 'dpath',       sPathTK'\msg;'sPathTK'\book;'sPathTK'\SOM\COMMON\SYSTEM;'sPathTK'\SOM\MSG;'
    26794 +    call EnvAddFront fRM, 'beginlibpath', sPathTK'\dll;'sPathTK'\som\common\dll;'sPathTK'\som\lib;'
    26795 +    call EnvAddFront fRM, 'help',        sPathTK'\help;'
    26796 +    call EnvAddFront fRM, 'bookshelf',   sPathTK'\book;'sPathTK'\archived;'
    26797 +    call EnvAddFront fRM, 'somir',       sPathTK'\SOM\COMMON\ETC\214\SOM.IR;'
    26798 +    call EnvAddEnd   fRM, 'somir',       sPathTK'\SAMPLES\REXX\SOM\ANIMAL\ORXSMP.IR;'
    26799 +    call EnvAddFront fRM, 'nlspath',     sPathTK'\msg\%N;'
    26800 +    call EnvAddEnd   fRM, 'ulspath',     sPathTK'\language;'
    26801 +    /*call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'sPathTK'\SPEECH\H;'sPathTK'\H\GL;'sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'*/
    26802 +    /* the include mustn't be too long :-/ */
    26803 +    call EnvAddFront fRM, 'include',     sPathTK'\H\ARPA;'sPathTK'\H\NET;'sPathTK'\H\NETINET;'sPathTK'\H\NETNB;'sPathTK'\H\RPC;'/*sPathTK'\SPEECH\H;'sPathTK'\H\GL;'*/sPathTK'\H;'sPathTK'\SOM\INCLUDE;'sPathTK'\INC;'
    26804 +    call EnvAddFront fRM, 'lib',         sPathTK'\lib;'sPathTK'\som\lib;'
    26805 +    call EnvAddEnd   fRM, 'lib',         sPathTK'\SAMPLES\MM\LIB;'sPathTK'\SPEECH\LIB;'
    26806 +    call EnvAddFront fRM, 'helpndx',     'EPMKWHLP.NDX+', '+'
    26807 +    call EnvAddFront fRM, 'ipfc',        sPathTK'\ipfc;'
    26808 +    call EnvSet      fRM, 'sombase',     sPathTK'\SOM'
    26809 +    call EnvSet      fRM, 'somruntime',  sPathTK'\SOM\COMMON'
    26810 +    call EnvSet      fRM, 'LANG',        'en_us'
    26811 +
    26812 +    call EnvSet      fRM, 'CPREF',       'CP1.INF+CP2.INF+CP3.INF'
    26813 +    call EnvSet      fRM, 'GPIREF',      'GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF'
    26814 +    call EnvSet      fRM, 'MMREF',       'MMREF1.INF+MMREF2.INF+MMREF3.INF'
    26815 +    call EnvSet      fRM, 'PMREF',       'PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF'
    26816 +    call EnvSet      fRM, 'WPSREF',      'WPS1.INF+WPS2.INF+WPS3.INF'
    26817 +    call EnvAddFront fRM, 'sminclude',   sPathTK'\H;'sPathTK'\IDL;'sPathTK'\SOM\INCLUDE;.;'
    26818 +    call EnvSet      fRM, 'smaddstar',   '1'
    26819 +    call EnvSet      fRM, 'smemit',      'h;ih;c'
    26820 +    call EnvSet      fRM, 'smtmp',       EnvGet('tmp');
    26821 +    call EnvSet      fRM, 'smclasses',   'WPTYPES.IDL'
    26822 +    /*
    26823 +    call EnvSet      fRM, 'CAT_MACHINE', 'COM1:57600'
    26824 +    call EnvSet      fRM, 'CAT_HOST_BIN_PATH', TKMAIN'\BIN'
    26825 +    call EnvSet      fRM, 'CAT_COMMUNICATION_TYPE', 'ASYNC_SIGBRK'
    26826 +    call EnvSet      fRM, 'CAT_HOST_SOURCE_PATH',TKMAIN'\BIN;'
    26827 +    */
    26828 +
    26829 +    /*
    26830 +     * Verify.
    26831 +     */
    26832 +    if (pos('verify', sOperation) <= 0) then
    26833 +        return 0;
    26834 +    if (    \CfgVerifyFile(sPathTK'\bin\alp.exe', fQuiet),
    26835 +        /*|   \CfgVerifyFile(sPathTK'\bin\rc.exe', fQuiet)*/,
    26836 +        |   \CfgVerifyFile(sPathTK'\bin\rc16.exe', fQuiet),
    26837 +        |   \CfgVerifyFile(sPathTK'\bin\ipfc.exe', fQuiet),
    26838 +        |   \CfgVerifyFile(sPathTK'\bin\implib.exe', fQuiet),
    26839 +        |   \CfgVerifyFile(sPathTK'\bin\mkmsgf.exe', fQuiet),
    26840 +        |   \CfgVerifyFile(sPathTK'\bin\mapsym.exe', fQuiet),
    26841 +        |   \CfgVerifyFile(sPathTK'\bin\nmake.exe', fQuiet),
    26842 +        |   \CfgVerifyFile(sPathTK'\bin\nmake32.exe', fQuiet),
    26843 +        |   \CfgVerifyFile(sPathTK'\lib\os2386.lib', fQuiet),
    26844 +        |   \CfgVerifyFile(sPathTK'\lib\pmbidi.lib', fQuiet),
    26845 +        |   \CfgVerifyFile(sPathTK'\lib\tcpip32.lib', fQuiet),
    26846 +        |   \CfgVerifyFile(sPathTK'\h\os2.h', fQuiet),
    26847 +        |   \CfgVerifyFile(sPathTK'\h\os2win.h', fQuiet),
    26848 +        |   \CfgVerifyFile(sPathTK'\h\stack16\pmwsock.h', fQuiet),
    26849 +        |   \CfgVerifyFile(sPathTK'\som\bin\sc.exe', fQuiet),
    26850 +        ) then
    26851 +        return 2;
    26852 +
    26853 +    rc = CheckSyslevel(sPathTK||'\bin\syslevel.tlk', fQuiet,,
    26854 +                       '5639F9300', '4.50.2', 'XR04520',,
    26855 +                       'IBM OS/2 Developer''s Toolkit Version 4.5',,
    26856 +                       15, '0');
    26857 +    if (rc = 0) then
    26858 +        rc = CheckCmdOutput('sc -V', -1, fQuiet, '", Version: 2.54.');
    26859 +    /*if (rc = 0) then
    26860 +        rc = CheckCmdOutput('rc', 1, fQuiet, 'Version 4.00.011 Oct 04 2001');*/
    26861 +    if (rc = 0) then
    26862 +        rc = CheckCmdOutput('rc16', 1, fQuiet, 'Version 4.00.011 Oct 04 2001');
    26863 +    if (rc = 0) then
    26864 +        rc = CheckCmdOutput('ipfc', 0, fQuiet, 'Version 4.00.007 Oct 02 2000');
    26865 +    if (rc = 0) then
    26866 +        rc = CheckCmdOutput('nmake -?', 0, fQuiet, 'Version 4.00.001 Oct  4 2001');
    26867 +    if (rc = 0) then
    26868 +        rc = CheckCmdOutput('nmake32 -?', 0, fQuiet, 'Version 5.00.003 Oct  4 2001');
    26869 +return rc;
    26870 +
    26871 +
    26872 +
    26873 +/**
    26874 + * This will envolve into an full UNIX like environment some day perhaps...
    26875 + */
    26876 +Unix: procedure expose aCfg. aPath.
    26877 +    parse arg sToolId,sOperation,fRM,fQuiet
    26878 +
    26879 +    /*
    26880 +     * Unix root directory and XFree86 main directory.
    26881 +     */
    26882 +    sUnixBack = PathQuery('unixroot', sToolId, sOperation);
    26883 +    if (sUnixBack = '') then
    26884 +        return 1;
    26885 +    sXF86Back = PathQuery('xfree86', sToolId, sOperation);
    26886 +    if (sXF86Back = '') then
    26887 +        return 1;
    26888 +    /* If config operation we're done now. */
    26889 +    if (pos('config', sOperation) > 0) then
    26890 +        return 0;
    26891 +
    26892 +    /*
    26893 +     * Installing the environment variables.
    26894 +     */
    26895 +    sUnixForw = translate(sUnixBack, '/', '\');
    26896 +    call EnvSet      fRM, 'PATH_UNIX',          sUnixBack
    26897 +    call EnvSet      fRM, 'unixroot',           sUnixBack
    26898 +    call EnvAddFront fRM, 'path',               sUnixBack'\bin;'sUnixBack'\usr\local\bin;'
    26899 +    call EnvAddFront fRM, 'beginlibpath',       sUnixBack'\dll;'
    26900 +    call EnvSet      fRM, 'groff_font_path',    sUnixForw'/lib/groff/font'
    26901 +    call EnvSet      fRM, 'groff_tmac_path',    sUnixForw'/lib/groff/tmac'
    26902 +    call EnvSet      fRM, 'refer',              sUnixForw'/lib/groff/dict/papers/ind'
    26903 +
    26904 +/*    call EnvSet      fRM, 'editor',             'TEDIT' - don't change it */
    26905 +
    26906 +    sXF86Forw = translate(sXF86Back, '/', '\');
    26907 +    call EnvSet      fRM, 'PATH_XFREE86',       sXF86Back
    26908 +    call EnvAddFront fRM, 'C_INCLUDE_PATH',     sXF86Forw'/include'
    26909 +    call EnvAddFront fRM, 'CPLUS_INCLUDE_PATH', sXF86Forw'/include'
    26910 +    call EnvSet      fRM, 'OBJC_INCLUDE_PATH',  sXF86Forw'/include'
    26911 +    call EnvAddFront fRM, 'LIBRARY_PATH',       sXF86Forw'/lib'
    26912 +
    26913 +    /*
    26914 +     * Verify.
    26915 +     */
    26916 +    if (pos('verify', sOperation) <= 0) then
    26917 +        return 0;
    26918 +    if (    \CfgVerifyFile(sUnixBack'\bin\bash.exe', fQuiet, 1),
    26919 +        |   \CfgVerifyFile(sUnixBack'\bin\sh.exe', fQuiet),
    26920 +        |   \CfgVerifyFile(sUnixBack'\bin\yes.exe', fQuiet),
    26921 +        |   \CfgVerifyFile(sUnixBack'\bin\rm.exe', fQuiet),
    26922 +        |   \CfgVerifyFile(sUnixBack'\bin\cp.exe', fQuiet, 1),
    26923 +        |   \CfgVerifyFile(sUnixBack'\bin\mv.exe', fQuiet. 1),
    26924 +        |   \CfgVerifyFile(sXF86Back'\bin\xf86config.exe', fQuiet, 1),
    26925 +        ) then
    26926 +        return 2;
    26927 +return 0;
    26928 +
    26929 +
    26930 +
    26931 +/*
    26932 + * IBM Visual Age for C++ v3.08 for OS/2
    26933 + */
    26934 +VAC308: procedure expose aCfg. aPath.
    26935 +    parse arg sToolId,sOperation,fRM,fQuiet
    26936 +
    26937 +    /*
    26938 +     * IBM Visual Age for C++ Version 3.08 main directory.
    26939 +     */
    26940 +    sPathCPP = PathQuery('vac308', sToolId, sOperation);
    26941 +    if (sPathCPP = '') then
    26942 +        return 1;
    26943 +    /* If config operation we're done now. */
    26944 +    if (pos('config', sOperation) > 0) then
    26945 +        return 0;
    26946 +
    26947 +    /*
    26948 +     * Installing the environment variables.
    26949 +     */
    26950 +    call EnvSet      fRM, 'PATH_VAC308',    sPathCPP
    26951 +    call EnvSet      fRM, 'CCENV',      'VAC3'
    26952 +    call EnvSet      fRM, 'BUILD_ENV',  'VAC308'
    26953 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    26954 +
    26955 +    call EnvAddFront fRM, 'beginlibpath',   sPathCPP'\DLL;'sPathCPP'\SAMPLES\TOOLKIT\DLL;'
    26956 +    call EnvAddFront fRM, 'path',           sPathCPP'\BIN;'sPathCPP'\SMARTS\SCRIPTS;'sPathCPP'\HELP;'
    26957 +    call EnvAddFront fRM, 'dpath',          sPathCPP'\HELP;'sPathCPP';'sPathCPP'\LOCALE;'sPathCPP'\MACROS;'sPathCPP'\BND;'
    26958 +    call EnvAddFront fRM, 'help',           sPathCPP'\HELP;'sPathCPP'\SAMPLES\TOOLKIT\HELP;'
    26959 +    call EnvAddFront fRM, 'bookshelf',      sPathCPP'\HELP;'
    26960 +    call EnvAddFront fRM, 'somir',          sPathCPP'\ETC\SOM.IR;'
    26961 +    call EnvAddFront fRM, 'cpphelp_ini',    'C:\OS2\SYSTEM'
    26962 +    call EnvAddFront fRM, 'locpath',        sPathCPP'\LOCALE;%LOCPATH%;'
    26963 +    call EnvAddFront fRM, 'include',        sPathCPP'\INCLUDE;'sPathCPP'\INCLUDE\OS2;'sPathCPP'\INC;'sPathCPP'\INCLUDE\SOM;'
    26964 +    call EnvAddFront fRM, 'sminclude',      sPathCPP'\INCLUDE\OS2;'sPathCPP'\INCLUDE;'sPathCPP'\INCLUDE\SOM;'
    26965 +
    26966 +    call EnvAddFront fRM, 'vbpath',         '.;'sPathCPP'\DDE4VB;'
    26967 +    call EnvSet      fRM, 'tmpdir',         EnvGet('tmp')
    26968 +    call EnvSet      fRM, 'lxevfref',       'EVFELREF.INF+LPXCREF.INF'
    26969 +    call EnvSet      fRM, 'lxevfhdi',       'EVFELHDI.INF+LPEXHDI.INF'
    26970 +    call EnvAddFront fRM, 'lpath',          sPathCPP'\MACROS;'
    26971 +    call EnvAddFront fRM, 'codelpath',      sPathCPP'\CODE\MACROS;'sPathCPP'\MACROS;'
    26972 +    call EnvSet      fRM, 'clref',          'CPPCLRF.INF+CPPDAT.INF+CPPAPP.INF+CPPWIN.INF+CPPCTL.INF+CPPADV.INF+CPP2DG.INF+CPPDDE.INF+CPPDM.INF+CPPMM.INF+CPPCLRB.INF'
    26973 +    call EnvAddFront fRM, 'ipfc',           sPathCPP'\IPFC'
    26974 +    call EnvAddFront fRM, 'lib',            sPathCPP'\LIB;'sPathCPP'\DLL;'
    26975 +    call EnvSet      fRM, 'cpplocal',       sPathCPP
    26976 +    call EnvSet      fRM, 'cppmain',        sPathCPP
    26977 +    call EnvSet      fRM, 'cppwork',        sPathCPP
    26978 +    call EnvSet      fRM, 'iwf.default_prj','CPPDFTPRJ'
    26979 +
    26980 +    call EnvSet      fRM, 'iwf.solution_lang_support', 'CPPIBS30;ENG'
    26981 +    call EnvSet      fRM, 'vacpp_shared'    'FALSE'
    26982 +    call EnvSet      fRM, 'iwfhelp',        'IWFHDI.INF'
    26983 +    call EnvSet      fRM, 'iwfopt',         sPathCPP
    26984 +
    26985 +    call EnvSet      fRM, 'somruntime',     sPathCPP'\DLL'
    26986 +    call EnvSet      fRM, 'smaddstar',      '1'
    26987 +    call EnvSet      fRM, 'smemit',         'h;ih;c'
    26988 +    call EnvSet      fRM, 'sombase',        sPathCPP
    26989 +    call EnvSet      fRM, 'smtmp',          EnvGet('tmp')
    26990 +    call EnvSet      fRM, 'smclasses',      'WPTYPES.IDL'
    26991 +
    26992 +    call EnvAddFront fRM, 'helpndx',        'EPMKWHLP.NDX+CPP.NDX+CPPBRS.NDX', '+'
    26993 +    call EnvAddFront fRM, 'ipf_keys',       'SHOWNAV'
    26994 +
    26995 +    /*
    26996 +     * Verify.
    26997 +     */
    26998 +    if (pos('verify', sOperation) <= 0) then
    26999 +        return 0;
    27000 +    if (    \CfgVerifyFile(sPathCPP'\bin\icc.exe', fQuiet),
    27001 +        |   \CfgVerifyFile(sPathCPP'\bin\ilib.exe', fQuiet),
    27002 +        |   \CfgVerifyFile(sPathCPP'\bin\ilink.exe', fQuiet),
    27003 +        |   \CfgVerifyFile(sPathCPP'\bin\icsperf.exe', fQuiet,1),
    27004 +        |   \CfgVerifyFile(sPathCPP'\bin\icsdebug.exe', fQuiet),
    27005 +        |   \CfgVerifyFile(sPathCPP'\bin\cppfilt.exe', fQuiet),
    27006 +        |   \CfgVerifyFile(sPathCPP'\bin\dllrname.exe', fQuiet),
    27007 +        |   \CfgVerifyFile(sPathCPP'\lib\demangl.lib', fQuiet),
    27008 +        |   \CfgVerifyFile(sPathCPP'\lib\cppom30.lib', fQuiet),
    27009 +        |   \CfgVerifyFile(sPathCPP'\lib\cppom30i.lib', fQuiet),
    27010 +        |   \CfgVerifyFile(sPathCPP'\lib\cppom30o.lib', fQuiet),
    27011 +        |   \CfgVerifyFile(sPathCPP'\lib\cppon30i.lib', fQuiet),
    27012 +        |   \CfgVerifyFile(sPathCPP'\lib\cppon30o.lib', fQuiet),
    27013 +        |   \CfgVerifyFile(sPathCPP'\lib\_doscall.lib', fQuiet, 1),
    27014 +        |   \CfgVerifyFile(sPathCPP'\lib\_pmwin.lib', fQuiet, 1),
    27015 +        |   \CfgVerifyFile(sPathCPP'\include\builtin.h', fQuiet),
    27016 +        |   \CfgVerifyFile(sPathCPP'\include\conio.h', fQuiet),
    27017 +        |   \CfgVerifyFile(sPathCPP'\include\ismkss.h', fQuiet),
    27018 +        |    FileExists(sPathCPP'\include\os2.h'),
    27019 +        |    FileExists(sPathCPP'\include\os2win.h'),
    27020 +        |    FileExists(sPathCPP'\include\pm.h'),
    27021 +        |   \CfgVerifyFile(sPathCPP'\include\sys\utime.h', fQuiet),
    27022 +        |   \CfgVerifyFile(sPathCPP'\help\cpplib.inf', fQuiet),
    27023 +        ) then
    27024 +        return 2;
    27025 +
    27026 +
    27027 +    rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.ct3', fQuiet,'562201703',,'CTC308',);
    27028 +    if (rc = 0) then
    27029 +        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.ct4', fQuiet,'562201704',,'CTU308',);
    27030 +    /*if (rc = 0) then
    27031 +        rc = CheckCmdOutput('syslevel '||sPathCPP||'\syslevel', 0, fQuiet, 'Version 3.00     Component ID 562201707'||'0d0a'x||'Current CSD level: CTV308');
    27032 +    if (rc = 0) then
    27033 +        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.ct8', fQuiet,'562201708',,'CTD308',);
    27034 +        */
    27035 +    if (rc = 0) then
    27036 +        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.wf5', fQuiet,'562201605',,'CTC308',);
    27037 +    /*if (rc = 0) then
    27038 +        rc = CheckSyslevel(sPathCPP||'\syslevel\syslevel.wf2', fQuiet,'562201602',,'CTO308',);
    27039 +        */
    27040 +    if (rc = 0) then
    27041 +        rc = CheckCmdOutput('icc', 0, fQuiet, 'IBM VisualAge C++ for OS/2, Version 3');
    27042 +    if (rc = 0) then
    27043 +        rc = CheckCmdOutput('ilink', 16, fQuiet, 'IBM(R) Linker for OS/2(R), Version 01.08.r1a_CTC308c');
    27044 +    if (rc = 0) then
    27045 +        rc = CheckCmdOutput('ilib /?', 8, fQuiet, 'IBM(R) Library Manager for OS/2(R), Version 01.00.03 cc_CTC308c');
    27046 +return rc;
    27047 +
    27048 +
    27049 +
    27050 +/*
    27051 + * Visual Age / C and C++ tools v3.6.5 for OS/2
    27052 + */
    27053 +VAC365: procedure expose aCfg. aPath.
    27054 +    parse arg sToolId,sOperation,fRM,fQuiet
    27055 +
    27056 +    /*
    27057 +     * IBM C/C++ Compiler and Tools Version 3.6.5 main directory.
    27058 +     */
    27059 +    sPathCxx    = PathQuery('vac365', sToolId, sOperation);
    27060 +    if (sPathCxx = '') then
    27061 +        return 1;
    27062 +    /* If config operation we're done now. */
    27063 +    if (pos('config', sOperation) > 0) then
    27064 +        return 0;
    27065 +
    27066 +    /*
    27067 +     * Installing the environment variables.
    27068 +     */
    27069 +    call EnvSet      fRM, 'PATH_VAC365', sPathCxx;
    27070 +    call EnvSet      fRM, 'CCENV',      'VAC36'
    27071 +    call EnvSet      fRM, 'BUILD_ENV',  'VAC365'
    27072 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    27073 +
    27074 +    call EnvSet      fRM, 'cxxmain',     sPathCxx;
    27075 +    call EnvAddFront fRM, 'path',        sPathCxx'\bin;'
    27076 +    call EnvAddFront fRM, 'dpath',       sPathCxx'\local;'sPathCxx'\help;'
    27077 +    call EnvAddFront fRM, 'beginlibpath',sPathCxx'\dll;'sPathCxx'\runtime;'
    27078 +    call EnvAddFront fRM, 'nlspath',     sPathCxx'\msg\%N;'
    27079 +    call EnvAddFront fRM, 'include',     sPathCxx'\include;'
    27080 +    call EnvAddFront fRM, 'lib',         sPathCxx'\lib;'
    27081 +    call EnvAddFront fRM, 'ipfc',        sPathCxx'\ipfc;'
    27082 +    call EnvSet      fRM, 'LANG',        'en_us'
    27083 +    call EnvSet      fRM, 'CPP_DBG_LANG', 'CPP'
    27084 +
    27085 +    /*
    27086 +     * Verify.
    27087 +     */
    27088 +    if (pos('verify', sOperation) <= 0) then
    27089 +        return 0;
    27090 +    if (    \CfgVerifyFile(sPathCxx'\bin\icc.exe', fQuiet),
    27091 +        |   \CfgVerifyFile(sPathCxx'\bin\ilib.exe', fQuiet),
    27092 +        |   \CfgVerifyFile(sPathCxx'\bin\ilink.exe', fQuiet),
    27093 +        |   \CfgVerifyFile(sPathCxx'\bin\idebug.exe', fQuiet),
    27094 +        |   \CfgVerifyFile(sPathCxx'\bin\cppfilt.exe', fQuiet),
    27095 +        |   \CfgVerifyFile(sPathCxx'\bin\dllrname.exe', fQuiet),
    27096 +        |   \CfgVerifyFile(sPathCxx'\bin\cppcbe36.exe', fQuiet),
    27097 +        |   \CfgVerifyFile(sPathCxx'\lib\cpprms36.lib', fQuiet),
    27098 +        |   \CfgVerifyFile(sPathCxx'\lib\cpprmi36.lib', fQuiet),
    27099 +        |   \CfgVerifyFile(sPathCxx'\lib\cpprmo36.lib', fQuiet),
    27100 +        |   \CfgVerifyFile(sPathCxx'\lib\cpprni36.lib', fQuiet),
    27101 +        |   \CfgVerifyFile(sPathCxx'\lib\cpprds36.lib', fQuiet),
    27102 +        |   \CfgVerifyFile(sPathCxx'\include\builtin.h', fQuiet),
    27103 +        |   \CfgVerifyFile(sPathCxx'\include\conio.h', fQuiet),
    27104 +        |   \CfgVerifyFile(sPathCxx'\include\ismavl.h', fQuiet),
    27105 +        |    FileExists(sPathCxx'\include\os2.h'),
    27106 +        |    FileExists(sPathCxx'\include\os2win.h'),
    27107 +        |    FileExists(sPathCxx'\include\pm.h'),
    27108 +        |   \CfgVerifyFile(sPathCxx'\include\sys\utime.h', fQuiet),
    27109 +        |   \CfgVerifyFile(sPathCxx'\help\cpplbm36.msg', fQuiet),
    27110 +        ) then
    27111 +        return 2;
    27112 +    rc = CheckCmdOutput('icc', 0, fQuiet, 'IBM* C and C++ Compilers for OS/2*, AIX* and for Windows NT**, Version 3.6');
    27113 +    if (rc = 0) then
    27114 +        rc = CheckCmdOutput('ilink', 16, fQuiet, 'IBM(R) Linker for OS/2(R), Version 03.06.PPK1010917.011116ilink');
    27115 +    if (rc = 0) then
    27116 +        rc = CheckCmdOutput('ilib /?', 0, fQuiet, 'IBM Librarian for OS/2(R) Version 03.99.PPK1001123');
    27117 +    if (stream(sPathCxx'\bin\cppcbe36.exe', 'c', 'query size') <> 603122) then
    27118 +    do
    27119 +        say 'Error!!! Get latest vac365 optimizer fixes from the OS2 Mozilla project.';
    27120 +        say '         http://www.mozilla.org/ports/os2/setup.html';
    27121 +        rc = 99;
    27122 +    end
    27123 +return rc;
    27124 +
    27125 +
    27126 +/*
    27127 + * Visual Age for C++ v4.0 for OS/2
    27128 + */
    27129 +VAC40: procedure expose aCfg. aPath.
    27130 +    parse arg sToolId,sOperation,fRM,fQuiet
    27131 +
    27132 +    /*
    27133 +     * IBM VisualAge for C++ v4.0 main directory.
    27134 +     */
    27135 +    sPathCPP    = PathQuery('vac40', sToolId, sOperation);
    27136 +    if (sPathCPP = '') then
    27137 +        return 1;
    27138 +    /* If config operation we're done now. */
    27139 +    if (pos('config', sOperation) > 0) then
    27140 +        return 0;
    27141 +
    27142 +    /*
    27143 +     * Installing the environment variables.
    27144 +     */
    27145 +    call EnvSet      fRM, 'PATH_VAC40',  sPathCPP;
    27146 +    call EnvSet      fRM, 'CCENV',      'VAC40'
    27147 +    call EnvSet      fRM, 'BUILD_ENV',  'VAC40'
    27148 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    27149 +
    27150 +    call EnvAddFront fRM, 'path',        sPathCPP'\bin;'
    27151 +    call EnvAddFront fRM, 'dpath',       sPathCPP'\etc;'sPathCPP'\help;'
    27152 +    call EnvAddFront fRM, 'beginlibpath',sPathCPP'\dll;'sPathCPP'\runtime;'
    27153 +    call EnvAddFront fRM, 'help',        sPathCPP'\help;'
    27154 +    call EnvAddFront fRM, 'nlspath',     sPathCPP'\msg\%N;'
    27155 +    call EnvAddFront fRM, 'locpath',     sPathCPP'\locale;'sPathCPP'\runtime\locale;'
    27156 +    call EnvAddFront fRM, 'include',     sPathCPP'\ivb;'sPathCPP'\include;'
    27157 +    call EnvAddFront fRM, 'lib',         sPathCPP'\lib;'
    27158 +    call EnvAddFront fRM, 'ipfc',        sPathCPP'\bin;'
    27159 +    call EnvAddFront fRM, 'cpplpath4',   sPathCPP'\macros;'
    27160 +    call EnvSet      fRM, 'system_ice',  sPathCPP'\etc\system.ice'
    27161 +    call EnvSet      fRM, 'vbpath',      sPathCPP'\ivb'
    27162 +    call EnvSet      fRM, 'vacppmain',   sPathCPP;
    27163 +    call EnvSet      fRM, 'os2',         '1'
    27164 +
    27165 +    /*
    27166 +     * Verify.
    27167 +     */
    27168 +    if (pos('verify', sOperation) <= 0) then
    27169 +        return 0;
    27170 +    if (    \CfgVerifyFile(sPathCPP'\bin\iccv4.exe', fQuiet),
    27171 +        |   \CfgVerifyFile(sPathCPP'\bin\ilib.exe', fQuiet),
    27172 +        |   \CfgVerifyFile(sPathCPP'\bin\ire.exe', fQuiet),
    27173 +        |   \CfgVerifyFile(sPathCPP'\bin\vacide.exe', fQuiet),
    27174 +        |   \CfgVerifyFile(sPathCPP'\bin\cppfilt.exe', fQuiet),
    27175 +        |   \CfgVerifyFile(sPathCPP'\bin\dllrname.exe', fQuiet),
    27176 +        |   \CfgVerifyFile(sPathCPP'\bin\patrace.exe', fQuiet),
    27177 +        |   \CfgVerifyFile(sPathCPP'\lib\cpprms40.lib', fQuiet),
    27178 +        |   \CfgVerifyFile(sPathCPP'\lib\cpprmi40.lib', fQuiet),
    27179 +        |   \CfgVerifyFile(sPathCPP'\lib\cpprmo40.lib', fQuiet),
    27180 +        |   \CfgVerifyFile(sPathCPP'\lib\cpprni40.lib', fQuiet),
    27181 +        |   \CfgVerifyFile(sPathCPP'\lib\cpprds40.lib', fQuiet),
    27182 +        |   \CfgVerifyFile(sPathCPP'\include\builtin.h', fQuiet),
    27183 +        |   \CfgVerifyFile(sPathCPP'\include\conio.h', fQuiet),
    27184 +        |   \CfgVerifyFile(sPathCPP'\include\ismavl.h', fQuiet),
    27185 +        |    FileExists(sPathCPP'\include\os2.h'),
    27186 +        |    FileExists(sPathCPP'\include\os2win.h'),
    27187 +        |    FileExists(sPathCPP'\include\pm.h'),
    27188 +        |   \CfgVerifyFile(sPathCPP'\include\sys\utime.h', fQuiet),
    27189 +        |   \CfgVerifyFile(sPathCPP'\help\cpplbm40.msg', fQuiet),
    27190 +        ) then
    27191 +        return 2;
    27192 +    rc = CheckCmdOutput('iccv4', 0, fQuiet, 'IBM VisualAge for C++ Version 4.0 C Compiler');
    27193 +    if (rc = 0) then
    27194 +        rc = CheckCmdOutput('ilib /?', 0, fQuiet, 'IBM Librarian for OS/2(R) Version 03.99.cc_981110'); /* is this really FP2?????? */
    27195 +    if (rc = 0) then
    27196 +        rc = CheckCmdOutput('vacbld -?', 0, fQuiet, 'IBM(R) VisualAge(R) C++ Professional, Version 4.0 (981117)'); /* is this really FP2?????? */
    27197 +return rc;
    27198 +
    27199 +
    27200 +
    27201 +
    27202 +/*
    27203 + * WarpIn
    27204 + */
    27205 +WarpIn: procedure expose aCfg. aPath.
    27206 +    parse arg sToolId,sOperation,fRM,fQuiet
    27207 +
    27208 +    /*
    27209 +     * WarpIn main directory.
    27210 +     */
    27211 +    sPathWarpIn = PathQuery('warpin', sToolId, sOperation);
    27212 +    if (sPathWarpIn = '') then
    27213 +        return 1;
    27214 +    /* If config operation we're done now. */
    27215 +    if (pos('config', sOperation) > 0) then
    27216 +        return 0;
    27217 +
    27218 +    /*
    27219 +     * Installing the environment variables.
    27220 +     */
    27221 +    call EnvSet      fRM, 'PATH_WARPIN', sPathWarpIn;
    27222 +    call EnvAddFront fRM, 'path',        sPathWarpIn';'
    27223 +    call EnvAddFront fRM, 'beginlibpath',sPathWarpIn';'
    27224 +    call EnvAddFront fRM, 'bookshelf',   sPathWarpIn';'
    27225 +
    27226 +    /*
    27227 +     * Verify.
    27228 +     */
    27229 +    if (pos('verify', sOperation) <= 0) then
    27230 +        return 0;
    27231 +    if (    \CfgVerifyFile(sPathWarpIn'\wic.exe', fQuiet),
    27232 +        |   \CfgVerifyFile(sPathWarpIn'\wpirtl.dll', fQuiet),
    27233 +        |   \CfgVerifyFile(sPathWarpIn'\warpin.exe', fQuiet),
    27234 +        ) then
    27235 +        return 2;
    27236 +    rc = CheckCmdOutput('wic', 1, fQuiet, '2002 - WarpIn archive creation and maintenance');
    27237 +return rc;
    27238 +
    27239 +
    27240 +
    27241 +/*
    27242 + * Watcom C/C++ v11.0
    27243 + */
    27244 +WatcomC11: procedure expose aCfg. aPath.
    27245 +    parse arg sToolId,sOperation,fRM,fQuiet, iBits
    27246 +
    27247 +    /*
    27248 +     * Watcom C/C++ v11.0 main directory
    27249 +     */
    27250 +    sPathWatcom = PathQuery('watcom11', sToolId, sOperation);
    27251 +    if (sPathWatcom = '') then
    27252 +        return 1;
    27253 +    /* If config operation we're done now. */
    27254 +    if (pos('config', sOperation) > 0) then
    27255 +        return 0;
    27256 +
    27257 +    /*
    27258 +     * Installing the environment variables.
    27259 +     */
    27260 +    call EnvSet      fRM, 'PATH_WATCOM', sPathWatcom
    27261 +    call EnvSet      fRM, 'CCENV',      'WAT'
    27262 +    call EnvSet      fRM, 'BUILD_ENV',  'WAT11'
    27263 +    if (iBits == 16) then
    27264 +        call EnvSet      fRM, 'BUILD_ENV',  'WAT11-16'
    27265 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    27266 +
    27267 +    call EnvSet      fRM, 'watcom',      sPathWatcom
    27268 +    call EnvAddFront fRM, 'path',        sPathWatcom'\binp;'sPathWatcom'\binw;'
    27269 +    call EnvAddFront fRM, 'beginlibpath',sPathWatcom'\binp\dll;'
    27270 +    call EnvAddFront fRM, 'help',        sPathWatcom'\binp\help;'
    27271 +    call EnvAddEnd   fRM, 'bookshelf',   sPathWatcom'\binp\help;'
    27272 +    call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os2;'sPathWatcom'\h\nt;'
    27273 +    call EnvAddFront fRM, 'lib',         sPathWatcom'\lib386;'sPathWatcom'\lib386\os2;'sPathWatcom'\lib286;'sPathWatcom'\lib286\os2;'
    27274 +    call EnvSet      fRM, 'edpath',      sPathWatcom'EDDAT;'
    27275 +    /*
    27276 +    rem detach %watcom%\BINP\BATSERV.EXE
    27277 +    rem detach %watcom%\BINP\NMPBIND.EXE
    27278 +    */
    27279 +
    27280 +    /*
    27281 +     * Verify.
    27282 +     */
    27283 +    if (pos('verify', sOperation) <= 0) then
    27284 +        return 0;
    27285 +    if (    \CfgVerifyFile(sPathWatcom'\binp\wpp.exe', fQuiet),
    27286 +        |   \CfgVerifyFile(sPathWatcom'\binp\wcc.exe', fQuiet),
    27287 +        |   \CfgVerifyFile(sPathWatcom'\binp\wcc386.exe', fQuiet),
    27288 +        |   \CfgVerifyFile(sPathWatcom'\binp\wpp386.exe', fQuiet),
    27289 +        |   \CfgVerifyFile(sPathWatcom'\binp\wlink.exe', fQuiet),
    27290 +        |   \CfgVerifyFile(sPathWatcom'\lib286\os2\os2.lib', fQuiet),
    27291 +        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clbrdll.lib', fQuiet),
    27292 +        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clib3r.lib', fQuiet),
    27293 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\kernel32.lib', fQuiet,1),
    27294 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clbrdll.lib', fQuiet,1),
    27295 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clib3r.lib', fQuiet,1),
    27296 +        ) then
    27297 +        return 2;
    27298 +    rc = CheckCmdOutput('wcc', 8, fQuiet, 'Watcom C16 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    27299 +    if (rc = 0) then
    27300 +        rc = CheckCmdOutput('wpp', 8, fQuiet, 'Watcom C++16 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    27301 +    if (rc = 0) then
    27302 +        rc = CheckCmdOutput('wcc386', 8, fQuiet, 'Watcom C32 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    27303 +    if (rc = 0) then
    27304 +        rc = CheckCmdOutput('wpp386', 8, fQuiet, 'Watcom C++32 Optimizing Compiler  Version 11.0 '||'0d0a'x);
    27305 +    if (rc = 0) then
    27306 +        rc = CheckCmdOutput('wlink form ELF', 1, fQuiet, 'WATCOM Linker Version 11.0'||'0d0a'x);
    27307 +return rc;
    27308 +
    27309 +
    27310 +/*
    27311 + * Watcom C/C++ v11.0c
    27312 + */
    27313 +WatcomC11c: procedure expose aCfg. aPath.
    27314 +    parse arg sToolId,sOperation,fRM,fQuiet, iBits
    27315 +
    27316 +    /*
    27317 +     * Watcom C/C++ v11.0c main directory
    27318 +     */
    27319 +    sPathWatcom = PathQuery('watcom11c', sToolId, sOperation);
    27320 +    if (sPathWatcom = '') then
    27321 +        return 1;
    27322 +    /* If config operation we're done now. */
    27323 +    if (pos('config', sOperation) > 0) then
    27324 +        return 0;
    27325 +
    27326 +    /*
    27327 +     * Installing the environment variables.
    27328 +     */
    27329 +    call EnvSet      fRM, 'PATH_WATCOM', sPathWatcom
    27330 +    call EnvSet      fRM, 'CCENV',      'WAT'
    27331 +    call EnvSet      fRM, 'BUILD_ENV',  'WAT11C'
    27332 +    if (iBits = 16) then
    27333 +        call EnvSet      fRM, 'BUILD_ENV',  'WAT11C-16'
    27334 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    27335 +
    27336 +    call EnvSet      fRM, 'watcom',      sPathWatcom
    27337 +    call EnvAddFront fRM, 'path',        sPathWatcom'\binp;'sPathWatcom'\binw;'
    27338 +    call EnvAddFront fRM, 'beginlibpath',sPathWatcom'\binp\dll;'
    27339 +    call EnvAddFront fRM, 'help',        sPathWatcom'\binp\help;'
    27340 +    call EnvAddEnd   fRM, 'bookshelf',   sPathWatcom'\binp\help;'
    27341 +    if (iBits = 16) then
    27342 +        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os21x;'
    27343 +    else
    27344 +        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os2;'sPathWatcom'\h\nt;'
    27345 +    call EnvAddFront fRM, 'lib',         sPathWatcom'\lib386;'sPathWatcom'\lib386\os2;'sPathWatcom'\lib286;'sPathWatcom'\lib286\os2;'
    27346 +    call EnvSet      fRM, 'edpath',      sPathWatcom'EDDAT;'
    27347 +    /*
    27348 +    rem detach %watcom%\BINP\BATSERV.EXE
    27349 +    rem detach %watcom%\BINP\NMPBIND.EXE
    27350 +    */
    27351 +
    27352 +    /*
    27353 +     * Verify.
    27354 +     */
    27355 +    if (pos('verify', sOperation) <= 0) then
    27356 +        return 0;
    27357 +    if (    \CfgVerifyFile(sPathWatcom'\binp\wpp.exe', fQuiet),
    27358 +        |   \CfgVerifyFile(sPathWatcom'\binp\wcc.exe', fQuiet),
    27359 +        |   \CfgVerifyFile(sPathWatcom'\binp\wcc386.exe', fQuiet),
    27360 +        |   \CfgVerifyFile(sPathWatcom'\binp\wpp386.exe', fQuiet),
    27361 +        |   \CfgVerifyFile(sPathWatcom'\binp\wlink.exe', fQuiet),
    27362 +        |   \CfgVerifyFile(sPathWatcom'\lib286\os2\os2.lib', fQuiet, 1),
    27363 +        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clbrdll.lib', fQuiet),
    27364 +        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clib3r.lib', fQuiet),
    27365 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\kernel32.lib', fQuiet, 1),
    27366 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clbrdll.lib', fQuiet, 1),
    27367 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clib3r.lib', fQuiet, 1),
    27368 +        ) then
    27369 +        return 2;
    27370 +    rc = CheckCmdOutput('wcc', 8, fQuiet, 'Watcom C16 Optimizing Compiler  Version 11.0c');
    27371 +    if (rc = 0) then
    27372 +        rc = CheckCmdOutput('wpp', 8, fQuiet, 'Watcom C++16 Optimizing Compiler  Version 11.0c');
    27373 +    if (rc = 0) then
    27374 +        rc = CheckCmdOutput('wcc386', 8, fQuiet, 'Watcom C32 Optimizing Compiler  Version 11.0c');
    27375 +    if (rc = 0) then
    27376 +        rc = CheckCmdOutput('wpp386', 8, fQuiet, 'Watcom C++32 Optimizing Compiler  Version 11.0c');
    27377 +    if (rc = 0) then
    27378 +        rc = CheckCmdOutput('wlink form ELF', 1, fQuiet, 'WATCOM Linker Version 11.0c');
    27379 +return rc;
    27380 +
    27381 +
    27382 +/*
    27383 + * Open Watcom C/C++ v1.4 and higher
    27384 + */
    27385 +OpenWatcomC14: procedure expose aCfg. aPath.
    27386 +    parse arg sToolId,sOperation,fRM,fQuiet, iBits
    27387 +
    27388 +    /*
    27389 +     * Watcom C/C++ v1.4 (and higher) main directory
    27390 +     */
    27391 +    sPathId = sToolId;
    27392 +    if (pos('-', sToolId) > 0) then
    27393 +        sPathId = substr(sToolId, 1, pos('-', sToolId));
    27394 +    sPathWatcom = PathQuery(sPathId, sToolId, sOperation);
    27395 +    if (sPathWatcom = '') then
    27396 +        return 1;
    27397 +    /* If config operation we're done now. */
    27398 +    if (pos('config', sOperation) > 0) then
    27399 +        return 0;
    27400 +
    27401 +    /*
    27402 +     * Installing the environment variables.
    27403 +     */
    27404 +    call EnvSet      fRM, 'PATH_WATCOM', sPathWatcom
    27405 +    call EnvSet      fRM, 'CCENV',      'WAT'
    27406 +    call EnvSet      fRM, 'BUILD_ENV',  'OW14'
    27407 +    if (iBits = 16) then
    27408 +        call EnvSet      fRM, 'BUILD_ENV',  'OW14-16'
    27409 +    call EnvSet      fRM, 'BUILD_PLATFORM', 'OS2'
    27410 +
    27411 +    call EnvSet      fRM, 'watcom',      sPathWatcom
    27412 +    call EnvAddFront fRM, 'path',        sPathWatcom'\binp;'sPathWatcom'\binw;'
    27413 +    call EnvAddFront fRM, 'beginlibpath',sPathWatcom'\binp\dll;'
    27414 +    call EnvAddFront fRM, 'help',        sPathWatcom'\binp\help;'
    27415 +    call EnvAddEnd   fRM, 'bookshelf',   sPathWatcom'\binp\help;'
    27416 +    if (iBits = 16) then
    27417 +        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os21x;'
    27418 +    else
    27419 +        call EnvAddFront fRM, 'include',     sPathWatcom'\h;'sPathWatcom'\h\os2;'sPathWatcom'\h\nt;'
    27420 +    call EnvAddFront fRM, 'lib',         sPathWatcom'\lib386;'sPathWatcom'\lib386\os2;'sPathWatcom'\lib286;'sPathWatcom'\lib286\os2;'
    27421 +    call EnvSet      fRM, 'edpath',      sPathWatcom'EDDAT;'
    27422 +    /*
    27423 +    rem detach %watcom%\BINP\BATSERV.EXE
    27424 +    rem detach %watcom%\BINP\NMPBIND.EXE
    27425 +    */
    27426 +
    27427 +    /*
    27428 +     * Verify.
    27429 +     */
    27430 +    if (pos('verify', sOperation) <= 0) then
    27431 +        return 0;
    27432 +    if (    \CfgVerifyFile(sPathWatcom'\binp\wpp.exe', fQuiet),
    27433 +        |   \CfgVerifyFile(sPathWatcom'\binp\wcc.exe', fQuiet),
    27434 +        |   \CfgVerifyFile(sPathWatcom'\binp\wcc386.exe', fQuiet),
    27435 +        |   \CfgVerifyFile(sPathWatcom'\binp\wpp386.exe', fQuiet),
    27436 +        |   \CfgVerifyFile(sPathWatcom'\binp\wlink.exe', fQuiet),
    27437 +        |   \CfgVerifyFile(sPathWatcom'\lib286\os2\os2.lib', fQuiet, 1),
    27438 +        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clbrdll.lib', fQuiet),
    27439 +        |   \CfgVerifyFile(sPathWatcom'\lib386\os2\clib3r.lib', fQuiet),
    27440 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\kernel32.lib', fQuiet, 1),
    27441 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clbrdll.lib', fQuiet, 1),
    27442 +        |   \CfgVerifyFile(sPathWatcom'\lib386\nt\clib3r.lib', fQuiet, 1),
    27443 +        ) then
    27444 +        return 2;
    27445 +    rc = CheckCmdOutput('wcc', 8, fQuiet, 'Open Watcom C16 Optimizing Compiler Version 1.4');
    27446 +    if (rc = 0) then
    27447 +        rc = CheckCmdOutput('wpp', 8, fQuiet, 'Open Watcom C++16 Optimizing Compiler Version 1.4');
    27448 +    if (rc = 0) then
    27449 +        rc = CheckCmdOutput('wcc386', 8, fQuiet, 'Open Watcom C32 Optimizing Compiler Version 1.4');
    27450 +    if (rc = 0) then
    27451 +        rc = CheckCmdOutput('wpp386', 8, fQuiet, 'Open Watcom C++32 Optimizing Compiler Version 1.4');
    27452 +    if (rc = 0) then
    27453 +        rc = CheckCmdOutput('wlink form ELF', 1, fQuiet, 'Open Watcom Linker Version 1.4');
    27454 +return rc;
    27455 +
    27456 diff --git a/tools/bin/lxlite.cmd b/tools/bin/lxlite.cmd
    27457 index 2bbb443..3460f79 100644
    27458 --- a/tools/bin/lxlite.cmd
    27459 +++ b/tools/bin/lxlite.cmd
    27460 @@ -1,22 +1,22 @@
    27461 -/* $Id: lxlite.cmd,v 1.1 2002-08-24 22:33:46 bird Exp $
    27462 - *
    27463 - * LXLite wrapper to fix EA problem on LAN Server volumes with JFS.
    27464 - *
    27465 - * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    27466 - *
    27467 - */
    27468 -
    27469 -/* get input&output filename */
    27470 -parse arg sFilename
    27471 -
    27472 -/* get lxlite directory */
    27473 -parse source . . sSource
    27474 -sDir = filespec('drive', sSource) || filespec('path', sSource);
    27475 -
    27476 -/* stripp of EAs to avoid errors */
    27477 -'eautil' sFilename 'nul /s'
    27478 -
    27479 -/* call lxlite */
    27480 -sDir||'lxlite.exe' sFilename
    27481 -return rc;
    27482 -
    27483 +/* $Id: lxlite.cmd,v 1.1 2002-08-24 22:33:46 bird Exp $
    27484 + *
    27485 + * LXLite wrapper to fix EA problem on LAN Server volumes with JFS.
    27486 + *
    27487 + * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    27488 + *
    27489 + */
    27490 +
    27491 +/* get input&output filename */
    27492 +parse arg sFilename
    27493 +
    27494 +/* get lxlite directory */
    27495 +parse source . . sSource
    27496 +sDir = filespec('drive', sSource) || filespec('path', sSource);
    27497 +
    27498 +/* stripp of EAs to avoid errors */
    27499 +'eautil' sFilename 'nul /s'
    27500 +
    27501 +/* call lxlite */
    27502 +sDir||'lxlite.exe' sFilename
    27503 +return rc;
    27504 +
    27505 diff --git a/tools/bin/mapsymWat.cmd b/tools/bin/mapsymWat.cmd
    27506 index 6590865..55b387f 100644
    27507 --- a/tools/bin/mapsymWat.cmd
    27508 +++ b/tools/bin/mapsymWat.cmd
    27509 @@ -1,92 +1,92 @@
    27510 -/* $Id: mapsymWat.cmd,v 1.1 2000-11-21 04:34:58 bird Exp $
    27511 - *
    27512 - * Script which makes .sym file from Watcom Map file.
    27513 - *  Requires: wat2map - which didn't work.
    27514 - *            Currently it only make a dummy .sym file.
    27515 - *
    27516 - * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    27517 - *
    27518 - * Project Odin Software License can be found in LICENSE.TXT
    27519 - *
    27520 - */
    27521 -
    27522 -/*
    27523 - * Parse input and make sSym filename.
    27524 - */
    27525 -parse arg sMap sDummy
    27526 -
    27527 -iExtPos = lastpos('.', sMap);
    27528 -if (sMap = '' | substr(sMap, 1, 1) = '-' | iExtPos <= 0 | sDummy <> '') then
    27529 -do
    27530 -    say 'syntax error';
    27531 -    say 'mapsymWat.cmd <mapfile>';
    27532 -    exit(1);
    27533 -end
    27534 -sSym = substr(sMap, 1, iExtPos)||'sym';
    27535 -
    27536 -/*
    27537 - * Determin temporary directory.
    27538 - */
    27539 -sTmp = VALUE('TMP',,'OS2ENVIRONMENT');
    27540 -if (sTmp = '') then
    27541 -    sTmp = VALUE('TEMP',,'OS2ENVIRONMENT');
    27542 -if (sTmp = '') then
    27543 -    sTmp = '.';
    27544 -
    27545 -/*
    27546 - * Make temporary filename.
    27547 - */
    27548 -call RxFuncAdd 'SysTempFileName', 'RexxUtil', 'SysTempFileName'
    27549 -call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
    27550 -/* start: remove this code when the rest of the scrip is working again. */
    27551 -call SysFileDelete sSym;
    27552 -call stream sSym, 'c', 'open write';
    27553 -call stream sSym, 'c', 'close';
    27554 -exit(0);
    27555 -/* end */
    27556 -sTempFile = SysTempFileName(sTmp'\mapsymw.???');
    27557 -if (sTempFile = '') then
    27558 -do
    27559 -    say 'error: failed to make temporary file!';
    27560 -    exit(2);
    27561 -end
    27562 -sTempSymFile = substr(sTempFile, 1, length(sTempFile)-3)||'sym';
    27563 -
    27564 -/*
    27565 - * Convert the Watcom mapfile to a mapfile mapsym likes.
    27566 - */
    27567 -'wat2map' sMap sTempFile
    27568 -if (rc <> 0) then do
    27569 -    say 'error: Wat2Map failed with rc='rc'.';
    27570 -    exit(rc);
    27571 -end
    27572 -
    27573 -/*
    27574 - * Run mapsym.
    27575 - */
    27576 -sOldDir = directory();
    27577 -call directory(sTmp);
    27578 -'mapsym' sTempFile
    27579 -retrc = rc;
    27580 -call directory(sOldDir);
    27581 -if (retrc <> 0) then
    27582 -do
    27583 -    say 'error: mapsym failed with rc='rc'.';
    27584 -    call SysFileDelete sTempFile
    27585 -    call SysFileDelete sTempSymFile
    27586 -    exit(retrc);
    27587 -end
    27588 -
    27589 -/*
    27590 - * Copy result sym file to target sym file.
    27591 - */
    27592 -'copy' sTempSymFile sSym
    27593 -retrc = rc;
    27594 -if (rc <> 0) then
    27595 -    say 'error: copy failed with rc='rc'.';
    27596 -
    27597 -/* Cleanup and exit */
    27598 -call SysFileDelete sTempFile
    27599 -call SysFileDelete sTempSymFile
    27600 -exit(retrc);
    27601 -
    27602 +/* $Id: mapsymWat.cmd,v 1.1 2000-11-21 04:34:58 bird Exp $
    27603 + *
    27604 + * Script which makes .sym file from Watcom Map file.
    27605 + *  Requires: wat2map - which didn't work.
    27606 + *            Currently it only make a dummy .sym file.
    27607 + *
    27608 + * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    27609 + *
    27610 + * Project Odin Software License can be found in LICENSE.TXT
    27611 + *
    27612 + */
    27613 +
    27614 +/*
    27615 + * Parse input and make sSym filename.
    27616 + */
    27617 +parse arg sMap sDummy
    27618 +
    27619 +iExtPos = lastpos('.', sMap);
    27620 +if (sMap = '' | substr(sMap, 1, 1) = '-' | iExtPos <= 0 | sDummy <> '') then
    27621 +do
    27622 +    say 'syntax error';
    27623 +    say 'mapsymWat.cmd <mapfile>';
    27624 +    exit(1);
    27625 +end
    27626 +sSym = substr(sMap, 1, iExtPos)||'sym';
    27627 +
    27628 +/*
    27629 + * Determin temporary directory.
    27630 + */
    27631 +sTmp = VALUE('TMP',,'OS2ENVIRONMENT');
    27632 +if (sTmp = '') then
    27633 +    sTmp = VALUE('TEMP',,'OS2ENVIRONMENT');
    27634 +if (sTmp = '') then
    27635 +    sTmp = '.';
    27636 +
    27637 +/*
    27638 + * Make temporary filename.
    27639 + */
    27640 +call RxFuncAdd 'SysTempFileName', 'RexxUtil', 'SysTempFileName'
    27641 +call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
    27642 +/* start: remove this code when the rest of the scrip is working again. */
    27643 +call SysFileDelete sSym;
    27644 +call stream sSym, 'c', 'open write';
    27645 +call stream sSym, 'c', 'close';
    27646 +exit(0);
    27647 +/* end */
    27648 +sTempFile = SysTempFileName(sTmp'\mapsymw.???');
    27649 +if (sTempFile = '') then
    27650 +do
    27651 +    say 'error: failed to make temporary file!';
    27652 +    exit(2);
    27653 +end
    27654 +sTempSymFile = substr(sTempFile, 1, length(sTempFile)-3)||'sym';
    27655 +
    27656 +/*
    27657 + * Convert the Watcom mapfile to a mapfile mapsym likes.
    27658 + */
    27659 +'wat2map' sMap sTempFile
    27660 +if (rc <> 0) then do
    27661 +    say 'error: Wat2Map failed with rc='rc'.';
    27662 +    exit(rc);
    27663 +end
    27664 +
    27665 +/*
    27666 + * Run mapsym.
    27667 + */
    27668 +sOldDir = directory();
    27669 +call directory(sTmp);
    27670 +'mapsym' sTempFile
    27671 +retrc = rc;
    27672 +call directory(sOldDir);
    27673 +if (retrc <> 0) then
    27674 +do
    27675 +    say 'error: mapsym failed with rc='rc'.';
    27676 +    call SysFileDelete sTempFile
    27677 +    call SysFileDelete sTempSymFile
    27678 +    exit(retrc);
    27679 +end
    27680 +
    27681 +/*
    27682 + * Copy result sym file to target sym file.
    27683 + */
    27684 +'copy' sTempSymFile sSym
    27685 +retrc = rc;
    27686 +if (rc <> 0) then
    27687 +    say 'error: copy failed with rc='rc'.';
    27688 +
    27689 +/* Cleanup and exit */
    27690 +call SysFileDelete sTempFile
    27691 +call SysFileDelete sTempSymFile
    27692 +exit(retrc);
    27693 +
    27694 diff --git a/tools/bin/runmapsym.cmd b/tools/bin/runmapsym.cmd
    27695 index 8398d43..8e199b9 100644
    27696 --- a/tools/bin/runmapsym.cmd
    27697 +++ b/tools/bin/runmapsym.cmd
    27698 @@ -1,162 +1,162 @@
    27699 -/* REXX */
    27700 -/*
    27701 - * Works around stupid mapsym dumbness regarding the output .sym path.
    27702 - *
    27703 - * (c) too simple to be copyrighted
    27704 - */
    27705 -
    27706 -'@echo off'
    27707 -
    27708 -if (RxFuncQuery('SysLoadFuncs')) then do
    27709 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
    27710 -    call SysLoadFuncs
    27711 -end
    27712 -
    27713 -parse arg aArgs
    27714 -call TokenizeString aArgs, 'G.!args'
    27715 -
    27716 -if (G.!args.0 < 3) then do
    27717 -    say "Usage: runmapsym <mapsym_cmd> <map_file> <sym_file>"
    27718 -    exit 255
    27719 -end
    27720 -
    27721 -aMapSymEXE = translate(G.!args.1, '\' , '/')
    27722 -aMapFile = translate(G.!args.2, '\' , '/')
    27723 -aSymFile = translate(G.!args.3, '\' , '/')
    27724 -
    27725 -curDir = directory()
    27726 -
    27727 -mapSymExeDir = filespec('D', aMapSymEXE)||filespec('P', aMapSymEXE)
    27728 -if (mapSymExeDir \== '') then do
    27729 -    if (right(mapSymExeDir, 2) \== ':\') then
    27730 -        mapSymExeDir = strip(mapSymExeDir, 'T', '\')
    27731 -    mapSymExeDir = directory(mapSymExeDir)
    27732 -    if (mapSymExeDir == '') then do
    27733 -        say 'ERROR: Directory of "'aMapSymEXE'" does not exist.'
    27734 -        exit 255
    27735 -    end
    27736 -    if (right(mapSymExeDir, 2) \== ':\') then
    27737 -        mapSymExeDir = mapSymExeDir'\'
    27738 -    mapSymExe = mapSymExeDir||filespec('N', aMapSymEXE)
    27739 -end
    27740 -else do
    27741 -    mapSymExe = aMapSymEXE
    27742 -end
    27743 -
    27744 -call directory curDir
    27745 -
    27746 -mapFile = stream(aMapFile, 'C', 'QUERY EXISTS')
    27747 -if (mapFile == '') then do
    27748 -    say 'ERROR: Cannot find file "'aMapFile'".'
    27749 -    exit 255
    27750 -end
    27751 -
    27752 -symDir = filespec('D', aSymFile)||filespec('P', aSymFile)
    27753 -if (symDir == '') then symDir = '.'
    27754 -else if (right(symDir, 2) \== ':\') then symDir = strip(symDir, 'T', '\')
    27755 -symDir = directory(symDir)
    27756 -if (symDir == '') then do
    27757 -    say 'ERROR: Directory of "'aSymFile'" does not exist.'
    27758 -    exit 255
    27759 -end
    27760 -
    27761 -symFile = fileSpec('N', aSymFile)
    27762 -
    27763 -'call' mapSymExe mapFile
    27764 -
    27765 -if (rc \== 0) then do
    27766 -    say 'ERROR: Executing "'aMapSymExe'" failed with exit code 'rc'.'
    27767 -end
    27768 -else do
    27769 -    dumbSymFile = filespec('N', mapFile)
    27770 -    lastDot = lastpos('.', dumbSymFile)
    27771 -    if (lastDot > 0) then dumbSymFile = left(dumbSymFile, lastDot - 1)
    27772 -    dumbSymFile = dumbSymFile'.sym'
    27773 -    if (translate(symFile) \== translate(dumbSymFile)) then do
    27774 -        'del' symFile '1>nul 2>nul'
    27775 -        'rename' dumbSymFile symFile
    27776 -        if (rc \== 0) then do
    27777 -            say 'ERROR: Renaming "'dumbSymFile'" to "'symFile'"',
    27778 -                'failed with exit code 'rc'.'
    27779 -        end
    27780 -    end
    27781 -end
    27782 -
    27783 -call directory curDir
    27784 -
    27785 -exit rc
    27786 -
    27787 -/**
    27788 - *  Returns a list of all words from the string as a stem.
    27789 - *  Delimiters are spaces, tabs and new line characters.
    27790 - *  Words containg spaces must be enclosed with double
    27791 - *  quotes. Double quote symbols that need to be a part
    27792 - *  of the word, must be doubled.
    27793 - *
    27794 - *  @param string   the string to tokenize
    27795 - *  @param stem
    27796 - *      the name of the stem. The stem must be global
    27797 - *      (i.e. its name must start with 'G.!'), for example,
    27798 - *      'G.!wordlist'.
    27799 - *  @param leave_ws
    27800 - *      1 means whitespace chars are considered as a part of words they follow.
    27801 - *      Leading whitespace (if any) is always a part of the first word (if any).
    27802 - *
    27803 - *  @version 1.1
    27804 - */
    27805 -TokenizeString: procedure expose G.
    27806 -
    27807 -    parse arg string, stem, leave_ws
    27808 -    leave_ws = (leave_ws == 1)
    27809 -
    27810 -    delims  = '20090D0A'x
    27811 -    quote   = '22'x /* " */
    27812 -
    27813 -    num = 0
    27814 -    token = ''
    27815 -
    27816 -    len = length(string)
    27817 -    last_state = '' /* D - in delim, Q - in quotes, W - in word */
    27818 -    seen_QW = 0
    27819 -
    27820 -    do i = 1 to len
    27821 -        c = substr(string, i, 1)
    27822 -        /* determine a new state */
    27823 -        if (c == quote) then do
    27824 -            if (last_state == 'Q') then do
    27825 -                /* detect two double quotes in a row */
    27826 -                if (substr(string, i + 1, 1) == quote) then i = i + 1
    27827 -                else state = 'W'
    27828 -            end
    27829 -            else state = 'Q'
    27830 -        end
    27831 -        else if (verify(c, delims) == 0 & last_state \== 'Q') then do
    27832 -            state = 'D'
    27833 -        end
    27834 -        else do
    27835 -            if (last_state == 'Q') then state = 'Q'
    27836 -            else state = 'W'
    27837 -        end
    27838 -        /* process state transitions */
    27839 -        if ((last_state == 'Q' | state == 'Q') & state \== last_state) then c = ''
    27840 -        else if (state == 'D' & \leave_ws) then c = ''
    27841 -        if (last_state == 'D' & state \== 'D' & seen_QW) then do
    27842 -            /* flush the token */
    27843 -            num = num + 1
    27844 -            call value stem'.'num, token
    27845 -            token = ''
    27846 -        end
    27847 -        token = token||c
    27848 -        last_state = state
    27849 -        seen_QW = (seen_QW | state \== 'D')
    27850 -    end
    27851 -
    27852 -    /* flush the last token if any */
    27853 -    if (token \== '' | seen_QW) then do
    27854 -        num = num + 1
    27855 -        call value stem'.'num, token
    27856 -    end
    27857 -
    27858 -    call value stem'.0', num
    27859 -
    27860 -    return
    27861 +/* REXX */
    27862 +/*
    27863 + * Works around stupid mapsym dumbness regarding the output .sym path.
    27864 + *
    27865 + * (c) too simple to be copyrighted
    27866 + */
    27867 +
    27868 +'@echo off'
    27869 +
    27870 +if (RxFuncQuery('SysLoadFuncs')) then do
    27871 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
    27872 +    call SysLoadFuncs
    27873 +end
    27874 +
    27875 +parse arg aArgs
    27876 +call TokenizeString aArgs, 'G.!args'
    27877 +
    27878 +if (G.!args.0 < 3) then do
    27879 +    say "Usage: runmapsym <mapsym_cmd> <map_file> <sym_file>"
    27880 +    exit 255
    27881 +end
    27882 +
    27883 +aMapSymEXE = translate(G.!args.1, '\' , '/')
    27884 +aMapFile = translate(G.!args.2, '\' , '/')
    27885 +aSymFile = translate(G.!args.3, '\' , '/')
    27886 +
    27887 +curDir = directory()
    27888 +
    27889 +mapSymExeDir = filespec('D', aMapSymEXE)||filespec('P', aMapSymEXE)
    27890 +if (mapSymExeDir \== '') then do
    27891 +    if (right(mapSymExeDir, 2) \== ':\') then
    27892 +        mapSymExeDir = strip(mapSymExeDir, 'T', '\')
    27893 +    mapSymExeDir = directory(mapSymExeDir)
    27894 +    if (mapSymExeDir == '') then do
    27895 +        say 'ERROR: Directory of "'aMapSymEXE'" does not exist.'
    27896 +        exit 255
    27897 +    end
    27898 +    if (right(mapSymExeDir, 2) \== ':\') then
    27899 +        mapSymExeDir = mapSymExeDir'\'
    27900 +    mapSymExe = mapSymExeDir||filespec('N', aMapSymEXE)
    27901 +end
    27902 +else do
    27903 +    mapSymExe = aMapSymEXE
    27904 +end
    27905 +
    27906 +call directory curDir
    27907 +
    27908 +mapFile = stream(aMapFile, 'C', 'QUERY EXISTS')
    27909 +if (mapFile == '') then do
    27910 +    say 'ERROR: Cannot find file "'aMapFile'".'
    27911 +    exit 255
    27912 +end
    27913 +
    27914 +symDir = filespec('D', aSymFile)||filespec('P', aSymFile)
    27915 +if (symDir == '') then symDir = '.'
    27916 +else if (right(symDir, 2) \== ':\') then symDir = strip(symDir, 'T', '\')
    27917 +symDir = directory(symDir)
    27918 +if (symDir == '') then do
    27919 +    say 'ERROR: Directory of "'aSymFile'" does not exist.'
    27920 +    exit 255
    27921 +end
    27922 +
    27923 +symFile = fileSpec('N', aSymFile)
    27924 +
    27925 +'call' mapSymExe mapFile
    27926 +
    27927 +if (rc \== 0) then do
    27928 +    say 'ERROR: Executing "'aMapSymExe'" failed with exit code 'rc'.'
    27929 +end
    27930 +else do
    27931 +    dumbSymFile = filespec('N', mapFile)
    27932 +    lastDot = lastpos('.', dumbSymFile)
    27933 +    if (lastDot > 0) then dumbSymFile = left(dumbSymFile, lastDot - 1)
    27934 +    dumbSymFile = dumbSymFile'.sym'
    27935 +    if (translate(symFile) \== translate(dumbSymFile)) then do
    27936 +        'del' symFile '1>nul 2>nul'
    27937 +        'rename' dumbSymFile symFile
    27938 +        if (rc \== 0) then do
    27939 +            say 'ERROR: Renaming "'dumbSymFile'" to "'symFile'"',
    27940 +                'failed with exit code 'rc'.'
    27941 +        end
    27942 +    end
    27943 +end
    27944 +
    27945 +call directory curDir
    27946 +
    27947 +exit rc
    27948 +
    27949 +/**
    27950 + *  Returns a list of all words from the string as a stem.
    27951 + *  Delimiters are spaces, tabs and new line characters.
    27952 + *  Words containg spaces must be enclosed with double
    27953 + *  quotes. Double quote symbols that need to be a part
    27954 + *  of the word, must be doubled.
    27955 + *
    27956 + *  @param string   the string to tokenize
    27957 + *  @param stem
    27958 + *      the name of the stem. The stem must be global
    27959 + *      (i.e. its name must start with 'G.!'), for example,
    27960 + *      'G.!wordlist'.
    27961 + *  @param leave_ws
    27962 + *      1 means whitespace chars are considered as a part of words they follow.
    27963 + *      Leading whitespace (if any) is always a part of the first word (if any).
    27964 + *
    27965 + *  @version 1.1
    27966 + */
    27967 +TokenizeString: procedure expose G.
    27968 +
    27969 +    parse arg string, stem, leave_ws
    27970 +    leave_ws = (leave_ws == 1)
    27971 +
    27972 +    delims  = '20090D0A'x
    27973 +    quote   = '22'x /* " */
    27974 +
    27975 +    num = 0
    27976 +    token = ''
    27977 +
    27978 +    len = length(string)
    27979 +    last_state = '' /* D - in delim, Q - in quotes, W - in word */
    27980 +    seen_QW = 0
    27981 +
    27982 +    do i = 1 to len
    27983 +        c = substr(string, i, 1)
    27984 +        /* determine a new state */
    27985 +        if (c == quote) then do
    27986 +            if (last_state == 'Q') then do
    27987 +                /* detect two double quotes in a row */
    27988 +                if (substr(string, i + 1, 1) == quote) then i = i + 1
    27989 +                else state = 'W'
    27990 +            end
    27991 +            else state = 'Q'
    27992 +        end
    27993 +        else if (verify(c, delims) == 0 & last_state \== 'Q') then do
    27994 +            state = 'D'
    27995 +        end
    27996 +        else do
    27997 +            if (last_state == 'Q') then state = 'Q'
    27998 +            else state = 'W'
    27999 +        end
    28000 +        /* process state transitions */
    28001 +        if ((last_state == 'Q' | state == 'Q') & state \== last_state) then c = ''
    28002 +        else if (state == 'D' & \leave_ws) then c = ''
    28003 +        if (last_state == 'D' & state \== 'D' & seen_QW) then do
    28004 +            /* flush the token */
    28005 +            num = num + 1
    28006 +            call value stem'.'num, token
    28007 +            token = ''
    28008 +        end
    28009 +        token = token||c
    28010 +        last_state = state
    28011 +        seen_QW = (seen_QW | state \== 'D')
    28012 +    end
    28013 +
    28014 +    /* flush the last token if any */
    28015 +    if (token \== '' | seen_QW) then do
    28016 +        num = num + 1
    28017 +        call value stem'.'num, token
    28018 +    end
    28019 +
    28020 +    call value stem'.0', num
    28021 +
    28022 +    return
    28023 diff --git a/tools/bin/spec2def.cmd b/tools/bin/spec2def.cmd
    28024 index 16b6526..85ed127 100644
    28025 --- a/tools/bin/spec2def.cmd
    28026 +++ b/tools/bin/spec2def.cmd
    28027 @@ -1,104 +1,104 @@
    28028 -/*
    28029 - */
    28030 -'@echo off'
    28031 -
    28032 -/*
    28033 - * Parse argument(s).
    28034 - */
    28035 -parse arg inFileSpec
    28036 -
    28037 -dllName = substr(inFileSpec,1,pos('.', inFileSpec)-1);
    28038 -outFileDef = dllName".def"
    28039 -
    28040 -rc = stream(inFileSpec, 'c', 'open read');
    28041 -
    28042 -if (pos('READY', rc) <> 1) then
    28043 -do
    28044 -    say 'Failed to open include file' inFileSpec'.';
    28045 -    exit(-20);
    28046 -end
    28047 -
    28048 -rc = stream(outFileDef, 'c', 'open write');
    28049 -
    28050 -if (pos('READY', rc) <> 1) then
    28051 -do
    28052 -    say 'Failed to open include file' outFileDef'.';
    28053 -    exit(-20);
    28054 -end
    28055 -
    28056 -ordinal = 0
    28057 -
    28058 -Call LINEOUT outFileDef, "LIBRARY "TRANSLATE(dllName)" INITINSTANCE"
    28059 -Call LINEOUT outFileDef, "DESCRIPTION 'Odin32 System DLL - "dllName"'"
    28060 -Call LINEOUT outFileDef, "DATA MULTIPLE NONSHARED"
    28061 -Call LINEOUT outFileDef, ""
    28062 -Call LINEOUT outFileDef, "EXPORTS"
    28063 -Call LINEOUT outFileDef, ""
    28064 -
    28065 -do while (lines(inFileSpec) > 0)
    28066 -    varSize = 0;   
    28067 -    comment = 0;
    28068 -    sLine = strip(linein(inFileSpec));
    28069 -    if (sLine = '') then
    28070 -        iterate;
    28071 -    if (substr(sLine, 1, 1) <> '@') then
    28072 -        iterate;
    28073 -    ordinal = ordinal + 1;
    28074 -    sLine1 = sLine;
    28075 -    sLine = substr(sLine, 3);
    28076 -    if (word(sLine, 1) = 'stdcall') then
    28077 -        sLine = substr(sLine, 8);
    28078 -    if (word(sLine, 1) = 'stub') then
    28079 -    do
    28080 -        sLine = substr(sLine, 5);
    28081 -        comment = 1
    28082 -    end
    28083 -    sLine = strip(sLine);
    28084 -    if (word(sLine, 1) = '#') then
    28085 -        sLine = substr(sLine, 2);
    28086 -    sLine = strip(sLine);
    28087 -    if (word(sLine, 1) = '-private') then
    28088 -        sLine = substr(sLine, 9);
    28089 -    openSkobkaPos = pos('(',sLine);
    28090 -    if (openSkobkaPos > 0) then
    28091 -    do
    28092 -        funcName = strip(substr(sLine,1,openSkobkaPos-1));
    28093 -       ordinalFuncName = funcName;
    28094 -        closeSkobkaPos = pos(')',sLine);
    28095 -        sLine = substr(sLine,openSkobkaPos+1, closeSkobkaPos-openSkobkaPos-1);
    28096 -        /* now sLine contains parameters */
    28097 -       say '"'sLine'"' words(sLine)
    28098 -        varSize = words(sLine)*4;
    28099 -    end
    28100 -    else
    28101 -    do
    28102 -        funcName = strip(sLine);
    28103 -    end
    28104 -
    28105 -    /* check if ordinal name is differ from real func name */
    28106 -    funcNamePos = pos(funcName, word(sLine1, words(sLine1)));
    28107 -    if (funcNamePos > 0) then
    28108 -    do
    28109 -      /* found different func name. get last word as funcname */
    28110 -      funcName = word(sLine1, words(sLine1));
    28111 -      /* strip brackets */
    28112 -      openSkobkaPos1 = pos('(',funcName);
    28113 -      if (openSkobkaPos1 > 0) then
    28114 -      do
    28115 -        funcName = strip(substr(funcName,1,openSkobkaPos1-1));
    28116 -      end
    28117 -    end
    28118 -
    28119 -    if (comment == 1) then
    28120 -        outStr = ";"ordinalFuncName" = _"funcName;
    28121 -    else
    28122 -        outStr = ordinalFuncName" = _"funcName;
    28123 -    if (varSize > 0 | openSkobkaPos > 0) then
    28124 -        outStr = outStr"@"varSize;
    28125 -    outStr = outStr" @"ordinal;
    28126 -    Call LINEOUT outFileDef, outStr
    28127 -    /* say outStr */
    28128 -end
    28129 -
    28130 -call stream inFileSpec, 'c', 'close';
    28131 -call stream outFileDef, 'c', 'close';
    28132 +/*
    28133 + */
    28134 +'@echo off'
    28135 +
    28136 +/*
    28137 + * Parse argument(s).
    28138 + */
    28139 +parse arg inFileSpec
    28140 +
    28141 +dllName = substr(inFileSpec,1,pos('.', inFileSpec)-1);
    28142 +outFileDef = dllName".def"
    28143 +
    28144 +rc = stream(inFileSpec, 'c', 'open read');
    28145 +
    28146 +if (pos('READY', rc) <> 1) then
    28147 +do
    28148 +    say 'Failed to open include file' inFileSpec'.';
    28149 +    exit(-20);
    28150 +end
    28151 +
    28152 +rc = stream(outFileDef, 'c', 'open write');
    28153 +
    28154 +if (pos('READY', rc) <> 1) then
    28155 +do
    28156 +    say 'Failed to open include file' outFileDef'.';
    28157 +    exit(-20);
    28158 +end
    28159 +
    28160 +ordinal = 0
    28161 +
    28162 +Call LINEOUT outFileDef, "LIBRARY "TRANSLATE(dllName)" INITINSTANCE"
    28163 +Call LINEOUT outFileDef, "DESCRIPTION 'Odin32 System DLL - "dllName"'"
    28164 +Call LINEOUT outFileDef, "DATA MULTIPLE NONSHARED"
    28165 +Call LINEOUT outFileDef, ""
    28166 +Call LINEOUT outFileDef, "EXPORTS"
    28167 +Call LINEOUT outFileDef, ""
    28168 +
    28169 +do while (lines(inFileSpec) > 0)
    28170 +    varSize = 0;   
    28171 +    comment = 0;
    28172 +    sLine = strip(linein(inFileSpec));
    28173 +    if (sLine = '') then
    28174 +        iterate;
    28175 +    if (substr(sLine, 1, 1) <> '@') then
    28176 +        iterate;
    28177 +    ordinal = ordinal + 1;
    28178 +    sLine1 = sLine;
    28179 +    sLine = substr(sLine, 3);
    28180 +    if (word(sLine, 1) = 'stdcall') then
    28181 +        sLine = substr(sLine, 8);
    28182 +    if (word(sLine, 1) = 'stub') then
    28183 +    do
    28184 +        sLine = substr(sLine, 5);
    28185 +        comment = 1
    28186 +    end
    28187 +    sLine = strip(sLine);
    28188 +    if (word(sLine, 1) = '#') then
    28189 +        sLine = substr(sLine, 2);
    28190 +    sLine = strip(sLine);
    28191 +    if (word(sLine, 1) = '-private') then
    28192 +        sLine = substr(sLine, 9);
    28193 +    openSkobkaPos = pos('(',sLine);
    28194 +    if (openSkobkaPos > 0) then
    28195 +    do
    28196 +        funcName = strip(substr(sLine,1,openSkobkaPos-1));
    28197 +       ordinalFuncName = funcName;
    28198 +        closeSkobkaPos = pos(')',sLine);
    28199 +        sLine = substr(sLine,openSkobkaPos+1, closeSkobkaPos-openSkobkaPos-1);
    28200 +        /* now sLine contains parameters */
    28201 +       say '"'sLine'"' words(sLine)
    28202 +        varSize = words(sLine)*4;
    28203 +    end
    28204 +    else
    28205 +    do
    28206 +        funcName = strip(sLine);
    28207 +    end
    28208 +
    28209 +    /* check if ordinal name is differ from real func name */
    28210 +    funcNamePos = pos(funcName, word(sLine1, words(sLine1)));
    28211 +    if (funcNamePos > 0) then
    28212 +    do
    28213 +      /* found different func name. get last word as funcname */
    28214 +      funcName = word(sLine1, words(sLine1));
    28215 +      /* strip brackets */
    28216 +      openSkobkaPos1 = pos('(',funcName);
    28217 +      if (openSkobkaPos1 > 0) then
    28218 +      do
    28219 +        funcName = strip(substr(funcName,1,openSkobkaPos1-1));
    28220 +      end
    28221 +    end
    28222 +
    28223 +    if (comment == 1) then
    28224 +        outStr = ";"ordinalFuncName" = _"funcName;
    28225 +    else
    28226 +        outStr = ordinalFuncName" = _"funcName;
    28227 +    if (varSize > 0 | openSkobkaPos > 0) then
    28228 +        outStr = outStr"@"varSize;
    28229 +    outStr = outStr" @"ordinal;
    28230 +    Call LINEOUT outFileDef, outStr
    28231 +    /* say outStr */
    28232 +end
    28233 +
    28234 +call stream inFileSpec, 'c', 'close';
    28235 +call stream outFileDef, 'c', 'close';
    28236 diff --git a/tools/bin/wmapsym.cmd b/tools/bin/wmapsym.cmd
    28237 index 07a99b6..af934f0 100644
    28238 --- a/tools/bin/wmapsym.cmd
    28239 +++ b/tools/bin/wmapsym.cmd
    28240 @@ -1,454 +1,454 @@
    28241 -/* REXX */
    28242 -/*
    28243 - * Creates a .SYM file from the Watcom .MAP file using IBM MAPSYM.
    28244 - *
    28245 - * Copyright (C) 2010-2011 Dmitriy Kuminov
    28246 - *
    28247 - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    28248 - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    28249 - */
    28250 -
    28251 -signal on syntax
    28252 -signal on halt
    28253 -signal on novalue
    28254 -trace off
    28255 -numeric digits 12
    28256 -'@echo off'
    28257 -
    28258 -
    28259 -/*------------------------------------------------------------------------------
    28260 - globals
    28261 -------------------------------------------------------------------------------*/
    28262 -
    28263 -/* all globals to be exposed in procedures */
    28264 -Globals = 'G. Opt. Static.'
    28265 -
    28266 -
    28267 -/*------------------------------------------------------------------------------
    28268 - startup + main + termination
    28269 -------------------------------------------------------------------------------*/
    28270 -
    28271 -/* init system REXX library */
    28272 -if (RxFuncQuery('SysLoadFuncs')) then do
    28273 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
    28274 -    call SysLoadFuncs
    28275 -end
    28276 -
    28277 -/* detect script file and directory */
    28278 -parse source . . G.ScriptPath
    28279 -G.ScriptDir = FixDir(filespec('D', G.ScriptPath) || filespec('P', G.ScriptPath))
    28280 -G.ScriptFile = FixDir(filespec('N', G.ScriptPath))
    28281 -G.StartDir = directory()
    28282 -
    28283 -parse arg aArgs
    28284 -if (aArgs == '') then do
    28285 -    say
    28286 -    say 'Creates a .SYM file from the Watcom .MAP file using IBM MAPSYM'
    28287 -    say 'Version 1.1 (2011-12-18)'
    28288 -    say 'Copyright (C) 2011 Dmitriy Kuminov'
    28289 -    say
    28290 -    say 'Usage: '
    28291 -    say
    28292 -    say '  'G.ScriptFile' <watcom_map_file>'
    28293 -
    28294 -    call Done 0
    28295 -end
    28296 -
    28297 -G.WatMapFile = aArgs
    28298 -
    28299 -call Main
    28300 -
    28301 -call Done 0
    28302 -
    28303 -
    28304 -/*------------------------------------------------------------------------------
    28305 - functions
    28306 -------------------------------------------------------------------------------*/
    28307 -
    28308 -/**
    28309 - * Just do the job.
    28310 - */
    28311 -Main: procedure expose (Globals)
    28312 -
    28313 -    GroupHeader.0 = 5
    28314 -    GroupHeader.1 = '+------------+'
    28315 -    GroupHeader.2 = '|   Groups   |'
    28316 -    GroupHeader.3 = '+------------+'
    28317 -    GroupHeader.4 = 'Group                           Address              Size'
    28318 -    GroupHeader.5 = '=====                           =======              ===='
    28319 -
    28320 -    SegmentHeader.0 = 5
    28321 -    SegmentHeader.1 = '+--------------+'
    28322 -    SegmentHeader.2 = '|   Segments   |'
    28323 -    SegmentHeader.3 = '+--------------+'
    28324 -    SegmentHeader.4 = 'Segment                Class          Group          Address         Size'
    28325 -    SegmentHeader.5 = '=======                =====          =====          =======         ===='
    28326 -
    28327 -    MemMapHeader.0 = 7
    28328 -    MemMapHeader.1 = '+----------------+'
    28329 -    MemMapHeader.2 = '|   Memory Map   |'
    28330 -    MemMapHeader.3 = '+----------------+'
    28331 -    MemMapHeader.4 = '* = unreferenced symbol'
    28332 -    MemMapHeader.5 = '+ = symbol only referenced locally'
    28333 -    MemMapHeader.6 = 'Address        Symbol'
    28334 -    MemMapHeader.7 = '=======        ======'
    28335 -
    28336 -    ImportHeader.0 = 5
    28337 -    ImportHeader.1 = '+----------------------+'
    28338 -    ImportHeader.2 = '|   Imported Symbols   |'
    28339 -    ImportHeader.3 = '+----------------------+'
    28340 -    ImportHeader.4 = 'Symbol                              Module'
    28341 -    ImportHeader.5 = '======                              ======'
    28342 -
    28343 -    state = ''
    28344 -    state2 = 1
    28345 -    inMap = 0
    28346 -
    28347 -    segments.0 = 0
    28348 -    groups.0 = 0
    28349 -    image = ''
    28350 -
    28351 -    G.IbmMapFile = G.WatMapFile
    28352 -    i = lastpos('.', G.IbmMapFile)
    28353 -    if (i > 0) then
    28354 -        G.IbmMapFile = left(G.IbmMapFile, i - 1)
    28355 -    G.IbmMapFile = SysTempFileName(G.IbmMapFile'.?????-map')
    28356 -
    28357 -    do while lines(G.WatMapFile)
    28358 -        line = strip(linein(G.WatMapFile))
    28359 -        if (line == '') then iterate
    28360 -        select
    28361 -            when state == '' then do
    28362 -                str = 'Executable Image: '
    28363 -                if (StartsWith(line, str)) then
    28364 -                    image = filespec('N', substr(line, length(str) + 1))
    28365 -                    i = pos('.', image)
    28366 -                    if (i > 0) then do
    28367 -                        image = left(image, i - 1)
    28368 -                    end
    28369 -                else
    28370 -                if (line == GroupHeader.state2) then do
    28371 -                    if (state2 == GroupHeader.0) then do
    28372 -                        state = 'g'
    28373 -                        state2 = 1
    28374 -                        iterate
    28375 -                    end
    28376 -                    state2 = state2 + 1
    28377 -                end
    28378 -                else state2 = 1
    28379 -            end
    28380 -            when state == 'g' then do
    28381 -                if (line == SegmentHeader.state2) then do
    28382 -                    if (state2 == SegmentHeader.0) then do
    28383 -                        state = 's'
    28384 -                        state2 = 1
    28385 -                        iterate
    28386 -                    end
    28387 -                    state2 = state2 + 1
    28388 -                end
    28389 -                else do
    28390 -                    parse value Normalize(line) with name addr size
    28391 -                    i = groups.0 + 1
    28392 -                    groups.i.!name = name
    28393 -                    groups.i.!addr = addr
    28394 -                    groups.i.!size = size
    28395 -                    groups.0 = i
    28396 -                end
    28397 -            end
    28398 -            when state == 's' then do
    28399 -                if (line == MemMapHeader.state2) then do
    28400 -                    if (state2 == MemMapHeader.0) then do
    28401 -                        state = 'm'
    28402 -                        state2 = 1
    28403 -                        iterate
    28404 -                    end
    28405 -                    state2 = state2 + 1
    28406 -                end
    28407 -                else do
    28408 -                    parse value Normalize(line) with name rest
    28409 -                    i = words(rest)
    28410 -                    if (i == 2) then parse var rest         addr size
    28411 -                    else if (i == 3) then parse var rest       group addr size
    28412 -                    else parse var rest                     class group addr size
    28413 -                    i = segments.0 + 1
    28414 -                    segments.i.!name = name
    28415 -                    segments.i.!class = class
    28416 -                    segments.i.!group = group
    28417 -                    segments.i.!addr = addr
    28418 -                    segments.i.!size = size
    28419 -                    segments.0 = i
    28420 -                end
    28421 -            end
    28422 -            when state == 'm' then do
    28423 -                if (line == ImportHeader.state2) then do
    28424 -                    if (state2 == ImportHeader.0) then do
    28425 -                        state = 'rest'
    28426 -                        state2 = 1
    28427 -                        iterate
    28428 -                    end
    28429 -                    state2 = state2 + 1
    28430 -                end
    28431 -                else do
    28432 -                    if (\inMap) then do
    28433 -                        inMap = 1
    28434 -                        if (image \== '') then do
    28435 -                            call lineout G.IbmMapFile, ''
    28436 -                            call lineout G.IbmMapFile, ' 'image
    28437 -                        end
    28438 -                        call lineout G.IbmMapFile, ''
    28439 -                        call lineout G.IbmMapFile, ' Start         Length     Name                   Class'
    28440 -                        do i = 1 to segments.0
    28441 -                            call lineout G.IbmMapFile, ' 'segments.i.!addr' 0'segments.i.!size'H 'segments.i.!name
    28442 -                        end
    28443 -                        call lineout G.IbmMapFile, ''
    28444 -                        call lineout G.IbmMapFile, ' Origin   Group'
    28445 -                        do i = 1 to groups.0
    28446 -                            parse var groups.i.!addr seg':'addr
    28447 -                            addr = strip(addr, 'L', '0')
    28448 -                            if (addr == '') then addr = '0'
    28449 -                            call lineout G.IbmMapFile, ' 'seg':'addr'   'groups.i.!name
    28450 -                        end
    28451 -                        call lineout G.IbmMapFile, ''
    28452 -                        call lineout G.IbmMapFile, '  Address         Publics by Value'
    28453 -                        call lineout G.IbmMapFile, ''
    28454 -                    end
    28455 -                    if (StartsWith(line, 'Module: ')) then iterate
    28456 -                    parse value Normalize(line) with addr name
    28457 -                    addr = strip(addr, 'T', '*')
    28458 -                    addr = strip(addr, 'T', '+')
    28459 -                    if (addr == '0000:00000000') then iterate
    28460 -                    call lineout G.IbmMapFile, ' 'addr'       'name
    28461 -                end
    28462 -            end
    28463 -            when state == 'rest' then do
    28464 -                str = 'Entry point address: '
    28465 -                if (StartsWith(line, str)) then do
    28466 -                    call lineout G.IbmMapFile, ''
    28467 -                    call lineout G.IbmMapFile, 'Program entry point at 'substr(line, length(str) + 1)
    28468 -                end
    28469 -            end
    28470 -            otherwise nop
    28471 -        end
    28472 -
    28473 -    end
    28474 -    call lineout G.WatMapFile
    28475 -    call lineout G.IbmMapFile
    28476 -
    28477 -    cmdline = 'mapsym.exe' G.IbmMapFile
    28478 -    cmdline
    28479 -
    28480 -    if (rc \= 0) then do
    28481 -        call SayErr 'Executing "'cmdline'" failed with code 'rc'.'
    28482 -        call SayErr 'Please check the contents of "'G.IbmMapFile'".'
    28483 -        call Done rc
    28484 -    end
    28485 -
    28486 -    call DeleteFile G.IbmMapFile
    28487 -
    28488 -    return
    28489 -
    28490 -/*------------------------------------------------------------------------------
    28491 - utility functions
    28492 -------------------------------------------------------------------------------*/
    28493 -
    28494 -/**
    28495 - * Normalizes the given string by removing leading, trailing and extra spaces
    28496 - * in the middle so that words in the returned string are separated with exactly
    28497 - * one space.
    28498 - *
    28499 - * @param  aStr         String to normalize.
    28500 - * @return              Resulting string.
    28501 - */
    28502 -Normalize: procedure expose (Globals)
    28503 -    parse arg aStr
    28504 -    result = ""
    28505 -    do i = 1 to words(aStr)
    28506 -        if (result == "") then result = word(aStr, i)
    28507 -        else result = result" "word(aStr, i)
    28508 -    end
    28509 -    return result
    28510 -
    28511 -/**
    28512 - * Returns 1 if the given string @a aStr1 starts with the string @a aStr2 and
    28513 - * 0 otherwise. If @a aStr2 is null or empty, 0 is returned.
    28514 - *
    28515 - * @param  aStr1        String to search in.
    28516 - * @param  aStr2        String to search for.
    28517 - * @return              1 or 0.
    28518 - */
    28519 -StartsWith: procedure expose (Globals)
    28520 -    parse arg aStr1, aStr2
    28521 -    len = length(aStr2)
    28522 -    if (len == 0) then return 0
    28523 -    if (length(aStr1) < len) then return 0
    28524 -    return (left(aStr1, len) == aStr2)
    28525 -
    28526 -/**
    28527 - * Returns 1 if the given string @a aStr1 ends with the string @a aStr2 and
    28528 - * 0 otherwise. If @a aStr2 is null or empty, 0 is returned.
    28529 - *
    28530 - * @param  aStr1        String to search in.
    28531 - * @param  aStr2        String to search for.
    28532 - * @return              1 or 0.
    28533 - */
    28534 -EndsWith: procedure expose (Globals)
    28535 -    parse arg aStr1, aStr2
    28536 -    len = length(aStr2)
    28537 -    if (len == 0) then return 0
    28538 -    if (length(aStr1) < len) then return 0
    28539 -    return (right(aStr1, len) == aStr2)
    28540 -
    28541 -DeleteFile: procedure expose (Globals)
    28542 -    parse arg file
    28543 -    rc = SysFileDelete(file)
    28544 -    if (rc \= 0 & rc \= 2) then do
    28545 -        call SayErr 'FATAL: Could not delete file '''file'''!'
    28546 -        call SayErr 'SysFileDelete returned 'rc
    28547 -        call Done 1
    28548 -    end
    28549 -    return
    28550 -
    28551 -/**
    28552 - * Prefixes all lines of text with the given prefix.
    28553 - *
    28554 - * @param aLines    Text to prefix.
    28555 - * @param aPrefix   Prefix.
    28556 - *
    28557 - * @return Prefixed text.
    28558 - */
    28559 -PrefixLines: procedure expose (Globals)
    28560 -    parse arg aLines, aPrefix
    28561 -    return aPrefix||Replace(aLines, G.EOL, G.EOL||aPrefix)
    28562 -
    28563 -SaySayEx: procedure expose (Globals)
    28564 -    parse arg str, prefix, noeol
    28565 -    noeol = (noeol == 1)
    28566 -    if (noeol) then call charout, str
    28567 -    else say str
    28568 -    return
    28569 -
    28570 -SaySay: procedure expose (Globals)
    28571 -    parse arg str, noeol
    28572 -    noeol = (noeol == 1)
    28573 -    if (noeol) then call charout, str
    28574 -    else say str
    28575 -    return
    28576 -
    28577 -SayWrn: procedure expose (Globals)
    28578 -    parse arg str, noeol
    28579 -    str = 'WARNING: 'str
    28580 -    call SaySay str, noeol
    28581 -    return
    28582 -
    28583 -SayErr: procedure expose (Globals)
    28584 -    parse arg str, noeol
    28585 -    str = 'ERROR: 'str
    28586 -    call SaySay str, noeol
    28587 -    return
    28588 -
    28589 -/**
    28590 - *  Fixes the directory path by a) converting all slashes to back
    28591 - *  slashes and b) ensuring that the trailing slash is present if
    28592 - *  the directory is the root directory, and absent otherwise.
    28593 - *
    28594 - *  @param dir      the directory path
    28595 - *  @param noslash
    28596 - *      optional argument. If 1, the path returned will not have a
    28597 - *      trailing slash anyway. Useful for concatenating it with a
    28598 - *      file name.
    28599 - */
    28600 -FixDir: procedure expose (Globals)
    28601 -    parse arg dir, noslash
    28602 -    noslash = (noslash = 1)
    28603 -    dir = translate(dir, '\', '/')
    28604 -    if (right(dir, 1) == '\' &,
    28605 -        (noslash | \(length(dir) == 3 & (substr(dir, 2, 1) == ':')))) then
    28606 -        dir = substr(dir, 1, length(dir) - 1)
    28607 -    return dir
    28608 -
    28609 -/**
    28610 - *  Shortcut to FixDir(dir, 1)
    28611 - */
    28612 -FixDirNoSlash: procedure expose (Globals)
    28613 -    parse arg dir
    28614 -    return FixDir(dir, 1)
    28615 -
    28616 -/**
    28617 - *  NoValue signal handler.
    28618 - */
    28619 -NoValue:
    28620 -    errl    = sigl
    28621 -    say
    28622 -    say
    28623 -    say 'EXPRESSION HAS NO VALUE at line #'errl'!'
    28624 -    say
    28625 -    say 'This is usually a result of a misnamed variable.'
    28626 -    say 'Please contact the author.'
    28627 -    call Done 252
    28628 -
    28629 -/**
    28630 - *  Nonsense handler.
    28631 - */
    28632 -Nonsense:
    28633 -    errl    = sigl
    28634 -    say
    28635 -    say
    28636 -    say 'NONSENSE at line #'errl'!'
    28637 -    say
    28638 -    say 'The author decided that this point of code should'
    28639 -    say 'have never been reached, but it accidentally had.'
    28640 -    say 'Please contact the author.'
    28641 -    call Done 253
    28642 -
    28643 -/**
    28644 - *  Syntax signal handler.
    28645 - */
    28646 -Syntax:
    28647 -    errn    = rc
    28648 -    errl    = sigl
    28649 -    say
    28650 -    say
    28651 -    say 'UNEXPECTED PROGRAM TERMINATION!'
    28652 -    say
    28653 -    say 'REX'right(errn , 4, '0')': 'ErrorText(rc)' at line #'errl
    28654 -    say
    28655 -    say 'Possible reasons:'
    28656 -    say
    28657 -    say '  1. Some of REXX libraries are not found but required.'
    28658 -    say '  2. You have changed this script and made a syntax error.'
    28659 -    say '  3. Author made a mistake.'
    28660 -    say '  4. Something else...'
    28661 -    call Done 254
    28662 -
    28663 -/**
    28664 - *  Halt signal handler.
    28665 - */
    28666 -Halt:
    28667 -    say
    28668 -    say 'CTRL-BREAK pressed, exiting.'
    28669 -    call Done 255
    28670 -
    28671 -/**
    28672 - *  Always called at the end. Should not be called directly.
    28673 - *  @param the exit code
    28674 - */
    28675 -Done: procedure expose (Globals)
    28676 -    parse arg code
    28677 -    /* protect against recursive calls */
    28678 -    if (value('G.Done_done') == 1) then exit code
    28679 -    call value 'G.Done_done', 1
    28680 -    /* cleanup stuff goes there */
    28681 -    if (symbol('G.AtExit.0') == 'VAR') then do
    28682 -        /* run all AtExit slots */
    28683 -        do i = 1 to G.AtExit.0
    28684 -            if (symbol('G.AtExit.'i) == 'VAR') then
    28685 -                call RunAtExitSlot i
    28686 -        end
    28687 -    end
    28688 -    drop G.AtExit.
    28689 -    /* finally, exit */
    28690 -    if (code \= 0) then do
    28691 -        call SaySay G.ScriptFile': FAILED with exit code 'code
    28692 -    end
    28693 -    exit code
    28694 -
    28695 +/* REXX */
    28696 +/*
    28697 + * Creates a .SYM file from the Watcom .MAP file using IBM MAPSYM.
    28698 + *
    28699 + * Copyright (C) 2010-2011 Dmitriy Kuminov
    28700 + *
    28701 + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    28702 + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    28703 + */
    28704 +
    28705 +signal on syntax
    28706 +signal on halt
    28707 +signal on novalue
    28708 +trace off
    28709 +numeric digits 12
    28710 +'@echo off'
    28711 +
    28712 +
    28713 +/*------------------------------------------------------------------------------
    28714 + globals
    28715 +------------------------------------------------------------------------------*/
    28716 +
    28717 +/* all globals to be exposed in procedures */
    28718 +Globals = 'G. Opt. Static.'
    28719 +
    28720 +
    28721 +/*------------------------------------------------------------------------------
    28722 + startup + main + termination
    28723 +------------------------------------------------------------------------------*/
    28724 +
    28725 +/* init system REXX library */
    28726 +if (RxFuncQuery('SysLoadFuncs')) then do
    28727 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
    28728 +    call SysLoadFuncs
    28729 +end
    28730 +
    28731 +/* detect script file and directory */
    28732 +parse source . . G.ScriptPath
    28733 +G.ScriptDir = FixDir(filespec('D', G.ScriptPath) || filespec('P', G.ScriptPath))
    28734 +G.ScriptFile = FixDir(filespec('N', G.ScriptPath))
    28735 +G.StartDir = directory()
    28736 +
    28737 +parse arg aArgs
    28738 +if (aArgs == '') then do
    28739 +    say
    28740 +    say 'Creates a .SYM file from the Watcom .MAP file using IBM MAPSYM'
    28741 +    say 'Version 1.1 (2011-12-18)'
    28742 +    say 'Copyright (C) 2011 Dmitriy Kuminov'
    28743 +    say
    28744 +    say 'Usage: '
    28745 +    say
    28746 +    say '  'G.ScriptFile' <watcom_map_file>'
    28747 +
    28748 +    call Done 0
    28749 +end
    28750 +
    28751 +G.WatMapFile = aArgs
    28752 +
    28753 +call Main
    28754 +
    28755 +call Done 0
    28756 +
    28757 +
    28758 +/*------------------------------------------------------------------------------
    28759 + functions
    28760 +------------------------------------------------------------------------------*/
    28761 +
    28762 +/**
    28763 + * Just do the job.
    28764 + */
    28765 +Main: procedure expose (Globals)
    28766 +
    28767 +    GroupHeader.0 = 5
    28768 +    GroupHeader.1 = '+------------+'
    28769 +    GroupHeader.2 = '|   Groups   |'
    28770 +    GroupHeader.3 = '+------------+'
    28771 +    GroupHeader.4 = 'Group                           Address              Size'
    28772 +    GroupHeader.5 = '=====                           =======              ===='
    28773 +
    28774 +    SegmentHeader.0 = 5
    28775 +    SegmentHeader.1 = '+--------------+'
    28776 +    SegmentHeader.2 = '|   Segments   |'
    28777 +    SegmentHeader.3 = '+--------------+'
    28778 +    SegmentHeader.4 = 'Segment                Class          Group          Address         Size'
    28779 +    SegmentHeader.5 = '=======                =====          =====          =======         ===='
    28780 +
    28781 +    MemMapHeader.0 = 7
    28782 +    MemMapHeader.1 = '+----------------+'
    28783 +    MemMapHeader.2 = '|   Memory Map   |'
    28784 +    MemMapHeader.3 = '+----------------+'
    28785 +    MemMapHeader.4 = '* = unreferenced symbol'
    28786 +    MemMapHeader.5 = '+ = symbol only referenced locally'
    28787 +    MemMapHeader.6 = 'Address        Symbol'
    28788 +    MemMapHeader.7 = '=======        ======'
    28789 +
    28790 +    ImportHeader.0 = 5
    28791 +    ImportHeader.1 = '+----------------------+'
    28792 +    ImportHeader.2 = '|   Imported Symbols   |'
    28793 +    ImportHeader.3 = '+----------------------+'
    28794 +    ImportHeader.4 = 'Symbol                              Module'
    28795 +    ImportHeader.5 = '======                              ======'
    28796 +
    28797 +    state = ''
    28798 +    state2 = 1
    28799 +    inMap = 0
    28800 +
    28801 +    segments.0 = 0
    28802 +    groups.0 = 0
    28803 +    image = ''
    28804 +
    28805 +    G.IbmMapFile = G.WatMapFile
    28806 +    i = lastpos('.', G.IbmMapFile)
    28807 +    if (i > 0) then
    28808 +        G.IbmMapFile = left(G.IbmMapFile, i - 1)
    28809 +    G.IbmMapFile = SysTempFileName(G.IbmMapFile'.?????-map')
    28810 +
    28811 +    do while lines(G.WatMapFile)
    28812 +        line = strip(linein(G.WatMapFile))
    28813 +        if (line == '') then iterate
    28814 +        select
    28815 +            when state == '' then do
    28816 +                str = 'Executable Image: '
    28817 +                if (StartsWith(line, str)) then
    28818 +                    image = filespec('N', substr(line, length(str) + 1))
    28819 +                    i = pos('.', image)
    28820 +                    if (i > 0) then do
    28821 +                        image = left(image, i - 1)
    28822 +                    end
    28823 +                else
    28824 +                if (line == GroupHeader.state2) then do
    28825 +                    if (state2 == GroupHeader.0) then do
    28826 +                        state = 'g'
    28827 +                        state2 = 1
    28828 +                        iterate
    28829 +                    end
    28830 +                    state2 = state2 + 1
    28831 +                end
    28832 +                else state2 = 1
    28833 +            end
    28834 +            when state == 'g' then do
    28835 +                if (line == SegmentHeader.state2) then do
    28836 +                    if (state2 == SegmentHeader.0) then do
    28837 +                        state = 's'
    28838 +                        state2 = 1
    28839 +                        iterate
    28840 +                    end
    28841 +                    state2 = state2 + 1
    28842 +                end
    28843 +                else do
    28844 +                    parse value Normalize(line) with name addr size
    28845 +                    i = groups.0 + 1
    28846 +                    groups.i.!name = name
    28847 +                    groups.i.!addr = addr
    28848 +                    groups.i.!size = size
    28849 +                    groups.0 = i
    28850 +                end
    28851 +            end
    28852 +            when state == 's' then do
    28853 +                if (line == MemMapHeader.state2) then do
    28854 +                    if (state2 == MemMapHeader.0) then do
    28855 +                        state = 'm'
    28856 +                        state2 = 1
    28857 +                        iterate
    28858 +                    end
    28859 +                    state2 = state2 + 1
    28860 +                end
    28861 +                else do
    28862 +                    parse value Normalize(line) with name rest
    28863 +                    i = words(rest)
    28864 +                    if (i == 2) then parse var rest         addr size
    28865 +                    else if (i == 3) then parse var rest       group addr size
    28866 +                    else parse var rest                     class group addr size
    28867 +                    i = segments.0 + 1
    28868 +                    segments.i.!name = name
    28869 +                    segments.i.!class = class
    28870 +                    segments.i.!group = group
    28871 +                    segments.i.!addr = addr
    28872 +                    segments.i.!size = size
    28873 +                    segments.0 = i
    28874 +                end
    28875 +            end
    28876 +            when state == 'm' then do
    28877 +                if (line == ImportHeader.state2) then do
    28878 +                    if (state2 == ImportHeader.0) then do
    28879 +                        state = 'rest'
    28880 +                        state2 = 1
    28881 +                        iterate
    28882 +                    end
    28883 +                    state2 = state2 + 1
    28884 +                end
    28885 +                else do
    28886 +                    if (\inMap) then do
    28887 +                        inMap = 1
    28888 +                        if (image \== '') then do
    28889 +                            call lineout G.IbmMapFile, ''
    28890 +                            call lineout G.IbmMapFile, ' 'image
    28891 +                        end
    28892 +                        call lineout G.IbmMapFile, ''
    28893 +                        call lineout G.IbmMapFile, ' Start         Length     Name                   Class'
    28894 +                        do i = 1 to segments.0
    28895 +                            call lineout G.IbmMapFile, ' 'segments.i.!addr' 0'segments.i.!size'H 'segments.i.!name
    28896 +                        end
    28897 +                        call lineout G.IbmMapFile, ''
    28898 +                        call lineout G.IbmMapFile, ' Origin   Group'
    28899 +                        do i = 1 to groups.0
    28900 +                            parse var groups.i.!addr seg':'addr
    28901 +                            addr = strip(addr, 'L', '0')
    28902 +                            if (addr == '') then addr = '0'
    28903 +                            call lineout G.IbmMapFile, ' 'seg':'addr'   'groups.i.!name
    28904 +                        end
    28905 +                        call lineout G.IbmMapFile, ''
    28906 +                        call lineout G.IbmMapFile, '  Address         Publics by Value'
    28907 +                        call lineout G.IbmMapFile, ''
    28908 +                    end
    28909 +                    if (StartsWith(line, 'Module: ')) then iterate
    28910 +                    parse value Normalize(line) with addr name
    28911 +                    addr = strip(addr, 'T', '*')
    28912 +                    addr = strip(addr, 'T', '+')
    28913 +                    if (addr == '0000:00000000') then iterate
    28914 +                    call lineout G.IbmMapFile, ' 'addr'       'name
    28915 +                end
    28916 +            end
    28917 +            when state == 'rest' then do
    28918 +                str = 'Entry point address: '
    28919 +                if (StartsWith(line, str)) then do
    28920 +                    call lineout G.IbmMapFile, ''
    28921 +                    call lineout G.IbmMapFile, 'Program entry point at 'substr(line, length(str) + 1)
    28922 +                end
    28923 +            end
    28924 +            otherwise nop
    28925 +        end
    28926 +
    28927 +    end
    28928 +    call lineout G.WatMapFile
    28929 +    call lineout G.IbmMapFile
    28930 +
    28931 +    cmdline = 'mapsym.exe' G.IbmMapFile
    28932 +    cmdline
    28933 +
    28934 +    if (rc \= 0) then do
    28935 +        call SayErr 'Executing "'cmdline'" failed with code 'rc'.'
    28936 +        call SayErr 'Please check the contents of "'G.IbmMapFile'".'
    28937 +        call Done rc
    28938 +    end
    28939 +
    28940 +    call DeleteFile G.IbmMapFile
    28941 +
    28942 +    return
    28943 +
    28944 +/*------------------------------------------------------------------------------
    28945 + utility functions
    28946 +------------------------------------------------------------------------------*/
    28947 +
    28948 +/**
    28949 + * Normalizes the given string by removing leading, trailing and extra spaces
    28950 + * in the middle so that words in the returned string are separated with exactly
    28951 + * one space.
    28952 + *
    28953 + * @param  aStr         String to normalize.
    28954 + * @return              Resulting string.
    28955 + */
    28956 +Normalize: procedure expose (Globals)
    28957 +    parse arg aStr
    28958 +    result = ""
    28959 +    do i = 1 to words(aStr)
    28960 +        if (result == "") then result = word(aStr, i)
    28961 +        else result = result" "word(aStr, i)
    28962 +    end
    28963 +    return result
    28964 +
    28965 +/**
    28966 + * Returns 1 if the given string @a aStr1 starts with the string @a aStr2 and
    28967 + * 0 otherwise. If @a aStr2 is null or empty, 0 is returned.
    28968 + *
    28969 + * @param  aStr1        String to search in.
    28970 + * @param  aStr2        String to search for.
    28971 + * @return              1 or 0.
    28972 + */
    28973 +StartsWith: procedure expose (Globals)
    28974 +    parse arg aStr1, aStr2
    28975 +    len = length(aStr2)
    28976 +    if (len == 0) then return 0
    28977 +    if (length(aStr1) < len) then return 0
    28978 +    return (left(aStr1, len) == aStr2)
    28979 +
    28980 +/**
    28981 + * Returns 1 if the given string @a aStr1 ends with the string @a aStr2 and
    28982 + * 0 otherwise. If @a aStr2 is null or empty, 0 is returned.
    28983 + *
    28984 + * @param  aStr1        String to search in.
    28985 + * @param  aStr2        String to search for.
    28986 + * @return              1 or 0.
    28987 + */
    28988 +EndsWith: procedure expose (Globals)
    28989 +    parse arg aStr1, aStr2
    28990 +    len = length(aStr2)
    28991 +    if (len == 0) then return 0
    28992 +    if (length(aStr1) < len) then return 0
    28993 +    return (right(aStr1, len) == aStr2)
    28994 +
    28995 +DeleteFile: procedure expose (Globals)
    28996 +    parse arg file
    28997 +    rc = SysFileDelete(file)
    28998 +    if (rc \= 0 & rc \= 2) then do
    28999 +        call SayErr 'FATAL: Could not delete file '''file'''!'
    29000 +        call SayErr 'SysFileDelete returned 'rc
    29001 +        call Done 1
    29002 +    end
    29003 +    return
    29004 +
    29005 +/**
    29006 + * Prefixes all lines of text with the given prefix.
    29007 + *
    29008 + * @param aLines    Text to prefix.
    29009 + * @param aPrefix   Prefix.
    29010 + *
    29011 + * @return Prefixed text.
    29012 + */
    29013 +PrefixLines: procedure expose (Globals)
    29014 +    parse arg aLines, aPrefix
    29015 +    return aPrefix||Replace(aLines, G.EOL, G.EOL||aPrefix)
    29016 +
    29017 +SaySayEx: procedure expose (Globals)
    29018 +    parse arg str, prefix, noeol
    29019 +    noeol = (noeol == 1)
    29020 +    if (noeol) then call charout, str
    29021 +    else say str
    29022 +    return
    29023 +
    29024 +SaySay: procedure expose (Globals)
    29025 +    parse arg str, noeol
    29026 +    noeol = (noeol == 1)
    29027 +    if (noeol) then call charout, str
    29028 +    else say str
    29029 +    return
    29030 +
    29031 +SayWrn: procedure expose (Globals)
    29032 +    parse arg str, noeol
    29033 +    str = 'WARNING: 'str
    29034 +    call SaySay str, noeol
    29035 +    return
    29036 +
    29037 +SayErr: procedure expose (Globals)
    29038 +    parse arg str, noeol
    29039 +    str = 'ERROR: 'str
    29040 +    call SaySay str, noeol
    29041 +    return
    29042 +
    29043 +/**
    29044 + *  Fixes the directory path by a) converting all slashes to back
    29045 + *  slashes and b) ensuring that the trailing slash is present if
    29046 + *  the directory is the root directory, and absent otherwise.
    29047 + *
    29048 + *  @param dir      the directory path
    29049 + *  @param noslash
    29050 + *      optional argument. If 1, the path returned will not have a
    29051 + *      trailing slash anyway. Useful for concatenating it with a
    29052 + *      file name.
    29053 + */
    29054 +FixDir: procedure expose (Globals)
    29055 +    parse arg dir, noslash
    29056 +    noslash = (noslash = 1)
    29057 +    dir = translate(dir, '\', '/')
    29058 +    if (right(dir, 1) == '\' &,
    29059 +        (noslash | \(length(dir) == 3 & (substr(dir, 2, 1) == ':')))) then
    29060 +        dir = substr(dir, 1, length(dir) - 1)
    29061 +    return dir
    29062 +
    29063 +/**
    29064 + *  Shortcut to FixDir(dir, 1)
    29065 + */
    29066 +FixDirNoSlash: procedure expose (Globals)
    29067 +    parse arg dir
    29068 +    return FixDir(dir, 1)
    29069 +
    29070 +/**
    29071 + *  NoValue signal handler.
    29072 + */
    29073 +NoValue:
    29074 +    errl    = sigl
    29075 +    say
    29076 +    say
    29077 +    say 'EXPRESSION HAS NO VALUE at line #'errl'!'
    29078 +    say
    29079 +    say 'This is usually a result of a misnamed variable.'
    29080 +    say 'Please contact the author.'
    29081 +    call Done 252
    29082 +
    29083 +/**
    29084 + *  Nonsense handler.
    29085 + */
    29086 +Nonsense:
    29087 +    errl    = sigl
    29088 +    say
    29089 +    say
    29090 +    say 'NONSENSE at line #'errl'!'
    29091 +    say
    29092 +    say 'The author decided that this point of code should'
    29093 +    say 'have never been reached, but it accidentally had.'
    29094 +    say 'Please contact the author.'
    29095 +    call Done 253
    29096 +
    29097 +/**
    29098 + *  Syntax signal handler.
    29099 + */
    29100 +Syntax:
    29101 +    errn    = rc
    29102 +    errl    = sigl
    29103 +    say
    29104 +    say
    29105 +    say 'UNEXPECTED PROGRAM TERMINATION!'
    29106 +    say
    29107 +    say 'REX'right(errn , 4, '0')': 'ErrorText(rc)' at line #'errl
    29108 +    say
    29109 +    say 'Possible reasons:'
    29110 +    say
    29111 +    say '  1. Some of REXX libraries are not found but required.'
    29112 +    say '  2. You have changed this script and made a syntax error.'
    29113 +    say '  3. Author made a mistake.'
    29114 +    say '  4. Something else...'
    29115 +    call Done 254
    29116 +
    29117 +/**
    29118 + *  Halt signal handler.
    29119 + */
    29120 +Halt:
    29121 +    say
    29122 +    say 'CTRL-BREAK pressed, exiting.'
    29123 +    call Done 255
    29124 +
    29125 +/**
    29126 + *  Always called at the end. Should not be called directly.
    29127 + *  @param the exit code
    29128 + */
    29129 +Done: procedure expose (Globals)
    29130 +    parse arg code
    29131 +    /* protect against recursive calls */
    29132 +    if (value('G.Done_done') == 1) then exit code
    29133 +    call value 'G.Done_done', 1
    29134 +    /* cleanup stuff goes there */
    29135 +    if (symbol('G.AtExit.0') == 'VAR') then do
    29136 +        /* run all AtExit slots */
    29137 +        do i = 1 to G.AtExit.0
    29138 +            if (symbol('G.AtExit.'i) == 'VAR') then
    29139 +                call RunAtExitSlot i
    29140 +        end
    29141 +    end
    29142 +    drop G.AtExit.
    29143 +    /* finally, exit */
    29144 +    if (code \= 0) then do
    29145 +        call SaySay G.ScriptFile': FAILED with exit code 'code
    29146 +    end
    29147 +    exit code
    29148 +
    29149 diff --git a/tools/common/Makefile.kmk b/tools/common/Makefile.kmk
    29150 index f691636..280381f 100644
    29151 --- a/tools/common/Makefile.kmk
    29152 +++ b/tools/common/Makefile.kmk
    29153 @@ -1,27 +1,27 @@
    29154 -## @file
    29155 -# COMMON library makefile.
    29156 -#
    29157 -
    29158 -SUB_DEPTH = ../..
    29159 -include $(KBUILD_PATH)/subheader.kmk
    29160 -
    29161 -LIBRARIES          += common
    29162 -common_TEMPLATE     = OdinCxx
    29163 -
    29164 -common_INCS         = .
    29165 -
    29166 -common_SOURCES      = \
    29167 -    kFileDEF.cpp \
    29168 -    kFileLX.cpp \
    29169 -    kFilePE.cpp \
    29170 -    kFileSDF.cpp \
    29171 -    kFileFormatBase.cpp \
    29172 -    kFile.cpp \
    29173 -    kFileInterfaces.cpp \
    29174 -    kAssert.c \
    29175 -    kError.cpp
    29176 -
    29177 -common_LIBS        += \
    29178 -    $(PATH_STAGE_LIB)/unicode.lib
    29179 -
    29180 -include $(FILE_KBUILD_SUB_FOOTER)
    29181 +## @file
    29182 +# COMMON library makefile.
    29183 +#
    29184 +
    29185 +SUB_DEPTH = ../..
    29186 +include $(KBUILD_PATH)/subheader.kmk
    29187 +
    29188 +LIBRARIES          += common
    29189 +common_TEMPLATE     = OdinCxx
    29190 +
    29191 +common_INCS         = .
    29192 +
    29193 +common_SOURCES      = \
    29194 +    kFileDEF.cpp \
    29195 +    kFileLX.cpp \
    29196 +    kFilePE.cpp \
    29197 +    kFileSDF.cpp \
    29198 +    kFileFormatBase.cpp \
    29199 +    kFile.cpp \
    29200 +    kFileInterfaces.cpp \
    29201 +    kAssert.c \
    29202 +    kError.cpp
    29203 +
    29204 +common_LIBS        += \
    29205 +    $(PATH_STAGE_LIB)/unicode.lib
    29206 +
    29207 +include $(FILE_KBUILD_SUB_FOOTER)
    29208 diff --git a/tools/impdef/Makefile.kmk b/tools/impdef/Makefile.kmk
    29209 index 8b4234c..53b675c 100644
    29210 --- a/tools/impdef/Makefile.kmk
    29211 +++ b/tools/impdef/Makefile.kmk
    29212 @@ -1,25 +1,25 @@
    29213 -## @file
    29214 -# IMPDEF makefile.
    29215 -#
    29216 -
    29217 -SUB_DEPTH = ../..
    29218 -include $(KBUILD_PATH)/subheader.kmk
    29219 -
    29220 -BLDPROGS           += impdef
    29221 -impdef_TEMPLATE     = OdinBin
    29222 -
    29223 -# @todo: the need of this for BLDPROGS looks like a kBuild bug to me
    29224 -impdef_INST         = bin/
    29225 -impdef_INSTTYPE     = stage
    29226 -
    29227 -impdef_INCS         = \
    29228 -    ../common
    29229 -
    29230 -impdef_SOURCES      = \
    29231 -    ImpDef.cpp \
    29232 -    ImpDef.def
    29233 -
    29234 -impdef_LIBS         = \
    29235 -    $(PATH_STAGE_LIB)/common.lib
    29236 -
    29237 -include $(FILE_KBUILD_SUB_FOOTER)
    29238 +## @file
    29239 +# IMPDEF makefile.
    29240 +#
    29241 +
    29242 +SUB_DEPTH = ../..
    29243 +include $(KBUILD_PATH)/subheader.kmk
    29244 +
    29245 +BLDPROGS           += impdef
    29246 +impdef_TEMPLATE     = OdinBin
    29247 +
    29248 +# @todo: the need of this for BLDPROGS looks like a kBuild bug to me
    29249 +impdef_INST         = bin/
    29250 +impdef_INSTTYPE     = stage
    29251 +
    29252 +impdef_INCS         = \
    29253 +    ../common
    29254 +
    29255 +impdef_SOURCES      = \
    29256 +    ImpDef.cpp \
    29257 +    ImpDef.def
    29258 +
    29259 +impdef_LIBS         = \
    29260 +    $(PATH_STAGE_LIB)/common.lib
    29261 +
    29262 +include $(FILE_KBUILD_SUB_FOOTER)
    29263 diff --git a/tools/install/Makefile.kmk b/tools/install/Makefile.kmk
    29264 index 099378a..5b43523 100644
    29265 --- a/tools/install/Makefile.kmk
    29266 +++ b/tools/install/Makefile.kmk
    29267 @@ -1,22 +1,22 @@
    29268 -## @file
    29269 -# ODININST makefile.
    29270 -#
    29271 -
    29272 -SUB_DEPTH = ../..
    29273 -include $(KBUILD_PATH)/subheader.kmk
    29274 -
    29275 -PROGRAMS           += odininst
    29276 -odininst_TEMPLATE   = OdinApp
    29277 -
    29278 -odininst_SOURCES    = \
    29279 -    odininst.cpp \
    29280 -    regapi.c \
    29281 -    tz.c \
    29282 -    odininst.def
    29283 -
    29284 -odininst_LIBS      += \
    29285 -    $(PATH_STAGE_LIB)/kernel32.lib \
    29286 -    $(PATH_STAGE_LIB)/user32.lib \
    29287 -    $(PATH_STAGE_LIB)/advapi32.lib
    29288 -
    29289 -include $(FILE_KBUILD_SUB_FOOTER)
    29290 +## @file
    29291 +# ODININST makefile.
    29292 +#
    29293 +
    29294 +SUB_DEPTH = ../..
    29295 +include $(KBUILD_PATH)/subheader.kmk
    29296 +
    29297 +PROGRAMS           += odininst
    29298 +odininst_TEMPLATE   = OdinApp
    29299 +
    29300 +odininst_SOURCES    = \
    29301 +    odininst.cpp \
    29302 +    regapi.c \
    29303 +    tz.c \
    29304 +    odininst.def
    29305 +
    29306 +odininst_LIBS      += \
    29307 +    $(PATH_STAGE_LIB)/kernel32.lib \
    29308 +    $(PATH_STAGE_LIB)/user32.lib \
    29309 +    $(PATH_STAGE_LIB)/advapi32.lib
    29310 +
    29311 +include $(FILE_KBUILD_SUB_FOOTER)
    29312 diff --git a/tools/pebuild/mkn.cmd b/tools/pebuild/mkn.cmd
    29313 index 6c51fc4..49efc3e 100644
    29314 --- a/tools/pebuild/mkn.cmd
    29315 +++ b/tools/pebuild/mkn.cmd
    29316 @@ -1,5 +1,5 @@
    29317 -@rem tools\bin\cmdqd init 5
    29318 -@rem set MULTIJOBS=1
    29319 -SET EMX=e:\devtools\emx
    29320 -nmake DEBUG=1
    29321 +@rem tools\bin\cmdqd init 5
    29322 +@rem set MULTIJOBS=1
    29323 +SET EMX=e:\devtools\emx
    29324 +nmake DEBUG=1
    29325  copy bin\debug\pebuild.exe
    29326 \ No newline at end of file
    29327 diff --git a/tools/profilerfix/ApplyDiff.cmd b/tools/profilerfix/ApplyDiff.cmd
    29328 index 8537c5b..c0ede7c 100644
    29329 --- a/tools/profilerfix/ApplyDiff.cmd
    29330 +++ b/tools/profilerfix/ApplyDiff.cmd
    29331 @@ -1,104 +1,104 @@
    29332 -/* $Id: ApplyDiff.cmd,v 1.1 2002-04-19 07:05:53 bird Exp $
    29333 - *
    29334 - * Applies any .diff file to a binary file.
    29335 - *
    29336 - * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    29337 - *
    29338 - * Project Odin Software License can be found in LICENSE.TXT
    29339 - *
    29340 - */
    29341 -
    29342 -
    29343 -/*
    29344 - * Arguments.
    29345 - */
    29346 -parse arg sDiffFile sFilename sDummy
    29347 -if ((sFilename = '') | (sDummy <> '')) then
    29348 -do
    29349 -    say 'syntax error';
    29350 -    exit(1);
    29351 -end
    29352 -
    29353 -
    29354 -
    29355 -/*
    29356 - * Read the diff file.
    29357 - */
    29358 -aDiff.0 = 0;
    29359 -do while (lines(sDiffFile) > 0)
    29360 -    sLine = translate(linein(sDiffFile),,
    29361 -                      '                                      ',,
    29362 -                      x2c('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'))
    29363 -    if (word(sLine, 1) <> 'mismatch') then
    29364 -        leave;
    29365 -    parse var sLine 'mismatch at' sOffset '-' sTo'('.') !=' sFrom'('.
    29366 -    if ((sTo = '') | (sFrom = '') | (sOffset = '')) then
    29367 -    do
    29368 -        /*say 'dbg1:' sTo
    29369 -        say 'dbg1:' sFrom
    29370 -        say 'dbg1:' sOffset
    29371 -        say     sLine
    29372 -        */
    29373 -        leave;
    29374 -    end
    29375 -
    29376 -    /* add it */
    29377 -    i = aDiff.0 + 1;
    29378 -    aDiff.0 = i;
    29379 -    aDiff.i.iOffset = HexToDec(sOffset);
    29380 -    aDiff.i.chTo = x2c(strip(sTo))
    29381 -    aDiff.i.chFrom = x2c(strip(sFrom))
    29382 -end
    29383 -
    29384 -say 'Read 'aDiff.0' differences from' sDiffFile'.'
    29385 -if (aDiff.0 <= 0) then
    29386 -do
    29387 -    say ' No differences in the difffile, ' sDiffFile'!';
    29388 -    exit(3);
    29389 -end
    29390 -
    29391 -
    29392 -/*
    29393 - * Apply the diffeneces.
    29394 - */
    29395 -iRet = 0;
    29396 -do i = 1 to aDiff.0
    29397 -    /* say 'diff 'i':' aDiff.i.iOffset '-' c2x(aDiff.i.chFrom)' -> 'c2x(aDiff.i.chTo); */
    29398 -    ch = charin(sFilename, aDiff.i.iOffset + 1, 1);
    29399 -    if (ch <> aDiff.i.chFrom) then
    29400 -    do
    29401 -        if (ch <> aDiff.i.chTo) then
    29402 -        do
    29403 -            say 'patch mismatch at offset' aDiff.i.iOffset;
    29404 -            iRet = iRet + 1;
    29405 -            leave;
    29406 -        end
    29407 -    end
    29408 -    else
    29409 -    do
    29410 -        irc = charout(sFilename, aDiff.i.chTo, aDiff.i.iOffset + 1);
    29411 -        if (irc <> 0) then
    29412 -        do
    29413 -            say 'Error: failed to apply fix. rc='irc;
    29414 -            iRet = iRet + 1;
    29415 -        end
    29416 -    end
    29417 -end
    29418 -
    29419 -
    29420 -/*
    29421 - * Print indicator message.
    29422 - */
    29423 -if (iRet > 0) then
    29424 -    say iRet 'errors occured during applying of the patch.'
    29425 -else
    29426 -    say 'Successfully patched '''sFilename'''.';
    29427 -
    29428 -exit(iRet);
    29429 -
    29430 -
    29431 -
    29432 -
    29433 -HexToDec: procedure
    29434 -    parse arg sStringHex
    29435 -return x2d(strip(strip(sStringHex), 'L', '0'));
    29436 +/* $Id: ApplyDiff.cmd,v 1.1 2002-04-19 07:05:53 bird Exp $
    29437 + *
    29438 + * Applies any .diff file to a binary file.
    29439 + *
    29440 + * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    29441 + *
    29442 + * Project Odin Software License can be found in LICENSE.TXT
    29443 + *
    29444 + */
    29445 +
    29446 +
    29447 +/*
    29448 + * Arguments.
    29449 + */
    29450 +parse arg sDiffFile sFilename sDummy
    29451 +if ((sFilename = '') | (sDummy <> '')) then
    29452 +do
    29453 +    say 'syntax error';
    29454 +    exit(1);
    29455 +end
    29456 +
    29457 +
    29458 +
    29459 +/*
    29460 + * Read the diff file.
    29461 + */
    29462 +aDiff.0 = 0;
    29463 +do while (lines(sDiffFile) > 0)
    29464 +    sLine = translate(linein(sDiffFile),,
    29465 +                      '                                      ',,
    29466 +                      x2c('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'))
    29467 +    if (word(sLine, 1) <> 'mismatch') then
    29468 +        leave;
    29469 +    parse var sLine 'mismatch at' sOffset '-' sTo'('.') !=' sFrom'('.
    29470 +    if ((sTo = '') | (sFrom = '') | (sOffset = '')) then
    29471 +    do
    29472 +        /*say 'dbg1:' sTo
    29473 +        say 'dbg1:' sFrom
    29474 +        say 'dbg1:' sOffset
    29475 +        say     sLine
    29476 +        */
    29477 +        leave;
    29478 +    end
    29479 +
    29480 +    /* add it */
    29481 +    i = aDiff.0 + 1;
    29482 +    aDiff.0 = i;
    29483 +    aDiff.i.iOffset = HexToDec(sOffset);
    29484 +    aDiff.i.chTo = x2c(strip(sTo))
    29485 +    aDiff.i.chFrom = x2c(strip(sFrom))
    29486 +end
    29487 +
    29488 +say 'Read 'aDiff.0' differences from' sDiffFile'.'
    29489 +if (aDiff.0 <= 0) then
    29490 +do
    29491 +    say ' No differences in the difffile, ' sDiffFile'!';
    29492 +    exit(3);
    29493 +end
    29494 +
    29495 +
    29496 +/*
    29497 + * Apply the diffeneces.
    29498 + */
    29499 +iRet = 0;
    29500 +do i = 1 to aDiff.0
    29501 +    /* say 'diff 'i':' aDiff.i.iOffset '-' c2x(aDiff.i.chFrom)' -> 'c2x(aDiff.i.chTo); */
    29502 +    ch = charin(sFilename, aDiff.i.iOffset + 1, 1);
    29503 +    if (ch <> aDiff.i.chFrom) then
    29504 +    do
    29505 +        if (ch <> aDiff.i.chTo) then
    29506 +        do
    29507 +            say 'patch mismatch at offset' aDiff.i.iOffset;
    29508 +            iRet = iRet + 1;
    29509 +            leave;
    29510 +        end
    29511 +    end
    29512 +    else
    29513 +    do
    29514 +        irc = charout(sFilename, aDiff.i.chTo, aDiff.i.iOffset + 1);
    29515 +        if (irc <> 0) then
    29516 +        do
    29517 +            say 'Error: failed to apply fix. rc='irc;
    29518 +            iRet = iRet + 1;
    29519 +        end
    29520 +    end
    29521 +end
    29522 +
    29523 +
    29524 +/*
    29525 + * Print indicator message.
    29526 + */
    29527 +if (iRet > 0) then
    29528 +    say iRet 'errors occured during applying of the patch.'
    29529 +else
    29530 +    say 'Successfully patched '''sFilename'''.';
    29531 +
    29532 +exit(iRet);
    29533 +
    29534 +
    29535 +
    29536 +
    29537 +HexToDec: procedure
    29538 +    parse arg sStringHex
    29539 +return x2d(strip(strip(sStringHex), 'L', '0'));
    29540 diff --git a/tools/profilerfix/prfpatch.cmd b/tools/profilerfix/prfpatch.cmd
    29541 index 3e1fe58..add4e94 100644
    29542 --- a/tools/profilerfix/prfpatch.cmd
    29543 +++ b/tools/profilerfix/prfpatch.cmd
    29544 @@ -1,48 +1,48 @@
    29545 -/* $Id: prfpatch.cmd,v 1.1 2002-04-11 21:04:07 bird Exp $
    29546 - *
    29547 - * Applies fix the VAC308 profiler .obj.
    29548 - *
    29549 - * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    29550 - *
    29551 - * Project Odin Software License can be found in LICENSE.TXT
    29552 - *
    29553 - */
    29554 -
    29555 -
    29556 -/*
    29557 - * Arguments.
    29558 - */
    29559 -parse arg sFilename sDummy
    29560 -if ((sFilename = '') | (sDummy <> '')) then
    29561 -do
    29562 -    say 'syntax error';
    29563 -    exit(1);
    29564 -end
    29565 -
    29566 -/*
    29567 - * Apply the patch.
    29568 - */
    29569 -say 'Changing DosLoadModule to prfLoadModule...'
    29570 -sDosLoadModule = charin(sFilename, 229, 13);
    29571 -if (sDosLoadModule = 'DosLoadModule') then
    29572 -do
    29573 -    irc = charout(sFilename, 'prfLoadModule', 229);
    29574 -    if (irc <> 0) then
    29575 -        say 'Error: failed to apply fix. rc='irc;
    29576 -    else
    29577 -        say 'Fix applied.'
    29578 -    exit(irc);
    29579 -end
    29580 -else if (sDosLoadModule = 'prfLoadModule') then
    29581 -do
    29582 -    say 'Fix is allready applied.'
    29583 -    exit(0);
    29584 -end
    29585 -
    29586 -/*
    29587 - * Error
    29588 - */
    29589 -say 'invalid file?'
    29590 -say 'sDosLoadModule='c2x(sDosLoadModule);
    29591 -exit(1);
    29592 -
    29593 +/* $Id: prfpatch.cmd,v 1.1 2002-04-11 21:04:07 bird Exp $
    29594 + *
    29595 + * Applies fix the VAC308 profiler .obj.
    29596 + *
    29597 + * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
    29598 + *
    29599 + * Project Odin Software License can be found in LICENSE.TXT
    29600 + *
    29601 + */
    29602 +
    29603 +
    29604 +/*
    29605 + * Arguments.
    29606 + */
    29607 +parse arg sFilename sDummy
    29608 +if ((sFilename = '') | (sDummy <> '')) then
    29609 +do
    29610 +    say 'syntax error';
    29611 +    exit(1);
    29612 +end
    29613 +
    29614 +/*
    29615 + * Apply the patch.
    29616 + */
    29617 +say 'Changing DosLoadModule to prfLoadModule...'
    29618 +sDosLoadModule = charin(sFilename, 229, 13);
    29619 +if (sDosLoadModule = 'DosLoadModule') then
    29620 +do
    29621 +    irc = charout(sFilename, 'prfLoadModule', 229);
    29622 +    if (irc <> 0) then
    29623 +        say 'Error: failed to apply fix. rc='irc;
    29624 +    else
    29625 +        say 'Fix applied.'
    29626 +    exit(irc);
    29627 +end
    29628 +else if (sDosLoadModule = 'prfLoadModule') then
    29629 +do
    29630 +    say 'Fix is allready applied.'
    29631 +    exit(0);
    29632 +end
    29633 +
    29634 +/*
    29635 + * Error
    29636 + */
    29637 +say 'invalid file?'
    29638 +say 'sDosLoadModule='c2x(sDosLoadModule);
    29639 +exit(1);
    29640 +
    29641 diff --git a/tools/vslick/genproject.cmd b/tools/vslick/genproject.cmd
    29642 index 712f9bf..2f93dd3 100644
    29643 --- a/tools/vslick/genproject.cmd
    29644 +++ b/tools/vslick/genproject.cmd
    29645 @@ -1,233 +1,233 @@
    29646 -/* $Id: genproject.cmd,v 1.5 2000-11-15 00:20:44 bird Exp $
    29647 - *
    29648 - * This script generates a Visual Slick project of the source and include
    29649 - * files found in the directory tree starting at the current directory.
    29650 - *
    29651 - * Copyright (c) 1999-2000 knut st. osmundsen
    29652 - *
    29653 - * Project Odin Software License can be found in LICENSE.TXT
    29654 - *
    29655 - */
    29656 -    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    29657 -    call SysLoadFuncs;
    29658 -
    29659 -    parse arg sArg
    29660 -
    29661 -    sIncludes = '';
    29662 -    sProjFile = '';
    29663 -    fFullDir = 1;
    29664 -    fRecursive = 0;
    29665 -
    29666 -    sArgs.0 = 0;
    29667 -    i = 0;
    29668 -    do while sArg \= ''
    29669 -        i = i + 1;
    29670 -        ipos = pos(' ', sArg);
    29671 -        if ipos == 0 then do
    29672 -            sArgs.i = substr(sArg, 1);
    29673 -            sArg = '';
    29674 -        end
    29675 -        else do
    29676 -            sArgs.i = substr(sArg, 1, ipos);
    29677 -            /* next */
    29678 -            sArg = substr(sArg, ipos);
    29679 -            do while substr(sArg, 1, 1) == ' ' | substr(sArg, 1, 1) == '\t'
    29680 -                sArg = substr(sArg, 2);
    29681 -            end
    29682 -        end
    29683 -    end
    29684 -    sArgs.0 = i;
    29685 -
    29686 -    /* check if no parameters */
    29687 -    if i = 0 then
    29688 -    do
    29689 -        say 'error: no arguments!';
    29690 -        call syntax;
    29691 -    end
    29692 -
    29693 -    /* parse arguments */
    29694 -    do i = 1 to sArgs.0
    29695 -        sArg = sArgs.i;
    29696 -        if substr(sArg, 1, 1) == '-' | substr(sArg, 1, 1) == '/' then do
    29697 -            /* option */
    29698 -            chArg = substr(sArg, 2, 1);
    29699 -            sArg  = strip(substr(sArg, 3));
    29700 -            select
    29701 -                when chArg = 'I' | chArg = 'i' then do
    29702 -                    if (sArg <> '' & substr(sArg, length(sArg), 1) <> ';')  then
    29703 -                        sincludes = sIncludes || sArg || ';';
    29704 -                    else
    29705 -                        sIncludes = sIncludes || sArg;
    29706 -                end
    29707 -
    29708 -                when chArg = 'f' | chArg = 'F' then do
    29709 -                    fFullDir = 1;
    29710 -                end
    29711 -
    29712 -                when chArg = 'r' | chArg = 'R' then do
    29713 -                    fFullDir = 0;
    29714 -                end
    29715 -
    29716 -                when chArg = 'h' | chArg = '?' | sArg = '-help' then do
    29717 -                    call syntax;
    29718 -                end
    29719 -
    29720 -                when chArg = 's' | chArg = 'S' then do
    29721 -                    fRecursive = 1;
    29722 -                end
    29723 -
    29724 -                otherwise  do
    29725 -                    say 'illegal option: 'chArg||sArg
    29726 -                    call syntax;
    29727 -                end
    29728 -            end
    29729 -        end
    29730 -        else do
    29731 -            if sProjFile = '' then
    29732 -                sProjFile = sArg;
    29733 -            else do
    29734 -                say 'error! multiple project names!'
    29735 -                call syntax;
    29736 -            end
    29737 -        end
    29738 -    end /* do */
    29739 -
    29740 -    say 'Will now generate :' sProjFile
    29741 -    say 'Includes specified:' sIncludes
    29742 -
    29743 -    /* delete old target files */
    29744 -    call SysFileDelete sProjFile;
    29745 -    if lastpos('.', sProjFile) > 0 then /* tag file */
    29746 -        call SysFileDelete substr(sProjFile, 1, lastpos('.', sProjFile))'vtg'
    29747 -
    29748 -    /* open target file */
    29749 -    if (stream(sProjFile, 'c', 'open write' ) <> '') then do
    29750 -        call lineout sProjFile, '[COMPILER]'
    29751 -        call lineout sProjFile, 'MACRO=odin32_setcurrentdir();\nodin32_maketagfile();\n'
    29752 -        call lineout sProjFile, 'FILTEREXPANSION=1 1 0 0 1'
    29753 -        call lineout sProjFile, 'compile=concur|capture|clear|:Compile:&Compile,nmake .\bin\debug\%n.obj'
    29754 -        call lineout sProjFile, 'make=concur|capture|clear|:Build:&Build,nmake'
    29755 -        call lineout sProjFile, 'rebuild=concur|capture|clear|:Rebuild:&Rebuild,nmake -a'
    29756 -        call lineout sProjFile, 'debug=:Debug:&Debug,'
    29757 -        call lineout sProjFile, 'execute=:Execute:E&xecute,'
    29758 -        call lineout sProjFile, 'user1=hide|:User 1:User 1,'
    29759 -        call lineout sProjFile, 'user2=hide|:User 2:User 2,'
    29760 -        call lineout sProjFile, 'usertool_resource_editor=hide|:Resource Editor:Resource Editor,dlgedit'
    29761 -        call lineout sProjFile, 'workingdir='directory()
    29762 -        /* TODO */
    29763 -        call lineout sProjFile, 'includedirs='||sIncludes||'%(INCLUDE)'
    29764 -        call lineout sProjFile, 'tagfiles='
    29765 -        call lineout sProjFile, 'reffile='
    29766 -
    29767 -        call lineout sProjFile, '[FILES]'
    29768 -        call processDirTree sProjFile, directory(), directory(), fRecursive, fFullDir;
    29769 -        call lineout sProjFile, '[ASSOCIATION]'
    29770 -        call lineout sProjFile, '[STATE]'
    29771 -        call lineout sProjFile, 'FILEHIST: 0'
    29772 -        call lineout sProjFile, 'PRINTER: 2'
    29773 -
    29774 -        call stream sIncFile, 'c', 'close';
    29775 -    end
    29776 -    else do
    29777 -        say 'oops, failed to open outputfile,' sProjFile;
    29778 -        exit 1;
    29779 -    end
    29780 -
    29781 -    exit (0);
    29782 -
    29783 -
    29784 -
    29785 -
    29786 -
    29787 -
    29788 -/*********************/
    29789 -/* procedure section */
    29790 -/*********************/
    29791 -
    29792 -syntax: procedure
    29793 -    say 'Syntax: genproject.cmd  <project filename> [-I<include directories>]'
    29794 -    say '   switches:   -s                  Recursivly scan subdirectories too.'
    29795 -    say '                                   (default: Current dir only)'
    29796 -    say '               -f                  Full filenames.         (default)'
    29797 -    say '               -r                  Relative filenames.     (default: -f)'
    29798 -    say '               -I<dir or dirlist>  Include directories.'
    29799 -    say 'Copyright (c) 1999-2000 knut st. osmundsen'
    29800 -    exit (1);
    29801 -
    29802 -/* processes an directory tree */
    29803 -processDirTree: procedure
    29804 -    parse arg sProjFile, sDirectory, sRoot, fRecursive, fFullDir
    29805 -
    29806 -    rc = SysFileTree(sDirectory'\*', sFiles, 'FO');
    29807 -    if rc == 0  then do
    29808 -        do i = 1 to sFiles.0
    29809 -            if filterFile(sFiles.i) then
    29810 -            do
    29811 -                if (fFullDir) then
    29812 -                    call lineout sProjFile, sFiles.i;
    29813 -                else
    29814 -                    call lineout sProjFile, substr(sFiles.i, length(sRoot)+2);
    29815 -            end
    29816 -        end
    29817 -    end
    29818 -
    29819 -    if (fRecursive) then
    29820 -    do
    29821 -        rc = SysFileTree(sDirectory'\*', sDirs, 'DO');
    29822 -        if rc == 0  then do
    29823 -            do i = 1 to sDirs.0
    29824 -                if filterDirectory(sDirs.i) then
    29825 -                    call processDirTree sProjFile, sDirs.i, sRoot, fRecursive, fFullDir
    29826 -            end
    29827 -        end
    29828 -    end
    29829 -
    29830 -
    29831 -    return;
    29832 -
    29833 -
    29834 -/* returns boolean, TRUE if include; false if exclude */
    29835 -filterFile: procedure
    29836 -    parse arg sFile
    29837 -
    29838 -    if lastpos('\', sFile) < lastpos('.', sFile) then do
    29839 -        sIncludeExt = 'c;cpp;h;hpp;inc;asm;rc;mak;cmd;mk;def;txt;orc;dlg;doc;ipf;'
    29840 -        sExt = substr(sFile, lastpos('.', sFile)+1);
    29841 -
    29842 -        /* look for sExt in sIncludeExt */
    29843 -        do while pos(';', sIncludeExt) > 0
    29844 -            ipos = pos(';', sIncludeExt)
    29845 -            if sExt == substr(sIncludeExt, 1, ipos-1) then
    29846 -                return 1;
    29847 -            sIncludeExt = substr(sIncludeExt, ipos+1);
    29848 -        end
    29849 -
    29850 -    end
    29851 -    else
    29852 -        return 1; /* all file without extension is included. */
    29853 -
    29854 -    return 0;
    29855 -
    29856 -/* returns boolean, TRUE if include; false if exclude */
    29857 -filterDirectory: procedure
    29858 -    parse arg sDir
    29859 -
    29860 -    i = lastpos('\', sDir)
    29861 -    if i == 0 then
    29862 -        i = length(sDir);
    29863 -    else
    29864 -        i = i + 1;
    29865 -    sDir = substr(sDir, i);
    29866 -
    29867 -    sExcludeDir = 'CVS;old;new;object;list;bin;obj;';
    29868 -
    29869 -    /* look for sExt in sIncludeExt */
    29870 -    do while pos(';', sExcludeDir) > 0
    29871 -        ipos = pos(';', sExcludeDir)
    29872 -        if sDir == substr(sExcludeDir, 1, ipos-1) then
    29873 -            return 0;
    29874 -        sExcludeDir = substr(sExcludeDir, ipos+1);
    29875 -    end
    29876 -
    29877 -    return 1;
    29878 -
    29879 +/* $Id: genproject.cmd,v 1.5 2000-11-15 00:20:44 bird Exp $
    29880 + *
    29881 + * This script generates a Visual Slick project of the source and include
    29882 + * files found in the directory tree starting at the current directory.
    29883 + *
    29884 + * Copyright (c) 1999-2000 knut st. osmundsen
    29885 + *
    29886 + * Project Odin Software License can be found in LICENSE.TXT
    29887 + *
    29888 + */
    29889 +    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
    29890 +    call SysLoadFuncs;
    29891 +
    29892 +    parse arg sArg
    29893 +
    29894 +    sIncludes = '';
    29895 +    sProjFile = '';
    29896 +    fFullDir = 1;
    29897 +    fRecursive = 0;
    29898 +
    29899 +    sArgs.0 = 0;
    29900 +    i = 0;
    29901 +    do while sArg \= ''
    29902 +        i = i + 1;
    29903 +        ipos = pos(' ', sArg);
    29904 +        if ipos == 0 then do
    29905 +            sArgs.i = substr(sArg, 1);
    29906 +            sArg = '';
    29907 +        end
    29908 +        else do
    29909 +            sArgs.i = substr(sArg, 1, ipos);
    29910 +            /* next */
    29911 +            sArg = substr(sArg, ipos);
    29912 +            do while substr(sArg, 1, 1) == ' ' | substr(sArg, 1, 1) == '\t'
    29913 +                sArg = substr(sArg, 2);
    29914 +            end
    29915 +        end
    29916 +    end
    29917 +    sArgs.0 = i;
    29918 +
    29919 +    /* check if no parameters */
    29920 +    if i = 0 then
    29921 +    do
    29922 +        say 'error: no arguments!';
    29923 +        call syntax;
    29924 +    end
    29925 +
    29926 +    /* parse arguments */
    29927 +    do i = 1 to sArgs.0
    29928 +        sArg = sArgs.i;
    29929 +        if substr(sArg, 1, 1) == '-' | substr(sArg, 1, 1) == '/' then do
    29930 +            /* option */
    29931 +            chArg = substr(sArg, 2, 1);
    29932 +            sArg  = strip(substr(sArg, 3));
    29933 +            select
    29934 +                when chArg = 'I' | chArg = 'i' then do
    29935 +                    if (sArg <> '' & substr(sArg, length(sArg), 1) <> ';')  then
    29936 +                        sincludes = sIncludes || sArg || ';';
    29937 +                    else
    29938 +                        sIncludes = sIncludes || sArg;
    29939 +                end
    29940 +
    29941 +                when chArg = 'f' | chArg = 'F' then do
    29942 +                    fFullDir = 1;
    29943 +                end
    29944 +
    29945 +                when chArg = 'r' | chArg = 'R' then do
    29946 +                    fFullDir = 0;
    29947 +                end
    29948 +
    29949 +                when chArg = 'h' | chArg = '?' | sArg = '-help' then do
    29950 +                    call syntax;
    29951 +                end
    29952 +
    29953 +                when chArg = 's' | chArg = 'S' then do
    29954 +                    fRecursive = 1;
    29955 +                end
    29956 +
    29957 +                otherwise  do
    29958 +                    say 'illegal option: 'chArg||sArg
    29959 +                    call syntax;
    29960 +                end
    29961 +            end
    29962 +        end
    29963 +        else do
    29964 +            if sProjFile = '' then
    29965 +                sProjFile = sArg;
    29966 +            else do
    29967 +                say 'error! multiple project names!'
    29968 +                call syntax;
    29969 +            end
    29970 +        end
    29971 +    end /* do */
    29972 +
    29973 +    say 'Will now generate :' sProjFile
    29974 +    say 'Includes specified:' sIncludes
    29975 +
    29976 +    /* delete old target files */
    29977 +    call SysFileDelete sProjFile;
    29978 +    if lastpos('.', sProjFile) > 0 then /* tag file */
    29979 +        call SysFileDelete substr(sProjFile, 1, lastpos('.', sProjFile))'vtg'
    29980 +
    29981 +    /* open target file */
    29982 +    if (stream(sProjFile, 'c', 'open write' ) <> '') then do
    29983 +        call lineout sProjFile, '[COMPILER]'
    29984 +        call lineout sProjFile, 'MACRO=odin32_setcurrentdir();\nodin32_maketagfile();\n'
    29985 +        call lineout sProjFile, 'FILTEREXPANSION=1 1 0 0 1'
    29986 +        call lineout sProjFile, 'compile=concur|capture|clear|:Compile:&Compile,nmake .\bin\debug\%n.obj'
    29987 +        call lineout sProjFile, 'make=concur|capture|clear|:Build:&Build,nmake'
    29988 +        call lineout sProjFile, 'rebuild=concur|capture|clear|:Rebuild:&Rebuild,nmake -a'
    29989 +        call lineout sProjFile, 'debug=:Debug:&Debug,'
    29990 +        call lineout sProjFile, 'execute=:Execute:E&xecute,'
    29991 +        call lineout sProjFile, 'user1=hide|:User 1:User 1,'
    29992 +        call lineout sProjFile, 'user2=hide|:User 2:User 2,'
    29993 +        call lineout sProjFile, 'usertool_resource_editor=hide|:Resource Editor:Resource Editor,dlgedit'
    29994 +        call lineout sProjFile, 'workingdir='directory()
    29995 +        /* TODO */
    29996 +        call lineout sProjFile, 'includedirs='||sIncludes||'%(INCLUDE)'
    29997 +        call lineout sProjFile, 'tagfiles='
    29998 +        call lineout sProjFile, 'reffile='
    29999 +
    30000 +        call lineout sProjFile, '[FILES]'
    30001 +        call processDirTree sProjFile, directory(), directory(), fRecursive, fFullDir;
    30002 +        call lineout sProjFile, '[ASSOCIATION]'
    30003 +        call lineout sProjFile, '[STATE]'
    30004 +        call lineout sProjFile, 'FILEHIST: 0'
    30005 +        call lineout sProjFile, 'PRINTER: 2'
    30006 +
    30007 +        call stream sIncFile, 'c', 'close';
    30008 +    end
    30009 +    else do
    30010 +        say 'oops, failed to open outputfile,' sProjFile;
    30011 +        exit 1;
    30012 +    end
    30013 +
    30014 +    exit (0);
    30015 +
    30016 +
    30017 +
    30018 +
    30019 +
    30020 +
    30021 +/*********************/
    30022 +/* procedure section */
    30023 +/*********************/
    30024 +
    30025 +syntax: procedure
    30026 +    say 'Syntax: genproject.cmd  <project filename> [-I<include directories>]'
    30027 +    say '   switches:   -s                  Recursivly scan subdirectories too.'
    30028 +    say '                                   (default: Current dir only)'
    30029 +    say '               -f                  Full filenames.         (default)'
    30030 +    say '               -r                  Relative filenames.     (default: -f)'
    30031 +    say '               -I<dir or dirlist>  Include directories.'
    30032 +    say 'Copyright (c) 1999-2000 knut st. osmundsen'
    30033 +    exit (1);
    30034 +
    30035 +/* processes an directory tree */
    30036 +processDirTree: procedure
    30037 +    parse arg sProjFile, sDirectory, sRoot, fRecursive, fFullDir
    30038 +
    30039 +    rc = SysFileTree(sDirectory'\*', sFiles, 'FO');
    30040 +    if rc == 0  then do
    30041 +        do i = 1 to sFiles.0
    30042 +            if filterFile(sFiles.i) then
    30043 +            do
    30044 +                if (fFullDir) then
    30045 +                    call lineout sProjFile, sFiles.i;
    30046 +                else
    30047 +                    call lineout sProjFile, substr(sFiles.i, length(sRoot)+2);
    30048 +            end
    30049 +        end
    30050 +    end
    30051 +
    30052 +    if (fRecursive) then
    30053 +    do
    30054 +        rc = SysFileTree(sDirectory'\*', sDirs, 'DO');
    30055 +        if rc == 0  then do
    30056 +            do i = 1 to sDirs.0
    30057 +                if filterDirectory(sDirs.i) then
    30058 +                    call processDirTree sProjFile, sDirs.i, sRoot, fRecursive, fFullDir
    30059 +            end
    30060 +        end
    30061 +    end
    30062 +
    30063 +
    30064 +    return;
    30065 +
    30066 +
    30067 +/* returns boolean, TRUE if include; false if exclude */
    30068 +filterFile: procedure
    30069 +    parse arg sFile
    30070 +
    30071 +    if lastpos('\', sFile) < lastpos('.', sFile) then do
    30072 +        sIncludeExt = 'c;cpp;h;hpp;inc;asm;rc;mak;cmd;mk;def;txt;orc;dlg;doc;ipf;'
    30073 +        sExt = substr(sFile, lastpos('.', sFile)+1);
    30074 +
    30075 +        /* look for sExt in sIncludeExt */
    30076 +        do while pos(';', sIncludeExt) > 0
    30077 +            ipos = pos(';', sIncludeExt)
    30078 +            if sExt == substr(sIncludeExt, 1, ipos-1) then
    30079 +                return 1;
    30080 +            sIncludeExt = substr(sIncludeExt, ipos+1);
    30081 +        end
    30082 +
    30083 +    end
    30084 +    else
    30085 +        return 1; /* all file without extension is included. */
    30086 +
    30087 +    return 0;
    30088 +
    30089 +/* returns boolean, TRUE if include; false if exclude */
    30090 +filterDirectory: procedure
    30091 +    parse arg sDir
    30092 +
    30093 +    i = lastpos('\', sDir)
    30094 +    if i == 0 then
    30095 +        i = length(sDir);
    30096 +    else
    30097 +        i = i + 1;
    30098 +    sDir = substr(sDir, i);
    30099 +
    30100 +    sExcludeDir = 'CVS;old;new;object;list;bin;obj;';
    30101 +
    30102 +    /* look for sExt in sIncludeExt */
    30103 +    do while pos(';', sExcludeDir) > 0
    30104 +        ipos = pos(';', sExcludeDir)
    30105 +        if sDir == substr(sExcludeDir, 1, ipos-1) then
    30106 +            return 0;
    30107 +        sExcludeDir = substr(sExcludeDir, ipos+1);
    30108 +    end
    30109 +
    30110 +    return 1;
    30111 +
    30112 diff --git a/tools/wrc/Makefile.kmk b/tools/wrc/Makefile.kmk
    30113 index f83161a..a25916f 100644
    30114 --- a/tools/wrc/Makefile.kmk
    30115 +++ b/tools/wrc/Makefile.kmk
    30116 @@ -1,39 +1,39 @@
    30117 -## @file
    30118 -# WRC makefile.
    30119 -#
    30120 -# Note. If you wanna recompile everything you'll need flex and bison.
    30121 -#       Both are found at hobbes. See original makefiles.
    30122 -#
    30123 -
    30124 -SUB_DEPTH = ../..
    30125 -include $(KBUILD_PATH)/subheader.kmk
    30126 -
    30127 -# Note: while the tool is originally named wrc in Wine, we
    30128 -# name it winerc to avoid the naming conflict with Watcom RC
    30129 -
    30130 -BLDPROGS           += winerc
    30131 -winerc_TEMPLATE     = OdinBin
    30132 -
    30133 -# @todo: the need of this for BLDPROGS looks like a kBuild bug to me
    30134 -winerc_INST         = bin/
    30135 -winerc_INSTTYPE     = stage
    30136 -
    30137 -winerc_SOURCES      = \
    30138 -    dumpres.c \
    30139 -    genres.c \
    30140 -    newstruc.c \
    30141 -    preproc.c \
    30142 -    readres.c \
    30143 -    utils.c \
    30144 -    wrc.c \
    30145 -    y.tab.c \
    30146 -    lexyy.c \
    30147 -    ppy.tab.c \
    30148 -    lex.ppl.c \
    30149 -    writeres.c \
    30150 -    wrc.def
    30151 -
    30152 -winerc_LIBS        += \
    30153 -    $(PATH_STAGE_LIB)/unicode.lib
    30154 -
    30155 -include $(FILE_KBUILD_SUB_FOOTER)
    30156 +## @file
    30157 +# WRC makefile.
    30158 +#
    30159 +# Note. If you wanna recompile everything you'll need flex and bison.
    30160 +#       Both are found at hobbes. See original makefiles.
    30161 +#
    30162 +
    30163 +SUB_DEPTH = ../..
    30164 +include $(KBUILD_PATH)/subheader.kmk
    30165 +
    30166 +# Note: while the tool is originally named wrc in Wine, we
    30167 +# name it winerc to avoid the naming conflict with Watcom RC
    30168 +
    30169 +BLDPROGS           += winerc
    30170 +winerc_TEMPLATE     = OdinBin
    30171 +
    30172 +# @todo: the need of this for BLDPROGS looks like a kBuild bug to me
    30173 +winerc_INST         = bin/
    30174 +winerc_INSTTYPE     = stage
    30175 +
    30176 +winerc_SOURCES      = \
    30177 +    dumpres.c \
    30178 +    genres.c \
    30179 +    newstruc.c \
    30180 +    preproc.c \
    30181 +    readres.c \
    30182 +    utils.c \
    30183 +    wrc.c \
    30184 +    y.tab.c \
    30185 +    lexyy.c \
    30186 +    ppy.tab.c \
    30187 +    lex.ppl.c \
    30188 +    writeres.c \
    30189 +    wrc.def
    30190 +
    30191 +winerc_LIBS        += \
    30192 +    $(PATH_STAGE_LIB)/unicode.lib
    30193 +
    30194 +include $(FILE_KBUILD_SUB_FOOTER)
Note: See TracChangeset for help on using the changeset viewer.