1. Adding built-in routines to the euphoria interpretor
- Posted by Ryan W. Johnson <ryanj at fluidae.com> Nov 22, 2006
- 601 views
I'm trying to add some built-in routines to the eu interpretor. When I execute a test program that calls the function "fiKernelInfo", it's telling me "unknown opcode: 182". In keylist.e I added some entries:
{"fiCallProc", SC_PREDEF, PROC, FI_CALL_PROC, 3, E_PURE}, {"fiCallFunc", SC_PREDEF, FUNC, FI_CALL_FUNC, 3, E_PURE}, {"fiOpenSession", SC_PREDEF, FUNC, FI_OPEN_SESSION, 1, E_PURE}, {"fiCloseSession", SC_PREDEF, PROC, FI_CLOSE_SESSION, 1, E_PURE}, {"fiKernelInfo", SC_PREDEF, FUNC, FI_KERNEL_INFO, 0, E_PURE}
rywilly i also added entries in opnames.e:
"FI_CALL_PROC", "FI_CALL_FUNC", "FI_OPEN_SESSION", "FI_CLOSE_SESSION", "FI_KERNEL_INFO" --182
and in reswords.e
FI_CALL_PROC = 178, FI_CALL_FUNC = 179, FI_OPEN_SESSION = 180, FI_CLOSE_SESSION = 181, FI_KERNEL_INFO = 182, MAX_OPCODE = 182
and added procedures in execute.e:
procedure opFI_CALL_PROC() a = Code[pc+1] b = Code[pc+2] c = Code[pc+3] fiCallProc(val[a], val[b], val[c]) pc += 4 end procedure procedure opFI_CALL_FUNC() a = Code[pc+1] b = Code[pc+2] c = Code[pc+3] target = Code[pc+4] val[target] = fiCallFunc(val[a], val[b], val[c]) pc += 5 end procedure procedure opFI_OPEN_SESSION() a = Code[pc+1] target = Code[pc+2] val[target] = fiOpenSession(val[a]) pc += 3 end procedure procedure opFI_CLOSE_SESSION() a = Code[pc+1] b = Code[pc+2] fiCloseSession(val[a]) pc += 3 end procedure procedure opFI_KERNEL_INFO() target = Code[pc+1] val[target] = fiKernelInfo() pc += 2 end procedure
When i call the fiKernelInfo() function in my test app, it says op code 182 is unknown. So, it's seems to be partially working, but i'm missing something somewhere. Does anyone know what else I need to do? ~Ryan W. Johnson Fluid Application Environment http://www.fluidae.com/ [cool quote here, if i ever think of one...]
2. Re: Adding built-in routines to the euphoria interpretor
- Posted by Ryan W. Johnson <ryanj at fluidae.com> Nov 22, 2006
- 555 views
Perhaps I should have specified: I'm just using the euphoria backend (euphoria-in-euphoria intepretor). This is to be used as basically a scripting engine within a euphoria program. I'm not doing anything to the C backend. ~Ryan W. Johnson Fluid Application Environment http://www.fluidae.com/ [cool quote here, if i ever think of one...]
3. Re: Adding built-in routines to the euphoria interpretor
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Nov 22, 2006
- 582 views
Ryan W. Johnson wrote: > > I'm trying to add some built-in routines to the eu interpretor. When I execute > a test program that calls the function "fiKernelInfo", it's telling me > "unknown > opcode: 182". <snip> It looks like you forgot to update emit_op() in emit.e. Matt
4. Re: Adding built-in routines to the euphoria interpretor
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 25, 2006
- 571 views
On Tue, 21 Nov 2006 20:52:29 -0800, "Ryan W. Johnson" <guest at RapidEuphoria.com> wrote: >When i call the fiKernelInfo() function in my test app, it says op >code 182 is unknown. So, it's seems to be partially working, but i'm >missing something somewhere. Does anyone know what else I need to do? See emit_op in emit.e For example (untested!), add FI_OPEN_SESSION to the test:
elsif find(op, {RAND, PEEK, PEEK4S, PEEK4U, NOT_BITS, NOT}) then
Regards, Pete