From: lynnmcguire5@gmail.com   
      
   On 10/24/2024 1:28 AM, Thomas Koenig wrote:   
   > Lynn McGuire schrieb:   
   >   
   >> I am going to change all the F77 code to C++ some day. I already have a   
   >> heavily modified version of F2C that I have rewritten extensively and   
   >> already moved several hundred subroutines from F77 to C++.   
   >   
   > Modern Fortran might be the easier way, because a change can be done   
   > incrementally, and this...   
   >   
   >> The biggest   
   >> problem is the F77 write statements.   
   >   
   > ... would not be an issue. What features is modern Fortran missing that   
   > you need C++ for?   
   >   
   >> F2C fixes the other big problem   
   >> automatically, the change of initial array index from one to zero.   
   >   
   > If I remember correctly, it does so by issueing invalid C (or   
   > C++), by using negative offsets from pointers. Might work now,   
   > might not work tomorrow.   
   >   
   > But note the IIRC above.   
      
   I want to move to a monolanguage environment. 50,000 lines of my   
   calculation engine are C++ already. 850,000 lines to go.   
      
   Here is a portion of the translated C++ code from a subroutine called   
   vapres.f. component_data1.triplepointtemperature is a previous fortran   
   common block variable, it is now a static. The index before was [k],   
   now it is [k - 1]. t and star are an argument variables.   
      
   int vapres (integer k, doublereal t, doublereal *ps, char *star,   
   doublereal *apc,   
    doublereal *atb, doublereal *atc, longint *idcomp, doublereal *zcd)   
   {   
      
    if (t <= component_data1.triplepointtemperature[k - 1]) {   
    solid_vapor_pressure (k, t, ps);   
    *star = ' ';   
    goto L99999;   
    }   
      
   L99999:   
    if (*ps < 1e-20) {   
    *ps = 1e-20;   
    }   
    if (*ps > 1e6) {   
    *ps = 1e6;   
    }   
    return 0;   
      
   } /* vapres */   
      
      
   Lynn   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|