aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorGerd Moellmann2001-10-14 10:36:32 +0000
committerGerd Moellmann2001-10-14 10:36:32 +0000
commit228299fa7111d1f2da3c2fa741bb27d7dc9c66af (patch)
tree562b09ff191ebd71d426b5b2e33df3f7dcac4977 /src/alloc.c
parent37f6b5b6d246d36afcd658c8bdde1791eb790f63 (diff)
downloademacs-228299fa7111d1f2da3c2fa741bb27d7dc9c66af.tar.gz
emacs-228299fa7111d1f2da3c2fa741bb27d7dc9c66af.zip
Put doc strings in comments.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c223
1 files changed, 113 insertions, 110 deletions
diff --git a/src/alloc.c b/src/alloc.c
index b67f3942ba1..3a9dcc3c59d 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */
38 replaced, this file likely will not be used. */ 38 replaced, this file likely will not be used. */
39 39
40#undef HIDE_LISP_IMPLEMENTATION 40#undef HIDE_LISP_IMPLEMENTATION
41#define DOC_STRINGS_IN_COMMENTS
41#include "lisp.h" 42#include "lisp.h"
42#include "process.h" 43#include "process.h"
43#include "intervals.h" 44#include "intervals.h"
@@ -1659,9 +1660,9 @@ compact_small_strings ()
1659 1660
1660 1661
1661DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, 1662DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
1662 "Return a newly created string of length LENGTH, with each element being INIT.\n\ 1663 /* Return a newly created string of length LENGTH, with each element being INIT.
1663Both LENGTH and INIT must be numbers.") 1664Both LENGTH and INIT must be numbers. */
1664 (length, init) 1665 (length, init))
1665 Lisp_Object length, init; 1666 Lisp_Object length, init;
1666{ 1667{
1667 register Lisp_Object val; 1668 register Lisp_Object val;
@@ -1703,9 +1704,9 @@ Both LENGTH and INIT must be numbers.")
1703 1704
1704 1705
1705DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, 1706DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0,
1706 "Return a new bool-vector of length LENGTH, using INIT for as each element.\n\ 1707 /* Return a new bool-vector of length LENGTH, using INIT for as each element.
1707LENGTH must be a number. INIT matters only in whether it is t or nil.") 1708LENGTH must be a number. INIT matters only in whether it is t or nil. */
1708 (length, init) 1709 (length, init))
1709 Lisp_Object length, init; 1710 Lisp_Object length, init;
1710{ 1711{
1711 register Lisp_Object val; 1712 register Lisp_Object val;
@@ -2057,8 +2058,8 @@ free_cons (ptr)
2057 2058
2058 2059
2059DEFUN ("cons", Fcons, Scons, 2, 2, 0, 2060DEFUN ("cons", Fcons, Scons, 2, 2, 0,
2060 "Create a new cons, give it CAR and CDR as components, and return it.") 2061 /* Create a new cons, give it CAR and CDR as components, and return it. */
2061 (car, cdr) 2062 (car, cdr))
2062 Lisp_Object car, cdr; 2063 Lisp_Object car, cdr;
2063{ 2064{
2064 register Lisp_Object val; 2065 register Lisp_Object val;
@@ -2130,9 +2131,9 @@ list5 (arg1, arg2, arg3, arg4, arg5)
2130 2131
2131 2132
2132DEFUN ("list", Flist, Slist, 0, MANY, 0, 2133DEFUN ("list", Flist, Slist, 0, MANY, 0,
2133 "Return a newly created list with specified arguments as elements.\n\ 2134 /* Return a newly created list with specified arguments as elements.
2134Any number of arguments, even zero arguments, are allowed.") 2135Any number of arguments, even zero arguments, are allowed. */
2135 (nargs, args) 2136 (nargs, args))
2136 int nargs; 2137 int nargs;
2137 register Lisp_Object *args; 2138 register Lisp_Object *args;
2138{ 2139{
@@ -2149,8 +2150,8 @@ Any number of arguments, even zero arguments, are allowed.")
2149 2150
2150 2151
2151DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, 2152DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
2152 "Return a newly created list of length LENGTH, with each element being INIT.") 2153 /* Return a newly created list of length LENGTH, with each element being INIT. */
2153 (length, init) 2154 (length, init))
2154 register Lisp_Object length, init; 2155 register Lisp_Object length, init;
2155{ 2156{
2156 register Lisp_Object val; 2157 register Lisp_Object val;
@@ -2336,9 +2337,9 @@ allocate_other_vector (len)
2336 2337
2337 2338
2338DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, 2339DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
2339 "Return a newly created vector of length LENGTH, with each element being INIT.\n\ 2340 /* Return a newly created vector of length LENGTH, with each element being INIT.
2340See also the function `vector'.") 2341See also the function `vector'. */
2341 (length, init) 2342 (length, init))
2342 register Lisp_Object length, init; 2343 register Lisp_Object length, init;
2343{ 2344{
2344 Lisp_Object vector; 2345 Lisp_Object vector;
@@ -2359,11 +2360,11 @@ See also the function `vector'.")
2359 2360
2360 2361
2361DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 1, 2, 0, 2362DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 1, 2, 0,
2362 "Return a newly created char-table, with purpose PURPOSE.\n\ 2363 /* Return a newly created char-table, with purpose PURPOSE.
2363Each element is initialized to INIT, which defaults to nil.\n\ 2364Each element is initialized to INIT, which defaults to nil.
2364PURPOSE should be a symbol which has a `char-table-extra-slots' property.\n\ 2365PURPOSE should be a symbol which has a `char-table-extra-slots' property.
2365The property's value should be an integer between 0 and 10.") 2366The property's value should be an integer between 0 and 10. */
2366 (purpose, init) 2367 (purpose, init))
2367 register Lisp_Object purpose, init; 2368 register Lisp_Object purpose, init;
2368{ 2369{
2369 Lisp_Object vector; 2370 Lisp_Object vector;
@@ -2402,9 +2403,9 @@ make_sub_char_table (defalt)
2402 2403
2403 2404
2404DEFUN ("vector", Fvector, Svector, 0, MANY, 0, 2405DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
2405 "Return a newly created vector with specified arguments as elements.\n\ 2406 /* Return a newly created vector with specified arguments as elements.
2406Any number of arguments, even zero arguments, are allowed.") 2407Any number of arguments, even zero arguments, are allowed. */
2407 (nargs, args) 2408 (nargs, args))
2408 register int nargs; 2409 register int nargs;
2409 Lisp_Object *args; 2410 Lisp_Object *args;
2410{ 2411{
@@ -2422,12 +2423,12 @@ Any number of arguments, even zero arguments, are allowed.")
2422 2423
2423 2424
2424DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0, 2425DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0,
2425 "Create a byte-code object with specified arguments as elements.\n\ 2426 /* Create a byte-code object with specified arguments as elements.
2426The arguments should be the arglist, bytecode-string, constant vector,\n\ 2427The arguments should be the arglist, bytecode-string, constant vector,
2427stack size, (optional) doc string, and (optional) interactive spec.\n\ 2428stack size, (optional) doc string, and (optional) interactive spec.
2428The first four arguments are required; at most six have any\n\ 2429The first four arguments are required; at most six have any
2429significance.") 2430significance. */
2430 (nargs, args) 2431 (nargs, args))
2431 register int nargs; 2432 register int nargs;
2432 Lisp_Object *args; 2433 Lisp_Object *args;
2433{ 2434{
@@ -2510,9 +2511,9 @@ init_symbol ()
2510 2511
2511 2512
2512DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, 2513DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
2513 "Return a newly allocated uninterned symbol whose name is NAME.\n\ 2514 /* Return a newly allocated uninterned symbol whose name is NAME.
2514Its value and function definition are void, and its property list is nil.") 2515Its value and function definition are void, and its property list is nil. */
2515 (name) 2516 (name))
2516 Lisp_Object name; 2517 Lisp_Object name;
2517{ 2518{
2518 register Lisp_Object val; 2519 register Lisp_Object val;
@@ -2628,8 +2629,8 @@ allocate_misc ()
2628} 2629}
2629 2630
2630DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, 2631DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
2631 "Return a newly allocated marker which does not point at any place.") 2632 /* Return a newly allocated marker which does not point at any place. */
2632 () 2633 ())
2633{ 2634{
2634 register Lisp_Object val; 2635 register Lisp_Object val;
2635 register struct Lisp_Marker *p; 2636 register struct Lisp_Marker *p;
@@ -3299,8 +3300,8 @@ static int max_live, max_zombies;
3299static double avg_live; 3300static double avg_live;
3300 3301
3301DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", 3302DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
3302 "Show information about live and zombie objects.") 3303 /* Show information about live and zombie objects. */
3303 () 3304 ())
3304{ 3305{
3305 Lisp_Object args[7]; 3306 Lisp_Object args[7];
3306 args[0] = build_string ("%d GCs, avg live/zombies = %.2f/%.2f (%f%%), max %d/%d"); 3307 args[0] = build_string ("%d GCs, avg live/zombies = %.2f/%.2f (%f%%), max %d/%d");
@@ -3918,10 +3919,10 @@ make_pure_vector (len)
3918 3919
3919 3920
3920DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, 3921DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0,
3921 "Make a copy of OBJECT in pure storage.\n\ 3922 /* Make a copy of OBJECT in pure storage.
3922Recursively copies contents of vectors and cons cells.\n\ 3923Recursively copies contents of vectors and cons cells.
3923Does not copy symbols. Copies strings without text properties.") 3924Does not copy symbols. Copies strings without text properties. */
3924 (obj) 3925 (obj))
3925 register Lisp_Object obj; 3926 register Lisp_Object obj;
3926{ 3927{
3927 if (NILP (Vpurify_flag)) 3928 if (NILP (Vpurify_flag))
@@ -4015,15 +4016,15 @@ inhibit_garbage_collection ()
4015 4016
4016 4017
4017DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", 4018DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
4018 "Reclaim storage for Lisp objects no longer needed.\n\ 4019 /* Reclaim storage for Lisp objects no longer needed.
4019Returns info on amount of space in use:\n\ 4020Returns info on amount of space in use:
4020 ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\ 4021 ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)
4021 (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS\n\ 4022 (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS
4022 (USED-FLOATS . FREE-FLOATS) (USED-INTERVALS . FREE-INTERVALS)\n\ 4023 (USED-FLOATS . FREE-FLOATS) (USED-INTERVALS . FREE-INTERVALS)
4023 (USED-STRINGS . FREE-STRINGS))\n\ 4024 (USED-STRINGS . FREE-STRINGS))
4024Garbage collection happens automatically if you cons more than\n\ 4025Garbage collection happens automatically if you cons more than
4025`gc-cons-threshold' bytes of Lisp data since previous garbage collection.") 4026`gc-cons-threshold' bytes of Lisp data since previous garbage collection. */
4026 () 4027 ())
4027{ 4028{
4028 register struct gcpro *tail; 4029 register struct gcpro *tail;
4029 register struct specbinding *bind; 4030 register struct specbinding *bind;
@@ -5317,10 +5318,10 @@ gc_sweep ()
5317/* Debugging aids. */ 5318/* Debugging aids. */
5318 5319
5319DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0, 5320DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0,
5320 "Return the address of the last byte Emacs has allocated, divided by 1024.\n\ 5321 /* Return the address of the last byte Emacs has allocated, divided by 1024.
5321This may be helpful in debugging Emacs's memory usage.\n\ 5322This may be helpful in debugging Emacs's memory usage.
5322We divide the value by 1024 to make sure it fits in a Lisp integer.") 5323We divide the value by 1024 to make sure it fits in a Lisp integer. */
5323 () 5324 ())
5324{ 5325{
5325 Lisp_Object end; 5326 Lisp_Object end;
5326 5327
@@ -5330,19 +5331,19 @@ We divide the value by 1024 to make sure it fits in a Lisp integer.")
5330} 5331}
5331 5332
5332DEFUN ("memory-use-counts", Fmemory_use_counts, Smemory_use_counts, 0, 0, 0, 5333DEFUN ("memory-use-counts", Fmemory_use_counts, Smemory_use_counts, 0, 0, 0,
5333 "Return a list of counters that measure how much consing there has been.\n\ 5334 /* Return a list of counters that measure how much consing there has been.
5334Each of these counters increments for a certain kind of object.\n\ 5335Each of these counters increments for a certain kind of object.
5335The counters wrap around from the largest positive integer to zero.\n\ 5336The counters wrap around from the largest positive integer to zero.
5336Garbage collection does not decrease them.\n\ 5337Garbage collection does not decrease them.
5337The elements of the value are as follows:\n\ 5338The elements of the value are as follows:
5338 (CONSES FLOATS VECTOR-CELLS SYMBOLS STRING-CHARS MISCS INTERVALS STRINGS)\n\ 5339 (CONSES FLOATS VECTOR-CELLS SYMBOLS STRING-CHARS MISCS INTERVALS STRINGS)
5339All are in units of 1 = one object consed\n\ 5340All are in units of 1 = one object consed
5340except for VECTOR-CELLS and STRING-CHARS, which count the total length of\n\ 5341except for VECTOR-CELLS and STRING-CHARS, which count the total length of
5341objects consed.\n\ 5342objects consed.
5342MISCS include overlays, markers, and some internal types.\n\ 5343MISCS include overlays, markers, and some internal types.
5343Frames, windows, buffers, and subprocesses count as vectors\n\ 5344Frames, windows, buffers, and subprocesses count as vectors
5344 (but the contents of a buffer's text do not count here).") 5345 (but the contents of a buffer's text do not count here). */
5345 () 5346 ())
5346{ 5347{
5347 Lisp_Object consed[8]; 5348 Lisp_Object consed[8];
5348 5349
@@ -5435,66 +5436,68 @@ init_alloc ()
5435void 5436void
5436syms_of_alloc () 5437syms_of_alloc ()
5437{ 5438{
5438 DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, 5439 DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold
5439 "*Number of bytes of consing between garbage collections.\n\ 5440 /* *Number of bytes of consing between garbage collections.
5440Garbage collection can happen automatically once this many bytes have been\n\ 5441Garbage collection can happen automatically once this many bytes have been
5441allocated since the last garbage collection. All data types count.\n\n\ 5442allocated since the last garbage collection. All data types count.
5442Garbage collection happens automatically only when `eval' is called.\n\n\
5443By binding this temporarily to a large number, you can effectively\n\
5444prevent garbage collection during a part of the program.");
5445 5443
5446 DEFVAR_INT ("pure-bytes-used", &pure_bytes_used, 5444Garbage collection happens automatically only when `eval' is called.
5447 "Number of bytes of sharable Lisp data allocated so far.");
5448 5445
5449 DEFVAR_INT ("cons-cells-consed", &cons_cells_consed, 5446By binding this temporarily to a large number, you can effectively
5450 "Number of cons cells that have been consed so far."); 5447prevent garbage collection during a part of the program. */);
5451 5448
5452 DEFVAR_INT ("floats-consed", &floats_consed, 5449 DEFVAR_INT ("pure-bytes-used", &pure_bytes_used
5453 "Number of floats that have been consed so far."); 5450 /* Number of bytes of sharable Lisp data allocated so far. */);
5454 5451
5455 DEFVAR_INT ("vector-cells-consed", &vector_cells_consed, 5452 DEFVAR_INT ("cons-cells-consed", &cons_cells_consed
5456 "Number of vector cells that have been consed so far."); 5453 /* Number of cons cells that have been consed so far. */);
5457 5454
5458 DEFVAR_INT ("symbols-consed", &symbols_consed, 5455 DEFVAR_INT ("floats-consed", &floats_consed
5459 "Number of symbols that have been consed so far."); 5456 /* Number of floats that have been consed so far. */);
5460 5457
5461 DEFVAR_INT ("string-chars-consed", &string_chars_consed, 5458 DEFVAR_INT ("vector-cells-consed", &vector_cells_consed
5462 "Number of string characters that have been consed so far."); 5459 /* Number of vector cells that have been consed so far. */);
5463 5460
5464 DEFVAR_INT ("misc-objects-consed", &misc_objects_consed, 5461 DEFVAR_INT ("symbols-consed", &symbols_consed
5465 "Number of miscellaneous objects that have been consed so far."); 5462 /* Number of symbols that have been consed so far. */);
5466 5463
5467 DEFVAR_INT ("intervals-consed", &intervals_consed, 5464 DEFVAR_INT ("string-chars-consed", &string_chars_consed
5468 "Number of intervals that have been consed so far."); 5465 /* Number of string characters that have been consed so far. */);
5469 5466
5470 DEFVAR_INT ("strings-consed", &strings_consed, 5467 DEFVAR_INT ("misc-objects-consed", &misc_objects_consed
5471 "Number of strings that have been consed so far."); 5468 /* Number of miscellaneous objects that have been consed so far. */);
5472 5469
5473 DEFVAR_LISP ("purify-flag", &Vpurify_flag, 5470 DEFVAR_INT ("intervals-consed", &intervals_consed
5474 "Non-nil means loading Lisp code in order to dump an executable.\n\ 5471 /* Number of intervals that have been consed so far. */);
5475This means that certain objects should be allocated in shared (pure) space.");
5476 5472
5477 DEFVAR_INT ("undo-limit", &undo_limit, 5473 DEFVAR_INT ("strings-consed", &strings_consed
5478 "Keep no more undo information once it exceeds this size.\n\ 5474 /* Number of strings that have been consed so far. */);
5479This limit is applied when garbage collection happens.\n\ 5475
5480The size is counted as the number of bytes occupied,\n\ 5476 DEFVAR_LISP ("purify-flag", &Vpurify_flag
5481which includes both saved text and other data."); 5477 /* Non-nil means loading Lisp code in order to dump an executable.
5478This means that certain objects should be allocated in shared (pure) space. */);
5479
5480 DEFVAR_INT ("undo-limit", &undo_limit
5481 /* Keep no more undo information once it exceeds this size.
5482This limit is applied when garbage collection happens.
5483The size is counted as the number of bytes occupied,
5484which includes both saved text and other data. */);
5482 undo_limit = 20000; 5485 undo_limit = 20000;
5483 5486
5484 DEFVAR_INT ("undo-strong-limit", &undo_strong_limit, 5487 DEFVAR_INT ("undo-strong-limit", &undo_strong_limit
5485 "Don't keep more than this much size of undo information.\n\ 5488 /* Don't keep more than this much size of undo information.
5486A command which pushes past this size is itself forgotten.\n\ 5489A command which pushes past this size is itself forgotten.
5487This limit is applied when garbage collection happens.\n\ 5490This limit is applied when garbage collection happens.
5488The size is counted as the number of bytes occupied,\n\ 5491The size is counted as the number of bytes occupied,
5489which includes both saved text and other data."); 5492which includes both saved text and other data. */);
5490 undo_strong_limit = 30000; 5493 undo_strong_limit = 30000;
5491 5494
5492 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages, 5495 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages
5493 "Non-nil means display messages at start and end of garbage collection."); 5496 /* Non-nil means display messages at start and end of garbage collection. */);
5494 garbage_collection_messages = 0; 5497 garbage_collection_messages = 0;
5495 5498
5496 DEFVAR_LISP ("post-gc-hook", &Vpost_gc_hook, 5499 DEFVAR_LISP ("post-gc-hook", &Vpost_gc_hook
5497 "Hook run after garbage collection has finished."); 5500 /* Hook run after garbage collection has finished. */);
5498 Vpost_gc_hook = Qnil; 5501 Vpost_gc_hook = Qnil;
5499 Qpost_gc_hook = intern ("post-gc-hook"); 5502 Qpost_gc_hook = intern ("post-gc-hook");
5500 staticpro (&Qpost_gc_hook); 5503 staticpro (&Qpost_gc_hook);