aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-10 18:41:15 -0700
committerPaul Eggert2011-04-10 18:41:15 -0700
commit16a97296c05ec9d5bb4ffeae9dce90fc63f578ed (patch)
tree0801b434f760fd8dded7204501ffcdb82460720c /src/eval.c
parent785bbd422461295890087ced24bfd87504032d0c (diff)
downloademacs-16a97296c05ec9d5bb4ffeae9dce90fc63f578ed.tar.gz
emacs-16a97296c05ec9d5bb4ffeae9dce90fc63f578ed.zip
Make Emacs functions such as Fatom 'static' by default.
This makes it easier for human readers (and static analyzers) to see whether these functions can be called from other modules. DEFUN now defines a static function. To make the function external so that it can be used in other C modules, use the new macro DEFUE. * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN. (DEFUN): Rewrite in terms of DEFINE_FUNC. It now generates a static function definition. Use DEFUE if you want an extern one. (DEFUE, INFUN): New macros. (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library): (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer): (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute): (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes): Remove decls, since these functions are now static. (Funintern, Fget_internal_run_time): New decls, since these functions were already external. * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c: * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c: * fns.c, font.c, fontset.c, frame.c, image.c, indent.c: * keyboard.c, keymap.c, lread.c: * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c: * syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c: Mark functions with DEFUE instead of DEFUN, if they are used in other modules. * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward decls for now-static functions. * buffer.h (Fdelete_overlay): Remove decl. * callproc.c (Fgetenv_internal): Mark as internal. * composite.c (Fremove_list_of_text_properties): Remove decl. (Fcomposition_get_gstring): New forward static decl. * composite.h (Fcomposite_get_gstring): Remove decl. * dired.c (Ffile_attributes): New forward static decl. * doc.c (Fdocumntation_property): New forward static decl. * eval.c (Ffetch_bytecode): New forward static decl. (Funintern): Remove extern decl; now in .h file where it belongs. * fileio.c (Fmake_symbolic_link): New forward static decl. * image.c (Finit_image_library): New forward static decl. * insdel.c (Fcombine_after_change_execute): Make forward decl static. * intervals.h (Fprevious_property_change): (Fremove_list_of_text_properties): Remove decls. * keyboard.c (Fthis_command_keys): Remove decl. (Fcommand_execute): New forward static decl. * keymap.c (Flookup_key): New forward static decl. (Fcopy_keymap): Now static. * keymap.h (Flookup_key): Remove decl. * process.c (Fget_process): New forward static decl. (Fprocess_datagram_address): Mark as internal. * syntax.c (Fsyntax_table_p): New forward static decl. (skip_chars): Remove duplicate decl. * textprop.c (Fprevious_property_change): New forward static decl. * window.c (Fset_window_fringes, Fset_window_scroll_bars): Now internal. (Fset_window_margins, Fset_window_vscroll): New forward static decls. * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/eval.c b/src/eval.c
index 0f9e012b823..d6d62aa4afb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -126,6 +126,7 @@ static Lisp_Object funcall_lambda (Lisp_Object, size_t, Lisp_Object *);
126static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; 126static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
127static int interactive_p (int); 127static int interactive_p (int);
128static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); 128static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
129INFUN (Ffetch_bytecode, 1);
129 130
130void 131void
131init_eval_once (void) 132init_eval_once (void)
@@ -339,7 +340,7 @@ usage: (cond CLAUSES...) */)
339 return val; 340 return val;
340} 341}
341 342
342DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, 343DEFUE ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0,
343 doc: /* Eval BODY forms sequentially and return value of last one. 344 doc: /* Eval BODY forms sequentially and return value of last one.
344usage: (progn BODY...) */) 345usage: (progn BODY...) */)
345 (Lisp_Object args) 346 (Lisp_Object args)
@@ -504,7 +505,7 @@ usage: (function ARG) */)
504} 505}
505 506
506 507
507DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, 508DEFUE ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,
508 doc: /* Return t if the containing function was run directly by user input. 509 doc: /* Return t if the containing function was run directly by user input.
509This means that the function was called with `call-interactively' 510This means that the function was called with `call-interactively'
510\(which includes being called as the binding of a key) 511\(which includes being called as the binding of a key)
@@ -1310,7 +1311,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1310 _longjmp (catch->jmp, 1); 1311 _longjmp (catch->jmp, 1);
1311} 1312}
1312 1313
1313DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, 1314DEFUE ("throw", Fthrow, Sthrow, 2, 2, 0,
1314 doc: /* Throw to the catch for TAG and return VALUE from it. 1315 doc: /* Throw to the catch for TAG and return VALUE from it.
1315Both TAG and VALUE are evalled. */) 1316Both TAG and VALUE are evalled. */)
1316 (register Lisp_Object tag, Lisp_Object value) 1317 (register Lisp_Object tag, Lisp_Object value)
@@ -1648,7 +1649,7 @@ static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object,
1648static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, 1649static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
1649 Lisp_Object data); 1650 Lisp_Object data);
1650 1651
1651DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, 1652DEFUE ("signal", Fsignal, Ssignal, 2, 2, 0,
1652 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. 1653 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA.
1653This function does not return. 1654This function does not return.
1654 1655
@@ -2032,7 +2033,7 @@ error (const char *m, ...)
2032 va_end (ap); 2033 va_end (ap);
2033} 2034}
2034 2035
2035DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, 2036DEFUE ("commandp", Fcommandp, Scommandp, 1, 2, 0,
2036 doc: /* Non-nil if FUNCTION makes provisions for interactive calling. 2037 doc: /* Non-nil if FUNCTION makes provisions for interactive calling.
2037This means it contains a description for how to read arguments to give it. 2038This means it contains a description for how to read arguments to give it.
2038The value is nil for an invalid function or a symbol with no function 2039The value is nil for an invalid function or a symbol with no function
@@ -2213,7 +2214,7 @@ do_autoload (Lisp_Object fundef, Lisp_Object funname)
2213} 2214}
2214 2215
2215 2216
2216DEFUN ("eval", Feval, Seval, 1, 2, 0, 2217DEFUE ("eval", Feval, Seval, 1, 2, 0,
2217 doc: /* Evaluate FORM and return its value. 2218 doc: /* Evaluate FORM and return its value.
2218If LEXICAL is t, evaluate using lexical scoping. */) 2219If LEXICAL is t, evaluate using lexical scoping. */)
2219 (Lisp_Object form, Lisp_Object lexical) 2220 (Lisp_Object form, Lisp_Object lexical)
@@ -2449,7 +2450,7 @@ eval_sub (Lisp_Object form)
2449 return val; 2450 return val;
2450} 2451}
2451 2452
2452DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, 2453DEFUE ("apply", Fapply, Sapply, 2, MANY, 0,
2453 doc: /* Call FUNCTION with our remaining args, using our last arg as list of args. 2454 doc: /* Call FUNCTION with our remaining args, using our last arg as list of args.
2454Then return the value FUNCTION returns. 2455Then return the value FUNCTION returns.
2455Thus, (apply '+ 1 2 '(3 4)) returns 10. 2456Thus, (apply '+ 1 2 '(3 4)) returns 10.
@@ -2544,7 +2545,7 @@ funcall_nil (size_t nargs, Lisp_Object *args)
2544 return Qnil; 2545 return Qnil;
2545} 2546}
2546 2547
2547DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, 2548DEFUE ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0,
2548 doc: /* Run each hook in HOOKS. 2549 doc: /* Run each hook in HOOKS.
2549Each argument should be a symbol, a hook variable. 2550Each argument should be a symbol, a hook variable.
2550These symbols are processed in the order specified. 2551These symbols are processed in the order specified.
@@ -2573,7 +2574,7 @@ usage: (run-hooks &rest HOOKS) */)
2573 return Qnil; 2574 return Qnil;
2574} 2575}
2575 2576
2576DEFUN ("run-hook-with-args", Frun_hook_with_args, 2577DEFUE ("run-hook-with-args", Frun_hook_with_args,
2577 Srun_hook_with_args, 1, MANY, 0, 2578 Srun_hook_with_args, 1, MANY, 0,
2578 doc: /* Run HOOK with the specified arguments ARGS. 2579 doc: /* Run HOOK with the specified arguments ARGS.
2579HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2580HOOK should be a symbol, a hook variable. If HOOK has a non-nil
@@ -2619,7 +2620,7 @@ funcall_not (size_t nargs, Lisp_Object *args)
2619 return NILP (Ffuncall (nargs, args)) ? Qt : Qnil; 2620 return NILP (Ffuncall (nargs, args)) ? Qt : Qnil;
2620} 2621}
2621 2622
2622DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, 2623DEFUE ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure,
2623 Srun_hook_with_args_until_failure, 1, MANY, 0, 2624 Srun_hook_with_args_until_failure, 1, MANY, 0,
2624 doc: /* Run HOOK with the specified arguments ARGS. 2625 doc: /* Run HOOK with the specified arguments ARGS.
2625HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2626HOOK should be a symbol, a hook variable. If HOOK has a non-nil
@@ -2906,7 +2907,7 @@ call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
2906 2907
2907/* The caller should GCPRO all the elements of ARGS. */ 2908/* The caller should GCPRO all the elements of ARGS. */
2908 2909
2909DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0, 2910DEFUE ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
2910 doc: /* Non-nil if OBJECT is a function. */) 2911 doc: /* Non-nil if OBJECT is a function. */)
2911 (Lisp_Object object) 2912 (Lisp_Object object)
2912{ 2913{
@@ -2939,7 +2940,7 @@ DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
2939 return Qnil; 2940 return Qnil;
2940} 2941}
2941 2942
2942DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, 2943DEFUE ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
2943 doc: /* Call first argument as a function, passing remaining arguments to it. 2944 doc: /* Call first argument as a function, passing remaining arguments to it.
2944Return the value that function returns. 2945Return the value that function returns.
2945Thus, (funcall 'cons 'x 'y) returns (x . y). 2946Thus, (funcall 'cons 'x 'y) returns (x . y).
@@ -3647,8 +3648,6 @@ mark_backtrace (void)
3647 } 3648 }
3648} 3649}
3649 3650
3650EXFUN (Funintern, 2);
3651
3652void 3651void
3653syms_of_eval (void) 3652syms_of_eval (void)
3654{ 3653{