!S3Main-CallYourApps.f95  Group ID:      #19 = "-unlisted.f95"
!2025.05.24.1840cdt- Branches execution via the keyboard function keys

!            Author- Jeffrey M. Setterholm, Lakeville,MN 55044 USA
!         IP Status- Free source code (e.g.: post copyright)
!
!          Computer- "T3"/Dell Precision T3500/Intel i5 E5520/Win10Pro-21H2
!                     ^name ^Mfgr.Id           ^chipset       ^OS 
!                    /Absoft Pro Fortran 21.0.2/GeForce GTX 1050/f90gl~Glut3.7
!                     ^compiler ~Fortran 95     ^graphics card   ^graphics

!    f90gl bindings- public domain; see "https://math.nist.gov/f90gl/"

!Disclaimer:
! ***************************************************************
! **********   Individual cognition is always flawed,  **********
! **********         including yours and mine.         **********
! **********                 - So: -                   **********
! **********       Use this code at your own risk.     **********
! ***************************************************************

!Table of Contents: ...use to search...
! Subroutine CallYourApps         !Group#19
! Subroutine ImportYourNml        !This is called by S3Main; reads "Sn3D.nml"
!---------------------------------------------------------------------------7-9

Subroutine CallYourApps                          !Group#19 = "-unlisted.f95"
!2025.04.18.0835cdt JMS- A generic interface to NameList datafiles.
!--Globals                                                         S1ModDef.f95
!S1ModDef.f95 variables:
 use AppsDef   ,only: AppNumber !User Apps F1-F8
 use ioDef     ,only: Up
 use ViewDef   ,only: ThreePhase
 use S2Callback,only: CheckGL

!use RubikDef  ,only: RubSizeOverride

!S0-Rubik-ModDef.f95 variables:
!Use RubikDef,    only: RubSizeBaseline
 
 
!--End Globals
 implicit none
  integer(4)::AppNumberL,Init=0,nTry
 !--Arguments
 !--Internals
  !--EndDefs-----------------------------------------------
  !--                                                                ! end defs
   if((AppNumber==1).and.(ThreePhase==2)) then
!    call BreakHere(Up)    !////////////// Example debug  Breakpoint use. /////
   endif!(AppNumber=1 & ThreePhase=2)
   
   
  !Using the function keys within the simulation environment:
20 continue
                                                          call CheckGL(-190058)
   select case(AppNumber)
    case( 1); call S11AppF1     !Function key - F1 accessed within OpenGL
    case( 2); call S12AppF2     !             - F2 Dodecahedron visualization
!   case( 3); call S13AppF3     !             - F3
!   case( 4); call S14TppF4     !             - F4
!   case( 5); call S15AppF5     !             - F5
!   case( 6); call S16AppF6     !             - F6
!   case( 7); call S17AppF7     !             - F7
    case( 8); call PixelDraw    !             - F8 shows screen color choices
   end select!(S.AppNumber)
                                                          call CheckGL(+190071)
                                                                         return
End Subroutine CallYourApps
!---------------------------------------------------------------------------7 9
Subroutine ImportYourNml
!2025.04.18.0835cdt JMS- Reading/importing "Sn3D.nml"
!--Globals
!S1ModDef.f95 variables:
 use TaskDef, only: ExeBanner,ExeName,ExeVersion                &
                   ,Analyst,Phone,Street,CityStateZip,IPSummary
 use ioDef   ,only: &   !Files,Units,TimeStamp,Selfies,Flags
                    ExeFileIn,ExeFileOut,EnvNml,EnvIni,LExists  &
                   ,UserIni,UserNml,Ur,Us,uT,Uread,DaTimeLabel  &
                   ,Pi16,ModePi,IterPi

 use ViewDef ,only:FrustNom,UnitCube0
!--End Globals
 implicit none
 !--Arguments
  integer(4)::iP      !Write enable>5: write(iP,...)
 !--Internals
  integer(4)::i
  NAMELIST / Sn3Dnml /  ExeFileIn   , ExeFileOut              &
                       ,UserIni     , UserNml                 &
                       ,ExeBanner   , ExeName   , ExeVersion  &
                       ,Analyst     , Phone     , Street      &
                       ,CityStateZip,IPSummary                &
                       ,Ut,FrustNom ,UnitCube0                &
                       ,Pi16        ,ModePi     ,IterPi
   !--EndDefs-----------------------------------------------
!  Modifying key variables at runtime using NameList file `Sn3D.nml`:
!  Initial defaults are set here:
   Ut         = 13                  !Output unit#: Set to 6 or 13
   EnvNml     = '.\Sn3D.nml'        !default~ hard-coded here  
   ExeFileOut = '.\Sn3D-Out.txt'    !       -can be overwritten 
!! ActNml     = ActReset

  !Sn.nml variables listing: S1ModDef.f95 @L119.
   write(Us,"('ImportYourNml(): reading ',:,79a1)") &
                               (EnvNml(i:i),i=1,len_trim(EnvNml))
   inquire(file=EnvNml,exist=LExists)
   if(LExists)then
     open( unit=Ur, file=EnvNml        , action='read'    &
                  , access='sequential', status='old' ,err=9)
       read(Ur,nml=Sn3Dnml,err=8)        !<--Defined above
     close(Ur)                                                         ;goto 10
8    pause "Error reading `&Sn3Dnml`. Press enter to continue."
     close(Ur)                                                         ;goto 10
9    pause"Error trying to open your `Sn3D.nml` file. Press enter to continue."
     close(Ur)
    else
     write(Us,*) "Didn't find `Sn3D.nml`."
   endif!LExists
10 continue
   UnitCube0 = FrustNom
   write(Us,"(/'ImportYourNml() - done. ',10('|'))")

                                                                         return
End Subroutine ImportYourNml
!---------------------------------------------------------------------------7 9

