MCPcopy Create free account
hub / github.com/Kitware/CMake / _paste

Function _paste

Utilities/cmpdcurses/pdcurses/getch.c:190–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190static int _paste(void)
191{
192#ifdef PDC_WIDE
193 wchar_t *wpaste;
194# define PASTE wpaste
195#else
196# define PASTE paste
197#endif
198 char *paste;
199 long len, newmax;
200 int key;
201
202 key = PDC_getclipboard(&paste, &len);
203 if (PDC_CLIP_SUCCESS != key || !len)
204 return -1;
205
206#ifdef PDC_WIDE
207 wpaste = malloc(len * sizeof(wchar_t));
208 len = PDC_mbstowcs(wpaste, paste, len);
209#endif
210 newmax = len + SP->c_ungind;
211 if (newmax > SP->c_ungmax)
212 {
213 SP->c_ungch = realloc(SP->c_ungch, newmax * sizeof(int));
214 if (!SP->c_ungch)
215 return -1;
216 SP->c_ungmax = newmax;
217 }
218 while (len > 1)
219 PDC_ungetch(PASTE[--len]);
220 key = *PASTE;
221#ifdef PDC_WIDE
222 free(wpaste);
223#endif
224 PDC_freeclipboard(paste);
225 SP->key_modifiers = 0;
226
227 return key;
228}
229
230static int _mouse_key(void)
231{

Callers 2

_mouse_keyFunction · 0.85
wgetchFunction · 0.85

Calls 4

PDC_getclipboardFunction · 0.85
PDC_mbstowcsFunction · 0.85
PDC_ungetchFunction · 0.85
PDC_freeclipboardFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…