A.5 Creating ppules

Creating a new ppule works almost the same as reading one. First you need to init the object and call create:
  ppufile:=new(pppufile,init('output.ppu'));  
  ppufile.createfile;

After that you can simply write all needed entries. You'll have to take care that you write at least the basic entries for the sections:

  ibendinterface  
  ibenddefs  
  ibendsyms  
  ibendbrowser (only when you've set uf_has_browser!)  
  ibendimplementation  
  ibend

Writing an entry is a little dierent than reading it. You need to rst put everything in the entry with ppule.putxxx:

procedure putdata(var b;len:longint);  
procedure putbyte(b:byte);  
procedure putword(w:word);  
procedure putlongint(l:longint);  
procedure putreal(d:ppureal);  
procedure putstring(s:string);

After putting all the things in the entry you need to call ppufile.writeentry(ibnr:byte) where ibnr is the entry number you're writing.

At the end of the le you need to call ppufile.writeheader to write the new header to the le. This takes automatically care of the new size of the ppule. When that is also done you can call ppufile.closefile and dispose the object.

Extra functions/variables available for writing are:

ppufile.NewHeader;  
ppufile.NewEntry;

This will give you a clean header or entry. Normally this is called automatically in ppufile.writeentry, so there should be no need to call these methods.

ppufile.flush;

to ush the current buers to the disk

ppufile.do_crc:boolean;

set to false if you don't want that the crc is updated, this is necessary if you write for example the browser data.