Changeset d62f422 in sasview for sansmodels/src/python_wrapper


Ignore:
Timestamp:
Jan 4, 2012 5:36:38 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
dbddbf5
Parents:
ef93acb
Message:

updated WrapperGenerator? to deal with both pre- and post-refactor models.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/python_wrapper/WrapperGenerator.py

    ra1d1b90 rd62f422  
    6969        self.inStruct = False 
    7070        self.foundCPP = False 
     71        self.inParDefs = False 
    7172        ## Name of struct for the c object 
    7273        self.structName = None 
     
    213214            if line.count("class")>0: 
    214215                # We are entering a class definition 
    215                 self.inStruct = True 
     216                self.inParDefs = True 
    216217                self.foundCPP = True 
    217                 class_name = line.replace('}','') 
    218                 class_name = class_name.replace('class','') 
    219                 self.inStruct = class_name.strip() 
    220              
    221             if self.inStruct and line.count("}")>0: 
    222                 # We are exiting a struct block 
    223                 self.inStruct = False 
    224218                 
    225219            # Old-Style C struct definition 
    226220            if line.count("typedef struct")>0: 
    227221                # We are entering a struct block 
     222                self.inParDefs = True 
    228223                self.inStruct = True 
    229224             
    230             if self.inStruct and line.count("}")>0: 
     225            if self.inParDefs and line.count("}")>0: 
    231226                # We are exiting a struct block 
    232                 self.inStruct = False 
    233      
    234                 # Catch the name of the struct 
    235                 index = line.index("}") 
    236                 #toks = string.split(line[index+1:],";") 
    237                 toks = line[index+1:].split(";") 
    238                 # Catch pointer definition 
    239                 #toks2 = string.split(toks[0],',') 
    240                 toks2 = toks[0].split(',') 
    241                 self.structName = toks2[0].lstrip().rstrip() 
    242             
    243                  
     227                self.inParDefs = False 
     228                 
     229                if self.inStruct: 
     230                    self.inStruct = False 
     231                    # Catch the name of the struct 
     232                    index = line.index("}") 
     233                    toks = line[index+1:].split(";") 
     234                    # Catch pointer definition 
     235                    toks2 = toks[0].split(',') 
     236                    self.structName = toks2[0].lstrip().rstrip() 
    244237            
    245238            # Catch struct content 
    246239            key = "[DEFAULT]" 
    247             if self.inStruct and line.count(key)>0: 
     240            if self.inParDefs and line.count(key)>0: 
    248241                # Found a new parameter 
    249242                try: 
Note: See TracChangeset for help on using the changeset viewer.