Page 1 of 1

Residents

Posted: Thu Feb 02, 2006 3:19 pm
by Trond
Purebasic's native and OS constants are stored in a residents file, right? This is a precompiled file with only constants and structures, right? This is for faster compilation, right? So, how does PB know what constants are valid without looking in the residents file, and doesn't that sort of defeat it's purpose?

Posted: Thu Feb 02, 2006 4:00 pm
by Fred
Your assumptions about the resident are correct, but i don't understand the last question. The residents are loaded when the compiler starts and loaded in memory, so the compiler knows all the resident structures/constants when starting the compilation.

Posted: Thu Feb 02, 2006 4:03 pm
by Trond
But why is that faster than a normal file with constants? (Ah, it doesn't have to be parsed the same way!)

Posted: Thu Feb 02, 2006 4:12 pm
by Fred
sure, it's stored in a binary form which is way faster to load (and smaller as well).

Posted: Mon Nov 06, 2006 6:34 pm
by Trond
Is the file format a custom file format for PB only? I tried to search but I only get a lot of stuff about vulcanos.

And is it possible to store function declaration and external variable definitions in these files also?

Posted: Mon Nov 06, 2006 6:49 pm
by Flype
yes it is a custom format.

but it is 'parsable' so if you know how to read the file, you know how to generate a new resident file.

there are on this forum, examples on how to parse it.

at the moment, there are 2 formats : RES3 and RES4 chunks.

one which store constants, structures and interfaces

and the other, since PB4, which store also macros and prototypes...



i will send you a custom parser i made month ago.

Posted: Mon Nov 06, 2006 6:55 pm
by Flype
here is a project i was working on - for fun - some months ago.
it works (not completely) and there's a GUI but no time to finish it.

if you want you can grab it here and have a look at it.

just one note :
the parser is Event-Based and the programmer use callbacks to catch each elements (structs, consts, macros, ...).

have fun :wink:

http://www.penguinbyte.com/apps/pbwebst ... Parser.zip
just load and run the ResidentExplorer.pb file which need the ResidentParser.pbi include. Or you can also try the ResidentParser_EXAMPLE.pb test-file.

use it at your own risk.

[EDIT]
But without any documentation (not explained in the PureBasic SDK)
it's not an easy work to decrypt all these chunks... :?

i know this is purebasic private's stuff but the SDK might explain the structure of the residents files - for making third-party tools.

Posted: Mon Nov 06, 2006 7:29 pm
by Trond
Ok, if it's a private format then I won't bother using it. But thanks anyways.

Posted: Mon Nov 06, 2006 7:37 pm
by Flype
not so private because tailbite seems to use it,
and a old french project too.

Posted: Thu Nov 09, 2006 10:22 am
by PB
> And is it possible to store function declaration and external variable definitions in these files also?

Not functions, but you can definitely create your own custom residents file
with constants and so on... see my post here:
http://www.purebasic.fr/english/viewtopic.php?t=18820