| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2009, Google Inc. | 2 # Copyright 2009, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 | |
| 32 """o3d binding model module. | 31 """o3d binding model module. |
| 33 | 32 |
| 34 This module implements the glue functions for the o3d binding model, binding | 33 This module implements the glue functions for the o3d binding model, binding |
| 35 O3D objects. | 34 O3D objects. |
| 36 | 35 |
| 37 In C++, objects using this binding model are passed and returned by pointer. | 36 In C++, objects using this binding model are passed and returned by pointer. |
| 38 For example | 37 For example |
| 39 void SetValue(Class *value); | 38 void SetValue(Class *value); |
| 40 Class *GetValue(); | 39 Class *GetValue(); |
| 41 | 40 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 field being retrieved. | 292 field being retrieved. |
| 294 field: a string, the name of the field to be retrieved. | 293 field: a string, the name of the field to be retrieved. |
| 295 | 294 |
| 296 Returns: | 295 Returns: |
| 297 a string, which is the expression for getting the field. | 296 a string, which is the expression for getting the field. |
| 298 """ | 297 """ |
| 299 return '%s::%s()' % (cpp_utils.GetScopedName(scope, type_defn), | 298 return '%s::%s()' % (cpp_utils.GetScopedName(scope, type_defn), |
| 300 cpp_utils.GetGetterName(field)) | 299 cpp_utils.GetGetterName(field)) |
| 301 | 300 |
| 302 | 301 |
| 302 def JSDocTypeString(type_defn): |
| 303 """Gets the representation of a type in JSDoc notation. |
| 304 |
| 305 Args: |
| 306 type_defn: a Definition for the type. |
| 307 |
| 308 Returns: |
| 309 a string that is the JSDoc notation of type_defn. |
| 310 """ |
| 311 type_defn = type_defn.GetFinalType() |
| 312 type_stack = type_defn.GetParentScopeStack() |
| 313 name = type_defn.name |
| 314 return '!' + '.'.join([s.name for s in type_stack[1:]] + [name]) |
| 315 |
| 316 |
| 303 _binding_glue_header_template = string.Template('') | 317 _binding_glue_header_template = string.Template('') |
| 304 | 318 |
| 305 | 319 |
| 306 def NpapiBindingGlueHeader(scope, type_defn): | 320 def NpapiBindingGlueHeader(scope, type_defn): |
| 307 """Gets the NPAPI glue header for a given type. | 321 """Gets the NPAPI glue header for a given type. |
| 308 | 322 |
| 309 Args: | 323 Args: |
| 310 scope: a Definition for the scope in which the glue will be written. | 324 scope: a Definition for the scope in which the glue will be written. |
| 311 type_defn: a Definition, representing the type. | 325 type_defn: a Definition, representing the type. |
| 312 | 326 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 output=output, | 527 output=output, |
| 514 result=success) | 528 result=success) |
| 515 return phase_1_text, phase_2_text | 529 return phase_1_text, phase_2_text |
| 516 | 530 |
| 517 | 531 |
| 518 def main(): | 532 def main(): |
| 519 pass | 533 pass |
| 520 | 534 |
| 521 if __name__ == '__main__': | 535 if __name__ == '__main__': |
| 522 main() | 536 main() |
| OLD | NEW |