comparison src/editors.h @ 140:e57b0207e180

editors.c was almost completely rewritten: - centralized template parsing - better control of executed editors - possibility to get editor exit status via callback
author nadvornik
date Sun, 30 Sep 2007 21:10:54 +0000
parents 71e1ebee420e
children f6e307c7bad6
comparison
equal deleted inserted replaced
139:754c1e4349b6 140:e57b0207e180
11 11
12 12
13 #ifndef EDITORS_H 13 #ifndef EDITORS_H
14 #define EDITORS_H 14 #define EDITORS_H
15 15
16 enum {
17 EDITOR_KEEP_FS = 0x00000001,
18 EDITOR_VERBOSE = 0x00000002,
19 EDITOR_VERBOSE_MULTI = 0x00000004,
20
21 EDITOR_DEST = 0x00000100,
22 EDITOR_FOR_EACH = 0x00000200,
23 EDITOR_SINGLE_COMMAND = 0x00000400,
24
25 EDITOR_ERROR_EMPTY = 0x00020000,
26 EDITOR_ERROR_SYNTAX = 0x00040000,
27 EDITOR_ERROR_INCOMPATIBLE = 0x00080000,
28 EDITOR_ERROR_NO_FILE = 0x00100000,
29 EDITOR_ERROR_CANT_EXEC = 0x00200000,
30 EDITOR_ERROR_STATUS = 0x00400000,
31 EDITOR_ERROR_SKIPPED = 0x00800000,
32
33 EDITOR_ERROR_MASK = 0xffff0000
34
35 };
36
37 /* return values from callback function */
38 enum {
39 EDITOR_CB_CONTINUE = 0, /* continue multiple editor execution on remaining files*/
40 EDITOR_CB_SKIP, /* skip the remaining files */
41 EDITOR_CB_SUSPEND /* suspend execution, one of editor_resume or editor_skip
42 must be called later */
43 };
44
45
46 /*
47 Callback is called even on skipped files, with the EDITOR_ERROR_SKIPPED flag set.
48 It is a good place to call file_data_change_info_free().
49
50 ed - pointer that can be used for editor_resume/editor_skip or NULL if all files were already processed
51 flags - flags above
52 list - list of procesed FileData structures, typically single file or whole list passed to start_editor_*
53 data - generic pointer
54 */
55 typedef gint (*EditorCallback) (gpointer ed, gint flags, GList *list, gpointer data);
56
57
58
59 void editor_resume(gpointer ed);
60 void editor_skip(gpointer ed);
61
62
63 gint editor_command_parse(const gchar *template, GList *list, gchar **output);
16 64
17 void editor_reset_defaults(void); 65 void editor_reset_defaults(void);
18 gint start_editor_from_file(gint n, FileData *fd); 66 gint start_editor_from_file(gint n, FileData *fd);
19 gint start_editor_from_file_list(gint n, GList *list); 67 gint start_editor_from_file_list(gint n, GList *list);
20 68 gint start_editor_from_file_full(gint n, FileData *fd, EditorCallback cb, gpointer data);
69 gint start_editor_from_file_list_full(gint n, GList *list, EditorCallback cb, gpointer data);
21 gint editor_window_flag_set(gint n); 70 gint editor_window_flag_set(gint n);
22 71 const gchar *editor_get_error_str(gint flags);
23 72
24 #endif 73 #endif
25 74
26 75
27 76