HDTenEightyP/NetNews huggingface dataset:
From: ray@netcom.com (Ray Fischer)
Subject: Re: HELP: Speedup SetCPixel
Organization: Netcom. San Jose, California
Date: Thu, 17 Dec 1992 02:38:31 GMT

KOHLER@IOC.unibe.ch writes ...
>Hi there!

Dude!

>I'm writing a program that should be able to read a file of characters
>and display for each of them a pixel in the corresponding color (8 bit).
>
>The problem is: IT'S VERY SLOW ....

Yup.  For each 8-bit pixel you put into the buffer, Quickdraw has to
take the 48-bit color you gave it and use a reverse-index table to get
the actual pixel value (which will be an index into the color lookup
table).  It also figures out where in the offscreen GWorld the pixel
belongs and checks for any clipping.

The trick to make this process go faster is to do as much of it as
possible only once at the beginning.  For example, if character 'X'
turn into blue, then one way to do all this a lot faster would be to
create a table at the beginning indexed by character and returning a 
pixel value.  Then store this pixel value directly into the offscreen 
GWorld's pixmap.

I'll leave the details as an exercise (I always hated that phrase when
I was a student, but now's not the time to do the research myself.
Look at the Color Quickdraw and Pallette Manager chapters in IM V)

-- 
Ray Fischer                   "Convictions are more dangerous enemies of truth
ray@netcom.com                 than lies."  -- Friedrich Nietszsche
From: rson@rhi.hi.is (Mimir Reynisson)
Newsgroups: comp.sys.mac.programmer
Subject: Menus with another font than Chcago
Date: 17 Dec 92 08:55:46 GMT

How can I let the standard MDEF display it's contents with something
other than Chicago? Geneva 9 to be precise? Is it sufficent
just to change the system font global variable? and then change it
back after PopupSelect?

Or do I have to write a whole new MDEF for a simple trick like that?
Not that it very hard, but emulating everything the standard MDEF
does is a bit of a vaste...
Newsgroups: comp.sys.mac.programmer
From: kohler@ubevx1.unibe.ch (Martin Kohler)
Subject: HELP: Speedup SetCPixel
Reply-To: KOHLER@IOC.unibe.ch
Organization: University of Bern, Switzerland
Date: Wed, 16 Dec 1992 08:10:24 GMT

Hi there!

I'm writing a program that should be able to read a file of characters
and display for each of them a pixel in the corresponding color (8 bit).

The problem is: IT'S VERY SLOW ....

The details: I get the size of the file and create a buffer to hold the
             contents. The file is read with fread in one step. Then, I
             create an off-screen world and set the GrafPort. The pixels
             are drawn each after the other with SetCPixel.

The question: How to do it faster ???


Thanks for ANY help!

Martin

-----------------------------------------------------------------------------
 Martin Kohler                      >>> Internet    : kohler@ubeclu.unibe.ch
 Institut fuer organische Chemie    >>> SPAN/HEPnet : 20579::UBEVX1::KOHLER
 Universitaet Bern                  >>> DECnet      : 49854::SYSTEM
 Freiestrasse 3                     >>> FidoNet     : 2:301/580.33
                                    >>> Phone       : +41 31 654363   
 CH-3012 Bern (Switzerland)         >>> Fax         : +41 31 654499
----------------------------------------------------------------------------
Newsgroups: comp.sys.mac.programmer
From: wolfmc@rtsg.mot.com (Michael Wolf)
Subject: Whats a good sound editor utility (for LCII)
Keywords: sound,utility
Organization: Motorola Inc., Cellular Infrastructure Group
Date: Fri, 11 Dec 1992 17:21:15 GMT

What is a good sound editor utility?  Hopefully one which is not very
expensive or possibly a good shareware utility.

I have tried a couple but I have had problems with some crashing on my
LCII.

Any suggestions?

I do not haver FTP access, so I would need a shareware item emailed to me or
it would have to be available at one of the mail servers.

Thankas.

MJW

-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-
| Michael J. Wolf          | McIntosh Jr:  The power to crush the other kids|
| Software Engineer        |                                                |
| wolfmc@green.rtsg.mot.com|      Disclaimer?  Hell, I don't even know her! |
-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-
From: d88-jwa@hemul.nada.kth.se (Jon Wtte)
Newsgroups: comp.sys.mac.programmer
Subject: Re: 3D Graphics
Date: 14 Dec 92 16:06:48 GMT
Organization: Royal Institute of Technology, Stockholm, Sweden

In <830021@hplvec.LVLD.HP.COM> bayes@hplvec.LVLD.HP.COM (Scott Bayes) writes:

>This has always annoyed me.  Bresenham's algorithm, which handles this
>very well--optimally, one might say--has been around _forever_.  Why
>does Apple choose to draw lines with "hooks" on the ends?

Because:

1) The thing QuickDraw does is actually FASTER for certain
special cases (including horizontal lines) while retaining
speed for the average case

2) Bresenham's is PATENTED. (Please, no more "You can't patent
an algorithm" flames; send them to your congressperson instead)

Cheers,

						/ h+

-- 
 -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --

   This article printed on 100% recycled electrons.
From: cconstantine@galaxy.gov.bc.ca
Newsgroups: comp.sys.mac.programmer
Subject: Curious about PICT resources??
Date: 14 Dec 92 07:44:03 -0800
Organization: BC Systems Corporation

I have a curiosity question that maybe someone out there can help me with. 
While poking around in some programs using ResEdit, I find that some people put
mutilple images (usually for animation sequences) in a SINGLE PICT resource. 
Case in point: Glypha II.  Now my question is how in the world do you pull up a
single part of a large PICT resource like that based on either mouse or
keyboard movement.????????? is there some great algorythm for this????

Just curious.  any help is appreciated.

Carl B. Constantine
CCONSTANTINE@galaxy.gov.bc.ca
Newsgroups: comp.sys.mac.programmer
Subject: New version of PrettyC?
From: seth@physc1.byu.edu
Date: 15 Dec 92 11:51:16 -0700
Distribution: world
Organization: Brigham Young University

Is there a modern version of PrettyC available? I downloaded the latest version
that Sumex had a month or so ago, and it crashed immediately on my machine. I
run sys. 7.1 on a 17/80 IIsi, with THINK C 5.0.4.
From: lkimes@alshain.usc.edu (Lance 'Moof' Kimes)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Unlocking a locked volume
Date: 11 Dec 1992 12:03:22 -0800
Organization: University of Southern California, Los Angeles, CA
Distribution: world
NNTP-Posting-Host: alshain.usc.edu


In article <cmcclary-101292152155@mcclary-mac.ucs.indiana.edu>, cmcclary@ucs.indiana.edu (Charles McClary) writes:
|> I assumed, from reading Inside Mac and Think Reference, that logically 
|> unlocking a logically locked volume would be as simple as:
|> 
|> void unlock()
|> {
|> 	HVolumeParam	pb;
|> 	OSErr			osErr;
|> 	Str255			volumeName;
|> 	SysEnvRec		SysEnvData;
|> 	
|> 	osErr = SysEnvirons(1, &SysEnvData);
|> 	
|> 	pb.ioVRefNum = SysEnvData.sysVRefNum; /* use startup drive */
|> 	pb.ioVolIndex = 0;
|> 	pb.ioNamePtr = volumeName;
|> 	pb.ioCompletion = nil;
|> 	
|> 	osErr = PBHGetVInfo(&pb, false); /* get volume info */
|> 	if (osErr == noErr)
|> 	{
|> 		pb.ioVAtrb &= 0x7FFF; /* set unlock volume bit */
|> 		osErr = PBSetVInfo(&pb, false); 
|> 		osErr = FlushVol(0, pb.ioVRefNum);
|> 	}
|> }
|> 
|> However, the PBSetVInfo receives a -46 (vLckedErr - Volume is locked),
|> which 
|> makes some sense.  What am I missing to correct this?
|> 
|> Thanks in advance,
|> 
|> Charles McClary
|> Indiana University
|> cmcclary@indiana.edu


Here is some code I wrote awhile back.

OSErr UnlockHD( short targetVRefNum)
{
        OSErr           Err;
        QHdrPtr         VCBQHdrPtr;
        VCB                     *ssvcb;

        Err = nsvErr;
        VCBQHdrPtr = GetVCBQHdr();
        ssvcb = (VCB *)VCBQHdrPtr->qHead;

        while((ssvcb != nil) && (ssvcb->vcbVRefNum != targetVRefNum))
                ssvcb = (VCB *)ssvcb->qLink;

        if (ssvcb->vcbVRefNum == targetVRefNum)
        {
                if (!BitTst( &ssvcb->vcbAtrb, 0))
                        return 0;
                BitClr( &ssvcb->vcbAtrb, 0);
                Err = FlushVol( nil, targetVRefNum);
        }
        return (Err);
}

It perfectly. Have fun.


Lance Kimes
Systems Programmer
Newsgroups: comp.sys.mac.programmer
From: jim@apatosaur.cis.ohio-state.edu (Jim Curran)
Subject: SCSI Disk Driver
Originator: jim@apatosaur.cis.ohio-state.edu
Organization: Ohio State Computer Science
Distribution: comp
Date: Wed, 16 Dec 1992 19:13:18 GMT

Hi,
Does anyone know where I can can get some sample SCSI disk driver source code?
I'm also interested in understanding the bootstrapping process such that I
could ultimately write something which could boot off of floppy or SCSI, get
some useful addresses from the system (screen, serial ports, etc.) and then
clobber the Mac OS and ignore the ROMs.  Any clues - source code or otherwise?

Thanks,

Jim

Newsgroups: comp.sys.mac.programmer
From: crg@rocky.raleigh.ibm.com (Chuck Grissom)
Subject: Re: Fix : ThinkC app won't run standalone (bug in smart link!?)
Date: Thu, 17 Dec 1992 14:37:01 GMT
Organization: IBM, Research Triangle Park, North Carolina

In article <1992Dec16.215017.16222@usl.edu>, pvl1779@usl.edu (Leach Phuong V) writes:
|> 
|> First thanks to those who responded.
|> 
|> The problem seems to be in the linker.  I turned the "smart link" option
|> off when building the application, and it runs fine now.
|> 
|> The app was crashing on a sprintf() call.  Earlier calls worked fine, but
|> at some point in the program, sprintf() got stepped on and no longer
|> worked.  It seems to me that the "smart" linker has a possible bug.
|> Does this seem like a reasonable assumption to you?
|> 
|> Go figure,
|> Robb

Well, bugs in the linker are possible...but...many, many times I have heard
a C programmer claim that the bug in his program must be due to a compiler bug
only to find after further debugging that it's in his code after all.  As for
me, I assume every bug is MINE unless I can point to the exact problem in the
compiler/linker.  If it is such a problem, you should be able to reproduce it
with very simple code.  Otherwise, keep looking for those pointer errors!

Chuck
Newsgroups: comp.sys.mac.programmer
From: Anthony Van Alphen <ava@bnr.ca>
Subject: FSOpen and System 7 Alias
X-Xxdate: Mon, 14 Dec 92 15:57:02 GMT
Organization: Bell-Northern Research
X-Useragent: Nuntius v1.1.1d12
Date: Mon, 14 Dec 1992 15:51:38 GMT

If I write an application and use the standard FSOpen FSRead functions
supplied with
MPW can the file be aliased and the alias opened?  When I try to open an
alias I think I 
am opening the alias itself.  Is there a trick? Or am I doing something
wrong?

Regards...Anthony
ava@bnr.ca
Newsgroups: comp.sys.mac.programmer
From: a-kraus@uiuc.edu (Albert L. Kraus)
Subject: Think Reference
Followup-To: comp.sys.mac.programmer
Organization: PES
Date: Fri, 11 Dec 1992 21:28:56 GMT

I would like to find out if it is worth to buy the Think Reference.
What's in the Think Reference book?
I have Think C.

Thanks!
Have a nice day!
Newsgroups: comp.sys.mac.programmer
From: elliott@majestix.cs.uoregon.edu (Elliott E. Lee)
Subject: GetIText for window?
Organization: University of Oregon Computer and Information Sciences Dept.
Date: Fri, 18 Dec 1992 07:54:54 GMT

Is there a GetIText function for windows?  If not, how do I get text from
an edit text item in a window.


-- 
Elliott Lee
elliott@cs.uoregon.edu
Newsgroups: comp.sys.mac.programmer
From: ivanski@world.std.com (Ivan M CaveroBelaunde)
Subject: Re: I will kill or die for this tool
Organization: The World Public Access UNIX, Brookline, MA
Date: Mon, 21 Dec 1992 06:05:07 GMT

k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:

>Might some enterprising developer want to write a Macsbug dcmd that will
>keep track of the state of a handle/resource?  It would trap _HLock,
>_HUnlock, _HPurge, _HNoPurge, _AddResource, _DetachResource,
>_ReleaseResource, and _DisposHandle, oh yeah and _HSetState too.  You
>tell it to keep track of a certain handle, and to drop into Macsbug when
>its state changes a certain way.

>See, I have this resource, and the code goes through some incredible
>gyrations to keep it locked when necessary and unlocked when not, and
>it's screwing up somewhere between function X and function Y.  If I
>could just break into Macsbug at X, find the resource, tell this dcmd to
>keep its eye out for any calls that unlock it, and continue, I'd be home
>free.  I've been trying to track it down, and after several hours and
>thousands of lines of code (one at a time), I'm not any closer.

The following lines (or something along these lines - I'm a little fried
right now) should do it:

atb DisposHandle rA0=myHandle
	(this one will work for any other mem mgr trap as well)
atb ReleaseResource rA7^=myHandle
	(this one will work for the resource calls)

Hope this helps.

-Ivan
---
Ivan Cavero Belaunde (ivanski@world.std.com)
DiVA Corporation
Xref: sparky comp.sys.mac.programmer:19756 comp.lang.lisp:3064
From: bskendig@netcom.com (Brian Kendig)
Newsgroups: comp.sys.mac.programmer,comp.lang.lisp
Subject: Re: Info about Pearl Common Lisp for the Mac Desired...
Date: 14 Dec 92 01:26:15 GMT
Organization: Starfleet Headquarters: San Francisco

In addition, I'm porting xlisp to the Macintosh.  It's Common
Lisp-compliant for the most part, and it's a fairly standard
implementation, and best of all, it's free.  ;)

I'll be needing beta testers for it soon.  When I need 'em, I'll post...

-- 
_/_/_/  Brian Kendig                             Je ne suis fait comme aucun
/_/_/  bskendig@netcom.com                de ceux que j'ai vus; j'ose croire
_/_/                            n'etre fait comme aucun de ceux qui existent.
  /  Nolite te bastardes     Si je ne vaux pas mieux, au moins je suis autre.
 /  carborundorum.                                               -- Rousseau
From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Uniquely identifying a Mac? How?
Date: 17 Dec 92 16:28:20 +1300
Organization: University of Waikato, Hamilton, New Zealand

In article <1gm3ioINN9uh@calvin.NYU.EDU>, roy@mchip00.med.nyu.edu (Roy Smith) writes:
>
> I personally think it was a major mistake for Apple
> to not have put some sort of machine-readable serial number in each machine.

The trouble with providing a feature like that is that people will start to
use it.

Can you say "copy protection"...?

Lawrence D'Oliveiro                       fone: +64-7-856-2889
Computer Services Dept                     fax: +64-7-838-4066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
From: chuck@gte.com (Chuck Hoffman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Think C 32K segment
Date: 18 Dec 92 21:22:26 GMT
Followup-To: comp.sys.mac.programmer
Distribution: usa
Organization: GTE Laboratories

In article <1go3ohINN4pq@network.ucsd.edu>, sah@coast.ucsd.edu (Scott A.
Herndon) wrote:
> 
> 
> 	Greetings,
> 
> 		I am trying to write a program using ThinkC 5.x that
> 	declares a large array.
> 
> 	int Height[129][129];
> 
> 		I get the "code overflow" message when trying to compile
> 	and I think this has to do with some sort of 32k segment limitation.
> 	My questions are:
> 
> 	i) Am I correct about the cause of the error?
> 	ii) How can I declare and use a large array like the one above
> 	    that is about (2*129)^2 bytes large?
> 

I would try an approach using NewHandle, to get the memory you need at
execution time, instead of at compile time.  Then initiailize the array
after you get it.

This code is off the top of my head, so take it with a pound or two of
salt.  It does compile in a "main" segment, and with cursory checking
(only) seems to run okay under THINK C 5.0.4:

typedef	struct	heightStruct
	{	int	h1;
		int h2;
	}	**heightStructH;

heightStructH		myHeightStructH;
int					workH2;
int					j;

/*	get memory for structure:	*/

myHeightStructH =
		(heightStructH) NewHandle(129 * sizeof(struct heightStruct));
/* check for bad return here, then continue	*/

/* initialize the structure, possibly in a loop like this:	*/
for (j=0; j<129; j++)
	{
	(*(*myHeightStructH + j)).h1 = 0;		/* looks ugly, but...	*/
	(*(*myHeightStructH + j)).h2 = 0;		/* ...it's legitimate	*/
	}

/* later, to get info from element 5 ("j") of the structure:	*/

j = 5;
workH2 = (*(*myHeightStructH + j)).h2;

/* remember about locking/unlocking, and, when done, disposing	*/


Good luck.  Let me know how it comes out.

Chuck Hoffman
chuck@gte.com
GTE Laboratories, Waltham, Massachusetts, USA
(617) 466-2131
=====================================
I'm not sure why we're here, but I am sure that while we're here we're
supposed to help each other.
=====================================
From: bcoleman@hayes.com (Bill Coleman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Alg. for Detection of Monspaced Fonts
Date: 11 Dec 92 14:22:08 EDT
Organization: Hayes Microcomputer Products, Norcross, GA

In article <scott.724029618@phylo>, scott@phylo.life.uiuc.edu (Scott Howard) writes:
> My Application requires that all fonts it uses are monospaced
> and will allow the user to choose display fonts that meet that requirement.

Perhaps your application needs to be rewritten to allow proportional fonts

> The application chooses two non-equal chars of a font at random,
> and compare their charwidth at an equal pt size. If they are 
> equivalent, well, you get the point.

Why just two characters? You really must scan the entire (legal) character
set. Because if you just happen to choose two that match, you could become
very unlucky with other characters.

Comparing 256 characters for the same width shouldn't take much longer than
comparing two characters.

> Would someone tell me if I'm reinventing the (Toolbox) wheel here?

Alas, the Toolbox has provisions for monospaced fonts. See IM-I p I-231 and 2.
The Font manager defines fontType constants for fixed-width fonts. 

Unfortunately, there have never been any fonts with this font type.

I ran into this in 1984. Our solution was to create our own fonts. Today the
better solution is to support proportional fonts.

-- 
Bill Coleman, AA4LR                ! CIS: 76067,2327    AppleLink: D1958
Principal Software Engineer        ! Packet Radio: AA4LR @ W4QO
Hayes Microcomputer Products, Inc. ! UUCP: uunet!hayes!bcoleman
POB 105203 Atlanta, GA 30348 USA   ! Internet: bcoleman%hayes@uunet.uu.net
Disclaimer: "My employer doesn't pay me to have opinions."
Quote: "The same light shines on vineyards that makes deserts." -Steve Hackett.

Newsgroups: comp.sys.mac.programmer
From: BLOOMDA@ctrvax.vanderbilt.edu (_creative_output_)
Subject: Re: Porting simple UNIX programs to the MAC??
Organization: Camp Vanderbilt Vision Research Center
Date: Sat, 12 Dec 1992 00:38:44 GMT
X-News-Reader: VMS NEWS 1.21

In <1992Dec11.161544.12668@news.eng.convex.com> graham@convex.com writes:

> I have has a MAC for a while and have ThinkC 4.  I have just started trying
> to port simple UNIX programs to the MAC.  How does one port programs that
> need command line arguments? NOTE_ I am running System 6.0.7.

look in console.c in your TC4 package.  I think that's a hint.  I remember
in the OLD days (version 1? 2?) there was a simple way to compile your program
so that it ran inside a 'console' window, and accepted command line args.
What I just saw in console.c looks like some of the stuff to do this.

cheers						- dave bloom
Newsgroups: comp.sys.mac.programmer
From: wolfmc@rtsg.mot.com (Michael Wolf)
Subject: Sound usage help
Keywords: sound help
Organization: Motorola Inc., Cellular Infrastructure Group
Date: Fri, 11 Dec 1992 19:59:17 GMT

I had thought at one time I had the Sound Manager and compatibility issues
conquered, but some odd crashes have made me wonder.

First, what are the correct gestalts or methods of ensuring the environment
you are currently running on can run synchronous or asynchronously, how to
tell how stereo capabilities.  The correct method of allocating a sound
channel (should I create my own SndChannel variable or let SndNewChannel do
it for me).

I looked through the tech notes (1-310 or so) on anything to do with sound,
but I did not see anything like I wanted to know.  I also looked through the
sample codes (1-30 or so) and nothing there for sound sample code.

So, is there some nice sample code available for doing the many wonderous
things with sound?

Also, I assume any machine which doesn't have an apple sound chip will not
be able to run asynchronous sounds?

Thanks for any help.


MJW

-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-
| Michael J. Wolf          | McIntosh Jr:  The power to crush the other kids|
| Software Engineer        |                                                |
| wolfmc@green.rtsg.mot.com|      Disclaimer?  Hell, I don't even know her! |
-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-

Newsgroups: comp.sys.mac.programmer
From: GREMICF@YaleVM.YCC.Yale.Edu (M. David Greenspon)
Subject: Machine Icons
Organization: Yale University
Date: Fri, 11 Dec 92 11:32:39 EST

When you choose "About This Macintosh" from the Apple Menu in the finder, you
get, among other things, an icon that looks like your machine.  These icons
are stored as ICN#s in the System file.  When I call Gestalt with a selector
of gestaltMachineIcon on my PB160, I get 49031; sure enough, ICN# 49031
(= -16505) in the System file looks like a PowerBook.
 
Is there a list anywhere of Machine Icon numbers for _all_ Macs?  I don't have
access to every kind of Mac ever made to go around running my program on.  In
general, most of the icons do (sort of) look like the Macs I think they're
supposed to represent, but in some cases I'm not sure exactly which is which.
I'd like to be sure that I really am showing the "official" ones in all cases.
The newest list of undocumented Gestalt stuff posted here doesn't say anything
about this.  I can't find a Tech Note about it.  I'm doing this because I'd
like to determine various things about the system I'm on:  for example, if I
get an icon that looks like a Quadra, I'll assume the presence of an FPU.
 
Just kidding!  ;-) :-]  (I can just see the frantic letters pouring in from
people who were too aghast to read further... ;~> )  I just want to display
info about various Macs, and I thought it would be nice to display the icon.
Thanks in advance for any info.
 
--David
Newsgroups: comp.sys.mac.programmer