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