smbd: Simplify strict_lock_default with early returns
[Samba.git] / source3 / utils / regedit_hexedit.h
blobf0424cdad3519b64403d26cdb75eb49ce89e0f20
1 /*
2 * Samba Unix/Linux SMB client library
3 * Registry Editor
4 * Copyright (C) Christopher Davis 2012
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _HEXEDIT_H_
21 #define _HEXEDIT_H_
23 #include <ncurses.h>
25 enum {
26 HE_CURSOR_UP = 0x1000,
27 HE_CURSOR_DOWN = 0x1100,
28 HE_CURSOR_LEFT = 0x1200,
29 HE_CURSOR_RIGHT = 0x1300,
30 HE_CURSOR_PGUP = 0x1400,
31 HE_CURSOR_PGDN = 0x1500
35 offset hex1 hex2 ascii
36 00000000 FF FF FF FF FF FF FF FF ........
39 #define LINE_WIDTH 44
40 #define HEX_COL1 10
41 #define HEX_COL1_END 21
42 #define HEX_COL2 23
43 #define HEX_COL2_END 34
44 #define ASCII_COL 36
45 #define ASCII_COL_END LINE_WIDTH
46 #define BYTES_PER_LINE 8
48 struct hexedit {
49 size_t offset;
50 size_t len;
51 size_t alloc_size;
52 int cursor_y;
53 int cursor_x;
54 size_t cursor_offset;
55 size_t cursor_line_offset;
56 int nibble;
57 uint8_t *data;
58 WINDOW *win;
59 WINDOW *status_line;
62 struct hexedit *hexedit_new(TALLOC_CTX *ctx, WINDOW *parent, int nlines,
63 int y, int x, const void *data, size_t sz);
64 void hexedit_set_cursor(struct hexedit *buf);
65 void hexedit_refresh(struct hexedit *buf);
66 void hexedit_driver(struct hexedit *buf, int c);
67 WERROR hexedit_resize_buffer(struct hexedit *buf, size_t newsz);
69 #endif