Home » Archimedes archive » Archimedes World » AW-1991-09.adf » AWSept91 » !AWSep91/Goodies/AllAtC/work/c/lexical
!AWSep91/Goodies/AllAtC/work/c/lexical
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » AW-1991-09.adf » AWSept91 |
Filename: | !AWSep91/Goodies/AllAtC/work/c/lexical |
Read OK: | ✔ |
File size: | 01F5 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Archimedes archive » Archimedes World » AW-1991-08.adf » August91 » !AWAug91/Goodies/C/!Words/work/c/lexical
- Archimedes archive » Archimedes World » AW-1991-09.adf » AWSept91 » !AWSep91/Goodies/AllAtC/work/c/lexical
File contents
/* Lexical Functions. */ /* Archimedes World, August 1991. */ #include "lexical.h" #include <ctype.h> void ToUpperCase( char *word ) { /* Converts the given word to upper case. */ char *ptr = word; while ( *ptr ) { *ptr = toupper( *ptr ); ptr++; } } void ToLowerCase( char *word ) { /* Converts the given word to lower case. */ char *ptr = word; while ( *ptr ) { *ptr = tolower( *ptr ); ptr++; } }
00000000 2f 2a 20 20 4c 65 78 69 63 61 6c 20 46 75 6e 63 |/* Lexical Func| 00000010 74 69 6f 6e 73 2e 20 20 20 20 20 20 20 20 20 20 |tions. | 00000020 20 20 20 20 20 20 20 20 20 20 2a 2f 0a 2f 2a 20 | */./* | 00000030 20 41 72 63 68 69 6d 65 64 65 73 20 57 6f 72 6c | Archimedes Worl| 00000040 64 2c 20 41 75 67 75 73 74 20 31 39 39 31 2e 20 |d, August 1991. | 00000050 20 20 20 20 20 20 20 2a 2f 0a 0a 23 69 6e 63 6c | */..#incl| 00000060 75 64 65 20 22 6c 65 78 69 63 61 6c 2e 68 22 0a |ude "lexical.h".| 00000070 23 69 6e 63 6c 75 64 65 20 3c 63 74 79 70 65 2e |#include <ctype.| 00000080 68 3e 0a 0a 0a 76 6f 69 64 20 54 6f 55 70 70 65 |h>...void ToUppe| 00000090 72 43 61 73 65 28 20 63 68 61 72 20 2a 77 6f 72 |rCase( char *wor| 000000a0 64 20 29 0a 7b 0a 2f 2a 20 20 43 6f 6e 76 65 72 |d ).{./* Conver| 000000b0 74 73 20 74 68 65 20 67 69 76 65 6e 20 77 6f 72 |ts the given wor| 000000c0 64 20 74 6f 20 75 70 70 65 72 20 63 61 73 65 2e |d to upper case.| 000000d0 20 2a 2f 0a 0a 20 20 20 20 63 68 61 72 20 2a 70 | */.. char *p| 000000e0 74 72 20 3d 20 77 6f 72 64 3b 0a 0a 20 20 20 20 |tr = word;.. | 000000f0 77 68 69 6c 65 20 28 20 2a 70 74 72 20 29 0a 20 |while ( *ptr ). | 00000100 20 20 20 7b 0a 20 20 20 20 20 20 20 2a 70 74 72 | {. *ptr| 00000110 20 3d 20 74 6f 75 70 70 65 72 28 20 2a 70 74 72 | = toupper( *ptr| 00000120 20 29 3b 0a 20 20 20 20 20 20 20 20 70 74 72 2b | );. ptr+| 00000130 2b 3b 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 76 6f 69 |+;. }.}...voi| 00000140 64 20 54 6f 4c 6f 77 65 72 43 61 73 65 28 20 63 |d ToLowerCase( c| 00000150 68 61 72 20 2a 77 6f 72 64 20 29 0a 7b 0a 2f 2a |har *word ).{./*| 00000160 20 20 43 6f 6e 76 65 72 74 73 20 74 68 65 20 67 | Converts the g| 00000170 69 76 65 6e 20 77 6f 72 64 20 74 6f 20 6c 6f 77 |iven word to low| 00000180 65 72 20 63 61 73 65 2e 20 2a 2f 0a 0a 20 20 20 |er case. */.. | 00000190 20 63 68 61 72 20 2a 70 74 72 20 3d 20 77 6f 72 | char *ptr = wor| 000001a0 64 3b 0a 0a 20 20 20 20 77 68 69 6c 65 20 28 20 |d;.. while ( | 000001b0 2a 70 74 72 20 29 0a 20 20 20 20 7b 0a 20 20 20 |*ptr ). {. | 000001c0 20 20 20 20 2a 70 74 72 20 3d 20 74 6f 6c 6f 77 | *ptr = tolow| 000001d0 65 72 28 20 2a 70 74 72 20 29 3b 0a 20 20 20 20 |er( *ptr );. | 000001e0 20 20 20 20 70 74 72 2b 2b 3b 0a 20 20 20 20 7d | ptr++;. }| 000001f0 0a 7d 0a 0a 0a |.}...| 000001f5