Skip to content

Commit

Permalink
feat(mac): enable some functions/makros
Browse files Browse the repository at this point in the history
  • Loading branch information
SabinePlay committed Apr 19, 2024
1 parent c407489 commit 7b98ea5
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 45 deletions.
2 changes: 1 addition & 1 deletion mac/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ setup/textinputsource/textinputsource.x86_64
setup/Install Keyman.app

//Sabine
**/*.exe
**/mcompile/executable/*.*
8 changes: 4 additions & 4 deletions mac/mcompile/deadkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################

/*


// create a vector for a dk combination ( ` + a -> à )
v_dw_1D createLine(std::string first, std::string second, KMX_DWORD number, std::string nameresult);
Expand All @@ -28,6 +28,6 @@ bool found_dk_inVector(KMX_WCHAR dk, std::vector<DeadKey*> &myVec);
bool query_dk_combinations_for_specific_dk(v_dw_2D * dk_ComposeTable, v_dw_2D & dk_SingleTable, KMX_DWORD dk);

// get the shifted character of a key and write shiftstate of KVal to shift
KMX_DWORD KMX_changeKeynameToCapital(KMX_DWORD KVal, KMX_DWORD &shift, GdkKeymap* keymap);
*/
# endif //DEADKEY_H
//KMX_DWORD KMX_changeKeynameToCapital(KMX_DWORD KVal, KMX_DWORD &shift, GdkKeymap* keymap);

# endif//DEADKEY_H
17 changes: 8 additions & 9 deletions mac/mcompile/keymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ KMX_DWORD get_keyval_From_Keycode(std::vector<int> keyval, int shiftstate,const
#include <iostream>
#include <string>
#include <vector>
*/

enum ShiftState {
Base = 0, // 0
Expand Down Expand Up @@ -100,7 +100,7 @@ int map_VKShiftState_to_LinModifier(int VKShiftState);
KMX_DWORD convertNamesTo_DWORD_Value(std::string tok_str);

// create a Vector with all entries of both keymaps
int createOneVectorFromBothKeyboards(v_dw_3D &All_Vector,GdkKeymap *keymap);
//int createOneVectorFromBothKeyboards(v_dw_3D &All_Vector,GdkKeymap *keymap);

// read configuration file, split and write to 3D-Vector (Data for US on Vector[0][ ][ ] )
int write_US_ToVector(v_dw_3D &vec, std::string language, const char *text);
Expand All @@ -118,10 +118,10 @@ int split_US_To_3D_Vector(v_dw_3D &all_US, v_str_1D completeList);
v_dw_2D create_empty_2D_Vector(int dim_rows, int dim_shifts);

// append characters to 3D-Vector using GDK (Data for underlying Language on Vector[1][ ][ ] )
int append_underlying_ToVector(v_dw_3D &All_Vector, GdkKeymap *keymap);
//int append_underlying_ToVector(v_dw_3D &All_Vector, GdkKeymap *keymap);

// initialize GDK
bool InitializeGDK(GdkKeymap **keymap,int argc, gchar *argv[]);
//bool InitializeGDK(GdkKeymap **keymap,int argc, gchar *argv[]);

//------------------------------

Expand Down Expand Up @@ -530,19 +530,19 @@ bool IsKeymanUsedChar(int KV);
std::u16string convert_DeadkeyValues_To_U16str(int in);

// use gdk_keymap_translate_keyboard_state to get keyval - base function to get keyvals
int KMX_get_KeyVal_From_KeyCode(GdkKeymap *keymap, guint keycode, ShiftState ss, int caps);
//int KMX_get_KeyVal_From_KeyCode(GdkKeymap *keymap, guint keycode, ShiftState ss, int caps);

// use KMX_get_KeyVal_From_KeyCode and prevent use of certain keycodes
KMX_DWORD KMX_get_KeyValUnderlying_From_KeyCodeUnderlying(GdkKeymap *keymap, guint keycode, int shift_state_pos);
//KMX_DWORD KMX_get_KeyValUnderlying_From_KeyCodeUnderlying(GdkKeymap *keymap, guint keycode, int shift_state_pos);

// fill Deadkey with dk and return CATEGORY
KMX_DWORD KMX_get_KeyValUnderlying_From_KeyCodeUnderlying(GdkKeymap *keymap, UINT VKShiftState, UINT KC_underlying, PKMX_WCHAR DeadKey);
//KMX_DWORD KMX_get_KeyValUnderlying_From_KeyCodeUnderlying(GdkKeymap *keymap, UINT VKShiftState, UINT KC_underlying, PKMX_WCHAR DeadKey);

// use Vector to return the Keyval of underlying Keyboard
KMX_WCHAR KMX_get_KeyValUnderlying_From_KeyValUS(v_dw_3D &All_Vector,KMX_DWORD VK_underlying);

// use Vector to return the Keycode of the underlying Keyboard for given VK_US using GDK
KMX_DWORD KMX_get_KeyCodeUnderlying_From_KeyCodeUS(GdkKeymap *keymap, v_dw_3D &All_Vector,KMX_DWORD KC_US, ShiftState ss, int caps);
//KMX_DWORD KMX_get_KeyCodeUnderlying_From_KeyCodeUS(GdkKeymap *keymap, v_dw_3D &All_Vector,KMX_DWORD KC_US, ShiftState ss, int caps);

// return the Keycode of the underlying Keyboard for given VK_US
UINT KMX_get_KeyCodeUnderlying_From_VKUS(KMX_DWORD VirtualKeyUS);
Expand All @@ -553,7 +553,6 @@ KMX_DWORD KMX_get_VKUS_From_KeyCodeUnderlying(KMX_DWORD keycode);
// convert codePoint to u16string
std::u16string CodePointToU16String(unsigned int codepoint);

# endif// //KEYMAP_H*/



Expand Down
12 changes: 6 additions & 6 deletions mac/mcompile/kmx_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Copyright: Copyright (C) 2003-2018 SIL International.
Authors: mcdurdin
*/
/*


#define UNREFERENCED_PARAMETER(P) (P)
#define TRUNCATE ((size_t)-1)
Expand Down Expand Up @@ -183,9 +183,9 @@ namespace kmx {

#define U_UC_SENTINEL u"\uFFFF"

//
* VK__MAX defines the highest virtual key code defined in the system = 0xFF. Custom VK codes start at 256
//
/*
VK__MAX defines the highest virtual key code defined in the system = 0xFF. Custom VK codes start at 256
*/
#define VK__MAX 255

#define CODE_ANY 0x01
Expand Down Expand Up @@ -360,7 +360,7 @@ struct KMX_COMP_KEYBOARD_KMXPLUSINFO {
};

//
* Only valid if comp_keyboard.dwFlags&KF_KMXPLUS
//* Only valid if comp_keyboard.dwFlags&KF_KMXPLUS
//
struct KMX_COMP_KEYBOARD_EX {
KMX_COMP_KEYBOARD header; // 0000 see COMP_KEYBOARD
Expand Down Expand Up @@ -390,5 +390,5 @@ static_assert(sizeof(KMX_COMP_KEYBOARD) == KEYBOARDFILEHEADER_SIZE, "COMP_KEYBOA
} // namespace kmx
} // namespace kbp
} // namespace km
#endif*/
#endif
#endif //KMX_FILE_H
11 changes: 6 additions & 5 deletions mac/mcompile/mc_import_rules.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


/*
Name: mc_import_rules
Copyright: Copyright (C) SIL International.
Expand Down Expand Up @@ -28,10 +27,6 @@
#include "mc_kmxfile.h"
#include "keymap.h"

/*//################################################################################################################################################
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################
const int KMX_ShiftStateMap[] = {
ISVIRTUALKEY,
ISVIRTUALKEY | K_SHIFTFLAG,
Expand Down Expand Up @@ -68,6 +63,12 @@ bool DeadKey::KMX_ContainsBaseCharacter(KMX_WCHAR baseCharacter) {
return false;
}

/*//################################################################################################################################################
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################
int KMX_ToUnicodeEx(guint keycode, PKMX_WCHAR pwszBuff, int shift_state_pos, int caps,GdkKeymap *keymap) {
GdkKeymapKey *maps;
guint *keyvals;
Expand Down
4 changes: 2 additions & 2 deletions mac/mcompile/mc_import_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//################################################################################################################################################
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################
/*



class DeadKey {
Expand Down Expand Up @@ -39,5 +39,5 @@ class DeadKey {

bool KMX_ContainsBaseCharacter(KMX_WCHAR baseCharacter);
};
*/

# endif //MC_IMPORT_RULES_H
11 changes: 6 additions & 5 deletions mac/mcompile/mc_kmxfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################

/*

KMX_BOOL KMX_VerifyKeyboard(LPKMX_BYTE filebase, KMX_DWORD sz);

LPKMX_KEYBOARD KMX_FixupKeyboard(PKMX_BYTE bufp, PKMX_BYTE base, KMX_DWORD dwFileSize);
/*
KMX_BOOL KMX_SaveKeyboard(LPKMX_KEYBOARD kbd, PKMX_WCHAR filename) {
FILE *fp;
Expand All @@ -41,7 +41,7 @@ KMX_BOOL KMX_SaveKeyboard(LPKMX_KEYBOARD kbd, PKMX_WCHAR filename) {
}
return TRUE;
}
}*/

KMX_DWORD KMX_WriteCompiledKeyboard(LPKMX_KEYBOARD fk, FILE* hOutfile, KMX_BOOL FSaveDebug) {

Expand Down Expand Up @@ -227,6 +227,8 @@ PKMX_WCHAR KMX_StringOffset(PKMX_BYTE base, KMX_DWORD offset) {
return (PKMX_WCHAR)(base + offset);
}


/*
#ifdef KMX_64BIT
*/
/** CopyKeyboard will copy the data read into bufp from x86-sized structures into
Expand All @@ -235,7 +237,6 @@ PKMX_WCHAR KMX_StringOffset(PKMX_BYTE base, KMX_DWORD offset) {
we don't copy the strings
This method is used on 64-bit architectures.
*/
/*
LPKMX_KEYBOARD KMX_CopyKeyboard(PKMX_BYTE bufp, PKMX_BYTE base) {
PKMX_COMP_KEYBOARD ckbp = (PKMX_COMP_KEYBOARD) base;

Expand Down Expand Up @@ -311,7 +312,7 @@ LPKMX_KEYBOARD KMX_CopyKeyboard(PKMX_BYTE bufp, PKMX_BYTE base) {
}
return kbp;
}
*/

// else KMX_FixupKeyboard
//#else /* Fixup the keyboard by expanding pointers. On disk the pointers are stored relative to the
// beginning of the file, but we need real pointers. This method is used on 32-bit architectures.
Expand Down
13 changes: 5 additions & 8 deletions mac/mcompile/mc_kmxfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@

#ifndef _KMXFILE_H
#define _KMXFILE_H
//################################################################################################################################################
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################

/*

typedef struct KMX_tagSTORE {
KMX_DWORD dwSystemID;
Expand Down Expand Up @@ -84,7 +77,11 @@ KMX_BOOL KMX_LoadKeyboard(char16_t* fileName, LPKMX_KEYBOARD *lpKeyboard);
KMX_BOOL KMX_SaveKeyboard(LPKMX_KEYBOARD kbd, PKMX_WCHAR filename);

KMX_DWORD KMX_WriteCompiledKeyboard(LPKMX_KEYBOARD fk, FILE* hOutfile, KMX_BOOL FSaveDebug);
*/

#endif // _KMXFILE_H

#endif //MC_KMXFILE_H

//################################################################################################################################################
//################################# Code beyond these lines needs to be included in mcompile #####################################################
//################################################################################################################################################
9 changes: 4 additions & 5 deletions mac/mcompile/mcompile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "keymap.h"
#include <vector>
#include "deadkey.h"
#include "mc_kmxfile.h"

/*
Name: mcompile
Expand All @@ -29,9 +31,7 @@
//################################################################################################################################################


/*
#include "deadkey.h"
#include "mc_kmxfile.h"


struct KMX_DeadkeyMapping { // I4353
KMX_WCHAR deadkey, dkid;
Expand All @@ -45,11 +45,10 @@ int run(int argc, std::vector<std::u16string> str_argv, char* argv[]);

PKMX_WCHAR KMX_incxstr(PKMX_WCHAR p);

int KMX_GetDeadkeys(v_dw_2D & dk_Table, KMX_WORD DeadKey, KMX_WORD *OutputPairs, GdkKeymap* keymap);
//int KMX_GetDeadkeys(v_dw_2D & dk_Table, KMX_WORD DeadKey, KMX_WORD *OutputPairs, GdkKeymap* keymap);

void KMX_LogError(const wchar_t* fmt, ...);

#endif*/ /*MCOMPILE_H*/



Expand Down

0 comments on commit 7b98ea5

Please sign in to comment.