| 1 |
sysadm |
1.1 |
/***************************************************************************
|
| 2 |
|
|
editor.h - description
|
| 3 |
|
|
-------------------
|
| 4 |
|
|
copyright : (C) 2004-2025 by Leaflet
|
| 5 |
|
|
email : leaflet@leafok.com
|
| 6 |
|
|
***************************************************************************/
|
| 7 |
|
|
|
| 8 |
|
|
/***************************************************************************
|
| 9 |
|
|
* *
|
| 10 |
|
|
* This program is free software; you can redistribute it and/or modify *
|
| 11 |
|
|
* it under the terms of the GNU General Public License as published by *
|
| 12 |
|
|
* the Free Software Foundation; either version 3 of the License, or *
|
| 13 |
|
|
* (at your option) any later version. *
|
| 14 |
|
|
* *
|
| 15 |
|
|
***************************************************************************/
|
| 16 |
|
|
|
| 17 |
|
|
#ifndef _EDITOR_H_
|
| 18 |
|
|
#define _EDITOR_H_
|
| 19 |
|
|
|
| 20 |
|
|
#include "screen.h"
|
| 21 |
|
|
|
| 22 |
|
|
#define MAX_EDITOR_DATA_LINES 65536
|
| 23 |
|
|
#define MAX_EDITOR_DATA_LINE_LENGTH 1024
|
| 24 |
|
|
|
| 25 |
|
|
struct editor_data_t
|
| 26 |
|
|
{
|
| 27 |
|
|
char *p_data_lines[MAX_EDITOR_DATA_LINES];
|
| 28 |
|
|
long data_line_total;
|
| 29 |
|
|
char *p_display_lines[MAX_EDITOR_DATA_LINES];
|
| 30 |
|
|
long display_line_lengths[MAX_EDITOR_DATA_LINES];
|
| 31 |
|
|
long display_line_total;
|
| 32 |
|
|
};
|
| 33 |
|
|
typedef struct editor_data_t EDITOR_DATA;
|
| 34 |
|
|
|
| 35 |
sysadm |
1.2 |
struct editor_ctx_t
|
| 36 |
|
|
{
|
| 37 |
|
|
int reach_begin;
|
| 38 |
|
|
int reach_end;
|
| 39 |
|
|
long line_cursor;
|
| 40 |
|
|
char msg[MSG_EXT_MAX_LEN];
|
| 41 |
|
|
};
|
| 42 |
|
|
typedef struct editor_ctx_t EDITOR_CTX;
|
| 43 |
|
|
|
| 44 |
sysadm |
1.1 |
extern EDITOR_DATA *editor_data_load(const char *p_data);
|
| 45 |
|
|
extern long editor_data_save(const EDITOR_DATA *p_editor_data, char *p_data, size_t buf_len);
|
| 46 |
|
|
extern void editor_data_cleanup(EDITOR_DATA *p_editor_data);
|
| 47 |
|
|
|
| 48 |
|
|
extern int editor_display(EDITOR_DATA *p_editor_data);
|
| 49 |
|
|
|
| 50 |
sysadm |
1.3 |
extern int editor_data_insert(EDITOR_DATA *p_editor_data, long *p_display_line, long *p_offset,
|
| 51 |
sysadm |
1.2 |
const char *str, int str_len, long *p_last_updated_line);
|
| 52 |
|
|
|
| 53 |
|
|
extern int editor_data_delete(EDITOR_DATA *p_editor_data, long display_line, long offset,
|
| 54 |
|
|
long *p_last_updated_line);
|
| 55 |
|
|
|
| 56 |
sysadm |
1.1 |
#endif //_EDITOR_H_
|