Update credits
[MacVim.git] / src / if_perlsfio.c
blob0ae1b956dc0bbb6264c1d4c7a82baf163c784608
1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
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.
13 #define _memory_h /* avoid memset redeclaration */
14 #define IN_PERL_FILE /* don't include if_perl.pro from prot.h */
16 #include "vim.h"
18 #if defined(USE_SFIO) || defined(PROTO)
20 #ifndef USE_SFIO /* just generating prototypes */
21 # define Sfio_t int
22 # define Sfdisc_t int
23 #endif
25 #define NIL(type) ((type)0)
27 static int
28 sfvimwrite(f, buf, n, disc)
29 Sfio_t *f; /* stream involved */
30 char *buf; /* buffer to read from */
31 int n; /* number of bytes to write */
32 Sfdisc_t *disc; /* discipline */
34 char_u *str;
36 str = vim_strnsave((char_u *)buf, n);
37 if (str == NULL)
38 return 0;
39 msg_split((char *)str);
40 vim_free(str);
42 return n;
46 * sfdcnewnvi --
47 * Create Vim discipline
49 Sfdisc_t *
50 sfdcnewvim()
52 Sfdisc_t *disc;
54 disc = (Sfdisc_t *)alloc((unsigned)sizeof(Sfdisc_t));
55 if (disc == NULL)
56 return NULL;
58 disc->readf = (Sfread_f)NULL;
59 disc->writef = sfvimwrite;
60 disc->seekf = (Sfseek_f)NULL;
61 disc->exceptf = (Sfexcept_f)NULL;
63 return disc;
66 #endif /* USE_SFIO */