> I don't know why this limit exists on PowerPC machines, though, both
> Metroworks CodeWarrior and MPW (Free C/C++ Development environment by Apple)
> have this limit. Known by reports on other Japanese mailing list, MPW has
> critial bug obtaining large stack more than 32K. (We can compile, but it
> will not work.) I don't use MPW so I don't know this is truth or not.
>
> To solve this problem, I put "static" before large array. This is not
> important, serious for me. But the codes of LAME have so may globals,
> statics, and this makes hard to understanding the flow of prosess to me.
> Hope to be changed to use struct (pointers).
>
> And one more suggestion. Macintosh programmers could not use f_open()
> function because  Macintosh has no full path consept. Windows, or UNIX has a
> path, but Macintosh has not. Hard drive name is not specified and it can be
> easy changed. Of course, file name may be contain spaces.
>
> So don't use file name to specify the file. Hope to use FILE* to specify the
> input/output file. With this change, I will be able to port LAME easiler.
>

The 32K limit doesn't really exists on PowerPC : in each application memory
zone, you have the stack zone and the heap zone.There is a default stack
zone(32 K)but if you want to increase it, you must change the limit of the
heap, and so the limit of the stack.
So you must insert this code at the very beginning of the application :

 stkNeeded=StackNeeded();
 if (stkNeeded > StackSpace())
 {
  SetApplLimit((Ptr) ((long) GetApplLimit() - stkNeeded + StackSpace()));
 }
 heapSize = (long) GetApplLimit() - (long) ApplicationZone();

The function stackNeeded() returns the value you want for the stack(which
must be less than the memory for all the application).You must define this
funciton. Then you fix the limit of the heap with SetApplLimit if necessary,
the processor will compute the stack as being the difference between the
overall memory for the application and the limit of the heap size. I'm using
MPW, and i don't know this bug of 32K limit (rather a misunderstanding of
MacOS programming by some users).

Lionel
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to