s_copy.c
Go to the documentation of this file.
00001 /* Unless compiled with -DNO_OVERWRITE, this variant of s_copy allows the
00002  * target of an assignment to appear on its right-hand side (contrary
00003  * to the Fortran 77 Standard, but in accordance with Fortran 90),
00004  * as in  a(2:5) = a(4:7) .
00005  */
00006 
00007 #include "f2c.h"
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011 
00012 /* assign strings:  a = b */
00013 
00014 #ifdef KR_headers
00015 VOID s_copy(a, b, la, lb) register char *a, *b; ftnlen la, lb;
00016 #else
00017 void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb)
00018 #endif
00019 {
00020         register char *aend, *bend;
00021 
00022         aend = a + la;
00023 
00024         if(la <= lb)
00025 #ifndef NO_OVERWRITE
00026                 if (a <= b || a >= b + la)
00027 #endif
00028                         while(a < aend)
00029                                 *a++ = *b++;
00030 #ifndef NO_OVERWRITE
00031                 else
00032                         for(b += la; a < aend; )
00033                                 *--aend = *--b;
00034 #endif
00035 
00036         else {
00037                 bend = b + lb;
00038 #ifndef NO_OVERWRITE
00039                 if (a <= b || a >= bend)
00040 #endif
00041                         while(b < bend)
00042                                 *a++ = *b++;
00043 #ifndef NO_OVERWRITE
00044                 else {
00045                         a += lb;
00046                         while(b < bend)
00047                                 *--a = *--bend;
00048                         a += lb;
00049                         }
00050 #endif
00051                 while(a < aend)
00052                         *a++ = ' ';
00053                 }
00054         }
00055 #ifdef __cplusplus
00056 }
00057 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:56