[ragel-users] some questions regarding ragel

Григорий Фучеджи grygoriy.fuchedzhy at gmail.com
Thu Nov 19 20:45:03 UTC 2009


Hi. I'm new to ragel and currently exploring its features. I'm working on
some applications using microcontrollers which have very limited resources.
Microcontrollers communicate with each other with radio. I'm using ragel to
parse radio protocol. So here is my questions:

1. Main part of my application is infinite loop, which is waiting for input,
parses it with ragel-generated code and do some work. So I don't have
EOF-thing at all. I don't use any EOF actions(at least explicitly). But
generated code still contains some EOF-stuff which uses eof variable(thus I
have to declare it). Documentation states: "If EOF actions are used then the
eof variable is required."(so if I don't use EOF actions it shouldn't be
required) I think I'm missing something. Maybe I have to state explicitly
somewhere in .rl file that EOF is senseless in my case. Here is my
dummy-playground-example for PC http://gist.github.com/239028

2. Ragel assumes that data which have to be processed is between p and pe
pointers. Can this be customized? Here is what I want. I have ring-buffer
which fills in interrupt routines. I have interface function for this
ring-buffer, which returns data from this buffer byte by byte ( int
cyw_tryread(uint8_t* ptr) ). If there is some valid data in buffer it writes
it to (*ptr) and returns 1, otherwise 0. I want ragel to use this function
as source of data instead of walking through p pointer. It seems that all I
need to do for this is replace
>    if ( ++p != pe )
>        goto _resume;
with
>    if ( cyw_tryread(p))
>        goto _resume;
pe pointer is useless here. So can I customize this in ragel without
patching generated code(patching generated code is not very good thing to
do...)

3. Can I embed C checks within machine definition statement? e.g. if I want
machine that matches any character, that have nonzero bit number 2
(xxxxx1xx). So for this characters (ch & 4) is true. Is there a way to
define such machine?

Any tips and explanations would be very much appreciated.
__
Grygoriy Fuchedzhy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20091119/0d2db19b/attachment-0001.html>


More information about the ragel-users mailing list