jscript: Return 'unknown' in typeof operator for native object's values that can...
[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 (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 
20                         }
21                 } else {
22                         names[lines] = array[1] 
23                         start = 2
24                 }
25
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++
33                 }
34                 print  "0 };"
35         
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++
44                 }
45                 print  "\";"
46         
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++
59                         }
60                         if (word < NF )
61                                 printf "' ',"
62                         word++
63                 }
64                 print  "0 };"
65         }
66 }
67 END {
68         print ""
69         print "static const error_info info[] = {"
70
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++
77         }
78
79         print "};"
80 }