0001
0002
0003
0004
0005
0006 #include <time.h>
0007 #include "tdef.h"
0008
0009
0010
0011 T_Objet Type_Objets[] =
0012 {
0013 "ACHRONO",28,
0014 "ASSERVISSEMENT", 20,
0015 "CAMAC2162", 5,
0016 "CAMAC6103", 6,
0017 "CAMAC6810", 7,
0018 "CAMAC8818", 8,
0019 "CHRONO", 9,
0020 "CHRONOVME", 18,
0021 "COMMON", 26,
0022 "CONSIGNE", 21,
0023 "DATE1", 10,
0024 "DATE2", 11,
0025 "DECOD_CHRONO", 14,
0026 "DIAGNOSTIC", 1,
0027 "DONGEN", 22,
0028 "DONNEE", 2,
0029 "ENCOD_CHRONO", 15,
0030 "GENE_FONCTION", 13,
0031 "ICM100", 3,
0032 "ICM101", 4,
0033 "ICV101", 27,
0034 "OBJET_CHRONO", 24,
0035 "PILOTAGE", 17,
0036 "SEQ_NUM", 12,
0037 "STRAT_DIAG", 16,
0038 "STRAT_PIL", 23,
0039 "TORE_SUPRA", 25,
0040 "TOUS", 100,
0041 "TRAITEMENT", 19,
0042 };
0043
0044 #define NB_OBJETS (sizeof(Type_Objets) / sizeof(T_Objet))
0045 int nb_objets = NB_OBJETS;
0046
0047 int binary (char *word, int n);
0048
0049 int
0050 fi (char *objet)
0051
0052 {
0053
0054 register int i;
0055
0056
0057 if ((i = binary (objet, nb_objets)) < 0)
0058 return (-1);
0059 else
0060 return (Type_Objets[i].code_type);
0061
0062 }
0063
0064
0065
0066
0067
0068
0069 int
0070 binary (char *word, int n)
0071 {
0072 register int low, high, mid, cond;
0073
0074 low = 0;
0075 high = n - 1;
0076 while (low <= high)
0077 {
0078 mid = (low + high) / 2;
0079 if ((cond = strcmp (word, Type_Objets[mid].obj_name)) < 0)
0080 high = mid - 1;
0081 else if (cond > 0)
0082 low = mid + 1;
0083 else
0084 return (mid);
0085 }
0086 return (-1);
0087 }
0088
0089
0090 int
0091 date_bd ()
0092 {
0093 time_t temps_absolu;
0094 struct tm *temps_systeme;
0095
0096 temps_absolu = time ((time_t *) 0);
0097
0098 temps_systeme = localtime (&temps_absolu);
0099
0100 return (temps_systeme->tm_mday
0101 + (temps_systeme->tm_mon + 1) * 100
0102 + (temps_systeme->tm_year + 1900) * 10000);
0103 }
0104
0105 void
0106 upper (char *chaine)
0107 {
0108 char *pt;
0109 pt = chaine;
0110
0111 while (*pt)
0112 {
0113 *pt = toupper (*pt);
0114 pt++;
0115 }
0116 }
0117
0118