HDTenEightyP/NetNews huggingface dataset:
From: eric_berdahl@taligent.com (Eric Berdahl)
Newsgroups: comp.sys.mac.programmer
Subject: Re: GWorld Woes
Date: 7 Apr 92 00:42:00 GMT
Organization: Taligent, Inc.

In article <6584@lee.SEAS.UCLA.EDU>, geck@plasma.icsl.ucla.edu (William Ross
Geck) writes:
> 
> Hi All,

Hi William!

> (1) The NewGWorld routine creates a pixMap of the appropriate size with 
>     (**pMap).baseAddr set to a Handle containing the pixMap data rather than 
>     the normal pointer.  (Aside: This is fine with me, I do the same for my 
>     own pixMaps.  I then lock and dereference the baseAddr before drawing to 
>     it, then do a "RestoreHandle" on it afterwards.  The LockPixels function 
>     does this same dereferencing when called before drawing anything to the 
>     port. And yes, I know that's why we should always use GetPixBaseAddr.)

Sounds reasonable that the GWorld routines do this, and it's cool that you have
found this special knowledge becuase you now understand GWorlds a little better
than the average bear (as Yogi would put it).

> (2) After calling LockPixels, I did an HGetState on the pixMapHandle, and on 
>     the pixMap data (now dereferenced) and found no bits set (AND no
MemError).
>     Yet the Swatch application informs me that these structures are indeed 
>     locked!
>     
>     Question:  why doesn't HGetState tell me that these handles are locked? 

Good question.  I don't know why this doesn't happen, but I don't think it's
anything to worry about.  I've been using GWorlds in my apps for a long time,
and they've always worked.  I think we may be trying to understand the
implementation at too fine a grain here.

> (4) I did the following:
>         [code deleted]
>     To set up a second PixMap IDENTICAL to the GWorld's.  I then called 
                                ^^^^^^^^^
Apparently, it wasn't identical.

>     SetPortPix( ePix ), locked ePix and (**ePix).baseAddr, dereferenced the 
>     baseAddr then tried to draw into the GWorld.  BOMB!!!!  I even replaced 
>     step #5 with a NewPtr call (In other words, made this a normal pixMap), 
>     BOMB!!!  

To create an identical PixMap (at least, as far as you need), create another
GWorld with the same characteristics as the GWorld you want to copy (size, bit
depth, color table, device, etc).  Basically, you have to treat all the fields
of the GWorld as completely private.  You are not allowed to even look at the
values because their use is not documented except to say that they may be
different than the way the rest of the toolbox works.

Also, I try to avoid SetPortPix and NewPixMap for basically just this reason. 
The only time I use PixMaps instead of GWorlds is if I need to CopyBits
somewhere given a specific digital image with a specific color table.  Then I
create a PixMap on the stack and CopyBits from it to a GWorld for more permanent
storage.

Hope this helps.
--
Eric Berdahl
Taligent, Inc.
Internet: eric_berdahl@taligent.com
AppleLink: BERDAHL
#include <StdDisclaimer.h>
This is a freeware signature.  What do you expect for nothing?
From: green@eniac.seas.upenn.edu (Bradley Green )
Newsgroups: comp.sys.mac.programmer
Subject: High-speed serial communications on Mac
Date: 8 Apr 92 17:55:51 GMT
Article-I.D.: netnews.73287
Organization: University of Pennsylvania

I would like to use the serial port on the Mac at LocalTalk data rates,
i.e. 232Kbaud, without using LocalTalk/AppleTalk protocols.  In other
words, I just want to be able to send straight data at these speeds.  I
understand that the serial driver does not support speeds over 34Kbaud or
so.

My question is this:  Do any of you out there know a source for the
direct hardware calls I need to do this?  Or, even better, a source for
prewritten (public domain) code?  Thanks for your help

Brad
From: zobkiw@world.std.com (Joe Zobkiw)
Newsgroups: comp.sys.mac.programmer
Subject: Re: QUESTION-Drawing Pict/Hide MenuBar??
Keywords: menubar, PICT
Date: 13 Apr 92 14:08:43 GMT
Organization: The World Public Access UNIX, Brookline, MA

> This is probably a very easy question to answer, but how do I read a
> PICT resource and display the PICT in the current cgrafport.

Look into the DrawPicture(thePicture, destRect); routine.
-- 
<--------------------------------------------------->
 joe zobkiw                     zobkiw@world.std.com
 mac.synthesis.MIDI.development.C.asm.communications
>---------------------------------------------------<
Newsgroups: comp.sys.mac.programmer
From: tamukha@sisters.cs.uoregon.edu (Tanka R. Sunuwar)
Subject: Color Dialogs in THINK Class Library?
Summary: Color Dialogs 
Keywords: Color Dialogs
Organization: University of Oregon Computer and Information Sciences Dept.
Distribution: usa
Date: Sun, 12 Apr 1992 20:12:53 GMT

Hi all TCL programmer,

I am trying to make some color dialog boxes (both Modal & Modless), but I don't
seem to be able to do it.  It seems to work for regular window, but not for dialog boxes.  I don't want anything fancy, just the gray background.

Maybe I am missing very simple thing here.  I am using TCL 1.1.2.  Any pointer to this direction will be very appreciated.

You can just e-mail at tamukha@cs.uoregon.edu.

Thanks in advance.

-Tanka

-- 
==========================================================================
Tanka R. Sunuwar                    | e-mail  tamukha@cs.uoregon.edu
342 E. 12th Avenue                  |         sunuwar@oregon.uoregon.edu
Eugene, OR 97401                    | GEnie   T.SUNUWAR1
Newsgroups: comp.sys.mac.programmer
Subject: question: THINK C "real window" console available?
From: eburk@russian.sfsu.edu (Eli K. Burk)
Date: 9 Apr 92 13:41:14 PDT

I am learning C and have decided to learn C first -then- experiment
with the toolbox. However THINK C's console.h does not include a 
"real" mac window - has anyone written one. The best case would one in  
which I could just comment out console.h an have the code be ansi
compliant.

If one doesn't exist perhaps someone could make one available for ftp.

eli

p.s. thanks to all that helped me before
   (i.e. the "help me help myself" posting)
Newsgroups: comp.sys.mac.programmer
From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
Subject: Re: LISP and DrawString questions
Organization: Kalamazoo College
Date: Tue, 7 Apr 1992 14:44:04 GMT

myers@wittenberg.edu writes:
>
>First:  I'm looking for a public domain version of LISP.  Does anybody know of
>one (if so, where can I get hold of it)?

Is this on the FAQ list?  Eric Sink posted a list of free/shareware
compilers a while back;  I think that belongs in the FAQ.

I don't know of a LISP, but there's a decent Scheme at
sumex-aim.stanford.edu.

>Second: I want to draw white text on a black background and everything I
>display using DrawString just appears as black (which is no good since that is
>the same color as the background!).  I've tried changing the PenPat, but that
>doesn't work.

There are two schools of thought, I believe.  The first method is to
change the PenPat and make sure you're using TextMode(srcCopy).  The
default mode is srcOr, and or'ing white won't do a thing.  The second is
to draw in TextFace(outline), again with srcCopy.  There really isn't
any reason to do the second (unless you're sloppy and are likely to
forget to change the PenPat back to something reasonable), but it's a
handy trick to know when you're using stupid graphics programs that
won't let you do text white-on-black.
-- 
 Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
 "Almost all portables today employ passive-matrix LCDs, and no one expects
 active-matrix screens to be cost-competitive for a few years" -PC World 2/92
From: heksterb@cs.utwente.nl (Ben Hekster)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Error Number to String Conversion
Date: 17 Apr 92 08:38:09 GMT
Organization: University of Twente, Dept. of Computer Science

In article <1992Apr14.205433.1@tesla.njit.edu> erh0362@tesla.njit.edu writes:
>	Is there a toolbox call that will convert an error number into an 
>appropriate string? If so what? If not why not? Am I doomed to type in 
>all the strings for every error I intend to check for?

What about the "Error Manager" library of MPW?  This has the advantage
that the file of error strings "SysErrs.Err" only needs to be stored on
your hard disk once, and can then be used by multiple applications.
This seems like a reasonable basis for standardization-- if more
applications would start using it.  Plus, if you distribute this file
with your app, the non-programmer can save some disk space by trashing
the file, if so desired.

-- 
Ben `Hackster' Hekster			| sigblock(sigmask(SIGFLAME));
heksterb@cs.utwente.nl			| "Here we are now, entertain us"
From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Precompiled version of MacApp.h
Date: 8 Apr 92 15:05:10 GMT
Article-I.D.: ux1.1992Apr8.150510.11046
Organization: University of Illinois at Urbana

aep@world.std.com (Andrew E Page) writes:

>   With alot of cursing and some fidling around I've managed to produce
>a precompiled version of MacApp.h.  I had to crank the partition of
>MPW Shell up to 9 Meg in order to do this and the resulting file is
>about 2.3 Meg long.  

All it takes is doing an "MABuild -CPlusLoad" and adding
"{OtherLinkFiles} f {CPlusLoad}" to the .MAMakefile...

You might want to add '-CPlus -mf -Link -mf' to your MABuildDefaults in
{MacApp}"Startup Files:Startup". Then you can drop your shell
partition to 3Mb again and let it go to MultiFinder for the rest.
The -CPlusLoad can be added there also.

>   Would anyone be interested in having me post this to AppleLink
>or UUEncode it for the net?

Wouldn't do anyone else any good since (a) it is compiled for specific
MABuild options, and (b) contains full pathnames.
-- 
Mark Lanett, Software Tools Group, NCSA           mlanett@uiuc.edu or  NCSA.STG
"People wander in and out of virtual rooms in virtual settings with virtual
characters and virtual money and virtual armor and virtual weapons, which is
virtually a good way to spend time, but not quite." -- Usenet Oracle
-- 
Mark Lanett, Software Tools Group, NCSA           mlanett@uiuc.edu or  NCSA.STG
"People wander in and out of virtual rooms in virtual settings with virtual
characters and virtual money and virtual armor and virtual weapons, which is
virtually a good way to spend time, but not quite." -- Usenet Oracle
Newsgroups: comp.sys.mac.programmer
From: shall@yoda.eecs.wsu.edu (Sean Hall - CS460)
Subject: Async Serial Stuff
Organization: Washington State University
Distribution: usa
Date: Sun, 12 Apr 92 01:17:32 GMT

I have a couple of questions.

1. Can the average joe programmer make the serial chip read and write async.
   at the same time (not intended to be redundant).  That is, have data going
   out and coming in at the same time. 
2. Related to earlier posts, when one sets up an async. write with data
   pointed to by myDataPtr, and sends it on its way, can the data being pointed
   to be modified "at the last minute".  What I guess Im trying to say, is,
   does the data pointed to simply get read by the serial driver, or does it
   get copied to some special place by the serial driver when you ask it to be
   written?

Well, thats two questions.  I like to be a man of my word.
-Sean
From: burglin@amber.mgh.harvard.edu (Thomas Burglin)
Newsgroups: comp.sys.mac.programmer
Subject: Macintosh C Programming primer examples (Q) Where?
Date: 6 Apr 92 06:31:00 GMT
Organization: Molecular Biology, Massachusetts General Hospital, Boston
News-Software: VAX/VMS VNEWS 1.41

Hi, I was wondering if any ftp site out there has at least some
of the example programs from the two books:
Macintosh C Programming Primer vol I & vol II.
Maybe not, since that might be an infringment on the copyright (I
didn't read the small print in the book).
But if anybody knows of some source for the example codes, 
I would appreciate the tip. (No, I don't want to pay megabucks
for the disk as advertised in the back of the book)
Thanks
Thomas Burglin
burglin@frodo.mgh.harvard.edu
Newsgroups: comp.sys.mac.programmer
From: ivanski@world.std.com (Ivan M CaveroBelaunde)
Subject: Re: Writing apps that use plug-ins?
Organization: The World Public Access UNIX, Brookline, MA
Date: Tue, 7 Apr 1992 13:36:26 GMT

edw@caligula.cts.com (Ed Watkeys) writes:
>While I didn't make the original post, I have a question about this... I'm
>writing a BBS program, and I have routines to do i/o over the connection (with
>the CTB, of course...); how can I have the plug-in call routines within my
>program's code?

Basically, one of the parameters you pass to the plug-in must be a procPtr
with well-defined calling conventions. The procptr could be one of the
explicit parameters (this I haven't seen done), or a field inside a
parameter block (XCMDs and Photoshop plug-ins do it this way). Then you
would take the procPtr, cast it to the right type (if necessary), and issue
the callback to your program.  HyperCard's callback structure is a good
example of a flexible callback spec that allows a wide variety of callbacks
with widely varying parameters via the same procPtr, and it's pretty well
documented as well. You might want to use that as a model.

BTW, when you process the callbacks from the plug-in in your code, be careful
not to do things like unlocking the plug-in resource or closing the resource
file; also, the spec for the callback should specify what you expect the
world to look like (chances are you should expect it restored to the state
it was when the plug-in was initially called. This means that if the plug-in
creates an A5 world for its globals, or changes the graphics world
(port/gdevice) and the like, they should be restored to the ones on entry
before calling. I know these might sound obvious, but they are easily
avoidable pitfalls that you should be careful about.

-Ivanski
---
Ivan Cavero Belaunde
DiVA Corporation
#include <std_disclaimer.h>
From: tjc@pacvax.UUCP (Tom Colley)
Newsgroups: comp.sys.mac.programmer
Subject: Re: PLookupName weirdness
Date: 7 Apr 92 14:54:00 GMT
Reply-To: tjc@pacvax.pacersoft.com (Tom Colley)
Organization: Pacer Software Inc., Westborough, MA USA

In article <1992Apr7.035320.9787@organpipe.uug.arizona.edu> jahnke@biosci.arizona.edu (Jerome Jahnke) writes:
>I have been working on some AppleTalk stuff, and things are going along
>smoothly until I was goofing with NBP and PLookupName. I get it all set
>up and let PLookupName go to work. The Function PLookupName returns an
>OSErr of 1. I could understand any error code less than 0. And would
>hope for an error code of 0. But 1 is totally beyond what I expected.
>...
>Jer,
>----
>Jerome Jahnke
>Biology Learning Center
>University of Arizona
>'jahnke@biosci.arizona.edu' or +1 (602) 621-3820

If you had said the ioResult field was 1, I would say it sounds as if you 
are making an asynchronous call (async calls stuff a 1 into ioResult
until they complete).  But you said the function returns a 1.  It sounds
like you are assigning the result of a comparison instead of comparing the
assignment.

/* this will cause result to be 1 if PLookupName returns noErr */
if (result = PLookupName (pbptr, false) == noErr)
    printf ("%d\n", result);

/* this will work as desired, note the extra parens */
/*  v                                   v   */
if ((result = PLookupName (pbptr, false)) == noErr)
    printf ("%d\n", result);

The '==' has higher precedence than the '=', so result is getting
assigned the result of the compare (1 if equal, 0 if not).

Tom Colley
Pacer Software Inc.
<tjc@pacersoft.com>
From: lkimes@alshain.usc.edu (Lance 'Moof' Kimes)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Think C, TCL, AppleTalk Async calls and a question
Date: 10 Apr 1992 19:17:45 -0700
Organization: University of Southern California, Los Angeles, CA
Distribution: world
Reply-To: lkimes@alshain.usc.edu (Lance 'Moof' Kimes)
NNTP-Posting-Host: alshain.usc.edu


In article <jsuker.23@orion.oac.uci.edu>, jsuker@orion.oac.uci.edu (Johnathon L. Suker) writes:
|> Hey AppleTalk and Think Class Library,
|> 
|> 	I have a programming question regarding AppleTalk programming and 
|> the think class library.  I am going to write (am writing) a programming 
|> that uses appletalk and sends syncronous calls.  I want to change them to 
|> Async. calls.  According to Inside AppleTalk, to should check for async 
|> calls in the main event loop of your program.  In TCL I do not have access 
|> to this and inorder to put something in their I must changing the source 
|> code of TCL (which Symantec says is BAD).  Has anyone (or does anyone) know 
|> how to make Async calls within TCL.  I would really like to use the TCL (my 
|> first big project using it) and this is the only thing holding me back.
|> 
|> 				Thanks in advance,
|> 
|> 					Johnathon
|> _______________________________________________________________________________
|> Johnathon Suker           |
|> UC Irvine                 |   .signature file under construction
|> jsuker@orion.oac.uci.edu  |
|> _______________________________________________________________________________


When I first started TCL programming I made the same mistake, but remember that TCL is a class library!!

CMyClass : public CApplication


override Process1Event

void CMyClass::Process1Event( void)
{


my stuff & checking


inherited::Process1Event();
}

then call CApplication method for processing events



Hope it helps

Lance Kimes
USC
From: dn5@apix.psu.edu (D. Jay Newman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Does MPW support aliases?
Date: 10 Apr 92 20:58:47 GMT
Organization: Penn State

In article <22808@goofy.Apple.COM>, ksand@apple.com (Kent Sandvik) writes:
 
> Most, if not all, MPW tools *don't* support aliases. I placed a request
> for change about this to tools engineering some time ago.

I *really* wish they did (at least the C++ compiler).  I am working on a
project with 6 shared files, and using aliases would be *much* easier than
either keeping two copies of source code (which occasionally change) or
shuttling them back and forth.

I've tried to keep the shared files in a common directory, but never got
that to work real well.

Actually, I've never been too impressed with Apple's following of their
own rules.  MPW was *not* 32-bit clean long after Apple said that everything
should be 32-bit clean.  Now Apple has been preaching about aliases for
quite some time, and still MPW doesn't know about them.  Typical.

()()()()()()()()()()()()() CBEL--Teaching & Learning Technologies ()()()
D. Jay Newman     !            Save the whales
dn5@psuvm.psu.edu !        (Collect the whole set)
dn5@apix.psu.edu  !
Newsgroups: comp.sys.mac.programmer
From: d88-jwa@dront.nada.kth.se (Jon W{tte)
Subject: Re: How to tell if a window has a title bar?
Originator: d88-jwa@dront.nada.kth.se
Organization: Royal Institute of Technology, Stockholm, Sweden
	<1992Mar26.212538.4018@dartvax.dartmouth.edu>
	<1992Apr6.151447.23885@kth.se>
Date: Mon, 6 Apr 1992 21:13:42 GMT

.se> f85-tno@nada.kth.se (Tommy Nordgren) writes:

   |> > You should use rgnBBox Rect of structRgn from WindowRecord instead
   |> > of portRect.    [Miika Asunta]
   |> 
   |> No.  This value will be invalid if the window has not been drawn on the
   |> screen.  Since one of the primary uses of centering windows is to
   |> create the window invisible, center it, and then show it, structRgn is
   |> not a general solution to this problem.

   Beside checking the variant code, also get Resource info for the window
   definition procedure. If the ID is 1 then it is a standard window.


However, there are lots of INITs that patch the standard window defProc
so that won't work.

What you do is as many others have said:

	1) MoveWindow ( theWindow , 25000 , 25000 , FALSE ) ;
	2) ShowWindow ( theWindow ) ;
	3) SelectWindow ( theWindow ) ;
	4) NOW you can check the structure region for the "true"
	   size of the window.
	5) MoveWindow ( theWindow , whatever you center with ) ;

This will, in effect, make the window appear as if you ShowWindowed
it after it was centered.

-- 
h+@nada.kth.se; Jon W{tte, the Diplomat - NOT!
From: peirce@outpost.SF-Bay.org (Michael Peirce)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Network copy protection problems
Date: 12 Apr 92 16:30:37 GMT
Reply-To: peirce@outpost.SF-Bay.org (Michael Peirce)
Organization: Peirce Software
X-Mailer: uAccess - Macintosh Release: 1.5v4


In article <1992Apr11.232023.11368@wam.umd.edu> (comp.sys.mac.programmer), nebel@wam.umd.edu (Chris D. Nebel) writes:
> I'm trying to write one of those things that checks to make sure that you're
> only running one copy of the same program at once on an Appletalk network.
> (Please, no flames from folks that think this practice is evil.  This is my
> job we're talking about, here.)  Anyway, I've got a little thing written that
> registers the "name" (all right, the serial number) of the program using
> NBPRegister; if NBPRegister comes back with a duplicate name error, then it
> decides that another copy is being run somewhere and exits.  (The program
> unregisters the name when you quit.)
> 
> This works pretty well, but there are two major problems.  One, it only checks
> the current zone.  I'd like it to check ALL the zones, but I can't seem to find
> anything at all on zones in IM except for an occasional mention of '*' -- where
> does Apple hide this information, anyway?

You need to use the Zone Information Protocol, ZIP, to find out what
zones exist in your network.  With it you can lookup the name in each
zone.

Of course, this will take FOREVER in a large network environment -
and there are many large AppleTalk networks out there.

You need to be a little more clever than just checking everywhere.
Do something like only picking a couple of random zones each time you
start up.  

Before you release your product do some serious testing of your scheme
on a real network (at least a few dozen zones with real traffic) and
make sure you aren't hogging all the resources or causing other problems
for people.  Your customers will be happier and so will you - you
don't want people dumping your product because it nukes their network!

> Problem number two is more serious: if the program terminates abnormally (read:
> crashes! (or the user kills it, or whatever)), then the name never gets
> unregistered.  So when they try to launch again, it says "This copy is already
> being used!"  Oh, joy.  I tried turning off self-send during the inital name-
> check, and that seems to work, but when it tries to unregister the name,
> something fairly horrible must happen, because the Finder almost always
> crashes a few seconds after I quit.

Patch the ExitToShell trap and do your unregistering there.

Not only are you getting a duplicate name, but worse, NBP still thinks
it owns the block of memory that contains the original name.  This
chunk of memory could very well be part of another program's memory
space now!

--  Michael Peirce         --   peirce@outpost.SF-Bay.org
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California USA 95117
--           & Consulting  --   voice: (408) 244-6554 fax: (408) 244-6882
--                         --   AppleLink: peirce & America Online: AFC Peirce
From: mithral@wpi.WPI.EDU (Bret Alvin Barker)
Subject: (Q): How to count # of snd resources in one file?
Keywords: resources, snd
Organization: Worcester Polytechnic Institute
Date: Tue, 14 Apr 1992 23:20:50 GMT

	I have a question as to how to count the number of resources of a
single type in one resource file.  Inside Mac. gives the routine CountResources
which counts the # of resources of a given type in ALL open rsrc files.
	I need a similar routine that will count them for only one file, 
namely the application's resource file.
	Is this possible?  If so, any suggestions would be helpful...

	Thanks in advance...

						--bret a. barker
						  mithral@wpi.wpi.edu




Newsgroups: comp.sys.mac.programmer