code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(35 lines)
1 #pragma once
3 // Boolean functions/type info
5 #include <stdbool.h>
6 #include <stdint.h>
8 #include "types.h"
9 #include "util.h"
11 #define yes (Bool_t) true
12 #define no (Bool_t) false
14 PUREFUNC Text_t Bool$as_text(const void *b, bool colorize, const TypeInfo_t *type);
15 OptionalBool_t Bool$parse(Text_t text, Text_t *remainder);
16 MACROLIKE Bool_t Bool$from_int(Int_t i) {
17 return (i.small != 0);
19 MACROLIKE Bool_t Bool$from_int64(Int64_t i) {
20 return (i != 0);
22 MACROLIKE Bool_t Bool$from_int32(Int32_t i) {
23 return (i != 0);
25 MACROLIKE Bool_t Bool$from_int16(Int16_t i) {
26 return (i != 0);
28 MACROLIKE Bool_t Bool$from_int8(Int8_t i) {
29 return (i != 0);
31 MACROLIKE Bool_t Bool$from_byte(uint8_t b) {
32 return (b != 0);
35 extern const TypeInfo_t Bool$info;