Hi Detlef,
> Detlef Janlowiak-Evers wrote:
>
> Hello
>
> has anybody a program that creates an Oberon-Source from a C-Headerfile
>
> Detlef
You are welcome to try my experimental H2O translator available here:
http://espc22.murdoch.edu.au/~stewart/files/h2o20010418.tar.gz
Unfortunately this is not a finished product, but you may be able to get
some use out of it. I've been working on this as my own needs require;
currently I don't have the time or need to finish it.
I wish I could say that there's a better solution, but I don't think one
exists. XDS have a product called H2D, but it generates Modula-2 definition
modules, which are quite different from Oberon interfaces. On the other
hand, H2O generates OOC-style Oberon-2 interface modules which are not the
same as Component Pascal interface modules, but are similar enough to be
easily converted. An earlier version of H2O had a Component Pascal
back-end, but I'm reworking parts of the interface and have not maintained
that part of the system.
Here are some points to consider:
- H2O is still under development so you will probably find some bugs.
- H2O is written for OOC, so you won't be able to use the source code under
Blackbox. The archive includes a stand-alone executable for WIN32 systems.
Within the h2o directory, you should find that "h2o tests/test.h" works.
- The documentation is out of date, although there are some example
interfaces that show how it works and what it produces.
- Error reporting is minimal. See "errors.short" for a brief description of
each error code.
- If you enable rewriteTypes, H2O will rewrite type constructors using
existing types. Otherwise it will leave type constructors in procedure
parameter lists, which may be a problem depending on your compiler. Under
Blackbox there are limitations on how many such constructors you can have
since each generates *different* anonymous type.
- The defaultPointerVar setting controls how H2O translates pointers in
procedure parameters. If T is a structure or pointer type, a declaration "T
* p" is translated as "VAR p [NIL_COMPAT] : T" when defaultPointerVar is
true, and "p : POINTER TO T" when false. Pointers to scalar types are
always translated as VAR, except for pointers to char and longchar. Your
choice will depend on the semantics of the interface. H2O should allow
finer control over this, but it doesn't.
- There are some limitations in the preprocessor. Token pasting is not
supported.
- H2O will generate named types to eliminate type constructors in procedure
parameter lists. Therefore, you will get this sort of thing from OpenGL:
AutoArray_4_GLint* = ARRAY 4 OF GLint;
AutoArray_16_GLdouble* = ARRAY 16 OF GLdouble;
PROCEDURE gluProject* (
objx : GLdouble; objy : GLdouble; objz : GLdouble;
modelMatrix : AutoArray_16_GLdouble;
projMatrix : AutoArray_16_GLdouble;
viewport : AutoArray_4_GLint;
VAR winx [NIL_COMPAT] : GLdouble;
VAR winy [NIL_COMPAT] : GLdouble;
VAR winz [NIL_COMPAT] : GLdouble) : LONGINT;
- There is experimental support for translating COM interfaces. If a
structure declares a field that is a function (C only allows pointers to
functions) the structure is assumed to have a C++ virtual method table. H2O
declares the type as "ABSTRACT VTABLE", and declares the necessary
type-bound procedures. Eg:
IDirectSoundNotify_struct* = RECORD [ABSTRACT, VTABLE]
END;
(* Procedures bound to IDirectSoundNotify_struct *)
PROCEDURE (VAR self : IDirectSoundNotify_struct) [ABSTRACT]
QueryInterface* (VAR p0 [NIL_COMPAT] : IID;
VAR p1 [NIL_COMPAT] : LPVOID) : HRESULT;
PROCEDURE (VAR self : IDirectSoundNotify_struct) [ABSTRACT]
AddRef* () : ULONG;
PROCEDURE (VAR self : IDirectSoundNotify_struct) [ABSTRACT]
Release* () : ULONG;
PROCEDURE (VAR self : IDirectSoundNotify_struct) [ABSTRACT]
SetNotificationPositions* (p0 : DWORD;
VAR p1 [NIL_COMPAT] : DSBPOSITIONNOTIFY) : HRESULT;
This will work for OOC, but *not* for Component Pascal. However, it would
not be hard to generate declarations compatible with the Direct-To-COM
compiler. For more examples of this, see h2o/interfaces/dsound/DSound.Mod.
Hope this helps.
Cheers,
Stewart
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Received on Wed Apr 18 2001 - 05:15:42 UTC