Wiki

Changes between Version 3 and Version 4 of WxWidgetsPort

Show
Ignore:
Timestamp:
10/29/09 12:47:07 (15 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WxWidgetsPort

    v3 v4  
    1 = Porting wxWidgets wx.NET C# source file to cobra = 
     1= Porting wxWidgets (wx.NET) C# source file to cobra = 
    22 
    33The .NET wrapper library ([http://wxnet.sourceforge.net wx.NET]) for [http://www.wxwidgets.org wxWidgets] is an interesting case for cobra since it is one of the few .NET libraries that 
     
    55Consequently there are some complications with persuading cobra to work with it conveniently. 
    66 
    7 see [wiki:C#Diffs Cobra differences fm C#] 
    8  
    9 Heres a process for C# generally with some notes re wx.NET generated from converting wx.NET sample file [wiki:ListViewCode ListView.cs to ListView.cobra] 
     7see [wiki:C#Diffs Cobra differences from C#] 
     8 
     9Heres a process for C# generally with some notes re wx.NET generated from converting wx.NET sample file ListView.cs.[[br]] 
     10(See !ListView.cs and converted !ListView.cobra attachment files at end of this page.) 
     11 
     12 
    1013 
    11141 Take .cs file, rename to .cobra file. 
    1215 
    1316 
    14 2. Change multiline comments from multiple // or /* */ bounded to be /# #/ bounded.[[br]] 
     172. Change multi-line comments from multiple // or /* */ bounded to be /# #/ bounded.[[br]] 
    1518Change single line comments to use leading '#' 
    1619 
     
    5659}}} 
    5760 
    58 5. Namespace decl 
     616. Namespace decl 
    5962   Namespaces in cobra need to start with an upcased letter. 
    6063   Remove any ''''wx.'''' prefix from namespace line ;  
     
    6265 
    6366 
    64 5a. Correct any Enum definitions. [[br]] 
     677. Correct any Enum definitions. [[br]] 
    6568    After applying the above its basically removing trailing ',' and ensuring indentation 
    6669    of enum items is the same 
     
    9497 
    9598 
    96 6. Fix class declaration syntax 
     998. Fix class declaration syntax 
    97100      Change lines like ''''class X : Y'''' to ''''class X inherits Y''''         
    98101 
    99102 
    100 7. Change any class instance attributes/fields to be prefixed with ''''var'''' 
     1039. Change any class instance attributes/fields to be prefixed with ''''var'''' 
    101104   change type and accessmodifier to cobra forms 
    102105{{{ 
     
    106109}}}            
    107110 
    108 8. Fixup class constructor definitions 
     11110. Fixup class constructor definitions 
    109112      For initializer/constructor change lines like 
    110113        {{{ public ClassName(params,...) : base(baseParams,...) }}} 
     
    131134}}} 
    132135                
    133 9. Remove any uses of ''''new'''' to construct a class instance,  
     13611. Remove any uses of ''''new'''' to construct a class instance,  
    134137    instead just make a call to the class type passing any initializer args, i.e just remove 'new'[[br]] 
    135138    e.g. 
     
    146149 
    147150 
    148 10. Methods: 
     15112. Methods: 
    149152    Prefix methods with '''def'''.[[br]] 
    150153    Change methodnames to start with a lowercase letter, [[br]] 
     
    178181}}} 
    179182             
    180 11. Calls to methods, properties and attributes/fields. 
     18313. Calls to methods, properties and attributes/fields. 
    181184     Instance method names, properties and fields are called with a prefix of ''''this.'''' or just ''''.'''' [[br]] 
    182185     and they all must be named starting with a lowercase letter so these calls and settings[[br]] 
     
    197200    If a method takes no args then any empty trailing () on a method call can/should be left off. 
    198201 
    199 12.  Property definition. Depending on the property use, prefix properties with :[[br]]  
     20214.  Property definition. Depending on the property use, prefix properties with :[[br]]  
    200203        * get - readable property only  
    201204        * set - settable property only 
     
    205208 
    206209 
    207 13. Local variables declared and assigned on first use can usually be changed to remove  
     21015. Local variables declared and assigned on first use can usually be changed to remove  
    208211the type definition (type inferred from the assignment) or can continue to be explicitly typed 
    209212(if that compiles). 
     
    233236 
    234237 
    235 12. Fixup 'For' loops 
     23816. Fixup 'For' loops 
    236239{{{ 
    237240for ( <Type> name = start ; name < stop; ++name )  
     
    250253 
    251254 
    252 13. Casting 
     25517. Casting 
    253256    Casts of form '(Type)name' become 'name to Type' 
    254257    e.g.   
     
    267270}}} 
    268271         
    269 14. String catenated with an expression (converted to string) 
     27218. String catenated with an expression (converted to string) 
    270273    Put the expression (cobra converted) in the string inside [] 
    271274    e.g.  
     
    276279}}} 
    277280              
    278 15. Adding eventHandlers 
     28119. Adding eventHandlers 
    279282    Cobra uses the '''listen''' statement to register event handlers where C# uses an override on  
    280283    the += operator.  !WxWidgets wraps method calls in an !EventHandler delegate class instance.[[br]] 
     
    323326    }}} 
    324327 
    325 16. Main method 
     32820. Main method 
    326329    'public void' is default, static is an accessmodifier which becomes ''''shared'''' in cobra, 
    327330    C# attributes (!MetaInformation) are denoted with ''''has'''' 
     
    336339    }}}     
    337340 
    338 17. Lowercased namespace names (as in wx.NET) used to disambiguate or otherwise explicitly [[br]] 
     34121. Lowercased namespace names (as in wx.NET) used to disambiguate or otherwise explicitly [[br]] 
    339342    specify the namespace on types (inherits ..., as ....) as opposed to methods or constants [[br]] 
    340343    can (may/will) generate compile errors of the form: [[br]] 
     
    367370  Eventually it would be preferable if cobra became a little more flexible in these cases..  
    368371 
     372----- 
    369373 
    370374Other weirdnesses: