dougm       01/04/19 10:38:56

  Modified:    xs/Apache/Filter Apache__Filter.h
  Log:
  add MODIFY_CODE_ATTRIBUTES method
  
  Revision  Changes    Path
  1.4       +42 -0     modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Apache__Filter.h  2001/04/13 07:17:07     1.3
  +++ Apache__Filter.h  2001/04/19 17:38:54     1.4
  @@ -55,3 +55,45 @@
   
       return len;
   }
  +
  +static MP_INLINE I32 *modperl_filter_attributes(SV *package, SV *cvrv)
  +{
  +    return &MP_CODE_ATTRS(SvRV(cvrv));
  +}
  +
  +static XS(MPXS_modperl_filter_attributes)
  +{
  +    dXSARGS;
  +    I32 *attrs = modperl_filter_attributes(ST(0), ST(1));
  +    I32 i;
  +
  +    for (i=2; i < items; i++) {
  +        STRLEN len;
  +        char *pv = SvPV(ST(i), len);
  +        char *attribute = pv;
  +
  +        switch (*pv) {
  +          case 'I':
  +            if (strnEQ(pv, "InputFilter", 11)) {
  +                pv += 11;
  +                switch (*pv) {
  +                  case 'B':
  +                    if (strEQ(pv, "Body")) {
  +                        *attrs |= MP_INPUT_FILTER_BODY;
  +                        continue;
  +                    }
  +                  case 'M':
  +                    if (strEQ(pv, "Message")) {
  +                        *attrs |= MP_INPUT_FILTER_MESSAGE;
  +                        continue;
  +                    }
  +                }
  +            }
  +          default:
  +            XPUSHs_mortal_pv(attribute);
  +            XSRETURN(1);
  +        }
  +    }
  +
  +    XSRETURN_EMPTY;
  +}
  
  
  

Reply via email to