Re: The Ulimate Editor
- From: Alex McDonald <alex_mcd@xxxxxxxxxxxxxxx>
- Date: Mon, 2 Jan 2006 21:11:47 +0000 (UTC)
Jenny Brien wrote:
On Sun, 01 Jan 2006 17:13:07 -0000, Alex McDonald <alex_mcd@xxxxxxxxxxxxxxx> wrote:
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.
That's the sort of thing that trips people up. I'd just about sorted out in my mind that any Forth code that didn't use Call had its parameters in the opposite order. :-( Quite frankly, I don't much care which convention is used so long as it's explicitly declared.
I'm sorry, I'm not that conversant with other Windows' based Forths. In W32F, the parameters to CALL have always been in the reverse order to a standard C call. It's omission (a new feature) doesn't change the order. Given
int funcname (int a, int b);
then the stack effect is ( b a -- retval ), and CALL funcname or funcname operate identically. W32F does not use the count of parameters to manipulate the stack before the call; that's what I mean by stack-natural.
My goal is to be able to read a properly documented Windows routine in any language with which I am conversant, and be able to easily translate it into any Windows Forth. That applies to translation between Forths too!
Given that limited objective, I propose:
WINCONSTANTS constantname [ alias ] [ \ comment ]
I'm not sure I understand this, or the requirement for it. Windows constants are (in the main) mostly numeric constants.
... WINLIBRARY dllname n IMPORT procname \ stack comment in C order ...
This need not be implemented, but should be included (as a comment if necessary) in published code.
It is assumed that all proc names are found in the declared library.
Which one? In your example, is procname bound to the immediately preceding WINLIBRARY dllname?
Procnames are case-sensitive. They take parameters in the declared
order. If preceded by Call, they take parameters in 'stack natural' order. So Call would be mandatory for a Win32 type Forth, defined as a
noop if need be. Since the number of parameters is declared in IMPORT, it should be possible, if required, to write a Call to allow a C-order Forth to read 'stack-natural' code.
The number of parameters is fixed in the Windows api for most calls, but that is not generally true of all DLLs that we have experience in using with W32F. There are several calling conventions in use; for example C, Pascal, or standard. The n IMPORT notation is inadequate for this.
Well, that's a start. What else is needed? Maybe some tool to examine a library and automatically create an IMPORT list as a text file.
These already exist; they are the C header files in the Windows case. SWIG can be used to generate XML output from the parse of these, something I have experimented with.
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.
You can still do that for your own private code. I'm concerned with standards for publication, not implementation.
I'm concerned with ensuring that W32F can interface with as wide a range of external libraries (DLL, COM objects etc) as possible. The restrictions of n IMPORT (or W32F's n PROC) are too limiting.
-- Regards Alex McDonald .
- References:
- Re: The Ulimate Editor
- From: Marcel Hendrix
- Re: The Ulimate Editor
- From: Alex McDonald
- Re: The Ulimate Editor
- From: Jenny Brien
- Re: The Ulimate Editor
- Prev by Date: Re: The Ulimate Editor
- Next by Date: Re: The Ulimate Editor
- Previous by thread: Re: The Ulimate Editor
- Next by thread: Re: The Ulimate Editor
- Index(es):
Relevant Pages
|
Loading