+void distDNA_indelblock(unsigned char *x, int *n, int *s, double *d)
+{
+ int i1, i2, s1, s2, target, N, start_block, end_block;
+
+ for (i1 = 1; i1 <= *n; i1++) {
+
+/* find a block of one or more '-' */
+
+ s1 = 1;
+ while (s1 < *s) {
+ if (x[X(i1, s1)] == 4) {
+ start_block = s1;
+ while (x[X(i1, s1)] == 4) s1++;
+ end_block = s1 - 1;
+
+/* then look if the same block is present in all the other sequences */
+
+ for (i2 = 1; i2 <= *n; i2++) {
+ if (i2 == i1) continue;
+
+ target = give_index(i1, i2, *n);
+
+ if (start_block > 1) {
+ if (x[X(i2, start_block - 1)] == 4) {
+ d[target]++;
+ continue;
+ }
+ }
+ if (end_block < *s) {
+ if (x[X(i2, end_block + 1)] == 4) {
+ d[target]++;
+ continue;
+ }
+ }
+ for (s2 = start_block; s2 <= end_block; s2++) {
+ if (x[X(i2, s2)] != 4) {
+ d[target]++;
+ continue;
+ }
+ }
+ }
+ s1 = end_block + 1;
+ }
+ s1++;
+ }
+ }
+}