mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-19 06:47:41 +00:00
The name compiler.h was misleading, so renamed to legacy_kmx_file.h, as it largely describes .kmx files. There are two declarations in the file which are specific to kmcmpdll, at the bottom of the file, but everything else is all related to the .kmx file format. (We may move those in a future update to kmcmpdll, but that should wait until the kmcmpdll cross-platform refactor is complete.) Moved to common/windows/cpp/include/ because it is used by both Developer and Windows projects. Where possible, removed redundant references, as compfile.h includes legacy_kmx_file.h anyway.
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
|
|
#include "pch.h"
|
|
|
|
#include <compfile.h>
|
|
#include <comperr.h>
|
|
#include <kmcmpdll.h>
|
|
|
|
#include "CheckForDuplicates.h"
|
|
|
|
|
|
DWORD CheckForDuplicateGroup(PFILE_KEYBOARD fk, PFILE_GROUP gp) noexcept {
|
|
DWORD i;
|
|
PFILE_GROUP gp0 = fk->dpGroupArray;
|
|
for (i = 0; i < fk->cxGroupArray; i++, gp0++) {
|
|
if (gp0 == gp) {
|
|
continue;
|
|
}
|
|
if (_wcsicmp(gp0->szName, gp->szName) == 0) {
|
|
wsprintf(ErrExtra, "Group '%ls' declared on line %d", gp0->szName, gp0->Line);
|
|
return CERR_DuplicateGroup;
|
|
}
|
|
}
|
|
return CERR_None;
|
|
}
|
|
|
|
DWORD CheckForDuplicateStore(PFILE_KEYBOARD fk, PFILE_STORE sp) noexcept {
|
|
if (!sp->szName[0]) {
|
|
// Stores with zero length names are reserved system stores.
|
|
// They cannot be defined in user code. This is not an issue.
|
|
return CERR_None;
|
|
}
|
|
DWORD i;
|
|
PFILE_STORE sp0 = fk->dpStoreArray;
|
|
for (i = 0; i < fk->cxStoreArray; i++, sp0++) {
|
|
if (sp0 == sp) {
|
|
continue;
|
|
}
|
|
if (_wcsicmp(sp0->szName, sp->szName) == 0) {
|
|
wsprintf(ErrExtra, "Store '%ls' declared on line %d", sp0->szName, sp0->line);
|
|
return CERR_DuplicateStore;
|
|
}
|
|
}
|
|
return CERR_None;
|
|
}
|