mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Add new generate-case-insensitive-mapping.js
to make generating mappings easier.
This commit is contained in:
parent
b403527131
commit
bb955ab8b9
50
script/generate-case-insensitive-mapping.js
Normal file
50
script/generate-case-insensitive-mapping.js
Normal file
@ -0,0 +1,50 @@
|
||||
const mappings = [
|
||||
/* basic Russian: https://github.com/clangen/musikcube/issues/613 */
|
||||
'а:А',
|
||||
'б:Б',
|
||||
'в:В',
|
||||
'г:Г',
|
||||
'д:Д',
|
||||
'е:Е',
|
||||
'ё:Ё',
|
||||
'ж:Ж',
|
||||
'з:З',
|
||||
'и:И',
|
||||
'й:Й',
|
||||
'к:К',
|
||||
'л:Л',
|
||||
'м:М',
|
||||
'н:Н',
|
||||
'о:О',
|
||||
'п:П',
|
||||
'р:Р',
|
||||
'с:С',
|
||||
'т:Т',
|
||||
'у:У',
|
||||
'ф:Ф',
|
||||
'х:Х',
|
||||
'ц:Ц',
|
||||
'ч:Ч',
|
||||
'ш:Ш',
|
||||
'щ:Щ',
|
||||
'ъ:Ъ',
|
||||
'ы:Ы',
|
||||
'ь:Ь',
|
||||
'э:Э',
|
||||
'ю:Ю',
|
||||
'я:Я',
|
||||
];
|
||||
|
||||
String.prototype.toHex = function () {
|
||||
var result = '';
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
result += this.charCodeAt(i).toString(16);
|
||||
}
|
||||
return '0x' + result;
|
||||
};
|
||||
|
||||
for (let i = 0; i < mappings.length; i++) {
|
||||
const parts = mappings[i].split(':');
|
||||
parts[1] = [parts[1], parts[0]];
|
||||
console.log(`{ (u32)${parts[0].toHex()} /* ${parts[0]} */, u8"${parts[1].join('')}" },`);
|
||||
}
|
Loading…
Reference in New Issue
Block a user