1 | #!/bin/sh |
1 | #!/bin/sh |
2 | |
2 | |
3 | # extracts various bits of data form OpenCL heder files, which are expected to |
3 | # extracts various bits of data form OpenCL heder files, which are expected to |
4 | # be in CL/ |
4 | # be in CL/ |
5 | |
5 | |
|
|
6 | ALL_H="CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL11/cl_d3d9.h CL/cl_d3d10.h CL12/cl_d3d11.h CL/cl_dx9_media_sharing.h" |
|
|
7 | |
6 | # constants |
8 | # constants |
7 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
9 | ( |
8 | perl -ne 'print "#ifdef CL_$1\nconst_iv($1)\n#endif\n" if /^#define CL_(\S+)/' >constiv.h |
10 | echo '// autogenerated by h_extract' |
|
|
11 | cat $ALL_H | |
|
|
12 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)/' |
|
|
13 | ) | sort >constiv.h |
9 | |
14 | |
10 | # constants that look like enum values |
15 | # constants that look like enum values |
11 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
16 | ( |
|
|
17 | echo '// autogenerated by h_extract' |
|
|
18 | cat $ALL_H | |
12 | perl -ne 'print "#ifdef CL_$1\nconst_iv($1)\n#endif\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' >enumstr.h |
19 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' |
|
|
20 | ) | sort >enumstr.h |
|
|
21 | |
|
|
22 | # error codes |
|
|
23 | ( |
|
|
24 | echo '// autogenerated by h_extract' |
|
|
25 | echo "const_iv(SUCCESS)" |
|
|
26 | cat $ALL_H | |
|
|
27 | perl -ne 'print "const_iv($1)\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' |
|
|
28 | ) | sort >errstr.h |
|
|
29 | |
|
|
30 | # default constant values to -1 |
|
|
31 | ( |
|
|
32 | echo '// autogenerated by h_extract' |
|
|
33 | cat constiv.h enumstr.h errstr.h | |
|
|
34 | perl -ne '/const_iv\((.*)\)/ or next; print "#ifndef CL_$1\n#define CL_$1 -1\n#endif\n"' |
|
|
35 | ) | sort >default.h |
13 | |
36 | |
14 | # *glGet*Info |
37 | # *glGet*Info |
15 | ( |
38 | ( |
16 | <CL/cl.hpp perl -ne 'print "$1\n" if /^\s*F\((.*)\)\s*\\?\s*$/' |
39 | <CL/cl.hpp perl -ne 'print "$1\n" if /^\s*F\((.*)\)\s*\\?\s*$/' |
17 | # DEVICE_DOUBLE_FP_CONFIG |
40 | # DEVICE_DOUBLE_FP_CONFIG |
… | |
… | |
35 | cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier |
58 | cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier |
36 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS |
59 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS |
37 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier |
60 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier |
38 | cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS |
61 | cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS |
39 | EOF |
62 | EOF |
40 | ) >getinfo.txt |
63 | ) | sort >getinfo.txt |
41 | |
64 | |
42 | # error codes |
|
|
43 | ( |
|
|
44 | echo "const_iv(SUCCESS)" |
|
|
45 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
|
|
46 | perl -ne 'print "#ifdef CL_$1\nconst_iv($1)\n#endif\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' |
|
|
47 | ) >errstr.h |
|
|
48 | |
|
|