About This Page
++
This page is about ancient (before the year 2000) programming languages, like Fortran and C. This page is mostly + about showing how it was done before fancy build tools and syntax were a thing. It also serves a purpose of a + showing, with examples, how to not only set up the programming environments, but also the whole workflow from + prototype to production.
++ +
This whole idea started when I made my first "serious" blog, rbwr.dk, but it didn't + feel like quite the "correct" place to put it. So the idea was shelved for a time... Until recently, when I picked + up a project in Fortran. Yep, Fortran. I had gotten bored, and wanted to challenge myself. And I thought, that if + I'm going to learn the language, I might as well put blood, sweat and tears into formulating and showcasing how + it's done (correctly).
++ +
I did initially want to try COBOL, but after looking at some examples, Fortran kind of looked more appealing lol.
++
+
Who Am I?
-
My name is Rasmus Rasmussen (yes, that's my name), I live somewhere in the outskirts of Odense, and I'm primarily +
My name is Rasmus Rasmussen (yes, that's my name), I live somewhere in the outskirts of Odense, Denmark, and I'm primarily a backend developer. But lately, I've started to like developing in vue3. With TypeScript, of cause. It's a nice chance of pace, and I often find myself wanting to experiment with different styling, as well as trying to optimize and minimize my bundles.
@@ -39,10 +58,11 @@ too far from my apartment.-


Not bad huh? The things you see when everyone is asleep.
-


And this is my humble bike. It has taken me many places, and it's still going strong. The odometer no longer works, so I just use my FitBit Charge 5 instead. I've modeled and 3D printed the two orange bottle holders myself, on my Original Prusa MK3S+.
diff --git a/src/components/Fortran/Fortran_Hello_World.vue b/src/components/Fortran/Fortran_Hello_World.vue index 7e584db..4a8fa4b 100644 --- a/src/components/Fortran/Fortran_Hello_World.vue +++ b/src/components/Fortran/Fortran_Hello_World.vue @@ -8,7 +8,7 @@-
program hello
implicit none
@@ -25,9 +25,8 @@ end program hello
will compile to the exact same assembly. So if you only need to print something to stdout, just use print *
as it conveys the meaning of the code better. Plus we don't need the full functionality of write(*,*)
in this example.
-
-
+
$ gfortran -o hello main.f90
$ ./hello
@@ -38,9 +37,8 @@ $ ./hello
Now, hear me out, why not spice up the program a little bit more? What if we want to read user input? Well, fret
not my friend, because I have just the solution for you then. All we gotta do is to read from the terminal, and
then print out the value.
-
-
+
program hello
implicit none
@@ -80,11 +78,10 @@ end program hello
So in this case, where we check if ios
is End Of File, then that means if we input an
End Of File key combination (Ctrl+D on Unix/Linux, and Ctrl+Z on Windows), then the program would stop immediately.
We use the trim()
function to remove any trailing whitespaces. That's because, if you
- make a character bigger than the actual text, it will be fille with whitespace after the text. So now the output
+ make a character array longer than the actual text, it will be filled with whitespace after the text. So now the output
looks like this:
-
-
+
$ gfortran -o hello main.f90
$ ./hello
diff --git a/src/components/Fortran/Fortran_Index.vue b/src/components/Fortran/Fortran_Index.vue
index 187d55a..83f7299 100644
--- a/src/components/Fortran/Fortran_Index.vue
+++ b/src/components/Fortran/Fortran_Index.vue
@@ -21,6 +21,7 @@
Table of contents:
+ > Set Up
> Hello World
> Reading A File
diff --git a/src/components/Fortran/Fortran_Set_Up.vue b/src/components/Fortran/Fortran_Set_Up.vue
new file mode 100644
index 0000000..850f5d2
--- /dev/null
+++ b/src/components/Fortran/Fortran_Set_Up.vue
@@ -0,0 +1,95 @@
+
+
+
+
+ Setting Up The Environment
+
+
+
+ If you're familiar with C, then you would feel right at home with Fortran's build environment. There isn't really
+ an "official" compiler for the language, only a standard, that has to be implemented by the compilers. But there
+ are a lot of great compilers, that might as well be "official."
+
+
+ The top listed compiler on Fortran's website, is the GNU Fortran compiler (gfortran). It's the one I will be using
+ throughout the examples on the site. Unless stated otherwise. There are also some other notable compilers, that
+ has some rather interesting qualities to them.
+
+
+ Compilers:
+
+ - lfortran (This one can be used as an interactive
+ compiler, and also supports parsing all of the 2018 standard syntax. It can also compile Fortran to WebAssemply).
+ - NVIDIA HPC SDK (This one comes with a whole lot of GPU
+ accelerated libraries).
+
+
+
+ But , we will use gfortran. I will mainly be focusing on installing and developing on Linux.
+
+
+ First, we install the compiler.
+
+
+ For Fedora.
+ $ sudo dnf install gcc-gfortran
+
+
+
+ For ubuntu.
+ $ sudo apt install gfortran
+
+
+
+ And that's it. Pretty easy.
+
+
+ Project Structure
+
+
+
+ When creating a Fortran project, or any project in general, you want a structure. There is a lot of different
+ layouts for the structure, but equal amongst them, is the src
folder. That's where we keep all of out
+ source code. Like *.f90, *.f95
files.
+
+
+ But other than that, most projects include a Makefile
file, a library
, test
+ and bin
folder. Your layout doesn't need to look like this specifically, nor does it have to contain
+ the same folders. Each project is different, and so are the requirements. But this layout is simple, and great
+ for medium to large projects.
+
+
+ But if we're doing micro-projects, as in like, a hello world application, a test application, or a small tool,
+ this layout is rather redundant, and on the examples on the website here, we will only use it on bigger projects,
+ and we will let you know, when or how we set up the project.
+
+
+
+
+project/
+├── src/ # Source files (.f90, .f95, etc.)
+│ ├── modules/ # Module definitions
+│ └── main.f90 # Main program file
+├── include/ # Include files (e.g., interface definitions)
+├── lib/ # Library object files and archives
+├── bin/ # Executable binaries
+├── tests/ # Test cases
+└── Makefile # Build script
+
+
+
+
+ Notes:
+
+ - >
src
(This is where we keep all of out source code).
+ - >
modules
(This is where we keep our classes. Or in Fortran-speak, modules).
+ - >
include
(This is where we keep our interfaces, that out modules will inherit from, if we're using Fortran 90 or above).
+ - >
bin
(This is where the compiled program should end up in).
+
+
+
+ Makefiles are very useful, and becomes increasingly useful, the bigger the project is.
+
+
\ No newline at end of file
diff --git a/src/index.css b/src/index.css
index bd6213e..1965c59 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1,3 +1,10 @@
@tailwind base;
@tailwind components;
-@tailwind utilities;
\ No newline at end of file
+@tailwind utilities;
+
+@layer base {
+ --color-light: #2500ff;
+ --color-dark: rgb(0, 0, 0);
+
+ --color-background: var(--color-light);
+}
\ No newline at end of file
diff --git a/src/main.ts b/src/main.ts
index fdf9169..4133554 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,6 +1,7 @@
import { createApp } from 'vue'
import {createRouter, createWebHistory} from "vue-router";
import './index.css'
+import './styles.css'
import App from './App.vue'
import Home from "./components/Home.vue";
import About from "./components/About.vue";
@@ -9,6 +10,7 @@ import PascalIndex from "./components/Pascal/Pascal_Index.vue";
import LispIndex from "./components/Lisp/Lisp_Index.vue";
import FortranReadingFiles from "./components/Fortran/Fortran_Reading_Files.vue";
import FortranHelloWorld from "./components/Fortran/Fortran_Hello_World.vue";
+import FortranSetUp from "./components/Fortran/Fortran_Set_Up.vue";
const router = createRouter({
history: createWebHistory(),
@@ -17,6 +19,7 @@ const router = createRouter({
{path: '/About', name: 'About', component: About},
{path: '/Fortran', name: 'Fortran', component: FortranIndex},
+ {path: '/Fortran/SetUp', name: 'SetUp', component: FortranSetUp},
{path: '/Fortran/HelloWorld', name: 'HelloWorld', component: FortranHelloWorld},
{path: '/Fortran/ReadingAFile', name: 'ReadingAFile', component: FortranReadingFiles},
diff --git a/src/styles.css b/src/styles.css
index 75ddfb0..8886507 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -3,13 +3,12 @@
line-height: 1.5;
font-weight: 400;
- color-scheme: light dark;
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
+ #color-scheme: light dark;
+ #color: rgba(255, 255, 255, 0.87);
+ #background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-}
-
+}
\ No newline at end of file
diff --git a/tailwind.config.js b/tailwind.config.js
index e095502..46296db 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -9,7 +9,11 @@ export default {
"./src/**/*.{js,ts,jsx,tsx,vue}",
],
theme: {
- extend: {},
+ extend: {
+ colors: {
+ var_background: "var(--color-background)"
+ }
+ },
},
plugins: [],
}
\ No newline at end of file