XCMD -> Revolution External shim kit?
Ben Rubinstein
benr at cogapp.com
Mon Mar 12 05:50:18 EDT 2007
I know - and I agree - most of the XCMDs one used to use can be recoded in
Transcript, often with no loss of speed, sometimes even an increase, and
obviously with a gain in portability.
But I am left with a couple of XCMDs that I don't want to be ported to
transcript, because their value is that they share code with applications
written in C/C++, and I want to be sure that the XCMD produces exactly the
same behaviour as the application. When I switched to Revolution, they
crashed until I understood that Rev supports v1 of the HC external interface,
not v2; so I added a bit of shim code for the missing function that this
external happened to be calling (StrToRect). Unfortunately, when Rev 2.0
arrived, these were orphaned; I've been hanging on to these with the app in
Rev 1.1 but now I really need to move the code into a Revolution external, so
I can bring the whole shebang up to date.
Looking at the code, there are a lot of functions passing the XCmdPtr around,
so that callbacks can be made, and results returned. Of course it would be
perfectly possible to sit down and rewrite the whole code to avoid all this.
But it looks to me as if it would be approximately the same effort - perhaps
even slightly less - to instead extend the shim, so it implements the HC v1
callbacks that are missing, translates the HC Set/Get global functions into
the Rev equivalents, and converts the input arguments and parameters.
The result would be a shell Revolution External project, into which one could
drop the code from an old HC external, and make it available to modern
versions of Rev with very little effort.
I don't imagine that I'm the first person to have the need to convert an old
external... so has anyone else produced such a shim kit? If not, is there
anyone else who has code that would benefit from it?
- Ben
More information about the use-livecode
mailing list