четверг, 7 апреля 2016 г.

#1219. Скрипты. Продолжаем тему

INTERFACE FUNCTION MakeConstants:
  STRING IN aName
  ^ IN aLambda
 aName nil MakeParam: ( 
   IN aMade
  aMade -> Stereotype := st_Constants
  aMade aLambda DO
 )
 >>> Result 
; // MakeConstants:
  
INTERFACE FUNCTION MakeConstant:
  STRING IN aName
  PRINTABLE IN aValue
  ^ IN aLambda
 aName nil MakeParam: ( 
   IN aMade
  aMade -> Class := class_Attribute
  aMade -> 'extprop:pas:Value' := aValue
  aMade aLambda DO
 )
 >>> Result 
; // MakeConstant:

elem_iterator ConstantsEx
 Cached:
 (
  Self .Constants
  
  RULES
   ( Self .IsTypedef )
    begin
     VAR l_OtherEnum
     Self .MainAncestor >>> l_OtherEnum
     RULES
      ( l_OtherEnum .IsEnum )
       RULES
        ( Self .Name l_OtherEnum .Name == )
         RULES
          ( l_OtherEnum .Attributes .CountIt > 0 )
           begin
            VAR l_ConstantsName
            [ Self .Name '_' l_OtherEnum .Name '_' 'Constants' ] strings:Cat >>> l_ConstantsName
            .join>
            [
             l_ConstantsName MakeConstants: (
               IN aConstants
              aConstants -> %SUM := ( [ 'Алиасы для значений ' l_OtherEnum .Parent .Name '.' l_OtherEnum .Name ] strings:Cat )
              aConstants -> Visibility := PublicAccess
              aConstants -> Attributes := [
               l_OtherEnum .Attributes .for> (
                 IN anItem
                anItem .Name 
                [ l_OtherEnum .EffectiveUnitName '.' anItem .Name ] strings:Cat 
                MakeConstant: (
                  IN aConstant
                 RULES
                  ( anItem .Documentation IsNil ! )
                   ( aConstant -> %SUM := ( anItem .Documentation ) )
                 ; // RULES 
                ) // MakeConstant:
               ) // l_OtherEnum .Attributes .for>
              ] // aConstants -> Attributes
             ) // MakeConstants:
            ] // .join>
           end // ( l_OtherEnum .Attributes .CountIt > 0 )
         ; // RULES
       ; // RULES
     ; // RULES
    end // ( Self .IsTypedef )
  ; // RULES
 )
 >>> Result
; // ConstantsEx

К коду нужны комментарии?

Комментариев нет:

Отправить комментарий