1. Return values for open() and define_c_*()
I have a suggestion,
how if open() returns the C file handle (on windows and linux),
define_c_*() and routine_id() returns the memory address (as it is now
with call_back()).
But still return -1 when there is a failure.
Why?
- Won't break existing code
(we usually write
fn = open(...)
if fn = -1 then error -- or if fn < 0 then error
something = define_c_func(...)
if something = -1 then error
don't we?)
- Easier interface with windows API that requires a file handle or
callback function (we dont have to open() the file using Windows
API)
- Faster execution (eu interpreter don't have to translate the
routineid/filenumber into an internal representation)
- call_back() can be replaced easily with:
function call_back(object x) return x end function
2. Re: Return values for open() and define_c_*()
aku saya wrote:
> I have a suggestion,
> how if open() returns the C file handle (on windows and linux),
> define_c_*() and routine_id() returns the memory address (as it is now
> with call_back()).
I like to use small integer values for these things,
so I can index easily into my own internal tables.
I also think it's better, where possible, to shield
Euphoria programs from the details of the underlying machine
or operating system. If you want to access files
using the Windows API, you might as well wrap the open function
as well as the read/write/close/etc. functions.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com