internal PcreRefCallout(ReadOnlySpan <char> subject, InternalRegex regex, Native.pcre2_callout_block *callout) { _subject = subject; _regex = regex; _callout = callout; _oVector = null; }
public int Call(Native.pcre2_callout_block *callout) { try { if (_subject != null) { var func = (Func <PcreCallout, PcreCalloutResult>)_callout; return((int)func(new PcreCallout(_subject, _regex, callout))); } else { var func = (PcreRefCalloutFunc)_callout; return((int)func(new PcreRefCallout(_subjectSpan, _regex, callout))); } } catch (Exception ex) { Exception = ex; return(PcreConstants.ERROR_CALLOUT); } }
internal PcreCallout(string subject, InternalRegex regex, Native.pcre2_callout_block *callout) { _subject = subject; _regex = regex; _flags = callout->callout_flags; Number = (int)callout->callout_number; StartOffset = (int)callout->start_match; CurrentOffset = (int)callout->current_position; MaxCapture = (int)callout->capture_top; LastCapture = (int)callout->capture_last; PatternPosition = (int)callout->pattern_position; NextPatternItemLength = (int)callout->next_item_length; _markPtr = callout->mark; _oVector = new uint[callout->capture_top * 2]; _oVector[0] = (uint)callout->start_match; _oVector[1] = (uint)callout->current_position; for (var i = 2; i < _oVector.Length; ++i) { _oVector[i] = callout->offset_vector[i].ToUInt32(); } }
private static int CalloutHandler(Native.pcre2_callout_block *callout, void *data) => ToInteropInfo(data).Call(callout);