void Fcaadar(CL_FORM *base) { Fcar(ARG(0)); Fcdr(ARG(0)); Fcar(ARG(0)); Fcar(ARG(0)); }
void Fset_cdadar(CL_FORM *base) { Fcar(ARG(1)); Fcdr(ARG(1)); Fcar(ARG(1)); Fset_cdr(ARG(0)); }
void Fset_caaaar(CL_FORM *base) { Fcar(ARG(1)); Fcar(ARG(1)); Fcar(ARG(1)); Fset_car(ARG(0)); }
static Lisp_Object call_process_cleanup (Lisp_Object arg) { Lisp_Object fdpid = Fcdr (arg); #if defined (MSDOS) Lisp_Object file; int fd; #else int pid; #endif Fset_buffer (Fcar (arg)); #if defined (MSDOS) /* for MSDOS fdpid is really (fd . tempfile) */ fd = XFASTINT (Fcar (fdpid)); file = Fcdr (fdpid); /* FD is -1 and FILE is "" when we didn't actually create a temporary file in call-process. */ if (fd >= 0) emacs_close (fd); if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0')) unlink (SDATA (file)); #else /* not MSDOS */ pid = XFASTINT (Fcdr (fdpid)); if (call_process_exited) { emacs_close (XFASTINT (Fcar (fdpid))); return Qnil; } if (EMACS_KILLPG (pid, SIGINT) == 0) { int count = SPECPDL_INDEX (); record_unwind_protect (call_process_kill, fdpid); message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); immediate_quit = 1; QUIT; wait_for_termination (pid); immediate_quit = 0; specpdl_ptr = specpdl + count; /* Discard the unwind protect. */ message1 ("Waiting for process to die...done"); } synch_process_alive = 0; emacs_close (XFASTINT (Fcar (fdpid))); #endif /* not MSDOS */ return Qnil; }
static Lisp_Object call_process_kill (Lisp_Object fdpid) { emacs_close (XFASTINT (Fcar (fdpid))); EMACS_KILLPG (XFASTINT (Fcdr (fdpid)), SIGKILL); synch_process_alive = 0; return Qnil; }
void x_clear_frame_selections (FRAME_PTR f) { Lisp_Object frame; Lisp_Object rest; struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); struct terminal *t = dpyinfo->terminal; XSETFRAME (frame, f); /* Delete elements from the beginning of Vselection_alist. */ while (CONSP (t->Vselection_alist) && EQ (frame, XCAR (XCDR (XCDR (XCDR (XCAR (t->Vselection_alist))))))) { /* Run the `x-lost-selection-functions' abnormal hook. */ Lisp_Object args[2]; args[0] = Qx_lost_selection_functions; args[1] = Fcar (Fcar (t->Vselection_alist)); if (x_selection_owner_p (args[1], dpyinfo)) Frun_hook_with_args (2, args); tset_selection_alist (t, XCDR (t->Vselection_alist)); } /* Delete elements after the beginning of Vselection_alist. */ for (rest = t->Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (CONSP (XCDR (rest)) && EQ (frame, XCAR (XCDR (XCDR (XCDR (XCAR (XCDR (rest)))))))) { Lisp_Object args[2]; args[0] = Qx_lost_selection_functions; args[1] = XCAR (XCAR (XCDR (rest))); if (x_selection_owner_p (args[1], dpyinfo)) Frun_hook_with_args (2, args); XSETCDR (rest, XCDR (XCDR (rest))); break; } }
/* Set up data in menu_items for a menu bar item whose event type is ITEM_KEY (with string ITEM_NAME) and whose contents come from the list of keymaps MAPS. */ bool parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) { Lisp_Object length; EMACS_INT len; Lisp_Object *mapvec; ptrdiff_t i; bool top_level_items = 0; USE_SAFE_ALLOCA; length = Flength (maps); len = XINT (length); /* Convert the list MAPS into a vector MAPVEC. */ SAFE_ALLOCA_LISP (mapvec, len); for (i = 0; i < len; i++) { mapvec[i] = Fcar (maps); maps = Fcdr (maps); } /* Loop over the given keymaps, making a pane for each map. But don't make a pane that is empty--ignore that map instead. */ for (i = 0; i < len; i++) { if (!KEYMAPP (mapvec[i])) { /* Here we have a command at top level in the menu bar as opposed to a submenu. */ top_level_items = 1; push_menu_pane (Qnil, Qnil); push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil, Qnil, Qnil, Qnil); } else { Lisp_Object prompt; prompt = Fkeymap_prompt (mapvec[i]); single_keymap_panes (mapvec[i], !NILP (prompt) ? prompt : item_name, item_key, 10); } } SAFE_FREE (); return top_level_items; }
/* Set up data in menu_items for a menu bar item whose event type is ITEM_KEY (with string ITEM_NAME) and whose contents come from the list of keymaps MAPS. */ int parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) { Lisp_Object length; int len; Lisp_Object *mapvec; int i; int top_level_items = 0; length = Flength (maps); len = XINT (length); /* Convert the list MAPS into a vector MAPVEC. */ mapvec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); for (i = 0; i < len; i++) { mapvec[i] = Fcar (maps); maps = Fcdr (maps); } /* Loop over the given keymaps, making a pane for each map. But don't make a pane that is empty--ignore that map instead. */ for (i = 0; i < len; i++) { if (!KEYMAPP (mapvec[i])) { /* Here we have a command at top level in the menu bar as opposed to a submenu. */ top_level_items = 1; push_menu_pane (Qnil, Qnil); push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil, Qnil, Qnil, Qnil); } else { Lisp_Object prompt; prompt = Fkeymap_prompt (mapvec[i]); single_keymap_panes (mapvec[i], !NILP (prompt) ? prompt : item_name, item_key, 10); } } return top_level_items; }
static void single_keymap_panes (Lisp_Object keymap, Lisp_Object pane_name, Lisp_Object prefix, int maxdepth) { struct skp skp; struct gcpro gcpro1; skp.pending_maps = Qnil; skp.maxdepth = maxdepth; skp.notbuttons = 0; if (maxdepth <= 0) return; push_menu_pane (pane_name, prefix); if (!have_boxes ()) { /* Remember index for first item in this pane so we can go back and add a prefix when (if) we see the first button. After that, notbuttons is set to 0, to mark that we have seen a button and all non button items need a prefix. */ skp.notbuttons = menu_items_used; } GCPRO1 (skp.pending_maps); map_keymap_canonical (keymap, single_menu_item, Qnil, &skp); UNGCPRO; /* Process now any submenus which want to be panes at this level. */ while (CONSP (skp.pending_maps)) { Lisp_Object elt, eltcdr, string; elt = XCAR (skp.pending_maps); eltcdr = XCDR (elt); string = XCAR (eltcdr); /* We no longer discard the @ from the beginning of the string here. Instead, we do this in *menu_show. */ single_keymap_panes (Fcar (elt), string, XCDR (eltcdr), maxdepth - 1); skp.pending_maps = XCDR (skp.pending_maps); } }
/* Push all the panes and items of a menu described by the alist-of-alists MENU. This handles old-fashioned calls to x-popup-menu. */ void list_of_panes (Lisp_Object menu) { Lisp_Object tail; init_menu_items (); for (tail = menu; CONSP (tail); tail = XCDR (tail)) { Lisp_Object elt, pane_name, pane_data; elt = XCAR (tail); pane_name = Fcar (elt); CHECK_STRING (pane_name); push_menu_pane (encode_menu_string (pane_name), Qnil); pane_data = Fcdr (elt); CHECK_CONS (pane_data); list_of_items (pane_data); } finish_menu_items (); }
Lisp_Object w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) { check_window_system (f); #ifndef HAVE_DIALOGS /* Handle simple Yes/No choices as MessageBox popups. */ if (is_simple_dialog (contents)) return simple_dialog_show (f, contents, header); else return Qunsupported__w32_dialog; #else /* HAVE_DIALOGS */ { Lisp_Object title; char *error_name; Lisp_Object selection; /* Decode the dialog items from what was specified. */ title = Fcar (contents); CHECK_STRING (title); list_of_panes (Fcons (contents, Qnil)); /* Display them in a dialog box. */ block_input (); selection = w32_dialog_show (f, title, header, &error_name); unblock_input (); discard_menu_items (); FRAME_DISPLAY_INFO (f)->grabbed = 0; if (error_name) error (error_name); return selection; } #endif /* HAVE_DIALOGS */ }
static void fix_command (Lisp_Object input, Lisp_Object values) { /* FIXME: Instead of this ugly hack, we should provide a way for an interactive spec to return an expression/function that will re-build the args without user intervention. */ if (CONSP (input)) { Lisp_Object car; car = XCAR (input); /* Skip through certain special forms. */ while (EQ (car, Qlet) || EQ (car, Qletx) || EQ (car, Qsave_excursion) || EQ (car, Qprogn)) { while (CONSP (XCDR (input))) input = XCDR (input); input = XCAR (input); if (!CONSP (input)) break; car = XCAR (input); } if (EQ (car, Qlist)) { Lisp_Object intail, valtail; for (intail = Fcdr (input), valtail = values; CONSP (valtail); intail = Fcdr (intail), valtail = XCDR (valtail)) { Lisp_Object elt; elt = Fcar (intail); if (CONSP (elt)) { Lisp_Object presflag, carelt; carelt = XCAR (elt); /* If it is (if X Y), look at Y. */ if (EQ (carelt, Qif) && EQ (Fnthcdr (make_number (3), elt), Qnil)) elt = Fnth (make_number (2), elt); /* If it is (when ... Y), look at Y. */ else if (EQ (carelt, Qwhen)) { while (CONSP (XCDR (elt))) elt = XCDR (elt); elt = Fcar (elt); } /* If the function call we're looking at is a special preserved one, copy the whole expression for this argument. */ if (CONSP (elt)) { presflag = Fmemq (Fcar (elt), preserved_fns); if (!NILP (presflag)) Fsetcar (valtail, Fcar (intail)); } } } } } }
void unparse_unix_directory_list(CL_FORM *base) { LOAD_NIL(STACK(base, 1)); LOAD_NIL(STACK(base, 2)); { CL_FORM *lptr; lptr = form_alloc(STACK(base, 3), 2); COPY(STACK(base, 1), CAR(lptr)); COPY(STACK(base, 2), CDR(lptr)); LOAD_CONS(lptr, STACK(base, 1)); } if(CL_TRUEP(STACK(base, 0))) { COPY(STACK(base, 0), STACK(base, 2)); Fcar(STACK(base, 2)); COPY(STACK(base, 0), STACK(base, 3)); COPY(STACK(base, 3), STACK(base, 4)); Fcdr(STACK(base, 4)); COPY(STACK(base, 4), STACK(base, 0)); if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 198)) /* ABSOLUTE */ { LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[0], STACK(base, 3)); /* / */ COPY(STACK(base, 1), STACK(base, 4)); add_q(STACK(base, 3)); } else { if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 201)) /* RELATIVE */ { LOAD_T(STACK(base, 3)); } else { LOAD_NIL(STACK(base, 3)); } if(CL_TRUEP(STACK(base, 3))) { } else { LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[2], STACK(base, 4)); /* ecase: the value ~a is not a legal value */ COPY(STACK(base, 2), STACK(base, 5)); Ferror(STACK(base, 4), 2); } } LOAD_NIL(STACK(base, 2)); COPY(STACK(base, 0), STACK(base, 3)); M33_1:; if(CL_ATOMP(STACK(base, 3))) { LOAD_NIL(STACK(base, 2)); goto RETURN34; } COPY(STACK(base, 3), STACK(base, 4)); Fcar(STACK(base, 4)); COPY(STACK(base, 4), STACK(base, 2)); if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 205)) /* UP */ { LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[4], STACK(base, 4)); /* ../ */ COPY(STACK(base, 1), STACK(base, 5)); add_q(STACK(base, 4)); } else { if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 199)) /* BACK */ { LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[6], STACK(base, 4)); /* :BACK cannot be represented in namestrings. */ Ferror(STACK(base, 4), 1); } else { if(CL_SMAR_P(STACK(base, 2))) { COPY(STACK(base, 2), STACK(base, 4)); LOAD_SYMBOL(SYMBOL(Slisp, 43), STACK(base, 5)); /* STANDARD-CHAR */ LOAD_SYMBOL(SYMBOL(Slisp, 48), STACK(base, 6)); /* * */ check_array_internal(STACK(base, 4)); } else { LOAD_NIL(STACK(base, 4)); } if(CL_TRUEP(STACK(base, 4))) { bool_result = TRUE; } else { COPY(STACK(base, 2), STACK(base, 5)); LOAD_SYMBOL(SYMBOL(Slisp, 181), STACK(base, 6)); /* PATTERN */ struct_typep(STACK(base, 5)); bool_result = CL_TRUEP(STACK(base, 5)); } if(bool_result) { COPY(STACK(base, 2), STACK(base, 4)); unparse_unix_piece(STACK(base, 4)); COPY(STACK(base, 1), STACK(base, 5)); add_q(STACK(base, 4)); LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[8], STACK(base, 4)); /* / */ COPY(STACK(base, 1), STACK(base, 5)); add_q(STACK(base, 4)); } else { LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[10], STACK(base, 4)); /* Invalid directory component: ~S */ COPY(STACK(base, 2), STACK(base, 5)); Ferror(STACK(base, 4), 2); } } } Fcdr(STACK(base, 3)); goto M33_1; RETURN34:; } LOAD_GLOBFUN(&CFconcatenate, STACK(base, 2)); LOAD_SYMBOL(SYMBOL(Slisp, 40), STACK(base, 3)); /* SIMPLE-STRING */ COPY(STACK(base, 1), STACK(base, 4)); Fcar(STACK(base, 4)); Fapply(STACK(base, 2), 3); COPY(STACK(base, 2), STACK(base, 0)); }
static void x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, Lisp_Object frame) { struct frame *f = XFRAME (frame); struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); Time timestamp = last_event_timestamp; OSStatus err; Selection sel; struct gcpro gcpro1, gcpro2; Lisp_Object rest, handler_fn, value, target_type; GCPRO2 (selection_name, selection_value); block_input (); err = mac_get_selection_from_symbol (selection_name, 1, &sel); if (err == noErr && sel) { /* Don't allow a quit within the converter. When the user types C-g, he would be surprised if by luck it came during a converter. */ ptrdiff_t count = SPECPDL_INDEX (); specbind (Qinhibit_quit, Qt); for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) { if (!(CONSP (XCAR (rest)) && (target_type = XCAR (XCAR (rest)), SYMBOLP (target_type)) && mac_valid_selection_target_p (target_type) && (handler_fn = XCDR (XCAR (rest)), SYMBOLP (handler_fn)))) continue; if (!NILP (handler_fn)) value = call3 (handler_fn, selection_name, target_type, selection_value); else value = Qnil; if (NILP (value)) continue; if (mac_valid_selection_value_p (value, target_type)) err = mac_put_selection_value (sel, target_type, value); else if (CONSP (value) && EQ (XCAR (value), target_type) && mac_valid_selection_value_p (XCDR (value), target_type)) err = mac_put_selection_value (sel, target_type, XCDR (value)); } unbind_to (count, Qnil); } unblock_input (); UNGCPRO; if (sel && err != noErr) error ("Can't set selection"); /* Now update the local cache */ { Lisp_Object selection_data; Lisp_Object ownership_info; Lisp_Object prev_value; if (sel) { block_input (); ownership_info = mac_get_selection_ownership_info (sel); unblock_input (); } else ownership_info = Qnil; /* dummy value for local-only selection */ selection_data = list5 (selection_name, selection_value, INTEGER_TO_CONS (timestamp), frame, ownership_info); prev_value = LOCAL_SELECTION (selection_name, dpyinfo); tset_selection_alist (dpyinfo->terminal, Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); /* If we already owned the selection, remove the old selection data. Don't use Fdelq as that may QUIT. */ if (!NILP (prev_value)) { /* We know it's not the CAR, so it's easy. */ Lisp_Object rest = dpyinfo->terminal->Vselection_alist; for (; CONSP (rest); rest = XCDR (rest)) if (EQ (prev_value, Fcar (XCDR (rest)))) { XSETCDR (rest, XCDR (XCDR (rest))); break; } } } }
void concatenate_to_list(CL_FORM *base, int nargs) { Flist(STACK(base, 0), nargs - 0); LOAD_NIL(STACK(base, 1)); LOAD_NIL(STACK(base, 2)); { CL_FORM *lptr; lptr = form_alloc(STACK(base, 3), 2); COPY(STACK(base, 1), CAR(lptr)); COPY(STACK(base, 2), CDR(lptr)); LOAD_CONS(lptr, STACK(base, 1)); } LOAD_NIL(STACK(base, 2)); COPY(STACK(base, 0), STACK(base, 3)); M148_1:; if(CL_ATOMP(STACK(base, 3))) { LOAD_NIL(STACK(base, 2)); goto RETURN162; } COPY(STACK(base, 3), STACK(base, 4)); Fcar(STACK(base, 4)); COPY(STACK(base, 4), STACK(base, 2)); if(CL_LISTP(STACK(base, 2))) { LOAD_NIL(STACK(base, 4)); COPY(STACK(base, 2), STACK(base, 5)); M149_1:; if(CL_ATOMP(STACK(base, 5))) { LOAD_NIL(STACK(base, 4)); goto RETURN163; } COPY(STACK(base, 5), STACK(base, 6)); Fcar(STACK(base, 6)); COPY(STACK(base, 6), STACK(base, 4)); COPY(STACK(base, 1), STACK(base, 7)); add_q(STACK(base, 6)); Fcdr(STACK(base, 5)); goto M149_1; RETURN163:; } else { COPY(STACK(base, 2), STACK(base, 4)); Flength(STACK(base, 4)); LOAD_FIXNUM(0, STACK(base, 5)); M150_1:; COPY(STACK(base, 5), STACK(base, 6)); COPY(STACK(base, 4), STACK(base, 7)); Fge(STACK(base, 6), 2); if(CL_TRUEP(STACK(base, 6))) { goto RETURN164; } COPY(STACK(base, 2), STACK(base, 6)); COPY(STACK(base, 5), STACK(base, 7)); Felt(STACK(base, 6)); COPY(STACK(base, 1), STACK(base, 7)); add_q(STACK(base, 6)); F1plus(STACK(base, 5)); goto M150_1; RETURN164:; } Fcdr(STACK(base, 3)); goto M148_1; RETURN162:; COPY(STACK(base, 1), STACK(base, 0)); Fcar(STACK(base, 0)); }
void concatenate_to_non_list(CL_FORM *base, int nargs) { Flist(STACK(base, 1), nargs - 1); LOAD_NIL(STACK(base, 2)); LOAD_FIXNUM(0, STACK(base, 3)); LOAD_FIXNUM(0, STACK(base, 4)); LOAD_NIL(STACK(base, 5)); COPY(STACK(base, 1), STACK(base, 6)); M144_1:; if(CL_ATOMP(STACK(base, 6))) { LOAD_NIL(STACK(base, 5)); goto RETURN158; } COPY(STACK(base, 6), STACK(base, 7)); Fcar(STACK(base, 7)); COPY(STACK(base, 7), STACK(base, 5)); COPY(STACK(base, 3), STACK(base, 7)); COPY(STACK(base, 5), STACK(base, 8)); Flength(STACK(base, 8)); Fplus(STACK(base, 7), 2); COPY(STACK(base, 7), STACK(base, 3)); Fcdr(STACK(base, 6)); goto M144_1; RETURN158:; COPY(STACK(base, 0), STACK(base, 5)); COPY(STACK(base, 3), STACK(base, 6)); Fmake_sequence(STACK(base, 5), 2); COPY(STACK(base, 5), STACK(base, 2)); LOAD_NIL(STACK(base, 5)); COPY(STACK(base, 1), STACK(base, 6)); M145_1:; if(CL_ATOMP(STACK(base, 6))) { LOAD_NIL(STACK(base, 5)); goto RETURN159; } COPY(STACK(base, 6), STACK(base, 7)); Fcar(STACK(base, 7)); COPY(STACK(base, 7), STACK(base, 5)); if(CL_LISTP(STACK(base, 5))) { LOAD_NIL(STACK(base, 7)); COPY(STACK(base, 5), STACK(base, 8)); M146_1:; if(CL_ATOMP(STACK(base, 8))) { LOAD_NIL(STACK(base, 7)); goto RETURN160; } COPY(STACK(base, 8), STACK(base, 9)); Fcar(STACK(base, 9)); COPY(STACK(base, 9), STACK(base, 7)); COPY(STACK(base, 2), STACK(base, 10)); COPY(STACK(base, 4), STACK(base, 11)); Fset_elt(STACK(base, 9)); COPY(STACK(base, 4), STACK(base, 9)); F1plus(STACK(base, 9)); COPY(STACK(base, 9), STACK(base, 4)); Fcdr(STACK(base, 8)); goto M146_1; RETURN160:; } else { COPY(STACK(base, 5), STACK(base, 7)); Flength(STACK(base, 7)); LOAD_FIXNUM(0, STACK(base, 8)); M147_1:; COPY(STACK(base, 8), STACK(base, 9)); COPY(STACK(base, 7), STACK(base, 10)); Fge(STACK(base, 9), 2); if(CL_TRUEP(STACK(base, 9))) { goto RETURN161; } COPY(STACK(base, 5), STACK(base, 9)); COPY(STACK(base, 8), STACK(base, 10)); Felt(STACK(base, 9)); COPY(STACK(base, 9), STACK(base, 10)); COPY(STACK(base, 2), STACK(base, 11)); COPY(STACK(base, 4), STACK(base, 12)); Fset_elt(STACK(base, 10)); COPY(STACK(base, 4), STACK(base, 9)); F1plus(STACK(base, 9)); COPY(STACK(base, 9), STACK(base, 4)); F1plus(STACK(base, 8)); goto M147_1; RETURN161:; } Fcdr(STACK(base, 6)); goto M145_1; RETURN159:; COPY(STACK(base, 2), STACK(base, 0)); }