|
- Forum
- iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Topic # 1391 |
Global variables in PP applet ? |
27/04/2006 @ 04:38 by bh77a

|
Hi,
I am working on a circle applet along with an update to the date time applet I released earlier and run into an error of exceeding the 256 byte size in the global variable area of the applet. I was able to get around this by limiting the size of the text strings, ie t:string[3];.
Now for my question...
Is the 256 byte buffer a "per applet" size, ie resetting to zero for each applet used in an application or more of a cumulative size, meaning that the totals of all of the variables in PP applets cannot exceed 256?
A second question...
Is there a way to fix the size of an integer, ie knowing that a variable will not exceed 160? Similar to n:integer[ ]:
Regards, bh77a |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1 -------- 27/04/2006 @ 19:24 by aldweb

visitor |
Hello bh77a,
To answer your questions:
1. the 256 bytes buffer is a cumulative size for all applets. And each applet should reserve with fake variables the upper values used by the other applets to make sure that the applet's variables are well positionned in the stack. For instance, if applet #1 reserves 2 integers like this: Var Applet1Var1: integer; Applet1Var2: integer; Then, applet #2 should reserve like this: Var // do not work with them unless you want // to share them between the 2 applets Fake1: integer; Fake2: integer; // applet #2 variables Applet2Var1: integer; Applet2Var2: integer;
2. Yes, you can reserve 8 bits integers, 16 bits integers and 32 bits integers. Copy & Paste from the PalmAPI.pas file: Int8=-128..127; UInt8=0..255; Int16=-32768..32767; UInt16=0..65535; Int32=Integer; UInt32=0..MaxInt; So, you can save 3 bytes out of the 256 available by using a Int8 instead of a Int32 (or integer) in your example.
Now, I am happy to see that you play around with this buffer, very few people did it so far. 
I could extend a little bit this buffer (but I don't remember by how much... I need to check) but kept it small so far because there are other ways to share data in the Palm (for instance, a file is nothing else but a not much slower piece of memory buffer storage possibility).
Cheers, aldweb
|
|
 |
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2 -------- 27/04/2006 @ 20:12 by bh77a

visitor |
Hi,
Thanks for the information. Over the weekend I will try to update my code to minimize the amounts of buffer space needed.
Regards, Brian |
|
 |
 topic active
 topic closed
 Sticky
 New message -
 Correct message
 Close topic
 Make sticky
|
|