… | |
… | |
469 | |
469 | |
470 | case DT_STRING: |
470 | case DT_STRING: |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
472 | break; |
472 | break; |
473 | |
473 | |
|
|
474 | case DT_STRING_LEN: |
|
|
475 | { |
|
|
476 | char *str = va_arg (ap, char *); |
|
|
477 | int len = va_arg (ap, int); |
|
|
478 | |
|
|
479 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
|
|
480 | } |
|
|
481 | break; |
|
|
482 | |
|
|
483 | case DT_XEVENT: |
|
|
484 | { |
|
|
485 | XEvent *xe = va_arg (ap, XEvent *); |
|
|
486 | HV *hv = newHV (); |
|
|
487 | |
|
|
488 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
|
|
489 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
|
|
490 | # undef set |
|
|
491 | |
|
|
492 | setiv (type, xe->type); |
|
|
493 | setiv (send_event, xe->xany.send_event); |
|
|
494 | setiv (serial, xe->xany.serial); |
|
|
495 | |
|
|
496 | switch (xe->type) |
|
|
497 | { |
|
|
498 | case KeyPress: |
|
|
499 | case KeyRelease: |
|
|
500 | case ButtonPress: |
|
|
501 | case ButtonRelease: |
|
|
502 | case MotionNotify: |
|
|
503 | setiv (time, xe->xmotion.time); |
|
|
504 | setiv (x, xe->xmotion.x); |
|
|
505 | setiv (y, xe->xmotion.y); |
|
|
506 | setiv (x_root, xe->xmotion.x_root); |
|
|
507 | setiv (y_root, xe->xmotion.y_root); |
|
|
508 | setiv (state, xe->xmotion.state); |
|
|
509 | break; |
|
|
510 | } |
|
|
511 | |
|
|
512 | switch (xe->type) |
|
|
513 | { |
|
|
514 | case KeyPress: |
|
|
515 | case KeyRelease: |
|
|
516 | setiv (keycode, xe->xkey.keycode); |
|
|
517 | break; |
|
|
518 | |
|
|
519 | case ButtonPress: |
|
|
520 | case ButtonRelease: |
|
|
521 | setiv (button, xe->xbutton.button); |
|
|
522 | break; |
|
|
523 | |
|
|
524 | case MotionNotify: |
|
|
525 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
526 | break; |
|
|
527 | } |
|
|
528 | |
|
|
529 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
530 | } |
|
|
531 | break; |
|
|
532 | |
474 | case DT_USTRING_LEN: |
533 | case DT_USTRING_LEN: |
475 | { |
534 | { |
476 | unicode_t *ustr = va_arg (ap, unicode_t *); |
535 | unicode_t *ustr = va_arg (ap, unicode_t *); |
477 | int ulen = va_arg (ap, int); |
536 | int ulen = va_arg (ap, int); |
478 | wchar_t *wstr = new wchar_t [ulen]; |
537 | wchar_t *wstr = new wchar_t [ulen]; |