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

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.52 by root, Tue Apr 24 23:53:12 2012 UTC vs.
Revision 1.53 by root, Wed Apr 25 00:02:25 2012 UTC

270/* they can be upgraded at runtime to the array form */ 270/* they can be upgraded at runtime to the array form */
271static void * 271static void *
272SvCLOBJ (const char *func, const char *svname, SV *sv, const char *pkg) 272SvCLOBJ (const char *func, const char *svname, SV *sv, const char *pkg)
273{ 273{
274 if (SvROK (sv) && sv_derived_from (sv, pkg)) 274 if (SvROK (sv) && sv_derived_from (sv, pkg))
275 {
276 SV *rv = SvRV (sv);
277
278#if CLOBJ_PUSH
279 if (SvTYPE (rv) == SVt_PVAV)
280 rv = AvARRAY (rv)[0];
281#endif
282
283 return (void *)SvIV (rv); 275 return (void *)SvIV (SvRV (sv));
284 }
285 276
286 croak ("%s: %s is not of type %s", func, svname, pkg); 277 croak ("%s: %s is not of type %s", func, svname, pkg);
287} 278}
288
289#if CLOBJ_PUSH
290
291static void
292CLOBJ_push (SV *self, SV *data)
293{
294 SV *rv = SvRV (self);
295
296 if (SvTYPE (rv) != SVt_PVAV)
297 {
298 AV *av = newAV ();
299 av_push (av, rv);
300 rv = (SV *)av;
301 SvRV_set (self, rv);
302 }
303
304 av_push ((AV *)rv, data);
305}
306
307static SV *
308sv_struct (STRLEN size)
309{
310 SV *sv = newSV (size);
311 SvPOK_only (sv);
312 return sv;
313}
314
315static void *
316CLOBJ_push_struct (SV *self, STRLEN size)
317{
318 SV *sv = sv_struct (size);
319 CLOBJ_push (self, sv);
320 return SvPVX (sv);
321}
322
323#endif
324 279
325/*****************************************************************************/ 280/*****************************************************************************/
326/* callback stuff */ 281/* callback stuff */
327 282
328/* default context callback, log to stderr */ 283/* default context callback, log to stderr */
386 341
387 X_UNLOCK (eq_lock); 342 X_UNLOCK (eq_lock);
388 343
389 return res; 344 return res;
390} 345}
391
392#if 0
393static void
394mem_free (pTHX_ void *p)
395{
396 free (p);
397}
398//SAVEDESTRUCTOR_X (mem_free, item);
399#endif
400 346
401static void 347static void
402eq_poll (void) 348eq_poll (void)
403{ 349{
404 eq_item *item; 350 eq_item *item;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines