[comp.sys.mac.programmer] CommToolbox: What the heck is going on?

mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) (09/15/89)

If someone out there could explain the CommToolbox SendProc sample routine
on page 103 of the manual, I would greatly appreciate it.  As it stands
now:

1.  What is a WindowP?  And where is it declared?
2.  Where is the function GethConn defined (assuming it is a function and
    not a type cast)?  (And all of the other GethXXX routines.)
3.  Why is theConn assigned a value only to be
    reassigned a different value a couple of lines down?
4.  Why is theTerm even there when it is not ever used, just assigned to?
5.  Where is flags declared?

Here are some general comments:

1.  I have never before needed to pass a pointer to a handle (for example,
    in TMChoose).
2.  In Think's C, before I would get lots of "Illegal Pointer/Integer
    Combination" errors.  Now, with the prototypes, I get loads of these
    "Call of XXX does not match prototype" or something similar, which is
    not very helpful (since I then have to locate the prototype).
3.  Why do some buttons have to be clicked?  Is there no default on the
    return key?  (For example, after a connection has been made by the
    Modem tool.)
4.  A direct connection tool would be extremely helpful.

That should about cover the questions of the last 5 hours.  Thanks for any
help you can give.

-Michael

-- 
Michael Niehaus        UUCP: <backbones>!{iuvax,pur-ee}!bsu-cs!mithomas
Apple Student Rep      ARPA:  mithomas@bsu-cs.bsu.edu
Ball State University  AppleLink: ST0374 (from UUCP: st0374@applelink.apple.com)

kazim@Apple.COM (Alex Kazim) (09/15/89)

In article <10135@bsu-cs.bsu.edu> mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) writes:
>
>1.  What is a WindowP?  And where is it declared?

Ignore that mess.  You got source to our primary test app, which means
there's a whole lot of junk in there that's meant to give the toolbox
a hard time.  Try this one out:

FUNCTION TermSendProc(thePtr: Ptr;theSize: LONGINT;refCon: LONGINT;
					flags: INTEGER): LONGINT;	 
VAR
 theErr : CMErr;

BEGIN
 TermSendProc := 0;
 theErr := CMWrite(gConn,thePtr,theSize,cmData,FALSE,NIL,0,flags);  
 IF theErr = noErr THEN
  TermSendProc := theSize
 ELSE
  ; { some error handling here, maybe }
END;

gConn is a global, or you could use the refCon being passed in (it's
the terminal record's refcon) to access it.  flags does end-of-message
stuff for connection tools.  It should be documented a little better
in the next manual release

>
>Here are some general comments:
>
>1.  I have never before needed to pass a pointer to a handle (for example,
>    in TMChoose).

The tool can change...

>2.  In Think's C, before I would get lots of "Illegal Pointer/Integer
>    Combination" errors.  Now, with the prototypes, I get loads of these
>    "Call of XXX does not match prototype" or something similar, which is
>    not very helpful (since I then have to locate the prototype).

I'll pass it along...

>3.  Why do some buttons have to be clicked?  Is there no default on the
>    return key?  (For example, after a connection has been made by the
>    Modem tool.)

Bug.  Alpha-software....

>4.  A direct connection tool would be helpful. 

You should have gotten a connection tool called "Serial" along with
the "Modem" tool.

>
>That should about cover the questions of the last 5 hours.  Thanks for any
>help you can give.
>
>-Michael
>

========================================================================
Alex Kazim, Apple Computer
Phone Repair Man
========================================================================