HDTenEightyP/NetNews huggingface dataset:
From: siegel@world.std.com (Rich Siegel)
Subject: THINK Pascal Misconceptions (was Re: Summary: THINK Pascal...)
Organization: GCC Technologies
Date: Thu, 19 Nov 1992 04:37:09 GMT

In Kurisoto's summary of responses to his problem (one of which is mine)
he quotes several of his respondents, some of whom provide advice which
is half-baked at best.

In article <Bxy2Iz.1w7@news.udel.edu> kurisuto@chopin.udel.edu (Sean J. Crist) writes:
>(Person A wrote)

>> When running in ThinkP these calls are done for you, but when you build the
>> standalone they aren't.  I mean stuff like:  InitGraf, InitWindows,
>> InitDialogs... etc.  Look up these calls in InsideMac or in any listing of
>> a complete Mac program!

	Wrong, as has been noted before. UNLESS you place a {$I-} in the
same file as your main program, THINK Pascal generates code to initialize
the major ToolBox managers before your main program is executed.

>(Person D wrote)
>> It might be some pointer or other variable that is not initialised. The
>> debugger does this automatically.

	Wrong. The debugger does not initialize -ANYTHING-. In THINK Pascal
all globals are initialized to zero, but this happens independent of whether
you're running under the environment or not.

>(Person E wrote)
>> TP does several things for you in the runtime environment: local (stack)
>> vars are initialized to zero; your explicit stack and memory allocations
>> get set up; there are lots of subtle differences having to do with TP
>> sitting between you and the system; your code executes in a heap zone
>> in TP's heap zone; etc.

Mostly wrong. Local variables are not initialized to zero. Either under the
environment or standalone, local variables, except for arguments passed
in, will contain whatever random junk happens to be in the portion of
memory which corresponds to the link frame that you're using.

>(Person F wrote)
>> The THINK Environment is a bit kinder regarding nil pointers, dereferenced
>> handles and initial values. Check that you aren't using any variables before
>> setting them and that all your handles are locked before dereferencing.

Not at all. THINK Pascal does nothing to hide bugs involving improper use
of NIL or junk pointers, any more than the rest of the system does.

I post the corrections here because I feel that bad advice is worse than
no advice at all.

R.
-- 
-----------------------------------------------------------------------
Rich Siegel                              Internet: siegel@world.std.com
Software Engineer & Toolsmith
GCC Technologies
Newsgroups: comp.sys.mac.programmer
From: wingo@apple.com (Tony Wingo)
Subject: Re: Whatever happened to macTutor???
Date: Wed, 18 Nov 1992 18:32:30 GMT
Organization: Apple Computer
Followup-To: comp.sys.mac.programmer

In article <1992Nov18.122202.1@lure.latrobe.edu.au>,
chergr@lure.latrobe.edu.au wrote:
> 
> Whatever happened to MacTutor???

It's still around, under new ownership and with better typesetting.  I
think you can reach them at MACTUTOR@applelink.apple.com.  If that doesn't
work try
1-310-575-4343 (voice) or 1-310-575-0925 (fax).

-tony

>>usual disclaimer<<
Newsgroups: comp.sys.mac.programmer
From: jack@umbio.med.miami.edu (Jack Herrington)
Subject: Re: Large multidimensional arrays in C (THINK/MPW)???
Organization: University of Miami Medical School
Date: Mon, 23 Nov 1992 20:36:39 GMT

asunta@convex.csc.FI (Miika Asunta) writes:
: Let's make a 1D array example...

That works fine, but the problem I was having and maybe some other people is
that NewHandle will bomb out on really large blocks.  But that's not it's 
fault.  For example, you have a 100 byte long structure, and you want 4000 of
them.  That's 40,000 bytes, normally you would just go like this:

newHand = NewHandle(sizeof(theStruct)*4000);

But that will fail because Think is going to think of both of those as shorts
even though the product will be more than a short.

So...

long newHandSize = sizeof(theStruct) * 4000;
newHand = NewHandle(newHandSize)

Will work.

As for two dimensional arrays, the normal way to do that is to write a little
locator code that is like:

Ptr ItemLoc(Ptr basePtr,short numCols,short rowNum,short colNum)
{
	return basePtr + ( ( ( numCols * rowNum ) + colNum ) * sizeof(Item) );
}
}
-- 
"Down in Joe's garage, we didn't have no dope, or LSD.  But a couple o'
 quarts of beer would fix it so the intonation would not offend your ear"
		-Frank Zappa
From: chuckp@u.washington.edu (Chuck Pliske)
Newsgroups: comp.sys.mac.programmer
Subject: Deadman programming - how to reset?
Date: 18 Nov 92 00:35:57 GMT
Article-I.D.: u.1992Nov18.003557.11293
Organization: University of Washington
X-Xxmessage-Id: <A72ECFE31802372A@chuckp.staffdev.washington.edu>
X-Xxdate: Tue, 17 Nov 92 00:35:47 GMT
X-Useragent: Nuntius v1.1.1d12

I have written a "deadman" program, consisting of a faceless bg app with 
a TimeManager periodic visit.  The app resets a counter every WNE, and 
the TM task counts it down.  If it gets to 0, its time to reset the Mac.

It has been my observation that most crashes involve the mainline portion 
of the system, and leave the interrupt system operational.  My problem is 
in figuring out a reliable "reset" to use.  In my old hypercharged SE, 
the "reset" instruction works just fine and I now have increased 
reliability in my unattended system.  However, in the IIfx (7.1) the 
reset instruction blanks the screen but does not otherwise reset the 
computer.  Any suggestions would be appreciated.

Chuck Pliske
Newsgroups: comp.sys.mac.programmer
From: ah301@yfn.ysu.edu (Jerry Sy)
Subject: does a notification alert always get posted ?
Reply-To: syjerry@duq3.duq.edu
Organization: St. Elizabeth Hospital, Youngstown, OH
Date: Wed, 18 Nov 1992 19:39:33 GMT


if there is a multifinder unfriendly application running in the
foreground (Pacerlink program downloading a file from the vax
in my case), can a notification alert posted by an app in the
background still get to the top ?  assuming the background program
can get enough cpu time to post the notification (does it ?).
or does the alert box only pops up after the foreground program
is done (finish downloading in my case).

thanks in advance.

jerry

Newsgroups: comp.sys.mac.programmer
From: croyer@atg.amex-trs.com (Chuck Royer)
Subject: Fooling the Event Manager
Date: Mon, 23 Nov 1992 15:51:58 GMT
Reply-To: croyer@atg.amex-trs.com
Organization: American Express Advanced Technology Group
Keywords: event keyboard modifier
Followup-To: comp.sys.mac.programmer


-- 
I'm developing a background application that is generating keyboard events.
I need to be able to generate an event that also sets the status of the
modifier keys (i.e. Command-s for "save").  Using PostEvent, I can only set
the character code for the letter "s" and the OS generates the modifiers
field in the event record.  Is there a way I can set the modifiers field as
well as the character code when I post a keyDown event?

Please e-mail responses and I will post a summary.

Thanks in advance.


- Chuck Royer
Newsgroups: comp.sys.mac.programmer
From: walkerj@math.scarolina.edu (Jim Walker)
Subject: Re: INIT's/System Extension Questions
Keywords: INIT extensions
Organization: USC  Department of Computer Science
Date: 18 Nov 92 15:10:54 GMT

In article <1992Nov5.184623.15326@asuvax.eas.asu.edu>
 system@asuvax.eas.asu.edu (Marc Lesure) writes:

>Also, are there any snippets showing the best way to show an INIT icon
>during the booting sequence?

I have one I call ShowIcon7 which is compatible (I think) with IconWrap,
and which (under System 7) will show color icons of iclx types. Under
System 6, it does black and white.  It's written in THINK C 5.  Source and
compiled code is available by ftp from bigbird.csd.scarolina.edu in
pub/mac.
--

 -- Jim Walker  USC Dept. of Math.  walkerj@math.scarolina.edu
Newsgroups: comp.sys.mac.programmer
From: d88-jwa@hemul.nada.kth.se (Jon Wtte)
Subject: Re: Access directory contents
Organization: Royal Institute of Technology, Stockholm, Sweden
Distribution: comp.sys.mac.programmer
Date: Thu, 19 Nov 1992 10:18:22 GMT

In <19385@ucdavis.ucdavis.edu> cklarson@burrito.engr.ucdavis.edu (Christopher Klaus Larson) writes:

>In article <1992Nov16.131617.2096@ncsu.edu> cpastore@unity.ncsu.edu (Chris Pastore) writes:
>>
>>Is there some easy way to get the listing of file names once a
>>directory is identified?
>>

>Call PBGetCatInfo on the directory: once with ioFDirIndex negative, to
>obtain the number of files in the directory; then call it again, once for
>each value of ioFDirIndex between 1 and the number of files in the
>directory, inclusive. (I know this explination is not very clear, 
>basically you are performing an indexed search of the directory.)

This is not generally the best way, since files may be added
or removed while you do it. Instead, just start enumerating
from 1 and up in indexed mode. Don't give up on the first error,
it might be a permission error, give up first when you get a fnfErr
(or was that eofErr?)

Actually, you still might have problems with disappearing files
(or appearing files) so you might want to go back and check again
like DIsinfectant does it.

Cheers,

						/ h+

-- 
 -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --
   This signature is kept shorter than 4 lines in the interests of UseNet
   S/N ratio.
Newsgroups: comp.sys.mac.programmer
From: asunta@convex.csc.FI (Miika Asunta)
Subject: Re: How can I change the menu in Think C?
Keywords: Think_C menu
Organization: Finnish Academic and Research Network Project - FUNET
Date: Tue, 17 Nov 92 19:10:12 GMT

In <1992Nov17.154800.470@maths.tcd.ie> tim@maths.tcd.ie (Timothy Murphy) writes:


>Anyone know why Think C (v5 under System 7)
>doesn't like this?
>It compiles but bombs out.

>main()
>{
>	MenuHandle AppleMenu;
>	AppleMenu = GetMenu(1);
>	AddResMenu(AppleMenu, 'DRVR');
>}

Grrrreaaattt....

1) Where are MacInit-routines (InitGraf etc...)

2) Do you have a resource file named project.pi.rsrc

3) Application resource IDs should be >= 128
--
Miika Asunta
asunta@convex.csc.fi			Double Bass Player
tel. +358-0-494 093			Macintosh Programmer
From: andreasm@cs.tu-berlin.de (Andreas Mueller)
Newsgroups: comp.sys.mac.programmer
Subject: Serius Developer System
Date: 20 Nov 1992 10:35:55 GMT
Organization: Technical University of Berlin, Germany
Distribution: world
NNTP-Posting-Host: harry.cs.tu-berlin.de

Who has experiences with the Serius Developer Kit.
How does it work?
Is it a "serius" developing environment?
How much is it, and where is the best buy?

Thanks in advance, andreasm@cs.tu-berlin.de


Newsgroups: comp.sys.mac.programmer
From: knee@netcom.com (Mark Lanett)
Subject: Re: MPW and GCC
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Thu, 19 Nov 1992 20:45:20 GMT

timmbake@mcl.ucsb.edu (Bake Timmons) writes:

>Hi -- I noticed that a gcc distribution for the Mac is available via ftp.  Is
>anyone up and running with it???

>To use it, you need MPW 3.1 includes and libraries.  I know that _ONE_ of these
>things is at ftp.apple.com.  Is it foolish to ask if the other one should be
>available.

Using gcc requires MPW 3.1 interfaces and libraries, MPW C, and MPW Asm. It
is slower than and requires more memory than MPW C, so I imagine you would
have to have fairly specific interests to use it.

The version of gcc out there was 1.37 or something like that. 2.2 was "sort-of"
ported last summer (just the C part, not C++ or ObjC)

I'd look for an old Dev CD for the 3.1 stuff.
From: draper@odin.mda.uth.tmc.edu (E.J. Draper)
Newsgroups: comp.sys.mac.programmer
Subject: Re: How to store file references/names ?
Date: 17 Nov 1992 16:17:14 GMT
Organization: U.T.M.D. Anderson Cancer Center
X-UserAgent: Nuntius v1.1.1d12
X-XXMessage-ID: <A72E78578D01019A@mdarpi1.mda.uth.tmc.edu>
X-XXDate: Tue, 17 Nov 92 16:22:15 GMT

In article <40561@unix.SRI.COM> Matt Mora, mxmora@unix.SRI.COM writes:

>And anyone that looked into a alias can tell you that it does contain
>the full path name. Damn you Apple! :-) (Do what I say not as I do. For
years 
>Apple has been bellowing: "don't use full pathnames" What did they end
up 
>using for aliases?)

So?  Why shouldn't they?  Programmatically FSSpecs are great, but are
utterly useless when things breakdown or when dealing with the Alias
Manager's idiosyncracies.  Say, for instance, we need to move 2.4
gigabytes of patient Images from our local RAID storage system to
permanent storage on our UNIX server. In the process ALL ALIASES
referencing files on the RAID will be INVALIDATED but the volumes'
structure will be identical. Well, what do we do now?  How does the
physician's conferencing software find a patient's scan?

All we need to do is call GetAliasInfo().  From this we can obtain the
full path name that was stored in the Alias handle. If Apple hadn't
bothered to use and store the original path name we'd be totally out of
luck!

Good Apple. Good Apple. ;-)


      |E|J-  ED DRAPER
 rEpar|D|<-  Radiologic/Pathologic Institute
             The University of Texas M.D. Anderson Cancer Center
             draper@odin.mda.uth.tmc.edu
From: bowman@reed.edu (BoBoRamDos)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Possible Bug  With MPW
Date: 18 Nov 92 01:19:31 GMT
Article-I.D.: reed.1992Nov18.011931.13796
Organization: Reed College, Portland, OR

In article <1992Nov17.224045.8582@den.mmc.com> jones@pogo.den.mmc.com (Jonathan Jones) writes:
> [Error in CFront:  cannot delete arrays of objects if their destructor
> is virtual]

Yes, I reported this bug to Apple many months ago.  They did respond, but as
of CFront 3.3a8, they still haven't fixed it.  Nor did they tell me that
removing the virtual would fix the problem.  Grrr.  Anyhow, I went through
many firey hoops until I tried removing the virtual, and that worked.

If you absotively, posolutely *must* keep your destructor virtual, I suspect
you could hack the C code CFront spits out...just remember to run it through
CDent first!

good luck,
bobo
bowman@reed.edu
A geek by any other name.
From: aleskine@cs.hut.fi (Arto Leskinen)
Newsgroups: comp.sys.mac.programmer
Subject: SpInsideMacintosh & wierd window
Date: 16 Nov 92 20:06:00 GMT
Distribution: comp.sys.mac.programmer
Organization: Helsinki University of Technology, Finland

Is SpInside Macintosh available on ftp?

I had problems that my srollbars were shorter than window, the line was still
drawn all the way trough window. I tried to set clip region smaller but still
( before I use DrawGrow())
something draws those dam lines. What's worse, if I run my window under
Think C debugger, the clipping works, but something eases my drawings off.
If I run separate program, my drawings will stay, but clipping does not work.
When window is drawn, the lines next to scroll bars are there. If I resize
the window, sometimes the lines disappear, somethimes the old line parts
stay on window and new ones will be drawn??

____________________________________________________
|=[ ]===============  Window  ==================F]=|
|--------------------------------------------------|
| |Calendar||v|  |Tools  v|     Widowfile          | Should be!
|==================================================|
|        Window contents ...                    |/\|
|             ...                               |--|

____________________________________________________
|=[ ]===============  Window  ==================F]=|
|--------------------------------------------------|
| |Calendar||v|  |Tools  v|     Widowfile  |    |  | Is like this!
|==================================================|
|        Window contents ...                    |/\|
|             ...                               |--|


Does this make any sence? Am I drawing into false grafport or what. 

Arto Leskinen
aleskine@cs.hut.fi
From: draper@odin.mda.uth.tmc.edu (E.J. Draper)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Whatever happened to macTutor???
Date: 18 Nov 1992 18:38:47 GMT
Organization: U.T.M.D. Anderson Cancer Center
X-UserAgent: Nuntius v1.1.1d12
X-XXMessage-ID: <A72FEB088D01019A@mdarpi1.mda.uth.tmc.edu>
X-XXDate: Wed, 18 Nov 92 18:43:52 GMT

In article <1992Nov18.122202.1@lure.latrobe.edu.au> ,
chergr@lure.latrobe.edu.au writes:
>Whatever happened to MacTutor???

They're still around.  The original publishers were bought out (last year
I believe).  I think you'll be happy with the changes they've made.  

I think the magazine has improved a thousandfold.


      |E|J-  ED DRAPER
 rEpar|D|<-  Radiologic/Pathologic Institute
             The University of Texas M.D. Anderson Cancer Center
             draper@odin.mda.uth.tmc.edu
Newsgroups: comp.sys.mac.programmer
From: danwood@netcom.com (Daniel J Wood)
Subject: Re: Whip me, beat me, what to do with DISCIPLINE?
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Thu, 19 Nov 1992 17:31:57 GMT

brunner@crchh447.bnr.ca (James Brunner) writes:

>I'm trying to get discipline to work.  

Welcome to the club. 
>I've tried using the "lenient" settings file and the finder keeps trapping it!
>(As soon as I turn it on with macsbugs DSCA ON).  

Try typing DSCA ON from *within your application* to prevent discipline from
acting on the finder. Yes, Finder violates beaucoup of what discipline catches.
I've managed to use Discipline this way with success!

Newsgroups: comp.sys.mac.programmer
From: nebel@wam.umd.edu (Chris D. Nebel)
Subject: Aaaaargh! MPW C++ help needed!
Organization: University of Maryland, College Park
Date: Tue, 17 Nov 1992 02:35:41 GMT

I've been translating a large Pascal project into C++, and it's actaully been
going quite well, all things considered.  Yesterday, however, I ran into a
very perplexing problem: one module simply won't compile.  CFront dies
partway through the #includes (it makes it past all the Mac includes, all 23
of them, and gags after about 20 of the 30 project includes) with the error
"internal error: free store exhausted".  (It reports the error at a line
inside one of the included files.)  At first I thought it was running out
of memory, but even after an additional 10MB of partition space (for a grand
total of 22MB!), it still died in the exact same place, so that theory seems
out.  I tried commenting out that include, but the same error appeared in
another place.  Does anyone have any clue as to what's going on, and more
importantly, how to fix it?

Desperately,

Chris Nebel
From: matti@my.sm.luth.se (Matti Larborn)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Think Pascal - Whats... - data abstraction?
Date: 17 Nov 92 14:01:15 GMT
Organization: Lule} University
X-UserAgent: Nuntius v1.1.1d11
X-XXMessage-ID: <A72EB9B97F01037B@sm-emac15.sm.luth.se>
X-XXDate: Tue, 17 Nov 92 14:01:13 GMT

In article <6746@m1.cs.man.ac.uk> Julian Fletcher,  writes:
>Think pascal seems to have fallen by the wayside in comparison with
think C.
>
>1	Are there any further upgrades since 4.0.1 ?
>	If so, where can they be obtained from, and what are the improvements ?
>
>2	Does anybody have any idea of the future of this wonderful product
>	i.e. is Symantec really committed to it ?

Another question: Why don't Think Pascal support abstract datatypes?

The only thing they would have to add is an export declaration:

	x=object
		export a,b; { or name it public if you like }
		a: integer;
		b: real;
		c: char; { hidden }

		{?operations }
	end;


There are also better ways to do this, but if you cannot hide fields in
objects you cannot make abstract datatypes. One main idea with objects is
to hide the data in the object so that the user cannot manipulate it
unless he/she uses the supplied operations. In this way you get code that
is easier to modify (since other parts of the program doesn't know
anything about your implementation) and you also get secure programs. If
one uses the built in operations one cannot do anything wrong (unless the
operations have some errors in them).

Symantec: Please add some kind of export feature to Think Pascal...

	--Matti Larborn, Sweden
Newsgroups: comp.sys.mac.programmer
From: REEKES@applelink.apple.com (Jim Reekes)
Subject: Re: LSize Strikes (Not Once But Twice)
Date: Thu, 19 Nov 1992 23:34:48 GMT
Organization: Apple Computer, Inc.
Followup-To: comp.sys.mac.programmer

In article <jpurlia-191192105158@129.46.5.45>, jpurlia@qualcomm.com (John
Purlia) wrote:
> 
> Lsize... My, isn't this trap annoying!
> 
> I've created a list containing both horizontal and vertical scroll bars
> that fit flush against the right and bottom borders of a window.  When the
> window is resized I invalidate and erase the old scroll bars, then call a
> routine shich does the resizing for this particular window with a call to
> LSize.  LSize is nice enough to draw the scroll bars for me (thank you, Mr.
> List Manager), however, when the window is resized such that the new width
> is greater than the old and the new height is less than the old
> (effectively dragging the grow icon up and to the right), the region along
> the horizontal scroll bar which was previously occupied by the rectangle
> enclosing the grow icon is NOT updated!!!  Remember, I invalidated this
> rectangle immediately before resizing the list via LSize...
> 
> This behavior does not happen along the vertical scroll bar when the resize
> is in the opposite direction.
> 
> What gives????
> 
> Sure, I could just invalidate the area occupied by the old grow Rect (which
> I'll probaly do), but something just seems wrong with LSize here!

I found a problem, not exactly like yours, but it may give you a clue.  The
list manager will always "validate" the regions for the two scroll bars
when you call LSize.  This happens even if you DO NOT have scroll bars. 
For me this caused my list to not get the frame I was trying to draw around
it.  The logic in the LSize code is taking the wrong path, and is probably
calling ValidRgn for your scroll bar area even if it wasn't drawn properly.
 If you called InvalRect on the scroll bar it would probably draw
correctly.  There might be a better way, but that's my clue for you.


-----------------------------------------------------------------------
Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
                             |          Sound Manager Expert
Apple Computer, Inc.         | "All opinions expressed are mine, and do
20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
Cupertino, CA 95014          |       employer, Apple Computer Inc."
From: alan@uts.amdahl.com (Alan Bomberger)
Newsgroups: comp.sys.mac.programmer
Subject: Re: How to store file references/names ?
Date: 18 Nov 92 20:32:03 GMT
Organization: Amdahl Corporation, Sunnyvale CA

"How many times do you restore a disk from tape?"

Imagine a Hypertext document with links to hundreds of files.
Do you want to tell the user of a hypertext application that
it will stop working should he ever have to restore his disk
from tape.  Why keep a backup then?

Since you have to keep full path names one wonders why
one would use DirIDs?

To answer you question.  Once is enough to have one
mighty pissed off customer!!

-- 
Alan Bomberger     | (408)-992-2748  | alan@uts.amdahl.com
Amdahl Corporation | Opinions are free, worth it, and not Amdahl's