fixed convert-to-lower-case function so keywords may contain underscore in future

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@246 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2020-06-21 15:16:38 +00:00
parent 5b37c4d24e
commit 85f0c32ff4
2 changed files with 9 additions and 4 deletions

View File

@ -109,7 +109,8 @@ static char *ensure_free_space(struct dynabuf *db, int size)
void DynaBuf_to_lower(struct dynabuf *target, struct dynabuf *source) void DynaBuf_to_lower(struct dynabuf *target, struct dynabuf *source)
{ {
char *read, char *read,
*write; *write,
byte;
// make sure target can take it // make sure target can take it
if (source->size > target->reserved) if (source->size > target->reserved)
@ -117,8 +118,12 @@ void DynaBuf_to_lower(struct dynabuf *target, struct dynabuf *source)
// convert to lower case // convert to lower case
read = source->buffer; // CAUTION - ptr may change when buf grows! read = source->buffer; // CAUTION - ptr may change when buf grows!
write = target->buffer; // CAUTION - ptr may change when buf grows! write = target->buffer; // CAUTION - ptr may change when buf grows!
while (*read) while ((byte = *read++)) {
*write++ = (*read++) | 32; // we want to keep underscore, so this check restricts:
if (byte <= 'Z')
byte |= 32;
*write++ = byte;
}
// Okay, so this method of converting to lowercase is lousy. // Okay, so this method of converting to lowercase is lousy.
// But actually it doesn't matter, because only pre-defined // But actually it doesn't matter, because only pre-defined
// keywords are converted, and all of those are plain // keywords are converted, and all of those are plain

View File

@ -9,7 +9,7 @@
#define RELEASE "0.96.5" // update before release FIXME #define RELEASE "0.96.5" // update before release FIXME
#define CODENAME "Fenchurch" // update before release #define CODENAME "Fenchurch" // update before release
#define CHANGE_DATE "20 June" // update before release FIXME #define CHANGE_DATE "21 June" // update before release FIXME
#define CHANGE_YEAR "2020" // update before release #define CHANGE_YEAR "2020" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME