mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 07:36:48 +03:00
remove unneeded thunks
git-svn-id: svn://kolibrios.org@6615 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
45f221c5f5
commit
2bf86a4dab
@ -106,7 +106,7 @@ import lib_boxlib, \
|
||||
ted_is_select, 'ted_is_select' , \
|
||||
ted_key, 'ted_key' , \
|
||||
ted_mouse, 'ted_mouse' , \
|
||||
ted_open_file, 'ted_open_file_asm' , \
|
||||
ted_open_file, 'ted_open_file' , \
|
||||
ted_save_file, 'ted_save_file' , \
|
||||
ted_text_add, 'ted_text_add' , \
|
||||
ted_but_select_word, 'ted_but_select_word' , \
|
||||
@ -159,55 +159,55 @@ public fb_draw_panel as '_filebrowse_draw'
|
||||
public fb_mouse as '_filebrowse_mouse'
|
||||
public fb_key as '_filebrowse_key'
|
||||
|
||||
public ted_but_sumb_upper as '_ted_but_sumb_upper_asm'
|
||||
public ted_but_sumb_lover as '_ted_but_sumb_lover_asm'
|
||||
public ted_but_convert_by_table as '_ted_but_convert_by_table_asm'
|
||||
public ted_can_save as '_ted_can_save_asm'
|
||||
public ted_clear as '_ted_clear_asm'
|
||||
public ted_delete as '_ted_delete_asm'
|
||||
public ted_but_sumb_upper as '_ted_but_sumb_upper'
|
||||
public ted_but_sumb_lover as '_ted_but_sumb_lover'
|
||||
public ted_but_convert_by_table as '_ted_but_convert_by_table'
|
||||
public ted_can_save as '_ted_can_save'
|
||||
public ted_clear as '_ted_clear'
|
||||
public ted_delete as '_ted_delete'
|
||||
public ted_draw as '_ted_draw'
|
||||
public ted_init as '_ted_init_asm'
|
||||
public ted_init as '_ted_init'
|
||||
public ted_init_scroll_bars as '_ted_init_scroll_bars'
|
||||
public ted_init_syntax_file as '_ted_init_syntax_file'
|
||||
public ted_is_select as '_ted_is_select_asm'
|
||||
public ted_is_select as '_ted_is_select'
|
||||
public ted_key as '_ted_key_asm'
|
||||
public ted_mouse as '_ted_mouse'
|
||||
public ted_open_file as '_ted_open_file_asm'
|
||||
public ted_save_file as '_ted_save_file_asm'
|
||||
public ted_text_add as '_ted_text_add'
|
||||
public ted_but_select_word as '_ted_but_select_word'
|
||||
public ted_but_cut as '_ted_but_cut_asm'
|
||||
public ted_but_cut as '_ted_but_cut'
|
||||
public ted_but_copy as '_ted_but_copy'
|
||||
public ted_but_paste as '_ted_but_paste'
|
||||
public ted_but_undo as '_ted_but_undo_asm'
|
||||
public ted_but_redo as '_ted_but_redo_asm'
|
||||
public ted_but_reverse as '_ted_but_reverse_asm'
|
||||
public ted_but_undo as '_ted_but_undo'
|
||||
public ted_but_redo as '_ted_but_redo'
|
||||
public ted_but_reverse as '_ted_but_reverse'
|
||||
public ted_but_find_next as '_ted_but_find_next'
|
||||
public ted_text_colored as 'ted_text_colored_asm'
|
||||
|
||||
public tl_data_init as '_tl_data_init_asm'
|
||||
public tl_data_clear as '_tl_data_clear_asm'
|
||||
public tl_info_clear as '_tl_info_clear_asm'
|
||||
public tl_data_init as '_tl_data_init'
|
||||
public tl_data_clear as '_tl_data_clear'
|
||||
public tl_info_clear as '_tl_info_clear'
|
||||
public tl_key as '_tl_key_asm'
|
||||
public tl_mouse as '_tl_mouse'
|
||||
public tl_draw as '_tl_draw'
|
||||
public tl_info_undo as '_tl_info_undo_asm'
|
||||
public tl_info_redo as '_tl_info_redo_asm'
|
||||
public tl_node_add as '_tl_node_add_asm'
|
||||
public tl_node_set_data as '_tl_node_set_data_asm'
|
||||
public tl_node_get_data as '_tl_node_get_data_asm'
|
||||
public tl_node_delete as '_tl_node_delete_asm'
|
||||
public tl_cur_beg as '_tl_cur_beg_asm'
|
||||
public tl_cur_next as '_tl_cur_next_asm'
|
||||
public tl_cur_perv as '_tl_cur_perv_asm'
|
||||
public tl_node_close_open as '_tl_node_close_open_asm'
|
||||
public tl_node_lev_inc as '_tl_node_lev_inc_asm'
|
||||
public tl_node_lev_dec as '_tl_node_lev_dec_asm'
|
||||
public tl_info_undo as '_tl_info_undo'
|
||||
public tl_info_redo as '_tl_info_redo'
|
||||
public tl_node_add as '_tl_node_add'
|
||||
public tl_node_set_data as '_tl_node_set_data'
|
||||
public tl_node_get_data as '_tl_node_get_data'
|
||||
public tl_node_delete as '_tl_node_delete'
|
||||
public tl_cur_beg as '_tl_cur_beg'
|
||||
public tl_cur_next as '_tl_cur_next'
|
||||
public tl_cur_perv as '_tl_cur_perv'
|
||||
public tl_node_close_open as '_tl_node_close_open'
|
||||
public tl_node_lev_inc as '_tl_node_lev_inc'
|
||||
public tl_node_lev_dec as '_tl_node_lev_dec'
|
||||
public tl_node_move_up as '_tl_node_move_up'
|
||||
public tl_node_move_down as '_tl_node_move_down'
|
||||
public tl_node_poi_get_info as '_tl_node_poi_get_info_asm'
|
||||
public tl_node_poi_get_next_info as '_tl_node_poi_get_next_info_asm'
|
||||
public tl_node_poi_get_data as '_tl_node_poi_get_data_asm'
|
||||
public tl_node_poi_get_info as '_tl_node_poi_get_info'
|
||||
public tl_node_poi_get_next_info as '_tl_node_poi_get_next_info'
|
||||
public tl_node_poi_get_data as '_tl_node_poi_get_data'
|
||||
public tl_save_mem as '_tl_save_mem_asm'
|
||||
public tl_load_mem as '_tl_load_mem_asm'
|
||||
public tl_get_mem_size as '_tl_get_mem_size_asm'
|
||||
|
@ -69,19 +69,19 @@ int main(int argc, char **argv)
|
||||
|
||||
gui_add_editor(main_window, ed = kolibri_new_editor(X_Y(0, 440), X_Y(20, 150), 0x11, 2048, &ed_lock)); // 0x11 font 8x16 sized x2
|
||||
ed_lock = ed;
|
||||
/*
|
||||
|
||||
// load sample file
|
||||
int res, len;
|
||||
res = editor_openfile(ed, "/rd/1/boardlog.txt", &len);
|
||||
debug_board_printf("loaded sample file err=%d, len=%d\n", res, len);
|
||||
*/
|
||||
//int res, len;
|
||||
//res = editor_openfile(ed, "/rd/1/boardlog.txt", &len);
|
||||
//debug_board_printf("loaded sample file err=%d, len=%d\n", res, len);
|
||||
|
||||
//adding sample text @cursor
|
||||
char *sampletext = "==========ADDED SAMPLE TEXT==========\n";
|
||||
char *sampletext = "*123*=========ADDED SAMPLE TEXT=========*789*\n";
|
||||
(*ted_text_add)(ed, sampletext, strlen(sampletext), 0);
|
||||
|
||||
// treelist as tree
|
||||
treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_KEY_NO_EDIT | TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff);
|
||||
treelist_data_init(tl);
|
||||
(*tl_data_init)(tl);
|
||||
|
||||
// ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè
|
||||
strcpy(fname, run_path);
|
||||
@ -94,42 +94,42 @@ int main(int argc, char **argv)
|
||||
tl->data_img = load_image_file(fname);
|
||||
|
||||
treelist_node_add(tl, "node1", 1, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
treelist_node_add(tl, "node1.1", 1, 0, 1);
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
treelist_node_add(tl, "node1.1.1", 0, 0, 2);
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
treelist_node_add(tl, "node1.2", 1, 0, 1);
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
|
||||
treelist_node_add(tl, "node2", 1, 1, 0); // closed node
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
treelist_node_add(tl, "node2.1", 1, 0, 1);
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
|
||||
treelist_node_add(tl, "node3", 1, 0, 0);
|
||||
treelist_cursor_next(tl);
|
||||
(*tl_cur_next)(tl);
|
||||
|
||||
treelist_cursor_begin(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
|
||||
(*tl_cur_beg)(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
|
||||
gui_add_treelist(main_window, tl);
|
||||
|
||||
// treelist as listbox
|
||||
treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff);
|
||||
treelist_data_init(tl2);
|
||||
(*tl_data_init)(tl2);
|
||||
|
||||
tl2->data_img_sys = tl->data_img_sys;
|
||||
tl2->data_img = tl->data_img;
|
||||
|
||||
treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
|
||||
treelist_cursor_next(tl2);
|
||||
(*tl_cur_next)(tl2);
|
||||
|
||||
treelist_node_add(tl2, "list2", 0, 0, 0);
|
||||
treelist_cursor_next(tl2);
|
||||
(*tl_cur_next)(tl2);
|
||||
|
||||
treelist_node_add(tl2, "list3", 0, 0, 0);
|
||||
treelist_cursor_next(tl2);
|
||||
(*tl_cur_next)(tl2);
|
||||
|
||||
treelist_cursor_begin(tl2); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
|
||||
(*tl_cur_beg)(tl2); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
|
||||
gui_add_treelist(main_window, tl2);
|
||||
|
||||
msgbox* box = kolibri_new_msgbox("Exit", "Are\rYOU\rSure?", 3, "YES", "Absolute", "Not Yet", NULL); // default NOT
|
||||
@ -148,7 +148,6 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case KOLIBRI_EVENT_KEY:
|
||||
key = get_key();
|
||||
trap(0x55); // for stop in debug
|
||||
if (ed_lock == ed)
|
||||
editor_key(ed, key);
|
||||
else if(ed_lock == tl)
|
||||
@ -181,6 +180,14 @@ trap(0x55); // for stop in debug
|
||||
} while(1) ; /* End of main activity loop */
|
||||
|
||||
clearing:
|
||||
trap(0x55); // for stop in debug
|
||||
//res = editor_savefile(ed, "/tmp0/1/editorlog.txt");
|
||||
pc = editor_get_text(ed);
|
||||
debug_board_printf("saved text \"%s\"\n", pc);
|
||||
free(pc);
|
||||
|
||||
|
||||
|
||||
editor_delete(ed);
|
||||
treelist_data_clear(tl);
|
||||
|
||||
|
@ -12,8 +12,8 @@ typedef void (*editor_callback)(void);
|
||||
struct __attribute__ ((__packed__)) editor_symbol {
|
||||
uint8_t c; // +0 ñèìâîë
|
||||
uint8_t col; // +1 öâåò
|
||||
struct editor_symbol *prev; // +2
|
||||
struct editor_symbol *next; // +6 óêàçàòåëè
|
||||
uint32_t prev; // +2 èíäåêñ ïðåäûäóùåãî
|
||||
uint32_t next; // +6 óêàçàòåëè (èíäåêñ ñëåäóþùåãî)
|
||||
uint32_t tc; // +10 âðåì. ñîçäàíèÿ
|
||||
uint32_t td; // +14 âðåì. óäàëåíèÿ
|
||||
};
|
||||
@ -39,8 +39,8 @@ typedef struct __attribute__ ((__packed__)) {
|
||||
uint32_t seln_x1;
|
||||
uint32_t seln_y1;
|
||||
struct editor_symbol *tex; // text memory pointer
|
||||
struct editor_symbol *tex_1; // text first symbol pointer
|
||||
struct editor_symbol *tex_end;// text end memory pointer
|
||||
struct editor_symbol *tex_1; // óêàçàòåëü çà ïîñëåäíèì ñóùåñòâóþùèì ñèìâîëîì (êîíåö ôàéëà)
|
||||
struct editor_symbol *tex_end;// text end memory pointer (óêàçàòåëü çà êîíöîì âûäåëåííîãî áóôåðà äëÿ òåêñòà)
|
||||
uint32_t cur_x; //êîîðäèíàòà x êóðñîðà
|
||||
uint32_t cur_y; //êîîðäèíàòà y êóðñîðà
|
||||
uint32_t max_chars; // TE_MAXCHARS ;+86 ìàêñèìàëüíîå ÷èñëî ñèìâîëîâ â îäíîì äîêóìåíòå
|
||||
@ -161,121 +161,34 @@ extern void (*ted_but_find_next)(editor *) __attribute__((__stdcall__));
|
||||
|
||||
|
||||
|
||||
extern void (*ted_but_sumb_upper_asm)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_selected_toupper(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t"
|
||||
"push %%esi \n\t":::);
|
||||
extern void (*ted_but_sumb_upper)(editor *) __attribute__((__stdcall__));
|
||||
|
||||
(*ted_but_sumb_upper_asm)(ed);
|
||||
extern void (*ted_but_sumb_lover)(editor *) __attribute__((__stdcall__));
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%esi \n\t"
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
extern void (*ted_but_convert_by_table)(editor *, char* table) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*ted_but_sumb_lover_asm)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_selected_tolower(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t"
|
||||
"push %%esi \n\t":::);
|
||||
|
||||
(*ted_but_sumb_lover_asm)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%esi \n\t"
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
|
||||
extern void (*ted_but_convert_by_table_asm)(editor *, char* table) __attribute__((__stdcall__));
|
||||
static inline void editor_convert_by_table(editor *ed, char* table)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t"
|
||||
"push %%esi \n\t":::);
|
||||
|
||||
(*ted_but_convert_by_table_asm)(ed, table);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%esi \n\t"
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern int (*ted_can_save_asm)(editor *) __attribute__((__stdcall__));
|
||||
static inline int editor_can_save(editor *ed)
|
||||
/// return 1 if need to be saved (has changes), 0 otherwise
|
||||
{
|
||||
int ret;
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*ted_can_save_asm)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":"=a"(ret)::);
|
||||
return ret;
|
||||
}
|
||||
extern int (*ted_can_save)(editor *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*ted_clear_asm)(editor *, int) __attribute__((__stdcall__));
|
||||
static inline void editor_clear(editor *ed, int all)
|
||||
/// all==1 - clear all memory
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*ted_clear)(editor *, int all) __attribute__((__stdcall__));
|
||||
|
||||
(*ted_clear_asm)(ed, all);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*ted_delete_asm)(editor *) __attribute__((__stdcall__));
|
||||
extern void (*ted_delete)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_delete(editor *ed)
|
||||
/// frees all memory (destroy)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*ted_delete_asm)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
(*ted_delete)(ed);
|
||||
free(ed->scr_w);
|
||||
free(ed->scr_h);
|
||||
free(ed->buffer);
|
||||
free(ed->buffer_find);
|
||||
}
|
||||
|
||||
extern void (*ted_init_asm)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_init(editor *ed)
|
||||
/// allocate memory
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*ted_init)(editor *) __attribute__((__stdcall__));
|
||||
|
||||
(*ted_init_asm)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern int (*ted_is_select)(editor *) __attribute__((__stdcall__));
|
||||
static inline int editor_is_select(editor *ed)
|
||||
/// return 1 if have selection
|
||||
{
|
||||
int ret;
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t":::);
|
||||
|
||||
(*ted_is_select)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%ebx \n\t":"=a"(ret)::);
|
||||
return ret;
|
||||
}
|
||||
extern int (*ted_is_select)(editor *) __attribute__((__stdcall__));
|
||||
|
||||
enum control_keys {
|
||||
KM_SHIFT = 0x00010000,
|
||||
@ -330,62 +243,19 @@ static inline int editor_savefile(editor *ed, char *fname)
|
||||
}
|
||||
|
||||
extern void (*ted_but_cut)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_cut(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*ted_but_cut)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*ted_but_undo)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_undo(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*ted_but_undo)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*ted_but_redo)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_redo(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*ted_but_redo)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*ted_but_reverse)(editor *) __attribute__((__stdcall__));
|
||||
static inline void editor_reverse(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t"
|
||||
"push %%ebx\n\t":::);
|
||||
|
||||
(*ted_but_reverse)(ed);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%ebx \n\t"
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*ted_text_colored_asm)() __attribute__((__stdcall__));
|
||||
static inline void editor_text_colored(editor *ed)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"nop \n\t"::"D"(ed):);
|
||||
"call *%0 \n\t"::"m"(ted_text_colored_asm), "D"(ed):);
|
||||
|
||||
(*ted_text_colored_asm)();
|
||||
}
|
||||
|
||||
static inline
|
||||
@ -494,8 +364,7 @@ static inline editor* kolibri_new_editor(uint32_t x_w, uint32_t y_h, uint32_t fo
|
||||
|
||||
ed->el_focus = editor_interlock;
|
||||
|
||||
// ??? saveregs ax,cx,di
|
||||
editor_init(ed); // memory allocation, cleaning
|
||||
(*ted_init)(ed); // memory allocation, cleaning
|
||||
ed->syntax_file = (char*)&default_syntax;
|
||||
(*ted_init_syntax_file)(ed); // load colors and syntax highlight
|
||||
ed->help_text_f1 = f1_table; // override if not aligned immediately after syntax words
|
||||
@ -504,5 +373,53 @@ static inline editor* kolibri_new_editor(uint32_t x_w, uint32_t y_h, uint32_t fo
|
||||
return ed;
|
||||
}
|
||||
|
||||
/// return 1 if symbol is not visible (deleted or undo-ed)
|
||||
static inline int editor_symbol_not_vis(editor* ed, struct editor_symbol* sym)
|
||||
{
|
||||
return (sym->td && sym->td + ed->tim_undo <= ed->tim_ch) || (sym->tc > ed->tim_ch - ed->tim_undo);
|
||||
}
|
||||
|
||||
/// returns next good symbol by index
|
||||
static inline
|
||||
uint32_t editor_iterat_next(editor* ed, uint32_t idx)
|
||||
{
|
||||
uint32_t i;
|
||||
if (ed->tim_undo)
|
||||
{
|
||||
for (i = ed->tex[idx].next; i != 0 && (ed->tex[i].c == '\n' || editor_symbol_not_vis(ed, ed->tex + i)); i = ed->tex[i].next);
|
||||
} else
|
||||
{
|
||||
for (i = ed->tex[idx].next; i != 0 && (ed->tex[i].c == '\n' || ed->tex[i].td); i = ed->tex[i].next);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// returns malloc'ed mem
|
||||
static inline
|
||||
char* editor_get_text(editor* ed)
|
||||
{
|
||||
char *buf = malloc(ed->max_chars), *pc = buf;
|
||||
if (!pc) return NULL;
|
||||
|
||||
int i;
|
||||
// *pc++ = ed->tex[0].c;
|
||||
for (i = ed->tex[0].next; i; i = editor_iterat_next(ed, i)) *pc++ = ed->tex[i].c;
|
||||
*pc++ = '\0';
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
char* editor_get_text20(editor* ed)
|
||||
{
|
||||
char *buf = malloc(ed->max_chars), *pc = buf;
|
||||
if (!pc) return NULL;
|
||||
|
||||
int i = ed->tex[0].next, c = 0;
|
||||
for (; i > 0 && c < 30; c++, i = ed->tex[i].next) *pc++ = ed->tex[i].c;
|
||||
*pc++ = '\0';
|
||||
|
||||
return buf;
|
||||
}
|
||||
*/
|
||||
#endif // KOLIBRI_EDITOR_H
|
||||
|
@ -102,45 +102,20 @@ extern void (*tl_node_move_up)(treelist *) __attribute__((__stdcall__));
|
||||
///ïåðåìåùàåì óçåë âíèç
|
||||
extern void (*tl_node_move_down)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*tl_data_init_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///âûäåëåíèå ïàìÿòè äëÿ ñòðóêòóð ñïèñêà è îñíîâíîé èíôîðìàöèè (êîíñòðóêòîð)
|
||||
static inline void treelist_data_init(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_data_init)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_data_init_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_data_clear_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///î÷èñòêà ïàìÿòè ýëåìåíòà (äåñòðóêòîð)
|
||||
extern void (*tl_data_clear)(treelist *) __attribute__((__stdcall__));
|
||||
static inline void treelist_data_clear(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*tl_data_clear_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
(*tl_data_clear)(tl);
|
||||
free(tl->p_scroll);
|
||||
}
|
||||
|
||||
extern void (*tl_info_clear_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///î÷èñòêà ñïèñêà (èíôîðìàöèè)
|
||||
static inline void treelist_info_clear(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*tl_info_clear_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
extern void (*tl_info_clear)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*tl_key_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///ðåàêöèÿ íà êëàâèàòóðó
|
||||
@ -153,33 +128,13 @@ __attribute__((__stdcall__)) static inline void treelist_key(treelist *tl, oskey
|
||||
// (*tl_key_asm)(tl);
|
||||
}
|
||||
|
||||
extern void (*tl_info_undo_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///îòìåíà äåéñòâèÿ
|
||||
static inline void treelist_undo(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_info_undo)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_info_undo_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_info_redo_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///ïîâòîð äåéñòâèÿ
|
||||
static inline void treelist_redo(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_info_redo)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_info_redo_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_node_add_asm)(treelist *, uint32_t n_opt, void *n_info) __attribute__((__stdcall__));
|
||||
extern void (*tl_node_add)(treelist *, uint32_t n_opt, void *n_info) __attribute__((__stdcall__));
|
||||
///äîáàâèòü óçåë
|
||||
///input:
|
||||
/// tlist - óêàçàòåëü íà ñòðóêòóðó ëèñòà
|
||||
@ -187,235 +142,68 @@ extern void (*tl_node_add_asm)(treelist *, uint32_t n_opt, void *n_info) __attri
|
||||
/// n_info - óêàçàòåëü íà äîáàâëÿåìûå äàííûå
|
||||
static inline void treelist_node_add(treelist *tl, void *n_info, uint16_t type, uint8_t clos, uint8_t lev)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
uint32_t n_opt = (type << 16) | (clos << 8) | lev;
|
||||
(*tl_node_add_asm)(tl, n_opt, n_info);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
(*tl_node_add)(tl, n_opt, n_info);
|
||||
}
|
||||
|
||||
extern void (*tl_node_set_data_asm)(treelist *, void *n_info) __attribute__((__stdcall__));
|
||||
///çàïèñàòü â òåêóùèé óçåë
|
||||
///input:
|
||||
/// tlist - óêàçàòåëü íà ñòðóêòóðó ëèñòà
|
||||
/// n_info - óêàçàòåëü íà äàííûå
|
||||
static inline void treelist_node_setdata(treelist *tl, void *n_info)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%esi \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_node_set_data)(treelist *, void *n_info) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_node_set_data_asm)(tl, n_info);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%esi \n\t":::);
|
||||
}
|
||||
|
||||
extern void* (*tl_node_get_data_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///âçÿòü óêàçàòåëü íà äàííûå óçëà ïîä êóðñîðîì
|
||||
static inline void* treelist_getdata(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
void *res =
|
||||
(*tl_node_get_data_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
return res;
|
||||
}
|
||||
extern void* (*tl_node_get_data)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*tl_node_delete_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///óäàëèòü óçåë ïîä êóðñîðîì
|
||||
static inline void treelist_node_delete(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*tl_node_delete_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
extern void (*tl_node_delete)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*tl_cur_beg_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///ïîñòàâèòü êóðñîð íà ïåðâûé óçåë
|
||||
static inline void treelist_cursor_begin(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_cur_beg)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_cur_beg_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_cur_next_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ íèæå
|
||||
static inline void treelist_cursor_next(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%esi \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_cur_next)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_cur_next_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%esi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_cur_perv_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ âûøå
|
||||
static inline void treelist_cursor_prev(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%esi \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
(*tl_cur_perv_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%esi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
}
|
||||
extern void (*tl_cur_perv)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*tl_node_close_open_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///îòêðûòü/çàêðûòü óçåë (ðàáîòàåò ñ óçëàìè êîòîðûå èìåþò äî÷åðíèå óçëû)
|
||||
static inline void treelist_close_open(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_node_close_open)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_node_close_open_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_node_lev_inc_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///óâåëè÷èòü óðîâåíü
|
||||
static inline void treelist_level_inc(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_node_lev_inc)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_node_lev_inc_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern void (*tl_node_lev_dec_asm)(treelist *) __attribute__((__stdcall__));
|
||||
///óìåíüøèòü óðîâåíü
|
||||
static inline void treelist_level_dec(treelist *tl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void (*tl_node_lev_dec)(treelist *) __attribute__((__stdcall__));
|
||||
|
||||
(*tl_node_lev_dec_asm)(tl);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
}
|
||||
|
||||
extern treelist_node* (*tl_node_poi_get_info_asm)(treelist *, int node_ind) __attribute__((__stdcall__));
|
||||
///âçÿòü óêàçàòåëü íà ñòðóêòóðó óçëà â óêàçàííîé ïîçèöèè
|
||||
///input:
|
||||
/// tlist - pointer to 'TreeList' struct
|
||||
/// node_ind - node index
|
||||
///output - pointer to node info or NULL
|
||||
static inline treelist_node* treelist_getnode(treelist *tl, int node_ind)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
extern treelist_node* (*tl_node_poi_get_info)(treelist *, int node_ind) __attribute__((__stdcall__));
|
||||
|
||||
treelist_node *ret =
|
||||
(*tl_node_poi_get_info_asm)(tl, node_ind);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern treelist_node* (*tl_node_poi_get_next_info_asm)(treelist *, treelist_node*) __attribute__((__stdcall__));
|
||||
///âçÿòü óêàçàòåëü íà ñëåäóùóþ ñòðóêòóðó óçëà
|
||||
///input:
|
||||
/// tlist - pointer to 'TreeList' struct
|
||||
/// node_p - node param struct
|
||||
///output - pointer to next node struct or NULL
|
||||
static inline treelist_node* treelist_getnode_next(treelist *tl, treelist_node* node)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
extern treelist_node* (*tl_node_poi_get_next_info)(treelist *, treelist_node*) __attribute__((__stdcall__));
|
||||
|
||||
treelist_node *ret =
|
||||
(*tl_node_poi_get_next_info_asm)(tl, node);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern void* (*_tl_node_poi_get_data_asm)(treelist *, treelist_node*) __attribute__((__stdcall__));
|
||||
///;âçÿòü óêàçàòåëü íà äàííûå óçëà
|
||||
///input:
|
||||
/// tlist - pointer to 'TreeList' struct
|
||||
/// node_p - node param struct
|
||||
///output - pointer
|
||||
static inline void* treelist_getnode_data(treelist *tl, treelist_node *node)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%edi \n\t":::);
|
||||
extern void* (*_tl_node_poi_get_data)(treelist *, treelist_node*) __attribute__((__stdcall__));
|
||||
|
||||
void *ret =
|
||||
(*_tl_node_poi_get_data_asm)(tl, node);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t":::);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int (*tl_save_mem_asm)(treelist *, int opt, void *h_mem, int mem_size) __attribute__((__stdcall__));
|
||||
/// tlist - pointer to 'TreeList' struct
|
||||
/// opt - options: 0 - first element, 1 - add next element
|
||||
/// h_mem - pointer to memory
|
||||
/// mem_size - memory size
|
||||
///output - error code
|
||||
static inline int treelist_save2mem(treelist *tl, int opt, void *h_mem, int mem_size)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%esi \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
int ret =
|
||||
(*tl_save_mem_asm)(tl, opt, h_mem, mem_size);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%esi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
return ret;
|
||||
}
|
||||
extern int (*tl_save_mem)(treelist *, int opt, void *h_mem, int mem_size) __attribute__((__stdcall__));
|
||||
|
||||
extern int (*_tl_load_mem_asm)(treelist *, int opt, void *h_mem, int mem_size) __attribute__((__stdcall__));
|
||||
/**input:
|
||||
; tlist - pointer to 'TreeList' struct
|
||||
; opt - options: element index + (2*(add mode)+(init mode)) shl 16, tl_load_mode_add equ 0x20000 ;îïöèÿ ñ÷èòûâàíèÿ â ðåæèìå äîáàâëåíèÿ èíôîðìàöèè
|
||||
@ -436,40 +224,11 @@ extern int (*_tl_load_mem_asm)(treelist *, int opt, void *h_mem, int mem_size) _
|
||||
; +22 - (4) scroll pos
|
||||
;memory data format:
|
||||
; +26 - (info size + 8) * count nodes */
|
||||
static inline int treelist_load4mem(treelist *tl, int opt, void *h_mem, int mem_size)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%esi \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
extern int (*_tl_load_mem)(treelist *, int opt, void *h_mem, int mem_size) __attribute__((__stdcall__));
|
||||
|
||||
int ret =
|
||||
(*_tl_load_mem_asm)(tl, opt, h_mem, mem_size);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%esi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int (*tl_get_mem_size_asm)(treelist *, void *h_mem) __attribute__((__stdcall__));
|
||||
/// ;áåðåò ðàçìåð ïàìÿòè çàíÿòîé ôóíêöèåé tl_save_mem ïðè ñîõðàíåíèè ýëåìåíòîâ
|
||||
/// tlist - pointer to 'TreeList' struct
|
||||
/// h_mem - pointer to saved memory
|
||||
static inline int treelist_get_memsize(treelist *tl, void *h_mem)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"push %%ebx \n\t"
|
||||
"push %%edi \n\t":::);
|
||||
|
||||
int ret =
|
||||
(*tl_get_mem_size_asm)(tl, h_mem);
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pop %%edi \n\t"
|
||||
"pop %%ebx \n\t":::);
|
||||
return ret;
|
||||
}
|
||||
extern int (*tl_get_mem_size)(treelist *, void *h_mem) __attribute__((__stdcall__));
|
||||
|
||||
#endif //KOLIBRI_TREELIST_H
|
||||
|
Loading…
Reference in New Issue
Block a user