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 | ( |
9 | ( |
8 | echo '// autogenerated by h_extract' |
10 | echo '// autogenerated by h_extract' |
9 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
11 | cat $ALL_H | |
10 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)/' |
12 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)/' |
11 | ) >constiv.h |
13 | ) | sort >constiv.h |
12 | |
14 | |
13 | # constants that look like enum values |
15 | # constants that look like enum values |
14 | ( |
16 | ( |
15 | echo '// autogenerated by h_extract' |
17 | echo '// autogenerated by h_extract' |
16 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
18 | cat $ALL_H | |
17 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' |
19 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' |
18 | ) >enumstr.h |
20 | ) | sort >enumstr.h |
19 | |
21 | |
20 | # error codes |
22 | # error codes |
21 | ( |
23 | ( |
22 | echo '// autogenerated by h_extract' |
24 | echo '// autogenerated by h_extract' |
23 | echo "const_iv(SUCCESS)" |
25 | echo "const_iv(SUCCESS)" |
24 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
26 | cat $ALL_H | |
25 | perl -ne 'print "const_iv($1)\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' |
27 | perl -ne 'print "const_iv($1)\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' |
26 | ) >errstr.h |
28 | ) | sort >errstr.h |
27 | |
29 | |
28 | # default constant values to -1 |
30 | # default constant values to -1 |
29 | ( |
31 | ( |
30 | echo '// autogenerated by h_extract' |
32 | echo '// autogenerated by h_extract' |
31 | cat constiv.h enumstr.h errstr.h | |
33 | cat constiv.h enumstr.h errstr.h | |
32 | perl -ne '/const_iv\((.*)\)/ or next; print "#ifndef CL_$1\n#define CL_$1 -1\n#endif\n"' |
34 | perl -ne '/const_iv\((.*)\)/ or next; print "#ifndef CL_$1\n#define CL_$1 -1\n#endif\n"' |
33 | ) >default.h |
35 | ) | sort >default.h |
34 | |
36 | |
35 | # *glGet*Info |
37 | # *glGet*Info |
36 | ( |
38 | ( |
37 | <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*$/' |
38 | # DEVICE_DOUBLE_FP_CONFIG |
40 | # DEVICE_DOUBLE_FP_CONFIG |
… | |
… | |
56 | 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 |
57 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS |
59 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS |
58 | 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 |
59 | cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS |
61 | cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS |
60 | EOF |
62 | EOF |
61 | ) >getinfo.txt |
63 | ) | sort >getinfo.txt |
62 | |
64 | |