24 |
|
|
25 |
#include <stdio.h> |
#include <stdio.h> |
26 |
#include <errno.h> |
#include <errno.h> |
27 |
|
#include <time.h> |
28 |
#include <utime.h> |
#include <utime.h> |
29 |
#include <dirent.h> |
#include <dirent.h> |
30 |
#include <sys/types.h> |
#include <sys/types.h> |
47 |
#undef realloc |
#undef realloc |
48 |
#undef init_process |
#undef init_process |
49 |
#include <Carbon/Carbon.h> |
#include <Carbon/Carbon.h> |
50 |
|
#undef mktime |
51 |
|
#define mktime emacs_mktime |
52 |
#undef free |
#undef free |
53 |
#define free unexec_free |
#define free unexec_free |
54 |
#undef malloc |
#undef malloc |
75 |
#include "process.h" |
#include "process.h" |
76 |
#include "sysselect.h" |
#include "sysselect.h" |
77 |
#include "systime.h" |
#include "systime.h" |
78 |
|
#include "blockinput.h" |
79 |
|
|
80 |
Lisp_Object QCLIPBOARD; |
Lisp_Object QCLIPBOARD; |
81 |
|
|
2551 |
|
|
2552 |
CHECK_STRING (script); |
CHECK_STRING (script); |
2553 |
|
|
2554 |
|
BLOCK_INPUT; |
2555 |
status = do_applescript (SDATA (script), &result); |
status = do_applescript (SDATA (script), &result); |
2556 |
|
UNBLOCK_INPUT; |
2557 |
if (status) |
if (status) |
2558 |
{ |
{ |
2559 |
if (!result) |
if (!result) |
2623 |
() |
() |
2624 |
{ |
{ |
2625 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
2626 |
|
OSStatus err; |
2627 |
ScrapRef scrap; |
ScrapRef scrap; |
2628 |
ScrapFlavorFlags sff; |
ScrapFlavorFlags sff; |
2629 |
Size s; |
Size s; |
2630 |
int i; |
int i; |
2631 |
char *data; |
char *data; |
2632 |
|
|
2633 |
if (GetCurrentScrap (&scrap) != noErr) |
BLOCK_INPUT; |
2634 |
return Qnil; |
err = GetCurrentScrap (&scrap); |
2635 |
|
if (err == noErr) |
2636 |
if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) != noErr) |
err = GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff); |
2637 |
return Qnil; |
if (err == noErr) |
2638 |
|
err = GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s); |
2639 |
if (GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s) != noErr) |
if (err == noErr && (data = (char*) alloca (s))) |
2640 |
return Qnil; |
err = GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data); |
2641 |
|
UNBLOCK_INPUT; |
2642 |
if ((data = (char*) alloca (s)) == NULL) |
if (err != noErr || s == 0) |
|
return Qnil; |
|
|
|
|
|
if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr |
|
|
|| s == 0) |
|
2643 |
return Qnil; |
return Qnil; |
2644 |
|
|
2645 |
/* Emacs expects clipboard contents have Unix-style eol's */ |
/* Emacs expects clipboard contents have Unix-style eol's */ |
2704 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
2705 |
{ |
{ |
2706 |
ScrapRef scrap; |
ScrapRef scrap; |
2707 |
|
|
2708 |
|
BLOCK_INPUT; |
2709 |
ClearCurrentScrap (); |
ClearCurrentScrap (); |
2710 |
if (GetCurrentScrap (&scrap) != noErr) |
if (GetCurrentScrap (&scrap) != noErr) |
2711 |
error ("cannot get current scrap"); |
{ |
2712 |
|
UNBLOCK_INPUT; |
2713 |
|
error ("cannot get current scrap"); |
2714 |
|
} |
2715 |
|
|
2716 |
if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len, |
if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len, |
2717 |
buf) != noErr) |
buf) != noErr) |
2718 |
error ("cannot put to scrap"); |
{ |
2719 |
|
UNBLOCK_INPUT; |
2720 |
|
error ("cannot put to scrap"); |
2721 |
|
} |
2722 |
|
UNBLOCK_INPUT; |
2723 |
} |
} |
2724 |
#else /* not TARGET_API_MAC_CARBON */ |
#else /* not TARGET_API_MAC_CARBON */ |
2725 |
ZeroScrap (); |
ZeroScrap (); |
2754 |
ScrapRef scrap; |
ScrapRef scrap; |
2755 |
ScrapFlavorFlags sff; |
ScrapFlavorFlags sff; |
2756 |
|
|
2757 |
|
BLOCK_INPUT; |
2758 |
if (GetCurrentScrap (&scrap) == noErr) |
if (GetCurrentScrap (&scrap) == noErr) |
2759 |
if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr) |
if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr) |
2760 |
val = Qt; |
val = Qt; |
2761 |
|
UNBLOCK_INPUT; |
2762 |
#else /* not TARGET_API_MAC_CARBON */ |
#else /* not TARGET_API_MAC_CARBON */ |
2763 |
Handle my_handle; |
Handle my_handle; |
2764 |
long rc, scrap_offset; |
long rc, scrap_offset; |
2783 |
extern int inhibit_window_system; |
extern int inhibit_window_system; |
2784 |
extern int noninteractive; |
extern int noninteractive; |
2785 |
|
|
|
#include "blockinput.h" |
|
|
|
|
2786 |
/* When Emacs is started from the Finder, SELECT always immediately |
/* When Emacs is started from the Finder, SELECT always immediately |
2787 |
returns as if input is present when file descriptor 0 is polled for |
returns as if input is present when file descriptor 0 is polled for |
2788 |
input. Strangely, when Emacs is run as a GUI application from the |
input. Strangely, when Emacs is run as a GUI application from the |