Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -36,22 +36,22 @@ generates.
char *Buffer, CharFlag = 0;
if (argc != 2) {
printf(“usage: wc <filename>\n”);
printf("usage: wc <filename>\n");
exit(1);
}
if ((Buffer = malloc(BUFFER_SIZE)) == NULL) {
printf(“Can’t allocate adequate memory\n”);
printf("Can't allocate adequate memory\n");
exit(1);
}
if ((Handle = open(argv[1], O_RDONLY | O_BINARY)) == -1) {
printf(“Can’t open file %s\n”, argv[1]);
printf("Can't open file %s\n", argv[1]);
exit(1);
}
if ((FileSize = filelength(Handle)) == -1) {
printf(“Error sizing file %s\n”, argv[1]);
printf("Error sizing file %s\n", argv[1]);
exit(1);
}
@ -59,7 +59,7 @@ generates.
while (FileSize > 0) {
FileSize -= (BlockSize = min(FileSize, BUFFER_SIZE));
if (read(Handle, Buffer, BlockSize) == -1) {
printf(“Error reading file %s\n”, argv[1]);
printf("Error reading file %s\n", argv[1]);
exit(1);
}
ScanBuffer(Buffer, BlockSize, &CharFlag, &WordCount);
@ -69,7 +69,7 @@ generates.
if (CharFlag) {
WordCount++;
}
printf(“\nTotal words in file: %lu\n”, WordCount);
printf("\nTotal words in file: %lu\n", WordCount);
return(0);
}
@ -98,9 +98,9 @@ generates.
.code
public _ScanBuffer
_ScanBuffer proc near
push bp ;preserve caller’s stack frame
push bp ;preserve caller's stack frame
mov bp,sp ;set up local stack frame
push si ;preserve caller’s register vars
push si ;preserve caller's register vars
push di
mov si,[bp+Buffer] ;point to buffer to scan
@ -116,19 +116,19 @@ generates.
and al,7fh ;strip high bit for word processors
; that set it as an internal flag
mov bl,1 ;assume this is a char; CharFlag = 1;
cmp al,‘a’ ;it is a char if between a and z
cmp al,‘a' ;it is a char if between a and z
jb CheckAZ
cmp al,‘z’
cmp al,‘z'
jna IsAChar
CheckAZ:
cmp al,‘A’ ;it is a char if between A and Z
cmp al,‘A' ;it is a char if between A and Z
jb Check09
cmp al,‘Z’
cmp al,‘Z'
jna IsAChar
Check09:
cmp al,‘0’ ;it is a char if between 0 and 9
cmp al,‘0' ;it is a char if between 0 and 9
jb CheckApostrophe
cmp al,‘9’
cmp al,‘9'
jna IsAChar
CheckApostrophe:
cmp al,27h ;it is a char if an apostrophe
@ -149,9 +149,9 @@ generates.
mov [bx],cx ;set new word count
mov [bx+2],dx
pop di ;restore caller’s register vars
pop di ;restore caller's register vars
pop si
pop bp ;restore caller’s stack frame
pop bp ;restore caller's stack frame
ret
_ScanBuffer endp
end
@ -160,10 +160,10 @@ generates.
We could rearrange the tests in light of the nature of the data being
scanned; for example, we could perform the tests more efficiently by
taking advantage of the knowledge that if a byte is less than ‘0,’ it’s
taking advantage of the knowledge that if a byte is less than ‘0,' it's
either an apostrophe or not a character at all. However, that sort of
fine-tuning is typically good for speedups of only 10 to 20 percent, and
I’ve intentionally refrained from implementing this in Listing 16.3 to
I've intentionally refrained from implementing this in Listing 16.3 to
avoid pointing you down the wrong path; what we need is a different tack
altogether. Ponder this. What we *really* want to know is nothing more
than whether a byte is a character, not what sort of character it is.