Commit | Line | Data |
---|---|---|
483839cf C |
1 | CHANGES as of July 12: |
2 | ||
3 | 1. \ddd allowed in regular expressions. | |
4 | ||
5 | 2. exit <expression> causes the expression to | |
6 | to be the status return upon completion. | |
7 | ||
8 | 3. a new builtin called "getline" causes the next | |
9 | input line to be read immediately. Fields, NR, etc., | |
10 | are all set, but you are left at exactly the same place | |
11 | in the awk program. Getline returns 0 for end of file; | |
12 | 1 for a normal record. | |
13 | ||
14 | ||
15 | CHANGES SINCE MEMO: | |
16 | Update to TM of Sept 1, 1978: | |
17 | ||
18 | 1. A new form of for loop | |
19 | for (i in array) | |
20 | statement | |
21 | is now available. It provides a way to walk | |
22 | along the members of an array, most usefully | |
23 | for associative arrays with non-numeric subscripts. | |
24 | Elements are accessed in an unpredictable order, | |
25 | so don't count on anything. | |
26 | Futhermore, havoc ensues if elements are created | |
27 | during this operation, or if the index variable | |
28 | is fiddled. | |
29 | ||
30 | 2. index(s1, s2) returns the position in s1 | |
31 | where s2 first occurs, or 0 if it doesn't. | |
32 | ||
33 | 3. Multi-line records are now supported more | |
34 | conveniently. If the record separator is null | |
35 | RS = "" | |
36 | then a blank line terminates a record, and newline | |
37 | is a default field separator, along with | |
38 | blank and tab. | |
39 | ||
40 | 4. The syntax of split has been changed. | |
41 | n = split(str, arrayname, sep) | |
42 | splits the string str into the array using | |
43 | the separator sep (a single character). | |
44 | If no sep field is given, FS is used instead. | |
45 | The elements are array[1] ... array[n]; n | |
46 | is the function value. | |
47 | ||
48 | 5. some minor bugs have been fixed. | |
49 | ||
50 | IMPLEMENTATION NOTES: | |
51 | ||
52 | Things to watch out for when trying to make awk: | |
53 | ||
54 | 1. The yacc -d business creates a new file y.tab.h | |
55 | with the yacc #defines in it. this is compared to | |
56 | awk.h on each successive compile, and major recompilation | |
57 | is done only if the files differ. (This permits editing | |
58 | the grammar file without causing everything in sight | |
59 | to be recompiled, so long as the definitions don't | |
60 | change.) | |
61 | ||
62 | 2. The program proc.c is compiled into proc, which | |
63 | is used to create proctab.c. proctab.c is the | |
64 | table of function pointers used by run to actually | |
65 | execute things. Don't try to load proc.c with the | |
66 | other .c files; it also contains a "main()". | |
67 | ||
68 | 3. Awk uses structure assignment. Be sure your | |
69 | version of the C compiler has it. | |
70 | ||
71 | 4. The loader flag -lm is used to fetch the standard | |
72 | math library on the Research system. It is more likely | |
73 | that you will want to use -lS on yours. | |
74 | run.c also includes "math.h", which contains sensible | |
75 | definitions for log(), sqrt(), etc. If you don't have this | |
76 | include file, comment the line out, and all will be well | |
77 | anyway. | |
78 | ||
79 | 5. The basic sequence of events (in case make doesn't | |
80 | seem to do the job) is | |
81 | yacc -d awk.g.y | |
82 | cc -O -c y.tab.c | |
83 | mv y.tab.o awk.g.o | |
84 | lex awk.lx.l | |
85 | cc -O -c lex.yy.c | |
86 | mv lex.yy.o awk.lx.o | |
87 | cc -O -c b.c | |
88 | cc -O -c main.c | |
89 | e - <tokenscript | |
90 | cc -O -c token.c | |
91 | cc -O -c tran.c | |
92 | cc -O -c lib.c | |
93 | cc -O -c run.c | |
94 | cc -O -c parse.c | |
95 | cc -O -c proc.c | |
96 | cc -o proc proc.c token.o | |
97 | proc >proctab.c | |
98 | cc -O -c proctab.c | |
99 | cc -i -O awk.g.o awk.lx.o b.o main.o token.o tran.o lib.o run.o parse.o proctab.o -lm |