Residents

Everything else that doesn't fall into one of the other PB categories.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Residents

Post 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?
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

But why is that faster than a normal file with constants? (Ah, it doesn't have to be parsed the same way!)
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

sure, it's stored in a binary form which is way faster to load (and smaller as well).
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post 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.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post 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.
Last edited by Flype on Mon Nov 06, 2006 7:40 pm, edited 2 times in total.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Ok, if it's a private format then I won't bother using it. But thanks anyways.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

not so private because tailbite seems to use it,
and a old french project too.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply