0001
0002
0003 #include <stdio.h>
0004 #include <stdlib.h>
0005 #include<string.h>
0006 #include<ctype.h>
0007
0008
0009 #include "tsarcad.h"
0010 #include "def.h"
0011 #include "tdef.h"
0012 #include "erreur.h"
0013 char tslib_reel='f';
0014
0015 typedef struct t_ {
0016 char nom[8];
0017 int temps;
0018 }tdecl;
0019
0020 typedef struct v_t_decode_ {
0021 char type[2];
0022 short numero;
0023 short polar;
0024 char declench1[L_NOM_DECLENCHE];
0025 char declench2[L_NOM_DECLENCHE];
0026 Longint duree;
0027 char comment[L_COMMENTAIRE];
0028 } v_t_decode;
0029
0030
0031 char gros_buffer[12345]={"AZE"};
0032
0033 int
0034 main ()
0035 {
0036 char t_objet[16], n_prod[13], n_objet[13], n_param[13];
0037 register int i;
0038 int the_size, n_choc, nb_obj,n_val = 0;
0039 ts_objet *p_ts_obj, *p_tmp;
0040 int cr;
0041 int format, nb_val, data_int[32];
0042 float *pt_flt, data_float[4];
0043 char *pt_char, *pt_comment;
0044 char **pt_cmt;
0045 void *pt_void;
0046 char *pt__;
0047 ts_diagnostic *pt_diagnostic;
0048 ts_donnee *pt_donnee;
0049 char *ldiag[100], *lsig[200];
0050 tdecl *ptdecl;
0051 v_t_decode *pp;
0052 char VAL[123456];
0053 int L;
0054
0055
0056
0057 "APOLO"
0058
0059 "bob tstele OK on a %d long \n"
0060
0061
0062 "bob tstele PAS OK %d \n"
0063
0064
0065
0066 puts (" Test RqParm");
0067
0068 printf ("No Choc ? ");
0069 scanf ("%d", &n_choc);
0070 printf ("Nom prod ? ");
0071 scanf ("%s", n_prod);
0072 printf ("Nom objet ? ");
0073 scanf ("%s", n_objet);
0074 printf ("Nom param ? ");
0075 scanf ("%s", n_param);
0076
0077 pt_char = NULL;
0078
0079 n_val = 256;
0080 cr = TSRqParm (n_choc, n_prod, n_objet, n_param, n_val, &pt_char, &nb_val, &format);
0081 if (cr == 0)
0082 {
0083 printf ("bob tsrqparm OK on a %d valeurs \n",nb_val);
0084 switch(format){
0085 case OCTET:
0086 {
0087 ts_v_int1 * pt_void;
0088 pt_void = (ts_v_int1 *) pt_char;
0089 for (i = 0; i < nb_val; i++)
0090 {
0091 printf ("valeur %i : %d\n", i, pt_void->integer1);
0092 pt_void += 1;
0093 }
0094 free(pt_char);
0095 break;
0096 }
0097 case INT16:
0098 {
0099 short * pt_void;
0100 pt_void = (short *) gros_buffer;
0101 pt_void = (short *) pt_char;
0102 for (i = 0; i < nb_val; i++)
0103 {
0104 printf ("valeur %i : %d\n", i, *(pt_void));
0105 pt_void += 1;
0106 }
0107 free(pt_char);
0108 break;
0109 }
0110 case INT32:
0111 {
0112 int * pt_void;
0113 pt_void = (int *) pt_char;
0114 for (i = 0; i < nb_val; i++)
0115 {
0116 printf ("valeur %i : %d\n", i, *(pt_void));
0117 pt_void += 1;
0118 }
0119 free(pt_char);
0120 break;
0121 }
0122 case REEL16:
0123 {
0124 ts_v_float4 * pt_void;
0125 pt_void = (ts_v_float4 *) pt_char;
0126 for (i = 0; i < nb_val; i++)
0127 {
0128 printf ("valeur %i : %6.3f\n", i, pt_void->float4);
0129 pt_void += 1;
0130 }
0131 free(pt_char);
0132 break;
0133 }
0134 case STRING12:
0135 {
0136 char * pt_void;
0137 pt_void = (char *) pt_char;
0138 for (i = 0; i < nb_val; i++)
0139 {
0140 printf ("valeur %d : %s\n", i, pt_void);
0141 pt_void += 1;
0142 }
0143 free(pt_char);
0144 break;
0145 }
0146 case T_DECLENC:
0147 {
0148 ts_v_declenc * pt_void;
0149 pt_void = (ts_v_declenc *) pt_char;
0150 for (i = 0; i < nb_val; i++)
0151 {
0152 printf ("nom %s valeur : %f \n", pt_void->nom,pt_void->temps);
0153 pt_void += 1;
0154 }
0155 free(pt_char);
0156 break;
0157 }
0158 case 16:
0159 {
0160 tdecl * ptdecl;
0161 ptdecl = (tdecl *) pt_char;
0162 for (i = 0; i < nb_val; i++)
0163 {
0164 int j;
0165 printf ("nom[%3d] : ",i);
0166 for(j=0;j<8;j++)
0167 printf("%c",ptdecl->nom[j]);
0168 printf (" valeur : %d \n",ptdecl->temps);
0169 ptdecl += 1;
0170 }
0171 free(pt_char);
0172 break;
0173 }
0174 case TWIN_REEL32:
0175 {
0176 ts_v_float4_float4 * pt_void;
0177 pt_void = (ts_v_float4_float4 *) pt_char;
0178 for (i = 0; i < nb_val; i++)
0179 {
0180 printf ("valeur %i : %6.3f %6.3f \n", i,
0181 pt_void->float4_1,pt_void->float4_2);
0182 pt_void += 1;
0183 }
0184 free(pt_char);
0185 break;
0186 }
0187
0188 case F_ACHRONO:
0189 {
0190 ts_v_achrono * pt_void;
0191 pt_void = (ts_v_achrono *) pt_char;
0192 for (i = 0; i < nb_val; i++)
0193 {
0194 printf ("valeur %i : %s %s %6.3f %6.3f %s\n", i,
0195 pt_void->code,pt_void->declenche,
0196 pt_void->decalage,pt_void->duree,pt_void->comment);
0197 pt_void += 1;
0198 }
0199 free(pt_char);
0200 break;
0201 }
0202
0203 case F_DESCRIPTEUR:
0204 {
0205 ts_v_descripteur * pt_void;
0206 pt_void = (ts_v_descripteur *) pt_char;
0207 for (i = 0; i < nb_val; i++)
0208 {
0209 printf ("valeur %i : %d %s %s %d %s %s %d\n", i,
0210 pt_void->num_choc, pt_void->nom_diag, pt_void->donnee_brute,
0211 pt_void->indiceb, pt_void->nom_trait, pt_void->donnee_traitee,
0212 pt_void->indicet);
0213 pt_void += 1;
0214 }
0215 free(pt_char);
0216 break;
0217
0218 case 24:
0219 {
0220 v_t_decode * pt_void;
0221 for (i = 0; i < nb_val; i++)
0222 {
0223 pt_void = (v_t_decode *) pt_char;
0224 printf ("valeur %i : %2c %d %d %s %s %d %s\n", i,
0225 pt_void->type, pt_void->numero, pt_void->polar,
0226 pt_void->declench1, pt_void->declench2, pt_void->duree,
0227 pt_void->comment);
0228
0229 pt_char = pt_char + 2+sizeof(short) *2+ 2*L_NOM_DECLENCHE+
0230 sizeof(Longint)+L_COMMENTAIRE;
0231
0232 }
0233 free(pt_char);
0234 break;
0235 }
0236 }
0237 default: puts(" Not yet implemented ");
0238 }
0239 }
0240 else
0241 {
0242 printf ("bob : Erreur tsrqparam %d\n",cr);
0243 }
0244
0245
0246 " Test TSdescObjet"
0247
0248 "No Choc ? "
0249 "%d"
0250 "Nom prod ? "
0251 "%s"
0252 "Nom objet ? "
0253 "%s"
0254 "Nom type objet ? "
0255 "%s"
0256
0257
0258
0259
0260
0261
0262 "bob tsdescobj OK"
0263 "comment %s \n"
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332 "bob tsdescobj Pb %d\n"
0333
0334
0335
0336 "TSDescDon_choc \nNo Choc ? "
0337 "%d"
0338 "Nom donnee ? "
0339 "%s"
0340
0341
0342
0343
0344 "bob tsdescdon_choc OK"
0345 " id_objet :\t%d \n"
0346 " numero :\t%d \n"
0347 " id_donnee :\t%d \n"
0348 " condif :\t%d \n"
0349 " type_don :\t%d \n"
0350 " nb_compo :\t%d \n"
0351 " nb_coord :\t%d \n"
0352 " formatX :\t%s \n"
0353 " formatY :\t%s \n"
0354 " formatI :\t%s \n"
0355 " formatJ :\t%s \n"
0356 " uniteX :\t%s \n"
0357 " uniteY :\t%s \n"
0358 " uniteI :\t%s \n"
0359 " uniteJ :\t%s \n"
0360 " structX :\t%d \n"
0361 " structY :\t%d \n"
0362 " strucI :\t%d \n"
0363 " strucJ :\t%d \n"
0364 " longi :\t%d \n"
0365 " longj :\t%d \n"
0366 " maxtrame :\t%d \n"
0367 " remdif :\t%d \n"
0368
0369
0370
0371 "bob tsdesdon_choc Pb %d\n"
0372
0373
0374 return (0);
0375 }
0376
0377 decObjet(char *type_objet, char *pt_val )
0378 {
0379
0380 void * result;
0381 switch ( fi(type_objet)) {
0382
0383 case DONNEE: {
0384 ts_donnee *pt = (ts_donnee *) pt_val;
0385
0386 printf(" id_objet :\t%d \n", pt->id_objet);
0387 printf(" id_donnee :\t%d \n", pt->id_donnee);
0388 printf(" condif :\t%d \n", pt->confidentialite);
0389 printf(" type_don :\t%d \n", pt->type_donnee);
0390 printf(" nb_compo :\t%d \n", pt->nb_composantes);
0391 printf(" nb_coord :\t%d \n", pt->nb_coordonnees);
0392 printf(" structX :\t%d \n", pt->structx);
0393 printf(" structY :\t%d \n", pt->structy);
0394 printf(" strucI :\t%d \n", pt->structi);
0395 printf(" strucJ :\t%d \n", pt->structj);
0396 printf(" lgi :\t%d \n", pt->longueuri);
0397 printf(" lgj :\t%d \n", pt->longueurj);
0398 printf(" maxtrame :\t%d \n", pt->maxtrame);
0399 printf(" remdif :\t%d \n", pt->remdif);
0400 }
0401 break;
0402
0403
0404 }
0405
0406
0407 return(0);
0408
0409
0410 }
0411