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

There are 4 messages totalling 123 lines in this issue.

Topics of the day:

  1. sprintf (2)
  2. rasafratzer
  3. sprintf abuse

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

Date:    Wed, 15 Oct 1997 09:14:23 -0000
From:    Nick Rothwell 
Subject: Re: sprintf

> The only way I know to get tidy columns is to put up with the leading
> zeros. The following:
> sprintf %05ld__%05ld__%05ld
> Where the _s are replaced by option space will give you even
> columns,

In C code, I prefer something like

        sprintf("%s%c%s%c%s", str1, n, str2, n, str3)

where n is the ASCII value for hard space (which temporarily escapes
me).

> The reason it's so screwy is that printf outputs numbers when possible,
and
> creates symbols only as a last resort. (Quick review for newbies: a number
> in Max is a 32 bit representation of the value; a symbol is a pointer to a
> string of characters.)

Are we talking MAX objects or C here? A Symbol is a hashed pointer to
an object representing a token. s->s_name is the string.

--
         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:    Wed, 15 Oct 1997 09:48:07 -0500
From:    MALONE Don A 
Subject: rasafratzer

i am running 3.0 on a powerbook 190 w/4 shades of gray (16 is harder to see)
i have two peeves
 1)intermittently disappearing LEDs
   i have to quit & reload to get them back
     a real drag in the middle of a concert
 2)intermittent loadbang failure
   again _ i quit, reload & everything is hunky dory
does anyone know how to avoid these annoyances?

HoHoHo
Don

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

Date:    Wed, 15 Oct 1997 10:26:55 -0700
From:    Peter Elsea 
Subject: sprintf

Nick Rothweil asks:
> is the sprintf we're talking about a particular
>implementation provided by the MAX libraries? I'm still in the THINK C
>stone age and I can't remember offhand what gets provided by MAX and
>what I pull in from elsewhere;

Yes, it's peculiar to Max. As near as I can tell without looking at the
code, someone took the printf() source from a C library and bound it into
an object. The strangeness I am describing comes from the object argument
parser (which is sensitive to spaces) and the number display protocol
(which supresses leading 0s unless it's a symbol).

As for the %s and %ld specifiers, I am speaking in Max manualese rather
than pure C.

In C, you pass %s a *char, and all characters up to the next 0 are printed.
In max, you pass %s a symbol (really a symbol pointer) and the symbol's
s_name gets printed.

Max only recognizes 2 data types at the user level (there are more under
the surface, much to the chagrin of external coders) a 32 bit int and a 32
bit float. In most C compilers a 32 bit int is a long. This is properly
displayed by %ld. In Max 3.0 %d and %u would give truncated numbers under
some circumstances- in 3.5 it's fixed. (I wonder if this was an actual
repair or an artifact of the compiler change?)

(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.)

Oh by the way, there's a typo in the tutorial on Max&Numbers some of you
may have downloaded. The biggest number that Max can deal with in a number
box is 2,147,483,647. The lowest negative is -2147483648. (Dyslexia and
long numbers do not get along.)

Peter Elsea
Electronic Music Studios
University of California, Santa Cruz
http://arts.ucsc.edu/EMS/Music/index.html
 elsea@cats.ucsc.edu

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

Date:    Wed, 15 Oct 1997 11:06:45 -0700
From:    Peter Elsea 
Subject: 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.
So I hooked up a counter to see how far I could go.
I started with Max 3.5.0 right out of the box with 3870K assigned.
The Max window showed 2048K free.
I drove the counter with a metro at 10.
Max memory free steadily declined, at about 16 symbols per K.
at 95884 the memory was exhausted and I got a system crash.
So limit yourself to something under 50,000 sysmbols per meg.

Peter Elsea
Electronic Music Studios
University of California, Santa Cruz
http://arts.ucsc.edu/EMS/Music/index.html
 elsea@cats.ucsc.edu

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

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