Imported Debian patch 0.13.1-3
[pkg-lisaac.git] / src / external / size_of.li
blob1ba36c8f912c3ebdcc956fbebe0d08fa7d46f482
1 ///////////////////////////////////////////////////////////////////////////////
2 //                             Lisaac Compiler                               //
3 //                                                                           //
4 //                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
5 //                                                                           //
6 //   This program is free software: you can redistribute it and/or modify    //
7 //   it under the terms of the GNU General Public License as published by    //
8 //   the Free Software Foundation, either version 3 of the License, or       //
9 //   (at your option) any later version.                                     //
10 //                                                                           //
11 //   This program is distributed in the hope that it will be useful,         //
12 //   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
13 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
14 //   GNU General Public License for more details.                            //
15 //                                                                           //
16 //   You should have received a copy of the GNU General Public License       //
17 //   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
18 //                                                                           //
19 //                     http://isaacproject.u-strasbg.fr/                     //
20 ///////////////////////////////////////////////////////////////////////////////
21 Section Header
22   
23   + name        := SIZE_OF;
25   - copyright   := "2003-2007 Benoit Sonntag";
27     
28   - author      := "Sonntag Benoit (bsonntag@loria.fr)";
29   - comment     := "Size of object";
30   
31 Section Inherit
32   
33   + parent_expr:Expanded EXPR;
34   
35 Section Public 
36   
37   - is_invariant:BOOLEAN <- TRUE;  
38   
39   + receiver:EXPR;
40     
41   - static_type:TYPE_FULL <- type_integer.default;
42   
43   - get_type t:TYPES_TMP <-
44   (     
45     t.add type_integer;
46   );
47   
48   //
49   // Creation.
50   //
51   
52   - create p:POSITION receiver e:EXPR :SELF <-
53   ( + result:SELF;
54     
55     result := clone;
56     result.make p receiver e;
57     result
58   );
59   
60   - make p:POSITION receiver e:EXPR <-
61   (
62     position := p;            
63     receiver := e; 
64   );
65   
66   - my_copy:SELF <- SELF.create position receiver (receiver.my_copy);
67   
68   //
69   // Remove
70   //
71   
72   - remove <-
73   (
74     receiver.remove;
75   );
76   
77   //
78   // Execute
79   //
80   
81   - execute_unlink:INSTR <-
82   (     
83     receiver.execute_unlink
84   );
85   
86   - execute_link:EXPR <-
87   (   
88     receiver := receiver.execute_link;
89     Self
90   );
91     
92   //
93   // Genere.
94   //
95   
96   - genere buffer:STRING <-
97   ( + t:TYPE_FULL;
98     buffer.append "sizeof(";
99     t := receiver.static_type;
100     t.raw.put_expanded_declaration buffer;
101     buffer.add_last ')';    
102   );
103   
104   //
105   // Display.
106   //
107   
108   - display buffer:STRING <-
109   (
110     buffer.append "size_of(";
111     receiver.display buffer;
112     buffer.add_last ')';
113   );