home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / c / clone1_1.zip / BAT2EXEC.BUG next >
Text File  |  1993-01-08  |  5KB  |  78 lines

  1. BAT2EXEC.BUG - Bugs (and other pecularities) in BATch file compiler:
  2.     BAT2EXEC 1.5 (c) 1990, 1991 Ziff Communications Co.
  3.     PC Magazine ~ Douglas Boling.
  4. Of the three BAT compilers I have this is the most compatible one.
  5.  
  6. More or less severe bugs.
  7. 1. If ECHO statements write more than 14 lines to a diskfile (via redirection)
  8.    then subsequent ECHO lines without redirection want to write to the PRN
  9.    device instead of to the CONsole. This may be "corrected" by redirecting
  10.    subsequent ECHO's, as well as some other internal commands, such as PAUSE,
  11.    that write to standard output, explicitely to CON. This "correction" does
  12.    not work for many other internal and external DOS commands, external
  13.    programs and within external batch files: these even DO NOT RUN if
  14.    redirected to ANYTHING (e.g. CD, COPY, DIR and TYPE), while they print on
  15.    PRN if not redirected at all! Is seems that something in memory gets
  16.    confused, which can not be corrected. ECHO (and PAUSE) can be corrected
  17.    because they are handled by the compiler itself (within the compiled file),
  18.    while (all) other commands are executed by shelling out to (a confused) DOS.
  19.    This is a rather severe bug!
  20. 2. ECHO lines that begin with the characters "on" or "off" whether followed by
  21.    any other text or not are always interpreted as their equivalent batch
  22.    commands (in contrast to DOS: if "on" or "off" is followed by more text then
  23.    the whole line is text and "on" of "off" are not interpreted). Commands
  24.    never are echoed from the compiler, so such lines will not be displayed.
  25. 3. While redirecting standard output (to a file, e.g. via ECHO) extra spaces
  26.    corresponding to the redirection part on the original line are written to
  27.    the output file. (This isn't necessaryly an important bug.)
  28. 4. Constructs like 'FOR %%A IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO.....etc.',
  29.    that involve wildcards (* and ?'s) in one or more replaceable parameters are
  30.    processed buggy by BAT2EXEC. How buggy is unpredictable, but it is
  31.    certainly erroneous. Such constructs should be changed (split mostly)
  32.    into a number of separate lines such as 'FOR %%A IN (%1) DO.....etc.',
  33.    'FOR %%A IN (%2) DO.....etc.', etc. or otherwise as one likes.
  34.  
  35. Other differences with DOS BATch language:
  36. 1. %0 in a batch file only returns the literal call to the file;
  37.    %0 in a compiled program returns the full drive:\path\filename.ext of the
  38.    called program (ext=COM/EXE), independent of how it was called (to start).
  39.    This may be an undesired 'feature', in any case %0 is much longer.
  40. 2. DOS allows for special treatment of a slash within a 'for' list (see file
  41.    UNDOCU'D.DOS). The compiler doesn't regard the slash special, so slashes
  42.    within a 'for' list are treated as all other characters. This should not
  43.    be a problem, because it was not documented and thus in DOS goes differently
  44.    than expected, if compiled it works as expected.
  45. 3. A file to redirect to should initially be created with a single > character.
  46.    A double >> does not implicitely create it as in DOS; in such a case the
  47.    redirection is ignored and output goes to standard output (which may have
  48.    changed from CON to PRN by another bug). Bug or feature?
  49. 4. The command line 'echo 7' in which '7' is actually the ascii value 7,
  50.    causing a beep and a CRLF on the output device, is suppressed completely
  51.    by the resulting compiled program. In order to get it function one should
  52.    include at least some printable character (not equal to a space), for
  53.    instance the ascii character 255, that prints as a space. Thus: 'echo #7',
  54.    in which '7' is ascii character 7 and '#' is character 255, works!
  55. 5. Redirecting or piping a normal BATch file at call time makes no sense: it is
  56.    not effective. Redirecting (or piping) the input for or output from a
  57.    compiled batch script at call time (at least with BAT2EXEC), however, is
  58.    effective!  Redirected input does not occur in (compiled) batch files,
  59.    except for some special internal DOS commands (such as DATE, TIME and
  60.    DEL *.*). Output to redirect, that normally goes to the screen (CON),
  61.    concerns all output not explicitely redirected within the compiled script,
  62.    so all messages from internal DOS commands (as long as not written to the
  63.    standard error device), such as from COPY, DIR and ECHO. This redirection of
  64.    _ALL_ standard (input and) output remains in effect as long as the called
  65.    compiled script is running, also if it calls real BATch files (!) and other
  66.    compiled batch scripts and in fact any external program for which no other
  67.    (explicit) redirection of standard output has been specified.
  68.    Redirection of standard (input and) output of compiled batch scripts
  69.    generally is not intented and applied, but in specific cases there may be a
  70.    useful application for it.
  71.  
  72. Centrum voor Medische Informatica TNO       <Email>              |  |  |\/|
  73. TNO Center for Medical Informatics | GROENEVELD@CMI.TNO.NL  |  \_/  |  |  |
  74. ( CMI-TNO )    | Y. Groeneveld     | GROENEVELD@CMIHP1.UUCP | Jim Groeneveld
  75. P.O.Box 124    | Wassenaarseweg 56 | GROENEVELD@TNO.NL      | Schoolweg 14
  76. 2300 AC Leiden | 2333 AL Leiden    | (8 January 1993)       | 8071 BC Nunspeet
  77. Nederland.     | (+31|0)71-181810  | Fax (+31|0)71-176382   | 03412-60413
  78.