annotate src/os_qnx.c @ 26365:9722ad38bd53

Added tag v8.2.3713 for changeset baf0d27eb0246dea8157d24e7bf999ce6567687b
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 Dec 2021 12:00:06 +0100
parents 44b855153d8e
children 3365a601e73b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 7833
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
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 * QNX port by Julian Kinraid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * os_qnx.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #if defined(FEAT_GUI_PHOTON)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 int is_photon_available;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
7833
c079097365f3 commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents: 5735
diff changeset
22 void qnx_init(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #if defined(FEAT_GUI_PHOTON)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 PhChannelParms_t parms;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
27 memset(&parms, 0, sizeof(parms));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 parms.flags = Ph_DYNAMIC_BUFFER;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
30 is_photon_available = (PhAttach(NULL, &parms) != NULL) ? TRUE : FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #if (defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD)) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #define CLIP_TYPE_VIM "VIMTYPE"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #define CLIP_TYPE_TEXT "TEXT"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
39 // Turn on the clipboard for a console vim when photon is running
7833
c079097365f3 commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents: 5735
diff changeset
40 void qnx_clip_init(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
42 if (is_photon_available == TRUE && !gui.in_use)
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
43 clip_init(TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
46 /////////////////////////////////////////////////////////////////////////////
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
47 // Clipboard
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
49 // No support for owning the clipboard
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 int
17063
3147c7c2e86b patch 8.1.1531: clipboard type name is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16768
diff changeset
51 clip_mch_own_selection(Clipboard_T *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 void
17063
3147c7c2e86b patch 8.1.1531: clipboard type name is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16768
diff changeset
57 clip_mch_lose_selection(Clipboard_T *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 void
17063
3147c7c2e86b patch 8.1.1531: clipboard type name is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16768
diff changeset
62 clip_mch_request_selection(Clipboard_T *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 int type = MLINE, clip_length = 0, is_type_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 void *cbdata;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 PhClipHeader *clip_header;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 char_u *clip_text = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
69 cbdata = PhClipboardPasteStart(PhInputGroup(NULL));
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
70 if (cbdata != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
72 // Look for the vim specific clip first
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
73 clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
74 if (clip_header != NULL && clip_header->data != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
76 switch(*(char *) clip_header->data)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
78 default: // fallthrough to line type
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 case 'L': type = MLINE; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 case 'C': type = MCHAR; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 case 'B': type = MBLOCK; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 is_type_set = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
86 // Try for just normal text
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
87 clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_TEXT);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
88 if (clip_header != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 clip_text = clip_header->data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 clip_length = clip_header->length - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
93 if (clip_text != NULL && is_type_set == FALSE)
2896
fd4224d9ee09 updated for version 7.3.221
Bram Moolenaar <bram@vim.org>
parents: 419
diff changeset
94 type = MAUTO;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
97 if ((clip_text != NULL) && (clip_length > 0))
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
98 clip_yank_selection(type, clip_text, clip_length, cbd);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
100 PhClipboardPasteFinish(cbdata);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 void
17063
3147c7c2e86b patch 8.1.1531: clipboard type name is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16768
diff changeset
105 clip_mch_set_selection(Clipboard_T *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 long_u len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 char_u *text_clip, vim_clip[2], *str = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 PhClipHeader clip_header[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
112 // Prevent recursion from clip_get_selection()
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
113 if (cbd->owned == TRUE)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 cbd->owned = TRUE;
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
117 clip_get_selection(cbd);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 cbd->owned = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
120 type = clip_convert_selection(&str, &len, cbd);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
121 if (type >= 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 {
16768
695d9ef00b03 patch 8.1.1386: unessesary type casts for lalloc()
Bram Moolenaar <Bram@vim.org>
parents: 16162
diff changeset
123 text_clip = alloc(len + 1); // Normal text
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
125 if (text_clip && vim_clip)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
127 memset(clip_header, 0, sizeof(clip_header));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
129 STRNCPY(clip_header[0].type, CLIP_TYPE_VIM, 8);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
130 clip_header[0].length = sizeof(vim_clip);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 clip_header[0].data = vim_clip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
133 STRNCPY(clip_header[1].type, CLIP_TYPE_TEXT, 8);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 clip_header[1].length = len + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 clip_header[1].data = text_clip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
137 switch(type)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 17063
diff changeset
139 default: // fallthrough to MLINE
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 case MLINE: *vim_clip = 'L'; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 case MCHAR: *vim_clip = 'C'; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 case MBLOCK: *vim_clip = 'B'; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
145 vim_strncpy(text_clip, str, len);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 vim_clip[ 1 ] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
149 PhClipboardCopy(PhInputGroup(NULL), 2, clip_header);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 }
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
151 vim_free(text_clip);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 }
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
153 vim_free(str);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 #endif