source: trunk/gcc/libf2c/libF77/s_copy.c

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 893 bytes
Line 
1/* Unless compiled with -DNO_OVERWRITE, this variant of s_copy allows the
2 * target of an assignment to appear on its right-hand side (contrary
3 * to the Fortran 77 Standard, but in accordance with Fortran 90),
4 * as in a(2:5) = a(4:7) .
5 */
6
7#include "f2c.h"
8
9/* assign strings: a = b */
10
11void
12s_copy (register char *a, register char *b, ftnlen la, ftnlen lb)
13{
14 register char *aend, *bend;
15
16 aend = a + la;
17
18 if (la <= lb)
19#ifndef NO_OVERWRITE
20 if (a <= b || a >= b + la)
21#endif
22 while (a < aend)
23 *a++ = *b++;
24#ifndef NO_OVERWRITE
25 else
26 for (b += la; a < aend;)
27 *--aend = *--b;
28#endif
29
30 else
31 {
32 bend = b + lb;
33#ifndef NO_OVERWRITE
34 if (a <= b || a >= bend)
35#endif
36 while (b < bend)
37 *a++ = *b++;
38#ifndef NO_OVERWRITE
39 else
40 {
41 a += lb;
42 while (b < bend)
43 *--a = *--bend;
44 a += lb;
45 }
46#endif
47 while (a < aend)
48 *a++ = ' ';
49 }
50}
Note: See TracBrowser for help on using the repository browser.