Pdb is a procedural database built ontop of Guile. Pdb provides wrappers so that functions can be called from c, c++, and Guile. Pdb also intends to have wrappers for Perl, python etc. Once a Pdb wrapper exists for a language, that language has full access to the procedural database. In the future it should be possible for Perl or Python scripts to call scheme functions and vice-versa. In order for language bindings to be dynamically built from Pdb, it is necessary to keep track of argument types and return values. Additionally Pdb has it's own docstring system so that functions can be uniformly documented across varying language bindings. Pdb was designed to be used with Extreme Wave, a libre 3d modeller to provide a powerful procedural database similar in spirit to the Gimp's. Pdb is aware of inheritance. A function that was designed to operate on type X, can also be used with a type subclassed from X (but not vice versa).
typedef PdbDoc struct { int id; char *label; } typdef SCM (*PdbFun)(); typedef PdbDoc* PdbDok; typedef PdbObj struct { PdbDok doc; PdbFun fun; } PdbObj; SCM pdb_exe (char *name, ...); int pdb_add (PdbDok, PdbFun0..9); // overloaded. int pdb_add (SCM, SCM); int pdb_add_c (PdbDok, PdbFun); PdbObj* pdb_find (char *name); int pdb_type_add (char *, PdbFun1); // function to check new type. int pdb_type_add_subclass (int baseclass, char *, PdbFun1); // function to check new type. (pdb-add 'foo-run "Run foo with bar." '((gfINT bar)) '() '()) (pdb-exe 'foo-run 345) (pdb-help 'foo-run) Command: foo-run Arguments: (INT) bar Returns: Unspecified Description: Run foo with bar. Tips for designing c++ classes that can be registered in Pdb: A typical circle object might be defined like this: class Circle { private: SCM radius; public: SCM set_radius(SCM r); SCM get_radius(SCM r); }; Unfortunately, Pdb needs to act on an object, so a better way to design this class would be: class Circle { private: SCM radius; public: static SCM set_radius(SCM obj, SCM r); static SCM get_radius(SCM obj, SCM r); }; typedef long PDB; int pdb2int (PDB); double pdb2double (PDB); float pdb2float (PDB); char* pdb2newstr (PDB); void* pdb2pointer (PDB); PDB int2pdb (PDB); PDB double2pdb (PDB); PDB PDB_ENTRY foo2bar_[] = {{PDB_NAME, "foo2bar"}, {PDB_DOCSTR, "Creates bar from foo."}, { PDB foo2bar (PDB foo) { pdb_assert(foo2bar_, foo); return int2pdb((pdb2int(foo) + 2)); } Modified on Wed Jun 23 10:26:02 1999 by James Dean Palmer.