1998-02-01 02:37:08 +01:00
|
|
|
/* Unless compiled with -DNO_OVERWRITE, this variant of s_cat allows the
|
|
|
|
* target of a concatenation to appear on its right-hand side (contrary
|
|
|
|
* to the Fortran 77 Standard, but in accordance with Fortran 90).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "f2c.h"
|
|
|
|
#ifndef NO_OVERWRITE
|
|
|
|
#include <stdio.h>
|
|
|
|
#undef abs
|
|
|
|
#undef min
|
|
|
|
#undef max
|
|
|
|
#include <stdlib.h>
|
2002-06-01 14:38:32 +02:00
|
|
|
extern char *F77_aloc (ftnlen, char *);
|
1998-02-01 02:37:08 +01:00
|
|
|
#include <string.h>
|
|
|
|
#endif /* NO_OVERWRITE */
|
|
|
|
|
g2c.hin, [...]: Kill VOID, Void and Int.
* g2c.hin, libF77/d_cnjg.c, libF77/main.c, libF77/r_cnjg.c,
libF77/s_cat.c, libF77/s_paus.c, libF77/s_rnge.c, libF77/setarg.c,
libF77/setsig.c, libF77/signal1.h0, libI77/dfe.c, libI77/due.c,
libI77/err.c, libI77/fio.h, libI77/fmt.c, libI77/iio.c,
libI77/ilnw.c, libI77/lread.c, libI77/lwrite.c, libI77/rsfe.c,
libI77/rsli.c, libI77/rsne.c, libI77/sfe.c, libI77/sue.c,
libI77/util.c, libI77/wrtfmt.c, libI77/wsfe.c, libI77/wsle.c,
libI77/xwsne.c, libU77/date_.c: Kill VOID, Void and Int.
From-SVN: r54134
2002-06-01 03:58:10 +02:00
|
|
|
void
|
2002-06-01 14:38:32 +02:00
|
|
|
s_cat (char *lp, char *rpp[], ftnint rnp[], ftnint * np, ftnlen ll)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
ftnlen i, nc;
|
|
|
|
char *rp;
|
|
|
|
ftnlen n = *np;
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef NO_OVERWRITE
|
2002-06-01 14:38:32 +02:00
|
|
|
ftnlen L, m;
|
|
|
|
char *lp0, *lp1;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
lp0 = 0;
|
|
|
|
lp1 = lp;
|
|
|
|
L = ll;
|
|
|
|
i = 0;
|
|
|
|
while (i < n)
|
|
|
|
{
|
|
|
|
rp = rpp[i];
|
|
|
|
m = rnp[i++];
|
|
|
|
if (rp >= lp1 || rp + m <= lp)
|
|
|
|
{
|
|
|
|
if ((L -= m) <= 0)
|
|
|
|
{
|
|
|
|
n = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lp1 += m;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
lp0 = lp;
|
|
|
|
lp = lp1 = F77_aloc (L = ll, "s_cat");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lp1 = lp;
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif /* NO_OVERWRITE */
|
2002-06-01 14:38:32 +02:00
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
{
|
|
|
|
nc = ll;
|
|
|
|
if (rnp[i] < nc)
|
|
|
|
nc = rnp[i];
|
|
|
|
ll -= nc;
|
|
|
|
rp = rpp[i];
|
|
|
|
while (--nc >= 0)
|
|
|
|
*lp++ = *rp++;
|
|
|
|
}
|
|
|
|
while (--ll >= 0)
|
|
|
|
*lp++ = ' ';
|
1998-02-01 02:37:08 +01:00
|
|
|
#ifndef NO_OVERWRITE
|
2002-06-01 14:38:32 +02:00
|
|
|
if (lp0)
|
|
|
|
{
|
|
|
|
memcpy (lp0, lp1, L);
|
|
|
|
free (lp1);
|
|
|
|
}
|
1998-02-01 02:37:08 +01:00
|
|
|
#endif
|
2002-06-01 14:38:32 +02:00
|
|
|
}
|