Mercurial > emacs
comparison src/data.c @ 48961:39ba2cdf869e
(Fmakunbound, Ffmakunbound, Fmake_variable_buffer_local)
(Fsetq_default, Fmake_local_variable, Fkill_local_variable)
(Fmake_variable_frame_local, Faset, Fnumber_to_string)
(Fstring_to_number, Fminus): Mention the returned value in the doc
strings.
| author | Francesco Potort? <pot@gnu.org> |
|---|---|
| date | Wed, 25 Dec 2002 23:27:27 +0000 |
| parents | a6906c113d14 |
| children | 7931f73b31db |
comparison
equal
deleted
inserted
replaced
| 48960:5491133e02c7 | 48961:39ba2cdf869e |
|---|---|
| 626 CHECK_SYMBOL (symbol); | 626 CHECK_SYMBOL (symbol); |
| 627 return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt); | 627 return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt); |
| 628 } | 628 } |
| 629 | 629 |
| 630 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, | 630 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, |
| 631 doc: /* Make SYMBOL's value be void. */) | 631 doc: /* Make SYMBOL's value be void. |
| 632 Return SYMBOL. */) | |
| 632 (symbol) | 633 (symbol) |
| 633 register Lisp_Object symbol; | 634 register Lisp_Object symbol; |
| 634 { | 635 { |
| 635 CHECK_SYMBOL (symbol); | 636 CHECK_SYMBOL (symbol); |
| 636 if (XSYMBOL (symbol)->constant) | 637 if (XSYMBOL (symbol)->constant) |
| 638 Fset (symbol, Qunbound); | 639 Fset (symbol, Qunbound); |
| 639 return symbol; | 640 return symbol; |
| 640 } | 641 } |
| 641 | 642 |
| 642 DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, | 643 DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, |
| 643 doc: /* Make SYMBOL's function definition be void. */) | 644 doc: /* Make SYMBOL's function definition be void. |
| 645 Return SYMBOL. */) | |
| 644 (symbol) | 646 (symbol) |
| 645 register Lisp_Object symbol; | 647 register Lisp_Object symbol; |
| 646 { | 648 { |
| 647 CHECK_SYMBOL (symbol); | 649 CHECK_SYMBOL (symbol); |
| 648 if (NILP (symbol) || EQ (symbol, Qt)) | 650 if (NILP (symbol) || EQ (symbol, Qt)) |
| 791 while (XSYMBOL (hare)->indirect_variable) | 793 while (XSYMBOL (hare)->indirect_variable) |
| 792 { | 794 { |
| 793 hare = XSYMBOL (hare)->value; | 795 hare = XSYMBOL (hare)->value; |
| 794 if (!XSYMBOL (hare)->indirect_variable) | 796 if (!XSYMBOL (hare)->indirect_variable) |
| 795 break; | 797 break; |
| 796 | 798 |
| 797 hare = XSYMBOL (hare)->value; | 799 hare = XSYMBOL (hare)->value; |
| 798 tortoise = XSYMBOL (tortoise)->value; | 800 tortoise = XSYMBOL (tortoise)->value; |
| 799 | 801 |
| 800 if (EQ (hare, tortoise)) | 802 if (EQ (hare, tortoise)) |
| 801 Fsignal (Qcyclic_variable_indirection, Fcons (symbol, Qnil)); | 803 Fsignal (Qcyclic_variable_indirection, Fcons (symbol, Qnil)); |
| 939 void | 941 void |
| 940 swap_in_global_binding (symbol) | 942 swap_in_global_binding (symbol) |
| 941 Lisp_Object symbol; | 943 Lisp_Object symbol; |
| 942 { | 944 { |
| 943 Lisp_Object valcontents, cdr; | 945 Lisp_Object valcontents, cdr; |
| 944 | 946 |
| 945 valcontents = SYMBOL_VALUE (symbol); | 947 valcontents = SYMBOL_VALUE (symbol); |
| 946 if (!BUFFER_LOCAL_VALUEP (valcontents) | 948 if (!BUFFER_LOCAL_VALUEP (valcontents) |
| 947 && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 949 && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 948 abort (); | 950 abort (); |
| 949 cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr; | 951 cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr; |
| 950 | 952 |
| 951 /* Unload the previously loaded binding. */ | 953 /* Unload the previously loaded binding. */ |
| 952 Fsetcdr (XCAR (cdr), | 954 Fsetcdr (XCAR (cdr), |
| 953 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); | 955 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); |
| 954 | 956 |
| 955 /* Select the global binding in the symbol. */ | 957 /* Select the global binding in the symbol. */ |
| 956 XSETCAR (cdr, cdr); | 958 XSETCAR (cdr, cdr); |
| 957 store_symval_forwarding (symbol, valcontents, XCDR (cdr), NULL); | 959 store_symval_forwarding (symbol, valcontents, XCDR (cdr), NULL); |
| 958 | 960 |
| 959 /* Indicate that the global binding is set up now. */ | 961 /* Indicate that the global binding is set up now. */ |
| 973 static Lisp_Object | 975 static Lisp_Object |
| 974 swap_in_symval_forwarding (symbol, valcontents) | 976 swap_in_symval_forwarding (symbol, valcontents) |
| 975 Lisp_Object symbol, valcontents; | 977 Lisp_Object symbol, valcontents; |
| 976 { | 978 { |
| 977 register Lisp_Object tem1; | 979 register Lisp_Object tem1; |
| 978 | 980 |
| 979 tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer; | 981 tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer; |
| 980 | 982 |
| 981 if (NILP (tem1) | 983 if (NILP (tem1) |
| 982 || current_buffer != XBUFFER (tem1) | 984 || current_buffer != XBUFFER (tem1) |
| 983 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame | 985 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame |
| 984 && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) | 986 && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) |
| 985 { | 987 { |
| 986 if (XSYMBOL (symbol)->indirect_variable) | 988 if (XSYMBOL (symbol)->indirect_variable) |
| 987 symbol = indirect_variable (symbol); | 989 symbol = indirect_variable (symbol); |
| 988 | 990 |
| 989 /* Unload the previously loaded binding. */ | 991 /* Unload the previously loaded binding. */ |
| 990 tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); | 992 tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); |
| 991 Fsetcdr (tem1, | 993 Fsetcdr (tem1, |
| 992 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); | 994 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); |
| 993 /* Choose the new binding. */ | 995 /* Choose the new binding. */ |
| 1027 find_symbol_value (symbol) | 1029 find_symbol_value (symbol) |
| 1028 Lisp_Object symbol; | 1030 Lisp_Object symbol; |
| 1029 { | 1031 { |
| 1030 register Lisp_Object valcontents; | 1032 register Lisp_Object valcontents; |
| 1031 register Lisp_Object val; | 1033 register Lisp_Object val; |
| 1032 | 1034 |
| 1033 CHECK_SYMBOL (symbol); | 1035 CHECK_SYMBOL (symbol); |
| 1034 valcontents = SYMBOL_VALUE (symbol); | 1036 valcontents = SYMBOL_VALUE (symbol); |
| 1035 | 1037 |
| 1036 if (BUFFER_LOCAL_VALUEP (valcontents) | 1038 if (BUFFER_LOCAL_VALUEP (valcontents) |
| 1037 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 1039 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 1140 && (NILP (Fkeywordp (symbol)) | 1142 && (NILP (Fkeywordp (symbol)) |
| 1141 || !EQ (newval, SYMBOL_VALUE (symbol)))) | 1143 || !EQ (newval, SYMBOL_VALUE (symbol)))) |
| 1142 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); | 1144 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
| 1143 | 1145 |
| 1144 innercontents = valcontents = SYMBOL_VALUE (symbol); | 1146 innercontents = valcontents = SYMBOL_VALUE (symbol); |
| 1145 | 1147 |
| 1146 if (BUFFER_OBJFWDP (valcontents)) | 1148 if (BUFFER_OBJFWDP (valcontents)) |
| 1147 { | 1149 { |
| 1148 int offset = XBUFFER_OBJFWD (valcontents)->offset; | 1150 int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 1149 int idx = PER_BUFFER_IDX (offset); | 1151 int idx = PER_BUFFER_IDX (offset); |
| 1150 if (idx > 0 | 1152 if (idx > 0 |
| 1363 /* If this variable is not always local in all buffers, | 1365 /* If this variable is not always local in all buffers, |
| 1364 set it in the buffers that don't nominally have a local value. */ | 1366 set it in the buffers that don't nominally have a local value. */ |
| 1365 if (idx > 0) | 1367 if (idx > 0) |
| 1366 { | 1368 { |
| 1367 struct buffer *b; | 1369 struct buffer *b; |
| 1368 | 1370 |
| 1369 for (b = all_buffers; b; b = b->next) | 1371 for (b = all_buffers; b; b = b->next) |
| 1370 if (!PER_BUFFER_VALUE_P (b, idx)) | 1372 if (!PER_BUFFER_VALUE_P (b, idx)) |
| 1371 PER_BUFFER_VALUE (b, offset) = value; | 1373 PER_BUFFER_VALUE (b, offset) = value; |
| 1372 } | 1374 } |
| 1373 return value; | 1375 return value; |
| 1393 } | 1395 } |
| 1394 | 1396 |
| 1395 DEFUN ("setq-default", Fsetq_default, Ssetq_default, 2, UNEVALLED, 0, | 1397 DEFUN ("setq-default", Fsetq_default, Ssetq_default, 2, UNEVALLED, 0, |
| 1396 doc: /* Set the default value of variable VAR to VALUE. | 1398 doc: /* Set the default value of variable VAR to VALUE. |
| 1397 VAR, the variable name, is literal (not evaluated); | 1399 VAR, the variable name, is literal (not evaluated); |
| 1398 VALUE is an expression and it is evaluated. | 1400 VALUE is an expression: it is evaluated and its value returned. |
| 1399 The default value of a variable is seen in buffers | 1401 The default value of a variable is seen in buffers |
| 1400 that do not have their own values for the variable. | 1402 that do not have their own values for the variable. |
| 1401 | 1403 |
| 1402 More generally, you can use multiple variables and values, as in | 1404 More generally, you can use multiple variables and values, as in |
| 1403 (setq-default SYMBOL VALUE SYMBOL VALUE...) | 1405 (setq-default SYMBOL VALUE SYMBOL VALUE...) |
| 1439 At any time, the value for the current buffer is in effect, | 1441 At any time, the value for the current buffer is in effect, |
| 1440 unless the variable has never been set in this buffer, | 1442 unless the variable has never been set in this buffer, |
| 1441 in which case the default value is in effect. | 1443 in which case the default value is in effect. |
| 1442 Note that binding the variable with `let', or setting it while | 1444 Note that binding the variable with `let', or setting it while |
| 1443 a `let'-style binding made in this buffer is in effect, | 1445 a `let'-style binding made in this buffer is in effect, |
| 1444 does not make the variable buffer-local. | 1446 does not make the variable buffer-local. Return VARIABLE. |
| 1445 | 1447 |
| 1446 The function `default-value' gets the default value and `set-default' sets it. */) | 1448 The function `default-value' gets the default value and `set-default' sets it. */) |
| 1447 (variable) | 1449 (variable) |
| 1448 register Lisp_Object variable; | 1450 register Lisp_Object variable; |
| 1449 { | 1451 { |
| 1483 1, 1, "vMake Local Variable: ", | 1485 1, 1, "vMake Local Variable: ", |
| 1484 doc: /* Make VARIABLE have a separate value in the current buffer. | 1486 doc: /* Make VARIABLE have a separate value in the current buffer. |
| 1485 Other buffers will continue to share a common default value. | 1487 Other buffers will continue to share a common default value. |
| 1486 \(The buffer-local value of VARIABLE starts out as the same value | 1488 \(The buffer-local value of VARIABLE starts out as the same value |
| 1487 VARIABLE previously had. If VARIABLE was void, it remains void.\) | 1489 VARIABLE previously had. If VARIABLE was void, it remains void.\) |
| 1488 See also `make-variable-buffer-local'. | 1490 See also `make-variable-buffer-local'. Return VARIABLE. |
| 1489 | 1491 |
| 1490 If the variable is already arranged to become local when set, | 1492 If the variable is already arranged to become local when set, |
| 1491 this function causes a local value to exist for this buffer, | 1493 this function causes a local value to exist for this buffer, |
| 1492 just as setting the variable would do. | 1494 just as setting the variable would do. |
| 1493 | 1495 |
| 1573 } | 1575 } |
| 1574 | 1576 |
| 1575 DEFUN ("kill-local-variable", Fkill_local_variable, Skill_local_variable, | 1577 DEFUN ("kill-local-variable", Fkill_local_variable, Skill_local_variable, |
| 1576 1, 1, "vKill Local Variable: ", | 1578 1, 1, "vKill Local Variable: ", |
| 1577 doc: /* Make VARIABLE no longer have a separate value in the current buffer. | 1579 doc: /* Make VARIABLE no longer have a separate value in the current buffer. |
| 1578 From now on the default value will apply in this buffer. */) | 1580 From now on the default value will apply in this buffer. Return VARIABLE. */) |
| 1579 (variable) | 1581 (variable) |
| 1580 register Lisp_Object variable; | 1582 register Lisp_Object variable; |
| 1581 { | 1583 { |
| 1582 register Lisp_Object tem, valcontents; | 1584 register Lisp_Object tem, valcontents; |
| 1583 | 1585 |
| 1634 1, 1, "vMake Variable Frame Local: ", | 1636 1, 1, "vMake Variable Frame Local: ", |
| 1635 doc: /* Enable VARIABLE to have frame-local bindings. | 1637 doc: /* Enable VARIABLE to have frame-local bindings. |
| 1636 When a frame-local binding exists in the current frame, | 1638 When a frame-local binding exists in the current frame, |
| 1637 it is in effect whenever the current buffer has no buffer-local binding. | 1639 it is in effect whenever the current buffer has no buffer-local binding. |
| 1638 A frame-local binding is actually a frame parameter value; | 1640 A frame-local binding is actually a frame parameter value; |
| 1639 thus, any given frame has a local binding for VARIABLE | 1641 thus, any given frame has a local binding for VARIABLE if it has |
| 1640 if it has a value for the frame parameter named VARIABLE. | 1642 a value for the frame parameter named VARIABLE. Return VARIABLE. |
| 1641 See `modify-frame-parameters' for how to set frame parameters. */) | 1643 See `modify-frame-parameters' for how to set frame parameters. */) |
| 1642 (variable) | 1644 (variable) |
| 1643 register Lisp_Object variable; | 1645 register Lisp_Object variable; |
| 1644 { | 1646 { |
| 1645 register Lisp_Object tem, valcontents, newval; | 1647 register Lisp_Object tem, valcontents, newval; |
| 1948 fns.c for base64 handling. */ | 1950 fns.c for base64 handling. */ |
| 1949 #define MAX_ALLOCA 16*1024 | 1951 #define MAX_ALLOCA 16*1024 |
| 1950 | 1952 |
| 1951 DEFUN ("aset", Faset, Saset, 3, 3, 0, | 1953 DEFUN ("aset", Faset, Saset, 3, 3, 0, |
| 1952 doc: /* Store into the element of ARRAY at index IDX the value NEWELT. | 1954 doc: /* Store into the element of ARRAY at index IDX the value NEWELT. |
| 1953 ARRAY may be a vector, a string, a char-table or a bool-vector. | 1955 Return NEWELT. ARRAY may be a vector, a string, a char-table or a |
| 1954 IDX starts at 0. */) | 1956 bool-vector. IDX starts at 0. */) |
| 1955 (array, idx, newelt) | 1957 (array, idx, newelt) |
| 1956 register Lisp_Object array; | 1958 register Lisp_Object array; |
| 1957 Lisp_Object idx, newelt; | 1959 Lisp_Object idx, newelt; |
| 1958 { | 1960 { |
| 1959 register int idxval; | 1961 register int idxval; |
| 2265 bot = XCAR (bot); | 2267 bot = XCAR (bot); |
| 2266 return ((XINT (top) << 16) | XINT (bot)); | 2268 return ((XINT (top) << 16) | XINT (bot)); |
| 2267 } | 2269 } |
| 2268 | 2270 |
| 2269 DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, | 2271 DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, |
| 2270 doc: /* Convert NUMBER to a string by printing it in decimal. | 2272 doc: /* Return the decimal representation of NUMBER as a string. |
| 2271 Uses a minus sign if negative. | 2273 Uses a minus sign if negative. |
| 2272 NUMBER may be an integer or a floating point number. */) | 2274 NUMBER may be an integer or a floating point number. */) |
| 2273 (number) | 2275 (number) |
| 2274 Lisp_Object number; | 2276 Lisp_Object number; |
| 2275 { | 2277 { |
| 2311 | 2313 |
| 2312 if (digit >= base) | 2314 if (digit >= base) |
| 2313 return -1; | 2315 return -1; |
| 2314 else | 2316 else |
| 2315 return digit; | 2317 return digit; |
| 2316 } | 2318 } |
| 2317 | 2319 |
| 2318 DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 2, 0, | 2320 DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 2, 0, |
| 2319 doc: /* Convert STRING to a number by parsing it as a decimal number. | 2321 doc: /* Return a number obtained by parsing STRING as a decimal number. |
| 2320 This parses both integers and floating point numbers. | 2322 This parses both integers and floating point numbers. |
| 2321 It ignores leading spaces and tabs. | 2323 It ignores leading spaces and tabs. |
| 2322 | 2324 |
| 2323 If BASE, interpret STRING as a number in that base. If BASE isn't | 2325 If BASE, interpret STRING as a number in that base. If BASE isn't |
| 2324 present, base 10 is used. BASE must be between 2 and 16 (inclusive). | 2326 present, base 10 is used. BASE must be between 2 and 16 (inclusive). |
| 2354 sign = -1; | 2356 sign = -1; |
| 2355 p++; | 2357 p++; |
| 2356 } | 2358 } |
| 2357 else if (*p == '+') | 2359 else if (*p == '+') |
| 2358 p++; | 2360 p++; |
| 2359 | 2361 |
| 2360 if (isfloat_string (p) && b == 10) | 2362 if (isfloat_string (p) && b == 10) |
| 2361 val = make_float (sign * atof (p)); | 2363 val = make_float (sign * atof (p)); |
| 2362 else | 2364 else |
| 2363 { | 2365 { |
| 2364 double v = 0; | 2366 double v = 0; |
| 2557 { | 2559 { |
| 2558 return arith_driver (Aadd, nargs, args); | 2560 return arith_driver (Aadd, nargs, args); |
| 2559 } | 2561 } |
| 2560 | 2562 |
| 2561 DEFUN ("-", Fminus, Sminus, 0, MANY, 0, | 2563 DEFUN ("-", Fminus, Sminus, 0, MANY, 0, |
| 2562 doc: /* Negate number or subtract numbers or markers. | 2564 doc: /* Negate number or subtract numbers or markers, returns the result. |
| 2563 With one arg, negates it. With more than one arg, | 2565 With one arg, negates it. With more than one arg, |
| 2564 subtracts all but the first from the first. | 2566 subtracts all but the first from the first. |
| 2565 usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) | 2567 usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) |
| 2566 (nargs, args) | 2568 (nargs, args) |
| 2567 int nargs; | 2569 int nargs; |
| 3210 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; | 3212 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; |
| 3211 | 3213 |
| 3212 DEFVAR_LISP ("most-positive-fixnum", &Vmost_positive_fixnum, | 3214 DEFVAR_LISP ("most-positive-fixnum", &Vmost_positive_fixnum, |
| 3213 doc: /* The largest value that is representable in a Lisp integer. */); | 3215 doc: /* The largest value that is representable in a Lisp integer. */); |
| 3214 Vmost_positive_fixnum = make_number (MOST_POSITIVE_FIXNUM); | 3216 Vmost_positive_fixnum = make_number (MOST_POSITIVE_FIXNUM); |
| 3215 | 3217 |
| 3216 DEFVAR_LISP ("most-negative-fixnum", &Vmost_negative_fixnum, | 3218 DEFVAR_LISP ("most-negative-fixnum", &Vmost_negative_fixnum, |
| 3217 doc: /* The smallest value that is representable in a Lisp integer. */); | 3219 doc: /* The smallest value that is representable in a Lisp integer. */); |
| 3218 Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); | 3220 Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); |
| 3219 } | 3221 } |
| 3220 | 3222 |
