[Mono-dev] Patch for System.IO.Ports.SerialPort ReadLinefunction

Adar Wesley adar.wesley at gmail.com
Tue Nov 6 04:42:43 EST 2007


Hi,

I don't know if it is relevant for your particular situation, but your
discussion about
keeping track of multiple possible matches reminded me of something I read a
long
time ago.

Check out the AGREP alrorithm for matching multiple patterns concurrently.
In
particular it has an efficient implementation of keeping track of multiple
possible
matches.

Just google for AGREP algorithm, or check out here:
http://webglimpse.net/pubs/TR94-17.pdf

Hope this helps, and sorry if it's not relevant.

---
Adar Wesley


On 11/6/07, Michael Mattess <MichaelMattess at rauland.com.au> wrote:
>
>   Hello Miguel,
>
>
>
> Yes using the ReadTo function does make the most sense as it is a special
> case of the operation.
>
>
>
> I had a look at the ReadTo function and I think it is broken.  It assumes
> that it is in the initial state (IE current is 0) when it encounters the
> beginning of the string it is reading to.  So if we are reading to "ababZ"
> and the input is "abababZfoo" it will read past the "ababZ".
>
>
>
> It was because of this that I put the 'state-driven' approach into the too
> hard / too complex basket when I wrote my initial function.  But thinking
> about it further the ReadTo function could be extended to keep multiple
> states (ie a list of 'current' offsets).  One for each time a potential
> beginning of the string we are looking for is encountered.  I
> have attached a file with such an extended ReadTo function.
>
>
>
>  Let me know your thought.
>
>
>
> Regards
>
> Michael
>
>
>
>
>
> ------------------------------
> *From:* Miguel de Icaza [mailto:miguel at novell.com]
> *Sent:* Tue 06.11.2007 02:06
> *To:* Michael Mattess
> *Cc:* mono-devel-list at lists.ximian.com
> *Subject:* Re: [Mono-dev] Patch for System.IO.Ports.SerialPortReadLinefunction
>
>
>
> Hello,
>
>     My ReadLine routine is broken, it did not append data that was only
> partially part of the ReadLine.   While I was fixing it, I noticed that
> we already have a routine that did this correctly (ReadTo).
>
>     So am going to just change the code to be:
>
>         ReadTo (new_line).
>
> Miguel.
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>


-- 
---
Adar Wesley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071106/97034e5d/attachment.html 


More information about the Mono-devel-list mailing list