parameters: (properties)
return_statement: return result
docstring: Given a set of properties, add default values for features not
          represented in the set. 
          Note: if there's there's ordinary feature F1 and composite feature
          F2, which includes some value for F1, and both feature have default values,
          then the default value of F1 will be added, not the value in F2. This might
          not be right idea: consider
          
            feature variant : debug ... ;
                 <variant>debug : .... <runtime-debugging>on
            feature <runtime-debugging> : off on ;
            
            Here, when adding default for an empty property set, we'll get
          
              <variant>debug <runtime_debugging>off
           
            and that's kind of strange.
docstring_summary: Given a set of properties, add default values for features not
          represented in the set. 
          Note: if there's there's ordinary feature F1 and composite feature
          F2, which includes some value for F1, and both feature have default values,
          then the default value of F1 will be added, not the value in F2. This might
          not be right idea: consider
          
            feature variant : debug ... ;
                 <variant>debug : .... <runtime-debugging>on
            feature <runtime-debugging> : off on ;
            
            Here, when adding default for an empty property set, we'll get
          
              <variant>debug <runtime_debugging>off
           
            and that's kind of strange.
docstring_tokens: Given a set of properties add default values for features not represented in the set . Note : if there s there s ordinary feature F1 and composite feature F2 which includes some value for F1 and both feature have default values then the default value of F1 will be added not the value in F2 . This might not be right idea : consider feature variant : debug ... ; <variant > debug : .... <runtime - debugging > on feature <runtime - debugging > : off on ; Here when adding default for an empty property set we ll get <variant > debug <runtime_debugging > off and that s kind of strange .
function: def add_defaults (properties):
      """ Given a set of properties, add default values for features not
          represented in the set. 
          Note: if there's there's ordinary feature F1 and composite feature
          F2, which includes some value for F1, and both feature have default values,
          then the default value of F1 will be added, not the value in F2. This might
          not be right idea: consider
          
            feature variant : debug ... ;
                 <variant>debug : .... <runtime-debugging>on
            feature <runtime-debugging> : off on ;
            
            Here, when adding default for an empty property set, we'll get
          
              <variant>debug <runtime_debugging>off
           
            and that's kind of strange.        
      """
      result = [x for x in properties]
      
      handled_features = set()
      for p in properties:
          # We don't add default for conditional properties.  We don't want
          # <variant>debug:<define>DEBUG to be takes as specified value for <variant>
          if not p.condition():
              handled_features.add(p.feature())
          
      missing_top = [f for f in __all_top_features if not f in handled_features]    
      more = defaults(missing_top)
      result.extend(more)
      for p in more:
          handled_features.add(p.feature())
         
      # Add defaults for subfeatures of features which are present
      for p in result[:]:
          s = p.feature().subfeatures()
          more = defaults([s for s in p.feature().subfeatures() if not s in handled_features])
          for p in more:
              handled_features.add(p.feature())
          result.extend(more)
      
      return result
function_tokens: def add_defaults ( properties ) : result = [ x for x in properties ] handled_features = set ( ) for p in properties : # We don't add default for conditional properties.  We don't want # <variant>debug:<define>DEBUG to be takes as specified value for <variant> if not p . condition ( ) : handled_features . add ( p . feature ( ) ) missing_top = [ f for f in __all_top_features if not f in handled_features ] more = defaults ( missing_top ) result . extend ( more ) for p in more : handled_features . add ( p . feature ( ) ) # Add defaults for subfeatures of features which are present for p in result [ : ] : s = p . feature ( ) . subfeatures ( ) more = defaults ( [ s for s in p . feature ( ) . subfeatures ( ) if not s in handled_features ] ) for p in more : handled_features . add ( p . feature ( ) ) result . extend ( more ) return result