[prev] [prev-tail] [tail] [up]

### A.5 Creating ppufiles

Creating a new ppufile 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 different than reading it. You need to first put everything in the entry with ppufile.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 file you need to call ppufile.writeheader to write the new header to the file. This takes automatically care of the new size of the ppufile. 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. You can call

ppufile.flush;

to flush the current buffers to the disk, and you can set

ppufile.do_crc:boolean;

to False if you don’t want the crc to be updated when writing to disk. This is necessary if you write for example the browser data.

[prev] [prev-tail] [front] [up]