comparison src/coding.c @ 83530:46b1096093f5

Merged from emacs@sv.gnu.org. Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-294 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-295 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-296 Update from CVS: admin/FOR-RELEASE: Update refcard section. * emacs@sv.gnu.org/emacs--devo--0--patch-297 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-298 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-299 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-300 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-301 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-302 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-303 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-304 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-103 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-104 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 12 Jun 2006 07:27:12 +0000
parents ab6ab63755f7 ccef92f2f7f8
children 02e39decdc84
comparison
equal deleted inserted replaced
83529:0d9e16eab053 83530:46b1096093f5
7463 to the primitive. Depending on which primitive, one of those arguments 7463 to the primitive. Depending on which primitive, one of those arguments
7464 is selected as the TARGET. For example, if OPERATION does file I/O, 7464 is selected as the TARGET. For example, if OPERATION does file I/O,
7465 whichever argument specifies the file name is TARGET. 7465 whichever argument specifies the file name is TARGET.
7466 7466
7467 TARGET has a meaning which depends on OPERATION: 7467 TARGET has a meaning which depends on OPERATION:
7468 For file I/O, TARGET is a file name. 7468 For file I/O, TARGET is a file name (except for the special case below).
7469 For process I/O, TARGET is a process name. 7469 For process I/O, TARGET is a process name.
7470 For network I/O, TARGET is a service name or a port number 7470 For network I/O, TARGET is a service name or a port number
7471 7471
7472 This function looks up what specified for TARGET in, 7472 This function looks up what specified for TARGET in,
7473 `file-coding-system-alist', `process-coding-system-alist', 7473 `file-coding-system-alist', `process-coding-system-alist',
7474 or `network-coding-system-alist' depending on OPERATION. 7474 or `network-coding-system-alist' depending on OPERATION.
7475 They may specify a coding system, a cons of coding systems, 7475 They may specify a coding system, a cons of coding systems,
7476 or a function symbol to call. 7476 or a function symbol to call.
7477 In the last case, we call the function with one argument, 7477 In the last case, we call the function with one argument,
7478 which is a list of all the arguments given to this function. 7478 which is a list of all the arguments given to this function.
7479
7480 If OPERATION is `insert-file-contents', the argument corresponding to
7481 TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a
7482 file name to look up, and BUFFER is a buffer that contains the file's
7483 contents (not yet decoded). If `file-coding-system-alist' specifies a
7484 function to call for FILENAME, that function should examine the
7485 contents of BUFFER instead of reading the file.
7479 7486
7480 usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) 7487 usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */)
7481 (nargs, args) 7488 (nargs, args)
7482 int nargs; 7489 int nargs;
7483 Lisp_Object *args; 7490 Lisp_Object *args;
7501 && nargs > 5 7508 && nargs > 5
7502 && STRINGP (args[5])) 7509 && STRINGP (args[5]))
7503 target_idx = make_number (4); 7510 target_idx = make_number (4);
7504 target = args[XINT (target_idx) + 1]; 7511 target = args[XINT (target_idx) + 1];
7505 if (!(STRINGP (target) 7512 if (!(STRINGP (target)
7513 || (EQ (operation, Qinsert_file_contents) && CONSP (target)
7514 && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
7506 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) 7515 || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
7507 error ("Invalid argument %d", XINT (target_idx) + 1); 7516 error ("Invalid argument %d", XINT (target_idx) + 1);
7517 if (CONSP (target))
7518 target = XCAR (target);
7508 7519
7509 chain = ((EQ (operation, Qinsert_file_contents) 7520 chain = ((EQ (operation, Qinsert_file_contents)
7510 || EQ (operation, Qwrite_region)) 7521 || EQ (operation, Qwrite_region))
7511 ? Vfile_coding_system_alist 7522 ? Vfile_coding_system_alist
7512 : (EQ (operation, Qopen_network_stream) 7523 : (EQ (operation, Qopen_network_stream)
7535 return Qnil; 7546 return Qnil;
7536 if (! NILP (Fcoding_system_p (val))) 7547 if (! NILP (Fcoding_system_p (val)))
7537 return Fcons (val, val); 7548 return Fcons (val, val);
7538 if (! NILP (Ffboundp (val))) 7549 if (! NILP (Ffboundp (val)))
7539 { 7550 {
7540 val = call1 (val, Flist (nargs, args)); 7551 val = safe_call1 (val, Flist (nargs, args));
7541 if (CONSP (val)) 7552 if (CONSP (val))
7542 return val; 7553 return val;
7543 if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) 7554 if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val)))
7544 return Fcons (val, val); 7555 return Fcons (val, val);
7545 } 7556 }