bigloo.foreign.rgc_buffer_insert_substring C# (CSharp) Method

rgc_buffer_insert_substring() public static method

public static rgc_buffer_insert_substring ( input_port p, byte s, int from, int to ) : bool
p input_port
s byte
from int
to int
return bool
        public static bool rgc_buffer_insert_substring(input_port p, byte[] s, int from, int to)
        {
            if ( from < 0 ) return false;
            if ( to > s.Length ) return false;
            if ( p.bufsiz == 2) return false; // unbuffered port
            if ( CLOSED_RGC_BUFFER( p )) return false;
            if ( from >= to ) return true;

            int len = to - from;

            rgc_buffer_reserve_space(p, len);

            int matchstop = p.matchstop;

            bcopy(s, from, p.buffer, (matchstop - len), len);

            if ( p.filepos >= len )
               p.filepos -= len;
            else
               p.filepos = 0;

            p.matchstop -= len;
            p.forward    = p.matchstop;
            p.matchstart = p.matchstop;
            return true;
        }
foreign