[ragel-users] How to process a block of random sized data

Adrian Thurston thurston at colm.net
Thu Nov 1 07:53:17 UTC 2018


 

Hi Ming, 

Ragel has no support for this built in. I use a class for this that
tracks the start of the interesting input and flushes it out when
necessary. The start and finish functions are called from ragel actions.
The preExec and postExec functions are called before and after the ragel
write exec. See attached example. 

In my uses I expand it to include start and finish functions on the
expensive thing (also a stream processor), and I can also pause it to
skip over some data that shouldn't go to expensive thing. 

I've often thought about building this support into ragel, but once
you've got the class made it's super easy to reuse it in many different
cases. 

Regards, 

 Adrian 

On 2018-10-31 16:48, Ming Fu wrote: 

> Hi, 
> 
> I have the following ragel rule: 
> 
> any* $( 
> 
> Some_expensive_call(*p) 
> 
> } 
> 
> However, I do not necessary have to make the some_expensive_call per input char, I can call some_less_expensive_call(*p, len) to be more efficient. 
> 
> How do I figure out the len and adjust pe. Consider the input may not be in contiguous memory block. 
> 
> Thanks, 
> 
> Ming 
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users [1]
 

Links:
------
[1] http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20181101/13a7260d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blockexec.cc
Type: text/x-c
Size: 655 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20181101/13a7260d/attachment.bin>


More information about the ragel-users mailing list