Welcome, Guest. Please login or register.

Author Topic: Blllludy devices!  (Read 5857 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Blllludy devices!
« on: January 28, 2003, 04:36:16 PM »
do any of you know of any typeos(?) in the ARKRM: Devices?

virtually whenever i try to open/close a device i get so many compiler errors!

is this example from page 89 of the 3rd edition correct?


struct MsgPort *GameMP;
struct IOStdReq *GameIO;
if(!(GameMP=CreatePort("RKM_game_port",0)))
cleanexit();
if(!(GameIO=CreateExtIO(GameMP,sizeof(struct IOStdReq))))
cleanexit();
if(error=OpenDevice("gameport.device",1,GameIO,0))
cleanexit();


i get pretty much the same problems with other chapters
 could sombody plese give me an example as to how a device should be opened and closed?
somthing simple all in the main function?
 :-)
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #1 on: January 29, 2003, 08:36:57 PM »
probably #include clib/alib_protos.h

i did get MANY errors!
ill take a look, and comeback with the errors later!
 :-)
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #2 on: January 31, 2003, 06:36:28 PM »
Quote

Karlos wrote:
Quote

iamaboringperson wrote:
probably #include clib/alib_protos.h

i did get MANY errors!
ill take a look, and comeback with the errors later!
 :-)


You sure that shouldn't have been #include ?

I realise that's probably just a typo in your post. I'll have a look at it when I have a mo. I havent got round to implementing gameport code in my existing work just yet but avoiding potential problems in advance always worth the effort..

Oh, a handy hint when dealing with the amiga's IO stuff is to define a union of IO pointer types for use with all the different IO functions. It saves lots and lots of casting which is often a source of silly compiler errors...

heheh, that was a typo!
and i did have
still getting errors though :-(

so does anybody have a solution for any kind of device?
just somthing simple?
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #3 on: February 01, 2003, 03:33:44 AM »
Quote

Steady wrote:
Hi there Iamaboringperson,

   Can you please list the error messages you are getting so we can see what is going on. I'm curious to see what they are.

ok, ive been using Storm C V3, i was mucking around to try and get it working, i realised i couldnt easily output the errors straight into a file, so i switched to Lattice C(SAS/C), and guess what? no errors! LC has no problems with that part of the code! so im guessing its either Storm/C's fault, or, a problem with the includes!   but the includes i use for storm C, and lattice C are virtually the same, not in the same directory, but the same source

but i would still prefer to use Sorm C, so here is whats wrong in a bit more detail:
NO linker errors!
no problems with includes not found
virtually anywhere GameIO, is found as an argument for a function there is an Illigal Argument Error! and my code is basically the same as in my previous post
its also basically the same as another piece of example code from the developer CD
so i dont know what the hell is going on?  :-?
any help? :-?  :-?  :-?  :-?  :-?
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #4 on: February 01, 2003, 07:13:21 PM »
@Steady
i had a bit of a go with casting for SOME of it, but it was getting too frustrating! i thought it shouldnt need it, so i gave up  :-(  it was too frustrating to be mucking around with for all that time, and i couldnt think!
but thanks!! ill try that out!
 :-)  :-)  :-)  :-)  :-)
i discoverd last night that the example program "absolute_joystick.c" came up with the same errors, so probably for the same reason
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #5 on: February 01, 2003, 08:41:09 PM »
Quote

Hardboy wrote:
Since you are using StormC V3, I guess you´ll have the dev. CD. All example code on the dev. CD, has been adjusted to compile with StormC V3. Therefore you should load the example code directly from the CD instead of typing it in...

thats where it came from :-)
i didnt type it in!

my includes did come of the CD, but i think it might be more to do with storm c, since the ones i use for lattice c are from the same source
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #6 on: February 02, 2003, 03:49:51 AM »
@Steady
no, i dont think its casting anymore :-(
i tried some of your casting aswell as alot of mine, still errors! basically the same errors, i think they were exactly the same :-(

perhaps its the configuration
or perhaps i should be using the includes that came with Storm C?
Storm C users: do you use the includes of the Dev CD? all of them? or some or all of the Storm C includes(assuming it has any)

i might reinstall, reconfigure, and if all that fails ill pick up my A4000T, carfuly and gently lift it up over my shoulders, and throw it against the wall!!
 :-x  :-x  :-x  :-x
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #7 on: February 02, 2003, 08:26:36 PM »
Quote

ncafferkey wrote:
That should be #include and for compatibility with all compilers.

i suppose before i destroy my beloved A4000T, ill try that too!
 :-(
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blllludy devices!
« Reply #8 on: February 07, 2003, 07:47:35 PM »
Quote

Steady wrote:
I had a quick play and think I've found the source of your problem. It is basically as Karlos pointed out earlier. Casting is your problem.

amiga.lib's CreateExtIO function is expecting to return an IORequest pointer. You are expecting an IOStdReq pointer.

exec.library's OpenDevice function is causing the same problem for you, but in reverse. You should cast as follows assuming your variables are still defined in the same way:

if(!(GameMP=CreatePort("RKM_game_port",0)))
   cleanexit();

if(!(GameIO=(struct IOStdReq *)CreateExtIO(GameMP,sizeof(struct IOStdReq))))
   cleanexit();

if(error=OpenDevice("gameport.device",1,(struct IORequest *)GameIO,0))
   cleanexit();


Hope that helps.

ok, thanks steady! after much #### ing around, i just ripped my code out stuck yours in, and it worked
but now i have another problem, which is the same thing i had a year ago when i was trying to use "keyboard.device"
it opens ok, but when it finaly flushes and closes the thing, the whole machine crashes, ive tried to use storms debug modes, but the machine will only crash
ill try to get the code here soon if that will help, but its basically whats found in the ARKRMs, except with the extra casting stuck in
 :-)
last time with the keyboard stuff, i just commented-out the device close bits and exited the program without any of that clean up!!  :-o
but this time i want to do things properly of course