CONTENTS | PREV | NEXT
17C. bin/iconvert, bin/pragma2module
------------------------------------
These two utilities are for advanced E-programmers only. if
you don't feel like one (yet), skip this part.
[NOTE: like the showmodule utility, the sources to these utilities
have been removed from the distribution, because people misused
their knowledge of the .m module format. It is PRIVATE. Contact
me first if you want to do something with it.]
Iconvert will convert structure and constant definitions in
assembly ".i" files to E modules, and pragma2module will do the
same for SAS/C pragma library definition files. Of course, all
commodores includes have already been converted this way, but
say you find a nice PD library that you may want to use with E,
you will need these utilities.
most libraries come with various includes defining, most obvious,
the library calls of the library, as well as the constants
and structures (OBJECTs in E) that it uses. say that it is
called "tools.library", then it will probably feature:
pragmas/tools_pragmas.h
includes/tools.i
then do:
1> pragma2module tools_pragmas.h
rename the resulting "tools_pragmas.m" to "tools.m" and put it
in emodules:, check with ShowModule if all went well.
Now, in your program you may use tools.library:
MODULE 'tools'
PROC main()
IF (toolsbase:=Openlibrary('tools.library',37))=NIL THEN error()
ToolsFunc()
...etc.
convert tools.i with Iconvert to another tools.m, which you place in
emodules:libraries, for example. Iconvert needs an assembler like
the PD A68k or PhxAss (use option "-p") to do the hard work of understanding
the actual assembly.
1> iconvert tools.i
see with showmodule what became of the ".i" file. use in your
program with:
MODULE 'libraries/tools'
DEF x:toolsobj, y=TOOLS_CONST
converting with Iconvert may require some assembly expertise, as
Iconvert relies on the correct format of the ".i" file, just like
commodores assembly includes. About 10% of the ".i" files need
to be patched by hand to be "convertable". definitions that
Iconvert judges correctly are amongst others
<label> EQU <any_expression>
STRUCTURE <sname>,0 ; if <>0, then <struct>_SIZEOF
ULONG <sname>_<label>
BPTR <sname>_<label>
; etc.
LABEL <sname>_SIZEOF ; or "_SIZE"
to get an idea what kind of assembly-expression Iconvert can
handle, take a look at commodores assembly includes and compare
them to the equivalent modules (for example intuition.i).