| 1 | #include "EXTERN.h" | ||
| 2 | #include "perl.h" | ||
| 3 | #include "XSUB.h" | ||
| 4 | |||
| 5 | |||
| 6 | #include "keyboardDistance.h" | ||
| 7 | |||
| 8 | static int | ||
| 9 | 0 | not_here(char *s) | |
| 10 | { | ||
| 11 | 0 | croak("%s not implemented on this architecture", s); | |
| 12 | return -1; | ||
| 13 | } | ||
| 14 | |||
| 15 | static double | ||
| 16 | 0 | constant(char *name, int len, int arg) | |
| 17 | { | ||
| 18 | 0 | errno = EINVAL; | |
| 19 | 0 | return 0; | |
| 20 | } | ||
| 21 | |||
| 22 | MODULE = String::KeyboardDistanceXS PACKAGE = String::KeyboardDistanceXS | ||
| 23 | |||
| 24 | |||
| 25 | double | ||
| 26 | constant(sv,arg) | ||
| 27 | PREINIT: | ||
| 28 | STRLEN len; | ||
| 29 | INPUT: | ||
| 30 | SV * sv | ||
| 31 | char * s = SvPV(sv, len); | ||
| 32 | int arg | ||
| 33 | CODE: | ||
| 34 | 0 | RETVAL = constant(s,len,arg); | |
| 35 | OUTPUT: | ||
| 36 | RETVAL | ||
| 37 | |||
| 38 | double | ||
| 39 | qwertyKeyboardDistance(left,right) | ||
| 40 | PREINIT: | ||
| 41 | STRLEN llen; | ||
| 42 | STRLEN rlen; | ||
| 43 | INPUT: | ||
| 44 | SV* left | ||
| 45 | SV* right | ||
| 46 | char* pleft = SvPV(left, llen); | ||
| 47 | char* pright = SvPV(right,rlen); | ||
| 48 | CODE: | ||
| 49 | 5 | RETVAL = c_qwertyKeyboardDistance( pleft, llen, pright, rlen ); | |
| 50 | OUTPUT: | ||
| 51 | RETVAL | ||
| 52 | |||
| 53 | double | ||
| 54 | qwertyKeyboardDistanceMatch(left,right) | ||
| 55 | PREINIT: | ||
| 56 | STRLEN llen; | ||
| 57 | STRLEN rlen; | ||
| 58 | INPUT: | ||
| 59 | SV* left | ||
| 60 | SV* right | ||
| 61 | char* pleft = SvPV(left, llen); | ||
| 62 | char* pright = SvPV(right,rlen); | ||
| 63 | CODE: | ||
| 64 | 5 | RETVAL = c_qwertyKeyboardDistanceMatch( pleft, llen, pright, rlen ); | |
| 65 | OUTPUT: | ||
| 66 | RETVAL | ||
| 67 | |||
| 68 | int | ||
| 69 | initQwertyMap() | ||
| 70 | CODE: | ||
| 71 | 1 | RETVAL = c_initQwertyMap(); | |
| 72 | OUTPUT: | ||
| 73 | RETVAL | ||
| 74 |