aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuanma Barranquero2010-07-07 11:38:03 +0200
committerJuanma Barranquero2010-07-07 11:38:03 +0200
commitcf84bb53567cf64b3dade9e9abeaef289371f0cc (patch)
tree93053d9c5d8de3754cf661b32a3859113d256192 /src
parent1a4990fb03fb1e7e608269e299ae2caef5155168 (diff)
downloademacs-cf84bb53567cf64b3dade9e9abeaef289371f0cc.tar.gz
emacs-cf84bb53567cf64b3dade9e9abeaef289371f0cc.zip
* coding.c, sysdep.c: Convert some more functions to standard C.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/coding.c124
-rw-r--r--src/sysdep.c103
3 files changed, 124 insertions, 107 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 51088e3666a..9f9e31b0b7b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12010-07-07 Juanma Barranquero <lekktu@gmail.com> 12010-07-07 Juanma Barranquero <lekktu@gmail.com>
2 2
3 * coding.c, sysdep.c: Convert some more functions to standard C.
4
52010-07-07 Juanma Barranquero <lekktu@gmail.com>
6
3 * coding.c (decode_coding_gap, encode_coding_gap, decode_coding_object) 7 * coding.c (decode_coding_gap, encode_coding_gap, decode_coding_object)
4 (encode_coding_object): Use SPECPDL_INDEX. 8 (encode_coding_object): Use SPECPDL_INDEX.
5 (syms_of_coding): Use DOS_NT. 9 (syms_of_coding): Use DOS_NT.
diff --git a/src/coding.c b/src/coding.c
index f38beafed9f..f16d505b67a 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -154,9 +154,8 @@ STRUCT CODING_SYSTEM
154 154
155#if 0 155#if 0
156static int 156static int
157detect_coding_XXX (coding, detect_info) 157detect_coding_XXX (struct coding_system *coding,
158 struct coding_system *coding; 158 struct coding_detection_info *detect_info)
159 struct coding_detection_info *detect_info;
160{ 159{
161 const unsigned char *src = coding->source; 160 const unsigned char *src = coding->source;
162 const unsigned char *src_end = coding->source + coding->src_bytes; 161 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -203,8 +202,7 @@ detect_coding_XXX (coding, detect_info)
203 202
204#if 0 203#if 0
205static void 204static void
206decode_coding_XXXX (coding) 205decode_coding_XXXX (struct coding_system *coding)
207 struct coding_system *coding;
208{ 206{
209 const unsigned char *src = coding->source + coding->consumed; 207 const unsigned char *src = coding->source + coding->consumed;
210 const unsigned char *src_end = coding->source + coding->src_bytes; 208 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -261,8 +259,7 @@ decode_coding_XXXX (coding)
261 Below is a template of these functions. */ 259 Below is a template of these functions. */
262#if 0 260#if 0
263static void 261static void
264encode_coding_XXX (coding) 262encode_coding_XXX (struct coding_system *coding)
265 struct coding_system *coding;
266{ 263{
267 int multibytep = coding->dst_multibyte; 264 int multibytep = coding->dst_multibyte;
268 int *charbuf = coding->charbuf; 265 int *charbuf = coding->charbuf;
@@ -1165,7 +1162,8 @@ coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes)
1165} 1162}
1166 1163
1167static void 1164static void
1168coding_alloc_by_making_gap (struct coding_system *coding, EMACS_INT gap_head_used, EMACS_INT bytes) 1165coding_alloc_by_making_gap (struct coding_system *coding,
1166 EMACS_INT gap_head_used, EMACS_INT bytes)
1169{ 1167{
1170 if (EQ (coding->src_object, coding->dst_object)) 1168 if (EQ (coding->src_object, coding->dst_object))
1171 { 1169 {
@@ -1194,7 +1192,8 @@ coding_alloc_by_making_gap (struct coding_system *coding, EMACS_INT gap_head_use
1194 1192
1195 1193
1196static unsigned char * 1194static unsigned char *
1197alloc_destination (struct coding_system *coding, EMACS_INT nbytes, unsigned char *dst) 1195alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
1196 unsigned char *dst)
1198{ 1197{
1199 EMACS_INT offset = dst - coding->destination; 1198 EMACS_INT offset = dst - coding->destination;
1200 1199
@@ -1292,7 +1291,8 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes, unsigned char
1292#define UTF_8_BOM_3 0xBF 1291#define UTF_8_BOM_3 0xBF
1293 1292
1294static int 1293static int
1295detect_coding_utf_8 (struct coding_system *coding, struct coding_detection_info *detect_info) 1294detect_coding_utf_8 (struct coding_system *coding,
1295 struct coding_detection_info *detect_info)
1296{ 1296{
1297 const unsigned char *src = coding->source, *src_base; 1297 const unsigned char *src = coding->source, *src_base;
1298 const unsigned char *src_end = coding->source + coding->src_bytes; 1298 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1423,8 +1423,6 @@ decode_coding_utf_8 (struct coding_system *coding)
1423 } 1423 }
1424 CODING_UTF_8_BOM (coding) = utf_without_bom; 1424 CODING_UTF_8_BOM (coding) = utf_without_bom;
1425 1425
1426
1427
1428 while (1) 1426 while (1)
1429 { 1427 {
1430 int c, c1, c2, c3, c4, c5; 1428 int c, c1, c2, c3, c4, c5;
@@ -1610,7 +1608,8 @@ encode_coding_utf_8 (struct coding_system *coding)
1610 1608
1611 1609
1612static int 1610static int
1613detect_coding_utf_16 (struct coding_system *coding, struct coding_detection_info *detect_info) 1611detect_coding_utf_16 (struct coding_system *coding,
1612 struct coding_detection_info *detect_info)
1614{ 1613{
1615 const unsigned char *src = coding->source, *src_base = src; 1614 const unsigned char *src = coding->source, *src_base = src;
1616 const unsigned char *src_end = coding->source + coding->src_bytes; 1615 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1962,7 +1961,8 @@ char emacs_mule_bytes[256];
1962 else return 0. */ 1961 else return 0. */
1963 1962
1964static int 1963static int
1965detect_coding_emacs_mule (struct coding_system *coding, struct coding_detection_info *detect_info) 1964detect_coding_emacs_mule (struct coding_system *coding,
1965 struct coding_detection_info *detect_info)
1966{ 1966{
1967 const unsigned char *src = coding->source, *src_base; 1967 const unsigned char *src = coding->source, *src_base;
1968 const unsigned char *src_end = coding->source + coding->src_bytes; 1968 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -2050,7 +2050,9 @@ detect_coding_emacs_mule (struct coding_system *coding, struct coding_detection_
2050 -1. If SRC is too short, return -2. */ 2050 -1. If SRC is too short, return -2. */
2051 2051
2052int 2052int
2053emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nbytes, int *nchars, int *id, struct composition_status *cmp_status) 2053emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2054 int *nbytes, int *nchars, int *id,
2055 struct composition_status *cmp_status)
2054{ 2056{
2055 const unsigned char *src_end = coding->source + coding->src_bytes; 2057 const unsigned char *src_end = coding->source + coding->src_bytes;
2056 const unsigned char *src_base = src; 2058 const unsigned char *src_base = src;
@@ -2368,7 +2370,8 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nb
2368 2370
2369 2371
2370static int 2372static int
2371emacs_mule_finish_composition (int *charbuf, struct composition_status *cmp_status) 2373emacs_mule_finish_composition (int *charbuf,
2374 struct composition_status *cmp_status)
2372{ 2375{
2373 int idx = - cmp_status->length; 2376 int idx = - cmp_status->length;
2374 int new_chars; 2377 int new_chars;
@@ -3048,7 +3051,8 @@ setup_iso_safe_charsets (Lisp_Object attrs)
3048 If it is, return 1, else return 0. */ 3051 If it is, return 1, else return 0. */
3049 3052
3050static int 3053static int
3051detect_coding_iso_2022 (struct coding_system *coding, struct coding_detection_info *detect_info) 3054detect_coding_iso_2022 (struct coding_system *coding,
3055 struct coding_detection_info *detect_info)
3052{ 3056{
3053 const unsigned char *src = coding->source, *src_base = src; 3057 const unsigned char *src = coding->source, *src_base = src;
3054 const unsigned char *src_end = coding->source + coding->src_bytes; 3058 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4298,7 +4302,9 @@ decode_coding_iso_2022 (struct coding_system *coding)
4298 Return new DST. */ 4302 Return new DST. */
4299 4303
4300unsigned char * 4304unsigned char *
4301encode_invocation_designation (struct charset *charset, struct coding_system *coding, unsigned char *dst, int *p_nchars) 4305encode_invocation_designation (struct charset *charset,
4306 struct coding_system *coding,
4307 unsigned char *dst, int *p_nchars)
4302{ 4308{
4303 int multibytep = coding->dst_multibyte; 4309 int multibytep = coding->dst_multibyte;
4304 int produced_chars = *p_nchars; 4310 int produced_chars = *p_nchars;
@@ -4410,7 +4416,8 @@ encode_invocation_designation (struct charset *charset, struct coding_system *co
4410 find all the necessary designations. */ 4416 find all the necessary designations. */
4411 4417
4412static unsigned char * 4418static unsigned char *
4413encode_designation_at_bol (struct coding_system *coding, int *charbuf, int *charbuf_end, unsigned char *dst) 4419encode_designation_at_bol (struct coding_system *coding, int *charbuf,
4420 int *charbuf_end, unsigned char *dst)
4414{ 4421{
4415 struct charset *charset; 4422 struct charset *charset;
4416 /* Table of charsets to be designated to each graphic register. */ 4423 /* Table of charsets to be designated to each graphic register. */
@@ -4650,7 +4657,8 @@ encode_coding_iso_2022 (struct coding_system *coding)
4650 CATEGORY_MASK_SJIS, else return 0. */ 4657 CATEGORY_MASK_SJIS, else return 0. */
4651 4658
4652static int 4659static int
4653detect_coding_sjis (struct coding_system *coding, struct coding_detection_info *detect_info) 4660detect_coding_sjis (struct coding_system *coding,
4661 struct coding_detection_info *detect_info)
4654{ 4662{
4655 const unsigned char *src = coding->source, *src_base; 4663 const unsigned char *src = coding->source, *src_base;
4656 const unsigned char *src_end = coding->source + coding->src_bytes; 4664 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4706,7 +4714,8 @@ detect_coding_sjis (struct coding_system *coding, struct coding_detection_info *
4706 CATEGORY_MASK_BIG5, else return 0. */ 4714 CATEGORY_MASK_BIG5, else return 0. */
4707 4715
4708static int 4716static int
4709detect_coding_big5 (struct coding_system *coding, struct coding_detection_info *detect_info) 4717detect_coding_big5 (struct coding_system *coding,
4718 struct coding_detection_info *detect_info)
4710{ 4719{
4711 const unsigned char *src = coding->source, *src_base; 4720 const unsigned char *src = coding->source, *src_base;
4712 const unsigned char *src_end = coding->source + coding->src_bytes; 4721 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5144,7 +5153,8 @@ encode_coding_big5 (struct coding_system *coding)
5144 CATEGORY_MASK_CCL, else return 0. */ 5153 CATEGORY_MASK_CCL, else return 0. */
5145 5154
5146static int 5155static int
5147detect_coding_ccl (struct coding_system *coding, struct coding_detection_info *detect_info) 5156detect_coding_ccl (struct coding_system *coding,
5157 struct coding_detection_info *detect_info)
5148{ 5158{
5149 const unsigned char *src = coding->source, *src_base; 5159 const unsigned char *src = coding->source, *src_base;
5150 const unsigned char *src_end = coding->source + coding->src_bytes; 5160 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5423,7 +5433,8 @@ encode_coding_raw_text (struct coding_system *coding)
5423 is, return 1, else return 0. */ 5433 is, return 1, else return 0. */
5424 5434
5425static int 5435static int
5426detect_coding_charset (struct coding_system *coding, struct coding_detection_info *detect_info) 5436detect_coding_charset (struct coding_system *coding,
5437 struct coding_detection_info *detect_info)
5427{ 5438{
5428 const unsigned char *src = coding->source, *src_base; 5439 const unsigned char *src = coding->source, *src_base;
5429 const unsigned char *src_end = coding->source + coding->src_bytes; 5440 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -6168,7 +6179,8 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
6168#define MAX_EOL_CHECK_COUNT 3 6179#define MAX_EOL_CHECK_COUNT 3
6169 6180
6170static int 6181static int
6171detect_eol (const unsigned char *source, EMACS_INT src_bytes, enum coding_category category) 6182detect_eol (const unsigned char *source, EMACS_INT src_bytes,
6183 enum coding_category category)
6172{ 6184{
6173 const unsigned char *src = source, *src_end = src + src_bytes; 6185 const unsigned char *src = source, *src_end = src + src_bytes;
6174 unsigned char c; 6186 unsigned char c;
@@ -6704,7 +6716,8 @@ get_translation (Lisp_Object trans, int *buf, int *buf_end)
6704 6716
6705 6717
6706static int 6718static int
6707produce_chars (struct coding_system *coding, Lisp_Object translation_table, int last_block) 6719produce_chars (struct coding_system *coding, Lisp_Object translation_table,
6720 int last_block)
6708{ 6721{
6709 unsigned char *dst = coding->destination + coding->produced; 6722 unsigned char *dst = coding->destination + coding->produced;
6710 unsigned char *dst_end = coding->destination + coding->dst_bytes; 6723 unsigned char *dst_end = coding->destination + coding->dst_bytes;
@@ -7174,7 +7187,9 @@ decode_coding (struct coding_system *coding)
7174 return BUF. */ 7187 return BUF. */
7175 7188
7176static INLINE int * 7189static INLINE int *
7177handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system *coding, int *buf, EMACS_INT *stop) 7190handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
7191 struct coding_system *coding, int *buf,
7192 EMACS_INT *stop)
7178{ 7193{
7179 EMACS_INT start, end; 7194 EMACS_INT start, end;
7180 Lisp_Object prop; 7195 Lisp_Object prop;
@@ -7255,7 +7270,9 @@ handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_sys
7255 property value is non-nil (limiting by LIMIT), and return BUF. */ 7270 property value is non-nil (limiting by LIMIT), and return BUF. */
7256 7271
7257static INLINE int * 7272static INLINE int *
7258handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system *coding, int *buf, EMACS_INT *stop) 7273handle_charset_annotation (EMACS_INT pos, EMACS_INT limit,
7274 struct coding_system *coding, int *buf,
7275 EMACS_INT *stop)
7259{ 7276{
7260 Lisp_Object val, next; 7277 Lisp_Object val, next;
7261 int id; 7278 int id;
@@ -7275,7 +7292,8 @@ handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system
7275 7292
7276 7293
7277static void 7294static void
7278consume_chars (struct coding_system *coding, Lisp_Object translation_table, int max_lookup) 7295consume_chars (struct coding_system *coding, Lisp_Object translation_table,
7296 int max_lookup)
7279{ 7297{
7280 int *buf = coding->charbuf; 7298 int *buf = coding->charbuf;
7281 int *buf_end = coding->charbuf + coding->charbuf_size; 7299 int *buf_end = coding->charbuf + coding->charbuf_size;
@@ -7560,7 +7578,8 @@ code_conversion_save (int with_work_buf, int multibyte)
7560} 7578}
7561 7579
7562int 7580int
7563decode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT bytes) 7581decode_coding_gap (struct coding_system *coding,
7582 EMACS_INT chars, EMACS_INT bytes)
7564{ 7583{
7565 int count = SPECPDL_INDEX (); 7584 int count = SPECPDL_INDEX ();
7566 Lisp_Object attrs; 7585 Lisp_Object attrs;
@@ -7605,7 +7624,8 @@ decode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT byte
7605} 7624}
7606 7625
7607int 7626int
7608encode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT bytes) 7627encode_coding_gap (struct coding_system *coding,
7628 EMACS_INT chars, EMACS_INT bytes)
7609{ 7629{
7610 int count = SPECPDL_INDEX (); 7630 int count = SPECPDL_INDEX ();
7611 7631
@@ -7658,12 +7678,11 @@ encode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT byte
7658 */ 7678 */
7659 7679
7660void 7680void
7661decode_coding_object (coding, src_object, from, from_byte, to, to_byte, 7681decode_coding_object (struct coding_system *coding,
7662 dst_object) 7682 Lisp_Object src_object,
7663 struct coding_system *coding; 7683 EMACS_INT from, EMACS_INT from_byte,
7664 Lisp_Object src_object; 7684 EMACS_INT to, EMACS_INT to_byte,
7665 EMACS_INT from, from_byte, to, to_byte; 7685 Lisp_Object dst_object)
7666 Lisp_Object dst_object;
7667{ 7686{
7668 int count = SPECPDL_INDEX (); 7687 int count = SPECPDL_INDEX ();
7669 unsigned char *destination; 7688 unsigned char *destination;
@@ -7849,12 +7868,11 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
7849 7868
7850 7869
7851void 7870void
7852encode_coding_object (coding, src_object, from, from_byte, to, to_byte, 7871encode_coding_object (struct coding_system *coding,
7853 dst_object) 7872 Lisp_Object src_object,
7854 struct coding_system *coding; 7873 EMACS_INT from, EMACS_INT from_byte,
7855 Lisp_Object src_object; 7874 EMACS_INT to, EMACS_INT to_byte,
7856 EMACS_INT from, from_byte, to, to_byte; 7875 Lisp_Object dst_object)
7857 Lisp_Object dst_object;
7858{ 7876{
7859 int count = SPECPDL_INDEX (); 7877 int count = SPECPDL_INDEX ();
7860 EMACS_INT chars = to - from; 7878 EMACS_INT chars = to - from;
@@ -8162,13 +8180,10 @@ function `define-coding-system'. */)
8162 detect only text-format. */ 8180 detect only text-format. */
8163 8181
8164Lisp_Object 8182Lisp_Object
8165detect_coding_system (src, src_chars, src_bytes, highest, multibytep, 8183detect_coding_system (const unsigned char *src,
8166 coding_system) 8184 EMACS_INT src_chars, EMACS_INT src_bytes,
8167 const unsigned char *src; 8185 int highest, int multibytep,
8168 EMACS_INT src_chars, src_bytes; 8186 Lisp_Object coding_system)
8169 int highest;
8170 int multibytep;
8171 Lisp_Object coding_system;
8172{ 8187{
8173 const unsigned char *src_end = src + src_bytes; 8188 const unsigned char *src_end = src + src_bytes;
8174 Lisp_Object attrs, eol_type; 8189 Lisp_Object attrs, eol_type;
@@ -8922,7 +8937,9 @@ is nil. */)
8922 8937
8923 8938
8924Lisp_Object 8939Lisp_Object
8925code_convert_region (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object dst_object, int encodep, int norecord) 8940code_convert_region (Lisp_Object start, Lisp_Object end,
8941 Lisp_Object coding_system, Lisp_Object dst_object,
8942 int encodep, int norecord)
8926{ 8943{
8927 struct coding_system coding; 8944 struct coding_system coding;
8928 EMACS_INT from, from_byte, to, to_byte; 8945 EMACS_INT from, from_byte, to, to_byte;
@@ -9061,7 +9078,8 @@ code_convert_string (string, coding_system, dst_object,
9061 ENCODE_FILE, thus we ignore character composition. */ 9078 ENCODE_FILE, thus we ignore character composition. */
9062 9079
9063Lisp_Object 9080Lisp_Object
9064code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system, int encodep) 9081code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
9082 int encodep)
9065{ 9083{
9066 return code_convert_string (string, coding_system, Qt, encodep, 0, 1); 9084 return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
9067} 9085}
@@ -10096,7 +10114,7 @@ usage: (define-coding-system-internal ...) */)
10096DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, 10114DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
10097 3, 3, 0, 10115 3, 3, 0,
10098 doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */) 10116 doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */)
10099 (coding_system, prop, val) 10117 (coding_system, prop, val)
10100 Lisp_Object coding_system, prop, val; 10118 Lisp_Object coding_system, prop, val;
10101{ 10119{
10102 Lisp_Object spec, attrs; 10120 Lisp_Object spec, attrs;
@@ -10194,7 +10212,7 @@ DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base,
10194 1, 1, 0, 10212 1, 1, 0,
10195 doc: /* Return the base of CODING-SYSTEM. 10213 doc: /* Return the base of CODING-SYSTEM.
10196Any alias or subsidiary coding system is not a base coding system. */) 10214Any alias or subsidiary coding system is not a base coding system. */)
10197 (coding_system) 10215 (coding_system)
10198 Lisp_Object coding_system; 10216 Lisp_Object coding_system;
10199{ 10217{
10200 Lisp_Object spec, attrs; 10218 Lisp_Object spec, attrs;
diff --git a/src/sysdep.c b/src/sysdep.c
index 8e783bd7344..d32ba6d4de8 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -182,7 +182,7 @@ SIGMASKTYPE sigprocmask_set;
182 Any other returned value must be freed with free. This is used 182 Any other returned value must be freed with free. This is used
183 only when get_current_dir_name is not defined on the system. */ 183 only when get_current_dir_name is not defined on the system. */
184char* 184char*
185get_current_dir_name () 185get_current_dir_name (void)
186{ 186{
187 char *buf; 187 char *buf;
188 char *pwd; 188 char *pwd;
@@ -363,7 +363,8 @@ set_exclusive_use (int fd)
363 363
364#ifndef subprocesses 364#ifndef subprocesses
365 365
366wait_without_blocking () 366void
367wait_without_blocking (void)
367{ 368{
368 croak ("wait_without_blocking"); 369 croak ("wait_without_blocking");
369 synch_process_alive = 0; 370 synch_process_alive = 0;
@@ -800,7 +801,7 @@ request_sigio (void)
800 801
801void 802void
802unrequest_sigio (void) 803unrequest_sigio (void)
803{ 804{
804 if (noninteractive) 805 if (noninteractive)
805 return; 806 return;
806 807
@@ -820,7 +821,7 @@ unrequest_sigio (void)
820#ifndef MSDOS 821#ifndef MSDOS
821 822
822void 823void
823request_sigio () 824request_sigio (void)
824{ 825{
825 if (noninteractive || read_socket_hook) 826 if (noninteractive || read_socket_hook)
826 return; 827 return;
@@ -829,7 +830,7 @@ request_sigio ()
829} 830}
830 831
831void 832void
832unrequest_sigio () 833unrequest_sigio (void)
833{ 834{
834 if (noninteractive || read_socket_hook) 835 if (noninteractive || read_socket_hook)
835 return; 836 return;
@@ -1019,10 +1020,10 @@ init_sys_modes (struct tty_display_info *tty_out)
1019 1020
1020 if (!tty_out->output) 1021 if (!tty_out->output)
1021 return; /* The tty is suspended. */ 1022 return; /* The tty is suspended. */
1022 1023
1023 if (! tty_out->old_tty) 1024 if (! tty_out->old_tty)
1024 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); 1025 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
1025 1026
1026 EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); 1027 EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty);
1027 1028
1028 tty = *tty_out->old_tty; 1029 tty = *tty_out->old_tty;
@@ -1080,7 +1081,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1080 means that the interrupt and quit feature must be 1081 means that the interrupt and quit feature must be
1081 disabled on secondary ttys, or we would not even see the 1082 disabled on secondary ttys, or we would not even see the
1082 keypress. 1083 keypress.
1083 1084
1084 Note that even though emacsclient could have special code 1085 Note that even though emacsclient could have special code
1085 to pass SIGINT to Emacs, we should _not_ enable 1086 to pass SIGINT to Emacs, we should _not_ enable
1086 interrupt/quit keys for emacsclient frames. This means 1087 interrupt/quit keys for emacsclient frames. This means
@@ -1098,7 +1099,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1098 tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use 1099 tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use
1099 of C-z */ 1100 of C-z */
1100#endif /* VSWTCH */ 1101#endif /* VSWTCH */
1101 1102
1102#if defined (__mips__) || defined (HAVE_TCATTR) 1103#if defined (__mips__) || defined (HAVE_TCATTR)
1103#ifdef VSUSP 1104#ifdef VSUSP
1104 tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ 1105 tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */
@@ -1189,9 +1190,9 @@ init_sys_modes (struct tty_display_info *tty_out)
1189 tty.tchars.t_startc = '\021'; 1190 tty.tchars.t_startc = '\021';
1190 tty.tchars.t_stopc = '\023'; 1191 tty.tchars.t_stopc = '\023';
1191 } 1192 }
1192 1193
1193 tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; 1194 tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode;
1194 1195
1195#endif /* HAVE_TCHARS */ 1196#endif /* HAVE_TCHARS */
1196#endif /* not HAVE_TERMIO */ 1197#endif /* not HAVE_TERMIO */
1197 1198
@@ -1411,11 +1412,11 @@ reset_sys_modes (struct tty_display_info *tty_out)
1411 1412
1412 if (!tty_out->output) 1413 if (!tty_out->output)
1413 return; /* The tty is suspended. */ 1414 return; /* The tty is suspended. */
1414 1415
1415 /* Go to and clear the last line of the terminal. */ 1416 /* Go to and clear the last line of the terminal. */
1416 1417
1417 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); 1418 cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
1418 1419
1419 /* Code adapted from tty_clear_end_of_line. */ 1420 /* Code adapted from tty_clear_end_of_line. */
1420 if (tty_out->TS_clr_line) 1421 if (tty_out->TS_clr_line)
1421 { 1422 {
@@ -1425,16 +1426,16 @@ reset_sys_modes (struct tty_display_info *tty_out)
1425 { /* have to do it the hard way */ 1426 { /* have to do it the hard way */
1426 int i; 1427 int i;
1427 tty_turn_off_insert (tty_out); 1428 tty_turn_off_insert (tty_out);
1428 1429
1429 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) 1430 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++)
1430 { 1431 {
1431 fputc (' ', tty_out->output); 1432 fputc (' ', tty_out->output);
1432 } 1433 }
1433 } 1434 }
1434 1435
1435 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); 1436 cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
1436 fflush (tty_out->output); 1437 fflush (tty_out->output);
1437 1438
1438 if (tty_out->terminal->reset_terminal_modes_hook) 1439 if (tty_out->terminal->reset_terminal_modes_hook)
1439 tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal); 1440 tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal);
1440 1441
@@ -1645,7 +1646,7 @@ init_system_name (void)
1645 struct addrinfo hints; 1646 struct addrinfo hints;
1646 int ret; 1647 int ret;
1647 1648
1648 memset (&hints, 0, sizeof(hints)); 1649 memset (&hints, 0, sizeof (hints));
1649 hints.ai_socktype = SOCK_STREAM; 1650 hints.ai_socktype = SOCK_STREAM;
1650 hints.ai_flags = AI_CANONNAME; 1651 hints.ai_flags = AI_CANONNAME;
1651 1652
@@ -1757,8 +1758,8 @@ jmp_buf read_alarm_throw;
1757 1758
1758int read_alarm_should_throw; 1759int read_alarm_should_throw;
1759 1760
1760SIGTYPE 1761void
1761select_alarm () 1762select_alarm (int ignore)
1762{ 1763{
1763 select_alarmed = 1; 1764 select_alarmed = 1;
1764 signal (SIGALRM, SIG_IGN); 1765 signal (SIGALRM, SIG_IGN);
@@ -1770,13 +1771,12 @@ select_alarm ()
1770#ifndef WINDOWSNT 1771#ifndef WINDOWSNT
1771/* Only rfds are checked. */ 1772/* Only rfds are checked. */
1772int 1773int
1773sys_select (nfds, rfds, wfds, efds, timeout) 1774sys_select (int nfds,
1774 int nfds; 1775 SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1775 SELECT_TYPE *rfds, *wfds, *efds; 1776 EMACS_TIME *timeout)
1776 EMACS_TIME *timeout;
1777{ 1777{
1778 /* XXX This needs to be updated for multi-tty support. Is there 1778 /* XXX This needs to be updated for multi-tty support. Is there
1779 anybody who needs to emulate select these days? */ 1779 anybody who needs to emulate select these days? */
1780 int ravail = 0; 1780 int ravail = 0;
1781 SELECT_TYPE orfds; 1781 SELECT_TYPE orfds;
1782 int timeoutval; 1782 int timeoutval;
@@ -1907,7 +1907,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
1907 waiting for at least one character. */ 1907 waiting for at least one character. */
1908 1908
1909void 1909void
1910read_input_waiting () 1910read_input_waiting (void)
1911{ 1911{
1912 /* XXX This needs to be updated for multi-tty support. Is there 1912 /* XXX This needs to be updated for multi-tty support. Is there
1913 anybody who needs to emulate select these days? */ 1913 anybody who needs to emulate select these days? */
@@ -2421,11 +2421,10 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte)
2421#ifndef HAVE_GETWD 2421#ifndef HAVE_GETWD
2422 2422
2423char * 2423char *
2424getwd (pathname) 2424getwd (char *pathname)
2425 char *pathname;
2426{ 2425{
2427 char *npath, *spath; 2426 char *npath, *spath;
2428 extern char *getcwd (); 2427 extern char *getcwd (char *, size_t);
2429 2428
2430 BLOCK_INPUT; /* getcwd uses malloc */ 2429 BLOCK_INPUT; /* getcwd uses malloc */
2431 spath = npath = getcwd ((char *) 0, MAXPATHLEN); 2430 spath = npath = getcwd ((char *) 0, MAXPATHLEN);
@@ -2454,9 +2453,8 @@ getwd (pathname)
2454 2453
2455#ifndef HAVE_RENAME 2454#ifndef HAVE_RENAME
2456 2455
2457rename (from, to) 2456int
2458 const char *from; 2457rename (const char *from, const char *to)
2459 const char *to;
2460{ 2458{
2461 if (access (from, 0) == 0) 2459 if (access (from, 0) == 0)
2462 { 2460 {
@@ -2476,7 +2474,8 @@ rename (from, to)
2476/* HPUX curses library references perror, but as far as we know 2474/* HPUX curses library references perror, but as far as we know
2477 it won't be called. Anyway this definition will do for now. */ 2475 it won't be called. Anyway this definition will do for now. */
2478 2476
2479perror () 2477void
2478perror (void)
2480{ 2479{
2481} 2480}
2482#endif /* HPUX and not HAVE_PERROR */ 2481#endif /* HPUX and not HAVE_PERROR */
@@ -2489,9 +2488,8 @@ perror ()
2489 * until we are, then close the unsuccessful ones. 2488 * until we are, then close the unsuccessful ones.
2490 */ 2489 */
2491 2490
2492dup2 (oldd, newd) 2491int
2493 int oldd; 2492dup2 (int oldd, int newd)
2494 int newd;
2495{ 2493{
2496 register int fd, ret; 2494 register int fd, ret;
2497 2495
@@ -2525,11 +2523,9 @@ dup2 (oldd, newd)
2525 2523
2526/* ARGSUSED */ 2524/* ARGSUSED */
2527int 2525int
2528gettimeofday (tp, tzp) 2526gettimeofday (struct timeval *tp, struct timezone *tzp)
2529 struct timeval *tp;
2530 struct timezone *tzp;
2531{ 2527{
2532 extern long time (); 2528 extern long time (long);
2533 2529
2534 tp->tv_sec = time ((long *)0); 2530 tp->tv_sec = time ((long *)0);
2535 tp->tv_usec = 0; 2531 tp->tv_usec = 0;
@@ -2616,9 +2612,7 @@ set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime)
2616 * Make a directory. 2612 * Make a directory.
2617 */ 2613 */
2618int 2614int
2619mkdir (dpath, dmode) 2615mkdir (char *dpath, int dmode)
2620 char *dpath;
2621 int dmode;
2622{ 2616{
2623 int cpid, status, fd; 2617 int cpid, status, fd;
2624 struct stat statbuf; 2618 struct stat statbuf;
@@ -2676,8 +2670,7 @@ mkdir (dpath, dmode)
2676 2670
2677#ifndef HAVE_RMDIR 2671#ifndef HAVE_RMDIR
2678int 2672int
2679rmdir (dpath) 2673rmdir (char *dpath)
2680 char *dpath;
2681{ 2674{
2682 int cpid, status, fd; 2675 int cpid, status, fd;
2683 struct stat statbuf; 2676 struct stat statbuf;
@@ -2724,8 +2717,7 @@ rmdir (dpath)
2724 2717
2725#ifndef HAVE_STRSIGNAL 2718#ifndef HAVE_STRSIGNAL
2726char * 2719char *
2727strsignal (code) 2720strsignal (int code)
2728 int code;
2729{ 2721{
2730 char *signame = 0; 2722 char *signame = 0;
2731 2723
@@ -2741,7 +2733,8 @@ strsignal (code)
2741 2733
2742#ifdef HAVE_TERMIOS 2734#ifdef HAVE_TERMIOS
2743/* For make-serial-process */ 2735/* For make-serial-process */
2744int serial_open (char *port) 2736int
2737serial_open (char *port)
2745{ 2738{
2746 int fd = -1; 2739 int fd = -1;
2747 2740
@@ -2774,7 +2767,8 @@ int serial_open (char *port)
2774#if !defined (HAVE_CFMAKERAW) 2767#if !defined (HAVE_CFMAKERAW)
2775/* Workaround for targets which are missing cfmakeraw. */ 2768/* Workaround for targets which are missing cfmakeraw. */
2776/* Pasted from man page. */ 2769/* Pasted from man page. */
2777static void cfmakeraw (struct termios *termios_p) 2770static void
2771cfmakeraw (struct termios *termios_p)
2778{ 2772{
2779 termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); 2773 termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
2780 termios_p->c_oflag &= ~OPOST; 2774 termios_p->c_oflag &= ~OPOST;
@@ -2786,7 +2780,8 @@ static void cfmakeraw (struct termios *termios_p)
2786 2780
2787#if !defined (HAVE_CFSETSPEED) 2781#if !defined (HAVE_CFSETSPEED)
2788/* Workaround for targets which are missing cfsetspeed. */ 2782/* Workaround for targets which are missing cfsetspeed. */
2789static int cfsetspeed (struct termios *termios_p, speed_t vitesse) 2783static int
2784cfsetspeed (struct termios *termios_p, speed_t vitesse)
2790{ 2785{
2791 return (cfsetispeed (termios_p, vitesse) 2786 return (cfsetispeed (termios_p, vitesse)
2792 + cfsetospeed (termios_p, vitesse)); 2787 + cfsetospeed (termios_p, vitesse));
@@ -2796,7 +2791,7 @@ static int cfsetspeed (struct termios *termios_p, speed_t vitesse)
2796/* For serial-process-configure */ 2791/* For serial-process-configure */
2797void 2792void
2798serial_configure (struct Lisp_Process *p, 2793serial_configure (struct Lisp_Process *p,
2799 Lisp_Object contact) 2794 Lisp_Object contact)
2800{ 2795{
2801 Lisp_Object childp2 = Qnil; 2796 Lisp_Object childp2 = Qnil;
2802 Lisp_Object tem = Qnil; 2797 Lisp_Object tem = Qnil;
@@ -2839,7 +2834,7 @@ serial_configure (struct Lisp_Process *p,
2839 CHECK_NUMBER (tem); 2834 CHECK_NUMBER (tem);
2840 if (XINT (tem) != 7 && XINT (tem) != 8) 2835 if (XINT (tem) != 7 && XINT (tem) != 8)
2841 error (":bytesize must be nil (8), 7, or 8"); 2836 error (":bytesize must be nil (8), 7, or 8");
2842 summary[0] = XINT(tem) + '0'; 2837 summary[0] = XINT (tem) + '0';
2843#if defined (CSIZE) && defined (CS7) && defined (CS8) 2838#if defined (CSIZE) && defined (CS7) && defined (CS8)
2844 attr.c_cflag &= ~CSIZE; 2839 attr.c_cflag &= ~CSIZE;
2845 attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8); 2840 attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8);
@@ -2997,7 +2992,7 @@ list_system_processes (void)
2997#elif !defined (WINDOWSNT) && !defined (MSDOS) 2992#elif !defined (WINDOWSNT) && !defined (MSDOS)
2998 2993
2999Lisp_Object 2994Lisp_Object
3000list_system_processes () 2995list_system_processes (void)
3001{ 2996{
3002 return Qnil; 2997 return Qnil;
3003} 2998}
@@ -3196,7 +3191,7 @@ system_process_attributes (Lisp_Object pid)
3196 procfn_end = fn + strlen (fn); 3191 procfn_end = fn + strlen (fn);
3197 strcpy (procfn_end, "/stat"); 3192 strcpy (procfn_end, "/stat");
3198 fd = emacs_open (fn, O_RDONLY, 0); 3193 fd = emacs_open (fn, O_RDONLY, 0);
3199 if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof(procbuf) - 1)) > 0) 3194 if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof (procbuf) - 1)) > 0)
3200 { 3195 {
3201 procbuf[nread] = '\0'; 3196 procbuf[nread] = '\0';
3202 p = procbuf; 3197 p = procbuf;
@@ -3457,7 +3452,7 @@ system_process_attributes (Lisp_Object pid)
3457 strcpy (procfn_end, "/psinfo"); 3452 strcpy (procfn_end, "/psinfo");
3458 fd = emacs_open (fn, O_RDONLY, 0); 3453 fd = emacs_open (fn, O_RDONLY, 0);
3459 if (fd >= 0 3454 if (fd >= 0
3460 && (nread = read (fd, (char*)&pinfo, sizeof(struct psinfo)) > 0)) 3455 && (nread = read (fd, (char*)&pinfo, sizeof (struct psinfo)) > 0))
3461 { 3456 {
3462 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); 3457 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs);
3463 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); 3458 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs);