source: trunk/src/gcc/libf2c/libF77/s_copy.c@ 1188

Last change on this file since 1188 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 957 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
11#ifdef KR_headers
12VOID s_copy(a, b, la, lb) register char *a, *b; ftnlen la, lb;
13#else
14void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb)
15#endif
16{
17 register char *aend, *bend;
18
19 aend = a + la;
20
21 if(la <= lb)
22#ifndef NO_OVERWRITE
23 if (a <= b || a >= b + la)
24#endif
25 while(a < aend)
26 *a++ = *b++;
27#ifndef NO_OVERWRITE
28 else
29 for(b += la; a < aend; )
30 *--aend = *--b;
31#endif
32
33 else {
34 bend = b + lb;
35#ifndef NO_OVERWRITE
36 if (a <= b || a >= bend)
37#endif
38 while(b < bend)
39 *a++ = *b++;
40#ifndef NO_OVERWRITE
41 else {
42 a += lb;
43 while(b < bend)
44 *--a = *--bend;
45 a += lb;
46 }
47#endif
48 while(a < aend)
49 *a++ = ' ';
50 }
51 }
Note: See TracBrowser for help on using the repository browser.