dplayx: GetSPPlayerData was releasing the memory we were going to use
[wine/gsoc_dplay.git] / dlls / dxerr8 / errors.awk
blob0a785371920e038bc5bb78d5408969d3d1468b83
1 BEGIN {
2 print "/* Machine generated. Do not edit. */"
3 print ""
4 lines = 0
6 {
7 split($0, array, FS)
9 if (NF > 0 && length(array[1]) > 0) {
10 lines++
12 # save the first word (or '&' separated list of words) in the names array
13 if (array[2] == "&") {
14 if (array[4] == "&") {
15 names[lines] = array[1] " " array[2] " " array[3] " " array[4] " " array[5]
16 start = 6
17 } else {
18 names[lines] = array[1] " " array[2] " " array[3]
19 start = 4
21 } else {
22 names[lines] = array[1]
23 start = 2
26 # create the WCHAR version of the name
27 printf "static const WCHAR name%dW[] = { ", lines
28 i = 1
29 len = length(names[lines]) + 1
30 while (i < len) {
31 printf "'%s',", substr(names[lines],i,1)
32 i++
34 print "0 };"
36 # create the CHAR version of the description
37 printf "static const CHAR description%dA[] = \"", lines
38 word = start
39 while (word < (NF + 1)) {
40 printf "%s", array[word]
41 if (word < NF )
42 printf " "
43 word++
45 print "\";"
47 # create the WCHAR version of the description
48 printf "static const WCHAR description%dW[] = { ", lines
49 word = start
50 while (word < (NF + 1)) {
51 i = 1
52 len = length(array[word]) + 1
53 while (i < len) {
54 if (substr(array[word],i,1) == "'")
55 printf "'\\'',"
56 else
57 printf "'%s',", substr(array[word],i,1)
58 i++
60 if (word < NF )
61 printf "' ',"
62 word++
64 print "0 };"
67 END {
68 print ""
69 print "static const error_info info[] = {"
71 i = 1
72 while ( i <= lines) {
73 split(names[i], words, FS)
74 printf " { %s, \"%s\", name%dW, description%dA, description%dW },\n",
75 words[1], names[i], i, i,i
76 i++
79 print "};"