BRL-CAD
cursor.h
Go to the documentation of this file.
1 /* C U R S O R . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2013-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file cursor.h
21  *
22  * These are declarations of functions provided by libcursor, a simple
23  * wrapper library to terminal capabilities (termcap).
24  *
25  */
26 
27 #ifndef CURSOR_H
28 #define CURSOR_H
29 
30 #include "common.h"
31 
32 #include <stdio.h>
33 
35 
36 #ifndef CURSOR_EXPORT
37 # if defined(CURSOR_DLL_EXPORTS) && defined(CURSOR_DLL_IMPORTS)
38 # error "Only CURSOR_DLL_EXPORTS or CURSOR_DLL_IMPORTS can be defined, not both."
39 # elif defined(CURSOR_DLL_EXPORTS)
40 # define CURSOR_EXPORT __declspec(dllexport)
41 # elif defined(CURSOR_DLL_IMPORTS)
42 # define CURSOR_EXPORT __declspec(dllimport)
43 # else
44 # define CURSOR_EXPORT
45 # endif
46 #endif
47 
48 
49 /**
50  * Initialize termcap.
51  *
52  * This function must be called first to read the termcap database and
53  * to specify the output stream.
54  *
55  * Get individual parameters and control strings. Initialize the
56  * terminal. Use 'fp' as output stream.
57  *
58  * Returns 1 for success, 0 for failure and prints appropriate
59  * diagnostic.
60  */
61 CURSOR_EXPORT extern int InitTermCap(FILE *fp);
62 
63 /**
64  * These below functions output terminal control strings to the file
65  * stream specified by the InitTermCap() call which must precede them.
66  * They return 0 if the capability is not described in the termcap
67  * database and 1 otherwise. Of course if the database entry is
68  * wrong, the command will not do its job.
69  */
70 
71 /**
72  * Begin standout mode.
73  */
74 CURSOR_EXPORT extern int SetStandout(void);
75 
76 /**
77  * End standout mode.
78  */
79 CURSOR_EXPORT extern int ClrStandout(void);
80 
81 /**
82  * Clear from the cursor to end of line.
83  */
84 CURSOR_EXPORT extern int ClrEOL(void);
85 
86 /**
87  * Clear screen and home cursor.
88  */
89 CURSOR_EXPORT extern int ClrText(void);
90 
91 /**
92  * Delete the current line.
93  */
94 CURSOR_EXPORT extern int DeleteLn(void);
95 
96 /**
97  * Home the cursor.
98  */
99 CURSOR_EXPORT extern int HmCursor(void);
100 
101 /**
102  * Move the cursor to screen coordinates x, y.
103  */
104 CURSOR_EXPORT extern int MvCursor(int x, int y);
105 
106 /**
107  * Reverse scroll 1 line.
108  */
109 CURSOR_EXPORT extern int ScrollDn(void);
110 
111 /**
112  * Forward scroll 1 line.
113  */
114 CURSOR_EXPORT extern int ScrollUp(void);
115 
116 /**
117  * Set the scrolling region to be from "top" to "btm".
118  */
119 CURSOR_EXPORT extern int SetScrlReg(int top, int btm);
120 
121 /**
122  * Reset the scrolling region to the entire screen.
123  */
124 CURSOR_EXPORT extern int ResetScrlReg(void);
125 
126 
128 
129 #endif /* CURSOR_H */
130 
131 /*
132  * Local Variables:
133  * tab-width: 8
134  * mode: C
135  * indent-tabs-mode: t
136  * c-file-style: "stroustrup"
137  * End:
138  * ex: shiftwidth=4 tabstop=8
139  */
int DeleteLn(void)
Definition: cursor.c:237
Header file for the BRL-CAD common definitions.
int SetScrlReg(int top, int btm)
Definition: cursor.c:289
int ClrStandout(void)
Definition: cursor.c:313
#define __BEGIN_DECLS
Definition: common.h:73
static void top()
int ScrollDn(void)
Definition: cursor.c:225
int ScrollUp(void)
Definition: cursor.c:213
int ResetScrlReg(void)
Definition: cursor.c:301
int InitTermCap(FILE *fp)
Definition: cursor.c:115
int ClrText(void)
Definition: cursor.c:277
int SetStandout(void)
Definition: cursor.c:325
#define __END_DECLS
Definition: common.h:74
int ClrEOL(void)
Definition: cursor.c:265
int HmCursor(void)
Definition: cursor.c:201
int MvCursor(int x, int y)
Definition: cursor.c:249