Changeset 40 for trunk/vbfilter.awk


Ignore:
Timestamp:
10/10/11 00:04:41 (7 months ago)
Author:
sevo
Message:
- added support for nested classes
- updated .NET example
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/vbfilter.awk

    r39 r40  
    11#---------------------------------------------------------------------------- 
    2 # vbfilter.awk - doxygen VB .NET filter script - v2.4 
     2# vbfilter.awk - doxygen VB .NET filter script - v2.4.1 
    33# 
    44# Creation:     26.05.2010  Vsevolod Kukol 
     
    6464        fileHeader=0; 
    6565        fullLine=1; 
    66         insideClass=0; 
     66        classNestCounter=0; 
     67        className[1]=""; 
    6768        insideVB6Class=0; 
    6869        insideVB6ClassName=""; 
    6970        insideVB6Header=0; 
    70         insideSubClass=0; 
    7171        insideNamespace=0; 
    7272        insideComment=0; 
     
    299299                 
    300300                if (isInherited==1){ 
    301                         isInherited=0; 
    302                         if (lastLine!="") print appShift lastLine; 
    303                         print appShift "{" 
    304                         AddShift() 
    305                         lastLine=""; 
     301                        endOfInheritance(); 
    306302                } 
    307303                print appShift "/**" 
     
    725721 
    726722############################################################################# 
     723# Rewrite Subs handling events if csharpStyledOutput=1 
     724############################################################################# 
     725 
     726/.*[[:blank:]]Handles[[:blank:]]+/ && (csharpStyledOutput==1) { 
     727        name=gensub(/(.*)[[:blank:]]+Handles[[:blank:]]+(\w+)/,"\\2","g",$0); 
     728        print appShift "/// \\remark Handles the " name " event."; 
     729        $0=  gensub(/(.*)[[:blank:]]+Handles[[:blank:]]+(.*)/,"\\1","g",$0); 
     730} 
     731                 
     732############################################################################# 
    727733# namespaces 
    728734############################################################################# 
     
    757763        sub("Structure","struct"); 
    758764        sub("Type","struct"); 
    759          
    760         # handle subclasses 
    761         if (insideClass==1) { 
    762                 insideSubClass=1; 
    763         } else { 
    764                 insideClass=1; 
    765         } 
     765        if(isInherited) { 
     766                endOfInheritance(); 
     767        } 
     768        classNestCounter++; 
    766769         
    767770        # save class name for constructor handling 
    768         className=gensub(".+class[[:blank:]]+([^ ]*).*","\\1","g"); 
    769          
     771        className[classNestCounter]=gensub(".+class[[:blank:]]+([^ ]*).*","\\1","g"); 
    770772        isInherited=1; 
    771773        print appShift $0; 
     
    774776 
    775777# handle constructors 
    776 /.*Sub[[:blank:]]+New.*/ && className!="" { 
    777         sub("New", "New " className); 
    778 } 
    779  
     778/.*Sub[[:blank:]]+New.*/ && className[classNestCount]!="" { 
     779        sub("New", "New " className[classNestCount]); 
     780} 
     781 
     782function endOfInheritance() 
     783{ 
     784                isInherited=0; 
     785                if (lastLine!="") print appShift lastLine; 
     786                print appShift "{"; 
     787                AddShift(); 
     788                lastLine=""; 
     789                return 0; 
     790} 
    780791 
    781792# handle inheritance 
     
    797808        } 
    798809        else { 
    799                 isInherited=0; 
    800                 if (lastLine!="") print appShift lastLine; 
    801                 print appShift "{"; 
    802                 AddShift(); 
    803                 lastLine=""; 
     810                endOfInheritance(); 
    804811        } 
    805812} 
     
    809816 /.*End[[:blank:]]+Structure/ || 
    810817 /.*End[[:blank:]]+Type/) && 
    811  (insideClass==1 || insideSubClass==1){ 
    812         if (insideSubClass==1) { 
    813                 insideSubClass=0; 
    814         } else { 
    815                 insideClass=0; 
    816         } 
     818 (classNestCounter >= 1){ 
    817819        ReduceShift(); 
    818820        print appShift "}"; 
    819         className=""; 
     821        delete className[classNestCounter+1]; 
    820822        next; 
    821823} 
Note: See TracChangeset for help on using the changeset viewer.