Re: The Ulimate Editor
- From: Alex McDonald <alex_mcd@xxxxxxxxxxxxxxx>
- Date: Sun, 1 Jan 2006 17:13:07 +0000 (UTC)
Marcel Hendrix wrote:
"Jenny Brien" <jennifer@xxxxxxxxxxxxxxxxxxxxxxxxxxx> writes Re: The Ulimate Editor [..]
It's a pity all the major Windows Forths seem to interface in a different way. Perhaps it's time for a publication standard?
[snipped]
I do NOT like to have Forth code like that shown for Win32Forth: it firmly locks down that Forth to Windows (and because the parameter
order is reversed from the OS spec., the code can never be reliably exchanged between Windows Forth systems ... ).
I'm not quite with you on this one; if Windows declares a call like
FARPROC GetProcAddress( HMODULE hModule, LPCSTR lpProcName );
then to invoke this;
c" LoadLibrary" 0 call GetProcAddress
(strings in WIn32Forth are automatically null terminated). The order of the parameters is "stack natural"; there's no swapping of the parameters before the call.
In fact, the call statement is not required in the latest version; the word (apart from case sensitivity) is tickable etc, and looks just like an ordinary word.
' GetProcAddress value getproc c" LoadLibrary" 0 getproc
Before it's too late, interface layers to common functionality should be specified (and agreed upon). It doesn't seem that hard to me, but it never seems to takes off.
In Win32Forth, the words are currently
WINLIBRARY name.dll
identifies the library.
n PROC name
n is the number of parameters; it's only for documentation use. PROCs are not tied to libraries; every declared library is searched for the proc. This isn't 100% satisfactory if the same name is in more than 1 library. name is case preserved. (In fact, the PROC statement can be omitted much of the time; it's use has become largely ceremonial.)
AS altname
allows an alternative name for the last declared PROC, where case is not preserved.
CALL name ( or altname)
CALL is optional.
n CALLBACK: name ... ;
defines a callback with n parameters (again, stack natural). __CDECL can be as a modifier to support other than the normal __STDCALL convention.
That's as things stand currently; I'm working on an update to address some of the problems associated with external variables, PROCs with duplicate names etc, and to support exports.
Basically, I'll agree to anything that allows me to treat the name of a function as a normal Forth word, without too much declaration fluff; preferably just the name of the library it lives in, as I can do right now in Win32Forth. It's much more flexible currently than I think you give it credit for.
-- Regards Alex McDonald .
- Follow-Ups:
- Re: The Ulimate Editor
- From: Jenny Brien
- Re: The Ulimate Editor
- References:
- Re: The Ulimate Editor
- From: Marcel Hendrix
- Re: The Ulimate Editor
- Prev by Date: Re: win32forth file bug??
- Next by Date: Re: win32forth file bug??
- Previous by thread: Re: The Ulimate Editor
- Next by thread: Re: The Ulimate Editor
- Index(es):
Relevant Pages
|
Loading