48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
#include "compare.h"
|
||
|
||
// tableau des tailles des types (ne pas modifier)
|
||
int psize[] = {
|
||
2, 1, 5, MAXSTR, 9,
|
||
};
|
||
|
||
// tableau des fonctions de comparaison
|
||
fcmp cmp[] = {
|
||
fcmp_int, fcmp_char, fcmp_double, fcmp_string, fcmp_pointx,
|
||
};
|
||
|
||
// tableau des types pour l'aide
|
||
char *type[] = {
|
||
"int", "integers in [0,100[ (default)",
|
||
"char", "capital letters in ['A','Z'[",
|
||
"double", "real numbers in ]-1.00,+1.00[",
|
||
"string", "strings of length at most " xstr(MAXSTR),
|
||
"point", "real points of [0,9.9]×[0,9.9] with 'x' like fcmp()",
|
||
};
|
||
|
||
// tableau des tailles des types
|
||
int size[] = {
|
||
sizeof(int), sizeof(char), sizeof(double), sizeof(string), sizeof(point),
|
||
};
|
||
|
||
int fcmp_int(const void *x, const void *y) {
|
||
int a = *((int *)x);
|
||
int b = *((int *)y);
|
||
return (a < b) ? -1 : (a > b);
|
||
}
|
||
|
||
int fcmp_char(const void *x, const void *y) {
|
||
return 0;
|
||
}
|
||
|
||
int fcmp_double(const void *x, const void *y) {
|
||
return 0;
|
||
}
|
||
|
||
int fcmp_string(const void *x, const void *y) {
|
||
return 0;
|
||
}
|
||
|
||
int fcmp_pointx(const void *p, const void *q) {
|
||
return 0;
|
||
}
|