From:
                                                           10/16/97 11:00 PM
Subject: MAX Digest - 15 Oct 1997 to 16 Oct
1997To: Recipients of MAX digests 

There are 5 messages totalling 180 lines in this issue.

Topics of the day:

  1. > 32k tekxt
  2. sprintf abuse (2)
  3. Sizeof(int) (Was: sprintf)
  4. sprintf in Max ??

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

Date:    Thu, 16 Oct 1997 05:08:06 -0600
From:    =cw4t7abs 
Subject: > 32k tekxt

is it possible 2have max open more than 32k ov text.

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

Date:    Thu, 16 Oct 1997 09:49:10 -0000
From:    Nick Rothwell 
Subject: Re: sprintf abuse

> While on the subject of sprintf, it ocurred to me that the use of sprintf
> is not unlimited. Each time you create a new symbol with something like
> sprintf '%08ld you put another entry in the symbol table.

I wondered about this a few years ago when I implemented my effects
journaliser for the Wavestation. It shows parameter changes in a stack
of message boxes, and it generates things like

        Wet/Dry Mix 45

as single symbols, using hard spaces. Spinning the dial on the WS
would make the numerical value go from 0 to perhaps 100, generating a
symbol for each. The space and performance overheads were not
noticable, suggesting that the symbol hashing is very good indeed. Did
you notice any performance degradation as you pumped new symbols into
the hash table?

--
         Nick Rothwell, CASSIEL        contemporary dance projects
         http://www.cassiel.com        music synthesis and control

        "...but you? You've got a monkey on your back: dedication."

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

Date:    Thu, 16 Oct 1997 16:38:07 +0200
From:    Peter Castine 
Subject: Sizeof(int) (Was: sprintf)

Peter Elsea wrote about integer sized:
>(The actual size of things is hardware dependent. On a Mac, the smallest
>entity you can store is 16 bits, so shorts and ints are really the same
>size. At one point in time, the Think compiler people decided to change
>ints from 16 to 32 bits, so a lot of example external code quit working.)

Sorry to nitpick. The sizeof(int) is *implementation* (i.e. compiler)
dependent. Cf. Kernighan and Ritchie.

Just what the "natural" size of int should be on Mac has been a bone of
contention for as long as there have been Mac C compilers. It has always
been four-byte on MPW. It was traditionally two-byte on most 3rd-party C
compilers. Around THINK/Symantec version 5 or 6, sizeof(int) became a
compiler option, as it is in CodeWorrier.

So, if your code is breaking, check the compile options.

Anyway, you should NEVER NEVER NEVER rely on sizeof(int) being a
particular value. Never. Not ever. If you do, you deserve all the bad,
bad, really bad things that happen to you.

For that matter, depending on the number of bits in a long or short is
dicey if you want long-term multi-platform portability. Better to use a
few choice typedefs like

#if (OPERATING_SYSTEM == OS_FOO)
  typedef long int32bit;
#elif (OPERATING_SYSTEM == OS_BAR_ON_FUNKY_MACHINE_WITH_128_BIT_REGISTERS)
  typedef char int32bit;        // He: "32-bit char?! They can't be
serious."
                                // She: "Betcha it'll happen some day."
#endif

End-of-sermon.

Cheers,

Peter

---------------- http://www.prz.tu-berlin.de/~pcastine/ ----------------
Dr. Peter Castine           | I think every good Christian ought to kick
pcastine@prz.tu-berlin.de   | Falwell's ass.
                            |
                            |                    -- Sen. Barry Goldwater

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

Date:    Thu, 16 Oct 1997 11:46:20 -0400
From:    Stephen Kay 
Subject: sprintf in Max ??

>For example, I tried using bot append and pack
>in order to be able to create a symbol/ tex =

>string of the  form:

>  X.Y.Z

>where X, Y and Z are integers being gen'd from 3
>sep. sliders, and there is no space chars between
>the '.' s and #'s.  (And moving any of the 3
>sliders results in an updated string be gen'd).

A bit unclear what you want to do.  However, if you are looking to =

generate a symbol in the format:

42.52.31

then all you need do is use a "sprintf %d.%d.%d", run each slider into a
separate inlet, and have the 2 rightmost sliders bang the left inlet in =

addition to inputting the data (or a "sprintf %ld.%ld.%ld" for numbers =

with huge values).

Note that if the discussion of the last few days is correct, (assuming a
range of 128 on each slider) this will generate up to 128^3 or 2,097,152
symbols in MAX's lookup table.  According to Peter Elsea, (whose exact =

post is on my other computer, but I think he said he was getting 16 =

symbols per 1k), this would take 2,097,152 / 16 or 131k, but I =

configured the above 3 slider x 128 arrangement, and used up to maybe =

10k after moving each slider through its entire range of 128 =

possibilities (so what...)

Stephen Kay
-------- The MegaMAX Application Developer's Collection --------
 Full color 3D UI Objects for creating professional looking apps,
     Macintosh Interface objects, and other Max helpers.
-----------check out the demo on the MAX 3.5 CD----------------

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

Date:    Thu, 16 Oct 1997 14:17:56 -0400
From:    Stephen Kay 
Subject: sprintf abuse

Oops! Sorry for the putrid math in my earlier post.  What can I say, I ju=
st
woke up, I was only into my first cup o' java, I've been working with bit=
s
instead of bytes lately, and, and, and...

Actually, to sprintf 3 sliders of 128 values each into the format "sprint=
f
%d.%d.%d", to get things like:

45.33.12

would take, as I mentioned, 128^3, or 2,097,152 symbols to cover every
possible value from 0.0.0 to 127.127.127.  However, using Peter Elsea's 1=
6
symbols per 1k estimate, this would take 2,097,152/16 or 131,072k, or /10=
24
=3D 128 mb!

Furthermore, in my admittedly brief test, I realized I had only gone
through a few thousand combinations and used up 10k, not two million.

I put together a patch, which totally abuses Max, causes *tnewptr errors,=

etc.  At 10 ms per value, it would take approximately 5.8 hours to run th=
e
full two million values.  Furthermore, it crashes after awhile.  But I ra=
n
approximately 9600 symbols, and used up 100k, so it seems that I was
getting 96 symbols per 1k.

Stephen Kay

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

End of MAX Digest - 15 Oct 1997 to 16 Oct 1997
**********************************************