module Declaration_Types

  ! Define the types of declaration table objects

  implicit NONE
  public

  enum, bind(C) ! Nothing to do with C, but this is the required syntax
    enumerator :: Empty           ! Required. Not one of the others. Used
                                  ! for the default initializer for the
                                  ! Type component of type Decls.

    enumerator :: Label           ! Symbol appears as a label
    enumerator :: Spec            ! Symbol is a spec name
    enumerator :: Field           ! Symbol is a field name
  end enum

  integer, parameter :: Last_Type = Field

  ! Strings need to be in the same order as type names
  character(len=*), parameter :: Type_Names(empty:last_type) = &
    [ 'Empty', &
    & 'Label', &
    & 'Spec ', &
    & 'Field'  ]

  ! Value field of declaration table
  enum, bind(C) ! Nothing to do with C, but that's the required syntax
    ! Indices of spec names. S_ prefix means "spec name"
    enumerator :: S_Block = 1 ! Logic block
    enumerator :: S_Comment   ! At the bottom of the page
    enumerator :: S_Dot       ! "Dot" wired-or or wired-nand
    enumerator :: S_EC        ! Engineering change order
    enumerator :: S_Edge      ! Edge connector
    enumerator :: S_Input     ! Input signal
    enumerator :: S_Line      ! Circuit trace
    enumerator :: S_Multi     ! Multi-card circuit
    enumerator :: S_Output    ! Output signal
    enumerator :: S_Page      ! About the logic page
    ! Indices of field names. F_ prefix means "field name"
    enumerator :: F_At        ! Position of Dot [2-12 even].[1-6].[A-J^I].[1-18]
    enumerator :: F_Block     ! 01-99 of circuit card
                              ! Of multi-card circuit
    enumerator :: F_Cap       ! AA-ZZ
    enumerator :: F_Card      ! AA-ZZ
    enumerator :: F_Chassis   ! 1-4 (not used for Modular I)
    enumerator :: F_Column    ! A-F
    enumerator :: F_Date      ! Of engineering change
    enumerator :: F_EC        ! Engineering change level [A-Z]
    enumerator :: F_Edge      ! Edge connector xxxxxxxx{.[A-Z0-9]{[A-Z0-9]}}
    enumerator :: F_Frame     ! 01-99
    enumerator :: F_From      ! Origin of line
    enumerator :: F_Func      ! Functional module, e.g. BA for basic circuits
    enumerator :: F_Gate      ! 1-8 (not use dfor Modular II)
    enumerator :: F_Level     ! Level, [+-][NPRSTUMWXYZV] Fig 13 page 15
    enumerator :: F_Logic     ! Logic number nn.nn.nn.n
    enumerator :: F_Machine   ! Machine type
    enumerator :: F_Mode      ! NPRSTUMWXYZV Fig 13 page 15.
    enumerator :: F_Module    ! [AB]
    enumerator :: F_Number    ! Drawing number
                              ! Of engineering change
    enumerator :: F_Row       ! Row of input or output [A-J^I][0-6]
                              ! Row of logic card 01-26
    enumerator :: F_Show      ! Show unconnect logic block pin
    enumerator :: F_Symbol    ! Logic type
    enumerator :: F_Tag       ! Engineering change tag [A-Z]
    enumerator :: F_Text      ! For an input or output signal
    enumerator :: F_Title     ! Drawing title
    enumerator :: F_To        ! Destination of line
  end enum

  integer, parameter :: First_Value = S_Block, Last_Spec=S_Page, Last_Value=F_To
  character(*), parameter :: Value_Names(first_value:last_value) = [ &
  ! Spec names
    'Block  ', &
    'Comment', &
    'Dot    ', &
    'EC     ', &
    'Edge   ', &
    'Input  ', &
    'Line   ', &
    'Multi  ', &
    'Output ', &
    'Page   ', &
  ! Field names
    'At     ', &
    'Block  ', &
    'Cap    ', &
    'Card   ', &
    'Chassis', &
    'Column ', &
    'Date   ', &
    'EC     ', &
    'Edge   ', &
    'Frame  ', &
    'From   ', &
    'Func   ', &
    'Gate   ', &
    'Level  ', &
    'Logic  ', &
    'Machine', &
    'Mode   ', &
    'Module ', &
    'Number ', &
    'Row    ', &
    'Show   ', &
    'Symbol ', &
    'Tag    ', &
    'Text   ', &
    'Title  ', &
    'To     ' ]

  ! Maximum field widths for identifiers or strings
  integer, parameter :: Field_Widths(last_spec+1:last_value) = [ &
    & 99, & ! At
    &  2, & ! Block
    &  2, & ! Cap
    &  2, & ! Card
    &  2, & ! Chassis
    &  1, & ! Column
    &  8, & ! Date
    &  1, & ! EC
    &  8, & ! Edge
    &  2, & ! Frame
    & 99, & ! From
    &  4, & ! Func
    &  1, & ! Gate
    &  1, & ! Level
    & 99, & ! Logic
    &  4, & ! Machine
    &  2, & ! Mode
    &  2, & ! Module
    &  6, & ! Number
    &  2, & ! Row
    &  2, & ! Show
    &  4, & ! Symbol
    &  1, & ! Tag
    & 40, & ! Title
    & 41, & ! Text
    & 99  ] ! To
  ! <dot value value...> in fields. 0 => Yes of no, 1 => Requred, 2 => Prohibited
  integer, parameter :: Field_Dot(last_spec+1:last_value) = [ &
    & 1, & ! At
    & 2, & ! Block
    & 2, & ! Cap
    & 2, & ! Card
    & 2, & ! Chassis
    & 2, & ! Column
    & 2, & ! Date
    & 2, & ! EC
    & 0, & ! Edge
    & 2, & ! Frame
    & 0, & ! From
    & 2, & ! Func
    & 2, & ! Gate
    & 2, & ! Level
    & 1, & ! Logic
    & 2, & ! Machine
    & 0, & ! Mode
    & 2, & ! Module
    & 0, & ! Number
    & 2, & ! Row
    & 1, & ! Show
    & 2, & ! Symbol
    & 2, & ! Tag
    & 0, & ! Title
    & 0, & ! Text
    & 0  ] ! To

!---------------------------- RCS Module Info ------------------------------
  character (len=*), private, parameter :: ModuleName= &
       "$RCSfile: Declaration_Types.f90,v $"
  private :: not_used_here 
!---------------------------------------------------------------------------

contains

!--------------------------- end bloc --------------------------------------
  logical function not_used_here()
  character (len=*), parameter :: IdParm = &
       "$Id: Declaration_Types.f90,v 1.1 2022/01/24 21:58:15 vsnyder Exp $"
  character (len=len(idParm)) :: Id = idParm
    not_used_here = (id(1:1) == ModuleName(1:1))
    print *, Id ! .mod files sometimes change if PRINT is added
  end function not_used_here
!---------------------------------------------------------------------------

end module Declaration_Types

! $Log: Declaration_Types.f90,v $
! Revision 1.1  2022/01/24 21:58:15  vsnyder
! Initial commit
!
