2003-08-19 15:19:38 -04:00
|
|
|
#include "xt.h"
|
|
|
|
|
|
|
|
static max_functions = 512;
|
|
|
|
static Object Functions;
|
|
|
|
|
|
|
|
int Register_Function (x) Object x; {
|
|
|
|
register i;
|
|
|
|
Object v;
|
|
|
|
GC_Node;
|
|
|
|
|
|
|
|
for (i = 0; i < max_functions; i++)
|
2003-09-02 04:12:11 -04:00
|
|
|
if (Nullp (VECTOR(Functions)->data[i])) break;
|
2003-08-19 15:19:38 -04:00
|
|
|
if (i == max_functions) {
|
2003-09-02 04:12:11 -04:00
|
|
|
max_functions *= 2;
|
|
|
|
GC_Link (x);
|
|
|
|
v = Make_Vector (max_functions, Null);
|
|
|
|
GC_Unlink;
|
|
|
|
bcopy ((char *)VECTOR(Functions)->data, (char *)VECTOR(v)->data,
|
|
|
|
i * sizeof (Object));
|
|
|
|
Functions = v;
|
2003-08-19 15:19:38 -04:00
|
|
|
}
|
|
|
|
VECTOR(Functions)->data[i] = x;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
Object Get_Function (i) int i; {
|
|
|
|
return VECTOR(Functions)->data[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Deregister_Function (i) int i; {
|
|
|
|
VECTOR(Functions)->data[i] = Null;
|
|
|
|
}
|
|
|
|
|
|
|
|
elk_init_xt_function () {
|
|
|
|
Functions = Make_Vector (max_functions, Null);
|
|
|
|
Global_GC_Link (Functions);
|
|
|
|
}
|