[comp.sys.mac.programmer] problem with PenPat

chou@cs.washington.edu (Pai Chou) (05/20/91)

I have problems with PenPat() in THINK C's console window.
If I don't call PenPat() at all, my Line() and LineTo() calls
will draw lines correctly in the console window.

But if I call PenPat(black) or any pattern at all,
then the same Line() or LineTo() will not draw anything.
I also tried PenPat(&black)  but it doesn't make a difference.
My program does not crash in either case.

Is there something special I should do about calling PenPat()
in the console window?  I am using THINK C version 4.5,
but my ANSI library is from 4.0 with the scanf patch.
Thanks in advance.

Pai Chou
chou@june.cs.washington.edu

stevec@Apple.COM (Steve Christensen) (05/20/91)

chou@cs.washington.edu (Pai Chou) writes:
>I have problems with PenPat() in THINK C's console window.
>If I don't call PenPat() at all, my Line() and LineTo() calls
>will draw lines correctly in the console window.
>
>But if I call PenPat(black) or any pattern at all,
>then the same Line() or LineTo() will not draw anything.
>I also tried PenPat(&black)  but it doesn't make a difference.
>My program does not crash in either case.
>
>Is there something special I should do about calling PenPat()
>in the console window?  I am using THINK C version 4.5,
>but my ANSI library is from 4.0 with the scanf patch.
>Thanks in advance.

For C you should be using PenPat(&qd.black).  The Inside Mac documentation was
written primarily for Pascal which automatically handles the "&qd." part...

steve

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Steve Christensen			Never hit a man with glasses.
  stevec@apple.com			Hit him with a baseball bat.

hairston@henry.ece.cmu.edu (David Hairston) (05/21/91)

[chou@cs.washington.edu (Pai Chou) writes:]
[] I have problems with PenPat() in THINK C's console window.
[] ...
[] But if I call PenPat(black) or any pattern at all,
[] then the same Line() or LineTo() will not draw anything.
[] I also tried PenPat(&black)  but it doesn't make a difference.
[] My program does not crash in either case.

[stevec@Apple.COM (Steve Christensen) writes:]
[] For C you should be using PenPat(&qd.black).  The Inside Mac documentation
[] was written primarily for Pascal which automatically handles the "&qd."
[] part...

that's MPW C ... Think C defines Pattern:

typedef unsigned char Pattern[8]

and uses:

extern Pattern black;

and so on.  so the call in Think C is PenPat(black), for example.
however, in special cases, the compiler ignores the address operator
on an array variable, thus PenPat(&black) is equivalent to
PenPat(black).

as to why this doesn't work in the console window, i dunno,  are you
setting the port to that window?

  -dave-  
hairston@henry.ece.cmu.edu