HDTenEightyP/NetNews huggingface dataset:
From: stepan@natinst.com (Stepan Riha)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Think C and sizeof() ???
Date: 13 Oct 1992 11:26:51 -0500
Organization: National Instruments, Austin, TX
NNTP-Posting-Host: falcon.natinst.com

In article <dang.718983733@cserver> dang@cserver.plexus.com (Dan Gardner) writes:

Dan wonders about printf'ing sizeof in THINK C 5.0.3:

>#include <stdio.h>
>
>main()
>{
>	printf("The size of char is %d\n", sizeof(char));
>}
>
>This resulted in  "The size of char is 0".
...
>Interesting that this next program worked:
>
>#include <stdio.h>
>
>main()
>{
>	int i;
>
>	i = sizeof(char);
>	printf("The size of char is %d\n", i);
>}
>
>This resulted in  "The size of char is 1".

The type of sizeof is size_t, which (at least in THINK C 5.0.3) is an
unsigned long (look it up in "size_t.h").  Since a long int is 4 bytes
and, at least in your case, an int is 2 bytes, the printf was printing the
high order word of of a long int which, of course, is a 0.
Your first program would've worked if you had explicitly cast sizeof or used
the proper length modifier, i.e.

	printf("The size of char is %d\n", (int)sizeof(char));
or
	printf("The size of char is %ld\n", sizeof(char));

It's often a good idea to declare variables or struct fields as shorts or
longs rather than ints since the size of the int may be anywhere between
the size of a short and the size of a long.  Also, it's a good idea to
cast stuff when passing it to a function without a prototype or to one that
takes a variable-length argument list.

	- Stepan
-- 
   Stepan Riha -- stepan@natinst.com
From: bowman@reed.edu (Eric Bowman (bobo))
Newsgroups: comp.sys.mac.programmer
Subject: Re: ZREF errors - Think C 5.0.3
Date: 13 Oct 92 22:32:56 GMT
Article-I.D.: reed.1992Oct13.223256.4365
Distribution: comp
Organization: Reed College, Portland, OR

In article <BRIANJ.92Oct13172203@bedrock.cs.umd.edu> brianj@bedrock.cs.umd.edu (Brian Johnson) writes:
>scrambling on, it ran great.  Tried SS 0 (looking for writes to 0 in
>memory) in macsbug and it seemed like there were a few!  Most
>before I even got to my code?

It's been my experience that the 7.0.1 Finder *loves* writing to nil.  Sigh.
Much better than using SS 0 0 is to stuff an odd address at nil, or to get
EvenBetterBusError off sumex or ftp.apple.com.

Other than that, not much I can suggest without knowing more.  If heap
scrambling doesn't cause any problems, ever, then you might check for things
like disposing pointers or windows more than once (this caused me no end of
pain once), or problems with resources.

lood guck,
bobo
bowman@reed.edu
Newsgroups: comp.sys.mac.programmer
Subject: Re: MPW Question
From: Bruce.Hoult@bbs.actrix.gen.nz
Date: Mon, 12 Oct 1992 08:29:51 GMT
Organization: Actrix Information Exchange

In article <keith-111092211139@kip-55.taligent.com> keith@taligent.com (Keith Rollin) writes:
> 
> I got one, too. Looks like this:
> 
> AddMenu Special "Unmangle Name/U" 'set temp "`catenate
> "{Active}.<opt-6>"`";  Alert -s "`UnmangleTool "{temp}"`"'
> 
> That's all one command line; any line breaks are provided by your friendly
> neighborhood newsreader.

Why use two statements when one will do?  :-)

AddMenu Special "Unmangle Name/U" \d
 'Alert -s `UnmangleTool \d`Catenate "{active}.\6"\d``'


[  \d means <option>-d,  \6 means <option>-6  ]
-- 
Bruce.Hoult@bbs.actrix.gen.nz   Twisted pair: +64 4 477 2116
BIX: brucehoult                 Last Resort:  PO Box 4145 Wellington, NZ
"Cray's producing a 500 MIPS personal computer with 256MB RAM and 8 GB
hard disk that fits in your pocket!"   "Great!  Is it PC compatible?"
From: jpurlia@qualcomm.com (John Purlia)
Newsgroups: comp.sys.mac.programmer
Subject: vSynchWait and PowerBook I/O
Date: 13 Oct 92 00:16:40 GMT
Followup-To: comp.sys.mac.programmer
Organization: Qualcomm, Inc.

I've writted an app that communicates to an external device via the modem
port.  My app runs fine on a Quadra 700 and a IIci, but hangs forever and
ever and ever when run on a PowerBook 170.  A protocol analyzer reveals
that nothing is ever sent from the serial port when I call FSWrite.  When I
trace through the code using MacsBug I find that the code is at the
following:

_vSynchWait
    +0000    4080BB8C    MOVE.W $0010(A0),D0
    +0004    4080BB90    *BGT.S	_vSynchWait

The value being tested is always 0001, which leads me to believe that I'm
waiting for the asynchronous I/O to complete.  My question...  Why does
this only happen on a PowerBook and what are some of the possibilities for
things I'm doing incorrectly?

Thanks!
...........................................................................
John Purlia          : My brain; not my company's brain.  My brain says...
jpurlia@qualcomm.com : "The Toolbox giveth, and the Tech Notes taketh away"
...........................................................................
Newsgroups: comp.sys.mac.programmer
Subject: Re: Bug in Mac ROMs
From: russells@ccu1.aukuni.ac.nz (Russell Street)
Date: Tue, 13 Oct 1992 21:50:22 GMT
Organization: University of Auckland, New Zealand.

michael@otago.ac.nz writes:

>Argh!
I could not agree more.

>I have just found this little gem being executed in the ROM of my IIsi (System
>7.0.1, TuneUp 1.1)

>408177A6:  MOVE.L A0,-(A7)
>           _LoadResource
>           _HLock

RTfM:
	IM I-113: "LoadResource preserves A0 and D0 as well."

These people *really* know what they are doing :)

>Unless I'm hallucinating again, this is a bug. It relies on A0 being preserved
>across the _LoadResource call, something it has no right to do. It only works
>because it so happens that the present _LoadResource does preserve A0. Or it
>did until I patched it...

There is only one word for people like you (and me -- patching traps is
fun isn't it): movem.l

>I want new ROMs. Immediately :-).

-------------------------------------------------------
And with that remark, folks, the case of the Crown vs
Russell Street (russells@ccu1.aukuni.ac.nz) was proven.


Newsgroups: comp.sys.mac.programmer
From: essam@gagme.chi.il.us (Essam Khairullah)
Subject: Re: Think C++??
Originator: essam@gagme
Organization: Gagme Public Access UNIX, Chicago, Illinois.
Date: Tue, 13 Oct 1992 12:43:12 GMT

In article <1992Oct9.195615.29886@gn.ecn.purdue.edu> jess@gn.ecn.purdue.edu (Jess M Holle) writes:
>Any idea as to how long before Think C goes C++?  Will it ever?
>

The last I heard out of THINK on this subject was more or less, "No, I don't
think we'll ever make a THINK C++.  THINK C's class support is more than you
ever need anyway, so just get used to it."

I'm pretty sure that Symantec has bought out Zortech on their Mac C++ compiler,
but I don't know if it's nearly as good as THINK C.  In fact, it might even
be a tool for MPW!  I'm not really sure...

>MPW C++ is not a "wonderful enough" of an environment to be of much 
>use around here either. 

I have never quite figure out why people would want to use MPW anything to
do any programming!  It just seems to be so archaic!  Maybe if they put a
Commando shell on it (ala A/UX) it would be easier to use...  But then just
remember that this (MPW) is coming from the same people who invented the idea
of using a Lisa to program a Mac...


-- 
                    Essam Badi' Abu Khalil Khairullah
			  essam@gagme.chi.il.us
	             I don't got no fancy signature!
I'm a .signature virus. You can't resist copying me into your .signature!
From: mkelly@mystix.cs.uoregon.edu (Michael A. Kelly)
Newsgroups: comp.sys.mac.programmer
Subject: Telling the Finder to update a file's type & creator
Date: 12 Oct 92 06:53:32 GMT
Organization: University of Oregon Computer and Information Sciences Dept.


Hi everyone,

I'm writing yet another program to change a file's type and creator.  I would
like to tell the Finder to immediately update the file's icon and/or Kind
when I change the type and/or creator.  I know it's possible, because
Now Utilities' StartUp Manager does it when it turns extensions on and off,
but I can't find anything in the literature that tells how to do it.  Perhaps
I just haven't dug deep enough, but I'm hoping someone can just tell me
how to do it, or where I can find that information.

Thanks,

Mike.
-- 
_____________________________________________________________________________
Michael A. Kelly                                         University of Oregon
mkelly@cs.uoregon.edu                             Computer Science Department
_____________________________________________________________________________
Newsgroups: comp.sys.mac.programmer
From: jlawrie@fraser.sfu.ca (John William Lawrie)
Subject: OOP question
Summary: Need help with designing a data structure Using TCL
Keywords: OOP think
Organization: Simon Fraser University, Burnaby, B.C., Canada
Date: Thu, 15 Oct 1992 06:58:13 GMT

Hey guy, I was wondering if anybody out there could give me some advice about
data structures for a space stratege game (vaguely similar to spaceward ho).

Do I try to create a galaxy object (Using think C 5.03) as a subset of one of
the existing objects, Or should it be a root object?  My friend and I were
kind of thinking of making a subclass of a list for our galaxy object.  We
could then store planet objects it it.

If this is the way to go, should our planet objects be picture, or should they
be icons?  Although I seem to have an intuitive understanding of what an Icon
is, what makes it different from just being a small picture?  Are there any
cool and easy ways to select and check if an icon is selected?

Any help would be greatly appreciated.

Thanx in advance

Newsgroups: comp.sys.mac.programmer
From: siegel@world.std.com (Rich Siegel)
Subject: Re: Adapting old MacPascal program to MPW
Organization: GCC Technologies
Date: Thu, 8 Oct 1992 13:29:25 GMT

In article <ednstras.718517579@kraken> ednstras@kraken.itc.gu.edu.au (Michael Strasser) writes:
>I have been asked to adapt a MacPascal program to MPW so it can be used
>again.
>
>Some preliminary work has shown that the program's dependence on MacPascal's
>text and drawing windows and a few other things will be a major problem.  I
>have tried to use the MPW SIOW option but the program doesn't even create a
>window: it just stops at the first writeln statement.
>
>This program does some QD stuff itself, so it looks as if I'll have to write
>a proper Mac program to replace the old one.
>
>Does anyone have experience with such adaptations or have any suggestions?

It's probably a lot easier to adapt the program to THINK Pascal, which supports
the same Text and Drawing windows that Mac Pascal does.

R.


-- 
-----------------------------------------------------------------------
Rich Siegel                              Internet: siegel@world.std.com
Software Engineer & Toolsmith
GCC Technologies
From: michael@otago.ac.nz
Newsgroups: comp.sys.mac.programmer
Subject: Re: Bug in Mac ROMs - NOT
Date: 14 Oct 92 13:28:15 +1300
Organization: University of Otago, Dunedin, New Zealand

In article <1992Oct14.091914.59@otago.ac.nz>, michael@otago.ac.nz writes:
> 
> Argh!
> 
> I have just found this little gem being executed in the ROM of my IIsi (System
> 7.0.1, TuneUp 1.1)
> 
> 408177A6:  MOVE.L A0,-(A7)
>            _LoadResource
>            _HLock
> 
> Unless I'm hallucinating again, this is a bug. It relies on A0 being preserved

Damn. Which it is entitled to, by a strange quirk. I hadn't noticed a note at
the start of the Resource Manager chapter which points out that LoadResource
preserves all registers (why there?). My apologies.


Michael(tm) Hamel, Computing Services Centre, University of Otago, New Zealand

ROOSEBECK (n.)                     
Useful all-purpose emergency word. When a child asks `Daddy, what's that
bird/flower/funny thing that man's wearing?' you simply reply `It's a
roosebeck, darling'.

Newsgroups: comp.sys.mac.programmer
From: mkelly@mystix.cs.uoregon.edu (Michael A. Kelly)
Subject: C.S.M.P. Digest V1 #179 Available
Followup-To: poster
Organization: University of Oregon Computer and Information Sciences Dept.
Date: Sat, 10 Oct 1992 06:39:41 GMT


C.S.M.P. Digest             Fri, 09 Oct 92       Volume 1 : Issue 179

Today's Topics:

	ColorTables:  misc. tidbits and code
	Keeping the cursor visible
	Zbasic+System 6/7 Speed
	Function missing from MPW C library?



The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.

The digest is a collection of article threads from the internet newsgroup
comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
regularly and want an archive of the discussions.  If you don't know what a
newsgroup is, you probably don't have access to it.  Ask your systems
administrator(s) for details.  (This means you can't post questions to the
digest.)

Each issue of the digest contains one or more sets of articles (called
threads), with each set corresponding to a 'discussion' of a particular
subject.  The articles are not edited; all articles included in this digest
are in their original posted form (as received by our news server at
cs.uoregon.edu).  Article threads are not added to the digest until the last
article added to the thread is at least one month old (this is to ensure that
the thread is dead before adding it to the digest).  Article threads that
consist of only one message are generally not included in the digest.

The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
[128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
file /pub/mac/csmp-digest/README before downloading any files.  The most
recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
archive has a mail server; send a message with the text '$MACarch help' (no
quotes) to LISTSERV@ricevm1.rice.edu for more information.

The digest is also available via email.  Just send a note saying that you
want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
automatically receive each new issue as it is created.  Sorry, back issues
are not available through the mailing list.

Send administrative mail to mkelly@cs.uoregon.edu.


-- 
_____________________________________________________________________________
Michael A. Kelly                                         University of Oregon
mkelly@cs.uoregon.edu                             Computer Science Department
_____________________________________________________________________________
From: tkelley@hel4.brl.mil (Troy Kelley)
Newsgroups: comp.sys.mac.programmer
Subject: buss error on ModalDialog
Date: 8 Oct 92 18:42:21 GMT
Organization: HEL

I am getting a buss error on this ModalDialog call and I am baffled as to why. 
Any suggestions would be appreciated.

void do_double_click(wPtr, eventp)
WindowPtr		wPtr;
EventRecord		*eventp;
{

	WObjsHandle			w_objs_hndl;
	short				i,my_task,items,Dialog_items,itemType;
	Rect 				TestRect,double_clicked_rect,done_rect;
	Point				mouse_pt;
	DialogPtr			task_hndl;
	GrafPtr				savedPort;
	Boolean				done;
	Handle				itemH;
	
	
	mouse_pt = eventp->where;
	items = 3;
	done = false;
	
	
	
	
	w_objs_hndl=(WObjsHandle)GetWRefCon(wPtr);
	
	for(i = 0; i< MAX_OBJECTS; i++)
		{
		TestRect = (**w_objs_hndl).object[i].bounds;
		if( ((**w_objs_hndl).object[i].type != NO_OBJ) &&
			(PtInRect(mouse_pt, &TestRect) == TRUE ) )
			{
			double_clicked_rect = (**w_objs_hndl).object[i].bounds;
			
			task_hndl = GetNewDialog(TEST_DIALOG,NULL,(wPtr)-1L);
			GetDItem(task_hndl,DONE_BUTTON,&itemType,&itemH,&done_rect);
			SetPort(task_hndl);
			ShowWindow(task_hndl);
			
				while(! done)
				{
				ModalDialog(NIL,&Dialog_items); /*** BUSS ERROR ****/
				
					switch(Dialog_items)
					{
						case DONE_BUTTON:
							done = true;
							
						break;
					}
				}
				DisposDialog(task_hndl);
			}
		}
	
	return;
	
}

Thank you 
Troy Kelley
From: mxmora@unix.SRI.COM (Matt Mora)
Newsgroups: comp.sys.mac.programmer
Subject: Re: out of memory with InvalRect
Date: 8 Oct 92 17:06:12 GMT
Distribution: usa
Organization: SRI International, Menlo Park, California

In article <1992Oct8.155432.12803@mcs.drexel.edu> udmorrow@mcs.drexel.edu (Daniel Morrow) writes:

>I make the call to InvalRect right after I dispose of a dialog
>and call NumToString, although I don't know why this should matter.


You probably forgot to set the port to a valid port after you closed the
dialog. Most of the provlems with simple quickdraw calls like this are caused
by not setting the port. ( Think Pascal users usally see this after they build
the application as stand alone.)

Matt
-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________
Newsgroups: comp.sys.mac.programmer,comp.sys.mac.comm
From: Andreas Wuertz <wuertz@tik.ethz.ch>
Subject: Re: CTB Tool Menu Wierdness...
Organization: Federal Institute of Technology
X-Useragent: Nuntius v1.1
Date: Mon, 12 Oct 1992 16:03:58 GMT

In article <84243D415D@ivt.srcc.msu.su> Vladimir Butenko,
butenko@stalker.srcc.msu.su writes:
> The resource files of the CTB tools opened are not included  into  the
> resource files chain, so the attempt to find the MDEF resource  fails,
> since the MDEF is stored in the System file.

Might it be that this problem is fixed in System7? I wrote a tool with a
popup. When I use it in Sys7, everything works fine; when I use it in
Sys6+CTB, it bombs as soon as I hit the popup (but the popup appears ok
in the initial dialog). Or does anyone know a fix for my problem?

Andy (wuertz@tik.ethz.ch)

========================================================================
The only person who got all his work done by Friday was Robinson Crusoe.
========================================================================
From: scott@mcl.ucsb.edu (Scott Bronson)
Newsgroups: comp.sys.mac.programmer
Subject: Big problem with the Control Manager
Date: 11 Oct 92 20:27:55 GMT

I a nutshell, I need to figure out how to get a contrlAction proc to work
with both indicators and non-indicators.  The warning at the bottom of the
page of Inside Macintosh I-324 explains the problem perfectly.  If anyone
knows a good way to get around this, please please get ahold of me.

Here's the background.  I've written a CDEF that implements a scrolling
list of virtual serial ports like most of Apple's CTB tools.  I'm going
to release this CDEF to the 'net so no one else has to spend time writing
something like this when it should be a part of the CTB.

Obviously my CDEF can't contain a scroll bar (I tried--the control manager
gets all confused at having this weird dual behavior in the control list)
so, no problem, I'll just creat the scroll bar using its own CNTL template
then couple it to my CDEF with a single call.  This coupling sets, among
other things, the contrlAction of the scroll bar to point at my CDEF's
code, so that when someone scrolls, my port list box gets updated.

Works like a champ until someone clicks in the thumb.  Then I pop some
parameters that don't exist off the stack and, well, chaos ensues.  This
one procedure is getting called with two sets of parameters, and I'm
paying the price.

I've worked out a solution that uses inline assembly.  I check up the stack
to see if theControl is equal to the control handle I'm expecting.  If it is,
then I assume we're in a part and call my action procedure.  If it isn't,
I assume we're in an indicator and don't pop any parameters.  It works, but
it's rather skanky.  There's gotta be a better solution.

Has anyone else solved this problem?  I'd definitely like to hear how.
Thanks for any ideas!

	- Scott
anything when the indicator 

Newsgroups: comp.sys.mac.programmer
From: sctbutz@kraken.itc.gu.edu.au (Kirk Butz)
Subject: writing directly to an offscreen pixmap
Keywords: pixmap
Organization: ITC, Griffith University, Brisbane, Australia
Date:  8 Oct 92 04:39:05 GMT

i am trying to write a routine in mpw pascal that will write directly to an
offscreen pixmap.  i have got all the offscreen stuff working and can write
using quickdraw commands, but this is too slow.  does anybody have a bit of
code or advice on how to write directly into the pixmap of an offscreen
graphics buffer?  thanks in advance.
kirk
From: rgasch@nl.oracle.com (Robert Gasch)
Newsgroups: comp.sys.mac.programmer
Subject: Trensferring Icons
Date: 8 Oct 92 11:37:28 GMT
Organization: Oracle Europe

A friend of mine has some icons that he would like to send me
for use in a program. I want to end up using these on an XWindow
environment. Is there an easy way to transfer icons to the 
XWindow Bitmap format??

If anybody has (successfuly) attempted this, I'd like to hear from
them.

Thanks
--> Rob
From: mac@coos.dartmouth.edu (Milton A. Colvin)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Productivity of a C programmer ?
Date: 12 Oct 92 01:40:46 GMT
Organization: Dartmouth College, Hanover, NH

On my best days, I have managed to eliminate several hundred lines of code
in order to add functionality. Guess that gives me negative productivity...
From: gasser@eniac.seas.upenn.edu (Nathan Gasser ><>  )
Newsgroups: comp.sys.mac.programmer
Subject: Help with shrinking heapSpace in HyperCard XFCN?
Date: 12 Oct 92 03:47:34 GMT

Hi all,

I'm writing an XFCN for HyperCard with THINK Pascal.  This 
is my first, so it's not too impressive.  It returns the 
first item in a comma-separated.  Problem is, the heapspace
decreases after each execution.  It's only a few lines --
Can anyone take a look and tell me what's wrong?

Thanks a ton,
Nate.

-----
unit DummyUnit;
interface
uses
  HyperXCmd;
procedure main (paramPtr: XCmdPtr);

implementation

procedure main (paramPtr: XCmdPtr);
 var
  outputList: handle;
  scanPtr, startPtr, outPtr: Ptr;
  lineLen: integer;
begin
  outputList := NewHandle(GetHandleSize(paramPtr^.params[1]));
  scanPtr := paramPtr^.params[1]^;
  outPtr := outputList^;
  startPtr := scanPtr;
  while scanPtr^ <> 44 do
   scanPtr := Pointer(ord(scanPtr) + 1);
  lineLen := ord(scanPtr) - ord(startPtr);
  BlockMove(startPtr, outPtr, lineLen);
  outPtr := Pointer(ord(outPtr) + lineLen);
  outPtr^ := 0;
  SetHandleSize(outputList, StringLength(paramPtr, outputList^) + 1);
  paramPtr^.returnValue := outputList;
 end;
end.
 


--

Nathan Gasser       ><>         
gasser@eniac.seas.upenn.edu     

Newsgroups: comp.sys.mac.programmer
From: heksterb@cs.utwente.nl (Ben Hekster)
Subject: Re: Deferred Tasks - What can I do?
Organization: University of Twente, Dept. of Computer Science
Date: Wed, 7 Oct 1992 10:39:50 GMT

In article <Bvq666.MHH@news.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes:
>Can I move memory (e.g. call NewPtr) in a deferred task, i.e. one I
>installed with DTInstall?

I would say, no.  The only difference between a VBL and a Deferred Task
is that a VBL task executes while the processor interrupts are being
serviced, and a Deferred Task is executed after processor interrupts
are reenabled.  This is so that you don't get a System Error when
another interrupt arrives while you are still executing a (lengthy)
task.  For all other practical purposes, you are still executing at
interrupt time-- i.e., the heap may be in an inconsistent state, etc.

-- 
Ben `Hackster' Hekster		| "He bides his time and thinks,
heksterb@cs.utwente.nl		|  'There must be more to life than this!'"
Newsgroups: comp.sys.mac.programmer