1. find_from() in compile.e
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Jun 22, 2007
- 546 views
I was looking at the compile.e include file in the source directory, understanding that any new IL opcode defined should have its own entry there for the translator to do something about it. Yet I couldn't find any translation routine for the FIND_FROM IL opcode. Nor is it translated into any other opcode. Did I do anything wrong when I checked out from SVN? CChris
2. Re: find_from() in compile.e
- Posted by Robert Craig <rds at RapidEuphoria.com> Jun 22, 2007
- 541 views
CChris wrote: > I was looking at the compile.e include file in the source directory, > understanding > that any new IL opcode defined should have its own entry there for the > translator > to do something about it. > Yet I couldn't find any translation routine for the FIND_FROM IL opcode. Nor > is it translated into any other opcode. > Did I do anything wrong when I checked out from SVN? The latest 3.1 code is all checked in. If you search for "find_from" in compile.e, you'll see that there's a routine for it, opFIND_FROM() just after the one for "find". The M_ constants at the top of compile.e are just for machine_proc operations, not IL ops (if that caused you some confusion). During initialization, in init_opcodes(), the Translator builds a sequence of routine ids, using the "opnames" sequence in opnames.e. That's how it knows what routine to call for each IL op. Those names are in the exact order of IL op number. In reswords.e, you can see that FIND_FROM = 178, and in opnames you'll find "FIND_FROM" as the 178th element. The Translator used to have a huge if-elsif chain for the IL ops, but for efficiency I now use calls based on the routine id of the opcode handling routine. The routine ids are stored in the "operation" sequence. To add find_from() and match_from() to the Translator, all I did was copy the way find() and match() are handled (adding an extra argument of course). Translated code simply calls the same find_from and match_from run-time routines as the interpreter uses - i.e. the ones Matt wrote. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com