1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
Version 1.3:
The new array design will fail under msdos if you put more than
16K items into an array and then walk it with for(i in A).
Unfortunately things will probably fail ungracefully. The new
array design runs into 64K limits at 16K elements in an array and
there are no checks in the code. This is fixable, but tedious and
1.2.2 works well on DOS.
If this is a problem use version 1.2.2.
You can get updated source and executables (1.2.2) for DOS from
ftp.wustl.edu ~/systems/msdos/gnuish/mawk122[sx].zip
Version 1.2:
I no longer have a dos machine so must count on others to verify that
things work under msdos.
1.2 has been ported to TCC, but not MSC (I wouldn't expect this to
be too hard).
You now have to compile large model. Code will no longer fit in
64K and code ptr and data ptrs must be both fit in a void* hence
large model required.
Installation instructions are in file INSTALL.
Notes for 1.1.2d
Three changes specific to DOS.
(1) Internal conversions from doubles to strings that are integers
use internal conversion to long so DOS and unix now give the same
output. E.g.
'{ print 2^30 }'
1073741824
(2) Large model uses 8K as opposed to 4K I/O buffers.
(3) MAWKSHELL is no longer required. If not set in the
environment, MAWKSHELL defaults to %COMSPEC% /c, e.g., if
comspec is
c:\system\command.com
then this has the effect of setting MAWKSHELL to
c:\system\command.com /c
Comspec should give a full drive-path specification.
Notes for MsDOS (mawk 1.1)
---------------
command.com doesn't understand ' so if you use command.com as your
shell (the norm under DOS) then on the command line (and NOT from
files) the meanings of " and ' are reversed.
mawk "{ print 'hello world' }"
If this seems too weird, use
mawk -f con
{ print "hello world" }
^Z
If you use a DOS shell that gives you a Unix style command line, to use
it you'll need to provide a C function reargv() that retrieves argc and
argv[] from your shell.
To enable system and pipes you need to tell mawk about your shell by
setting the environment variable MAWKSHELL. E.g, with command.com
set MAWKSHELL=c:\sys\command.com /c
or with a unix like shell
set MAWKSHELL=c:\bin\sh.exe -c
in your autoexec.bat. The full path with drive and extension and
appropriate switch is required. (Small model is a tight squeeze
and there's not enought room for PATH searching code.)
If you want to use a ram disk for the pipes, set MAWKTMPDIR.
set MAWKTMPDIR=d:\
The trailing backslash is required. You have to set MAWKSHELL,
MAWKTMPDIR is optional -- defaulting to the current directory.
For compatibility with Unix, CR are silently stripped from input and LF
silently become CRLF on output. Also ^Z indicates EOF on input (
evidently for compatibility with CPM!!!).
CR control can be turned off, with a new variable BINMODE.
BINMODE defaults to 0.
BINMODE = 1 gives binary input.
BINMODE = 2 gives binary output.
BINMODE = 3 gives both.
Setting BINMODE with -v or in the BEGIN section affects all
files, otherwise it only affects files opened after the
assignment to BINMODE. Once a file is open, later assignment to
BINMODE does not affect it. Note that with binary output, printf
will behave strangely -- you'll need to explicitly use \r
Eg mawk -v BINMODE=2 '{ printf "%d %s\r\n", NR, $0}'
Assignment to BINMODE does not change RS or ORS; however there is
a -W feature
-W BINMODE=1 is the same as
-v BINMODE=1 -v RS="\r\n" or BEGIN{BINMODE=1 ; RS = "\r\n" }
-W BINMODE=2 is the same as
-v BINMODE=2 -v ORS="\r\n" or BEGIN{BINMODE=2 ; ORS = "\r\n" }
-W BINMODE=3 is the same as
-v BINMODE=3 -v RS=ORS="\r\n" or BEGIN{BINMODE=2 ; RS=ORS = "\r\n" }
Setting MAWKBINMODE in the environment is the same as using -W,
except its permanent.
If you rarely have to deal with text files that contain ^Z,
then setting MAWKBINMODE=1 in the environment would speed up input
slightly.
----------------------------------------------------------
WARNING: If you write an infinite loop that does not print to the
screen, then you will have to reboot. For example
x = 1
while( x < 10 ) A[x] = x
x++
By mistake the x++ is outside the loop. What you need to do is type
control break and the keyboard hardware will generate an interrupt and
the operating system will service that interrupt and terminate your
program, but unfortunately MsDOS does not have such a feature.
|