Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
2 user(s) are online (1 user(s) are browsing Forum)

Members: 1
Guests: 1

ross, more...

Browsing this Thread:   1 Anonymous Users





Datatypes supported method listing

Joined:
2009/4/16 23:03
From Liancourt Saint Pierre - France
Group:
Member
Posts: 1118
Offline
Hi,

I'm trying to get dynamically the list of picture datatypes supporting DTM_WRITE method.
I've looked into AddDataTypes source code from Aros repository to have some hints on how to obtain this.

I've built a test application, that should list all datatypes from GID_PICTURE group and print the supported methods :
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/datatypes.h>
#include <proto/utility.h>
#include <datatypes/pictureclass.h>

struct DataTypesList
{
    
struct SignalSemaphore  dtl_Lock;
    
struct List            dtl_SortedList;
    
struct List            dtl_BinaryList;
    
struct List         dtl_ASCIIList;
    
struct List            dtl_IFFList;
    
struct List            dtl_MiscList;
    
ULONG            dtl_LongestMask;
    
struct DateStamp        dtl_DateStamp;
};

struct CompoundDataType
{
    
struct DataType  DT;
    
ULONG         FlagLong;
    
ULONG         ParsePatSize;
    
UBYTE        *ParsePatMem;
    
UBYTE        *DTCDChunk;
    
ULONG         DTCDSize;
    
BPTR         SegList;
    
BOOL (*Function)(struct DTHookContext *dthc);
    
ULONG         OpenCount;
    
struct DataTypeHeader DTH;
};

int main(void)
{
    
int    result RETURN_FAIL;
    
    
struct DataTypesList *dtl NULL;
    
struct NamedObject   *no  NULL;
    if((
no = (struct NamedObject   *)FindNamedObject(NULL"DataTypesList"NULL)))
    {
        
dtl = (struct DataTypesList*)no->no_Object;
        
ReleaseNamedObject(no);
        if(
dtl != NULL)
        {
            
struct Node *node=dtl->dtl_SortedList.lh_Head;
            while(
node->ln_Succ != NULL)
            {
                
// sorted list points to DT.dtn_Node2 ....
                
struct CompoundDataType *cdt;
                
struct DataTypeHeader *dth;

                
cdt=(struct CompoundDataType *)(node-1);
                
dth=cdt->DT.dtn_Header;

                if (
dth->dth_GroupID == GID_PICTURE)
                {
                    
Object *DTImage NULL;
                    
ULONG *Methods NULL;

                    
Printf("%s, "%s"n"dth->dth_BaseNamedth->dth_Name);

                    
DTImage NewDTObject((APTR)NULL,
                                          
DTA_SourceTypeDTST_RAM,
                                          
DTA_BaseName, (IPTR)dth->dth_BaseName,
                                          
TAG_DONE);
                    
                    if (
DTImage)
                    {
                        
Methods GetDTMethods(DTImage);
                            
                        while(*
Methods 0)
                        {
                            switch(*
Methods)
                            {
                                case 
DTM_FRAMEBOX         Printf("tDTM_FRAMEBOX        n"); break;             
                                case 
DTM_PROCLAYOUT       Printf("tDTM_PROCLAYOUT      n"); break;                 
                                case 
DTM_ASYNCLAYOUT      Printf("tDTM_ASYNCLAYOUT     n"); break;                 
                                case 
DTM_REMOVEDTOBJECT   Printf("tDTM_REMOVEDTOBJECT  n"); break;                     
                                case 
DTM_SELECT           Printf("tDTM_SELECT          n"); break;
                                case 
DTM_CLEARSELECTED    Printf("tDTM_CLEARSELECTED   n"); break;
                                case 
DTM_COPY             Printf("tDTM_COPY            n"); break;
                                case 
DTM_PRINT            Printf("tDTM_PRINT           n"); break;
                                case 
DTM_ABORTPRINT       Printf("tDTM_ABORTPRINT      n"); break;
                                case 
DTM_NEWMEMBER        Printf("tDTM_NEWMEMBER       n"); break;
                                case 
DTM_DISPOSEMEMBER    Printf("tDTM_DISPOSEMEMBER   n"); break;
                                case 
DTM_GOTO             Printf("tDTM_GOTO            n"); break;
                                case 
DTM_TRIGGER          Printf("tDTM_TRIGGER         n"); break;
                                case 
DTM_OBTAINDRAWINFO   Printf("tDTM_OBTAINDRAWINFO  n"); break;
                                case 
DTM_DRAW             Printf("tDTM_DRAW            n"); break;
                                case 
DTM_RELEASEDRAWINFO  Printf("tDTM_RELEASEDRAWINFO n"); break;
                                case 
DTM_WRITE            Printf("tDTM_WRITE           n"); break;
                                case 
PDTM_WRITEPIXELARRAY Printf("tPDTM_WRITEPIXELARRAYn"); break;                      
                                case 
PDTM_READPIXELARRAY  Printf("tPDTM_READPIXELARRAY n"); break;                      
                                case 
PDTM_SCALE           Printf("tPDTM_SCALE          n"); break;
                                default:
                                    
Printf("%tMethod %08lX supportedn", *Methods); break;
                            }
                            
Methods++;
                        }
                        
DisposeDTObject(DTImage);
                    }
                }
                
node node->ln_Succ;
            }
            
result RETURN_OK;
        }
    } 
    return 
result;
}


However I have some issues:
1. why do I have to use internal structures that are not exposed by the librariy/includes ?
2. Is there a more system friendly way to do this?
3. The list of supported methods doesn'l look right, what am I doing wrong?

Thanks for the help.

Posted on: 2/25 1:46
_________________
Yannick
http://www.dusabledanslherbe.eu/AROSPage
Transfer the post to other applications Transfer


Re: Datatypes supported method listing

Joined:
2004/10/30 17:13
From Ireland
Group:
Member
Posts: 2570
Offline
Quote:

Yannickescu wrote:

1. why do I have to use internal structures that are not exposed by the librariy/includes ?


Maybe the original developers didn't see a need to get a list of datatypes. Why do you need to do this?

Quote:

2. Is there a more system friendly way to do this?


Not that I'm aware of.

Quote:

3. The list of supported methods doesn'l look right, what am I doing wrong?


The AutoDocs say that the array is terminated with ~0 (0xffffffff), not zero.

Posted on: 2/26 11:08
Transfer the post to other applications Transfer


Re: Datatypes supported method listing

Joined:
2009/4/16 23:03
From Liancourt Saint Pierre - France
Group:
Member
Posts: 1118
Offline
Quote:

ncafferkey wrote:
Quote:

Yannickescu wrote:

1. why do I have to use internal structures that are not exposed by the librariy/includes ?

Maybe the original developers didn't see a need to get a list of datatypes. Why do you need to do this?

I'd like to offer a saving option listing all datatypes supporting DTM_WRITE method.

Quote:

Quote:

3. The list of supported methods doesn'l look right, what am I doing wrong?


The AutoDocs say that the array is terminated with ~0 (0xffffffff), not zero.

Oh thanks, I went to fast this time.


Posted on: 2/26 11:56
_________________
Yannick
http://www.dusabledanslherbe.eu/AROSPage
Transfer the post to other applications Transfer






You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4278
2 magorium
magorium
4095
3 phoenixkonsole
phoenixkonsole
3887
4 nikolaos
nikolaos
3670
5 deadwood
deadwood
2923
6 ncafferkey
ncafferkey
2570
7 mazze
mazze
2200
8 clusteruk
clusteruk
2055
9 Kalamatee
Kalamatee
2009
10 damocles
damocles
1789
© 2004-2017 AROS Exec