change DORNE_*_H namespacing to CURSETREE_*_H

This commit is contained in:
Emile Clark-Boman 2025-09-13 10:58:31 +10:00
parent 69745c81f7
commit daaaaf979c
9 changed files with 69 additions and 20 deletions

View file

@ -38,7 +38,7 @@ $(BUILD) $(BIN):
$(BUILD)/dorne.o: $(addprefix $(CLI)/, main.c)
$(call mkobj,-Icursetree)
$(BUILD)/cursetree.o: $(addprefix $(CT)/, cursetree.c curse.c)
$(BUILD)/cursetree.o: $(addprefix $(CT)/, cursetree.c ncrswrap.c)
$(call mkobj,)
$(BUILD)/epty.o: $(addprefix $(CT)/, pty/child.c pty/epty.c pty/_pty.c)
$(call mkobj,)

View file

@ -2,8 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include "curse.h"
#include "ncurses.h"
#include "ncrswrap.h"
#include "cursetree.h"
/* Internal allocator method for crs_node structures.

View file

@ -1,5 +1,5 @@
#ifndef DORNE_TREE_H
#define DORNE_TREE_H
#ifndef CURSETREE_CURSETREE_H
#define CURSETREE_CURSETREE_H
#ifndef __NCURSES_H
typedef struct _win_st WINDOW;
@ -60,4 +60,4 @@ void bifurcate_window_node(struct crs_node **const node,
const enum crs_axis axis, const int invert_axis,
const float ratio);
#endif /* DORNE_TREE_H */
#endif /* CURSETREE_CURSETREE_H */

View file

@ -1,9 +1,8 @@
#include <locale.h>
#include <unistd.h>
#include "curse.h"
#include "ncrswrap.h"
#define BASE_DELAY 1000000
#define CRS_LOCALE "en_US.UTF-8"
/* Set ncurses terminal mode (buffering, character processing,

View file

@ -1,5 +1,5 @@
#ifndef DORNE_CURSE_H
#define DORNE_CURSE_H
#ifndef CURSETREE_NCRSWRAP_H
#define CURSETREE_NCRSWRAP_H
/* libncurses with wide-character support. */
#include <ncursesw/ncurses.h>
@ -26,4 +26,4 @@ WINDOW *root_window(void);
int resizemv_window(const int x, const int y, const int width, const int height,
WINDOW *const win);
#endif /* DORNE_CURSE_H */
#endif /* CURSETREE_NCRSWRAP_H */

51
cursetree/node.h Normal file
View file

@ -0,0 +1,51 @@
#ifndef CURSETREE_NODE_H
#define CURSETREE_NODE_H
#ifndef __NCURSES_H
typedef struct _win_st WINDOW;
#endif /* __NCURSES_H */
#define NODE_CHILD_N 2
/* MACRO:
* Get widnow node start x,y coordinates, width, & height.
* void NODEDIMS(struct crs_node *node, struct crs_nodedims dims);
*/
#define GET_WNODEDIMS(dims, node) \
(getbegyx((node)->win, dims.y, dims.x)); \
getmaxyx((node)->win, dims.y, dims.x)
enum crs_nodetype {
NODE_WINDOW,
NODE_ABSTRACT,
};
/* Stores a node's starting x,y coordinates, width, & height.
* NOTE: Intended for interfunction communication.
*/
struct crs_nodedims {
int x, y, width, height;
};
enum crs_axis {
AXIS_X,
AXIS_Y,
};
struct crs_node {
enum crs_nodetype type;
// union value depends on crs_node.type
union {
WINDOW *win;
struct {
enum crs_axis axis;
float ratio;
struct crs_nodedims *dims;
struct crs_node *child[NODE_CHILD_N];
};
};
};
/* === External Interface === */
#endif /* CURSETREE_NODE_H */

View file

@ -1,5 +1,5 @@
#ifndef DORNE_MKPTY_H
#define DORNE_MKPTY_H
#ifndef CURSETREE_PTY_H
#define CURSETREE_PTY_H
#include <errno.h>
#include <limits.h>
@ -27,4 +27,4 @@ int setptsxy(const unsigned short rows, const unsigned short cols,
const int fds);
int getptsxy(unsigned short *rows, unsigned short *cols, const int fds);
#endif /* DORNE_MKPTY_H */
#endif /* CURSETREE_PTY_H */

View file

@ -1,5 +1,5 @@
#ifndef DORNE_CHILD_H
#define DORNE_CHILD_H
#ifndef CURSETREE_CHILD_H
#define CURSETREE_CHILD_H
#include <unistd.h>
@ -11,4 +11,4 @@ struct d_child {
int spawnchild(struct d_child *child);
#endif /* DORNE_CHILD_H */
#endif /* CURSETREE_CHILD_H */

View file

@ -1,8 +1,8 @@
#ifndef DORNE_EPTY_H
#define DORNE_EPTY_H
#ifndef CURSETREE_EPTY_H
#define CURSETREE_EPTY_H
#include <sys/types.h>
pid_t forkepty(int *fdmx, int *fderr);
#endif /* DORNE_EPTY_H */
#endif /* CURSETREE_EPTY_H */