Break check_for_unmarked_paragraphs() out
authorali <ali@juiblex.co.uk>
Sat May 25 20:38:17 2013 +0100 (2013-05-25)
changeset 48274aa1e09099
parent 47 7522c36859d0
child 49 8a53979c0d65
Break check_for_unmarked_paragraphs() out
bookloupe/bookloupe.c
     1.1 --- a/bookloupe/bookloupe.c	Sat May 25 20:29:36 2013 +0100
     1.2 +++ b/bookloupe/bookloupe.c	Sat May 25 20:38:17 2013 +0100
     1.3 @@ -1236,6 +1236,33 @@
     1.4  }
     1.5  
     1.6  /*
     1.7 + * check_for_unmarked_paragraphs:
     1.8 + *
     1.9 + * Check for unmarked paragraphs indicated by separate speakers.
    1.10 + *
    1.11 + * May well be false positive:
    1.12 + * "Bravo!" "Wonderful!" called the crowd.
    1.13 + * but useful all the same.
    1.14 + */
    1.15 +void check_for_unmarked_paragraphs(const char *aline)
    1.16 +{
    1.17 +    const char *s;
    1.18 +    s=strstr(aline,"\"  \"");
    1.19 +    if (!s)
    1.20 +	s=strstr(aline,"\" \"");
    1.21 +    if (s)
    1.22 +    {
    1.23 +	if (pswit[ECHO_SWITCH])
    1.24 +	    printf("\n%s\n",aline);
    1.25 +	if (!pswit[OVERVIEW_SWITCH])
    1.26 +	    printf("    Line %ld column %d - Query missing paragraph break?\n",
    1.27 +	      linecnt,(int)(s-aline)+1);
    1.28 +	else
    1.29 +	    cnt_punct++;
    1.30 +    }
    1.31 +}
    1.32 +
    1.33 +/*
    1.34   * procfile:
    1.35   *
    1.36   * Process one file.
    1.37 @@ -1481,29 +1508,7 @@
    1.38  	    check_for_spaced_emdash(aline);
    1.39  	    check_for_spaced_dash(aline);
    1.40  	}
    1.41 -        /*
    1.42 -	 * Check for unmarked paragraphs indicated by separate speakers.
    1.43 -         * May well be false positive:
    1.44 -         * "Bravo!" "Wonderful!" called the crowd.
    1.45 -         * but useful all the same.
    1.46 -	 */
    1.47 -        s=wrk;
    1.48 -        *s=0;
    1.49 -        if (strstr(aline,"\" \""))
    1.50 -	    s=strstr(aline,"\" \"");
    1.51 -        if (strstr(aline,"\"  \""))
    1.52 -	    s=strstr(aline,"\"  \"");
    1.53 -        if (*s)
    1.54 -	{
    1.55 -            if (pswit[ECHO_SWITCH])
    1.56 -		printf("\n%s\n",aline);
    1.57 -            if (!pswit[OVERVIEW_SWITCH])
    1.58 -                printf("    Line %ld column %d - "
    1.59 -		  "Query missing paragraph break?\n",
    1.60 -		  linecnt,(int)(s-aline)+1);
    1.61 -            else
    1.62 -                cnt_punct++;
    1.63 -	}
    1.64 +	check_for_unmarked_paragraphs(aline);
    1.65          /*
    1.66  	 * Check for "to he" and other easy he/be errors.
    1.67           * This is a very inadequate effort on the he/be problem,