Mercurial > vim
annotate src/if_perlsfio.c @ 36179:e134e2d4fe29 default tip
Added tag v9.1.0739 for changeset dae96c59b506230be0539f863890c050674940f0
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Sep 2024 11:45:05 +0200 |
parents | f0f9692d4487 |
children |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
7823
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 /* | |
10 * if_perlsfio.c: Special I/O functions for Perl interface. | |
11 */ | |
12 | |
18798
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
13 #define _memory_h // avoid memset redeclaration |
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
14 #define IN_PERL_FILE // don't include if_perl.pro from prot.h |
7 | 15 |
16 #include "vim.h" | |
17 | |
18 #if defined(USE_SFIO) || defined(PROTO) | |
19 | |
18798
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
20 #ifndef USE_SFIO // just generating prototypes |
7 | 21 # define Sfio_t int |
22 # define Sfdisc_t int | |
23 #endif | |
24 | |
25 #define NIL(type) ((type)0) | |
26 | |
27 static int | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
28 sfvimwrite( |
18798
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
29 Sfio_t *f, // stream involved |
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
30 char *buf, // buffer to read from |
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
31 int n, // number of bytes to write |
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
32 Sfdisc_t *disc) // discipline |
7 | 33 { |
34 char_u *str; | |
35 | |
36 str = vim_strnsave((char_u *)buf, n); | |
37 if (str == NULL) | |
38 return 0; | |
39 msg_split((char *)str); | |
40 vim_free(str); | |
41 | |
42 return n; | |
43 } | |
44 | |
45 /* | |
46 * sfdcnewnvi -- | |
47 * Create Vim discipline | |
48 */ | |
49 Sfdisc_t * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
50 sfdcnewvim(void) |
7 | 51 { |
52 Sfdisc_t *disc; | |
53 | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16764
diff
changeset
|
54 disc = ALLOC_ONE(Sfdisc_t); |
7 | 55 if (disc == NULL) |
56 return NULL; | |
57 | |
58 disc->readf = (Sfread_f)NULL; | |
59 disc->writef = sfvimwrite; | |
60 disc->seekf = (Sfseek_f)NULL; | |
61 disc->exceptf = (Sfexcept_f)NULL; | |
62 | |
63 return disc; | |
64 } | |
65 | |
18798
f0f9692d4487
patch 8.1.2387: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
66 #endif // USE_SFIO |