source: mainline/uspace/app/terminal/terminal.h@ 7b11315

serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 7b11315 was 7b11315, checked in by Jiri Svoboda <jiri@…>, 4 years ago

Add -c option to terminal to execute a command

This is to allow terminal-mode commands to be run from non-terminal
(i.e. GUI) context. This way is similar to what UN*X style OSses do.
For the record, I think this is a kludge. I think we can do better.
A console/terminal window could be automatically open when needed
(something like that happens in Windows?)

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2021 Jiri Svoboda
3 * Copyright (c) 2012 Petr Koupy
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup terminal
31 * @{
32 */
33/**
34 * @file
35 */
36
37#ifndef TERMINAL_H
38#define TERMINAL_H
39
40#include <errno.h>
41#include <fibril_synch.h>
42#include <gfx/bitmap.h>
43#include <gfx/context.h>
44#include <gfx/coord.h>
45#include <io/chargrid.h>
46#include <io/con_srv.h>
47#include <loc.h>
48#include <adt/prodcons.h>
49#include <stdatomic.h>
50#include <str.h>
51#include <ui/ui.h>
52#include <ui/window.h>
53
54#define UTF8_CHAR_BUFFER_SIZE (STR_BOUNDS(1) + 1)
55
56typedef enum {
57 tf_topleft = 1
58} terminal_flags_t;
59
60typedef struct {
61 ui_t *ui;
62 ui_window_t *window;
63 ui_resource_t *ui_res;
64 gfx_context_t *gc;
65
66 gfx_bitmap_t *bmp;
67 sysarg_t w;
68 sysarg_t h;
69 gfx_rect_t update;
70 gfx_coord2_t off;
71 bool is_focused;
72
73 fibril_mutex_t mtx;
74 link_t link;
75 atomic_flag refcnt;
76
77 prodcons_t input_pc;
78 char char_remains[UTF8_CHAR_BUFFER_SIZE];
79 size_t char_remains_len;
80
81 sysarg_t cols;
82 sysarg_t rows;
83 chargrid_t *frontbuf;
84 chargrid_t *backbuf;
85 sysarg_t top_row;
86
87 sysarg_t ucols;
88 sysarg_t urows;
89 charfield_t *ubuf;
90
91 service_id_t dsid;
92 con_srvs_t srvs;
93} terminal_t;
94
95extern errno_t terminal_create(const char *, sysarg_t, sysarg_t,
96 terminal_flags_t, const char *, terminal_t **);
97extern void terminal_destroy(terminal_t *);
98
99#endif
100
101/** @}
102 */
Note: See TracBrowser for help on using the repository browser.