!> @file gtvargetxtype.f90
!>
!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
!>            License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
!>
!> @en
!> @brief Get external type representation
!>
!> Returns a string representing the type for systems with external
!> type representation, or empty string for other systems.
!> @enden
!>
!> @ja
!> @brief 外部型表現の取得
!>
!> 外部型表現が存在する処理系に関しては型を示す文字列を、
!> そうでない処理系に関しては空文字列を返す。
!> @endja
!>

!>
!> @en
!> @brief Get variable external type
!> @param[in]  var   Variable handle
!> @param[out] xtype External type representation string
!> @enden
!>
!> @ja
!> @brief 変数の外部型を取得
!> @param[in]  var   変数ハンドル
!> @param[out] xtype 外部型表現文字列
!> @endja
!>
subroutine GTVarGetXtype(var, xtype)
    use gtdata_types, only: GT_VARIABLE
    use dc_string, only: VSTRING
    use gtdata_generic, only: get_attr
    implicit none
    type(GT_VARIABLE), intent(in):: var
    type(VSTRING), intent(out):: xtype
    call get_attr(var, "__xtype__", xtype, default="")
end subroutine
