! adds.def [101] - definitions related to Ashell Dynamic Data Sources
!------------------------------------------------------------------------
!EDIT HISTORY
! [101] 13-Dec-19 / jdm / change T_ADDS_FILEOPTIONS from S,50 to B,4
! [100] 24-Sep-18 / jdm / created
!------------------------------------------------------------------------
!NOTES
!   A-Shell 6.5.1647.1, Compiler 882
!------------------------------------------------------------------------

++ifndef T_ADDSCFG_COMMON

++include'once ashinc:types.def
++include'once ashinc:dynstruct.def

deftype T_ADDS_FILEOPTIONS = b,4        ! [101] was s,50  (now use FDVF_xxx - see addsfdv.def)
deftype T_ADDS_FILEDRIVER  = s,16
deftype T_ADDS_FILETYPE    = s,20

defstruct ST_ADDSCFG_COMMON        ! ADDSCFG [Common] (defaults)
    map2 loaded,T_BOOLEAN          ! set when defaults loaded
    map2 filebase,b,1
    map2 fileoptions,T_ADDS_FILEOPTIONS
    map2 structfile,T_NATIVEPATH
    map2 filedir,T_NATIVEPATH
    map2 filedriver,T_ADDS_FILEDRIVER
    map2 hooklogfil,T_NATIVEPATH
    map2 formatter,T_FN_NAME
endstruct

!>!FileId=####
!>!;StructName=<DEFSTRUCT name>
!>!;StructFile=<file containing the DEFSTRUCT>
!>!;ControlStructName=<DEFSTRUCT name for control rec>
!>!;InUseField=<member of control struct specifying # recs in use>
!>!;FileBase=<0 or 1, defaulting to [Common] FileBase
!>!;FileDir=<data file dir>
!>!;FileType=<one of: block, span, isam, isama, csv, seq>
!>!;FileOptions=<string interpreted by the file driver>
!>!;FileDriver=<prefix for FileDriver functions, defaults to FileType>

defstruct ST_ADDSCFG              ! ADDSCFG.INI [name.ext] section (one file)
    map2 fileid,b,2
    map2 structname,T_DYN_NAME       
    map2 controlstructname,T_DYN_NAME
    MAP2 structfile,T_NATIVEPATH
    map2 inusefield,T_DYN_NAME
    map2 filebase,b,1
    map2 filedir,T_NATIVEPATH
    map2 filetype,T_ADDS_FILETYPE
    map2 fileoptions,T_ADDS_FILEOPTIONS
    map2 filedriver,T_ADDS_FILEDRIVER
    map2 hooklogfil,T_NATIVEPATH
    map2 keyfield,T_DYN_NAME
    map2 formatter,T_FN_NAME
endstruct


! higher-level / display-oriented version of ST_FLDDEF (from dynstruct.def)
! an array of these would represent a print line or perhaps an XTREE row
defstruct ST_DSPFLDDEF              ! 
    map2 flddefidx,b,2              ! physical field # (index into ST_FLDDEF array)
    map2 dwidth,b,2                 ! display width
    map2 fnfmt, T_FN_NAME           ! field formatting function
    map2 sub(MAX_ARY_DIMS),b,4      ! specific element (up to 4 dimensions) to print
endstruct

++endif
