SmallBASIC is a programming language that runs on the handheld. With this class, you can convert to/from the .PDB format that the SmallBASIC interpreter uses.
Warning: This class has not yet been tested extensively, so don't use this for mission-critical applications without further testing. However, it does both read and write this format successfully for me, so I expect that it will work for you.
SmallBASIC files already have a defined type and creator ID. The only thing left for you to do is to specify the name. Usually, this is the name of the file that you are converting.
|$DB = new PalmSmallBASIC("MyTest.BAS");|
// Typical usage to create the SmallBASIC file
$pdb = new PalmDoc();
// Special: If you want to create an instance of the class
// and then use ReadFile() to load the database information
This is the same as the base class. See Basic Use for more information.
To let you know, the first record is the header, and the rest contain separate sections of code. No single section can be bigger than 32k. If, by some fluke, there is a section that is too large, it will be automatically trimmed when the database is written.
This works just like loading files with the base class. Please see Basic Use for further information.
SmallBASIC files do not support categories nor record attributes.
|$contents = file("your_file.bas");|
// You should check to make sure the file
// was loaded properly before proceeding
$contents = implode("", $contents);
$pdb = new PalmSmallBASIC("your_file.bas");