iff.library iff.l.main stub existing?

This forum is for general developer support questions.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: iff.library iff.l.main stub existing?

Post by salass00 »

JosDuchIt wrote:@salasso
Thanks, a big step forward.
I did put the OS4/include/proto/iff.h OS4/include/inlines4/iff.h and OS4/include/interfaces/iff.h in the SDK in the include_h/ subdrawers proto/ inlines4/ and interfaces/ respectively and kept
the OS4/Include/iff.h in the same drawer as the source.
Third party stuff belongs in SDK:local and not anywhere else in the SDK. In this case the includes should go in SDK:local/common/include (SDK:include/include_h is for OS includes only).
I only have one 'indefined reference' left
/tmp/cc6KBeGa.o: In function `DisplayILBM':
EasyExampleOS4.c:(.text+0x554): undefined reference to `IFFL_CloseIFF'
Doing a search for IFFL_CloseIFF i find that it is only present in
os4/fd/iff_lib.fd
whereas other functions appear also in
OS4/include/inlines4/iff.h
OS4/include/interfaces/iff.h
OS4/Include/iff.h

as IFFL_CloseIFF is the first function listed in the autodoc, i guess something went wring with the generation of the stub?
I don't see how to complete those files manually
If somebody has them ?
Thomas?
Thomas probably used fd2pragma to convert the original fd and clib files into an sfd file for use with fdtrans (to generate the ppc->m68k stub code and an xml file for idltool which generates the proto, interfaces and inline4 include files). In my experience fd2pragma will sometimes skip over a function in an fd file if it doesn't like how it's defined and will print a warning about this, probably this is what happened here.
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: iff.library iff.l.main stub existing?

Post by thomasrapp »

I corrected the stub lib and also made the examples compile. (I replaced the archive, see same link as above.)

However, none of the examples runs correctly. They all crash somewhere inside iff.library.

May I ask why you want to use iff.library? Most of what it does can also be done with datatypes.library. And with datatypes you cannot only read IFF but any supported picture file format, without changing your program.


Here is the EasyExample rewritten to use datatypes: http://thomas-rapp.homepage.t-online.de ... s/EasyDT.c
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: iff.library iff.l.main stub existing?

Post by salass00 »

thomasrapp wrote:I corrected the stub lib and also made the examples compile. (I replaced the archive, see same link as above.)

However, none of the examples runs correctly. They all crash somewhere inside iff.library.
Have you added:

Code: Select all

#pragma pack(2)

/* structure definitions here */

#pragma pack()
around all the structure definitions in libraries/iff.h file?
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: iff.library iff.l.main stub existing?

Post by chris »

thomasrapp wrote:May I ask why you want to use iff.library? Most of what it does can also be done with datatypes.library. And with datatypes you cannot only read IFF but any supported picture file format, without changing your program.
I would definitely agree with this, if it is just images that the OP is interested in. Anything a little more low-level can be done with iffparse.library instead (not sure how low-level iff.library gets though)

If it is needed for a port, I would suggest rewriting iff.library as a wrapper around datatypes.library/iffparse.library. I notice the readme on Aminet even says the author is thinking about doing that himself!
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

@thomas & chris
I try to maintain Gui4Cli, it comes with a plug-in which happens to use IFF.library.
If some wrapper could provide its functionality soon i will wait
Anyhow i want to finish the making iff.library available to PPC code as an exercice, make the examples work at least. (in that order)




Having studied the SDK i gave it a try. My try is till now not working

Here is what i did:

The 68k iff.library v23.2 archive comes with the files
http://de4.aminet.net/util/libs/iff.library-23.lha comes notably with

iff.h containg notably the function prototypes
iff_lib.fd
ifflib.doc


I have those in the
Datas:Gui4Cli/Dev/iff_library drawer
and iff.library is present in libs:

According to what we understand from the OS4 SDK, we can obtain all needed files for using this library with PPC code with the following command sequence that ise only using the files iff.h and iff_lib.fd as arguments.

Is this right ?

=== command sequence ===
13.Datas:Gui4Cli/Dev/iff_library> fd2pragma iff_lib.fd CLIB iff.h SPECIAL 112 //=> iff_lib.sfd
SourceFile: iff_lib.fd
Warning 79 in line 193 of clib file: Unknown type of argument 1 (IFFL_HANDLE) handled as int.
ResultFile: iff_lib.sfd (*)
13.Datas:Gui4Cli/Dev/iff_library> fdtrans -s iff_lib.sfd //=> iff.c
13.Datas:Gui4Cli/Dev/iff_library> fdtrans -x iff_lib.sfd //=>iff.xml
13.Datas:Gui4Cli/Dev/iff_library> idltool -c iff.xml // iff_vectors.c
13.Datas:Gui4Cli/Dev/iff_library> idltool -p iff.xml //=><proto/iff.h>
13.Datas:Gui4Cli/Dev/iff_library> idltool -n iff.xml //=> <inline4/iff.h>
13.Datas:Gui4Cli/Dev/iff_library> idltool -i iff.xml //=> <interfaces/iff.h>
13.Datas:Gui4Cli/Dev/iff_library>copy include/#? SDK:include/include_h/ ALL
13.Datas:Gui4Cli/Dev/iff_library> gcc -o iff.l.main -nostartfiles iff.c //> iff.l.main
In file included from iff.c:16:
In file included from iff.c:16:
/SDK/include/include_h/interfaces/iff.h:36: error: expected declaration specifiers or '...' before 'IFFL_HANDLE'
/SDK/include/include_h/interfaces/iff.h:37: error: expected declaration specifiers or '...' before 'IFFL_HANDLE'
/SDK/include/include_h/interfaces/iff.h:38: error: expected declaration specifiers or '...' before 'IFFL_HANDLE'
etc

Can it be that the warning in the generation of iff_lib.sfd causes all the trouble ?
How then can we avoid this ??

(°) !n iff.h we have the following line though
typedef void *IFFL_HANDLE

I noted also a difference in the documentation concerning GetColorTab() function:
LONG IFFFL_GetColorTab( IFF_HANDLE, UWORD * ) /// according to ifflib.doc
LONG IFFL_GetColorTab ( IFFL_HANDLE, WORD * ); /// according to iff.h
The examples use the UWORD form, but i am less suspicious of this as cause of the noted problems
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: iff.library iff.l.main stub existing?

Post by salass00 »

http://dl.dropbox.com/u/26599983/iff_os4_glue.7z

Installation:

copy iff.l.main SYS:Libs/
copy include/#? ALL SDK:local/common/include/

If you have installed iff.library includes into some other place in the SDK you should delete them.
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

@salass00
I have downloaded and installled the iff files you provided.

Thank you

Does the EasyExample.c works for you ?

When compiling the EasyExamle.c (modified for OS4 ) i get a warning
"pointer targets in passing argument 3 of 'IIFF->IFFL_GetColorTab' differ in signedness"


either for the use of IFFL_GetColorTab() when i leave in the function DisplayILBM() acolortable defined as
UWORD colortable[256]
or
"pointer targets in passing argument 3 of 'IGraphics->LoadRGB4' differ in signedness"

for the IGraphics->LoadRGB4() function if i change the definition to
WORD colortable[256]

The example compiles but crashes when trying to load an ILBM file with
68k Stack trace:
Address of 68k IP 0x5b42deea not found

As mentiond before the <libraries/iff.h> file coming with the archive mentions WORD * for the second argument of GetColorTab() where as well the Example as the Autodoc(?) ifflib.doc specify UWORD *

As this last doc may be generated automatically and as this type is coherent with the IGraphics->LoadRGB4 argument i did try to generate the IFF OS4 files having modified <libraries/iff.h> to comply with this view.

I gave the command sequence i used in a previous message, also pointing out that i got a warning message in the first command

13.Datas:Gui4Cli/Dev/iff_library> fd2pragma iff_lib.fd CLIB iff.h SPECIAL 112 //=> iff_lib.sfd
SourceFile: iff_lib.fd
Warning 79 in line 193 of clib file: Unknown type of argument 1 (IFFL_HANDLE) handled as int

In the end the compilation of iff.l.main failed.

Would you be so kind as to spell out what sequence of commands you used?

One of the questions I have is if and how the “iff.lib” is used in this sequence?

I noted, reading iff.i which gives function offsets explicitly, that those offsets are defined in iff.lib
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: iff.library iff.l.main stub existing?

Post by salass00 »

JosDuchIt wrote:@salass00
Does the EasyExample.c works for you ?
I've changed the EasyExample program for you so it compiles on OS4:
http://dl.dropbox.com/u/26599983/iff_lib_examples.7z

Note that as the program accesses the screen->BitMap and probably assumes planar format for bitmap as well you will need to enable the "Planar screens on RTG" option in GUI prefs (it's listed under "Controls") or it will crash with several DSIs and not work at all. With "Planar screens on RTG" enabled it seems to work perfectly fine here though (I used some example pics from DPaint 3 art disk to test with).

Edit:
Ported AnimExample as well. As with EasyExample it will need the "Planar screens on RTG" option enabled in order to work.
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

@salass00

thank you very much
Easyexample works at home too, but with a distorted view of the images
I have a very slow intgernet connection and will do more tests when i can download some more material , within a few days, as i have other work to do here
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

Easyexample works at home too, but with a distorted view of the images
Back in front of my SAM at home: The .ilbm files i tested all came from AmiCygnix themes, and all were distorted.

I now tested files from other sources and all are OK. animexample works ok too.

Thanks again
Post Reply