1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #ifndef XNEDIT_FILTER_H
23 #define XNEDIT_FILTER_H
24
25 #include "nedit.h"
26
27 #include <X11/Intrinsic.h>
28 #include <X11/Xresource.h>
29 #include <Xm/Xm.h>
30 #include <X11/Xlib.h>
31
32 typedef struct IOFilter IOFilter;
33 struct IOFilter {
34 char *name;
35 char *pattern;
36 char *ext;
37 char *cmdin;
38 char *cmdout;
39 char *ec_pattern;
40 };
41
42 #define FILESTREAM_HDR_BUFLEN 32768
43 typedef struct FileStream {
44 FILE *file;
45 int pin[
2];
46 int pout[
2];
47 pid_t pid;
48 char *filter_cmd;
49 char hdrbuf[
FILESTREAM_HDR_BUFLEN];
50 size_t hdrbuflen;
51 size_t hdrbufpos;
52 int mode;
53 } FileStream;
54
55 void FilterSettings(WindowInfo *window);
56
57 void ParseFilterSettings(
char *str);
58
59 char* WriteFilterString(
void);
60
61 IOFilter** GetFilterList(
size_t *num);
62
63 IOFilter* GetFilterFromName(
const char *name);
64
65 IOFilter* GetFilterForPath(
const char *path);
66
67 FileStream* filestream_open_r(Widget w,
FILE *f,
const char *filter_cmd);
68 FileStream* filestream_open_w(Widget w,
FILE *f,
const char *filter_cmd);
69 int filestream_reset(FileStream *stream,
int pos);
70 size_t filestream_read(
void *buffer,
size_t nbytes, FileStream *stream);
71 size_t filestream_write(
const void *buffer,
size_t nbytes, FileStream *stream);
72 int filestream_close(FileStream *stream);
73
74
75
76 #endif
77