# Cpp (C preprocessor) tricks

**URL:** <https://fortran-lang.discourse.group/t/cpp-c-preprocessor-tricks/8639>\
**Category:** Uncategorized\
**Created:** [September 21, 2024, 1:28pm UTC](https://fortran-lang.discourse.group/t/cpp-c-preprocessor-tricks/8639 "2024-09-21T13:28:53Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![davidpfister](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/davidpfister/32/3949_2.png) [@davidpfister](https://fortran-lang.discourse.group/u/davidpfister)\
**Post date:** [September 30, 2024, 2:05pm UTC](https://fortran-lang.discourse.group/t/cpp-c-preprocessor-tricks/8639/22 "2024-09-30T14:05:39Z")

</div>

While looking at the code of daskr, I just came across the `*DECK` instruction, which after a bit of research led me to [preFOR](https://www.nrc.gov/docs/ML0402/ML040210564.pdf).  
It seems that each Fortran era had its flock of pre-processors.

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [September 30, 2024, 2:37pm UTC](https://fortran-lang.discourse.group/t/cpp-c-preprocessor-tricks/8639/23 "2024-09-30T14:37:48Z")

</div>

A colleague once pointed me to Trefor: [TREFOR](https://dau.itep.ru/seb/trefor.html). The sources of TREFOR can be found here: [OpenStella/trefor at main · sblinnikov/OpenStella · GitHub](https://github.com/sblinnikov/OpenStella/tree/main/trefor)

---

<div class="post-metadata">

**Author:** ![wspector](https://avatars.discourse-cdn.com/v4/letter/w/47e85d/32.png) [@wspector](https://fortran-lang.discourse.group/u/wspector)\
**Post date:** [September 30, 2024, 5:11pm UTC](https://fortran-lang.discourse.group/t/cpp-c-preprocessor-tricks/8639/24 "2024-09-30T17:11:43Z")

</div>

> [@davidpfister](#):
>
> While looking at the code of daskr, I just came across the `*DECK` instruction, which after a bit of research led me to [preFOR](https://www.nrc.gov/docs/ML0402/ML040210564.pdf).  
> It seems that each Fortran era had its flock of pre-processors.

The `*DECK` directive is from the CDC (Control Data Corporation) UPDATE and MODIFY source code control programs. They implemented a “program library” system where you had a file containing multiple decks, common decks (which could be included into decks via the`*CALL` directive), modification decks to those decks, branches, etc. It was quite powerful for its day.

There was actually an early predecessor to them in the CDC world called COSY. And the decks were called “COSY decks”… The CDC SCOPE system introduced UPDATE, and many of CDCs products were maintained in UPDATE PLs. In the later KRONOS and NOS systems, CDC came up with the similar, but different, MODIFY utility.

Cray Research had its own version of UPDATE because, like many other pieces of Cray software, they were written by former CDC employees who re-wrote what they knew. If I recall correctly, CRI’s version of UPDATE was written in Fortran - whereas the CDC utilities were written in assembly language (COMPASS). It even made its way into _unicos_ - Cray’s version of _unix_.

You can think of UPDATE and MODIFY as the great-grandparents of todays cvs/svn/git - but in batch processing days:

> **[Update\_Version\_1\_RefMan\_Sept84.pdf](https://bitsavers.org/pdf/cdc/Tom_Hunter_Scans/Update_Version_1_RefMan_Sept84.pdf)**
>
> 8.23 MB

> **[Modify\_RefMan\_Sept85.pdf](https://bitsavers.org/pdf/cdc/Tom_Hunter_Scans/Modify_RefMan_Sept85.pdf)**
>
> 7.29 MB

[Previous page](https://fortran-lang.discourse.group/t/cpp-c-preprocessor-tricks/8639.md?page=1)
