[comp.sys.apple2] Starting/Shutting Tools Down

toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (01/14/91)

jpenne@ee.ualberta.ca (Jerry Penner) writes:

>I'm using Orca/C v 1.1 and to be quick my program looks like this:

Your initTools and shutDownTools declarations are OK, but they are not
necessarily the problem. Are you using any #pragma optimizes, because you
can turn the stack repair code off -- which means that ANY ints-instead-of-
longs will do you in.

also make sure you declare argc as int and argv as char ** or char *[]. Sorry
this is dumb-dumb checking but I've caught myself for things like it before.

>int	main( argc, argv )	/* I TRIED void'ing THESE w/ same results */
>{
>	if (initTools())
>	{
>		shutDownTools();
>		exit();		/* This part has never executed as initTools()
>				   hasn't got any errors for me yet */
>	}

>	/* DRAW a simple graphic */

>	shutDownTools();
>				<------ This is where it hangs
>}

ok, this should also be fine. I'd suggest adding the variable int sp; and the
following code just inside the enclosing brackets of main:

asm	{
	tsc
	sta	sp
	}
printf("stack pointer is $%x\n", sp);

If you see both printf's and the values are different then something is
definately wrong somewhere. You may want to try an isolate-and-test strategy
to figure out where the offending statement is -- and it might be a library
function but keep your mind open.

>Anyhow, I will try startdesk and enddesk but I still wish I could do it
>my way.  I like knowing how everything works in my programs.

My sentiments exactly.

Todd Whitesel
toddpw @ tybalt.caltech.edu

jeffh@HyperMail.apple.com (Jeff Holcomb) (01/15/91)

In article <1991Jan13.173303.3516@ee.ualberta.ca> jpenne@ee.ualberta.ca 
(Jerry Penner) writes:
> I'm using Orca/C v 1.1 and to be quick my program looks like this:
> 
--- program lines cut ---

Could you be receiving an error in your shutDownTools routine?  Are you 
using the StartUpTools/ShutDownTools combination, or are you starting up 
each tool by itself?  If you have GSBug, you can step through your code, 
look at the stack before calls, and track down the problem fast.

___________________________________________________________________________
Jeff Holcomb                 Internet: jeffh@HyperMail.apple.com
                            AppleLink: jeffh@HyperMail.apple.com@INTERNET#
                                GEnie: A2.JEFFH
Contracting for Apple ATG       Voice: (408) 974-0841

         My opinions are not necessarily those of Apple.  :-P
___________________________________________________________________________

jpenne@ee.ualberta.ca (Jerry Penner) (01/15/91)

In article <11712@goofy.Apple.COM> jeffh@HyperMail.apple.com (Jeff Holcomb) writes:
>In article <1991Jan13.173303.3516@ee.ualberta.ca> jpenne@ee.ualberta.ca 
>(Jerry Penner) writes:
>> I'm using Orca/C v 1.1 and to be quick my program looks like this:
>> 
>--- program lines cut ---
>
>Could you be receiving an error in your shutDownTools routine?  Are you 
>using the StartUpTools/ShutDownTools combination, or are you starting up 
>each tool by itself?  If you have GSBug, you can step through your code, 
>look at the stack before calls, and track down the problem fast.
>
>___________________________________________________________________________
>Jeff Holcomb                 Internet: jeffh@HyperMail.apple.com

I'm starting up each tool separately since I don't have Toolbox Ref Vol 3
yet.  I probably won't try to debug this until the weekend since school
is keeping me busy but thanks very much to everyone who has responded.  I've
got a bunch of good ideas to try to track this down.  I will let the net
know what was messing up.
-- 
-------------
    Jerry Penner	alberta!bode!jpenne	Edmonton, Alberta, Canada