Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/types.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55#
    6 #   Copyright (C) 2008-2015 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#-- 
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    629629
    630630class FloatType < Type
    631 #  @bit_size::         32, 64, (80), -32, -64
     631#  @bit_size::         32, 64, (80), -32, -64, -128
    632632
    633633  def initialize( bit_size )
     
    684684    when -64
    685685      str = "#{str}double"
     686    when -128
     687      str = "#{str}long double"
    686688    end
    687689    return str
     
    734736#  @b_has_sized_pointer_member:: bool : メンバにポインタ型がある
    735737#  @b_has_unsized_string_member:: bool : メンバにポインタ型がある
     738#  @b_hasTag:: bool : タグがある
    736739#  @member_types_symbol:: Symbol : tag が無い時のみ設定 (それ以外では nil)
    737740
     
    746749    super()
    747750    @tag = tag
     751    if tag then
     752      @b_hasTag = true
     753    else
     754      @b_hasTag = false
     755    end
    748756    @@structtype_current_sp += 1
    749757    @@structtype_current_stack[@@structtype_current_sp] = self
     
    918926    str = super
    919927
    920     if @tag then
     928    if @b_hasTag then
    921929      # typedef struct tag StructType; の形式の場合
    922930      # struct の本体は、別に生成される
    923       return "#{str}struct #{@tag} "
     931      return "#{str}struct #{@tag}"
    924932
    925933    else
    926934      # typedef struct { int a; } StructType; の形式の場合
    927       str += "struct {\n"
     935      str += "struct {"
    928936      @members_decl.get_items.each{ |i|
    929         str += sprintf( "    %-8s %s%s;\n", "#{i.get_type.get_type_str}", "#{i.get_name}", "#{i.get_type.get_type_str_post}" )
     937        str += sprintf( "%s %s%s;", "#{i.get_type.get_type_str}", "#{i.get_name}", "#{i.get_type.get_type_str_post}" )
    930938      }
    931939      str += "} "
     
    12671275  def check_init( locale, ident, initializer, kind, attribute = nil )
    12681276    if ( initializer.instance_of?( Array ) ) then
     1277      # 要素数が指定されている場合、初期化要素数をチェック
     1278      if @subscript then
     1279        n_sub = @subscript.eval_const( nil )
     1280        if n_sub then
     1281          if initializer.length > n_sub then
     1282            cdl_error2( locale, "T9999 $1: too many initializer, $2 for $3" , ident, initializer.length, n_sub )
     1283          end
     1284        end
     1285      end
    12691286      index = 0
    12701287      initializer.each{ |i|
     
    15431560# 動的結合で渡すデスクリプタ型
    15441561class DescriptorType < Type
    1545 # @sinagure_nsp::NamespacePath
     1562  # @sinagure_nsp::NamespacePath
     1563
     1564  @@descriptors = {}
    15461565
    15471566  def initialize( signature_nsp )
    15481567    @signature_nsp = signature_nsp
    1549     obj = Namespace.find signature_nsp
    1550     if ! obj.kind_of? Signature then
    1551       cdl_error( "T9999 '$1': not signature or not found", signature_nsp.to_s )
    1552     else
    1553       if obj.has_descriptor? then
    1554         cdl_error( "T9999 '$1': has Desicrptor in function parameter", signature_nsp.to_s )
    1555       end
    1556     end
     1568    # check_signature ##
     1569    @@descriptors[ self ] = false
    15571570  end
    15581571
    15591572  def get_type_str
    1560     "Descriptor( #{@signature_nsp.to_s} )"
     1573    "Descriptor( #{@signature_nsp.get_global_name} )"
    15611574  end
    15621575
     
    15811594  end
    15821595
     1596  def self.check_signature
     1597    @@descriptors.each{ |desc, val|
     1598      if val != true then
     1599        desc.check_signature
     1600        @@descriptors[ desc ] = true
     1601      end
     1602    }
     1603  end
     1604 
     1605  def check_signature
     1606    # p "Desc #{@signature_nsp.to_s}"
     1607    obj = Namespace.find @signature_nsp
     1608    if ! obj.kind_of? Signature then
     1609      cdl_error( "T9999 '$1': not signature or not found", @signature_nsp.to_s )
     1610    else
     1611      if obj.has_descriptor? then
     1612       # cdl_error( "T9999 '$1': has Descriptor in function parameter", @signature_nsp.to_s )
     1613      end
     1614      # @signature_nsp = obj.get_namespace_path
     1615    end
     1616  end
     1617
    15831618  #== DescriptorType#
    1584   # 意味解析段階では nil が返される可能性に注意
    15851619  def get_signature
    15861620    Namespace.find @signature_nsp
Note: See TracChangeset for help on using the changeset viewer.