Break report_first_pass() out
authorali <ali@juiblex.co.uk>
Sat May 25 09:40:56 2013 +0100 (2013-05-25)
changeset 4220d51419e077
parent 41 68b1403e2971
child 43 e4042a067753
Break report_first_pass() out
bookloupe/bookloupe.c
     1.1 --- a/bookloupe/bookloupe.c	Sat May 25 08:52:47 2013 +0100
     1.2 +++ b/bookloupe/bookloupe.c	Sat May 25 09:40:56 2013 +0100
     1.3 @@ -494,7 +494,8 @@
     1.4                              if (usertypo_count>=MAX_USER_TYPOS)
     1.5  			    {
     1.6                                  printf("   --> Only %d user-defined typos "
     1.7 -				  "allowed: ignoring the rest\n");
     1.8 +				  "allowed: ignoring the rest\n",
     1.9 +				  MAX_USER_TYPOS);
    1.10                                  break;
    1.11  			    }
    1.12  			}
    1.13 @@ -694,6 +695,199 @@
    1.14      return &results;
    1.15  }
    1.16  
    1.17 +struct warnings {
    1.18 +    signed int shortline,longline,bin,dash,dotcomma,ast,fslash,digit,hyphen;
    1.19 +    signed int endquote,isDutch,isFrench;
    1.20 +};
    1.21 +
    1.22 +/*
    1.23 + * report_first_pass:
    1.24 + *
    1.25 + * Make some snap decisions based on the first pass results.
    1.26 + */
    1.27 +struct warnings *report_first_pass(struct first_pass_results *results)
    1.28 +{
    1.29 +    static struct warnings warnings={0};
    1.30 +    if (cnt_spacend>0)
    1.31 +        printf("   --> %ld lines in this file have white space at end\n",
    1.32 +	  cnt_spacend);
    1.33 +    warnings.dotcomma=1;
    1.34 +    if (results->dotcomma>5)
    1.35 +    {
    1.36 +        warnings.dotcomma=0;
    1.37 +        printf("   --> %ld lines in this file contain '.,'. "
    1.38 +	  "Not reporting them.\n",results->dotcomma);
    1.39 +    }
    1.40 +    /*
    1.41 +     * If more than 50 lines, or one-tenth, are short,
    1.42 +     * don't bother reporting them.
    1.43 +     */
    1.44 +    warnings.shortline=1;
    1.45 +    if (results->shortline>50 || results->shortline*10>linecnt)
    1.46 +    {
    1.47 +        warnings.shortline=0;
    1.48 +        printf("   --> %ld lines in this file are short. "
    1.49 +	  "Not reporting short lines.\n",results->shortline);
    1.50 +    }
    1.51 +    /*
    1.52 +     * If more than 50 lines, or one-tenth, are long,
    1.53 +     * don't bother reporting them.
    1.54 +     */
    1.55 +    warnings.longline=1;
    1.56 +    if (results->longline>50 || results->longline*10>linecnt)
    1.57 +    {
    1.58 +        warnings.longline=0;
    1.59 +        printf("   --> %ld lines in this file are long. "
    1.60 +	  "Not reporting long lines.\n",results->longline);
    1.61 +    }
    1.62 +    /* If more than 10 lines contain asterisks, don't bother reporting them. */
    1.63 +    warnings.ast=1;
    1.64 +    if (results->astline>10)
    1.65 +    {
    1.66 +        warnings.ast=0;
    1.67 +        printf("   --> %ld lines in this file contain asterisks. "
    1.68 +	  "Not reporting them.\n",results->astline);
    1.69 +    }
    1.70 +    /*
    1.71 +     * If more than 10 lines contain forward slashes,
    1.72 +     * don't bother reporting them.
    1.73 +     */
    1.74 +    warnings.fslash=1;
    1.75 +    if (results->fslashline>10)
    1.76 +    {
    1.77 +        warnings.fslash=0;
    1.78 +        printf("   --> %ld lines in this file contain forward slashes. "
    1.79 +	  "Not reporting them.\n",results->fslashline);
    1.80 +    }
    1.81 +    /*
    1.82 +     * If more than 20 lines contain unpunctuated endquotes,
    1.83 +     * don't bother reporting them.
    1.84 +     */
    1.85 +    warnings.endquote=1;
    1.86 +    if (results->endquote_count>20)
    1.87 +    {
    1.88 +        warnings.endquote=0;
    1.89 +        printf("   --> %ld lines in this file contain unpunctuated endquotes. "
    1.90 +	  "Not reporting them.\n",results->endquote_count);
    1.91 +    }
    1.92 +    /*
    1.93 +     * If more than 15 lines contain standalone digits,
    1.94 +     * don't bother reporting them.
    1.95 +     */
    1.96 +    warnings.digit=1;
    1.97 +    if (results->standalone_digit>10)
    1.98 +    {
    1.99 +        warnings.digit=0;
   1.100 +        printf("   --> %ld lines in this file contain standalone 0s and 1s. "
   1.101 +	  "Not reporting them.\n",results->standalone_digit);
   1.102 +    }
   1.103 +    /*
   1.104 +     * If more than 20 lines contain hyphens at end,
   1.105 +     * don't bother reporting them.
   1.106 +     */
   1.107 +    warnings.hyphen=1;
   1.108 +    if (results->hyphens>20)
   1.109 +    {
   1.110 +        warnings.hyphen=0;
   1.111 +        printf("   --> %ld lines in this file have hyphens at end. "
   1.112 +	  "Not reporting them.\n",results->hyphens);
   1.113 +    }
   1.114 +    if (results->htmcount>20 && !pswit[MARKUP_SWITCH])
   1.115 +    {
   1.116 +        printf("   --> Looks like this is HTML. Switching HTML mode ON.\n");
   1.117 +        pswit[MARKUP_SWITCH]=1;
   1.118 +    }
   1.119 +    if (results->verylongline>0)
   1.120 +        printf("   --> %ld lines in this file are VERY long!\n",
   1.121 +	  results->verylongline);
   1.122 +    /*
   1.123 +     * If there are more non-PG spaced dashes than PG em-dashes,
   1.124 +     * assume it's deliberate.
   1.125 +     * Current PG guidelines say don't use them, but older texts do,
   1.126 +     * and some people insist on them whatever the guidelines say.
   1.127 +     */
   1.128 +    warnings.dash=1;
   1.129 +    if (results->spacedash+results->non_PG_space_emdash>
   1.130 +      results->PG_space_emdash)
   1.131 +    {
   1.132 +        warnings.dash=0;
   1.133 +        printf("   --> There are %ld spaced dashes and em-dashes. "
   1.134 +	  "Not reporting them.\n",
   1.135 +	  results->spacedash+results->non_PG_space_emdash);
   1.136 +    }
   1.137 +    /* If more than a quarter of characters are hi-bit, bug out. */
   1.138 +    warnings.bin=1;
   1.139 +    if (results->binlen*4>results->totlen)
   1.140 +    {
   1.141 +        printf("   --> This file does not appear to be ASCII. "
   1.142 +	  "Terminating. Best of luck with it!\n");
   1.143 +        exit(1);
   1.144 +    }
   1.145 +    if (results->alphalen*4<results->totlen)
   1.146 +    {
   1.147 +        printf("   --> This file does not appear to be text. "
   1.148 +	  "Terminating. Best of luck with it!\n");
   1.149 +        exit(1);
   1.150 +    }
   1.151 +    if (results->binlen*100>results->totlen || results->binlen>100)
   1.152 +    {
   1.153 +        printf("   --> There are a lot of foreign letters here. "
   1.154 +	  "Not reporting them.\n");
   1.155 +        warnings.bin=0;
   1.156 +    }
   1.157 +    warnings.isDutch=0;
   1.158 +    if (results->Dutchcount>50)
   1.159 +    {
   1.160 +        warnings.isDutch=1;
   1.161 +        printf("   --> This looks like Dutch - "
   1.162 +	  "switching off dashes and warnings for 's Middags case.\n");
   1.163 +    }
   1.164 +    warnings.isFrench=0;
   1.165 +    if (results->Frenchcount>50)
   1.166 +    {
   1.167 +        warnings.isFrench=1;
   1.168 +        printf("   --> This looks like French - "
   1.169 +	  "switching off some doublepunct.\n");
   1.170 +    }
   1.171 +    if (results->firstline && results->footerline)
   1.172 +        printf("    The PG header and footer appear to be already on.\n");
   1.173 +    else
   1.174 +    {
   1.175 +        if (results->firstline)
   1.176 +            printf("    The PG header is on - no footer.\n");
   1.177 +        if (results->footerline)
   1.178 +            printf("    The PG footer is on - no header.\n");
   1.179 +    }
   1.180 +    printf("\n");
   1.181 +    if (pswit[VERBOSE_SWITCH])
   1.182 +    {
   1.183 +        warnings.bin=1;
   1.184 +        warnings.shortline=1;
   1.185 +        warnings.dotcomma=1;
   1.186 +        warnings.longline=1;
   1.187 +        warnings.dash=1;
   1.188 +        warnings.digit=1;
   1.189 +        warnings.ast=1;
   1.190 +        warnings.fslash=1;
   1.191 +        warnings.hyphen=1;
   1.192 +        warnings.endquote=1;
   1.193 +        printf("   *** Verbose output is ON -- you asked for it! ***\n");
   1.194 +    }
   1.195 +    if (warnings.isDutch)
   1.196 +        warnings.dash=0;
   1.197 +    if (results->footerline>0 && results->firstline>0 &&
   1.198 +      results->footerline>results->firstline &&
   1.199 +      results->footerline-results->firstline<100)
   1.200 +    {
   1.201 +        printf("   --> I don't really know where this text starts. \n");
   1.202 +        printf("       There are no reference points.\n");
   1.203 +        printf("       I'm going to have to report the header and footer "
   1.204 +	  "as well.\n");
   1.205 +        results->firstline=0;
   1.206 +    }
   1.207 +    return &warnings;
   1.208 +}
   1.209 +
   1.210  /*
   1.211   * procfile:
   1.212   *
   1.213 @@ -706,11 +900,10 @@
   1.214      char parastart[81];     /* first line of current para */
   1.215      FILE *infile;
   1.216      struct first_pass_results *first_pass_results;
   1.217 +    struct warnings *warnings;
   1.218      long quot,squot,start_para_line;
   1.219      signed int i,j,llen,isemptyline,isacro,isellipsis,istypo,alower,
   1.220        eNon_A,eTab,eTilde,eAst,eFSlash,eCarat;
   1.221 -    signed int warn_short,warn_long,warn_bin,warn_dash,warn_dotcomma,
   1.222 -      warn_ast,warn_fslash,warn_digit,warn_hyphen,warn_endquote;
   1.223      unsigned int lastlen,lastblen;
   1.224      signed int s_brack,c_brack,r_brack,c_unders;
   1.225      signed int open_single_quote,close_single_quote,guessquote,dquotepar,
   1.226 @@ -720,7 +913,6 @@
   1.227        cbrack_err[80],unders_err[80];
   1.228      signed int qword_index,qperiod_index,isdup;
   1.229      signed int enddash;
   1.230 -    signed int isDutch,isFrench;
   1.231      laststart=CHAR_SPACE;
   1.232      lastlen=lastblen=0;
   1.233      *dquote_err=*squote_err=*rbrack_err=*cbrack_err=*sbrack_err=
   1.234 @@ -728,13 +920,10 @@
   1.235      linecnt=checked_linecnt=start_para_line=0;
   1.236      quot=squot=s_brack=c_brack=r_brack=c_unders=0;
   1.237      i=llen=isemptyline=isacro=isellipsis=istypo=0;
   1.238 -    warn_short=warn_long=warn_bin=warn_dash=warn_dotcomma= 
   1.239 -      warn_ast=warn_fslash=warn_digit=warn_endquote=0;
   1.240      isnewpara=vowel=consonant=enddash=0;
   1.241      qword_index=qperiod_index=isdup=0;
   1.242      *inword=*testword=0;
   1.243      open_single_quote=close_single_quote=guessquote=dquotepar=squotepar=0;
   1.244 -    isDutch=isFrench=0;
   1.245      for (j=0;j<MAX_QWORD;j++)
   1.246      {
   1.247          dupcnt[j]=0;
   1.248 @@ -754,198 +943,9 @@
   1.249  	exit(1);
   1.250      }
   1.251      fprintf(stdout,"\n\nFile: %s\n\n",filename);
   1.252 -
   1.253      first_pass_results=first_pass(infile);
   1.254 -
   1.255 -    fclose(infile);
   1.256 -    /* now, based on this quick view, make some snap decisions */
   1.257 -    if (cnt_spacend>0)
   1.258 -        printf("   --> %ld lines in this file have white space at end\n",
   1.259 -	  cnt_spacend);
   1.260 -    warn_dotcomma=1;
   1.261 -    if (first_pass_results->dotcomma>5)
   1.262 -    {
   1.263 -        warn_dotcomma=0;
   1.264 -        printf("   --> %ld lines in this file contain '.,'. "
   1.265 -	  "Not reporting them.\n",first_pass_results->dotcomma);
   1.266 -    }
   1.267 -    /* if more than 50 lines, or one-tenth, are short,
   1.268 -     * don't bother reporting them */
   1.269 -    warn_short=1;
   1.270 -    if (first_pass_results->shortline>50 ||
   1.271 -      first_pass_results->shortline*10>linecnt)
   1.272 -    {
   1.273 -        warn_short=0;
   1.274 -        printf("   --> %ld lines in this file are short. "
   1.275 -	  "Not reporting short lines.\n",first_pass_results->shortline);
   1.276 -    }
   1.277 -    /*
   1.278 -     * If more than 50 lines, or one-tenth, are long,
   1.279 -     * don't bother reporting them.
   1.280 -     */
   1.281 -    warn_long=1;
   1.282 -    if (first_pass_results->longline>50 ||
   1.283 -      first_pass_results->longline*10>linecnt)
   1.284 -    {
   1.285 -        warn_long=0;
   1.286 -        printf("   --> %ld lines in this file are long. "
   1.287 -	  "Not reporting long lines.\n",first_pass_results->longline);
   1.288 -    }
   1.289 -    /* If more than 10 lines contain asterisks, don't bother reporting them. */
   1.290 -    warn_ast=1;
   1.291 -    if (first_pass_results->astline>10)
   1.292 -    {
   1.293 -        warn_ast=0;
   1.294 -        printf("   --> %ld lines in this file contain asterisks. "
   1.295 -	  "Not reporting them.\n",first_pass_results->astline);
   1.296 -    }
   1.297 -    /*
   1.298 -     * If more than 10 lines contain forward slashes,
   1.299 -     * don't bother reporting them.
   1.300 -     */
   1.301 -    warn_fslash=1;
   1.302 -    if (first_pass_results->fslashline>10)
   1.303 -    {
   1.304 -        warn_fslash=0;
   1.305 -        printf("   --> %ld lines in this file contain forward slashes. "
   1.306 -	  "Not reporting them.\n",first_pass_results->fslashline);
   1.307 -    }
   1.308 -    /*
   1.309 -     * If more than 20 lines contain unpunctuated endquotes,
   1.310 -     * don't bother reporting them.
   1.311 -     */
   1.312 -    warn_endquote=1;
   1.313 -    if (first_pass_results->endquote_count>20)
   1.314 -    {
   1.315 -        warn_endquote=0;
   1.316 -        printf("   --> %ld lines in this file contain unpunctuated endquotes. "
   1.317 -	  "Not reporting them.\n",first_pass_results->endquote_count);
   1.318 -    }
   1.319 -    /*
   1.320 -     * If more than 15 lines contain standalone digits,
   1.321 -     * don't bother reporting them.
   1.322 -     */
   1.323 -    warn_digit=1;
   1.324 -    if (first_pass_results->standalone_digit>10)
   1.325 -    {
   1.326 -        warn_digit=0;
   1.327 -        printf("   --> %ld lines in this file contain standalone 0s and 1s. "
   1.328 -	  "Not reporting them.\n",first_pass_results->standalone_digit);
   1.329 -    }
   1.330 -    /*
   1.331 -     * If more than 20 lines contain hyphens at end,
   1.332 -     * don't bother reporting them.
   1.333 -     */
   1.334 -    warn_hyphen=1;
   1.335 -    if (first_pass_results->hyphens>20)
   1.336 -    {
   1.337 -        warn_hyphen=0;
   1.338 -        printf("   --> %ld lines in this file have hyphens at end. "
   1.339 -	  "Not reporting them.\n",first_pass_results->hyphens);
   1.340 -    }
   1.341 -    if (first_pass_results->htmcount>20 && !pswit[MARKUP_SWITCH])
   1.342 -    {
   1.343 -        printf("   --> Looks like this is HTML. Switching HTML mode ON.\n");
   1.344 -        pswit[MARKUP_SWITCH]=1;
   1.345 -    }
   1.346 -    if (first_pass_results->verylongline>0)
   1.347 -        printf("   --> %ld lines in this file are VERY long!\n",
   1.348 -	  first_pass_results->verylongline);
   1.349 -    /*
   1.350 -     * If there are more non-PG spaced dashes than PG em-dashes,
   1.351 -     * assume it's deliberate.
   1.352 -     * Current PG guidelines say don't use them, but older texts do,
   1.353 -     * and some people insist on them whatever the guidelines say.
   1.354 -     */
   1.355 -    warn_dash=1;
   1.356 -    if (first_pass_results->spacedash+first_pass_results->non_PG_space_emdash>
   1.357 -      first_pass_results->PG_space_emdash)
   1.358 -    {
   1.359 -        warn_dash=0;
   1.360 -        printf("   --> There are %ld spaced dashes and em-dashes. "
   1.361 -	  "Not reporting them.\n",first_pass_results->spacedash+
   1.362 -	  first_pass_results->non_PG_space_emdash);
   1.363 -    }
   1.364 -    /* If more than a quarter of characters are hi-bit, bug out. */
   1.365 -    warn_bin=1;
   1.366 -    if (first_pass_results->binlen*4>first_pass_results->totlen)
   1.367 -    {
   1.368 -        printf("   --> This file does not appear to be ASCII. "
   1.369 -	  "Terminating. Best of luck with it!\n");
   1.370 -        exit(1);
   1.371 -    }
   1.372 -    if (first_pass_results->alphalen*4<first_pass_results->totlen)
   1.373 -    {
   1.374 -        printf("   --> This file does not appear to be text. "
   1.375 -	  "Terminating. Best of luck with it!\n");
   1.376 -        exit(1);
   1.377 -    }
   1.378 -    if (first_pass_results->binlen*100>first_pass_results->totlen ||
   1.379 -      first_pass_results->binlen>100)
   1.380 -    {
   1.381 -        printf("   --> There are a lot of foreign letters here. "
   1.382 -	  "Not reporting them.\n");
   1.383 -        warn_bin=0;
   1.384 -    }
   1.385 -    isDutch=0;
   1.386 -    if (first_pass_results->Dutchcount>50)
   1.387 -    {
   1.388 -        isDutch=1;
   1.389 -        printf("   --> This looks like Dutch - "
   1.390 -	  "switching off dashes and warnings for 's Middags case.\n");
   1.391 -    }
   1.392 -    isFrench=0;
   1.393 -    if (first_pass_results->Frenchcount>50)
   1.394 -    {
   1.395 -        isFrench=1;
   1.396 -        printf("   --> This looks like French - "
   1.397 -	  "switching off some doublepunct.\n");
   1.398 -    }
   1.399 -    if (first_pass_results->firstline && first_pass_results->footerline)
   1.400 -        printf("    The PG header and footer appear to be already on.\n");
   1.401 -    else
   1.402 -    {
   1.403 -        if (first_pass_results->firstline)
   1.404 -            printf("    The PG header is on - no footer.\n");
   1.405 -        if (first_pass_results->footerline)
   1.406 -            printf("    The PG footer is on - no header.\n");
   1.407 -    }
   1.408 -    printf("\n");
   1.409 -    if (pswit[VERBOSE_SWITCH])
   1.410 -    {
   1.411 -        warn_bin=1;
   1.412 -        warn_short=1;
   1.413 -        warn_dotcomma=1;
   1.414 -        warn_long=1;
   1.415 -        warn_dash=1;
   1.416 -        warn_digit=1;
   1.417 -        warn_ast=1;
   1.418 -        warn_fslash=1;
   1.419 -        warn_hyphen=1;
   1.420 -        warn_endquote=1;
   1.421 -        printf("   *** Verbose output is ON -- you asked for it! ***\n");
   1.422 -    }
   1.423 -    if (isDutch)
   1.424 -        warn_dash=0;
   1.425 -    infile=fopen(filename,"rb");
   1.426 -    if (!infile)
   1.427 -    {
   1.428 -        if (pswit[STDOUT_SWITCH])
   1.429 -            fprintf(stdout,"bookloupe: cannot open %s\n",filename);
   1.430 -        else
   1.431 -            fprintf(stderr,"bookloupe: cannot open %s\n",filename);
   1.432 -	exit(1);
   1.433 -    }
   1.434 -    if (first_pass_results->footerline>0 && first_pass_results->firstline>0 &&
   1.435 -      first_pass_results->footerline>first_pass_results->firstline &&
   1.436 -      first_pass_results->footerline-first_pass_results->firstline<100)
   1.437 -    {
   1.438 -        printf("   --> I don't really know where this text starts. \n");
   1.439 -        printf("       There are no reference points.\n");
   1.440 -        printf("       I'm going to have to report the header and footer "
   1.441 -	  "as well.\n");
   1.442 -        first_pass_results->firstline=0;
   1.443 -    }
   1.444 +    warnings=report_first_pass(first_pass_results);
   1.445 +    rewind(infile);
   1.446      /*
   1.447       * Here we go with the main pass. Hold onto yer hat!
   1.448       * Re-init some variables we've dirtied.
   1.449 @@ -1210,7 +1210,7 @@
   1.450                      cnt_bin++;
   1.451  	    }
   1.452  	}
   1.453 -        if (warn_bin)
   1.454 +        if (warnings->bin)
   1.455  	{
   1.456  	    /* Don't repeat multiple warnings on one line. */
   1.457              eNon_A=eTab=eTilde=eCarat=eFSlash=eAst=0;
   1.458 @@ -1274,7 +1274,7 @@
   1.459                          cnt_odd++;
   1.460                      eCarat=1;
   1.461  		}
   1.462 -                if (!eFSlash && *s==CHAR_FORESLASH && warn_fslash)
   1.463 +                if (!eFSlash && *s==CHAR_FORESLASH && warnings->fslash)
   1.464  		{  
   1.465                      if (pswit[ECHO_SWITCH])
   1.466  			printf("\n%s\n",aline);
   1.467 @@ -1289,7 +1289,7 @@
   1.468  		 * Report asterisks only in paranoid mode,
   1.469  		 * since they're often deliberate.
   1.470  		 */
   1.471 -                if (!eAst && pswit[PARANOID_SWITCH] && warn_ast &&
   1.472 +                if (!eAst && pswit[PARANOID_SWITCH] && warnings->ast &&
   1.473  		  !isemptyline && *s==CHAR_ASTERISK)
   1.474  		{
   1.475                      if (pswit[ECHO_SWITCH])
   1.476 @@ -1304,7 +1304,7 @@
   1.477  	    }
   1.478  	}
   1.479          /* Check for line too long. */
   1.480 -        if (warn_long)
   1.481 +        if (warnings->longline)
   1.482  	{
   1.483              if (strlen(aline)>LONGEST_PG_LINE)
   1.484  	    {
   1.485 @@ -1338,7 +1338,7 @@
   1.486           * then just assume it's OK? Need to look at some texts to see
   1.487           * how often a formula like this would get the right result.
   1.488  	 */
   1.489 -        if (warn_short && strlen(aline)>1 && lastlen>1 &&
   1.490 +        if (warnings->shortline && strlen(aline)>1 && lastlen>1 &&
   1.491  	  lastlen<SHORTEST_PG_LINE && lastblen>1 && lastblen>SHORTEST_PG_LINE &&
   1.492  	  laststart!=CHAR_SPACE)
   1.493  	{
   1.494 @@ -1370,7 +1370,7 @@
   1.495           * hence the loop - even if the first double-dash is OK
   1.496           * there may be another that's wrong later on.
   1.497  	 */
   1.498 -        if (warn_dash)
   1.499 +        if (warnings->dash)
   1.500  	{
   1.501              s=aline;
   1.502              while (strstr(s,"--"))
   1.503 @@ -1390,7 +1390,7 @@
   1.504  	    }
   1.505  	}
   1.506          /* Check for spaced dashes. */
   1.507 -        if (warn_dash)
   1.508 +        if (warnings->dash)
   1.509  	{
   1.510              if (strstr(aline," -"))
   1.511  	    {
   1.512 @@ -1590,7 +1590,7 @@
   1.513                      t++;
   1.514                      continue;
   1.515  		}
   1.516 -                if (isDutch)
   1.517 +                if (warnings->isDutch)
   1.518  		{
   1.519  		    /* For Frank & Jeroen -- 's Middags case */
   1.520                      if (t[2]==CHAR_SQUOTE && t[3]>='a' && t[3]<='z' &&
   1.521 @@ -1718,7 +1718,7 @@
   1.522                  if (pswit[ECHO_SWITCH])
   1.523  		    printf("\n%s\n",aline);
   1.524                  if (!pswit[OVERVIEW_SWITCH])
   1.525 -                    printf("    Line %ld column %ld - Query digit in %s\n",
   1.526 +                    printf("    Line %ld column %d - Query digit in %s\n",
   1.527  		      linecnt,(int)(wordstart-aline)+1,inword);
   1.528                  else
   1.529                      cnt_word++;
   1.530 @@ -1890,7 +1890,7 @@
   1.531  			      "Query possible scanno %s\n",
   1.532  			      linecnt,(int)(wordstart-aline)+2,inword);
   1.533  		    }
   1.534 -            if (pswit[PARANOID_SWITCH] && warn_digit)
   1.535 +            if (pswit[PARANOID_SWITCH] && warnings->digit)
   1.536  	    {
   1.537  		/* In paranoid mode, query all 0 and 1 standing alone. */
   1.538                  if (!strcmp(inword,"0") || !strcmp(inword,"1"))
   1.539 @@ -2089,7 +2089,7 @@
   1.540  		    printf("\n%s\n",aline);
   1.541  		if (!pswit[OVERVIEW_SWITCH])
   1.542  		    printf("    Line %ld column 1 - Wrongspaced quotes?\n",
   1.543 -		      linecnt,(int)(s-aline)+1);
   1.544 +		      linecnt);
   1.545  		else
   1.546  		    cnt_punct++;
   1.547  	    }
   1.548 @@ -2143,7 +2143,7 @@
   1.549           * e.g. "etc., etc.," and vol. 1.; vol 3.;
   1.550           * OTOH, from my initial tests, there are also fairly
   1.551           * common errors. What to do? Make these cases paranoid?
   1.552 -         * ".," is the most common, so warn_dotcomma is used
   1.553 +         * ".," is the most common, so warnings->dotcomma is used
   1.554           * to suppress detailed reporting if it occurs often.
   1.555  	 */
   1.556          llen=strlen(aline);
   1.557 @@ -2156,28 +2156,28 @@
   1.558  		/* followed by punctuation, it's a query, unless . . . */
   1.559                  if (aline[i]==aline[i+1] && (aline[i]=='.' || aline[i]=='?' ||
   1.560  		  aline[i]=='!') ||
   1.561 -		  !warn_dotcomma && aline[i]=='.' && aline[i+1]==',' ||
   1.562 -		  isFrench && !strncmp(aline+i,",...",4) ||
   1.563 -		  isFrench && !strncmp(aline+i,"...,",4) ||
   1.564 -		  isFrench && !strncmp(aline+i,";...",4) ||
   1.565 -		  isFrench && !strncmp(aline+i,"...;",4) ||
   1.566 -		  isFrench && !strncmp(aline+i,":...",4) ||
   1.567 -		  isFrench && !strncmp(aline+i,"...:",4) ||
   1.568 -		  isFrench && !strncmp(aline+i,"!...",4) ||
   1.569 -		  isFrench && !strncmp(aline+i,"...!",4) ||
   1.570 -		  isFrench && !strncmp(aline+i,"?...",4) ||
   1.571 -		  isFrench && !strncmp(aline+i,"...?",4))
   1.572 +		  !warnings->dotcomma && aline[i]=='.' && aline[i+1]==',' ||
   1.573 +		  warnings->isFrench && !strncmp(aline+i,",...",4) ||
   1.574 +		  warnings->isFrench && !strncmp(aline+i,"...,",4) ||
   1.575 +		  warnings->isFrench && !strncmp(aline+i,";...",4) ||
   1.576 +		  warnings->isFrench && !strncmp(aline+i,"...;",4) ||
   1.577 +		  warnings->isFrench && !strncmp(aline+i,":...",4) ||
   1.578 +		  warnings->isFrench && !strncmp(aline+i,"...:",4) ||
   1.579 +		  warnings->isFrench && !strncmp(aline+i,"!...",4) ||
   1.580 +		  warnings->isFrench && !strncmp(aline+i,"...!",4) ||
   1.581 +		  warnings->isFrench && !strncmp(aline+i,"?...",4) ||
   1.582 +		  warnings->isFrench && !strncmp(aline+i,"...?",4))
   1.583  		{
   1.584 -		    if (isFrench && !strncmp(aline+i,",...",4) ||
   1.585 -		      isFrench && !strncmp(aline+i,"...,",4) ||
   1.586 -		      isFrench && !strncmp(aline+i,";...",4) ||
   1.587 -		      isFrench && !strncmp(aline+i,"...;",4) ||
   1.588 -		      isFrench && !strncmp(aline+i,":...",4) ||
   1.589 -		      isFrench && !strncmp(aline+i,"...:",4) ||
   1.590 -		      isFrench && !strncmp(aline+i,"!...",4) ||
   1.591 -		      isFrench && !strncmp(aline+i,"...!",4) ||
   1.592 -		      isFrench && !strncmp(aline+i,"?...",4) ||
   1.593 -		      isFrench && !strncmp(aline+i,"...?",4))
   1.594 +		    if (warnings->isFrench && !strncmp(aline+i,",...",4) ||
   1.595 +		      warnings->isFrench && !strncmp(aline+i,"...,",4) ||
   1.596 +		      warnings->isFrench && !strncmp(aline+i,";...",4) ||
   1.597 +		      warnings->isFrench && !strncmp(aline+i,"...;",4) ||
   1.598 +		      warnings->isFrench && !strncmp(aline+i,":...",4) ||
   1.599 +		      warnings->isFrench && !strncmp(aline+i,"...:",4) ||
   1.600 +		      warnings->isFrench && !strncmp(aline+i,"!...",4) ||
   1.601 +		      warnings->isFrench && !strncmp(aline+i,"...!",4) ||
   1.602 +		      warnings->isFrench && !strncmp(aline+i,"?...",4) ||
   1.603 +		      warnings->isFrench && !strncmp(aline+i,"...?",4))
   1.604  			i+=4;
   1.605  		    ; /* do nothing for .. !! and ?? which can be legit */
   1.606  		}
   1.607 @@ -2280,7 +2280,7 @@
   1.608  	     * Dash at end of line may well be legit - paranoid mode only
   1.609               * and don't report em-dash at line-end.
   1.610  	     */
   1.611 -            if (pswit[PARANOID_SWITCH] && warn_hyphen)
   1.612 +            if (pswit[PARANOID_SWITCH] && warnings->hyphen)
   1.613  	    {
   1.614                  for (i=llen-1;i>0 && (unsigned char)aline[i]<=CHAR_SPACE;i--)
   1.615  		    ;
   1.616 @@ -2315,7 +2315,7 @@
   1.617  	    }
   1.618  	}
   1.619          llen=strlen(aline);
   1.620 -        if (warn_endquote)
   1.621 +        if (warnings->endquote)
   1.622  	{
   1.623              for (i=1;i<llen;i++)
   1.624  	    {