/**********************************************************************/ /*** vefc.c WA8YCD ***/ /*** Ver 2.4 02 Sep 89 ***/ /*** ***/ /*** This utility provides a counting aid, a character inclusion ***/ /*** list, and sending time at 5, 13, and 20 wpm. ***/ /*** ***/ /*** usage: vefc textfile reportfile [report to file] ***/ /*** or vefc textfile [report to screen] ***/ /*** or vefc textfile > prn [report to printer] ***/ /*** ____________________________________________________________ ***/ /*** Change history: ***/ /*** 890505 WA8YCD 1.0 - original version--exclusions only ***/ /*** 890521 WA8YCD 2.0 - display input with count columns ***/ /*** 890525 WA8YCD 2.1 - include AND exclude list in report ***/ /*** 890902 WA8YCD 2.2 - add counts to report for each letter ***/ /*** 890908 WA8YCD 2.3 - Oops-Didn't print counts if all letters ***/ /*** were there. Also print input file name. ***/ /*** 891227 WA8YCD 2.4 - Latest data says numbers, punctuation, ***/ /*** and prosigns ALL count as 2. Also, the ***/ /*** newest SuperMorse (SM305) uses "=" not ***/ /*** "-" for now. ***/ /*** ____________________________________________________________ ***/ /*** Copyright (c) 1989 Robert L. West, Jr., WA8YCD ***/ /*** Distribution of this program is allowed provided no monetary ***/ /*** compensation beyond reasonable reproduction costs is made. ***/ /*** It is provided as a public service to the amateur community. ***/ /*** ____________________________________________________________ ***/ /*** Compiled using Turbo C Version 2.0 under MS-DOS 3.3 ***/ /*** Turbo C (tm) Borland International. MS (r) MicroSoft Corp. ***/ /**********************************************************************/ #include #define MIN_LTR 65 #define MAX_LTR 91 #define MIN_NUM 48 #define MAX_NUM 58 #define SK 36 #define COMMA 44 #define PERIOD 46 #define DN 47 #define BT 61 /* 2.4 */ #define QUERY 63 #define AR 64 #define LENGTH_5 25 #define LENGTH_13 65 #define LENGTH_20 100 #define TRUE 1 #define FALSE 0 main(argc, argv) int argc; char *argv[]; { int i, no_zeros=1, output_to_file; long inch=0, counts[256]; float test_time_5, test_time_13, test_time_20; char c; FILE *fopen(), *infile, *outfile; /* first, see if the correct number of parameters are given... */ if (argc < 2) { printf("\nusage:\n freq input-filename [output-filename]\n"); printf("\n if output-filename is omitted display appears \n"); printf(" on the screen.\n\n"); exit(); } /* next, see if the first parameter can be opened as an input file... */ if ((infile = fopen(argv[1], "rb")) == NULL) { printf("\nUnable to open input file, \"%s\"!\n\n", argv[1]); printf("vefc: abnormal termination.\n"); exit(); } /* now, see if the second parameter can be opened as an output file... */ if (argc == 3) { if ((outfile = fopen(argv[2], "w")) == NULL) { printf("\nUnable to open output file, \"%s\"!\n\n", argv[2]); printf("vefc: abnormal termination.\n"); exit(); } } else { if ((outfile = fopen("CON", "w")) == NULL) { printf("\nUnable to open console for output!\n\n"); printf("vefc: abnormal termination.\n"); exit(); } } /*************************************************************************/ /*** ***/ /*************************************************************************/ fprintf(outfile, "- VE CODE EXAM VALIDATER ver 2.4, 12/27/89 -\n"); fprintf(outfile, " Input File: \"%s\"\n", argv[1]); fprintf(outfile, "\n"); fprintf(outfile, " "); fprintf(outfile, "....5...10...15...20...25"); fprintf(outfile, " "); fprintf(outfile, "...30...35...40...45...50\n"); fprintf(outfile, "%7ld ", inch); for (i=0; i<256; i++) counts[i]=0; while((c=getc(infile)) != EOF) { if (c>='a' && c<='z') c=c-'a'+'A'; switch((int)c) { case 'A': case 'F': case 'K': case 'P': case 'U': case 'B': case 'G': case 'L': case 'Q': case 'V': case 'C': case 'H': case 'M': case 'R': case 'W': case 'D': case 'I': case 'N': case 'S': case 'X': case 'E': case 'J': case 'O': case 'T': case 'Y': case 'Z': counts[(int)c]++; fprintf(outfile, "%c", c); if ( !(++inch % 50) ) { fprintf(outfile, "\n%7ld ", inch); } else { if ( !(inch % 25) ) fprintf(outfile, " "); } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '/': case '@': case '$': case '=': case '.': case ',': case '?': counts[(int)c]++; fprintf(outfile, "%c", c); if ( !(++inch % 50) ) { fprintf(outfile, "\n%7ld ", inch); } else { if ( !(inch % 25) ) fprintf(outfile, " "); } fprintf(outfile, "_"); if ( !(++inch % 50) ) { fprintf(outfile, "\n%7ld ", inch); } else { if ( !(inch % 25) ) fprintf(outfile, " "); } break; default: break; } } fclose(infile); /* We're finished with the input file, so close it */ no_zeros = TRUE; for (i=MIN_LTR; i