/* ChibiOS - Copyright (C) 2006-2014 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @file chprintf.h * @brief Mini printf-like functionality. * * @addtogroup chprintf * @{ */ #ifndef _CHPRINTF_H_ #define _CHPRINTF_H_ #include /** * @brief Float type support. */ #if !defined(CHPRINTF_USE_FLOAT) || defined(__DOXYGEN__) #define CHPRINTF_USE_FLOAT FALSE #endif #ifdef __cplusplus extern "C" { #endif void chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap); int chsnprintf(char *str, size_t size, const char *fmt, ...); #ifdef __cplusplus } #endif /** * @brief System formatted output function. * @details This function implements a minimal @p printf() like functionality * with output on a @p BaseSequentialStream. * The general parameters format is: %[-][width|*][.precision|*][l|L]p. * The following parameter types (p) are supported: * - x hexadecimal integer. * - X hexadecimal long. * - o octal integer. * - O octal long. * - d decimal signed integer. * - D decimal signed long. * - u decimal unsigned integer. * - U decimal unsigned long. * - c character. * - s string. * . * * @param[in] chp pointer to a @p BaseSequentialStream implementing object * @param[in] fmt formatting string * * @api */ static inline void chprintf(BaseSequentialStream *chp, const char *fmt, ...) { va_list ap; va_start(ap, fmt); chvprintf(chp, fmt, ap); va_end(ap); } #endif /* _CHPRINTF_H_ */ /** @} */ tion value='committer'>committer
path: root/quantum/process_keycode/process_ucis.h
blob: b114d839ab8d72030c36c7b9ab5e2e22bae60be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright 2017 Jack Humbert
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "quantum.h"
#include "process_unicode_common.h"

#ifndef UCIS_MAX_SYMBOL_LENGTH
#define UCIS_MAX_SYMBOL_LENGTH 32
#endif

typedef struct {
  char *symbol;
  char *code;
} qk_ucis_symbol_t;

typedef struct {
  uint8_t count;
  uint16_t codes[UCIS_MAX_SYMBOL_LENGTH];
  bool in_progress:1;
} qk_ucis_state_t;

extern qk_ucis_state_t qk_ucis_state;

#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}}
#define UCIS_SYM(name, code) {name, #code}

extern const qk_ucis_symbol_t ucis_symbol_table[];

void qk_ucis_start(void);
void qk_ucis_start_user(void);
void qk_ucis_symbol_fallback (void);
void qk_ucis_success(uint8_t symbol_index);
void register_ucis(const char *hex);
bool process_ucis (uint16_t keycode, keyrecord_t *record);