Subject:     csmp digest Vol 4 No 039
Sent:        9/21/97 10:00 PM
Received:    9/21/97 10:38 PM
From:        owner-csmp@ee.mcgill.ca

C.S.M.P. Digest             Sun, 21 Sep 97       Volume 4 : Issue 39
 
Today's Topics:
 
        Appearance manager help
        Color question...
        CopyBits & dithercopy
        DateToString (StringDate) question
        Decoding a 32bit value field (characters)? HELP PLEASE
        Discrete Cosine Transform (JPEG & MPEG)
        DrawString crawls, V.Large FontSize
        Eiffel compiler
        Find and opening a file.
        How can I get a list of mounted volumes?
        Localization Question...
        Looking for 6 byte LDEF trick
        MacGifts
        Of Killing Clocks and Control Strips
        Sound Manager Problem
        Version numbers with ResEdit?



The Comp.Sys.Mac.Programmer Digest is moderated by Mark Aiken
(marka@ee.mcgill.ca).

The digest is a collection of article threads from the internet
newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
csmp.games. It is designed for people who read news 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. If you don't have access to news, you
may still be able to post messages to the group by using a mail server
like anon.penet.fi (mail help@anon.penet.fi for more information).

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
ee.mcgill.ca).  Article threads are not added to the digest until the last
article added to the thread is at least two weeks 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 digests can be obtained by email, ftp or through the World Wide Web.

If you want to receive the digest by mail, send email to 
majordomo@ee.mcgill.ca with no subject and one of the following commands
as body:

    help		                Sends you a summary of commands
    subscribe csmp                      Adds you to the mailing list
    unsubscribe csmp                    Removes you from the list

Once you have subscribed, you will automatically receive each new
issue as it is created.

Back issues are available by ftp from Info-Mac mirror sites in the
per/csmp subdirectory, e.g.

  ftp://sumex-aim.stanford.edu/info-mac/per/csmp/

The contents of all back issues can be searched by accessing the
following URL, courtesy of Andrew Barry (ajbarry@ozemail.com.au):

    http://marvin.stattech.com.au/search.html

They can also be searched through the following URLs, thanks to
Tim Tuck (Tim.Tuck@sensei.com.au):

    http://wais.sensei.com.au/searchform.html
    wais://wais.sensei.com.au:210/csmp?

-------------------------------------------------------

>From docnick@ix.netcom.com (David Christie)
Subject: Appearance manager help
Date: Sun, 31 Aug 1997 12:27:22 -0700
Organization: Netcom

I'm trying to make my applications appearance manager savvy, but am
running into some problems.  I have Apple's appearance manager SDK, but it
doesn't give the format for many of the manager's resources like the tab#,
dlgx, and ldes.  Any help as to the format of these resources, or
information leading to it would be appreciated.

+++++++++++++++++++++++++++

>From hexman@concentric.net (Tony Morales)
Date: Sun, 31 Aug 1997 13:50:48 -0700
Organization: Concentric Internet Services

In article <docnick-3108971227230001@ant-ca2-29.ix.netcom.com>,
docnick@ix.netcom.com (David Christie) wrote:

> I'm trying to make my applications appearance manager savvy, but am
> running into some problems.  I have Apple's appearance manager SDK, but it
> doesn't give the format for many of the manager's resources like the tab#,
> dlgx, and ldes.  Any help as to the format of these resources, or
> information leading to it would be appreciated.

You could try looking in in the Appearance.r Rez template file which is
part of the SDK.  Unless I missed something, the only Appearance Manager
SDK released to date is considered preliminary--when the final is ready,
perhaps it will have better docs.
Tony


+++++++++++++++++++++++++++

>From docnick@ix.netcom.com (David Christie)
Date: Sun, 31 Aug 1997 18:06:49 -0700
Organization: Netcom

Thanks for the help Tony.  I should have thought of that myself!  I guess
I just overlook anything that doesn't end in .h, .c, or .cp.  ;)

David Christie

+++++++++++++++++++++++++++

>From magesteve@aol.com (Mage Steve)
Date: 1 Sep 1997 05:37:44 GMT
Organization: AOL http://www.aol.com

David,
  You might also want to look in the Resourcerer templates that are
provided with the Appearance Manager SDK.  They are the best way to create
the resources.
  I am also using the Manager heavily.  Drop me a note (and anyone else
who is using it) sometime.

Steve Sheets
MageSteve@AOL.Com

---------------------------

>From keniwasa@wam.umd.edu (Ken Iwasa)
Subject: Color question...
Date: 31 Aug 1997 08:48:48 -0400
Organization: University of Maryland, College Park

I've recently wrote a simple program that draws a bunch of adjacent filled
rectangles.  The leftmost rectangle is black, the rightmost rectangle
is pink, and the ones in between are supposed to be a weighted average of
the two.  I'm limited to 256 colors, so I figure that might be part of the
problem, but I'm getting lots of weird colors between pink and black (like
a few shades of green and blue) though the RGB values seem to be correct.

Actually, this seems to be a problem only when the R, G, and B components
are all relatively close together (but are not the same).  What do I
need to do to get a nice blend?

Ken

+++++++++++++++++++++++++++

>From tlindner@nospam.com (tim lindner)
Date: Sun, 31 Aug 1997 09:38:26 -0800
Organization: Computers Suck!, Inc.

Ken Iwasa <keniwasa@wam.umd.edu> wrote:

> I've recently wrote a simple program that draws a bunch of adjacent filled
> rectangles.  The leftmost rectangle is black, the rightmost rectangle
> is pink, and the ones in between are supposed to be a weighted average of
> the two.  I'm limited to 256 colors, so I figure that might be part of the
> problem, but I'm getting lots of weird colors between pink and black (like
> a few shades of green and blue) though the RGB values seem to be correct.
> 
> Actually, this seems to be a problem only when the R, G, and B components
> are all relatively close together (but are not the same).  What do I
> need to do to get a nice blend?
> 
> Ken

Yes this is caused the your 256 (8-bit) color mode. You have two options:

Change your monitor to thousands or millions of colors (16 or 24 bit).

-or-

Create a custom color pallette which better describes your blend.

See the following link for the specific chapter of
_Inside Macintosh: Advance Color Imaging_:

http://gemma.apple.com/dev/techsupport/insidemac/ACI/ACI-14.html#HEADIN14-0

--
tim lindner
tlindner at netcom dot com

---------------------------

>From demon@news.loop (The Anonymous Mouse)
Subject: CopyBits & dithercopy
Date: Thu, 28 Aug 1997 10:04:30 +0000
Organization: The Cheese Factory

Whilst trying to get Quickdraw to convert an image to 1 bit and dither the
image I have struck the following problme:


Program creates 2 Gworlds, one is the depth of the picture (ie, 16 bit for
thousands, 8 bit for 256 etc.) the other is one bit (ie mono). I draw my
original picture to the first GWorld and then _SetGWorld on my 1 bit
GWorld. I start recording with OpenPicture and then use _copybits with
'dithercopy' option to copy from my original GWorld to my 1 bit world. The
resulting picture is then closed with _ClosePicture and wrote to disk. But
its the same depth as before, its *not* mono. 

Does Quickdraw store a colour pict in my mono GWorld or am I missing
something real obvious?

Ta


reply to anonymouse@mindless.com

-- 
Reply to:
The anonymous mouse.
anonymouse@mindless.com



+++++++++++++++++++++++++++

>From mh@primenet.com (Mark Hartman)
Date: 28 Aug 1997 07:29:00 -0700
Organization: Mark Hartman Computer Solutions

In article <demon-ya02408000R2808971004300001@news.demon.co.uk>,
demon@news.loop (The Anonymous Mouse) wrote:

>Whilst trying to get Quickdraw to convert an image to 1 bit and dither the
>image I have struck the following problme:
>
>
>Program creates 2 Gworlds, one is the depth of the picture (ie, 16 bit for
>thousands, 8 bit for 256 etc.) the other is one bit (ie mono). I draw my
>original picture to the first GWorld and then _SetGWorld on my 1 bit
>GWorld. I start recording with OpenPicture and then use _copybits with
>'dithercopy' option to copy from my original GWorld to my 1 bit world. The
>resulting picture is then closed with _ClosePicture and wrote to disk. But
>its the same depth as before, its *not* mono. 
>
>Does Quickdraw store a colour pict in my mono GWorld or am I missing
>something real obvious?

When you OpenPicture(), it records exactly what you're doing, which in this
case is copying a color picture.

What you need to do is to first dithercopy the picture, and only then
OpenPicture() and copy the dithered picture to itself.  This will give
the result you want.
==============================================================================
    Mark Hartman  |Consultants to business, industry and education since 1977
  C O M P U T E R |    Database design * User interface * Troubleshooting
 S O L U T I O N S| Networking * Client/server systems * Macintosh * Oracle
==== tel 714/758-0640 ===============<*>================ fax 714/999-5030 ====
Save-the-world movies:  with Macs, science fiction; with Windows, pure fantasy

---------------------------

>From "Bert Torfs" <bert_torfs@compuserve.com>
Subject: DateToString (StringDate) question
Date: Mon, 25 Aug 1997 13:49:41 +0200
Organization: Mezelf

Does anyone have a C(++) snippet that converts a date (3 ints, one representing the year, a second representing the month and a third representing the day - not the number of seconds since...) to a string respecting the international settings? 
Very much thanks

Bert.

+++++++++++++++++++++++++++

>From bradley@apple.com (Bob Bradley)
Date: 26 Aug 1997 05:07:41 GMT
Organization: Uh huh huh...It says Organ

In article <bert_torfs-2508971349410001@pool016a-216.innet.be>, "Bert
Torfs" <bert_torfs@compuserve.com> wrote:

> Does anyone have a C(++) snippet that converts a date (3 ints, one
representing the year, a second representing the month and a third
representing the day - not the number of seconds since...) to a string
respecting the international settings? 
> Very much thanks

You can use DateToSeconds to convert a year/month/day to seconds, then use
DateString to convert that to a string.

---------------------------

>From ss@posoe.com
Subject: Decoding a 32bit value field (characters)? HELP PLEASE
Date: Wed, 03 Sep 1997 08:35:39 -0500
Organization: PSINet

I have a problem im trying to figure out and wondered if anyone could help:

Im reading from a text file, 4 characters (a field):

For example the decimal values of the characters are:

173, 16, 38, 0

I somehow need to decode this -- its supposed to be a 32bit number.
(it would probably come out to something in the millions)

Any idea how to decode this?

Someone told me I would have to multiply the second number by 256,
the third number by 1024, and the fourth number by 2048 or something.

Any help is VERY GREATLY appriciated!

Thanks

-Scott Szretter

+++++++++++++++++++++++++++

>From "Jack Klein" <jackklein@nospam.worldnet.att.net>
Date: 4 Sep 1997 05:56:43 GMT
Organization: AT&T WorldNet Services

Denis Constales <dc@cage.rug.ac.be> wrote in article
<dc-ya023080000309971643190001@news>...
> In article
<ss-ya02408000R0309970835390001@client.ne.news.psi.net>,
> ss@posoe.com wrote:
> 
> > Im reading from a text file, 4 characters (a field):
> > 
> > For example the decimal values of the characters are:
> > 
> > 173, 16, 38, 0
> > 
> > I somehow need to decode this -- its supposed to be a 32bit
number.
> > (it would probably come out to something in the millions)
> > 
> > Any idea how to decode this?
> > 
> > Someone told me I would have to multiply the second number
by 256,
> > the third number by 1024, and the fourth number by 2048 or
something.
> 
> Call your characters c0=173,c1,c2,c3. These should be
*unsigned* char
> values if you're going to multiply and add. How to reconstruct
the value
> depends in what order the four bytes have been written, which
depends on
> the hardware that wrote it. Anyway, the factors you mention
are wrong, the
> correct ones are 256, its square 65536  and its third power
16777216. Or
> you can use (more readably) left-shifts and bitwise or, i.e.
|. Try out
> 
>  c0 | (c1 << 8) | (c2 << 16) | (c3 << 24)

Not trying to be grumpy, but either define c0..c3 as unsigned
long, or
define an unsigned long (example name result) and use

	result = (unsigned long)c0 | ((unsigned long(c1) << 8)  etc.

I know first expression doesn't need cast, might have more
parentheses than necessary, etc.

Left shifting (8 bit) unsigned char 8 or more bits is guaranteed
to result in 0.

> 
> (this one will be about 2.5 million) and if that doesn't work
try out
> 
>  c3 | (c2 << 8) | (c1 << 16) | (c0 << 24)
> 
> (more than 2.9 billion) or another permutation like c2 c3 c0
c1 etc. etc.
> until it makes sense. Once the order is established it is of
course the
> same for all sets of four consecutive characters.
> --
> Dr. Denis Constales - dcons@world.std.com -
http://cage.rug.ac.be/~dc/
> 

+++++++++++++++++++++++++++

>From ((unknown))
Date: 4 Sep 1997 11:44:38 GMT
Organization: Telecom Italia - Video On Line


ss (ss@posoe.com) wrote:
>I have a problem im trying to figure out and wondered if anyone could help:

>Im reading from a text file, 4 characters (a field):

>For example the decimal values of the characters are:

>173, 16, 38, 0

>I somehow need to decode this -- its supposed to be a 32bit number.
>(it would probably come out to something in the millions)

>Any idea how to decode this?

>Someone told me I would have to multiply the second number by 256,
>the third number by 1024, and the fourth number by 2048 or something.

>Any help is VERY GREATLY appriciated!

The value you're looking for is (0)+(38<<8)+(16<<16)+(173<<24)
in case your CPU is little endian, your value is (173)+(16<<8)+(38<<16)+(0<<24)

Of course you've to change 173,16, etc.. with variables or whatever you'll use.



>Thanks

>-Scott Szretter




+++++++++++++++++++++++++++

>From fred@genesis.demon.co.uk (Lawrence Kirby)
Date: Thu, 04 Sep 97 21:16:04 GMT
Organization: none

In article <dc-ya023080000409971026280001@news>
           dc@cage.rug.ac.be "Denis Constales" writes:

>>         result = (unsigned long)c0 | ((unsigned long(c1) << 8)  etc.
>> 
>> Left shifting (8 bit) unsigned char 8 or more bits is guaranteed
>> to result in 0.
>
>Only if your ints are 8 bits as well (which is below the minimal ANSI
>requirements): chars are promoted to int before shifting; if the ints are
>32 bits everything works as displayed (I tried it out before). The only
>possible problem is with 16bit ints; then you have to cast to something
>that has at least 32 bits.

And the only unsigned type where that is guaranteed is unsigned long.

>Because the original poster cross-posted to comp.sys.mac.programmer.help I
>supposed he worked on Mac and I assumed that (the Mac always having had at
>least a 68000 processor) ints would always be 32 bit on Mac C compilers
>(but I admit not being certain about this).

AFAIK the 68000 also has instructions to perform 16 bit operations and on
that processor they ran faster than their 32 bit counterparts, so a
compiler for the 68000 would naturally make ints 16 bits wide. That's
pretty much irrelevant however, there's simply no good reason here to
assume ints are more than 16 bits wide, justuse longs instead which you
know will work.

>#include <stdio.h>
>
>int
>main (void)
>{
>  unsigned char c0 = 173;
>  unsigned char c1 = 16;
>  unsigned char c2 = 38;
>  unsigned char c3 = 0;
>
>  int i = c0 | (c1 << 8) | (c2 << 16) | (c3 << 24);

It is a bad idea to write non-portable code like this. You should write as
a minimum:

   unsigned long value = c0                        |
                         ((unsigned)c1 << 8)       |
                         ((unsigned long)c2 << 16) |
                         ((unsigned long)c3 << 24);

although casting everything to unsigned long is probably neater overall.
                       
>  printf ("%d\n", i);

   printf ("%ul\n", value);

>
>  return 0;
>}

-- 
- ---------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
- ---------------------------------------


+++++++++++++++++++++++++++

>From wasser@jamin.enet.dec.com (John Wasser)
Date: Thu, 04 Sep 1997 16:41:52 -0400
Organization: Digital Equipment Corporation

In article <ss-ya02408000R0309970835390001@client.ne.news.psi.net>, ss@posoe.com wrote:


> I'm reading from a text file, 4 characters (a field):
> For example the decimal values of the characters are:
> 173, 16, 38, 0
> 
> I somehow need to decode this -- its supposed to be a 32bit number.
> (it would probably come out to something in the millions)

    unsigned char buffer[n];  long int value = 0;

    It could be either:

        for (i=0; i<4; i++)
            value = (value * 256) + buffer[i];

    or

        for (i=0; i<4; i++)
            value = (value * 256) + buffer[3-i];

    Which one is correct depends on the ordering of bytes
    within the file and within words in the processor
    being used.

        (((0*256+173)*256+16)*256+38)*256+0 = 2,903,516,672
        (((0*256+0)*256+38)*256+16)*256+173 = 2,494,637

    It appears that the file is stored "low order byte first"
    (the second loop).

- ---------------------------------------------------------------
John A. Wasser, PATHWORKS Engineering, Digital Equipment Corp.
Mailstop LKG2-1/T01, 550 King Street, Littleton MA, USA 01460
Email: (Work) wasser@jamin.enet.dec.com (Other) wasser@tiac.net
Home Page: http://www.tiac.net/users/wasser/index.html
         "I work on IBM-PC clones but I use Macintoshes."

+++++++++++++++++++++++++++

>From dc@cage.rug.ac.be (Denis Constales)
Date: Thu, 04 Sep 1997 10:26:28 +0200
Organization: RUG

In article <5uliir$4n8@bgtnsc03.worldnet.att.net>, "Jack Klein"
<jackklein@nospam.worldnet.att.net> wrote:

> Denis Constales <dc@cage.rug.ac.be> wrote in article
> <dc-ya023080000309971643190001@news>...
> > In article
> <ss-ya02408000R0309970835390001@client.ne.news.psi.net>,
> > ss@posoe.com wrote:
> > 
> >  c0 | (c1 << 8) | (c2 << 16) | (c3 << 24)
> 
> Not trying to be grumpy, but either define c0..c3 as unsigned
> long, or
> define an unsigned long (example name result) and use
> 
>         result = (unsigned long)c0 | ((unsigned long(c1) << 8)  etc.
> 
> Left shifting (8 bit) unsigned char 8 or more bits is guaranteed
> to result in 0.

Only if your ints are 8 bits as well (which is below the minimal ANSI
requirements): chars are promoted to int before shifting; if the ints are
32 bits everything works as displayed (I tried it out before). The only
possible problem is with 16bit ints; then you have to cast to something
that has at least 32 bits.

Because the original poster cross-posted to comp.sys.mac.programmer.help I
supposed he worked on Mac and I assumed that (the Mac always having had at
least a 68000 processor) ints would always be 32 bit on Mac C compilers
(but I admit not being certain about this).

#include <stdio.h>

int
main (void)
{
  unsigned char c0 = 173;
  unsigned char c1 = 16;
  unsigned char c2 = 38;
  unsigned char c3 = 0;

  int i = c0 | (c1 << 8) | (c2 << 16) | (c3 << 24);

  printf ("%d\n", i);

  return 0;
}

Output (Linux):

2494637
--
Dr. Denis Constales - dcons@world.std.com - http://cage.rug.ac.be/~dc/

+++++++++++++++++++++++++++

>From ss@posoe.com
Date: Fri, 05 Sep 1997 07:30:50 -0500
Organization: PSINet


FYI--

Thank you everyone for your replies and help!

I finally got the problem solved, and what did it the best
was using the BlockMove (or memcpy) command.

Just moved the characters into a longint, and bingo...
it worked great!

There were rounding errors trying to multiply by 256...
could have figured that out, but the BlockMove seemed cleaner.


THanks again!

-Scott

+++++++++++++++++++++++++++

>From "Robert H. Morrison" <RMorrison@hitex.de>
Date: 4 Sep 1997 12:29:11 GMT
Organization: Hitex


If this is a BINARY NUMBER then why are you reading it as chars.

If you are under DOS/WINDOWS then you would need a long to represent this.

You could do:

	fread( &lval, sizeof( lval ), 1, stream );

and then 

	printf( "Your number is: %ld\n", lval );

The number itself depends of course on HOW it was written to the file.
For a DOS/WINDOWS Intel processor (Little ENDIAN) this would mean that
the bytes for the number come least significant byte first and your
character values of 173, 16, 38, 0 would translate to hex values of
0xAD, 0x10, 0x26, 0 which means the number would be 0x2610AD which is a
value of 2,494,637.

Most important is to find out HOW the NUMBER HAS BEEN WRITTEN so you
know how to interpret it...

-- 
Best regards,
 _ __                      _    ,   _ _ _
' )  )     /         _/_  ' )  /   ' ) ) )
 /--' ____/___/> __  /     /--/     / / / __,_  __  o _   ______
/  \_(_) /_) (__/ (_<__   /  ( o   / ' (_(_) (_/ (_<_/_)_(_) / <_

Robert H. Morrison         	   	Tel:	+49 721 9628 167
Software Development, Basis Team       	FAX:	+49 721 9628 261
Hitex-Systementwicklung GmbH    	Email:  RMorrison@hitex.de


ss@posoe.com schrieb im Beitrag
<ss-ya02408000R0309970835390001@client.ne.news.psi.net>...
> 
> I have a problem im trying to figure out and wondered if anyone could
help:
> 
> Im reading from a text file, 4 characters (a field):
> 
> For example the decimal values of the characters are:
> 
> 173, 16, 38, 0
> 
> I somehow need to decode this -- its supposed to be a 32bit number.
> (it would probably come out to something in the millions)
> 
> Any idea how to decode this?
> 
> Someone told me I would have to multiply the second number by 256,
> the third number by 1024, and the fourth number by 2048 or something.
> 
> Any help is VERY GREATLY appriciated!
> 
> Thanks
> 
> -Scott Szretter
> 

+++++++++++++++++++++++++++

>From Bill Wilkinson <BillW@*NOSPAM*SuperCede.com>
Date: Fri, 05 Sep 1997 12:38:13 -0700
Organization: SuperCede, Inc.


ss@posoe.com wrote:
> I finally got the problem solved, and what did it the best
> was using the BlockMove (or memcpy) command.
> 

Then why did you post to so many newsgroups that aren't
at all concerned with the vagaries of non-portable C (or C++)
code?  (And it IS non-portable, as poster Conal Walsh pointed out.)

You can NOT DO a "memcpy" in Java, yet you posted this to two
Java groups (including one that no longer exists).

I apologize for wasting everyone's time with both this and
my earlier reply, but if I'd known that "ss@posoe.com" wanted
a non-portable C solution, I wouldn't have done so.

Grumble grumble...oh, well...I guess I need more coffee today.

+++++++++++++++++++++++++++

>From Roedy Green <roedy@oberon.ark.com>
Date: 5 Sep 1997 23:07:22 GMT
Organization: Canadian Mind Products

Have a look under "endian" in the Java glossary.  If the file is stored in
big-endian order, you can read the field directly with readInt, if
little-endian, you need the code given there for readIntLittleEndian.  If
you don't know what I am talking about, try it both ways and see which
works.

Roedy Green               Roedy rhymes with Cody   roedy@bix.com
Canadian Mind Products    contract programming     (250) 285-2954 
POB 707 Quathiaski Cove   Quadra Island BC         Canada V0P 1N0 
http://oberon.ark.com/~roedy for CMP utilities and the Java glossary
-30-

+++++++++++++++++++++++++++

>From dc@cage.rug.ac.be (Denis Constales)
Date: Wed, 03 Sep 1997 16:43:19 +0200
Organization: RUG


In article <ss-ya02408000R0309970835390001@client.ne.news.psi.net>,
ss@posoe.com wrote:

> Im reading from a text file, 4 characters (a field):
> 
> For example the decimal values of the characters are:
> 
> 173, 16, 38, 0
> 
> I somehow need to decode this -- its supposed to be a 32bit number.
> (it would probably come out to something in the millions)
> 
> Any idea how to decode this?
> 
> Someone told me I would have to multiply the second number by 256,
> the third number by 1024, and the fourth number by 2048 or something.

Call your characters c0=173,c1,c2,c3. These should be *unsigned* char
values if you're going to multiply and add. How to reconstruct the value
depends in what order the four bytes have been written, which depends on
the hardware that wrote it. Anyway, the factors you mention are wrong, the
correct ones are 256, its square 65536  and its third power 16777216. Or
you can use (more readably) left-shifts and bitwise or, i.e. |. Try out

 c0 | (c1 << 8) | (c2 << 16) | (c3 << 24)

(this one will be about 2.5 million) and if that doesn't work try out

 c3 | (c2 << 8) | (c1 << 16) | (c0 << 24)

(more than 2.9 billion) or another permutation like c2 c3 c0 c1 etc. etc.
until it makes sense. Once the order is established it is of course the
same for all sets of four consecutive characters.
--
Dr. Denis Constales - dcons@world.std.com - http://cage.rug.ac.be/~dc/

+++++++++++++++++++++++++++

>From Conal Walsh <conalw@nt.com>
Date: Fri, 05 Sep 1997 11:47:03 -0400
Organization: Nortel Limited


ss@posoe.com wrote:
> 
> FYI--
> 
> Thank you everyone for your replies and help!
> 
> I finally got the problem solved, and what did it the best
> was using the BlockMove (or memcpy) command.
> 
> Just moved the characters into a longint, and bingo...
> it worked great!
> 
> There were rounding errors trying to multiply by 256...
> could have figured that out, but the BlockMove seemed cleaner.
> 
> THanks again!
> 
> -Scott

Be aware that your solution will not work on other platforms - e.g. the
ordering of bytes within a long integer is different on x86 CPUs. Using
shift operators is more portable.

-- 

Conal Walsh
Senior Software Engineer
Nortel Toronto Multimedia Applications Center

Excerpt from new OSHA regulation on computer systems: "....if said
motherboard is equipped with an Intel central processing unit, an
appropriate warning label bearing the words 'Intel Inside' shall be
permanently affixed to the case in a prominent location." -- Bruce
Murphy

---------------------------

>From mr88cet@texas.net (Gary Morrison)
Subject: Discrete Cosine Transform (JPEG & MPEG)
Date: 5 Sep 1997 12:53:03 GMT
Organization: Texas Networking, Inc.

   Do any of you know of any public-domain code for the Discrete Cosine
Transform, which I'm told is used in JPEG and MPEG?  

   Tanks!

+++++++++++++++++++++++++++

>From Patrick.Stadelmann@imt.unine.ch (Patrick Stadelmann)
Date: Fri, 05 Sep 1997 22:02:44 +0200
Organization: University of Neuchatel

In article <mr88cet-0509970758160001@mnet02-31.austin.texas.net>,
mr88cet@texas.net (Gary Morrison) wrote:

>    Do any of you know of any public-domain code for the Discrete Cosine
> Transform, which I'm told is used in JPEG and MPEG?  
> 
>    Tanks!

You might find what you want in /info-mac/_Development/lib/jpeg-6-c.hqx

Here's the abstract of this file :

  This file is a Macintosh-ized version of the Independent JPEG
  Group's source code for using JPEG images.  It is unchanged
  from their canonical version except that the files are set to
  appropriate types (C source files are set for the Metrowerks
  C/C++ compiler, text files to BBEdit, etc.) and the upload is
  a self-extracting Compact Pro archive.

Hope this helps,

Patrick

-- 
Patrick Stadelmann <Patrick.Stadelmann@imt.unine.ch>

+++++++++++++++++++++++++++

>From mr88cet@texas.net (Gary Morrison)
Date: 6 Sep 1997 16:14:15 GMT
Organization: Texas Networking, Inc.


> >    Do any of you know of any public-domain code for the Discrete Cosine
> > Transform
> You might find what you want in /info-mac/_Development/lib/jpeg-6-c.hqx

   Excellent!  I'll check it out.  Thanks.

---------------------------

>From yairs@zoomorama.com (Yair Sageev)
Subject: DrawString crawls, V.Large FontSize
Date: Fri, 29 Aug 1997 16:12:36 -0400
Organization: Sony Research Labs

I'm running into a problem where the speed of DrawString() slows down
discontinuously and drastically after a font size of about 200+.  I
realize that drawing in a larger font size takes longer, but I don't
understand why there should be such steep increase in the time curve.

Any ideas as to why this is occuring would be appreciated.  

Thanks,

Yair

-- 
Yair Sageev
___________
Macintosh C++ Developer
Sony Research Laboratories

+++++++++++++++++++++++++++

>From Kevin Paszalek <kps@mindspring.com>
Date: Fri, 29 Aug 1997 23:15:48 -0500
Organization: MindSpring Enterprises

Yair Sageev wrote:
> 
> I'm running into a problem where the speed of DrawString() slows down
> discontinuously and drastically after a font size of about 200+.  I
> realize that drawing in a larger font size takes longer, but I don't
> understand why there should be such steep increase in the time curve.
> 
> Any ideas as to why this is occuring would be appreciated.
> 
> Thanks,
> 
> Yair
> 
> --
> Yair Sageev
> ___________
> Macintosh C++ Developer
> Sony Research Laboratories
Think Reference says that values ranging from 1 to 127 are 
acceptable. That could be part of your problem.
Kevin Paszalek
kps@mindspring.com

+++++++++++++++++++++++++++

>From dowdy@apple.com (Tom Dowdy)
Date: Wed, 03 Sep 1997 09:51:24 -0700
Organization: Apple Computer, Inc.


In article <34079E74.208B@mindspring.com>, kps@mindspring.com wrote:

>Yair Sageev wrote:
>> 
>> I'm running into a problem where the speed of DrawString() slows down
>> discontinuously and drastically after a font size of about 200+.  I
>> realize that drawing in a larger font size takes longer, but I don't
>> understand why there should be such steep increase in the time curve.
>> 
>> Any ideas as to why this is occuring would be appreciated.
>> 
>> Thanks,
>> 
>> Yair
>> 
>> --
>> Yair Sageev
>> ___________
>> Macintosh C++ Developer
>> Sony Research Laboratories
>Think Reference says that values ranging from 1 to 127 are 
>acceptable. That could be part of your problem.

This limitation has been removed since the existance of TrueType.  It's
specifically in the list of things to check for in your application for
System 7.0 savviness.

As for the reason for the slowdown:
TrueType (and most other font systems) render characters that you request
into a 1 bit deep bitmap, and cache the result in a LRU manner.  This
gives very high performance from the font system, once the character has
been cached.  This is important because of the process of hinting,
gridding, and scan converting characters isn't very speedy.

When a single glyph fails to fit in the cache, and the cache cannot be
grown in size, the character will be hinted, gridded and scan converted
directly into the frame buffer.  This is okay in speed, but following
draws of the character will be this slower speed rather than the higher
cached speed.

I suspect this is the cause.

-- 
 Tom Dowdy                  Internet: dowdy@apple.COM
 Apple Computer MS:302-3KS 
 1 Infinite Loop           
 Cupertino, CA 95014       
 "The 'Ooh-Ah' Bird is so called because it lays square eggs."

---------------------------

>From pprobine@clear.net.nz (Paul Probine)
Subject: Eiffel compiler
Date: Sun, 24 Aug 1997 13:06:46 +1200
Organization: Home

Does anybody know of an Eiffel compiler for the Mac???

Many Thanks
Paul

+++++++++++++++++++++++++++

>From sbryan@vendorsystems.com (Steve Bryan)
Date: Mon, 25 Aug 1997 09:35:07 -0500
Organization: VSI

In article <pprobine-ya02408000R2408971306460001@news.clear.net.nz>,
pprobine@clear.net.nz (Paul Probine) wrote:

> Does anybody know of an Eiffel compiler for the Mac???
> 
> Many Thanks
> Paul


http://www.peak.org/~jcd/eiffel/

-- 
Steve Bryan
sbryan@vendorsystems.com

---------------------------

>From ufo@paston.co.uk (UFO)
Subject: Find and opening a file.
Date: Wed, 03 Sep 1997 18:56:03 +0000
Organization: Paston Chase Internet


Hi

I want to be able to open a file that is loated in the same folder as my
application, how do I go about this without using a user open box
StandardGetFile();
I need my application to open by itself.

Hope you can help.

Thanks

UFO
ufo@paston.co.uk

+++++++++++++++++++++++++++

>From William Colsher <bill.colsher@rauland.com>
Date: Wed, 03 Sep 1997 14:58:06 -0500
Organization: Rauland-Borg Corporation

>I want to be able to open a file that is loated in the same folder as
my
>application

A bit round about, but pretty easy:

Call GetCurrentProcess() to get your app's Process Serial Number
 

Call GetProcessInformation() using the PSN returned by
GetCurrentProcess() to fill in a ProcessInfoRec structure.

Stuff the name of the file you want to open into the FSSpec that was
filled in by GetProcessInformation(). The you can open the file in the
usual way.

Code should looke something like this:
 

OSErr    err;
ProcessSerialNumber    myPSN
ProcessInfoRec            myInfo;
FSSpec                        myFileSpec;

err = GetCurrentProcess(&myPSN);
if(!err)
{
    myInfo.processName = nil;
    myInfo.processAppSpec = &myFileSpec;
    err = GetProcessInformation(myPSN, &myInfo);
}
 

-bill


+++++++++++++++++++++++++++

>From spriggan@brown.edu (kevinteich)
Date: Wed, 03 Sep 1997 18:57:09 -0500
Organization: Brown University

>I want to be able to open a file that is loated in the same folder as my
>application, how do I go about this without using a user open box
>StandardGetFile();

if you mean you just need to create an FSSpec for a file in the same
directory as your application, you can call FSMakeFSSpec with the file
name, like so.


   FSSpec theSpec;
   OSErr theErr = FSMakeFSSpec ( 0, 0, "\pFilename", &theSpec );
   if ( theErr != noErr ) { // error handling }

   
then just open it regularly. for example, to open the resource fork...

   long theFileRef = FSpOpenResFile ( &theSpec, fsRdPerm );


check out Inside Macintosh 'Files Manager' section for more info on
FSSpecs. you can download it in pdf format at
<http://devworld.apple.com/dev/insidemac.shtml>.

                                                              |
        k e v i n t e i c h : s p r i g g a n @ b r o w n . e d u
                                                              |
                                                              :
                                                              '

+++++++++++++++++++++++++++

>From betty@wam.umd.edu (Betty Boop)
Date: 5 Sep 1997 18:51:34 GMT
Organization: University of Maryland, College Park, MD


In addition to theSpec, you may need to find the current volume reference
number.  You can achieve this by doing:

::GetVol(&tVolName, &tVolRefNum);
TFile::SpecifyWithTrio(tVolRefNum, 0, filename);

0 indicates current directory.  If your filename is a complete path,
both the volrefnum and directory id (second parameter) are ignored.
if filename is a partial path, then dirId is 0 and it will be assumed
that you call is from the current directory where your application is
running from.

-betty

kevinteich (spriggan@brown.edu) wrote:
: >I want to be able to open a file that is loated in the same folder as my
: >application, how do I go about this without using a user open box
: >StandardGetFile();

: if you mean you just need to create an FSSpec for a file in the same
: directory as your application, you can call FSMakeFSSpec with the file
: name, like so.


:    FSSpec theSpec;
:    OSErr theErr = FSMakeFSSpec ( 0, 0, "\pFilename", &theSpec );
:    if ( theErr != noErr ) { // error handling }

:    
: then just open it regularly. for example, to open the resource fork...

:    long theFileRef = FSpOpenResFile ( &theSpec, fsRdPerm );


: check out Inside Macintosh 'Files Manager' section for more info on
: FSSpecs. you can download it in pdf format at
: <http://devworld.apple.com/dev/insidemac.shtml>.

:                                                               |
:         k e v i n t e i c h : s p r i g g a n @ b r o w n . e d u
:                                                               |
:                                                               :
:                                                               '

+++++++++++++++++++++++++++

>From gga@it.ntu.edu.au (Giles Alexander)
Date: 4 Sep 1997 01:14:58 GMT
Organization: Northern Territory University

UFO (ufo@paston.co.uk) wrote:
: Hi

: I want to be able to open a file that is loated in the same folder as my
: application, how do I go about this without using a user open box
: StandardGetFile();
: I need my application to open by itself.

There's a really quite simple way of doing this:

short OpenFile(Str255 inFileName)
{
	FSSpec		theFile;
	short		theFileRef;

	::FSMakeFSSpec(&theFile, 0, 0);
	::FSpOpenDF(&theFile, &theFileRef, fsRdWrPerm);
	return theFileRef;
}

The trick is passing the two 0's to FSMakeFSSpec.  That forces the File System
to use the default directory and volume. Which is the same folder as you
launched your application from.

You'd better check the ordering of the arguments as well.  I'm typing this
from memory.

Regards
Giles Alexander

--
giles@kagi.com                          | If builders built buildings the way
                                        | programmers write programs, the
Check out Note:                         | first woodpecker that comes along
http://www.ozemail.com.au/~notesoft/    | would destroy all of civilisation.

---------------------------

>From barnaby <barnaby.andrews@ukonline.co.uk>
Subject: How can I get a list of mounted volumes?
Date: Sun, 24 Aug 1997 10:32:21 +0000
Organization: (none)

I need to get a a list of names of the currently mounted
volumes in MacOS 7. What OS calls should I be looking at?

Also, how do I get a handle to the icon resource the Finder
uses to display the volume on the desktop?

All advice/tips most welcome!

janek

+++++++++++++++++++++++++++

>From blob@ricochet.NOSPAM.net
Date: Sun, 24 Aug 1997 20:34:59 -0700
Organization: (none)

In article <34000D9C.5D75@ukonline.co.uk>, barnaby.andrews@ukonline.co.uk wrote:

> I need to get a a list of names of the currently mounted
> volumes in MacOS 7. What OS calls should I be looking at?
> 
> Also, how do I get a handle to the icon resource the Finder
> uses to display the volume on the desktop?
> 
> All advice/tips most welcome!

Sample code for both is available from Apple.  See the file
<ftp://ftp.apple.com//devworld/Sample_Code/Snippets/Devices/
  Disk_Icons.sit.hqx>

-- 
(Comp.Sys.Mac.Programmer FAQ at <http://www.best.com/~ckt/faq/>)

To reply personally, remove the anti-spam "NOSPAM." from the email address
in the header.

+++++++++++++++++++++++++++

>From "Yan" <>
Date: Mon, 25 Aug 1997 03:33:23 +0000
Organization: (none)

In article <blob-ya023680002408972034590001@news.ricochet.net>,
blob@ricochet.NOSPAM.net wrote:

> Sample code for both is available from Apple.  See the file
> <ftp://ftp.apple.com//devworld/Sample_Code/Snippets/Devices/
>   Disk_Icons.sit.hqx>

Thanks!

+++++++++++++++++++++++++++

>From jwwalker@kagi.takethisout.com (James W. Walker)
Date: Mon, 25 Aug 1997 01:15:47 -0700
Organization: (none)

In article <34000D9C.5D75@ukonline.co.uk>, barnaby.andrews@ukonline.co.uk wrote:

>I need to get a a list of names of the currently mounted
>volumes in MacOS 7. What OS calls should I be looking at?

PBHGetVInfoSync.

>Also, how do I get a handle to the icon resource the Finder
>uses to display the volume on the desktop?

If you're talking about the scriptable Finder, there is a way to use
AppleEvents to ask the Finder for an object's icon suite.  (It's not
necessarily an icon resource; it may be an icon defined by the disk
driver.)  Alternatively, you could use my Find_icon package, available at
<http://members.aol.com/jwwalker/pages/codes.html>.
-- 
      Jim Walker <http://members.aol.com/jwwalker/>
      To reply, take out the spam-blocker from my address.
   ... looking for a Mac programming job

---------------------------

>From Tony Andreoli <andreoli@primecs.com>
Subject: Localization Question...
Date: 29 Aug 1997 14:32:44 GMT
Organization: CampusMCI

What is the easiest way to design one's software to work with a multitude
of localized versions of the OS?  I have a Location Manager module which
works fine in the US, but when placed on a Japanese system, fails because
the names of the files it's looking for (created by OT/PPP) are different.

Is it best to just use STR resources and read them based on the OS
version?  If so, how do I determine what should be placed in the STR
resources (I'd rather not install each localized version of the OS on my
machine).  Is there somehow to determine that "Finder Preferences" in the
US version="Gobbledegook" in some other version?

Thanks...
Tony Andreoli
Prime Computing Solutions

+++++++++++++++++++++++++++

>From Chuck_Houpt@MediaOne.Net (Chuck Houpt)
Date: Tue, 02 Sep 1997 11:47:51 -0400
Organization: nntp Needham

In article <5u6mic$37l$1@news.campus.mci.net>, Tony Andreoli 
<andreoli@primecs.com> wrote:

> What is the easiest way to design one's software to work with a multitude
> of localized versions of the OS?  I have a Location Manager module which
> works fine in the US, but when placed on a Japanese system, fails because
> the names of the files it's looking for (created by OT/PPP) are different.
> 
> Is it best to just use STR resources and read them based on the OS
> version?  If so, how do I determine what should be placed in the STR
> resources (I'd rather not install each localized version of the OS on my
> machine).  Is there somehow to determine that "Finder Preferences" in the
> US version="Gobbledegook" in some other version?

Many of the sub-folders (Preferences, Control Panels, etc) of the System 
folder can be located using the FindFolder() function.  

For the Finder preference file, you could look inside the Finder to get 
the name.  In the 7.6.1 Finder the preference file name is in STR# 27500.  
Of course, this is not a guaranteed method, because different versions of 
the Finder might use a different string resource (or might not even have a 
preference file!).

Good Luck - Chuck

+++++++++++++++++++++++++++

>From Chuck_Houpt@MediaOne.Net (Chuck Houpt)
Date: Tue, 02 Sep 1997 12:08:34 -0400
Organization: nntp Needham

In article <5u6mic$37l$1@news.campus.mci.net>, Tony Andreoli 
<andreoli@primecs.com> wrote:

> Is it best to just use STR resources and read them based on the OS
> version?  If so, how do I determine what should be placed in the STR
> resources (I'd rather not install each localized version of the OS on my
> machine).

I forgot to mention that there is a way to find all or most of these 
strings. On the Apple Developer Tool Chest CDs there are International 
glossaries for 34 scripts.

Look under "Tool Chest:Localization:Apple international Glossaries:"

- Chuck

---------------------------

>From brian_hall@markspace.com (Brian Hall)
Subject: Looking for 6 byte LDEF trick
Date: Sun, 24 Aug 1997 09:28:23 -0700
Organization: Mark/Space Softworks

Years and years ago I used to use the 6 byte LDEF trick so that I could
keep the  object for the LDEF inside my app instead of as an LDEF
resource. It involved a simple 6 byte ldef and some code that stuck the
address of the routine into the LDEF at runtime.

Anyone have a code snippet for this trick hanging around?

Thanks
Brian

-- 
_____________________________________________________________________
Mark/Space Softworks                               voice 408-293-7299
111 West Saint John, 4th Floor                       fax 408-293-7298
San Jose, CA 95113                         <http://www.markspace.com>

 Mac OS, Newton, Windows and Web Communications Software & Solutions:
 PageNOW!, PageME!, Communicate, ZMODEM, PC-ANSI, Videotex CTB Tools

+++++++++++++++++++++++++++

>From justinwick@aol.com (JustinWick)
Date: 24 Aug 1997 21:03:23 GMT
Organization: AOL http://www.aol.com

I had this lying around...  I couldn't get it to work, but maybe I just
need to make my function a PASCAL function instead of C...

This is what I found:

//////////////////////////////
this is a resource template for a dummy ldef, you fill in the procptr to
the routine in your application code that defines the ldef.

typedef struct DefStruct{
	short jmp;
	ProcPtr address;
	}DefStruct, **DefHandle;

This is an example of the initialization needed.

Init_LDEF(void)
{
	DefHandle def;
	
	def = (DefHandle)GetResource('LDEF', 256);
	if (def != NULL)
		(**def).address = (ProcPtr)Your_LDEF;
	else
		ExitToShell();
}

You'll also need to add the resource 'LDEF' id = 256 (or whatever) to the
application resource file...the resource data is:

4EF9 0000 0000

which is just a jmp to the address you fill in in INIT_LDEF.  This
resource should be non-purgeable but need not be locked.

The routine Your_LDEF is the entry point to an ldef as described in Inside
Mac.
////////////////////////////////


I hope this helps   :-)

Justin Wick
Head Programmer
Revolution Software
www.RevolutionSW.com

"The woods are lovely,
dark and deep,
but I have promises to keep,
and miles of code before I sleep..."  -  Robert Frost (Well, almost :-)

+++++++++++++++++++++++++++

>From brian_hall@markspace.com (Brian Hall)
Date: Sun, 24 Aug 1997 15:29:57 -0700
Organization: Mark/Space Softworks

In article <19970824210301.RAA23942@ladder02.news.aol.com>,
justinwick@aol.com (JustinWick) wrote:

> I had this lying around...  I couldn't get it to work, but maybe I just
> need to make my function a PASCAL function instead of C...

Yes - it needs to be declared pascal.

That works just fine, although now I realize why people may no longer do
it - that trick won't work for a PPC project (at least as it stands). I
think the dummy ldef will have to be smarter and know how to make a call
to PPC code. (Mixed Mode Manager anyone?)

b

-- 
_____________________________________________________________________
Mark/Space Softworks                               voice 408-293-7299
111 West Saint John, 4th Floor                       fax 408-293-7298
San Jose, CA 95113                         <http://www.markspace.com>

 Mac OS, Newton, Windows and Web Communications Software & Solutions:
 PageNOW!, PageME!, Communicate, ZMODEM, PC-ANSI, Videotex CTB Tools

+++++++++++++++++++++++++++

>From ajbarry@ozemail.com.au (Andrew Barry)
Date: Mon, 25 Aug 1997 19:29:34 -0600
Organization: Andrew Barry Software Pty Ltd

brian_hall@markspace.com (Brian Hall) wrote:
>That works just fine, although now I realize why people may no longer do
>it - that trick won't work for a PPC project (at least as it stands). I
>think the dummy ldef will have to be smarter and know how to make a call
>to PPC code. (Mixed Mode Manager anyone?)

You get it to work on PPC by expanding the handle and copying in a Routine
Descriptor.

My version is:

RoutineDescriptor LDEFProcRD = BUILD_ROUTINE_DESCRIPTOR 
   (uppListDefProcInfo, LDEFProc);

...

   if (!LDEFInited)
   {
      h = GetResource('LDEF', 128);
      if (h)
      {
         LDEFPresent = true;
#ifdef powerc
         SetHandleSize(h, sizeof(LDEFProcRD));
         BlockMoveData(&LDEFProcRD, *h, sizeof(LDEFProcRD));
#else
         *(void **)((*h) + 2) = LDEFProc;
         FlushDataCache();
         FlushInstructionCache();
#endif
      }
      LDEFInited = true;
   }

Note that you don't have to worry about flushing the cache on the PowerPC
- Routine Descriptors are always treated as data, andthus you don't have
to worry about the split code/data caches on the 603/604 processors.

Andrew Barry

+++++++++++++++++++++++++++

>From meeroh@mit.edu (Miro Jurisic)
Date: Tue, 26 Aug 1997 02:06:33 -0400
Organization: MIT

In article <brian_hall-2408971529580001@mg128-055.ricochet.net>,
brian_hall@markspace.com (Brian Hall) wrote:

> That works just fine, although now I realize why people may no longer do
> it - that trick won't work for a PPC project (at least as it stands). I
> think the dummy ldef will have to be smarter and know how to make a call
> to PPC code. (Mixed Mode Manager anyone?)

MixedMode.r contains an incredible amount of interesting stuff. If you
actually understand how it all works (which I _almost_ do), you should be
able to write a stub LDEF that does what you are suggesting.

meeroh

+++++++++++++++++++++++++++

>From don_arb@wolfenet.com (Don Arbow)
Date: Wed, 27 Aug 1997 11:15:44 -0700
Organization: None

In article <meeroh-2608970206330001@the-final-frontier.mit.edu>,
meeroh@mit.edu (Miro Jurisic) wrote:

:  In article <brian_hall-2408971529580001@mg128-055.ricochet.net>,
:  brian_hall@markspace.com (Brian Hall) wrote:
:  
:  > That works just fine, although now I realize why people may no longer do
:  > it - that trick won't work for a PPC project (at least as it stands). I
:  > think the dummy ldef will have to be smarter and know how to make a call
:  > to PPC code. (Mixed Mode Manager anyone?)
:  
:  MixedMode.r contains an incredible amount of interesting stuff. If you
:  actually understand how it all works (which I _almost_ do), you should be
:  able to write a stub LDEF that does what you are suggesting.
:  
:  meeroh

Once again, get the book "A Fragment of Your Imagination" by Joe Zobkiw. 
He shows exactly how to do this.

Don

-- 
Don Arbow, Partner, CTO
EveryDay Objects, Inc.
don_arb@wolfenet.com     <-- remove underscore to reply
http://www.edo-inc.com

+++++++++++++++++++++++++++

>From bhamlin@zocalo.sanspam.net (Brian Hamlin)
Date: Tue, 02 Sep 1997 10:32:25 -0700
Organization: Noesis Software Construction

In article <brian_hall-2408971529580001@mg128-055.ricochet.net>,
brian_hall@markspace.com (Brian Hall) wrote:

> (Mixed Mode Manager anyone?)
> 

  ok, I'll bite.

  The trick in this particular circumstance was the following. A big
CDEF that had to be ported to PowerPC with a big project (>1000 src files)
The code resource could be 68k/PowerPC and the app could be 68/PowerPC.
Yes?  Of course.

  Write the CallxxxProc() and NewxxxProc macros following the MixedMode
conventions. The style seems to be two versions, one on either side of
#if USESROUTINEDESCRIPTORS, the true side actually allocating a UPP.

  Create the Control on the App side. As the refCon, pass an allocated
struct* which contains all your goodies, _including a UPP created by
the App side_.  Then, inside the CDEF stub, you get something 
like


pascal long main( short varCode, ControlHandle theControl, etc)
{
  long result = 0;
  ObscureControlRec **h = (caste)GetControlReference( theControl);

  if ( h && *h) {
    result = CallxxxProc( (**h).xxxProcUPP, yourParamsHere...);

  }
  return result;
}


  Mind your struct alignment settings, 4byte int and 8byte double
project prefs on the CDEF project side, and you are off and running
to greater heights of obscure hacks no one will ever see or care
about but will run correctly on this grand and glorious PowerPC
architecture out there ...

  Think about it for a moment or many, and you will realize that this
works for every combination of native and non-native.

-- 
Brian M Hamlin                        bhamlin@screenlight.com
NSC Software Construction                     +1.510.271.7971

---------------------------

>From BHuey@worldnet.att.net (Hugh Johnson)
Subject: MacGifts
Date: Sat, 23 Aug 1997 16:01:13 -0600
Organization: Semplice

What's the correct mailto for sending something up to MacGifts? I've done
it twice in the past three days and it doesn't seem to be getting through.

-- 
Hugh Johnson
BHuey@worldnet.att.net
(612) 792-0583

+++++++++++++++++++++++++++

>From erkyrath@netcom.com (Andrew Plotkin)
Date: Sun, 24 Aug 1997 00:13:07 GMT
Organization: Netcom On-Line Services

Hugh Johnson (BHuey@worldnet.att.net) wrote:
> What's the correct mailto for sending something up to MacGifts?

http://gandalf.pht.com/info-mac/posting_guidelines.html contains the 
instructions.

> I've done
> it twice in the past three days and it doesn't seem to be getting through.

These days, I find that it takes at least a week for them to process 
submissions.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."

---------------------------

>From stone@enetis.net (Kevin and Brian Stone)
Subject: Of Killing Clocks and Control Strips
Date: 28 Aug 1997 21:11:09 -0600
Organization: E-Net Information Services (605-341-ENET)

  I need to kill a clock, a control strip, and probably a cookoo bird
  near the end of it all. ;)
  
  Can someone point me to some sample code or just an explaination of how
  to hide the Date & Time Menu Clock and Control Strip in system 7.5 and
  up?

-- Brian Stone
   Stone Entertainment
   www.StoneEntertainment.com
   stone@enetis.net
	


+++++++++++++++++++++++++++

>From P.T.Russell@sussex.ac.uk (Paul Russell)
Date: Fri, 29 Aug 1997 16:34:03 +0100
Organization: Experimental Psychology, Sussex University

In article <5u5ekd$7no@enet1.enetis.net>, stone@enetis.net (Kevin and
Brian Stone) wrote:

>  I need to kill a clock, a control strip, and probably a cookoo bird
>  near the end of it all. ;)
>  
>  Can someone point me to some sample code or just an explaination of how
>  to hide the Date & Time Menu Clock and Control Strip in system 7.5 and
>  up?
>

It's surprisingly easy - just set the menu bar height to 0 and not only
will the menu bar go away, but also the control strip will disappear !

//Paul

-- 
| Paul Russell        http://www.biols.susx.ac.uk/Home/Paul_Russell |
| Experimental Psychology           mailto:P.T.Russell@sussex.ac.uk |
| Sussex University, Falmer         mailto:paulr@biols.sussex.ac.uk |
| Brighton BN1 9QG, England tel:+44 1273 678639 fax:+44 1273 678611 |

+++++++++++++++++++++++++++

>From alex@astro.queensu.ca (Alex Duncan)
Date: 29 Aug 1997 16:09:30 GMT
Organization: none

>   I need to kill a clock, a control strip, and probably a cookoo bird
>   near the end of it all. ;)
>   
>   Can someone point me to some sample code or just an explaination of how
>   to hide the Date & Time Menu Clock and Control Strip in system 7.5 and
>   up?

To kill the clock i use SetMBarHeight(0); or LMSetMBarHeight(0); and make
a window with a visRgn that covers the menu bar.

Something similar might apply to the control strip.
   -Dunkstr

---------------------------

>From John Anderson <anderson@ssec.wisc.edu>
Subject: Sound Manager Problem
Date: Sun, 24 Aug 1997 20:02:44 -0500
Organization: University of WI, Madison -- Computer Sciences Dept.

I am having problems when I use bufferCmd to output samples sounds at
44k on a Power mac 7100 with Sound Manager 3.2.  It seems as if the
sound is getting resampled to 22k and them back to 44k before the output
with clear aliasing products.  This is true even if I set the sample
rate to 44k with:

		err = SndSetInfo(chan1, siSampleRate, (void *) 0xAC440000L);

If I write the data to an AIFF file and then play it with
SndStartFilePlay there is np problem and I get high quality output. I
havn't been able to find the release notes for SndManger 3.2 but I was
wandering if I had to do something to the mixer component, and if so
how?

Thanks,

John Anderson

+++++++++++++++++++++++++++

>From jaeho@xs4all.nl (Jae Ho Chang)
Date: Tue, 26 Aug 1997 01:32:11 +0100
Organization: XS4ALL, networking for the masses

> I am having problems when I use bufferCmd to output samples sounds at
> 44k on a Power mac 7100 with Sound Manager 3.2.  It seems as if the
> sound is getting resampled to 22k and them back to 44k before the output
> with clear aliasing products.

I'm not sure that a problem I had a couple of months ago is exactly same
as yours. But at that time, someone told me that I had to 'warm up' the
channel at non-interrupt time, which means you should call SndDoCommand()
once with an empty buffer after setting the sample rate.

Maybe this is the case for you.
Good luck,

Jae Ho Chang =)
--
http://www.xs4all.nl/~jaeho
Institute of Sonology
Royal Conservatory, The Hague

+++++++++++++++++++++++++++

>From reekes@[nospam]apple.com (Jim Reekes)
Date: Tue, 26 Aug 1997 13:31:04 -0700
Organization: Apple Computer, Inc.

In article <3400D9B2.19AA@ssec.wisc.edu>, John Anderson
<anderson@ssec.wisc.edu> wrote:

> I am having problems when I use bufferCmd to output samples sounds at
> 44k on a Power mac 7100 with Sound Manager 3.2.  It seems as if the
> sound is getting resampled to 22k and them back to 44k before the output
> with clear aliasing products.  This is true even if I set the sample
> rate to 44k with:
> 
>                 err = SndSetInfo(chan1, siSampleRate, (void *) 0xAC440000L);
> 
> If I write the data to an AIFF file and then play it with
> SndStartFilePlay there is np problem and I get high quality output. I
> havn't been able to find the release notes for SndManger 3.2 but I was
> wandering if I had to do something to the mixer component, and if so
> how?

It doesn't work that way. The sample rate of the hardware can be found in
the Sound control panel. You can also set it using SndSetInfo(), but be
aware that some hardware will not adjust the rate while a sound channel is
open.

Regardless of this, the Sound Mgr would not down sample and then up sample.
It couldn't. There's only one sample rate converter in the chain of
components, and this component is set to output at the hardware rate. So if
you source is 44.1 and the hardware is 44.1 then no work will be done by
the sample rate converter. If you're harware is set to 22.050, then the
sample rate converter will down sample to this rate.

SndStartFilePlay() using the same method to play audio as the bufferCmd.
You'd have to show us more code or something because so far what you're
saying couldn't be true.

Jim

-- 
Jim Reekes, Polterzeitgeist
Sound Manager Expert, QuickTime Products R&D
Sound Manager Web Page can be found at:
http://quicktime.apple.com/dev/devsnd.html

"All opinions expressed are mine, and do not necessarily represent
those of my employer, Apple Computer Inc."

---------------------------

>From Chris Lo <chrisl@gil.com.au>
Subject: Version numbers with ResEdit?
Date: Fri, 05 Sep 1997 17:14:43 +0000
Organization: Chris Lo Photography


Can anyone tell me how to insert a version number resource into an 
AppleScript application?  I'd like to be able to see the version number for a 
script application via a Get Info on the file.

Thanks,
Chris

+++++++++++++++++++++++++++

>From jac@igor.caltech.edu (Jeff Clites)
Date: Sun, 07 Sep 1997 01:49:43 -0700
Organization: California Institute of Technology, Pasadena

In article <34103E03.1E8E@gil.com.au>, chrisl@gil.com.au wrote:

>Can anyone tell me how to insert a version number resource into an 
>AppleScript application?  I'd like to be able to see the version number for a 
>script application via a Get Info on the file.

Just open your app with ResEdit, and add a 'vers' resource (with the
Create New Resource menu item). Fill this in with the version number you
want, and then assign it a resource ID of 1 (under the Get Resource Info
menu item). That's it.

- ------------------------------------------------------------------------
Jeff Clites                                           Pasadena, California

My account name is jac and the rest of my address has igor and caltech and
edu, separated by dots. Don't spam me or anybody else (please).

+++++++++++++++++++++++++++

>From johnb@hk.super.net.remove_this_to_mail_me (John W. Blackburne)
Date: Sun, 07 Sep 1997 23:01:04 +0800
Organization: Hong Kong Supernet

In article <jac-0709970149430001@clites-ppp.caltech.edu>,
jac@igor.caltech.edu (Jeff Clites) wrote:

:Just open your app with ResEdit, and add a 'vers' resource (with the
:Create New Resource menu item). Fill this in with the version number you
:want, and then assign it a resource ID of 1 (under the Get Resource Info
:menu item). That's it.

You can also add a 'vers' resource ID 2 to get a text string under the
item's name in the Finder 'Get Info' dialog. E.g. this is where Apple puts
the OS/installer version for system software (so hack almost anything in
your system folder to see how it works).

A quick tip: if you can do this editing with Mac OS 8 installed. The new
Finder updates 'Get Info' windows live, so as soon as you change the
'vers' resource(s) and hit 'Save' you see the results instantly in the
Info window, which you leave open in the background. Saves a lot of time
guessing how the text strings will fit and wrap.

John

-- 
John Blackburne; programmer, writer, consultant, trainer
tel/fax: Hong Kong (+852) 2816 7484
home page: <http://www.hk.super.net/~johnb>

---------------------------

End of C.S.M.P. Digest
**********************