Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
120 user(s) are online (74 user(s) are browsing Forums)

Members: 1
Guests: 119

nbache, more...

Headlines

Forum Index


Board index » All Posts (JosDuchIt)




Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


@ZeroG

Ok i understand how you reason about this.
Obviously i am not working with system doc yet with enough experience.

Joseph

Go to top


Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


@tboeckel
As said before i have a stringgadget (not mine) hook working, now it's just a question that i don'tunderstand fully the documentation as synthesized in my last mail: there is still a gap between the copy of
GTST_EditHook to StringExtend->EditHook >field.
and the production of the SGWork structure needed by the hookfunction
ULONG INTERRUPT SAVEDS TextInHook(struct Hook *hook, struct SGWork *sgw, ULONG *msg)

Thanks for the link
Joseph

Go to top


Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


@ZeroG

This was very helpfull, thanks

I do understand the Backfiil hook now that does not work yet,

I do not fully understand the GTST Edithook, but it worked, i just wantrd to compare both.

>A)
>The gadtools autodocs says that GTST_EditHook will be copied to the StringExtend->EditHook >field.

I read this which is far less clear
"==========================================
GTST_EditHook (struct Hook *) - Hook to use as a custom string gadget
edit hook (StringExtend->EditHook) for this gadget. GadTools will
allocate the StringExtend->WorkBuffer for you. (defaults to NULL)
"==========================================


>If you now make a quick search in the includes you will find the file intuition/sghooks.h. Have >you read it?
I find the stuff below, however this does not tell me how my hookfunction gets its SGW argument. ??


"===================================

struct StringExtend
{
/* display specifications */
struct TextFont *Font; /* must be an open Font (not TextAttr) */
UBYTE Pens[2]; /* color of text/backgroun */
UBYTE ActivePens[2]; /* colors when gadget is active */

/* edit specifications */
ULONG InitialModes; /* initial mode flags, below */
struct Hook *EditHook; /* if non-NULL, must supply WorkBuffer */
STRPTR WorkBuffer; /* must be as large as StringInfo.Buffer*/

ULONG Reserved[4]; /* set to 0 */
};

struct SGWork
{
/* set up when gadget is first activated */
struct Gadget *Gadget; /* the contestant itself */
struct StringInfo *StringInfo; /* easy access to sinfo */
STRPTR WorkBuffer; /* intuition's planned result */
STRPTR PrevBuffer; /* what was there before */
ULONG Modes; /* current mode */

/* modified for each input event */
struct InputEvent *IEvent; /* actual event: do not change */
UWORD Code; /* character code, if one byte */
WORD BufferPos; /* cursor position */
WORD NumChars;
ULONG Actions; /* what Intuition will do */
LONG LongInt; /* temp storage for longint */

struct GadgetInfo *GadgetInfo; /* see cghooks.h */
UWORD EditOp; /* from constants below */
};
========================================


B)
>A WA_BackFill hook is, as the autodoc says, a LayerHook that is described in Layers.doc
>InstallLayerHook() as

>void LayerHookFunc(struct Hook *, struct RastPort *, struct BackFillMessage *);

>BTW: The InstallLayerHook() autodocs needs a update, it still has a 68k-asm example.

I found this
======================
/*
* The message a backfill hook receives
*/
struct BackFillMessage
{
struct Layer *Layer;
struct Rectangle Bounds;
LONG OffsetX;
LONG OffsetY;
};
=======================

In the source however i found

struct BackFillData
{
struct Layer *l;
struct Rectangle bounds;
LONG offx, offy;
};

which closely matches BackFillMessage

and the hookfunction referring to the latter
ULONG INTERRUPT SAVEDS do_backfill(struct Hook *h, struct RastPort *rp, struct BackFillData *bfd)

This was the source of my bewildering: i did not find this structure BackFillData in th includes, and i did not see where it was initialised.

Joseph

Go to top


Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


@abalaban

Hello, i could solve the first problem , a string gadget hook, with the help you provided, especially that there was no need for the use of CallHookPkt since the call was done by giving the string gadget the appropriate hooktag.

I had to jump into the water though not understanding really what i was doing. I changed the soutce as folows

I commented out the functions hookEntry and InitHook belw

/******** Load Registers **********/
/* OS3
ULONG ASM hookEntry(REG(a0) struct Hook *h, REG(a2) VOID *o, REG(a1) VOID *msg)
//OS4E expected ')' before 'struct'
// macro "REG" requires 2 arguments, but only 1 given
{
return ((*(ULONG(*)(struct Hook *, VOID *, VOID *))(h->h_SubEntry))(h, o, msg));
}
######*/
/********* Initialise Hook **********/
/* OS3 #######
void InitHook(struct Hook *h, ULONG (*func)(), void *data)

{ if (h)
{ h->h_Entry = (ULONG(*)()) hookEntry;
h->h_SubEntry = func;
h->h_Data = data;
}
}
#### */



For the string gadget i had

1) the gadget tag
GTST_EditHook, tid->hk

2) the hookfunction
ULONG INTERRUPT SAVEDS TextInHook(struct Hook *hook, struct SGWork *sgw, ULONG *msg)
// OS4E was __interrupt __saveds

3) the hook initialisation
///InitHook (&tid->hk, TextInHook, bt); replaced with

if (!(tid->hk = AllocSysObjectTags( ASOT_HOOK, ASOHOOK_Entry, TextInHook, ASOHOOK_Data, bt, TAG_DONE))
========
For the window backfill hook i had)

1) the window tag
tags[c].ti_Tag = WA_BackFill;
tags[c].ti_Data = (LONG)hk

2) thehookfunction

ULONG INTERRUPT SAVEDS do_backfill(struct Hook *h, struct RastPort *rp, struct BackFillData *bfd)

3) the hook initialisation
// InitHook (hk, do_backfill, NULL); /* initialise hook */OS3
if (!(hk=AllocSysObjectTags( ASOT_HOOK, ASOHOOK_Entry, do_backfill, ASOHOOK_Data, NULL, TAG_DONE)))

A. The textinhook works ok as described
One thing i don't understand is that TextInhook requires apart from the hook two other arguments, and in the initialisation only one is given (bt)
So i am guessing that the first struct SGWork is created during the initialisation and the second is passed as bt

I can only understand this if a TextinHook function has a template where the two first arguments are of types struct Hook and struct SGW

I would expect then to find this template in the SDK, but i don't find it.


B. The backfillhook does not work and i probably mixed up some pointerbusyness
Here however the 68k initialisation InitHook apart from the hook and the hookfunction has no additional argument (NULL) whereas the do_backfill hook function needs apart from the rastport, which i suppose the initialisation will provide, also a struct BackFillData that does not seem to be system type. How is the do_backfill function provided with this argument? (Or how iscould it be created during the hook initialisation,?)

I am not doubting yet that the 68k InitHook initialisation is wrong, since this source used to compile well for 68k

Clarification of the above would help mme greatly;

Joseph

Go to top


Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


Hi all

I am struggling with a window backfillhook.
Can you tell me what might be wrong here?


__USE_INLINE__

struct BackFillData
{
struct Layer *l;
struct Rectangle bounds;
LONG offx, offy;
};

struct BackFill
{
char mode; /* s=solid, p=pattern, i=icon, I=image */
SHORT apen, bpen;
LONG top, left, width, height;
struct DiskObject *dobj;
struct BitMap BM;
struct imginfo *img;
};



ULONG INTERRUPT SAVEDS do_backfill(struct Hook *h, struct RastPort *rp, struct BackFillData *bfd)


int makewindow(struct BackFill *bf,) //??? args
{
struct TagItem *tags;
struct window *wn=NULL;
if (!(hk=AllocSysObjectTags( ASOT_HOOK, ASOHOOK_Entry, do_backfill, ASOHOOK_Data, NULL, TAG_DONE))) //OS4 Duch Added
return (0)


tags[c].ti_Tag = WA_BackFill;
tags[c].ti_Data = (LONG)hk


wn = OpenWindowTagList (NULL, tags)

etc

}
I derived theis from analogy with teh TextINHool (gadget string hook above. and from the original 68 k source.

What i don't understand is how the bfd are uused or found . I don't even find in the source where its values are set.
Does the do_backfil() hook function follows some template known to the system? If yes where is this described?

Thanks for help and calrification.

Joseph

Go to top


Re: Math link library for gcc
Just can't stay away
Just can't stay away


@tboeckel

This is what i used
gcc guis:Dev/G4C_Test/guiNotCleaned.c -xc -gstabs -lauto -lm -ldebug -o DuchID:G4T
Is there something wrong here?

The calculator worked OK when the source was compiled for 68k using -lmieee

Joseph

Go to top


Math link library for gcc
Just can't stay away
Just can't stay away


Hello,
in porting Gui4Cli to OS4 i just observed that a calculator written in Gui4Cli language is not working any more (eg 1/3 = 0)

I did use with gcc the -lm option since -lmieee (used for 68k) does not seem to exist in my system.

What am i supposed to do ?

Thanks for your help


Joseph


Edited by JosDuchIt on 2009/11/13 10:10:35
Go to top


Re: MUI TextEditor 15.29 used with YAM
Just can't stay away
Just can't stay away


@tboeckel

thank you for the reminder. I did normally get notice of update, but not for these last versions ./ I'll checj that.
@gurus2000 thanks for the URL

All the best.

Joseph

Go to top


MUI TextEditor 15.29 used with YAM
Just can't stay away
Just can't stay away


Hello,

YAM was not usable anymore on my SAM. Editing a mail generated a crash whenever you typed at a decent speed. I reverted from TextEditor 15.29 top 15.27 and it stopped crashing.
What about 15.28?
What about 15.30 will it be better?

Joseph

Go to top


Just can't stay away
Just can't stay away


@Chris

@Chris


I just did.

I did not notice it before because there is apparently no link to it.
In fact it took a while before i saw the link 'advanced search'
I scrolled till i saw 'search'.
Since i think this is an important tool, it would be good to have it higher up in
the left frame or even in the title bar (so the occasional user finds it readily)
The present link to 'advanced search' however does not point to the searchpossibility you mention, but probably to an earlier less performant possibility.

It is quite good as it is now to find a thread. I found the "OS4.1 bugs" thread. 'which was not possible with the version pointed at from the left frame.
Next thing i wanted to do is searching in this quite long thread only for 'input device' since i have frequent ' problems there.

i was able to decide that there is no report on an 'input device' problem doing a far more global search however than in the thread "OS4.1 bugs" So i think it would be nice to be able to specify a thread to be searched and independently the searchwords.


Thanks for the link


Joseph

Go to top


Just can't stay away
Just can't stay away


Hello i was searching for an OS4 bug list to see if bugs i experience were allready reported. I couldn't find it using the search possibility of this site.

I would be great if we could search in a given forum, in the title's if the threads. Of course also in he messages.

Please note that this site is allready very helpfull and nice to use. Just a suggestion

Joseph

Go to top


Migration of Gui4Cli to OS4 Dbg questions
Just can't stay away
Just can't stay away


Hi,
the migration of D. Keletsekis Gui4Cli to OS4 is progressing well.
For now it is allready much more stable on my SAM than the 68k version.
The presence of the gdb debugger in the SDK was one of the factors that convinced me the job would not be beyond my possibilities.

It did not help a bit till the source compiled though, and after that i was rather disappointed. I was never able to use breakpoints as a substitute to debugprint statements in the source.
I expected the 'source' command to be usefull,(having a number of petentially usefull breaks in one document), but i never saw more than the first break. using 'continue', 'step' or 'next' was rather impredicatable.
When having a crash, the stacklog proved to be very usefull, but the rest remained chinese to me. Trying to attach GDB after a crash generally resulted in gdb freezing and or in a general freeze.
As i would like to port Gcview (a Gui4Cli addon for picture manipulation) as well, i would like to hear more about your experience with gdb.
Can you make more out of it?


Joseph

Go to top


OWB 3.15 and Yahoogroups
Just can't stay away
Just can't stay away


Hello, i tried to post an answer on a yahoogroups message without succes.
When hitting the send button a message pops up asking you if you are interested in additionala yhoo services. After answering negatively, the message disappears but the page freezes.

BTW with IBrowse the message does not show up, but the the post seems to be succesfull.

Similar experience?


Joseph

Go to top


Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


@abalaban
Thanks for your help

The source is compiling just now.

I had a hell of a lot of time to remove some error "expected something at end of input." The missing brace was not in the the file the error pointed to (containing main() but in some other file included.
I also will from now on disapprove using the /* */ pair for just some line comment.

I also had to use AllocSysObjectTags since using __USE_INLINE__ makes the compiler think you are working with a macro with two arguments.


Thanks again

Joseph

Go to top


Re: Migration to OS4 Hooks
Just can't stay away
Just can't stay away


@Rigo and others

@Rigo
and others:
Rght now i want to understand fully the OS4 way of doing things and have an OS4 source up and running. I did have a look at the SDI headers and right now it is a complementary source of confusion in my situation.

The hook concerned is a custom stringgadget hook.


After much labour investigating available documentation, headers and autodocs and the source ( which i did not develop ) my main question remains the CallHookPkt function: I don't know where to insert it. I don't find anything similar in the OS3 source.

I understand there are three things to do
- write a Hook function, this function exists and i think it will do (no errors)
<ULONG INTERRUPT SAVEDS TextInHook(struct Hook *hook, struct SGWork *sgw, ULONG *msg)>

- Use AllocSysObject: i think i found the line to change in ttne InitGadgets function
InitHook (&tid->hk, TextInHook, bt);
will become
&tid->hk=AllocSysObject( ASOT_HOOK, ASOHOOK_Entry, func, ASOHOOK_Data, bt, TAG_DONE)
-lastly insert
CallHookPkt( &tid->hk, NULL, somemsg )
but where?

I understand the somemsg info will then be given as third argument to TextInHook/
As i don't see an equivalent to CallHookPkt in the source i am also in doubt which second argument i should use in CallHookPkt

All help much appreciated

Joseph

Go to top


Migration to OS4 Hooks
Just can't stay away
Just can't stay away


Hello,

In my migration efforts I am now trying to understand how to rewrite the hooks in order to be compliant with OS4 (notably using CallHookPkt)
The Migration guide gives information that is probably sufficient for an experienced programmer, but not for me.

I don't find an example or a hook in the SDK/examples drawer.
Could somebody point me to an example source?

Thanks

Joseph

Go to top


Re: Migration to OS4
Just can't stay away
Just can't stay away


@ChrisH

Hi Chris ,

I still have to look at portableE, which i wil do in time. As it is now i just am working on a program i didn't write and which i want to use under os4.1 in the debug mode so i can get rid of a number of problems in the 68k emulation mode. I guess a number of them which i never experienced under 68k orAmithlon could be due to the emulator;

The compiling errors still remaining have to do with hooks. I have included the SDI headers and hope this will prove the easier way to taccle this.

Joseph

Go to top


Re: Migration to OS4
Just can't stay away
Just can't stay away


@trixie

Of course... Well i am blushing not having seen this.
Thanks a lot

Joseph

Go to top


Re: Migration to OS4
Just can't stay away
Just can't stay away


Hello,

I get an error "two or more data types in declaration specifiers"
The compiled file is gui.c, which directly or indirectly includes all other files as .h files, even though most contain also specific function sets .
No makefile is used (yet)

gui.c includes
globals2.h in line 13
gui_protos.h 18
Font.h 86
and many other header files containing specific functions

globals2.h includes def/glob_GCmain.h

which defines the MyFont structure as:


struct MyFont // in def/glob_GCmain.h
{ UBYTE fontname[36];
struct TextAttr fta;
struct TextFont *ftf;
struct MyFont *next;
};


gui_protos.h prototypes the erroneous function??? as :
struct MyFont * openfont(UBYTE * , LONG , BOOL , UBYTE * ); // in gui_protos.h

The litigious function is defined in Font.h as:

int struct MyFont * openfont(UBYTE *name, LONG height, BOOL report, UBYTE *repstr) // this line gets the error " two or more data types in declaration specifiers"
{
struct MyFont ft, *fs;

// check if font exists, and return that if found..
for (fs = gd->topfont; fs; fs = fs->next)
{ if ((stricmp(fs->fta.ta_Name, name)==0) && (fs->fta.ta_YSize == height))
return (fs);
}

memset (&ft, 0, sizeof(ft));
ft.fta.ta_Name = name;
ft.fta.ta_YSize = height;

// open the font first, to make sure we can, then store it..
ft.ftf = (struct TextFont *)OpenDiskFont (&ft.fta);
if ((ft.ftf==NULL) && report)
{ Printf ("* %s: Could not open font %s - %ld", repstr, name, height);
return (NULL);
}

return (addfont(&ft.fta, ft.ftf));
}


There are other functions in Font.h using the MyFont structure and not raising this error.

Any help much appreciated

Joseph

Go to top


Re: Migration to OS4
Just can't stay away
Just can't stay away


@salass00

Thanks for the solution.

I did read about the __USE_BASETYPE__ possibility, but how to do it in 'OS4' mode was what i was looking for. I was not that sure about what __USE_BASETYPE__ acheaved neither.
I am?not a C programmer, just struggling my way through this OS4 migration.

Joseph

Go to top



TopTop
« 1 ... 52 53 54 (55) 56 »




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project