spiegel-keyman/developer/kmcompx/include/XX/kmx_debugger.h
Sabine 3e58fa76b6 get keymans version
Merge branch 'master' of https://github.com/keymanapp/keyman into refactor/developer/6026-kmcompx-compiler-cross-platform-part-2-NEW_VERSION

# Conflicts:
#	common/core/desktop/src/kmx/kmx_context.h
#	common/core/desktop/src/kmx/kmx_processor.cpp
#	common/windows/cpp/include/keymanversion.h
#	common/windows/cpp/include/kkmnkbd/Compfile.h
#	common/windows/cpp/include/kmtip_guids.h
#	common/windows/cpp/src/kmtip_guids.cpp
#	core/src/kmx/kmx_conversion.cpp
#	core/src/kmx/kmx_conversion.h
#	core/src/kmx/kmx_file.cpp
#	core/src/kmx/kmx_processevent.cpp
#	core/src/kmx/kmx_processor.hpp
#	core/src/kmx/kmx_xstring.cpp
#	developer/js/.gitignore
#	developer/js/package-lock.json
#	developer/js/tests/tsconfig.json
#	developer/src/kmcmpdll/CasedKeys.cpp
#	developer/src/kmcmpdll/CheckFilenameConsistency.cpp
#	developer/src/kmcmpdll/CheckFilenameConsistency.h
#	developer/src/kmcmpdll/CheckForDuplicates.cpp
#	developer/src/kmcmpdll/CheckForDuplicates.h
#	developer/src/kmcmpdll/CheckNCapsConsistency.cpp
#	developer/src/kmcmpdll/CheckNCapsConsistency.h
#	developer/src/kmcmpdll/Compiler.cpp
#	developer/src/kmcmpdll/DeprecationChecks.cpp
#	developer/src/kmcmpdll/NamedCodeConstants.cpp
#	developer/src/kmcmpdll/UnreachableRules.cpp
#	developer/src/kmcmpdll/UnreachableRules.h
#	developer/src/kmcmpdll/compfile.h
#	developer/src/kmcmpdll/kcframe/kcframe.cpp
#	developer/src/kmcmpdll/kcframe/kcframe.vcxproj
#	developer/src/kmcmpdll/kcframe/kcframe.vcxproj.filters
#	developer/src/kmcmpdll/kmcmpdll.vcxproj
#	developer/src/kmcmpdll/kmcmpdll.vcxproj.filters
#	developer/src/kmcmpdll/version.rc
#	developer/src/kmcmpdll/versioning.cpp
#	developer/src/kmlmc/bundle.sh
#	developer/src/kmlmc/tests/test-join-word-breaker.ts
#	developer/src/kmlmc/tests/test-override-script-defaults.ts
#	developer/src/server/tsconfig.json
#	windows/src/developer/kmcmpdll/Makefile
#	windows/src/developer/kmcmpdll/vkeys.h
#	windows/src/engine/keyman32/keymanengine.h
#	windows/src/global/inc/Vkeys.h
#	windows/src/global/inc/rc4.h
#	windows/src/global/vc/rc4.cpp
2022-07-12 10:43:20 +02:00

146 lines
No EOL
3.7 KiB
C++

/*
* Keyman is copyright (C) SIL International. MIT License.
*
* Keyman Core - KMX Debugger header
*
* Wrapper class for debug_items for kmx debugger, with
* helper functions for pushing different types of debug
* events.
*/
#pragma once
#include "../kmcompx.h" // old: #include "kmx_base.h"
#include "debug.hpp"
namespace km {
namespace kbp {
namespace kmx {
class KMX_DebugItems
{
private:
debug_items *_items;
void push_item(
uint8_t type,
uint16_t first_action,
uint32_t flags = 0,
LPKMX_GROUP group = nullptr,
LPKMX_KEY key = nullptr,
PKMX_WCHAR context = nullptr,
PKMX_WORD index_stack = nullptr
);
void fill_store_offsets(
km_kbp_state_debug_kmx_info *info,
PKMX_WORD index_stack
);
public:
KMX_DebugItems(debug_items *items);
void push_begin(km_kbp_state_debug_key_info *key_info, uint32_t flags);
void push_end(uint16_t first_action, uint32_t flags);
void push_group_enter(uint16_t first_action, LPKMX_GROUP group);
void push_group_exit(uint16_t first_action, uint32_t flags, LPKMX_GROUP group);
void push_nomatch_enter(uint16_t first_action, LPKMX_GROUP group);
void push_nomatch_exit(uint16_t first_action, LPKMX_GROUP group);
void push_match_enter(uint16_t first_action, LPKMX_GROUP group);
void push_match_exit(uint16_t first_action, LPKMX_GROUP group);
void push_rule_enter(
uint16_t first_action,
LPKMX_GROUP group,
LPKMX_KEY key,
PKMX_WCHAR context,
PKMX_WORD index_stack
);
void push_rule_exit(
uint16_t first_action,
LPKMX_GROUP group,
LPKMX_KEY key,
PKMX_WCHAR context,
PKMX_WORD index_stack
);
void push_set_option(
uint16_t first_action,
LPKMX_STORE option_store,
KMX_WCHAR const * value
);
};
inline
KMX_DebugItems::KMX_DebugItems(debug_items *items) {
assert(items);
_items = items;
}
inline void
KMX_DebugItems::push_begin(
km_kbp_state_debug_key_info *key_info,
uint32_t flags
) {
// As the vector always starts with a single KM_KBP_DEBUG_END entry,
// we clear that and any other potential events first before starting a new event sequence
_items->clear();
_items->push_begin(key_info, flags);
}
inline void
KMX_DebugItems::push_end(
uint16_t first_action,
uint32_t flags
) {
_items->push_end(first_action, flags);
}
inline void
KMX_DebugItems::push_group_enter(uint16_t first_action, LPKMX_GROUP group) {
push_item(KM_KBP_DEBUG_GROUP_ENTER, first_action, 0, group);
}
inline void
KMX_DebugItems::push_group_exit(uint16_t first_action, uint32_t flags, LPKMX_GROUP group) {
push_item(KM_KBP_DEBUG_GROUP_EXIT, first_action, flags, group);
}
inline void
KMX_DebugItems::push_nomatch_enter(uint16_t first_action, LPKMX_GROUP group) {
push_item(KM_KBP_DEBUG_NOMATCH_ENTER, first_action, 0, group);
}
inline void
KMX_DebugItems::push_nomatch_exit(uint16_t first_action, LPKMX_GROUP group) {
push_item(KM_KBP_DEBUG_NOMATCH_EXIT, first_action, 0, group);
}
inline void
KMX_DebugItems::push_match_enter(uint16_t first_action, LPKMX_GROUP group) {
push_item(KM_KBP_DEBUG_MATCH_ENTER, first_action, 0, group);
}
inline void
KMX_DebugItems::push_match_exit(uint16_t first_action, LPKMX_GROUP group) {
push_item(KM_KBP_DEBUG_MATCH_EXIT, first_action, 0, group);
}
inline void
KMX_DebugItems::push_rule_enter(
uint16_t first_action,
LPKMX_GROUP group,
LPKMX_KEY key,
PKMX_WCHAR context,
PKMX_WORD index_stack
) {
push_item(KM_KBP_DEBUG_RULE_ENTER, first_action, 0, group, key, context, index_stack);
}
inline void
KMX_DebugItems::push_rule_exit(
uint16_t first_action,
LPKMX_GROUP group,
LPKMX_KEY key,
PKMX_WCHAR context,
PKMX_WORD index_stack
) {
push_item(KM_KBP_DEBUG_RULE_EXIT, first_action, 0, group, key, context, index_stack);
}
} // namespace kmx
} // namespace kbp
} // namespace km