summaryrefslogtreecommitdiff
path: root/src/winmsgcond.h
blob: 4326cd6ad67e9f5b8fda1da7c158db62436595dc (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
/* Copyright (c) 2013
 *      Mike Gerwitz (mtg@gnu.org)
 *
 * This file is part of GNU screen.
 *
 * GNU screen 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 3, 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 (see the file COPYING); if not, see
 * <https://www.gnu.org/licenses>.
 *
 ****************************************************************
 */

#ifndef SCREEN_WINMSGCOND_H
#define SCREEN_WINMSGCOND_H

#include <stdbool.h>


/* represents a window message condition (e.g. %?)*/
typedef struct {
	int  offset;  /* offset in dest string */
	bool initialized;
	bool state;   /* conditional truth value */
	bool locked;  /* when set, prevents state from changing */
} WinMsgCond;

/* WinMsgCond is intended to be used as an opaque type */
void wmc_init(WinMsgCond *, int);
void wmc_set(WinMsgCond *);
void wmc_clear(WinMsgCond *);
bool wmc_is_active(const WinMsgCond *);
bool wmc_is_set(const WinMsgCond *);
int  wmc_else(WinMsgCond *, int, bool *);
int  wmc_end(const WinMsgCond *, int, bool *);
void wmc_deinit(WinMsgCond *);

#endif