ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.xs
(Generate patch)

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.75 by root, Sat May 5 14:18:35 2012 UTC vs.
Revision 1.76 by root, Sat May 5 14:49:52 2012 UTC

192 IV iv; 192 IV iv;
193 const char *name; 193 const char *name;
194 #define const_iv(name) { (IV)CL_ ## name, # name }, 194 #define const_iv(name) { (IV)CL_ ## name, # name },
195} ivstr; 195} ivstr;
196 196
197typedef struct
198{
199 NV nv;
200 const char *name;
201 #define const_nv(name) { (NV)CL_ ## name, # name },
202} nvstr;
203
197static const char * 204static const char *
198iv2str (IV value, const ivstr *base, int count, const char *fallback) 205iv2str (IV value, const ivstr *base, int count, const char *fallback)
199{ 206{
200 int i; 207 int i;
201 static char strbuf [32]; 208 static char strbuf [32];
795 eq_signal_arg = (void*)arg; 802 eq_signal_arg = (void*)arg;
796 803
797BOOT: 804BOOT:
798{ 805{
799 HV *stash = gv_stashpv ("OpenCL", 1); 806 HV *stash = gv_stashpv ("OpenCL", 1);
807
800 static const ivstr *civ, const_iv[] = { 808 static const ivstr *civ, const_iv[] = {
801 { sizeof (cl_char ), "SIZEOF_CHAR" }, 809 { sizeof (cl_char ), "SIZEOF_CHAR" },
802 { sizeof (cl_uchar ), "SIZEOF_UCHAR" }, 810 { sizeof (cl_uchar ), "SIZEOF_UCHAR" },
803 { sizeof (cl_short ), "SIZEOF_SHORT" }, 811 { sizeof (cl_short ), "SIZEOF_SHORT" },
804 { sizeof (cl_ushort), "SIZEOF_USHORT" }, 812 { sizeof (cl_ushort), "SIZEOF_USHORT" },
813#include "constiv.h" 821#include "constiv.h"
814 }; 822 };
815 823
816 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) 824 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
817 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 825 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
826
827 static const nvstr *cnv, const_nv[] = {
828#include "constnv.h"
829 };
830
831 for (cnv = const_nv + sizeof (const_nv) / sizeof (const_nv [0]); cnv > const_nv; cnv--)
832 newCONSTSUB (stash, (char *)cnv[-1].name, newSVnv (cnv[-1].nv));
833
834 newCONSTSUB (stash, "NAN", newSVnv (CL_NAN)); // CL_NAN might be a function call
818 835
819 stash_platform = gv_stashpv ("OpenCL::Platform", GV_ADD); 836 stash_platform = gv_stashpv ("OpenCL::Platform", GV_ADD);
820 stash_device = gv_stashpv ("OpenCL::Device", GV_ADD); 837 stash_device = gv_stashpv ("OpenCL::Device", GV_ADD);
821 stash_subdevice = gv_stashpv ("OpenCL::SubDevice", GV_ADD); 838 stash_subdevice = gv_stashpv ("OpenCL::SubDevice", GV_ADD);
822 stash_context = gv_stashpv ("OpenCL::Context", GV_ADD); 839 stash_context = gv_stashpv ("OpenCL::Context", GV_ADD);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines