/src/igraph/vendor/f2c/s_copy.c
Line | Count | Source (jump to first uncovered 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 | | #ifdef __cplusplus |
9 | | extern "C" { |
10 | | #endif |
11 | | |
12 | | /* assign strings: a = b */ |
13 | | |
14 | | #ifdef KR_headers |
15 | | VOID s_copy(a, b, la, lb) register char *a, *b; ftnlen la, lb; |
16 | | #else |
17 | | void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb) |
18 | | #endif |
19 | 0 | { |
20 | 0 | register char *aend, *bend; |
21 | |
|
22 | 0 | aend = a + la; |
23 | |
|
24 | 0 | if(la <= lb) |
25 | 0 | #ifndef NO_OVERWRITE |
26 | 0 | if (a <= b || a >= b + la) |
27 | 0 | #endif |
28 | 0 | while(a < aend) |
29 | 0 | *a++ = *b++; |
30 | 0 | #ifndef NO_OVERWRITE |
31 | 0 | else |
32 | 0 | for(b += la; a < aend; ) |
33 | 0 | *--aend = *--b; |
34 | 0 | #endif |
35 | | |
36 | 0 | else { |
37 | 0 | bend = b + lb; |
38 | 0 | #ifndef NO_OVERWRITE |
39 | 0 | if (a <= b || a >= bend) |
40 | 0 | #endif |
41 | 0 | while(b < bend) |
42 | 0 | *a++ = *b++; |
43 | 0 | #ifndef NO_OVERWRITE |
44 | 0 | else { |
45 | 0 | a += lb; |
46 | 0 | while(b < bend) |
47 | 0 | *--a = *--bend; |
48 | 0 | a += lb; |
49 | 0 | } |
50 | 0 | #endif |
51 | 0 | while(a < aend) |
52 | 0 | *a++ = ' '; |
53 | 0 | } |
54 | 0 | } |
55 | | #ifdef __cplusplus |
56 | | } |
57 | | #endif |