[comp.sys.mac.programmer] Open/CloseDriver & Think Pascal

jkeegan@hawk.ulowell.edu (Jeff Keegan) (09/02/89)

I'm having a few problems with drivers that I think are THINK Pascal (2.0)
related, but I'm not sure.. I'll describe them and leave it to whoever wants
to reply to specify which they think it is.

First, I'm not getting my Open command called more than once, ever. I've
written an open routine (for testing purposes) that ALWAYS opens a window
and draws into it either "First time" for the first case, or "Already Open"
for the 2nd, 3rd, etc. It then waits for a mouseclick and disposes of the
window. I call this driver with an application that calls OpenDriver.
It works fine the first time through, but after that the window isn't even
created. To make sure it wasn't something simple I've messed up, I put a 
SysBeep right after the Open routine begins (before deciding if my global
"alreadyOpen" is true or false), and it is only called the first time
through. This won't be a major problem in writing the driver (I can always
check with a status call), but I am curious as to why it is not calling it a
second time (since in Desk Accessories I've written, it has worked (using
Lightspeed 1.11)).

Second.. I load this driver into the system heap (via the "system heap"
option in ResEdit or THINK Pascal 2.0) and do a detach resource on it so
that it can run from application to application. (Can this affect question
#1? Hmm).. After I do the CloseDriver routine and end the application, the
driver seems to still be lying around in the system heap (I see this using
TMON).. I have it purgeable and unlocked, but it still lies there. Now
normally I wouldn't care (might as well keep system resources around in case
you need them, right?) but for developing this has been a pain, because (and
I have checked this MANY times) when I recompile and build a new version of
the driver, the old one hanging around in memory is the one that gets
called. I have the driver stored in a file that my application uses in the
"run options" resource box, and I have made sure to compile the driver and
then the application.

I imagine I could have the application do a GetResource and do some call to
purge it from memory, but shouldn't CloseDriver be handling this for me?
It's not a lot to do, since it's currently only bothering me in the
development phase, but should it be necessary for the user to purge a driver
with the same name and ID# once it's closed?

Lastly, since I'm posting a THINK Pascal question, just what IS the latest
version? (I've seen mentions of 2.01 or 2.1 recently, and feel outdated).
What has been fixed?

..Jeff Keegan

-------------------------------------------------------------------------------
| Jeff Keegan                | I clutch the wire fence until my fingers bleed |
| jkeegan@hawk.ulowell.edu   | A wound that will not heal                     |
|----------------------------| A heart that cannot feel                       |
| This space intentionally   | Hoping that the horror will receed             |
| left blank                 | Hoping that tomorrow we'll all be freed  -RUSH |
-------------------------------------------------------------------------------

steve@cpdaux.UUCP (Steve Lemke) (09/10/89)

In article <14736@swan.ulowell.edu> jkeegan@hawk.ulowell.edu (Jeff Keegan) writes:
}Lastly, since I'm posting a THINK Pascal question, just what IS the latest
}version? (I've seen mentions of 2.01 or 2.1 recently, and feel outdated).
}What has been fixed?

From what I read, there are just some minor things fixed (which is why the
latest is only called 2.01).  There was a 2.0 patch 1, but now it's just 2.01.
I got the patches for both from GEnie, and they are also on Compu$erve.  I
could mail them to you if you want...

Incidentally, does anyone out there have a small DA written in THINK Pascal
that I could look at as an example of how to do it?  The one that comes with
THINK is written in Object Pascal, which I am not using, and it's much too
large to just figure out the basics of writing a DA.  Any help would be
appreciated, and sample code could be mailed to any of the addresses below,
or to AppleLink at D3670.  Thanks.

-- 
----- Steve Lemke ------------------- "MS-DOS (OS/2, etc.) - just say no!"
----- Internet: cpdaux!steve@apple.com                GEnie:  LEMKE
----- Or try:   apple!cpdaux!steve               CompuServe:  73627,570
----- Quote:    "What'd I go to college for?"   "You had fun, didn't you?"