comparison src/w16select.c @ 30900:2bec1c202b13

(set_clipboard_data): If there's not enough memory to put text into clipboard, return 1, as Fw16_set_clipboard_data expects. In case of other failures, return 3. (system_error_msg): New error message. (Fw16_set_clipboard_data): If set_clipboard_data returns 3, print system_error_msg.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 17 Aug 2000 06:10:09 +0000
parents b19b46eabcb5
children fd7c0dac2110
comparison
equal deleted inserted replaced
30899:429c384fc024 30900:2bec1c202b13
246 unsigned truelen; 246 unsigned truelen;
247 unsigned long xbuf_addr, buf_offset; 247 unsigned long xbuf_addr, buf_offset;
248 unsigned char *dp = Data, *dstart = dp; 248 unsigned char *dp = Data, *dstart = dp;
249 249
250 if (Format != CF_OEMTEXT) 250 if (Format != CF_OEMTEXT)
251 return 0; 251 return 3;
252 252
253 /* need to know final size after '\r' chars are inserted (the 253 /* need to know final size after '\r' chars are inserted (the
254 standard CF_OEMTEXT clipboard format uses CRLF line endings, 254 standard CF_OEMTEXT clipboard format uses CRLF line endings,
255 while Emacs uses just LF internally). */ 255 while Emacs uses just LF internally). */
256 truelen = Size + 1; /* +1 for the terminating null */ 256 truelen = Size + 1; /* +1 for the terminating null */
264 dp++; 264 dp++;
265 } 265 }
266 } 266 }
267 267
268 if (clipboard_compact (truelen) < truelen) 268 if (clipboard_compact (truelen) < truelen)
269 return 0; 269 return 1;
270 270
271 if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0) 271 if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0)
272 return 0; 272 return 1;
273 273
274 /* Move the buffer into the low memory, convert LF into CR-LF if needed. */ 274 /* Move the buffer into the low memory, convert LF into CR-LF if needed. */
275 if (Raw) 275 if (Raw)
276 { 276 {
277 dosmemput (Data, Size, xbuf_addr); 277 dosmemput (Data, Size, xbuf_addr);
331 331
332 /* If the above failed, invalidate the local copy of the clipboard. */ 332 /* If the above failed, invalidate the local copy of the clipboard. */
333 if (regs.x.ax == 0) 333 if (regs.x.ax == 0)
334 *last_clipboard_text = '\0'; 334 *last_clipboard_text = '\0';
335 335
336 /* Zero means success, otherwise (1 or 2) it's an error. */ 336 /* Zero means success, otherwise (1, 2, or 3) it's an error. */
337 return regs.x.ax > 0 ? 0 : 1; 337 return regs.x.ax > 0 ? 0 : 3;
338 } 338 }
339 339
340 /* Return the size of the clipboard data of format FORMAT. */ 340 /* Return the size of the clipboard data of format FORMAT. */
341 unsigned 341 unsigned
342 get_clipboard_data_size (Format) 342 get_clipboard_data_size (Format)
475 475
476 static char no_mem_msg[] = 476 static char no_mem_msg[] =
477 "(Not enough DOS memory to put saved text into clipboard.)"; 477 "(Not enough DOS memory to put saved text into clipboard.)";
478 static char binary_msg[] = 478 static char binary_msg[] =
479 "(Binary characters in saved text; clipboard data not set.)"; 479 "(Binary characters in saved text; clipboard data not set.)";
480 static char system_error_msg[] =
481 "(Clipboard interface failure; clipboard data not set.)";
480 482
481 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0, 483 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
482 "This sets the clipboard data to the given text.") 484 "This sets the clipboard data to the given text.")
483 (string, frame) 485 (string, frame)
484 Lisp_Object string, frame; 486 Lisp_Object string, frame;
574 case 1: 576 case 1:
575 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0); 577 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0);
576 break; 578 break;
577 case 2: 579 case 2:
578 message2 (binary_msg, sizeof (binary_msg) - 1, 0); 580 message2 (binary_msg, sizeof (binary_msg) - 1, 0);
581 break;
582 case 3:
583 message2 (system_error_msg, sizeof (system_error_msg) - 1, 0);
579 break; 584 break;
580 } 585 }
581 sit_for (2, 0, 0, 1, 1); 586 sit_for (2, 0, 0, 1, 1);
582 } 587 }
583 588