Fixed a bug in Preload caused be a missing brace around a for loop,
[wine] / dlls / dxerr8 / errors.awk
1 BEGIN {
2         print "/* Machine generated. Do not edit. */"
3         print ""
4         lines = 0
5 }
6
7         split($0, array, FS)
8
9         if (NF > 0 && length(array[1]) > 0) {
10                 lines++
11
12                 # save the first word is the names array
13                 names[lines] = array[1] 
14
15                 # create the WCHAR version of the name
16                 printf "static const WCHAR name%dW[] = { ", lines
17                 i = 1
18                 len = length(array[1]) + 1
19                 while (i < len) {
20                         printf "'%s',", substr(array[1],i,1)
21                         i++
22                 }
23                 print  "0 };"
24         
25                 # create the CHAR version of the description
26                 printf "static const CHAR description%dA[] = \"", lines
27                 word = 2
28                 while (word < (NF + 1)) {
29                         printf "%s", array[word]
30                         if (word < NF )
31                                 printf " "
32                         word++
33                 }
34                 print  "\";"
35         
36                 # create the WCHAR version of the description
37                 printf "static const WCHAR description%dW[] = { ", lines
38                 word = 2
39                 while (word < (NF + 1)) {
40                         i = 1
41                         len = length(array[word]) + 1
42                         while (i < len) {
43                                 printf "'%s',", substr(array[word],i,1)
44                                 i++
45                         }
46                         if (word < NF )
47                                 printf "' ',"
48                         word++
49                 }
50                 print  "0 };"
51         }
52 }
53 END {
54         print ""
55         print "static const error_info info[] = {"
56
57         i = 1 
58         while ( i <= lines) { 
59                 printf "    { %s, \"%s\", name%dW, description%dA, description%dW },\n", 
60                         names[i], names[i], i, i,i 
61                 i++
62         }
63
64         print "};"
65 }