1998-02-01 02:37:08 +01:00
|
|
|
/* Unless compiled with -DNO_OVERWRITE, this variant of s_copy allows the
|
|
|
|
* target of an assignment to appear on its right-hand side (contrary
|
|
|
|
* to the Fortran 77 Standard, but in accordance with Fortran 90),
|
|
|
|
* as in a(2:5) = a(4:7) .
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "f2c.h"
|
|
|
|
|
|
|
|
/* assign strings: a = b */
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
void
|
|
|
|
s_copy (register char *a, register char *b, ftnlen la, ftnlen lb)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
register char *aend, *bend;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
aend = a + la;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
if (la <= lb)
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef NO_OVERWRITE
|
2002-06-01 14:38:32 +02:00
|
|
|
if (a <= b || a >= b + la)
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
while (a < aend)
|
|
|
|
*a++ = *b++;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef NO_OVERWRITE
|
2002-06-01 14:38:32 +02:00
|
|
|
else
|
|
|
|
for (b += la; a < aend;)
|
|
|
|
*--aend = *--b;
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
bend = b + lb;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef NO_OVERWRITE
|
2002-06-01 14:38:32 +02:00
|
|
|
if (a <= b || a >= bend)
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
while (b < bend)
|
|
|
|
*a++ = *b++;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef NO_OVERWRITE
|
2002-06-01 14:38:32 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
a += lb;
|
|
|
|
while (b < bend)
|
|
|
|
*--a = *--bend;
|
|
|
|
a += lb;
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|
2002-06-01 14:38:32 +02:00
|
|
|
#endif
|
|
|
|
while (a < aend)
|
|
|
|
*a++ = ' ';
|
|
|
|
}
|
|
|
|
}
|