comparison src/callint.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
54 54
55 #if 0 /* ill-conceived */ 55 #if 0 /* ill-conceived */
56 Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook; 56 Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
57 #endif 57 #endif
58 58
59 Lisp_Object Qlet, QletX, Qsave_excursion; 59 Lisp_Object QletX, Qsave_excursion;
60 60
61 Lisp_Object Qread_from_minibuffer; 61 Lisp_Object Qread_from_minibuffer;
62 Lisp_Object Qread_file_name; 62 Lisp_Object Qread_file_name;
63 Lisp_Object Qread_directory_name; 63 Lisp_Object Qread_directory_name;
64 Lisp_Object Qcompleting_read; 64 Lisp_Object Qcompleting_read;
191 191
192 return marker_position (current_buffer->mark); 192 return marker_position (current_buffer->mark);
193 } 193 }
194 194
195 static Lisp_Object 195 static Lisp_Object
196 callint_prompt (CONST Bufbyte *prompt_start, Bytecount prompt_length, 196 callint_prompt (const Bufbyte *prompt_start, Bytecount prompt_length,
197 CONST Lisp_Object *args, int nargs) 197 const Lisp_Object *args, int nargs)
198 { 198 {
199 Lisp_Object s = make_string (prompt_start, prompt_length); 199 Lisp_Object s = make_string (prompt_start, prompt_length);
200 struct gcpro gcpro1; 200 struct gcpro gcpro1;
201 201
202 /* Fformat no longer smashes its arg vector, so no need to copy it. */ 202 /* Fformat no longer smashes its arg vector, so no need to copy it. */
239 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS 239 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
240 Lisp_Object enable; 240 Lisp_Object enable;
241 #endif 241 #endif
242 /* If SPECS is a string, we reset prompt_data to string_data 242 /* If SPECS is a string, we reset prompt_data to string_data
243 * (XSTRING (specs)) every time a GC might have occurred */ 243 * (XSTRING (specs)) every time a GC might have occurred */
244 CONST char *prompt_data = 0; 244 const char *prompt_data = 0;
245 int prompt_index = 0; 245 int prompt_index = 0;
246 int argcount; 246 int argcount;
247 int set_zmacs_region_stays = 0; 247 int set_zmacs_region_stays = 0;
248 int mouse_event_count = 0; 248 int mouse_event_count = 0;
249 249
423 GCPRO2 (function, specs); 423 GCPRO2 (function, specs);
424 424
425 for (;;) 425 for (;;)
426 { 426 {
427 if (STRINGP (specs)) 427 if (STRINGP (specs))
428 prompt_data = (CONST char *) XSTRING_DATA (specs); 428 prompt_data = (const char *) XSTRING_DATA (specs);
429 429
430 if (prompt_data[prompt_index] == '+') 430 if (prompt_data[prompt_index] == '+')
431 error ("`+' is not used in `interactive' for ordinary commands"); 431 error ("`+' is not used in `interactive' for ordinary commands");
432 else if (prompt_data[prompt_index] == '*') 432 else if (prompt_data[prompt_index] == '*')
433 { 433 {
484 484
485 /* Count the number of arguments the interactive spec would have 485 /* Count the number of arguments the interactive spec would have
486 us give to the function. */ 486 us give to the function. */
487 argcount = 0; 487 argcount = 0;
488 { 488 {
489 CONST char *tem; 489 const char *tem;
490 for (tem = prompt_data + prompt_index; *tem; ) 490 for (tem = prompt_data + prompt_index; *tem; )
491 { 491 {
492 /* 'r' specifications ("point and mark as 2 numeric args") 492 /* 'r' specifications ("point and mark as 2 numeric args")
493 produce *two* arguments. */ 493 produce *two* arguments. */
494 if (*tem == 'r') 494 if (*tem == 'r')
495 argcount += 2; 495 argcount += 2;
496 else 496 else
497 argcount += 1; 497 argcount += 1;
498 tem = (CONST char *) strchr (tem + 1, '\n'); 498 tem = (const char *) strchr (tem + 1, '\n');
499 if (!tem) 499 if (!tem)
500 break; 500 break;
501 tem++; 501 tem++;
502 } 502 }
503 } 503 }
563 GCPRO2 (prefix, args[-1]); 563 GCPRO2 (prefix, args[-1]);
564 gcpro2.nvars = alloca_size; 564 gcpro2.nvars = alloca_size;
565 565
566 for (argnum = 0; ; argnum++) 566 for (argnum = 0; ; argnum++)
567 { 567 {
568 CONST char *prompt_start = prompt_data + prompt_index + 1; 568 const char *prompt_start = prompt_data + prompt_index + 1;
569 CONST char *prompt_limit = (CONST char *) strchr (prompt_start, '\n'); 569 const char *prompt_limit = (const char *) strchr (prompt_start, '\n');
570 int prompt_length; 570 int prompt_length;
571 prompt_length = ((prompt_limit) 571 prompt_length = ((prompt_limit)
572 ? (prompt_limit - prompt_start) 572 ? (prompt_limit - prompt_start)
573 : strlen (prompt_start)); 573 : strlen (prompt_start));
574 if (prompt_limit && prompt_limit[1] == 0) 574 if (prompt_limit && prompt_limit[1] == 0)
578 } 578 }
579 /* This uses `visargs' instead of `args' so that global-set-key 579 /* This uses `visargs' instead of `args' so that global-set-key
580 prompts with "Set key C-x C-f to command: "instead of printing 580 prompts with "Set key C-x C-f to command: "instead of printing
581 event objects in there. 581 event objects in there.
582 */ 582 */
583 #define PROMPT() callint_prompt ((CONST Bufbyte *) prompt_start, prompt_length, visargs, argnum) 583 #define PROMPT() callint_prompt ((const Bufbyte *) prompt_start, prompt_length, visargs, argnum)
584 switch (prompt_data[prompt_index]) 584 switch (prompt_data[prompt_index])
585 { 585 {
586 case 'a': /* Symbol defined as a function */ 586 case 'a': /* Symbol defined as a function */
587 { 587 {
588 Lisp_Object tem = call1 (Qread_function, PROMPT ()); 588 Lisp_Object tem = call1 (Qread_function, PROMPT ());
907 visargs[argnum] = args[argnum]; 907 visargs[argnum] = args[argnum];
908 908
909 if (!prompt_limit) 909 if (!prompt_limit)
910 break; 910 break;
911 if (STRINGP (specs)) 911 if (STRINGP (specs))
912 prompt_data = (CONST char *) XSTRING_DATA (specs); 912 prompt_data = (const char *) XSTRING_DATA (specs);
913 prompt_index += prompt_length + 1 + 1; /* +1 to skip spec, +1 for \n */ 913 prompt_index += prompt_length + 1 + 1; /* +1 to skip spec, +1 for \n */
914 } 914 }
915 unbind_to (speccount, Qnil); 915 unbind_to (speccount, Qnil);
916 916
917 QUIT; 917 QUIT;
991 #endif 991 #endif
992 defsymbol (&Qevents_to_keys, "events-to-keys"); 992 defsymbol (&Qevents_to_keys, "events-to-keys");
993 defsymbol (&Qcommand_debug_status, "command-debug-status"); 993 defsymbol (&Qcommand_debug_status, "command-debug-status");
994 defsymbol (&Qenable_recursive_minibuffers, "enable-recursive-minibuffers"); 994 defsymbol (&Qenable_recursive_minibuffers, "enable-recursive-minibuffers");
995 995
996 defsymbol (&Qlet, "let");
997 defsymbol (&QletX, "let*"); 996 defsymbol (&QletX, "let*");
998 defsymbol (&Qsave_excursion, "save-excursion"); 997 defsymbol (&Qsave_excursion, "save-excursion");
999 #if 0 /* ill-conceived */ 998 #if 0 /* ill-conceived */
1000 defsymbol (&Qmouse_leave_buffer_hook, "mouse-leave-buffer-hook"); 999 defsymbol (&Qmouse_leave_buffer_hook, "mouse-leave-buffer-hook");
1001 #endif 1000 #endif