HDTenEightyP/NetNews huggingface dataset:
From: davidp@stealth.usc.edu (David Peterson)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Porting code from UNIX: how to get rid of printfs
Date: 24 Jan 1993 19:16:14 -0800
Organization: University of Southern California, Los Angeles, CA
Distribution: world
Reply-To: davidp@usc.edu
NNTP-Posting-Host: stealth.usc.edu
Keywords: unix, porting


In article <C1DCus.B0q@cs.uiuc.edu>, totic@milton.cs.uiuc.edu (Aleksandar Totic) writes:
|> Hello,
|> I am using some UNIX code on the Mac. It works fine, with the exception
|> that occasionally the code uses printf to print diagnostics and errors.
|> Currently I am using Think C, but soon I`ll port it to MacApp also.
|> The result of printf in ThinkC is to pop up a console window. Is there
|> any way to get rid of this behaviuor, maybe pipe the statements into
|> dialog boxes, or my own error window? All comments are welcome, I do 
|> not know if there is a right answer to this.
|> 

You could define a macro that re-routes it to MacsBug. Its really annoying,
but it works great for debugging diagnostics.

#define printf MBPrintf
void MBPrintf(char* form, ...)
{
	va_list ap;
	char	str[256];

	va_start(ap, form);
	vsprintf(str, form, ap);
	va_end(ap);
	DebugStr(c2pstr(str));
}

If you want to jump into MacApp, just compile it with one of the debug
libraries and printf's will get sent to a window in SourceBug if you have
it running. Sort of a neat concept.

-dave.
Newsgroups: comp.sys.mac.programmer
From: jbrowne@zaphod.ncsa.uiuc.edu (Jim Browne)
Subject: Re: Where to upload/distribute shareware to? - FAQ Answer
Organization: University of Illinois at Urbana
Date: Fri, 22 Jan 1993 04:59:38 GMT

peter@cujo.curtin.edu.au (Peter N Lewis) writes:

>The file will be forwarded to the umich, info-mac and other archives, as
>well as comp.binaries.mac (but not comp.sources.mac, all sources and
>binaries go to comp.binaries.mac)-:

Who's in charge of comp.sources.mac anyway?  Is it moderated?


-- 
Jim Browne                                          | jbrowne@ncsa.uiuc.edu  |
NCSA/STG System Administrator                       | stgadmin@ncsa.uiuc.edu |
System Administration: Where the fun never ends...  | (217) 244-7798         |
--"It's really weird... kind of like how Telnet is programmed." - Q. Koziol --
From: stern@comb1.comb.umd.edu (Brian Stern; COMB)
Newsgroups: comp.sys.mac.programmer
Subject: Re: I hate THINK Pascal...
Date: 25 Jan 1993 14:13 EST
Organization: University of Maryland, Center of Marine Biotechnology
Distribution: world
NNTP-Posting-Host: comb1.comb.umd.edu
News-Software: VAX/VMS VNEWS 1.41    

In article <1993Jan24.005729.13045@fcom.cc.utah.edu>, Dmitry Boldyrev <dmitry@chemistry.chem.utah.edu> writes...
>Hello,
>I really hate THINK Pascal now!! :( Because, whatever I do,
>all couse problems..
>I'm working on Molecular Designer package and would like to write Floating
>palettes. Problem with Events, partcicularly with App4Evt, made me CRAZY!!
>If you have enought time, please take a look on this fragment of my code:
> 
code deleted

This is a bug in Think Pascal.
In my experience Think Pascal NEVER passes suspend/resume events to an
application running in the Think environment :-(
However, if you build and SaveAs a double-clickable application, your compiled
program will receive these events as you would expect them to :-)
Obviously you can't use source level debugging for your suspend/resume
processing, but it shouldn't be that difficult to debug that code anyway.
As I'm writing this it occurs to me that Pascal might not trap the supend/resume
events if you have debug off for the unit containing your event loop. However,
if you are switching in or out of your program Pascal has to process these
events also. It ought to pass them to your program but it doesn't.
Hope this helps,

BrianS

Stern@mbimail.umd.edu


Newsgroups: comp.sys.mac.programmer
From: UC525655@mizzou1.missouri.edu (M.Eaton)
Subject: Help dragging icon outlines?
Organization: University of Missouri
Date: Wed, 27 Jan 93 21:16:47 CST

 
Hi-
Does anyone have a code example to drag the outline of an icon around
the screen (a la Finder)? I have the icon, and I can follow the cursor,
plotting the icon, and I can erase what I plotted, but this also erases
other icons etc. I decided to switch over to using IconSuiteToRegion
and FrameRgn. But all I've accomplished is to confuse myself...
Can anyone give me tips, pointers or especially example code?
 
mark
From: baker4@scws6.harvard.edu (David Baker)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Serial question
Date: 27 Jan 93 00:46:43 GMT
Article-I.D.: scws6.BAKER4.93Jan26164643
Distribution: comp
Organization: Department of Psychology, Harvard University
In-reply-to: dpb@huelings.harvard.edu's message of 26 Jan 93 16:38:09

Oh, I forgot: also, I get a non-zero error from the SerReset call.  The error
is -21, which I see is badUnitErr (Driver reference num,ber doesn't match unit table).
--
--------------------------------------+----------------------------------------
David P. Baker			      | 
Work: dpb@huelings.harvard.edu	      | The only reason we think we're free is 
Home: baker4@husc.harvard.edu	      | that we cannot imagine the alternative.
Office: William James Hall 844	      |	
	Department of Psychology      | 
	Harvard University	      |	N.B.: If responding by mail, please
	(617) 495-3773		      |	      use my "Work" address above.
--------------------------------------+----------------------------------------
From: tal691@huxley.anu.edu.au (Tonio Loewald)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Why the Piracy? Here's why...
Date: 26 Jan 93 12:18:51 GMT
Organization: Australian National University
NNTP-Posting-Host: 150.203.2.12

UC525655@mizzou1.missouri.edu (M.Eaton) writes:

>Look folks - this argument has been raging for over a month now, and
>the interested parties have pretty much drawn - up the lines, and
>encamped on either side. Now its time to come up with a solution.
>About the only thing everyone agrees on is that a problem exist with
>software distribution in its present form, what should we do? Right
>now, the people who are piratiing aren't willing to buy software
>until the prices come down, and the vendors aren't willing to lower
>prices until more people start buying... A catch 22...

It's worse than that. The vendors are probably lying: they won't
lower prices if piracy stops -- that's the problem. Otherwise, why
aren't relatively unpirateable Nintendo or Sega cartridges _much_
cheaper than similar games for PCs?

And the pirates are lying. Most of them won't pay for software no
matter how cheap it is (within practical limits).

--

Here's a _really_ bad solution to get things rolling.
The government puts a tax on computers (based on overall oomph,
say) and diskettes etc. It then allows software to be obtained
legally, for free, from distribution sites. Documentation is
sold through regular channels, but certain royalties go to
the software publishers, who also get money from the govt
taxes based on apparent popularity (from central distribution
points) of software and other considerations (platform,
importance -- as determined by someone omniscient).

This has a lot of advantages, but requires the government to
_efficiently administrate a large program_ -- ie. the tooth fairy.
Assuming the tooth fairy -- ie. the omniscient distributor of
monies to worth software publishers -- existed, an economist
might continue, we would have a better incentive structure for
software creation AND the desireable situation that no-one who
needed a computer program would have any reason not to use it
or to use an inferior but similar program, since computer
programs -- once written -- cost nothing to distribute. I also
get to reform an irritating little injustice whereby the
people who write third party documentation for stuff make moneuy
off pirates and give nothing to developers.a

Tonio

-- 
Tonio Loewald | tal691@huxley.anu.edu.au

"Yes!! For the hundred and fiftieth time!
 We're burning in hell!!!" (John Callahan)
Newsgroups: comp.sys.mac.programmer
From: Jim Moy <jbm@gr.hp.com>
Subject: Fixing Process Type/Creator under THINK C?
X-Useragent: Nuntius v1.1.1d17
Date: Wed, 27 Jan 1993 22:10:14 GMT
X-Xxdate: Wed, 27 Jan 93 15:10:40 GMT
Organization: Hewlett-Packard, Greeley Hard Copy Division

When running an app in the THINK C environment, the app is
given Type/Creator PROJ/KAHL.  Is there any way to change this?

The reason I'm asking is there are certain commands within
Userland Frontier which take a creator and look through the
process list for applications (type 'appl') to send events
to it.  I'd like to use Frontier for sending Apple Events
because of its robust support, but they keep getting sent
to the THINK C application because it's process info is
appl/KAHL.

Thanks for any help.
Newsgroups: comp.sys.mac.programmer
From: peter@cujo.curtin.edu.au (Peter N Lewis)
Subject: Re: Where to upload/distribute shareware to? - FAQ Answer
Followup-To: comp.sys.mac.programmer
Organization: NCRPDA, Curtin University
Date: Fri, 22 Jan 1993 02:08:37 GMT

FAQ Posting answer:

So you want to submit a program or file to the various mac Internet ftp
sites?
This is what you do:

Package all your files up into a StuffIt or Compactor archive (using
StuffIt or Compactor obviously :).  Name the archive like this including
the version number, preferably without any spaces, eg:
myfile-215.sit

BinHex encode the resulting archive (using StuffIt or Compactor).  Edit the
resulting file and include a short (two or three paragraphs, hard carriage
returned wrapped to 70 columns) describing the file.  If it requires any
particular programs, systems or machines, mention them.  If it is an
update, include information about the original and the changes (but keep it
short!).  At the end you can have a one line signature (no more acording to
info-mac posting guidelines).  Save the resulting file (make sure its still
a TEXT only file!)

Send the resulting file via Email to macgifts@mac.archive.umich.edu with a
subject like:
util/myfile-215.hqx
or 
source/pascal/myfile-215.hqx

If you are distributing source code as well (please do!), then package and
send the source code seperately from the binary (unless the source is
particularly short, eg an LDEF).

The file will be forwarded to the umich, info-mac and other archives, as
well as comp.binaries.mac (but not comp.sources.mac, all sources and
binaries go to comp.binaries.mac)-:

Good luck,
   Peter.

_______________________________________________________________________
Peter N Lewis <peter@cujo.curtin.edu.au>             Ph: +61 9 368 2055
From: REEKES@applelink.apple.com (Jim Reekes)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Closing files at interrupt time
Date: 29 Jan 93 00:49:21 GMT
Followup-To: comp.sys.mac.programmer
Organization: Apple Computer, Inc.

In article <1993Jan26.171135.13445@waikato.ac.nz>, ldo@waikato.ac.nz
(Lawrence D'Oliveiro, Waikato University) wrote:
> 
> In article <1993Jan25.204808.11120@news.media.mit.edu>, delphi@media-lab.media.mit.edu (Andrew J. Kass) writes:
> > I am writing a library of sound routines, but have recently run into a major
> > problem. I am playing files using SndStartFilePlay asynchronously. In the
> > completion routine, I set my A5 to access my globals, get the fRefNum of the
> > file I was playing, and then call FSClose to close the file. The problem is,
> > every now and then, not at repeatable intervals, the machine will hang during that
> > call to FSClose. I can get into MacsBug and look at the stack to verify that it
> > is hanging during FSClose, but any attempt to exit to shell fails and I have
> > to reboot the machine.
> 
> I'd say the problem is the file system is in the middle of another call when
> your interrupt routine tries to do the close. Remember, the file system
> can only process one call at a time! What you should do is use PBCloseAsync
> instead, which will queue the request for execution when the file system
> isn't busy.
> 
> This is probably a general rule with *all* services that have an asynchronous
> and a synchronous form: *never* use the synchronous form from interrupt level.

One more thing. You shouldn't call the File System from an interrupt level,
even asynchronously. If the file system isn't busy, then the call will
happen immediately. This also means that you're holding off interrupts
until the transaction has completed since the SCSI Mgr is not asynchronous.
Therefore, calling its asynch can really be synchronous. You may not hang
at the interrupt, but you may hold off interrupts too long.

It's best to set a flag and perform the I/O from within the event loop, at
non-interrupt level.

-----------------------------------------------------------------------
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: rudolph@unixg.ubc.ca (Christopher E Rudolph)
Newsgroups: comp.sys.mac.programmer
Subject: Resources
Date: 23 Jan 93 21:27:43 GMT
Organization: The University of British Columbia
NNTP-Posting-Host: unixg.ubc.ca
Summary: Is there a quick method of cycling through all resource in an app?
Keywords: resources help manager


Hello all,

Can anyone tell me if there is an quick way of opening an applications
resource fork and then cycling through every resource in the application
so that I can display them in a list.

ie) simaler to what resource editors do

I basically want to know what methods are available to read off every
resource in an applications resource fork?

hope this is understandable, thanks in advance,

-----------------------------------------------------------
Chris Ruodlph (ComputerScience, UBC) <rudolph@unixg.ubc.ca>
|| Point To Ponder - What Is Meaning? ||
-----------------------------------------------------------
Newsgroups: comp.sys.mac.programmer
From: gwatts@fnalo.fnal.gov
Subject: Verifying valid handles, how to?
Organization: Fermi National Accelerator Lab
Date: Fri, 22 Jan 1993 07:55:20 GMT
X-Posted-From: fnalo.fnal.gov
NNTP-Posting-Host: sol.ctr.columbia.edu

Hi all,
  The first part is an amusing story.  The second request for help is aimed
at anyone who is good at the memory manager. :)  Everyone, right? :)
  I spent about 4 hours tracking down a but in my Think C 5.0.3 program
yesterday.  It was crazy.  My color table kept getting corrupted.  I would
never bomb in the same place.  Sometimes the "rb" command in MacsBug wouldn't
even work!  I had icons explode into little dots.
  Turns out (sheepish grin) I was deleteing an object twice. :)
  At any rate, I was thinking.  I've got only indirect objects in my project.
This means every object is a handle, right?  Well, why not, in the debug
version of the message dispatcher (oopDebug library) put a little code that
will check the object is infact allocated as a handle?
  I checked out the routine in msg.c (in the oops Libraries folder), and
the handle is stored in register a1.  I don't know, however, how to check
if it is a valid handle without causing an error (bus or otherwise) of
somesort.  Especially if it is a random number!  Anyone know?  Is there
some memory manager routine, given a suspected handle, will tell me this?
  By the way -- I do zero all objects after I delete them.  This case was
a little more subtle than that (so don't yell at me :)).

	Cheers,
		Gordon.

Newsgroups: comp.sys.mac.programmer
From: nagle@netcom.com (John Nagle)
Subject: Re: AfterDark modules?
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Tue, 26 Jan 1993 05:15:32 GMT

asunta@convex.csc.FI (Miika Asunta) writes:
>Where can I find C headers and documentation
>how to write afterdark modules? Is it included in the package?

     Yes.

					John Nagle
From: rudolph@unixg.ubc.ca (Christopher E Rudolph)
Newsgroups: comp.sys.mac.programmer
Subject: Desktop Icon Problem (ResEdit)
Date: 22 Jan 93 04:53:45 GMT
Organization: The University of British Columbia
NNTP-Posting-Host: unixg.ubc.ca
Summary: For some unkown reason I can't seem to get the ResEdit icon to show on
Keywords: help


This probably isn't the place for this question but here goes.

Okay, I just received a new hard drive yesterday and installed was Sys
7.0.1 w/ Tuneup 1.1.1 . My old system was 7.0 w/ Tuneup 1.1.1

Okay, so I spend the better part of a day cleaning up and reformatting
everything so that the same SCSI drivers were the same..I rebooted in the
end and rebuilt my desktop.  Everything was fine except for ResEdit, on
the default application Icon not the JackInTheBox icon that I'm used to. 
No problem, I rebuilt the desktop again...still no luck..Ok so I removed
all the desktop files manually(made them visible and deleted them) Still
no luck...Everything else is fine...So I checked the BundleBit in
ResEdit..That was set so it should be using the icons, which were
there....hmmm....I don't know what is going on here...Is there anything
else I can do to resolve this...This is a first for me...usually I have
the problem solved with rebuilding the desktop or at most trashing the
Desktop files...

Any insight is appreciated...

Chris Rudolph (ComputerScience, UBC) <rudolph@unixg.ubc.ca>
|| A Point To Ponder - What Is Meaning? ||


From: bayes@hplvec.LVLD.HP.COM (Scott Bayes)
Date: Tue, 19 Jan 1993 17:38:04 GMT
Subject: Re: Re:Was( Shareware compilations- what's the full scoop?
Organization: Hewlett-Packard Co., Loveland, CO
Newsgroups: comp.sys.mac.programmer

> mastering cost). All share ware authors now need to place ANTI-CD ROM
> massages in their programs that specify that the software has not been
> paid for, and that a better version exists if some fee is paid.
> 

How 'bout just putting in code to write a temp file to the program
medium, then erase it.  This would cause enough complaints by people who
have to copy it off the CD ROM to use it that eventually someone might
get the idea.  (maybe you :-)

ScottB
From: davidp@stealth.usc.edu (David Peterson)
Newsgroups: comp.sys.mac.programmer
Subject: Re: MacTCP - getservbyname code, anyone - inetd server
Date: 26 Jan 1993 12:21:22 -0800
Organization: University of Southern California, Los Angeles, CA
Distribution: world
Reply-To: davidp@usc.edu
NNTP-Posting-Host: stealth.usc.edu


In article <1993Jan22.185307.20294@dtint.uucp>, tom@dtint.uucp (Thomas R. Kimpton) writes:
|> I've thought, and I'm sure others have, about writing an "inetd"
|> program for the mac that would provide services on the mac.  It
|> would have a services file that had the service name, protocol
|> (UDP/TCP), port number, and program to launch.  However, I came

I've done this. I'm in the process of debugging it and writing it up as a
possible MacHack paper. Send me mail if you want a copy of it to test out.
Right now I've got an inetd, control panel to configure it, fingerd, rshd,
and a one-way rcp.

|> across a major snag:  When you create a MacTCP stream you have
|> to give it a buffer for input buffering.  There is no provision
|> for replacing the existing buffer with a new one. This means that
|> if I want to have my program setting on a port, then hand that
|> port to another program, the memory buffer will come from
|> my heap, and if I quit, the buffer I handed off with the
|> stream is no longer valid.  While it's possible to do, it wouldn't

Allocate memory for the MacTCP buffer in the system heap. This came
from DTS as the safest place to put shared memory.

I hadn't thought about chaning the buffer size on a per-stream basis,
I just make them all 8k. It wouldn't be hard to put an extra parameter
in the configuration specifying buffer size though.


-dave.
Newsgroups: comp.sys.mac.programmer
From: rmah@panix.com (Robert Mah)
Subject: Re: process info problems
Organization: PANIX Public Access Unix, NYC
Distribution: comp.sys.mac.programmer
Date: Mon, 25 Jan 1993 10:07:29 GMT

In <SMARGARI.93Jan24154951@emmy.nmsu.edu> smargari@nmsu.edu (Susan Margarit) writes:

> Consider the following code fragment:

> err := GetFrontProcess(psn);
> err := GetProcessInformation(psn,info);

> after the first line, err is 0 but after the second line, I get error
> -50 (process serial number is invalid). It seems like a pretty
> straight forward piece of code. Why does it fail? (sys 7.1). It
> doesn't matter if I run it standalone or in TP projects, foreground or
> background.

Hmmm, did you set the fields of the info parameter.  Remember, you've got
to tell the Process Manager the sizeof the info record, set a buffer for
the name and a buffer for the FSSpec.  Sort of pain, in my opinion.

In other words, I think the error may not be valid and you just forgot
to set up the info param block.

Rob
-- 
[----------------------------------------------------------------------]
[ Robert S. Mah   | Voice: 212-947-6507   | "Every day an adventure,   ]
[ One Step Beyond | EMail: rmah@panix.com |  every moment a challenge" ]
[----------------------------------------------------------------------]
Newsgroups: comp.sys.mac.programmer
From: R1025C@waccvm.corp.mot.com (John Famolaro)
Subject: help, trying to launch tn3270 and panorama from with think c
Organization: Motorola
Date: 22 Jan 1993 15:01:12 MST

I am trying to create a think c application that will first launch tn3270
and when done with tn3270 return to the think c app and launch panorama.
can this be done, if so how, do you have any sample code that I could
see.

thank you very much
john famolaro
Newsgroups: comp.sys.mac.programmer
From: cokenias@netcom.com (Damon Cokenias)
Subject: Re: CPU load
Organization: Netcom - Online Communication Services (408 241-9760 guest)
Date: Thu, 28 Jan 1993 08:17:21 GMT

In article <1k1p8bINNjuc@skeena.ucs.ubc.ca> sainaney@unixg.ubc.ca (Narayan R. Sainaney) writes:
>foreground application. Currently, I just check to see how many null
>events I get in 1 second (60 max right?) and then use the proportion  

Wrong.  The number of events per second (null or otherwise) depends on the speed
of your computer.  That might make your scaling a little more difficult as there
will not be any definite maximum/minimum.  There will be a statistical min and max but that's a little out of my realm.

It makes sense when you think about it.  You wouldn't want your Quadra 950 just
passing time before letting an application receive a null event.  And you'd have
a hard time getting 60 events per second on a plus.

As for determining CPU load-- I think you would need tru multiprocessing in order
to know more than multifinder friendliness.

Good luck.

-Damon