OLD | NEW |
1 {#--- Begin #} | 1 {#--- Begin #} |
2 function {{struct.name}}(values) { | 2 function {{struct.name}}(values) { |
3 this.initDefaults_(); | 3 this.initDefaults_(); |
4 this.initFields_(values); | 4 this.initFields_(values); |
5 } | 5 } |
6 | 6 |
7 {#--- Enums #} | 7 {#--- Enums #} |
8 {%- from "enum_definition.tmpl" import enum_def %} | 8 {%- from "enum_definition.tmpl" import enum_def %} |
9 {% for enum in struct.enums %} | 9 {% for enum in struct.enums %} |
10 {{enum_def("%s.%s"|format(struct.name, enum.name), enum, module)}} | 10 {{enum_def("%s.%s"|format(struct.name, enum.name), enum)}} |
11 {%- endfor %} | 11 {%- endfor %} |
12 | 12 |
13 {#--- Constants #} | 13 {#--- Constants #} |
14 {% for constant in struct.constants %} | 14 {% for constant in struct.constants %} |
15 {{struct.name}}.{{constant.name}} = {{constant.value|expression_to_text}}; | 15 {{struct.name}}.{{constant.name}} = {{constant.value|expression_to_text}}; |
16 {%- endfor %} | 16 {%- endfor %} |
17 | 17 |
18 {#--- initDefaults() #} | 18 {#--- initDefaults() #} |
19 {{struct.name}}.prototype.initDefaults_ = function() { | 19 {{struct.name}}.prototype.initDefaults_ = function() { |
20 {%- for packed_field in struct.packed.packed_fields %} | 20 {%- for packed_field in struct.packed.packed_fields %} |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 {%- else %} | 107 {%- else %} |
108 {%- for packed_field in byte.packed_fields %} | 108 {%- for packed_field in byte.packed_fields %} |
109 encoder.{{packed_field.field.kind|encode_snippet}}val.{{packed_field.field.n
ame}}); | 109 encoder.{{packed_field.field.kind|encode_snippet}}val.{{packed_field.field.n
ame}}); |
110 {%- endfor %} | 110 {%- endfor %} |
111 {%- endif %} | 111 {%- endif %} |
112 {%- if byte.is_padding %} | 112 {%- if byte.is_padding %} |
113 encoder.skip(1); | 113 encoder.skip(1); |
114 {%- endif %} | 114 {%- endif %} |
115 {%- endfor %} | 115 {%- endfor %} |
116 }; | 116 }; |
OLD | NEW |