summaryrefslogtreecommitdiffstats
path: root/src/c_init.h
blob: 86eb89a67310988e6b484644b7c3f8cd268baafc (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
50
51
52
53
54
55
56
57
58
59
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   c_init.h                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:19:27 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:19:29 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#ifndef U_INIT_H
#define U_INIT_H

#include <termios.h>
#include <sys/ioctl.h>

#include "s_struct.h"

# define LEFT_K  0x445b1b
# define RIGHT_K 0x435b1b
# define HOME_K 0x485b1b
# define END_K 0x7e345b1b
# define DEL_K 0x7f
# define RET_K 0x0d

# define CTRL_F 0x06
# define CTRL_B 0x02
# define CTRL_C 0x03
# define CTRL_L 0x0c


typedef struct s_caps
{
    struct termios tios;
    struct winsize ws;
    uint32_t cpos;  /*cursor position (column)*/
    uint32_t lpos;  /*cursor position (line)*/
    uint32_t nlines;  /*cursor position (line)*/
    uint8_t psx;  /*cursor position (line)*/
} t_caps;

int16_t c_gnl(int32_t fd, char **line, uint8_t psx, t_msh *msh);
int16_t c_set_term_raw(uint8_t mode);

#endif

/* cm_str; cursor mobility*/
/* nl;     newline, returned by tgoto()*/
/* ks;     indicate that keys transmit from now on*/
/* ke;     indicate that keys transmit from now on*/
/* pc;     padding char --> do not touch (default 0)*/
/* bc;     left  one char*/
/* le;     left  one char*/
/* up;     up one line*/
/* DO;     down one line*/
/* nd;     right one char*/
/* cl;     line clear*/