Show
Ignore:
Timestamp:
02/03/08 23:29:35 (1 year ago)
Author:
karpet
Message:

rename some vars for clarity

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libswish3/trunk/bindings/perl/3.xs

    r1933 r2009  
    4242/* some nice XS macros from KS - thanks Marvin! */ 
    4343#define START_SET_OR_GET_SWITCH \ 
    44     SV *RETVAL = &PL_sv_undef; \ 
     44    RETVAL = &PL_sv_undef; \ 
    4545    /* if called as a setter, make sure the extra arg is there */ \ 
    4646    if (ix % 2 == 1) { \ 
     
    178178 
    179179/* make a Perl blessed object from a C pointer */ 
    180 static SV * sp_ptr_to_object( char* CLASS, IV data
     180static SV * sp_ptr_to_object( char* CLASS, IV c_ptr
    181181{ 
    182182    dTHX; 
    183183    SV* obj = sv_newmortal(); 
    184     sv_setref_pv(obj, CLASS, (void*)data); 
     184    sv_setref_pv(obj, CLASS, (void*)c_ptr); 
    185185    return obj; 
    186186} 
     
    212212static void sp_dump_hash(SV* hash_ref)  
    213213{ 
    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; 
    234234} 
    235235 
     
    237237{ 
    238238    dTHX; 
     239    char * str; 
     240     
    239241    warn("describing object\n"); 
    240     char * str = SvPV( object, PL_na ); 
     242    str = SvPV( object, PL_na ); 
    241243    if (SvROK(object)) 
    242244    { 
     
    273275static char * sp_which_class( char * c ) 
    274276{ 
    275     dTHX; 
     277    dTHX;         
     278    SV** sv; 
     279 
    276280    if (SubClasses == (HV*)NULL) 
    277281        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 ); 
    280284    if ( !sv ) 
    281285        croak("could not fetch %s class from SubClasses", c); 
     
    303307{ 
    304308    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); 
    306314} 
    307315 
     
    321329{ 
    322330    dTHX; 
    323     av_push(mykeys, newSVpvn(key, strlen(key))); 
     331    av_push(mykeys, newSVpvn((char*)key, strlen((char*)key))); 
    324332} 
    325333 
     
    345353     
    346354    /* 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) 
    348356    { 
    349357        len = tmp - str; 
    350358        if(len) 
    351             av_push(strings, newSVpvn(str, len)); 
     359            av_push(strings, newSVpvn((char*)str, len)); 
    352360             
    353361        str = tmp + bump;  /* move the pointer up */ 
     
    356364    /* if there was only one string, make sure it's in array */ 
    357365    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); 
    361377} 
    362378 
     
    379395    swish_debug_docinfo( parse_data->docinfo ); 
    380396    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" ); 
    383399    warn("\n"); 
    384400} 
     
    414430    dTHX; 
    415431    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; 
    416438    xmlChar *meta, *ctxt; 
    417439    SV *token_re; 
     
    426448    va_end(args); 
    427449     
    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; 
    435456    token_re        = analyzer->regex; 
    436457    token_handler   = analyzer->stash; 
     
    453474     
    454475    /* wrap the string in an SV to please the regex engine */ 
    455     SvPVX(wrapper) = str_start; 
     476    SvPVX(wrapper) = (char*)str_start; 
    456477    SvCUR_set(wrapper, str_len); 
    457478    SvPOK_on(wrapper); 
     
    460481    num_code_points = 0; 
    461482     
    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) )  
    463484    { 
    464485        xmlChar * start_ptr = str + rx->startp[0]; 
     
    796817    swish_Analyzer * ana; 
    797818    char * skey; 
     819    SV *RETVAL; 
    798820PPCODE: 
    799821{ 
     
    13521374    PREINIT: 
    13531375        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; 
    13561378        unsigned int word_pos    = 0; 
    13571379        unsigned int offset      = 0; 
    1358         xmlChar * buf = SvPV(str, PL_na); 
     1380        xmlChar * buf = (xmlChar*)SvPV(str, PL_na); 
    13591381         
    13601382    CODE: 
     
    13771399                 
    13781400            if ( items > 4 ) 
    1379                 metaname = SvPV(ST(4), PL_na); 
     1401                metaname = (xmlChar*)SvPV(ST(4), PL_na); 
    13801402                 
    13811403            if ( items > 5 ) 
    1382                 context = SvPV(ST(5), PL_na); 
     1404                context = (xmlChar*)SvPV(ST(5), PL_na); 
    13831405                 
    13841406        } 
     
    14121434    PREINIT: 
    14131435        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; 
    14161438        unsigned int word_pos    = 0; 
    14171439        unsigned int offset      = 0; 
    1418         xmlChar * buf = SvPV(str, PL_na); 
     1440        xmlChar * buf = (xmlChar*)SvPV(str, PL_na); 
    14191441         
    14201442    CODE: 
     
    14371459                 
    14381460            if ( items > 4 ) 
    1439                 metaname = SvPV(ST(4), PL_na); 
     1461                metaname = (xmlChar*)SvPV(ST(4), PL_na); 
    14401462                 
    14411463            if ( items > 5 ) 
    1442                 context = SvPV(ST(5), PL_na); 
     1464                context = (xmlChar*)SvPV(ST(5), PL_na); 
    14431465                 
    14441466        } 
  • libswish3/trunk/bindings/perl/Makefile.PL

    r1920 r2009  
    99      (ABSTRACT_FROM  => 'lib/SWISH/3.pm', 
    1010       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'], 
    1212    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.', 
    1414        # Un-comment this if you add C files to link with later: 
    1515    # OBJECT            => '$(O_FILES)', # link all the C files too 
  • libswish3/trunk/bindings/perl/ppport.h

    r1914 r2009  
    55---------------------------------------------------------------------- 
    66 
    7     ppport.h -- Perl/Pollution/Portability Version 3.03  
     7    ppport.h -- Perl/Pollution/Portability Version 3.06  
    88    
    99    Automatically created by Devel::PPPort running under 
    10     perl 5.008006 on Tue Jul 11 09:34:09 2006
     10    perl 5.009003 on Fri May 20 22:14:30 2005
    1111     
    1212    Do NOT edit this file directly! -- Edit PPPort_pm.PL and the 
     
    2323=head1 NAME 
    2424 
    25 ppport.h - Perl/Pollution/Portability version 3.03 
     25ppport.h - Perl/Pollution/Portability version 3.06 
    2626 
    2727=head1 SYNOPSIS 
     
    4545  --list-provided             list provided API 
    4646  --list-unsupported          list unsupported API 
     47  --api-info=name             show Perl API portability information 
    4748 
    4849=head1 COMPATIBILITY 
     
    124125F<ppport.h> and below which version of Perl they probably 
    125126won't be available or work. 
     127 
     128=head2 --api-info=I<name> 
     129 
     130Show portability information for API elements matching I<name>. 
     131If I<name> is surrounded by slashes, it is interpreted as a regular 
     132expression. 
    126133 
    127134=head1 DESCRIPTION 
     
    239246This would output context diffs with 10 lines of context. 
    240247 
     248To display portability information for the C<newSVpvn> function, 
     249use: 
     250 
     251    perl ppport.h --api-info=newSVpvn 
     252 
     253Since the argument to C<--api-info> can be a regular expression, 
     254you can use 
     255 
     256    perl ppport.h --api-info=/_nomg$/ 
     257 
     258to display portability information for all C<_nomg> functions or 
     259 
     260    perl ppport.h --api-info=/./ 
     261 
     262to display information for all known API elements. 
     263 
    241264=head1 BUGS 
    242265 
     
    281304=head1 COPYRIGHT 
    282305 
    283 Version 3.x, Copyright (c) 2004, Marcus Holland-Moritz. 
     306Version 3.x, Copyright (c) 2004-2005, Marcus Holland-Moritz. 
    284307 
    285308Version 2.x, Copyright (C) 2001, Paul Marquess. 
     
    315338    help quiet diag! hints! changes! cplusplus 
    316339    patch=s copy=s diff=s compat-version=s 
    317     list-provided list-unsupported 
     340    list-provided list-unsupported api-info=s 
    318341  )) or usage(); 
    319342}; 
     
    750773UVuf|5.006000||p 
    751774UVxf|5.006000||p 
     775XCPT_CATCH|5.009002||p 
     776XCPT_RETHROW|5.009002||p 
     777XCPT_TRY_END|5.009002||p 
     778XCPT_TRY_START|5.009002||p 
    752779XPUSHi||| 
    753780XPUSHmortal|5.009002||p 
     
    880907dTHX|5.006000||p 
    881908dUNDERBAR|5.009002||p 
     909dXCPT|5.009002||p 
    882910dXSARGS||| 
    883911dXSI32||| 
     912dXSTARG|5.006000||p 
    884913deb_curcv||| 
    885914deb_nocontext|||vn 
     
    892921debstack||5.007003| 
    893922deb||5.007003|v 
    894 default_protect|||v 
    895923del_he||| 
    896924del_sv||| 
     
    10711099gv_fetchmethod||| 
    10721100gv_fetchmeth||| 
     1101gv_fetchpvn_flags||5.009002| 
    10731102gv_fetchpv||| 
     1103gv_fetchsv||5.009002| 
    10741104gv_fullname3||5.004000| 
    10751105gv_fullname4||5.006001| 
     
    11471177isUPPER||| 
    11481178is_an_int||| 
     1179is_gv_magical_sv||| 
    11491180is_gv_magical||| 
    11501181is_handle_constructor||| 
     
    14691500op_free||| 
    14701501op_null||5.007002| 
     1502op_refcnt_lock||5.009002| 
     1503op_refcnt_unlock||5.009002| 
    14711504open_script||| 
    14721505pMY_CXT_|5.007003||p 
     
    16461679savestack_grow_cnt||5.008001| 
    16471680savestack_grow||| 
     1681savesvpv||5.009002| 
    16481682sawparens||| 
    16491683scalar_mod_type||| 
     
    19111945uvuni_to_utf8||5.007001| 
    19121946validate_suid||| 
    1913 vcall_body||| 
    1914 vcall_list_body||| 
    19151947vcmp||5.009000| 
    19161948vcroak||5.006000| 
    19171949vdeb||5.007003| 
    1918 vdefault_protect||| 
    19191950vdie||| 
    1920 vdocatch_body||| 
    19211951vform||5.006000| 
    19221952visit||| 
     
    19281958vnormal||5.009002| 
    19291959vnumify||5.009000| 
    1930 vparse_body||| 
    1931 vrun_body||| 
    19321960vstringify||5.009000| 
    19331961vwarner||5.006000| 
     
    19842012 
    19852013  $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; 
     2014} 
     2015 
     2016if (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; 
    19862049} 
    19872050 
     
    29703033#endif 
    29713034 
    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 
    29743043#    define PERL_UNUSED_DECL 
    2975 #  else 
    2976 #    define PERL_UNUSED_DECL __attribute__((unused)) 
    29773044#  endif 
    2978 #else 
    2979 #  define PERL_UNUSED_DECL 
    29803045#endif 
    29813046#ifndef NOOP 
     
    31653230#ifndef dITEMS 
    31663231#  define dITEMS                         I32 items = SP - MARK 
     3232#endif 
     3233#ifndef dXSTARG 
     3234#  define dXSTARG                        SV * targ = sv_newmortal() 
    31673235#endif 
    31683236#ifndef dTHR 
     
    36203688#endif 
    36213689 
    3622 /* Hint: sv_pvn 
     3690/* Hint: sv_pvn_force 
    36233691 * Always use the SvPV_force() macro instead of sv_pvn_force(). 
    36243692 */ 
     
    48084876#endif 
    48094877 
     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 
    48104894#endif /* _P_P_PORTABILITY_H_ */ 
    48114895