Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparation of OS specified files
#1
Hi,

Under Sources\Specifics, there are files for Windows and Linux system.

Here is a script to compare them. Put the script under Sources\Specifics folder and run cpSrc.bat, the difference will saved in a cpDiff.txt file.

For GET_INI_FILNAM.f90, the difference is:

Code:
InputObject                                                                                                           
-----------                                                                                                           
! ##################################################################################################################...
! Gets name (incl path) of the MYSTRAN.INI initialization file. This is the Linux version which uses '/' as a folder...
         INIFIL(MYSTRAN_DIR_LEN+1:MYSTRAN_DIR_LEN+2)  = '/'                                                           
                                                                                                                      
! Gets name (incl path) of the MYSTRAN.INI initialization file. This is the Windows version which uses '\' as a fold...
         INIFIL(MYSTRAN_DIR_LEN+1:MYSTRAN_DIR_LEN+2)  = '\'           
There should be a way to work for both OSes, '\\' ?


For GET_MYSTRAN_DIR.f90, the difference is:

Code:
InputObject                                                                                                           
-----------                                                                                                           
! ##################################################################################################################...
      CHARACTER(FILE_NAM_MAXLEN*BYTE), INTENT(OUT) :: MYSTRAN_DIR       ! Directory where program executable (and IN...
      INTRINSIC                                    :: GET_ENVIRONMENT_VARIABLE                                        
      CALL GET_ENVIRONMENT_VARIABLE ( 'MYSTRAN_directory', MYSTRAN_DIR, MYSTRAN_DIR_LEN  )                            
! Gets the environment variable MYSTRAN_DIR that tells Windows where the MYSTRAN executable is located. The user mus...
! environment variable on their computer                                                                              
      CHARACTER(FILE_NAM_MAXLEN*BYTE), INTENT(OUT) :: MYSTRAN_DIR       ! Directory where executable (and INI file) ...
      INTRINSIC                                    :: GETENV                                                          
      CALL GETENV ( 'MYSTRAN_directory', MYSTRAN_DIR )                                                                
      MYSTRAN_DIR_LEN = FILE_NAM_MAXLEN                                                                               
      DO I=FILE_NAM_MAXLEN,1,-1                                                                                       
         IF (MYSTRAN_DIR(I:I) /= ' ') THEN                                                                            
            EXIT                                                                                                      
         ELSE                                                                                                         
            MYSTRAN_DIR_LEN = MYSTRAN_DIR_LEN - 1                                                                     
            CYCLE                                                                                                     
         ENDIF                                                                                                        
      ENDDO                 

I think GET_ENVIRONMENT_VARIABLE (Fortran 2003 and later) and GETENV (backwards compatibility with GNU Fortran 77) could use one to work for both OSes. In new code, programmers should consider the use of the GET_ENVIRONMENT_VARIABLE.

For READ_CL.f90,  the difference is:

Code:
InputObject                                                                                                           
-----------                                                                                                           
! Begin MIT license text.                                                                                             
! _______________________________________________________________________________________________________             
! Copyright 2019 Dr William R Case, Jr (dbcase29@gmail.com)                                                           
! Permission is hereby granted, free of charge, to any person obtaining a copy of this software and                   
! associated documentation files (the "Software"), to deal in the Software without restriction, including             
! without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell             
! copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to                
! the following conditions:                                                                                           
! The above copyright notice and this permission notice shall be included in all copies or substantial                
! portions of the Software and documentation.                                                                         
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS                                             
! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,                                         
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE                                         
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER                                              
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,                                       
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN                                           
! THE SOFTWARE.                                                                                                       
! _______________________________________________________________________________________________________             
! End MIT license text.                                                                                               
! ##################################################################################################################...
All are comments. So there should be no difference for this file.


Attached Files
.zip   cpSrc.zip (Size: 544 bytes / Downloads: 2)
Reply


Messages In This Thread
Comparation of OS specified files - by ceanwang - 08-31-2020, 02:57 AM
RE: Comparation of OS specified files - by Admin - 08-31-2020, 03:27 AM
RE: Comparation of OS specified files - by borges - 08-31-2020, 07:43 PM
RE: Comparation of OS specified files - by borges - 08-31-2020, 09:00 PM
RE: Comparation of OS specified files - by Admin - 09-01-2020, 04:45 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)