Initial commit

This commit is contained in:
2022-08-19 15:22:33 +02:00
commit d682fae506
545 changed files with 48172 additions and 0 deletions

50
gen/fvi.c Normal file
View File

@ -0,0 +1,50 @@
#include <stdlib.h>
#include <assert.h>
typedef void (*Routine)(void);
typedef struct Desc {
Routine r;
int t;
} Desc;
static Desc list0={0,0};
static Desc *list=&list0;
static int n=1;
static int m=0;
static int idx(Routine r, int t) {
int i;
Desc *p;
for (i=0; i<n; i++) {
if (list[i].r == r) {
if (i>0) {
list[i].t = t;
}
return i;
}
}
if (n>=m) {
if (m==0) {
m=64;
} else {
m*=2;
}
p = calloc(m, sizeof(Desc));
if (!p) return -1;
for (i=1; i<n; i++) {
p[i] = list[i];
}
if (list != &list0) free(list);
list = p;
}
list[n].r = r;
list[n].t = t;
n++;
return n-1;
}