Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
164 user(s) are online (142 user(s) are browsing Forums)

Members: 0
Guests: 164

more...

Support us!

Headlines

 
  Register To Post  

Newbie questions, SAS/C OS3 code to OS4 gcc conversion
Just popping in
Just popping in


See User information
I find relativelly simple intresting code.

I'm stuck in basics.

#define __USE_SYSBASE 1 is brobably SAS/C-only. Wjhat it does and what it needs on new gcc env?

Then there is two obsolete OS3 code. Wich mix probably that first problem...

tasklist[0] = &SysBase->TaskWait;
tasklist[1] = &SysBase->TaskReady;

They gives errors:

setpri.c:98:26: error: 'struct Library' has no member named 'TaskWait'
tasklist[0] = &SysBase->TaskWait;
^~
setpri.c:99:26: error: 'struct Library' has no member named 'TaskReady'
tasklist[1] = &SysBase->TaskReady;


How they are implemented on OS4 ?

I try to understand things way as it is intrest me. Reading general c-manual is bit like eat dry wood or something...

Peg2 1GHz G4, 1Gb mem, Radeon 9250
Go to top
Re: Newbie questions, SAS/C OS3 code to OS4 gcc conversion
Just popping in
Just popping in


See User information
@Mlehto

Quote:
#define __USE_SYSBASE 1 is brobably SAS/C-only. Wjhat it does and what it needs on new gcc env?

That tells the SAS/C code to get the address of ExecBase from a global variable called SysBase, instead of getting it by reading address 4. GCC always uses SysBase, so this definition is not needed (but it does no harm if present).

Quote:
setpri.c:98:26: error: 'struct Library' has no member named 'TaskWait'
tasklist[0] = &SysBase->TaskWait;
^~

By default the OS4 includes define SysBase as a generic pointer to struct Library, rather than what it actually is, a pointer to struct ExecBase. That allows calls like OpenLibrary() and CloseLibrary() to work without needing to cast to and from a pointer to whatever that library's base is called.

But of course struct Library has no TaskWait and TaskReady fields, so you get errors. One way to fix this is to cast SysBase to a pointer to ExecBase before referencing those fields. Another way is to add the definition

#define __USE_BASETYPE__

before including anything; that causes SysBase to be defined as pointing to struct ExecBase, which will let the code reference ExecBase fields like TaskWait and TaskReady without a cast.

Note that those two fields of ExecBase are marked as obsolete, so they may not do anything useful even after you get the code to compile. There are enough differences between OS4 and OS3 that OS3 code that pokes around in ExecBase is unlikely to work properly under OS4.

Quote:
Reading general c-manual is bit like eat dry wood or something.

Some people feel that same way about writing code.

Go to top
Re: Newbie questions, SAS/C OS3 code to OS4 gcc conversion
Just popping in
Just popping in


See User information
@msteedQuote:
msteed wrote:@Mlehto

Quote:
#define __USE_SYSBASE 1 is brobably SAS/C-only. Wjhat it does and what it needs on new gcc env?



That tells the SAS/C code to get the address of ExecBase from a global variable called SysBase, instead of getting it by reading address 4. GCC always uses SysBase, so this definition is not needed (but it does no harm if present).

Ok, thanks. Tried to find gcc equivalent and didnt find any. If it is there automagically, it explains. And makes things little easier.



Quote:
setpri.c:98:26: error: 'struct Library' has no member named 'TaskWait'
tasklist[0] = &SysBase->TaskWait;
^~

By default the OS4 includes define SysBase as a generic pointer to struct Library, rather than what it actually is, a pointer to struct ExecBase. That allows calls like OpenLibrary() and CloseLibrary() to work without needing to cast to and from a pointer to whatever that library's base is called.

But of course struct Library has no TaskWait and TaskReady fields, so you get errors. One way to fix this is to cast SysBase to a pointer to ExecBase before referencing those fields. Another way is to add the definition

#define __USE_BASETYPE__

before including anything; that causes SysBase to be defined as pointing to struct ExecBase, which will let the code reference ExecBase fields like TaskWait and TaskReady without a cast.

Note that those two fields of ExecBase are marked as obsolete, so they may not do anything useful even after you get the code to compile. There are enough differences between OS4 and OS3 that OS3 code that pokes around in ExecBase is unlikely to work properly under OS4.


Is seems to work with #define __USE_BASETYPE__. At least it seems. It works as 68k equivalent and really sets priority, setpri NAME/A,PRIORITY/A/N,Q=QUIET/S:
. Who knows, how well it works with OS4 in reality. At least system is still up and running... :)

Thanks really :)

Wanted to set enhancer clock priority bit up, because clock freezes under heavy load. It doesnt follow priority set by icon, at start it turns value on icon back to zero and runs at priority 0.

Yes, TaskWait and TaskReady are marked as obsolete, but didnt find any new functions to same operation. So thats probably why they still works (?).



Quote:
Reading general c-manual is bit like eat dry wood or something.

Some people feel that same way about writing code.



At least if you write examples from ANSI-C books, they are bit more dry than desert... :D

Problem is to understand coding related english first and then turn it to programming somehow. Not very easy.

Anyway it is intresting to learn new things and coding with Amiga has been on my list long time.

Thank you for you help, I really apprciate.

Peg2 1GHz G4, 1Gb mem, Radeon 9250
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project