On Sun, Jun 10, 2007 at 03:10:01PM +0000, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
the describe_functions are not generic, means, i'd have to do multiple tests, and it still does not make it any easier to get the type.
If you want the type then that's exactly what _typeof gives you. No sprintf'ing and no scanning needed. I don't understand what you want.
what i want is to be able to decide whether a given object is a module or not.
having the type as given by _typeof() or by master()->describe_module() does not solve the problem because each module has a different type, and i'd have to try to look at the output for hints that help me decide if that type is a module or not.
eg: by doing stunts like: search(sprintf("%O", _typeof(Stdio)), "node")
master()->objects[object_program(Stdio)]; should have done the trick. i am puzzled why that does not work.
Ah, yes, dirnodes and joinnodes don't end up there, only "proper" module objects. The fc mapping is better:
but the DO end up there:
master()->objects;
(1) Result: ([ /* 30 elements */ master: master(), object_program(_static_modules): _static_modules, object_program(_Charset): _Charset, object_program(Locale.Charset): Locale.Charset, object_program(Pike): Pike, object_program(System): System, object_program(Stdio): Stdio, object_program(Locale): Locale, object_program(___Math): ___Math, object_program(Math): Math, object_program(Array): Array, object_program(String): String, object_program(Gmp): Gmp, object_program(_ADT): _ADT, object_program(ADT): ADT, object_program(Parser.XML.Tree): Parser.XML.Tree, object_program(Parser.XML): Parser.XML, object_program(__builtin): __builtin, object_program(Parser._parser): Parser._parser, object_program(Parser): Parser, object_program(Tools.AutoDoc.PikeObjects): Tools.AutoDoc.PikeObjects, object_program(Tools.AutoDoc.PikeExtractor): Tools.AutoDoc.PikeExtractor, object_program(Tools.AutoDoc): Tools.AutoDoc, object_program(Thread): Thread.Thread(0), object_program(Stdio.Terminfo): Stdio.Terminfo, object_program(Tools.Hilfe): Tools.Hilfe, object_program(Getopt): Getopt, object_program(Parser.Pike): Parser.Pike, object_program(Tools.AutoDoc.DocParser): Tools.AutoDoc.DocParser, object_program(Error): Error ])
master()->fc_reverse_lookup (Mapping);
(1) Result: "/home/mast/Pike/stable/lib/modules/Mapping"
master()->fc_reverse_lookup (Stdio);
(2) Result: "/home/mast/Pike/stable/lib/modules/Stdio"
what version of pike is that?
i get:
master()->fc_reverse_lookup(Stdio);
(2) Result: 0
fails both in the 7.7 pikefarm build as well as in a regular installed 7.6
greetings, martin.