pike.git/
src/
program.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-07-01
2001-07-01 22:48:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>
a3823790277a6501e6174102fb4e0b8b9ce151e3 (
53
lines) (+
46
/-
7
)
[
Show
|
Annotate
]
Branch:
7.9
Added support for resolving some fixed programs in id_to_program().
Rev: src/program.c:1.341
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: program.c,v 1.
340
2001/07/01 22:
29
:
40
mast
Exp $");
+
RCSID("$Id: program.c,v 1.
341
2001/07/01 22:
48
:
34
grubba
Exp $");
#include "program.h" #include "object.h" #include "dynamic_buffer.h"
915:
if(p->id==id) return p;
-
if
(
id
)
+
for
(
p=first_program;p;p=p->next
)
{
-
+
if(id==p->id)
+
{
+
id_to_program_cache[h]=p;
+
return p;
+
}
+
}
+
+
if ((id > 0) && (id < PROG_DYNAMIC_ID_START)) {
+
/* Reserved id. Attempt to load the proper dynamic module
+
* to resolv the id.
+
*/
+
char *module = NULL;
+
+
switch(id) {
+
case PROG_PARSER_HTML_ID:
+
module = "Parser._parser";
+
break;
+
case PROG_GMP_MPZ_ID:
+
module = "Gmp";
+
break;
+
case PROG_MODULE_MIME_ID:
+
module = "___MIME";
+
break;
+
default:
+
if ((id >= 100) && (id <= 300)) {
+
module = "Image";
+
} else if ((id >= 1000) && (id <= 2000)) {
+
module = "GTK";
+
}
+
break;
+
}
+
if (module) {
+
push_text(module);
+
SAFE_APPLY_MASTER("resolv", 1);
+
pop_stack();
+
+
/* Try again... */
for(p=first_program;p;p=p->next) { if(id==p->id)
926:
} } }
+
}
return 0; }