Re: Euphoria++
- Posted by Mike The Spike <mtsreborn at yahoo.com> Feb 01, 2001
- 406 views
--- Jeff Zeitlin <jzeitlin at cyburban.com> wrote: > Mike the Spike, in his inimitable and occasionally > offensive way, makes a > quite valid point with regards to using compiler- > and/or platform-specific > code in the translator output. Thanks man. > What I might suggest - which would ultimately > enhance cross-platform/ > cross-compiler support - is for the Euphoria > translator to generate code > for specific, well-documented routines to perform > given functions, such as > graphics or interrupts, and also provide 'wrappers' > to provide the > 'standardized interface' for supported > platforms/compilers. As people > attempt to use new platforms/compilers, if calls to > the specified routines > are made, it would be the user's responsibility to > provide the appropriate > functionality, conforming to the specified > interface. > > Thus, the Euphoria translator would always generate > code for placing a > pixel on the screen using a routine "putpixel(int > xcoord, int ycoord, int > color)"; this would be mapped by wrapper routines - > provided either as a > precompiled library/object file or as a source > include file - to whatever > the "real" routine for the particular > platform/compiler is. Depending on > the code actually in the putpixel routine that the > translated code calls, > this could even allow for 'text-mode graphics', > based on line-drawing > characters, for example in the DOS CP437 character > set, or the old > Commodore PET/64 character graphics. > > Thoughts? Arguments in favor? Arguments against? > (Flames to /dev/null, > please) > -- > Jeff Zeitlin > jzeitlin at cyburban.com That's something I haven't thought of before... I'd say, do this; typedef void (*c_pixel_func)(int,int,int); /* In Euphoria.h */ c_pixel_func c_pixel; c_pixel = robs_c_pixel_in_ec_lib; So we can simply state: c_pixel = my_own_leet_pixe_func; And have pixel() call c_pixel! Excellent idea! Mike The Spike