comparison src/coding.c @ 70948:7ea8b1c11d80

(Ffind_operation_coding_system): Allow (FILENAME . BUFFER) in TARGET.
author Kenichi Handa <handa@m17n.org>
date Fri, 26 May 2006 04:48:21 +0000
parents 576f5c8ea6e4
children 71e6cab216b1
comparison
equal deleted inserted replaced
70947:48b2a1baa586 70948:7ea8b1c11d80
7455 to the primitive. Depending on which primitive, one of those arguments 7455 to the primitive. Depending on which primitive, one of those arguments
7456 is selected as the TARGET. For example, if OPERATION does file I/O, 7456 is selected as the TARGET. For example, if OPERATION does file I/O,
7457 whichever argument specifies the file name is TARGET. 7457 whichever argument specifies the file name is TARGET.
7458 7458
7459 TARGET has a meaning which depends on OPERATION: 7459 TARGET has a meaning which depends on OPERATION:
7460 For file I/O, TARGET is a file name. 7460 For file I/O, TARGET is a file name (except for the special case below).
7461 For process I/O, TARGET is a process name. 7461 For process I/O, TARGET is a process name.
7462 For network I/O, TARGET is a service name or a port number 7462 For network I/O, TARGET is a service name or a port number
7463 7463
7464 This function looks up what specified for TARGET in, 7464 This function looks up what specified for TARGET in,
7465 `file-coding-system-alist', `process-coding-system-alist', 7465 `file-coding-system-alist', `process-coding-system-alist',
7466 or `network-coding-system-alist' depending on OPERATION. 7466 or `network-coding-system-alist' depending on OPERATION.
7467 They may specify a coding system, a cons of coding systems, 7467 They may specify a coding system, a cons of coding systems,
7468 or a function symbol to call. 7468 or a function symbol to call.
7469 In the last case, we call the function with one argument, 7469 In the last case, we call the function with one argument,
7470 which is a list of all the arguments given to this function. 7470 which is a list of all the arguments given to this function.
7471
7472 If OPERATION is `insert-file-contents', the argument corresponding to
7473 TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a
7474 file name to look up, and BUFFER is a buffer that already contains the
7475 file (but not yet decoded). If a function is found as above, the
7476 function must pay attention to this format of TARGET.
7471 7477
7472 usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) 7478 usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */)
7473 (nargs, args) 7479 (nargs, args)
7474 int nargs; 7480 int nargs;
7475 Lisp_Object *args; 7481 Lisp_Object *args;
7493 && nargs > 5 7499 && nargs > 5
7494 && STRINGP (args[5])) 7500 && STRINGP (args[5]))
7495 target_idx = make_number (4); 7501 target_idx = make_number (4);
7496 target = args[XINT (target_idx) + 1]; 7502 target = args[XINT (target_idx) + 1];
7497 if (!(STRINGP (target) 7503 if (!(STRINGP (target)
7504 || (EQ (operation, Qinsert_file_contents) && CONSP (target)
7505 && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
7498 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) 7506 || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
7499 error ("Invalid argument %d", XINT (target_idx) + 1); 7507 error ("Invalid argument %d", XINT (target_idx) + 1);
7508 if (CONSP (target))
7509 target = XCAR (target);
7500 7510
7501 chain = ((EQ (operation, Qinsert_file_contents) 7511 chain = ((EQ (operation, Qinsert_file_contents)
7502 || EQ (operation, Qwrite_region)) 7512 || EQ (operation, Qwrite_region))
7503 ? Vfile_coding_system_alist 7513 ? Vfile_coding_system_alist
7504 : (EQ (operation, Qopen_network_stream) 7514 : (EQ (operation, Qopen_network_stream)