#!/bin/sh # extracts various bits of data form OpenCL heder files, which are expected to # be in CL/ 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" # constants ( echo '// autogenerated by h_extract' cat $ALL_H | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)/' ) >constiv.h # constants that look like enum values ( echo '// autogenerated by h_extract' cat $ALL_H | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' ) >enumstr.h # error codes ( echo '// autogenerated by h_extract' echo "const_iv(SUCCESS)" cat $ALL_H | perl -ne 'print "const_iv($1)\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' ) >errstr.h # default constant values to -1 ( echo '// autogenerated by h_extract' cat constiv.h | perl -ne '/const_iv\((.*)\)/ or next; print "#ifndef CL_$1\n#define CL_$1 -1\n#endif\n"' ) | sort >default.h # *glGet*Info ( getinfo.txt