Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add generated files to the CVS so that the use of autotools is not necessary to build...
[simgrid.git] / doc / gtut-tour-13-pointers.doc
1 /**
2 @page GRAS_tut_tour_pointers Lesson 13: Defining structure containing pointers (TODO)
3
4 \section GRAS_tut_tour_pointers_toc Table of Contents
5  - \ref GRAS_tut_tour_pointers_intro
6  - \ref GRAS_tut_tour_pointers_use
7  - \ref GRAS_tut_tour_pointers_recap
8    
9 <hr>
10
11 \section GRAS_tut_tour_pointers_intro Introduction
12
13
14 \section GRAS_tut_tour_pointers_use Defining structure containing pointers
15
16
17 \section GRAS_tut_tour_pointers_recap Recapping everything together
18
19 The program now reads:
20 include 12-pointers.c
21
22 Which produces the expected output:
23 include 12-pointers.output
24
25
26 */
27
28 #define COLS 16
29 #define MAX_ROUTESET 10
30 #define MAX_LEAFSET COLS
31
32 GRAS_DEFINE_TYPE(gras_row_t,
33 struct gras_row_t {         
34   int which_row;            
35   int row[COLS][MAX_ROUTESET];
36 };)
37     
38 typedef struct gras_row_t gras_row_t;
39     
40 GRAS_DEFINE_TYPE(gras_welcome_msg_t, 
41 struct gras_welcome_msg_t {
42   int id;
43   double time_sent;
44     
45   int row_count;
46   gras_row_t *rows GRAS_ANNOTE(size,row_count);
47         
48   int leaves[MAX_LEAFSET];
49 };)              
50
51 void declare_ddt(void) {
52   gras_datadesc_type_t ddt;
53   
54   gras_datadesc_set_const("COLS",COLS);
55   gras_datadesc_set_const("MAX_ROUTESET",MAX_ROUTESET);
56   gras_datadesc_set_const("MAX_LEAFSET",MAX_LEAFSET);
57   
58   gras_datadesc_by_symbol(gras_row_t); /* Parse it before */
59   ddt=gras_datadesc_ref("welcome_msg_t*",gras_datadesc_by_symbol(gras_welcome_msg_t));
60   gras_msgtype_declare("welcome",ddt);  
61 }