Topic: Mac Computer: open Project and modules

Computer: Mac M4
OS: Sequoia 15.5
SimplyFortran: V3.40 Build 4427

I could swear that in the past I could double click on a .prj file and it would open and include the .f95 source code file located in same folder. That folder also contains a Makefile document, a modules folder, and a Target document.

These days, when I double click the .prj file it opens to a blank window named ".... Fortran - Untitled (target)" instead of ".... Fortran - MyProject (target)"

I can navigate to MyProject.prj via the Project/Open Project ... menu. But I'd expected, because I started by double clicking on MyProject.prj, that it would open that along with my .f95 source code file in the same folder. Am I mistaken about that?

Double clicking the .f95 file first, just opens it in the BBedit (text editor) app.

I'll go back to square 1, and build the "Hello World" demo again. Maybe I'm remembering it wrong

I want to move working code out of the main program and into a Module. Is there and example of that structure? The basic question is, how do I get the Module folder in the Project Outline "column", function and procedure code (just copy/paste?) into the module and call the procedures from the main .f95 file?

It (from Chapman's book below), like I have add, inside the module folder, a .f95 file that starts something like:
Module my_routines
Contains
   Subrountine xxx (a,b,c)
   ....
   End Subroutine xxx

   Function yyy (a,b,c)
   ....
   End Function
End module my_routines


I'm using Fortran 90/95 for Scientists and Engineeers by S. J. Chapman as a reference and have other books, all with "Modern Fortran" in their titles.

2

Re: Mac Computer: open Project and modules

There are two separate questions in this post, so I'll address them separately:

First, in regards to file association in macOS, it appears that some component of project opening has broken.  macOS is quite a problematic platform to maintain since Apple has no interest in backwards compatibility whatsoever, so I'm guessing something just broke with project loading.  I'll look into fixing this quickly.

Second, modules, from the developer's viewpoint, are Fortran source files that contain the module construct, nothing more.  These source files can be stored anywhere and just added to your project.  They should be treated like any other Fortran source file, including using the f90, f95, or any other appropriate Fortran source file extension.  You can even use module constructs inside fixed-format Fortran with the f extension if you want.

The modules subdirectory that Simply Fortran creates, on the other hand, is purely for storing compiler output.  You should not place any source files inside that directory, nor should anyone be concerned with what files exist in that directory. 

When you compile a Fortran source file containing a module, let's say a file named mathmod.f90 that contains a module named mymath, the compiler will generate a file named mymath.mod inside the modules subdirectory that Simply Fortran created.  This file is a binary file that is not human readable and not portable to other compilers (or sometimes even to the same compiler but different version).  The existence of mymath.mod is necessary for other compilation steps, but it shouldn't be touched by the user. 

In short, you should ignore Simply Fortran's modules subdirectory, and you should not put anything inside it.  It isn't meant for the user, much like the build subdirectory.

Jeff Armstrong
Approximatrix, LLC

Re: Mac Computer: open Project and modules

Jeff, thank you for your comprehensive reply. You saved me a lot of "discovery" time because my next step would have been trying to put something in the Module folder. Also, I wasn't going crazy thinking that double clicking the .prj file should have loaded the .f95 files in the project folder (that contains the .prj file and others).

It's too bad Apple creates so much trouble for your support and I appreciate the effort you put in to keep compatibility with that platform. I miss the Graphical interface that was available with early "fortran-isque" programs like ZBasic and FutureBasic. But I can  use SimplyFortran prototype routines/algorithms I can then move to other apps.

The programming world embraced OOP design and of course one can come up with scenarios where it is appropriate. But for me, for what I do (my hobby programming), it adds so much overhead and complexity. If I were still in the biz - a forensic programmer who is just tossed the source code, no documentation, sometime even no description of what it's supposed to do, and tasked with making it work - OOP is a GodSent of additional billable hours because with encapsulation, the problem code could be anywhere.

SimplyFortran is, for me, the simplest, and quickest, least overhead, way to test/demonstrate a solution to a programming task.