annotate src/if_perlsfio.c @ 3433:3229335d0c4e v7.3.482

updated for version 7.3.482 Problem: With 'cursorbind' set moving up/down does not always keep the same column. Solution: Set curswant appropriately. (Gary Johnson)
author Bram Moolenaar <bram@vim.org>
date Wed, 28 Mar 2012 14:19:50 +0200
parents 3fc0f57ecb91
children bcef391c101c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 * if_perlsfio.c: Special I/O functions for Perl interface.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #define _memory_h /* avoid memset redeclaration */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 #define IN_PERL_FILE /* don't include if_perl.pro from prot.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #if defined(USE_SFIO) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #ifndef USE_SFIO /* just generating prototypes */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 # define Sfio_t int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 # define Sfdisc_t int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 #define NIL(type) ((type)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 sfvimwrite(f, buf, n, disc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 Sfio_t *f; /* stream involved */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 char *buf; /* buffer to read from */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 int n; /* number of bytes to write */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 Sfdisc_t *disc; /* discipline */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 char_u *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 str = vim_strnsave((char_u *)buf, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 if (str == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 msg_split((char *)str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 vim_free(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 return n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 * sfdcnewnvi --
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 * Create Vim discipline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 Sfdisc_t *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 sfdcnewvim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 Sfdisc_t *disc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 disc = (Sfdisc_t *)alloc((unsigned)sizeof(Sfdisc_t));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 if (disc == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 disc->readf = (Sfread_f)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 disc->writef = sfvimwrite;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 disc->seekf = (Sfseek_f)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 disc->exceptf = (Sfexcept_f)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 return disc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #endif /* USE_SFIO */