Changeset 2009 for libswish3/trunk/bindings
- Timestamp:
- 02/03/08 23:29:35 (1 year ago)
- Files:
-
- libswish3/trunk/bindings/perl/3.xs (modified) (19 diffs)
- libswish3/trunk/bindings/perl/Makefile.PL (modified) (1 diff)
- libswish3/trunk/bindings/perl/lib/SWISH/3/Xapian (deleted)
- libswish3/trunk/bindings/perl/ppport.h (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libswish3/trunk/bindings/perl/3.xs
r1933 r2009 42 42 /* some nice XS macros from KS - thanks Marvin! */ 43 43 #define START_SET_OR_GET_SWITCH \ 44 SV *RETVAL = &PL_sv_undef; \44 RETVAL = &PL_sv_undef; \ 45 45 /* if called as a setter, make sure the extra arg is there */ \ 46 46 if (ix % 2 == 1) { \ … … 178 178 179 179 /* make a Perl blessed object from a C pointer */ 180 static SV * sp_ptr_to_object( char* CLASS, IV data)180 static SV * sp_ptr_to_object( char* CLASS, IV c_ptr ) 181 181 { 182 182 dTHX; 183 183 SV* obj = sv_newmortal(); 184 sv_setref_pv(obj, CLASS, (void*) data);184 sv_setref_pv(obj, CLASS, (void*)c_ptr); 185 185 return obj; 186 186 } … … 212 212 static void sp_dump_hash(SV* hash_ref) 213 213 { 214 HV* hash;215 HE* hash_entry;216 int num_keys, i;217 SV* sv_key;218 SV* sv_val;219 int refcnt;220 221 if (SvTYPE(SvRV(hash_ref))!=SVt_PVHV)222 croak("hash_ref is not a hash reference");223 224 hash= (HV*)SvRV(hash_ref);225 num_keys= hv_iterinit(hash);226 for (i = 0; i < num_keys; i++) {227 hash_entry= hv_iternext(hash);228 sv_key= hv_iterkeysv(hash_entry);229 sv_val= hv_iterval(hash, hash_entry);230 refcnt= SvREFCNT(sv_val);231 warn("%s => %s [%d]\n", SvPV(sv_key, PL_na), SvPV(sv_val, PL_na), refcnt);232 }233 return;214 HV* hash; 215 HE* hash_entry; 216 int num_keys, i; 217 SV* sv_key; 218 SV* sv_val; 219 int refcnt; 220 221 if (SvTYPE(SvRV(hash_ref))!=SVt_PVHV) 222 croak("hash_ref is not a hash reference"); 223 224 hash = (HV*)SvRV(hash_ref); 225 num_keys = hv_iterinit(hash); 226 for (i = 0; i < num_keys; i++) { 227 hash_entry = hv_iternext(hash); 228 sv_key = hv_iterkeysv(hash_entry); 229 sv_val = hv_iterval(hash, hash_entry); 230 refcnt = SvREFCNT(sv_val); 231 warn("%s => %s [%d]\n", SvPV(sv_key, PL_na), SvPV(sv_val, PL_na), refcnt); 232 } 233 return; 234 234 } 235 235 … … 237 237 { 238 238 dTHX; 239 char * str; 240 239 241 warn("describing object\n"); 240 char *str = SvPV( object, PL_na );242 str = SvPV( object, PL_na ); 241 243 if (SvROK(object)) 242 244 { … … 273 275 static char * sp_which_class( char * c ) 274 276 { 275 dTHX; 277 dTHX; 278 SV** sv; 279 276 280 if (SubClasses == (HV*)NULL) 277 281 sp_make_subclasses(DEFAULT_BASE_CLASS); 278 279 SV**sv = hv_fetch( SubClasses, c, strlen(c), 0 );282 283 sv = hv_fetch( SubClasses, c, strlen(c), 0 ); 280 284 if ( !sv ) 281 285 croak("could not fetch %s class from SubClasses", c); … … 303 307 { 304 308 dTHX; 305 hv_store(perl_hash, key, strlen(key), newSVpvn(val, strlen(val)), 0); 309 hv_store( perl_hash, 310 (char*)key, 311 strlen((char*)key), 312 newSVpvn((char*)val, strlen((char*)val)), 313 0); 306 314 } 307 315 … … 321 329 { 322 330 dTHX; 323 av_push(mykeys, newSVpvn( key, strlen(key)));331 av_push(mykeys, newSVpvn((char*)key, strlen((char*)key))); 324 332 } 325 333 … … 345 353 346 354 /* analogous to @strings = split(/SWISH_META_CONNECTOR/, str) */ 347 while((tmp = xmlStrstr(str, SWISH_META_CONNECTOR)) != NULL)355 while((tmp = xmlStrstr(str, (xmlChar*)SWISH_META_CONNECTOR)) != NULL) 348 356 { 349 357 len = tmp - str; 350 358 if(len) 351 av_push(strings, newSVpvn( str, len));359 av_push(strings, newSVpvn((char*)str, len)); 352 360 353 361 str = tmp + bump; /* move the pointer up */ … … 356 364 /* if there was only one string, make sure it's in array */ 357 365 if (xmlBufferLength(buf) && av_len(strings) == -1) 358 av_push(strings, newSVpvn(xmlBufferContent(buf), xmlBufferLength(buf))); 359 360 hv_store(phash, key, strlen(key), (void*)newRV_inc((SV*)strings), 0); 366 { 367 av_push(strings, 368 newSVpvn((char*)xmlBufferContent(buf), 369 xmlBufferLength(buf))); 370 } 371 372 hv_store(phash, 373 (char*)key, 374 strlen((char*)key), 375 (void*)newRV_inc((SV*)strings), 376 0); 361 377 } 362 378 … … 379 395 swish_debug_docinfo( parse_data->docinfo ); 380 396 swish_debug_wordlist( parse_data->wordlist ); 381 swish_debug_nb( parse_data->properties, "Property" );382 swish_debug_nb( parse_data->metanames, "MetaName" );397 swish_debug_nb( parse_data->properties, (xmlChar*)"Property" ); 398 swish_debug_nb( parse_data->metanames, (xmlChar*)"MetaName" ); 383 399 warn("\n"); 384 400 } … … 414 430 dTHX; 415 431 unsigned int wpos, offset, num_code_points; 432 MAGIC *mg; 433 REGEXP *rx; 434 SV *wrapper; 435 xmlChar *str_start; 436 int str_len; 437 xmlChar *str_end; 416 438 xmlChar *meta, *ctxt; 417 439 SV *token_re; … … 426 448 va_end(args); 427 449 428 MAGIC *mg = NULL; 429 REGEXP *rx = NULL; 430 SV *wrapper = sv_newmortal(); 431 xmlChar *str_start = str; 432 int str_len = strlen((char*)str); 433 xmlChar *str_end = str_start + str_len; 434 450 mg = NULL; 451 rx = NULL; 452 wrapper = sv_newmortal(); 453 str_start = str; 454 str_len = strlen((char*)str); 455 str_end = str_start + str_len; 435 456 token_re = analyzer->regex; 436 457 token_handler = analyzer->stash; … … 453 474 454 475 /* wrap the string in an SV to please the regex engine */ 455 SvPVX(wrapper) = str_start;476 SvPVX(wrapper) = (char*)str_start; 456 477 SvCUR_set(wrapper, str_len); 457 478 SvPOK_on(wrapper); … … 460 481 num_code_points = 0; 461 482 462 while ( pregexec(rx, str, str_end,str, 1, wrapper, 1) )483 while ( pregexec(rx, (char*)str, (char*)str_end, (char*)str, 1, wrapper, 1) ) 463 484 { 464 485 xmlChar * start_ptr = str + rx->startp[0]; … … 796 817 swish_Analyzer * ana; 797 818 char * skey; 819 SV *RETVAL; 798 820 PPCODE: 799 821 { … … 1352 1374 PREINIT: 1353 1375 char * CLASS; 1354 xmlChar * metaname = SWISH_DEFAULT_METANAME;1355 xmlChar * context = SWISH_DEFAULT_METANAME;1376 xmlChar * metaname = (xmlChar*)SWISH_DEFAULT_METANAME; 1377 xmlChar * context = (xmlChar*)SWISH_DEFAULT_METANAME; 1356 1378 unsigned int word_pos = 0; 1357 1379 unsigned int offset = 0; 1358 xmlChar * buf = SvPV(str, PL_na);1380 xmlChar * buf = (xmlChar*)SvPV(str, PL_na); 1359 1381 1360 1382 CODE: … … 1377 1399 1378 1400 if ( items > 4 ) 1379 metaname = SvPV(ST(4), PL_na);1401 metaname = (xmlChar*)SvPV(ST(4), PL_na); 1380 1402 1381 1403 if ( items > 5 ) 1382 context = SvPV(ST(5), PL_na);1404 context = (xmlChar*)SvPV(ST(5), PL_na); 1383 1405 1384 1406 } … … 1412 1434 PREINIT: 1413 1435 char * CLASS; 1414 xmlChar * metaname = SWISH_DEFAULT_METANAME;1415 xmlChar * context = SWISH_DEFAULT_METANAME;1436 xmlChar * metaname = (xmlChar*)SWISH_DEFAULT_METANAME; 1437 xmlChar * context = (xmlChar*)SWISH_DEFAULT_METANAME; 1416 1438 unsigned int word_pos = 0; 1417 1439 unsigned int offset = 0; 1418 xmlChar * buf = SvPV(str, PL_na);1440 xmlChar * buf = (xmlChar*)SvPV(str, PL_na); 1419 1441 1420 1442 CODE: … … 1437 1459 1438 1460 if ( items > 4 ) 1439 metaname = SvPV(ST(4), PL_na);1461 metaname = (xmlChar*)SvPV(ST(4), PL_na); 1440 1462 1441 1463 if ( items > 5 ) 1442 context = SvPV(ST(5), PL_na);1464 context = (xmlChar*)SvPV(ST(5), PL_na); 1443 1465 1444 1466 } libswish3/trunk/bindings/perl/Makefile.PL
r1920 r2009 9 9 (ABSTRACT_FROM => 'lib/SWISH/3.pm', 10 10 AUTHOR => 'Peter Karman <perl@peknet.com>') : ()), 11 LIBS => ['-L/ opt/local/lib -L/usr/local/lib -lswish3 -lxml2'],11 LIBS => ['-L/usr/lib -L/usr/local/lib -lswish3 -lxml2'], 12 12 DEFINE => '', # e.g., '-DHAVE_SOMETHING' 13 INC => '-I/ opt/local/include/libxml2 -I/usr/local/include/libxml2 -I.',13 INC => '-I/usr/include -I/usr/local/include -I/usr/include/libxml2 -I/usr/local/include/libxml2 -I.', 14 14 # Un-comment this if you add C files to link with later: 15 15 # OBJECT => '$(O_FILES)', # link all the C files too libswish3/trunk/bindings/perl/ppport.h
r1914 r2009 5 5 ---------------------------------------------------------------------- 6 6 7 ppport.h -- Perl/Pollution/Portability Version 3.0 37 ppport.h -- Perl/Pollution/Portability Version 3.06 8 8 9 9 Automatically created by Devel::PPPort running under 10 perl 5.00 8006 on Tue Jul 11 09:34:09 2006.10 perl 5.009003 on Fri May 20 22:14:30 2005. 11 11 12 12 Do NOT edit this file directly! -- Edit PPPort_pm.PL and the … … 23 23 =head1 NAME 24 24 25 ppport.h - Perl/Pollution/Portability version 3.0 325 ppport.h - Perl/Pollution/Portability version 3.06 26 26 27 27 =head1 SYNOPSIS … … 45 45 --list-provided list provided API 46 46 --list-unsupported list unsupported API 47 --api-info=name show Perl API portability information 47 48 48 49 =head1 COMPATIBILITY … … 124 125 F<ppport.h> and below which version of Perl they probably 125 126 won't be available or work. 127 128 =head2 --api-info=I<name> 129 130 Show portability information for API elements matching I<name>. 131 If I<name> is surrounded by slashes, it is interpreted as a regular 132 expression. 126 133 127 134 =head1 DESCRIPTION … … 239 246 This would output context diffs with 10 lines of context. 240 247 248 To display portability information for the C<newSVpvn> function, 249 use: 250 251 perl ppport.h --api-info=newSVpvn 252 253 Since the argument to C<--api-info> can be a regular expression, 254 you can use 255 256 perl ppport.h --api-info=/_nomg$/ 257 258 to display portability information for all C<_nomg> functions or 259 260 perl ppport.h --api-info=/./ 261 262 to display information for all known API elements. 263 241 264 =head1 BUGS 242 265 … … 281 304 =head1 COPYRIGHT 282 305 283 Version 3.x, Copyright (c) 2004 , Marcus Holland-Moritz.306 Version 3.x, Copyright (c) 2004-2005, Marcus Holland-Moritz. 284 307 285 308 Version 2.x, Copyright (C) 2001, Paul Marquess. … … 315 338 help quiet diag! hints! changes! cplusplus 316 339 patch=s copy=s diff=s compat-version=s 317 list-provided list-unsupported 340 list-provided list-unsupported api-info=s 318 341 )) or usage(); 319 342 }; … … 750 773 UVuf|5.006000||p 751 774 UVxf|5.006000||p 775 XCPT_CATCH|5.009002||p 776 XCPT_RETHROW|5.009002||p 777 XCPT_TRY_END|5.009002||p 778 XCPT_TRY_START|5.009002||p 752 779 XPUSHi||| 753 780 XPUSHmortal|5.009002||p … … 880 907 dTHX|5.006000||p 881 908 dUNDERBAR|5.009002||p 909 dXCPT|5.009002||p 882 910 dXSARGS||| 883 911 dXSI32||| 912 dXSTARG|5.006000||p 884 913 deb_curcv||| 885 914 deb_nocontext|||vn … … 892 921 debstack||5.007003| 893 922 deb||5.007003|v 894 default_protect|||v895 923 del_he||| 896 924 del_sv||| … … 1071 1099 gv_fetchmethod||| 1072 1100 gv_fetchmeth||| 1101 gv_fetchpvn_flags||5.009002| 1073 1102 gv_fetchpv||| 1103 gv_fetchsv||5.009002| 1074 1104 gv_fullname3||5.004000| 1075 1105 gv_fullname4||5.006001| … … 1147 1177 isUPPER||| 1148 1178 is_an_int||| 1179 is_gv_magical_sv||| 1149 1180 is_gv_magical||| 1150 1181 is_handle_constructor||| … … 1469 1500 op_free||| 1470 1501 op_null||5.007002| 1502 op_refcnt_lock||5.009002| 1503 op_refcnt_unlock||5.009002| 1471 1504 open_script||| 1472 1505 pMY_CXT_|5.007003||p … … 1646 1679 savestack_grow_cnt||5.008001| 1647 1680 savestack_grow||| 1681 savesvpv||5.009002| 1648 1682 sawparens||| 1649 1683 scalar_mod_type||| … … 1911 1945 uvuni_to_utf8||5.007001| 1912 1946 validate_suid||| 1913 vcall_body|||1914 vcall_list_body|||1915 1947 vcmp||5.009000| 1916 1948 vcroak||5.006000| 1917 1949 vdeb||5.007003| 1918 vdefault_protect|||1919 1950 vdie||| 1920 vdocatch_body|||1921 1951 vform||5.006000| 1922 1952 visit||| … … 1928 1958 vnormal||5.009002| 1929 1959 vnumify||5.009000| 1930 vparse_body|||1931 vrun_body|||1932 1960 vstringify||5.009000| 1933 1961 vwarner||5.006000| … … 1984 2012 1985 2013 $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; 2014 } 2015 2016 if (exists $opt{'api-info'}) { 2017 my $f; 2018 my $count = 0; 2019 my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; 2020 for $f (sort { lc $a cmp lc $b } keys %API) { 2021 next unless $f =~ /$match/; 2022 print "\n=== $f ===\n\n"; 2023 my $info = 0; 2024 if ($API{$f}{base} || $API{$f}{todo}) { 2025 my $base = format_version($API{$f}{base} || $API{$f}{todo}); 2026 print "Supported at least starting from perl-$base.\n"; 2027 $info++; 2028 } 2029 if ($API{$f}{provided}) { 2030 my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; 2031 print "Support by $ppport provided back to perl-$todo.\n"; 2032 print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; 2033 print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; 2034 print "$hints{$f}" if exists $hints{$f}; 2035 $info++; 2036 } 2037 unless ($info) { 2038 print "No portability information available.\n"; 2039 } 2040 $count++; 2041 } 2042 if ($count > 0) { 2043 print "\n"; 2044 } 2045 else { 2046 print "Found no API matching '$opt{'api-info'}'.\n"; 2047 } 2048 exit 0; 1986 2049 } 1987 2050 … … 2970 3033 #endif 2971 3034 2972 #ifdef HASATTRIBUTE 2973 # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) 3035 #ifndef PERL_UNUSED_DECL 3036 # ifdef HASATTRIBUTE 3037 # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) 3038 # define PERL_UNUSED_DECL 3039 # else 3040 # define PERL_UNUSED_DECL __attribute__((unused)) 3041 # endif 3042 # else 2974 3043 # define PERL_UNUSED_DECL 2975 # else2976 # define PERL_UNUSED_DECL __attribute__((unused))2977 3044 # endif 2978 #else2979 # define PERL_UNUSED_DECL2980 3045 #endif 2981 3046 #ifndef NOOP … … 3165 3230 #ifndef dITEMS 3166 3231 # define dITEMS I32 items = SP - MARK 3232 #endif 3233 #ifndef dXSTARG 3234 # define dXSTARG SV * targ = sv_newmortal() 3167 3235 #endif 3168 3236 #ifndef dTHR … … 3620 3688 #endif 3621 3689 3622 /* Hint: sv_pvn 3690 /* Hint: sv_pvn_force 3623 3691 * Always use the SvPV_force() macro instead of sv_pvn_force(). 3624 3692 */ … … 4808 4876 #endif 4809 4877 4878 #ifdef NO_XSLOCKS 4879 # ifdef dJMPENV 4880 # define dXCPT dJMPENV; int rEtV = 0 4881 # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) 4882 # define XCPT_TRY_END JMPENV_POP; 4883 # define XCPT_CATCH if (rEtV != 0) 4884 # define XCPT_RETHROW JMPENV_JUMP(rEtV) 4885 # else 4886 # define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 4887 # define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) 4888 # define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); 4889 # define XCPT_CATCH if (rEtV != 0) 4890 # define XCPT_RETHROW Siglongjmp(top_env, rEtV) 4891 # endif 4892 #endif 4893 4810 4894 #endif /* _P_P_PORTABILITY_H_ */ 4811 4895
