Mercurial > hg > xemacs-beta
annotate tests/tooltalk/load-file.c @ 4989:d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-02-06 Ben Wing <ben@xemacs.org>
* code-init.el:
* code-init.el (set-eol-detection):
* code-init.el (coding-system-current-system-configuration):
* code-init.el (coding-system-default-configuration-table): New.
* code-init.el (no-mule-no-eol-detection):
* code-init.el (define-coding-system-default-configuration): New.
* code-init.el (coding-system-variable-default-value-table): Removed.
* code-init.el (no-mule-eol-detection):
* code-init.el (coding-system-default-configuration-list): Removed.
* code-init.el (coding-system-default-variable-list):
* code-init.el (get-coding-system-variable):
* code-init.el (set-coding-system-variable):
* code-init.el (coding-system-variable-default-value):
* code-init.el (reset-coding-categories-to-default):
Significant clean-up, add Cygwin-UTF-8 support.
1. Shorten the names of the coding system variables to follow
what used to be considered the "abbreviations":
default-process-coding-system-read -> process-read
default-process-coding-system-write -> process-write
buffer-file-coding-system-for-read -> bfcs-for-read
default-buffer-file-coding-system -> default-bfcs
no-conversion-coding-system-mapping -> no-conv-cs
2. Instead of listing all the defaults in a big, strangely organized
table, use a new function
`define-coding-system-default-configuration' to define a
particular configuration. This uses a hash table stored in
`coding-system-default-configuration-table'. Rewrite
`coding-system-variable-default-value' appropriately.
3. Rename configurations to eliminate `unix' from the name:
unix-no-mule-no-eol-detection -> no-mule-no-eol-detection
unix-no-mule-eol-detection -> no-mule-eol-detection
unix-mule -> mule
This is because these are really for all systems but Windows,
not just Unix.
4. Add configuration `cygwin-utf-8', enabled when (featurep
'cygwin-use-utf-8). Uses `utf-8' for all defaults except for
`bfcs-for-read', which is `undecided'.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 06 Feb 2010 03:59:18 -0600 |
parents | 131b0175ea99 |
children | 9fc91aa3a927 |
rev | line source |
---|---|
70 | 1 /* load-file.c - load & execute an Emacs Lisp file in XEmacs using ToolTalk */ |
2 | |
3 /* See `tooltalk-load-file-handler' in the file lisp/tooltalk/tooltalk-init.el | |
4 for the receiver side. */ | |
5 | |
6 #include <desktop/tt_c.h> | |
7 #include <stdio.h> | |
8 #include <stdlib.h> | |
9 #include <sys/wait.h> | |
10 | |
11 Tt_status tter; | |
12 | |
13 #define exit_err_ptr(ptr) \ | |
14 if ((tter = tt_ptr_error(ptr)) != TT_OK) \ | |
15 { fprintf(stderr, "%d:%s\n", __LINE__, tt_status_message(tter)); exit(1); } | |
16 | |
17 #define exit_err(stat) \ | |
18 if ((tter = stat) != TT_OK) \ | |
19 { fprintf(stderr, "%d:%s\n", __LINE__, tt_status_message(tter)); exit(1); } | |
20 | |
21 Tt_callback_action callback_fn(Tt_message msg, Tt_pattern pat); | |
22 static Tt_message create_new_message(char *pathname); | |
23 static int initialize_tooltalk(void); | |
24 static void usage(void); | |
25 | |
26 static char* tt_procid; | |
27 | |
28 Tt_callback_action | |
29 callback_fn(Tt_message msg, Tt_pattern pat) | |
30 { | |
31 tt_message_destroy(msg); | |
32 return TT_CALLBACK_PROCESSED; | |
33 } | |
34 | |
35 static Tt_message | |
36 create_new_message(char *pathname) | |
37 { | |
38 Tt_message msg; | |
39 | |
40 msg = tt_message_create(); | |
41 exit_err_ptr(msg); | |
42 | |
43 exit_err(tt_message_address_set (msg, TT_PROCEDURE)); | |
44 exit_err(tt_message_class_set (msg, TT_REQUEST)); | |
45 exit_err(tt_message_scope_set (msg, TT_SESSION)); | |
46 exit_err(tt_message_op_set (msg, "emacs-load-file")); | |
47 exit_err(tt_message_arg_add (msg, TT_IN, "file", pathname)); | |
48 exit_err(tt_message_callback_add(msg, callback_fn)); | |
49 | |
50 return msg; | |
51 } | |
52 | |
53 static int | |
54 initialize_tooltalk(void) { | |
55 int rcode; | |
56 | |
57 tt_procid = tt_open(); | |
58 if ((rcode = tt_ptr_error(tt_procid)) != TT_OK) { | |
59 return rcode; | |
60 } | |
61 | |
62 if ((rcode = tt_session_join(tt_default_session())) != TT_OK) { | |
63 return (rcode); | |
64 } | |
65 } | |
66 | |
67 | |
68 static void | |
69 usage(void) | |
70 { | |
71 fprintf(stderr, | |
72 "Usage: load-file pathname\n\n"); | |
73 } | |
74 | |
75 void | |
76 main(argc, argv) | |
77 int argc; | |
78 char *argv[]; | |
79 { | |
80 | |
81 Tt_message msg; | |
82 | |
83 if (argc != 2) { | |
84 usage(); | |
85 exit(0); | |
86 } | |
87 | |
88 exit_err(initialize_tooltalk()); | |
89 | |
90 msg = create_new_message(argv[1]); | |
91 | |
92 exit_err(tt_message_send(msg)); | |
93 | |
94 return; | |
95 } |