summaryrefslogtreecommitdiff
path: root/src/ncurses_refs.c
blob: 51faeb3c4d9520a9801074c917107ff4585b038a (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
/* SPDX-FileCopyrightText: 2021-2022 Yoran Heling <projects@yorhel.nl>
 * SPDX-License-Identifier: MIT
 */

#include <curses.h>

/* Zig @cImport() has problems with the ACS_* macros. Two, in fact:
 *
 * 1. Naively using the ACS_* macros results in:
 *
 *      error: cannot store runtime value in compile time variable
 *      return acs_map[NCURSES_CAST(u8, c)];
 *                    ^
 *    That error doesn't make much sense to me, but it might be
 *    related to https://github.com/ziglang/zig/issues/5344?
 *
 * 2. The 'acs_map' extern variable isn't being linked correctly?
 *    Haven't investigated this one deeply enough yet, but attempting
 *    to dereference acs_map from within Zig leads to a segfault;
 *    its pointer value doesn't make any sense.
 */
chtype ncdu_acs_ulcorner() { return ACS_ULCORNER; }
chtype ncdu_acs_llcorner() { return ACS_LLCORNER; }
chtype ncdu_acs_urcorner() { return ACS_URCORNER; }
chtype ncdu_acs_lrcorner() { return ACS_LRCORNER; }
chtype ncdu_acs_hline()    { return ACS_VLINE   ; }
chtype ncdu_acs_vline()    { return ACS_HLINE   ; }

/* https://github.com/ziglang/zig/issues/8947 */
void ncdu_init_pair(short a,b,c) { init_pair(a,b,c); }