Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix paths
[simgrid.git] / testsuite / gras / datadesc_usage.c
1 /* $Id$ */
2
3 /* datadesc: test of data description (using file transport).               */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2004 the OURAGAN project.                                  */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #include <stdio.h>
12 #include <gras.h>
13
14 #include "../src/gras/DataDesc/datadesc_interface.h"
15 GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
16
17 #define READ  0
18 #define WRITE 1
19 #define RW    2
20
21 int r_arch;
22 const char *filename = "datadesc_usage.out";  
23
24 gras_error_t
25 write_read(gras_datadesc_type_t *type,void *src, void *dst, 
26            gras_socket_t *sock, int direction);
27
28 gras_error_t
29 write_read(gras_datadesc_type_t *type,void *src, void *dst, 
30            gras_socket_t *sock, int direction) {
31   gras_error_t errcode;
32    
33   /* write */
34   if (direction == RW) 
35     TRY(gras_socket_client_from_file(filename,&sock));
36   if (direction == WRITE || direction == RW)
37     TRY(gras_datadesc_send(sock, type, src));
38   if (direction == RW) 
39     gras_socket_close(sock);
40    
41   /* read */
42   if (direction == RW) 
43     TRY(gras_socket_server_from_file(filename,&sock));
44
45   if (direction == READ || direction == RW)
46     TRY(gras_datadesc_recv(sock, type, r_arch, dst));
47
48   if (direction == RW) 
49     gras_socket_close(sock);
50   
51   return no_error;
52 }
53
54 gras_error_t test_int(gras_socket_t *sock, int direction);
55 gras_error_t test_float(gras_socket_t *sock, int direction);
56 gras_error_t test_double(gras_socket_t *sock, int direction);
57 gras_error_t test_array(gras_socket_t *sock, int direction);
58 gras_error_t test_intref(gras_socket_t *sock, int direction);
59 gras_error_t test_string(gras_socket_t *sock, int direction);
60
61 gras_error_t test_homostruct(gras_socket_t *sock, int direction);
62 gras_error_t test_hetestruct(gras_socket_t *sock, int direction);
63 gras_error_t test_nestedstruct(gras_socket_t *sock, int direction);
64 gras_error_t test_chain_list(gras_socket_t *sock, int direction);
65 gras_error_t test_graph(gras_socket_t *sock, int direction);
66
67 gras_error_t test_pbio(gras_socket_t *sock, int direction);
68 gras_error_t test_clause(gras_socket_t *sock, int direction);
69
70 /* defined in datadesc_structures.c, which in perl generated */
71 gras_error_t test_structures(gras_socket_t *sock, int direction); 
72
73
74
75 gras_error_t test_int(gras_socket_t *sock, int direction) {
76   gras_error_t errcode;
77   int i=5,j;
78   
79   INFO0("---- Test on integer ----");
80   TRY(write_read(gras_datadesc_by_name("int"), &i,&j, sock,direction));
81   if (direction == READ || direction == RW) {
82     gras_assert(i == j);
83   }
84   return no_error;
85 }
86 gras_error_t test_float(gras_socket_t *sock, int direction) {
87   gras_error_t errcode;
88   float i=5.0,j;
89   
90   INFO0("---- Test on float ----");
91   TRY(write_read(gras_datadesc_by_name("float"), &i,&j, sock,direction));
92   if (direction == READ || direction == RW) {
93     gras_assert2(i == j,"%f != %f",i,j);
94   }
95   return no_error;
96 }
97 gras_error_t test_double(gras_socket_t *sock, int direction) {
98   gras_error_t errcode;
99   double i=-3252355.1234,j;
100   
101   INFO0("---- Test on double ----");
102   TRY(write_read(gras_datadesc_by_name("double"), &i,&j, sock,direction));
103   if (direction == READ || direction == RW) {
104     gras_assert2(i == j,"%f != %f",i,j);
105   }
106   return no_error;
107 }
108
109 #define SIZE 5
110 typedef int array[SIZE];
111 gras_error_t test_array(gras_socket_t *sock, int direction) {
112   gras_error_t errcode;
113   gras_datadesc_type_t *my_type;
114   
115   array i = { 35212,-6226,74337,11414,7733};
116   array j;
117   int cpt;
118
119   INFO0("---- Test on fixed array ----");
120
121   TRY(gras_datadesc_array_fixed("fixed int array", 
122                                 gras_datadesc_by_name("int"),
123                                 SIZE, &my_type));
124
125   TRY(write_read(my_type, &i,&j, sock,direction));
126   if (direction == READ || direction == RW) {
127     for (cpt=0; cpt<SIZE; cpt++) {
128       DEBUG1("Test spot %d",cpt);
129       gras_assert4(i[cpt] == j[cpt],"i[%d]=%d  !=  j[%d]=%d",
130                    cpt,i[cpt],cpt,j[cpt]);
131     }
132   }
133   return no_error;
134 }
135 gras_error_t test_intref(gras_socket_t *sock, int direction) {
136   gras_error_t errcode;
137   gras_datadesc_type_t *my_type;
138   int *i,*j;
139   
140   if (! (i=malloc(sizeof(int))) )
141     RAISE_MALLOC;
142   *i=12345;
143
144   INFO1("---- Test on a reference to an integer (%p) ----",i);
145
146   TRY(gras_datadesc_ref("int*",gras_datadesc_by_name("int"),&my_type));
147
148   TRY(write_read(my_type, &i,&j, sock,direction));
149   if (direction == READ || direction == RW) {
150     gras_assert(*i == *j);
151     free(j);
152   }
153   free(i);
154   return no_error;
155 }
156
157 /***
158  *** string (dynamic array)
159  ***/ 
160 gras_error_t test_string(gras_socket_t *sock, int direction) {
161   gras_error_t errcode;
162   char *i=strdup("Some data"), *j=NULL;
163   int cpt;
164   
165   INFO0("---- Test on string (ref to dynamic array) ----");
166   TRY(write_read(gras_datadesc_by_name("string"), &i,&j,
167                  sock,direction));
168   if (direction == READ || direction == RW) {
169     for (cpt=0; cpt<strlen(i); cpt++) {
170       gras_assert4(i[cpt] == j[cpt],"i[%d]=%c  !=  j[%d]=%c",
171                    cpt,i[cpt],cpt,j[cpt]);
172     } 
173     free(j);
174   }
175   free(i);
176   return no_error;
177 }
178
179
180 /***
181  *** homogeneous struct
182  ***/ 
183 typedef struct {
184   int a,b,c,d;
185 } homostruct;
186 gras_error_t test_homostruct(gras_socket_t *sock, int direction) {
187   gras_error_t errcode;
188   gras_datadesc_type_t *my_type;
189   homostruct *i, *j; 
190
191   INFO0("---- Test on homogeneous structure ----");
192   /* create descriptor */
193   TRY(gras_datadesc_struct("homostruct",&my_type));
194   TRY(gras_datadesc_struct_append(my_type,"a",
195                                   gras_datadesc_by_name("signed int")));
196   TRY(gras_datadesc_struct_append(my_type,"b",
197                                   gras_datadesc_by_name("int")));
198   TRY(gras_datadesc_struct_append(my_type,"c",
199                                   gras_datadesc_by_name("int")));
200   TRY(gras_datadesc_struct_append(my_type,"d",
201                                   gras_datadesc_by_name("int")));
202   gras_datadesc_struct_close(my_type);
203   TRY(gras_datadesc_ref("homostruct*",
204                         gras_datadesc_by_name("homostruct"),
205                         &my_type));
206
207   /* init a value, exchange it and check its validity*/
208   if (! (i=malloc(sizeof(homostruct))) )
209     RAISE_MALLOC;
210   i->a = 2235;    i->b = 433425;
211   i->c = -23423;  i->d = -235235;
212
213   TRY(write_read(my_type, &i,&j, sock,direction));
214   if (direction == READ || direction == RW) {
215     gras_assert(i->a == j->a);
216     gras_assert(i->b == j->b);
217     gras_assert(i->c == j->c);
218     gras_assert(i->d == j->d);
219     free(j);
220   }
221   free(i);
222   return no_error;
223 }
224
225 /***
226  *** heterogeneous struct
227  ***/ 
228 typedef struct {
229   unsigned char c1;
230   unsigned long int l1;
231   unsigned char c2;
232   unsigned long int l2;
233 } hetestruct;
234 gras_error_t test_hetestruct(gras_socket_t *sock, int direction) {
235   gras_error_t errcode;
236   gras_datadesc_type_t *my_type;
237   hetestruct *i, *j; 
238
239   INFO0("---- Test on heterogeneous structure ----");
240   /* create descriptor */
241   TRY(gras_datadesc_struct("hetestruct",&my_type));
242   TRY(gras_datadesc_struct_append(my_type,"c1",
243                                   gras_datadesc_by_name("unsigned char")));
244   TRY(gras_datadesc_struct_append(my_type,"l1",
245                                   gras_datadesc_by_name("unsigned long int")));
246   TRY(gras_datadesc_struct_append(my_type,"c2",
247                                   gras_datadesc_by_name("unsigned char")));
248   TRY(gras_datadesc_struct_append(my_type,"l2",
249                                   gras_datadesc_by_name("unsigned long int")));
250   gras_datadesc_struct_close(my_type);
251   TRY(gras_datadesc_ref("hetestruct*", gras_datadesc_by_name("hetestruct"),
252                         &my_type));
253
254   /* init a value, exchange it and check its validity*/
255   if (! (i=malloc(sizeof(hetestruct))) )
256     RAISE_MALLOC;
257   i->c1 = 's'; i->l1 = 123455;
258   i->c2 = 'e'; i->l2 = 774531;
259
260   TRY(write_read(my_type, &i,&j, sock,direction));
261   if (direction == READ || direction == RW) {
262     gras_assert(i->c1 == j->c1);
263     gras_assert(i->c2 == j->c2);
264     gras_assert2(i->l1 == j->l1,"i->l1(=%ld)  !=  j->l1(=%ld)",i->l1,j->l1);
265     gras_assert(i->l2 == j->l2);
266     free(j);
267   }
268   free(i);
269   return no_error;
270 }
271
272 /***
273  *** nested struct
274  ***/ 
275 typedef struct {
276   hetestruct hete;
277   homostruct homo;
278 } nestedstruct;
279 gras_error_t test_nestedstruct(gras_socket_t *sock, int direction) {
280   gras_error_t errcode;
281   gras_datadesc_type_t *my_type;
282   nestedstruct *i, *j; 
283
284   INFO0("---- Test on nested structures ----");
285   /* create descriptor */
286   TRY(gras_datadesc_struct("nestedstruct",&my_type));
287
288   TRY(gras_datadesc_struct_append(my_type,"hete",
289                                   gras_datadesc_by_name("hetestruct")));
290   TRY(gras_datadesc_struct_append(my_type,"homo",
291                                   gras_datadesc_by_name("homostruct")));
292   gras_datadesc_struct_close(my_type);
293   TRY(gras_datadesc_ref("nestedstruct*", gras_datadesc_by_name("nestedstruct"),
294                         &my_type));
295
296   /* init a value, exchange it and check its validity*/
297   if (! (i=malloc(sizeof(nestedstruct))) )
298     RAISE_MALLOC;
299   i->homo.a = 235231;  i->homo.b = -124151;
300   i->homo.c = 211551;  i->homo.d = -664222;
301   i->hete.c1 = 's'; i->hete.l1 = 123455;
302   i->hete.c2 = 'e'; i->hete.l2 = 774531;
303
304   TRY(write_read(my_type, &i,&j, sock,direction));
305   if (direction == READ || direction == RW) {
306     gras_assert(i->homo.a == j->homo.a);
307     gras_assert(i->homo.b == j->homo.b);
308     gras_assert(i->homo.c == j->homo.c);
309     gras_assert(i->homo.d == j->homo.d);
310     gras_assert(i->hete.c1 == j->hete.c1);
311     gras_assert(i->hete.c2 == j->hete.c2);
312     gras_assert(i->hete.l1 == j->hete.l1);
313     gras_assert(i->hete.l2 == j->hete.l2);
314     free(j);
315   }
316   free(i);
317   return no_error;
318 }
319
320 /***
321  *** chained list
322  ***/ 
323 typedef struct s_chained_list chained_list_t;
324 struct s_chained_list {
325   int          v;
326   chained_list_t *l;
327 };
328 gras_error_t declare_chained_list_type(void);
329 chained_list_t *cons(int v, chained_list_t *l);
330 void list_free(chained_list_t *l);
331 int list_eq(chained_list_t*i,chained_list_t*j);
332
333 gras_error_t declare_chained_list_type(void) {
334   gras_error_t errcode;
335   gras_datadesc_type_t *my_type,*ref_my_type;
336
337   TRY(gras_datadesc_struct("chained_list_t",&my_type));
338   TRY(gras_datadesc_ref("chained_list_t*",my_type,&ref_my_type));
339
340   TRY(gras_datadesc_struct_append(my_type,"v", gras_datadesc_by_name("int")));
341   TRY(gras_datadesc_struct_append(my_type,"l", ref_my_type));
342   gras_datadesc_struct_close(my_type);
343
344   return no_error;
345 }
346
347 chained_list_t * cons(int v, chained_list_t *l) {
348   chained_list_t *nl = malloc(sizeof (chained_list_t));
349   
350   nl->v = v;
351   nl->l = l;
352   
353   return nl;
354 }
355 void list_free(chained_list_t*l) {
356   if (l) {
357     list_free(l->l);
358     free(l);
359   }
360 }
361 int list_eq(chained_list_t*i,chained_list_t*j) {
362   if (!i || !j) return i == j;
363   if (i->v != j->v)
364     return 0;
365   return list_eq(i->l, j->l); 
366 }
367 gras_error_t test_chain_list(gras_socket_t *sock, int direction) {
368   gras_error_t errcode;
369   chained_list_t *i, *j; 
370
371   INFO0("---- Test on chained list ----");
372
373   /* init a value, exchange it and check its validity*/
374   i = cons( 12355, cons( 246264 , cons( 23263, NULL)));
375   j = NULL;
376
377   TRY(write_read(gras_datadesc_by_name("chained_list_t*"),
378                  &i,&j,
379                  sock,direction));
380   if (direction == READ || direction == RW) {
381     gras_assert(list_eq(i,j));    
382     list_free(j);
383   }
384
385   list_free(i);
386   return no_error;
387 }
388 /***
389  *** graph
390  ***/
391 gras_error_t test_graph(gras_socket_t *sock, int direction) {
392   gras_error_t errcode;
393   chained_list_t *i, *j; 
394
395   INFO0("---- Test on graph (cyclique chained list) ----");
396   /* init a value, exchange it and check its validity*/
397   i = cons( 1151515, cons( -232362 , cons( 222552, NULL)));
398   i->l->l->l = i;
399   j = NULL;
400
401   TRY(write_read(gras_datadesc_by_name("chained_list_t*"),
402                  &i,&j, sock,direction));
403   if (direction == READ || direction == RW) {
404     
405     DEBUG1("i=%p"         ,i);
406     DEBUG1("i->l=%p"      ,i->l);
407     DEBUG1("i->l->l=%p"   ,i->l->l);
408     DEBUG1("i->l->l->l=%p",i->l->l->l);
409     DEBUG1("j=%p"         ,j);
410     DEBUG1("j->l=%p"      ,j->l);
411     DEBUG1("j->l->l=%p"   ,j->l->l);
412     DEBUG1("j->l->l->l=%p",j->l->l->l);
413     gras_assert4(j->l->l->l == j,
414                  "Received list is not cyclic. j=%p != j->l->l->l=%p\n"
415                  "j=%p; &j=%p",
416                  j,j->l->l->l, 
417                  j ,&j);
418     j->l->l->l = NULL;
419     i->l->l->l = NULL;
420     gras_assert(list_eq(i,j));
421
422     list_free(j);
423   }
424   i->l->l->l = NULL; /* do this even in WRITE mode */
425   list_free(i);
426   return no_error;
427 }
428
429 /**** PBIO *****/
430 GRAS_DEFINE_TYPE(s_pbio,
431 struct s_pbio{ /* structure presented in the IEEE article */
432   int Cnstatv;
433   double Cstatev[12];
434   int Cnprops;
435   double Cprops[110];
436   int Cndi[4];
437   int Cnshr;
438   int Cnpt;
439   double Cdtime;
440   double Ctime[2];
441   int Cntens;
442   double Cdfgrd0[373][3];
443   double Cdfgrd1[3][3];
444   double Cstress[106];
445   double Cddsdde[106][106];
446 };
447                  )
448 typedef struct s_pbio pbio_t;
449
450 gras_error_t test_pbio(gras_socket_t *sock, int direction) {
451   gras_error_t errcode;
452   pbio_t i,j;
453   int cpt;
454   int cpt2;
455   gras_datadesc_type_t *pbio_type;
456
457   INFO0("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
458   pbio_type = gras_datadesc_by_symbol(s_pbio);
459
460   /* Fill in that damn struct */
461   i.Cnstatv = 325115;
462   for (cpt=0; cpt<12; cpt++) 
463     i.Cstatev[cpt] = ((double) cpt) * -2361.11;
464   i.Cnprops = -37373;
465   for (cpt=0; cpt<110; cpt++)
466     i.Cprops[cpt] = cpt * 100.0;
467   for (cpt=0; cpt<4; cpt++)
468     i.Cndi[cpt] = cpt * 23262;
469   i.Cnshr = -4634;
470   i.Cnpt = 114142;
471   i.Cdtime = -11515.662;
472   i.Ctime[0] = 332523.226;
473   i.Ctime[1] = -26216.113;
474   i.Cntens = 235211411;
475   
476   for (cpt=0; cpt<3; cpt++) {
477     for (cpt2=0; cpt2<373; cpt2++)
478       i.Cdfgrd0[cpt2][cpt] = ((double)cpt) * ((double)cpt2);
479     for (cpt2=0; cpt2<3; cpt2++)
480       i.Cdfgrd1[cpt][cpt2] = -((double)cpt) * ((double)cpt2);
481   }
482   for (cpt=0; cpt<106; cpt++) {
483     i.Cstress[cpt]=(double)cpt * 22.113;
484     for (cpt2=0; cpt2<106; cpt2++) 
485       i.Cddsdde[cpt][cpt2] = ((double)cpt) * ((double)cpt2);
486   }
487   TRY(write_read(gras_datadesc_by_symbol(s_pbio),
488                  &i,&j, sock,direction));
489   if (direction == READ || direction == RW) {
490     /* Check that the data match */
491     gras_assert(i.Cnstatv == j.Cnstatv);
492     for (cpt=0; cpt<12; cpt++)
493       gras_assert(i.Cstatev[cpt] == j.Cstatev[cpt]);
494     gras_assert(i.Cnprops == j.Cnprops);
495     for (cpt=0; cpt<110; cpt++)
496       gras_assert(i.Cprops[cpt] == j.Cprops[cpt]);
497     for (cpt=0; cpt<4; cpt++) 
498       gras_assert(i.Cndi[cpt] == j.Cndi[cpt]);
499     gras_assert(i.Cnshr == j.Cnshr);
500     gras_assert(i.Cnpt == j.Cnpt);
501     gras_assert(i.Cdtime == j.Cdtime);
502     gras_assert(i.Ctime[0] == j.Ctime[0]);
503     gras_assert(i.Ctime[1] == j.Ctime[1]);
504     gras_assert(i.Cntens == j.Cntens);
505     for (cpt=0; cpt<3; cpt++) {
506       for (cpt2=0; cpt2<373; cpt2++)
507         gras_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
508       for (cpt2=0; cpt2<3; cpt2++)
509         gras_assert(i.Cdfgrd1[cpt][cpt2] == j.Cdfgrd1[cpt][cpt2]);
510     }
511     for (cpt=0; cpt<106; cpt++) {
512       gras_assert(i.Cstress[cpt] == j.Cstress[cpt]);
513       for (cpt2=0; cpt2<106; cpt2++) 
514         gras_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
515                      "%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
516                      i.Cddsdde[cpt][cpt2],cpt,cpt2,j.Cddsdde[cpt][cpt2]);
517     }
518   }
519
520   return no_error;
521 }
522
523 GRAS_DEFINE_TYPE(s_clause,
524 struct s_clause {
525    int num_lits;
526    int *literals GRAS_ANNOTE(size,num_lits); /* Tells GRAS where to find the size */
527 };)
528 typedef struct s_clause Clause;
529
530 gras_error_t test_clause(gras_socket_t *sock, int direction) {
531   gras_error_t errcode;
532   gras_datadesc_type_t *ddt,*array_t;
533   Clause *i,*j;
534   int cpt;
535   
536   INFO0("---- Test on struct containing dynamic array and its size (cbps test) ----");
537
538   /* create and fill the struct */
539   if (! (i=malloc(sizeof(Clause))) )
540     RAISE_MALLOC;
541
542   i->num_lits = 5432;
543   if (! (i->literals = malloc(sizeof(int) * i->num_lits)) )
544     RAISE_MALLOC;
545   for (cpt=0; cpt<i->num_lits; cpt++)
546     i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
547   DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
548   DEBUG1("created count=%d",i->num_lits);
549
550   /* create the damn type descriptor */
551   ddt = gras_datadesc_by_symbol(s_clause);
552 //  gras_datadesc_type_dump(ddt);
553
554   TRYFAIL(gras_datadesc_ref("Clause*",ddt,&ddt));
555
556   TRY(write_read(ddt, &i,&j, sock,direction));
557   if (direction == READ || direction == RW) {
558     gras_assert(i->num_lits == j->num_lits);
559     for (cpt=0; cpt<i->num_lits; cpt++)
560       gras_assert(i->literals[cpt] == j->literals[cpt]);
561     
562     free(j->literals);
563     free(j);
564   }
565   free(i->literals);
566   free(i);
567   return no_error;
568 }
569
570 int main(int argc,char *argv[]) {
571   gras_error_t errcode;
572   gras_socket_t *sock;
573   int direction = RW;
574   int cpt;
575   char r_arch_char = gras_arch_selfid();
576
577   gras_init_defaultlog(&argc,argv,NULL);
578
579   for (cpt=1; cpt<argc; cpt++) {
580     if (!strcmp(argv[cpt], "--read")) {
581       direction = READ;
582     } else if (!strcmp(argv[cpt], "--write")) {
583       direction = WRITE;
584     } else {
585        filename=argv[cpt];
586     }
587   }
588     
589   if (direction == WRITE) {
590     TRYFAIL(gras_socket_client_from_file(filename,&sock));
591     TRY(gras_datadesc_send(sock, gras_datadesc_by_name("char"),
592                            &r_arch_char));
593   }
594   if (direction == READ) {
595     TRYFAIL(gras_socket_server_from_file(filename,&sock));
596     TRY(gras_datadesc_recv(sock, gras_datadesc_by_name("char"),
597                            gras_arch_selfid(), &r_arch_char));
598     INFO3("This datafile was generated on %s (%d), I'm %s.",
599           gras_datadesc_arch_name(r_arch_char),(int)r_arch_char,
600           gras_datadesc_arch_name(gras_arch_selfid()));
601   }
602   r_arch = (int)r_arch_char;
603   
604   TRYFAIL(test_int(sock,direction));    
605   TRYFAIL(test_float(sock,direction));  
606   TRYFAIL(test_double(sock,direction));  
607   TRYFAIL(test_array(sock,direction));  
608   TRYFAIL(test_intref(sock,direction)); 
609   
610   TRYFAIL(test_string(sock,direction)); 
611
612 // TRYFAIL(test_structures(sock,direction));
613
614   TRYFAIL(test_homostruct(sock,direction));
615   TRYFAIL(test_hetestruct(sock,direction));
616   TRYFAIL(test_nestedstruct(sock,direction));
617
618   TRYFAIL(declare_chained_list_type());
619   TRYFAIL(test_chain_list(sock,direction));
620   //  TRYFAIL(test_graph(sock,direction));
621
622   TRYFAIL(test_pbio(sock,direction));
623
624   TRYFAIL(test_clause(sock,direction));
625
626   if (direction != RW) 
627     gras_socket_close(sock);
628   gras_exit();
629   return 0;
630 }
631