diff options
Diffstat (limited to 'libgfortran/m4/eoshift1.m4')
-rw-r--r-- | libgfortran/m4/eoshift1.m4 | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4 index 0c55c8711b6..b5245ee42ea 100644 --- a/libgfortran/m4/eoshift1.m4 +++ b/libgfortran/m4/eoshift1.m4 @@ -35,20 +35,10 @@ Boston, MA 02110-1301, USA. */ #include "libgfortran.h"' include(iparm.m4)dnl -static const char zeros[16] = - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - -extern void eoshift1_`'atype_kind (gfc_array_char *, - const gfc_array_char *, - const atype *, const char *, - const atype_name *); -export_proto(eoshift1_`'atype_kind); - -void -eoshift1_`'atype_kind (gfc_array_char *ret, - const gfc_array_char *array, - const atype *h, const char *pbound, - const atype_name *pwhich) +static void +eoshift1 (gfc_array_char *ret, const gfc_array_char *array, const atype *h, + const char *pbound, const atype_name *pwhich, index_type size, + char filler) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -70,7 +60,6 @@ eoshift1_`'atype_kind (gfc_array_char *ret, index_type count[GFC_MAX_DIMENSIONS]; index_type extent[GFC_MAX_DIMENSIONS]; index_type dim; - index_type size; index_type len; index_type n; int which; @@ -88,14 +77,8 @@ eoshift1_`'atype_kind (gfc_array_char *ret, else which = 0; - if (!pbound) - pbound = zeros; - - size = GFC_DESCRIPTOR_SIZE (ret); - extent[0] = 1; count[0] = 0; - size = GFC_DESCRIPTOR_SIZE (array); if (ret->data == NULL) { @@ -136,7 +119,7 @@ eoshift1_`'atype_kind (gfc_array_char *ret, rstride[n] = ret->dim[dim].stride * size; sstride[n] = array->dim[dim].stride * size; - hstride[n] = h->dim[n].stride * size; + hstride[n] = h->dim[n].stride; n++; } } @@ -187,11 +170,18 @@ eoshift1_`'atype_kind (gfc_array_char *ret, dest = rptr; n = delta; - while (n--) - { - memcpy (dest, pbound, size); - dest += roffset; - } + if (pbound) + while (n--) + { + memcpy (dest, pbound, size); + dest += roffset; + } + else + while (n--) + { + memset (dest, filler, size); + dest += roffset; + } /* Advance to the next section. */ rptr += rstride0; @@ -226,3 +216,33 @@ eoshift1_`'atype_kind (gfc_array_char *ret, } } } + +void eoshift1_`'atype_kind (gfc_array_char *, const gfc_array_char *, + const atype *, const char *, const atype_name *); +export_proto(eoshift1_`'atype_kind); + +void +eoshift1_`'atype_kind (gfc_array_char *ret, const gfc_array_char *array, + const atype *h, const char *pbound, + const atype_name *pwhich) +{ + eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), 0); +} + +void eoshift1_`'atype_kind`'_char (gfc_array_char *, GFC_INTEGER_4, + const gfc_array_char *, const atype *, + const char *, const atype_name *, + GFC_INTEGER_4, GFC_INTEGER_4); +export_proto(eoshift1_`'atype_kind`'_char); + +void +eoshift1_`'atype_kind`'_char (gfc_array_char *ret, + GFC_INTEGER_4 ret_length __attribute__((unused)), + const gfc_array_char *array, const atype *h, + const char *pbound, const atype_name *pwhich, + GFC_INTEGER_4 array_length, + GFC_INTEGER_4 bound_length + __attribute__((unused))) +{ + eoshift1 (ret, array, h, pbound, pwhich, array_length, ' '); +} |