diff options
| author | Jim Blandy | 1992-06-30 13:55:35 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-06-30 13:55:35 +0000 |
| commit | d8cafeb502e38d57a368708031d96cab3a8f58e6 (patch) | |
| tree | a4017e1dc132d8b409cada16c5413be748cbdc54 /src | |
| parent | e5d77022e8429ca757746ed5d7cf9e2420703e8e (diff) | |
| download | emacs-d8cafeb502e38d57a368708031d96cab3a8f58e6.tar.gz emacs-d8cafeb502e38d57a368708031d96cab3a8f58e6.zip | |
entered into RCS
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 111 | ||||
| -rw-r--r-- | src/filelock.c | 1 |
2 files changed, 78 insertions, 34 deletions
diff --git a/src/data.c b/src/data.c index e8e5b10a4d6..f963a323d7d 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -745,54 +745,94 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, | |||
| 745 | current_buffer->local_var_flags |= mask; | 745 | current_buffer->local_var_flags |= mask; |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | if (XTYPE (valcontents) == Lisp_Buffer_Local_Value | 748 | else if (XTYPE (valcontents) == Lisp_Buffer_Local_Value |
| 749 | || XTYPE (valcontents) == Lisp_Some_Buffer_Local_Value) | 749 | || XTYPE (valcontents) == Lisp_Some_Buffer_Local_Value) |
| 750 | { | 750 | { |
| 751 | /* valcontents is a list | 751 | /* valcontents is actually a pointer to a cons heading something like: |
| 752 | (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)). | 752 | (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE). |
| 753 | 753 | ||
| 754 | CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's | 754 | BUFFER is the last buffer for which this symbol's value was |
| 755 | local_var_alist, that being the element whose car is this variable. | 755 | made up to date. |
| 756 | Or it can be a pointer to the (CURRENT-ALIST-ELEMENT . DEFAULT-VALUE), if BUFFER | 756 | |
| 757 | does not have an element in its alist for this variable. | 757 | CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's |
| 758 | 758 | local_var_alist, that being the element whose car is this | |
| 759 | If the current buffer is not BUFFER, we store the current REALVALUE value into | 759 | variable. Or it can be a pointer to the |
| 760 | CURRENT-ALIST-ELEMENT, then find the appropriate alist element for | 760 | (CURRENT-ALIST-ELEMENT . DEFAULT-VALUE), if BUFFER does not |
| 761 | the buffer now current and set up CURRENT-ALIST-ELEMENT. | 761 | have an element in its alist for this variable (that is, if |
| 762 | Then we set REALVALUE out of that element, and store into BUFFER. | 762 | BUFFER sees the default value of this variable). |
| 763 | Note that REALVALUE can be a forwarding pointer. */ | 763 | |
| 764 | 764 | If we want to examine or set the value and BUFFER is current, | |
| 765 | current_alist_element = XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car; | 765 | we just examine or set REALVALUE. If BUFFER is not current, we |
| 766 | if (current_buffer != ((XTYPE (valcontents) == Lisp_Some_Buffer_Local_Value) | 766 | store the current REALVALUE value into CURRENT-ALIST-ELEMENT, |
| 767 | ? XBUFFER (XCONS (XCONS (valcontents)->cdr)->car) | 767 | then find the appropriate alist element for the buffer now |
| 768 | : XBUFFER (XCONS (current_alist_element)->car))) | 768 | current and set up CURRENT-ALIST-ELEMENT. Then we set |
| 769 | REALVALUE out of that element, and store into BUFFER. | ||
| 770 | |||
| 771 | If we are setting the variable and the current buffer does | ||
| 772 | not have an alist entry for this variable, an alist entry is | ||
| 773 | created. | ||
| 774 | |||
| 775 | Note that REALVALUE can be a forwarding pointer. Each time | ||
| 776 | it is examined or set, forwarding must be done. */ | ||
| 777 | |||
| 778 | /* What value are we caching right now? */ | ||
| 779 | current_alist_element = | ||
| 780 | XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car; | ||
| 781 | |||
| 782 | /* If the current buffer is not the buffer whose binding is | ||
| 783 | currently cached, or if it's a Lisp_Buffer_Local_Value and | ||
| 784 | we're looking at the default value, the cache is invalid; we | ||
| 785 | need to write it out, and find the new CURRENT-ALIST-ELEMENT. */ | ||
| 786 | if ((current_buffer | ||
| 787 | != XBUFFER (XCONS (XCONS (valcontents)->cdr)->car)) | ||
| 788 | || (XTYPE (valcontents) == Lisp_Buffer_Local_Value | ||
| 789 | && XCONS (current_alist_element)->car == current_alist_element)) | ||
| 769 | { | 790 | { |
| 770 | Fsetcdr (current_alist_element, do_symval_forwarding (XCONS (valcontents)->car)); | 791 | /* Write out the cached value for the old buffer; copy it |
| 792 | back to its alist element. This works if the current | ||
| 793 | buffer only sees the default value, too. */ | ||
| 794 | Fsetcdr (current_alist_element, | ||
| 795 | do_symval_forwarding (XCONS (valcontents)->car)); | ||
| 771 | 796 | ||
| 797 | /* Find the new value for CURRENT-ALIST-ELEMENT. */ | ||
| 772 | tem1 = Fassq (sym, current_buffer->local_var_alist); | 798 | tem1 = Fassq (sym, current_buffer->local_var_alist); |
| 773 | if (NILP (tem1)) | 799 | if (NILP (tem1)) |
| 774 | /* This buffer sees the default value still. | 800 | { |
| 775 | If type is Lisp_Some_Buffer_Local_Value, set the default value. | 801 | /* This buffer still sees the default value. */ |
| 776 | If type is Lisp_Buffer_Local_Value, give this buffer a local value | 802 | |
| 777 | and set that. */ | 803 | /* If the variable is a Lisp_Some_Buffer_Local_Value, |
| 778 | if (XTYPE (valcontents) == Lisp_Some_Buffer_Local_Value) | 804 | make CURRENT-ALIST-ELEMENT point to itself, |
| 779 | tem1 = XCONS (XCONS (valcontents)->cdr)->cdr; | 805 | indicating that we're seeing the default value. */ |
| 780 | else | 806 | if (XTYPE (valcontents) == Lisp_Some_Buffer_Local_Value) |
| 781 | { | 807 | tem1 = XCONS (XCONS (valcontents)->cdr)->cdr; |
| 782 | tem1 = Fcons (sym, Fcdr (current_alist_element)); | 808 | |
| 783 | current_buffer->local_var_alist = Fcons (tem1, current_buffer->local_var_alist); | 809 | /* If it's a Lisp_Buffer_Local_Value, give this buffer a |
| 784 | } | 810 | new assoc for a local value and set |
| 811 | CURRENT-ALIST-ELEMENT to point to that. */ | ||
| 812 | else | ||
| 813 | { | ||
| 814 | tem1 = Fcons (sym, Fcdr (current_alist_element)); | ||
| 815 | current_buffer->local_var_alist = | ||
| 816 | Fcons (tem1, current_buffer->local_var_alist); | ||
| 817 | } | ||
| 818 | } | ||
| 819 | /* Cache the new buffer's assoc in CURRENT-ALIST-ELEMENT. */ | ||
| 785 | XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car = tem1; | 820 | XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car = tem1; |
| 786 | XSET (XCONS (XCONS (valcontents)->cdr)->car, Lisp_Buffer, current_buffer); | 821 | |
| 822 | /* Set BUFFER, now that CURRENT-ALIST-ELEMENT is accurate. */ | ||
| 823 | XSET (XCONS (XCONS (valcontents)->cdr)->car, | ||
| 824 | Lisp_Buffer, current_buffer); | ||
| 787 | } | 825 | } |
| 788 | valcontents = XCONS (valcontents)->car; | 826 | valcontents = XCONS (valcontents)->car; |
| 789 | } | 827 | } |
| 828 | |||
| 790 | /* If storing void (making the symbol void), forward only through | 829 | /* If storing void (making the symbol void), forward only through |
| 791 | buffer-local indicator, not through Lisp_Objfwd, etc. */ | 830 | buffer-local indicator, not through Lisp_Objfwd, etc. */ |
| 792 | if (voide) | 831 | if (voide) |
| 793 | store_symval_forwarding (sym, Qnil, newval); | 832 | store_symval_forwarding (sym, Qnil, newval); |
| 794 | else | 833 | else |
| 795 | store_symval_forwarding (sym, valcontents, newval); | 834 | store_symval_forwarding (sym, valcontents, newval); |
| 835 | |||
| 796 | return newval; | 836 | return newval; |
| 797 | } | 837 | } |
| 798 | 838 | ||
| @@ -1598,7 +1638,10 @@ Both must be numbers or markers.") | |||
| 1598 | 1638 | ||
| 1599 | f1 = XTYPE (num1) == Lisp_Float ? XFLOAT (num1)->data : XINT (num1); | 1639 | f1 = XTYPE (num1) == Lisp_Float ? XFLOAT (num1)->data : XINT (num1); |
| 1600 | f2 = XTYPE (num2) == Lisp_Float ? XFLOAT (num2)->data : XINT (num2); | 1640 | f2 = XTYPE (num2) == Lisp_Float ? XFLOAT (num2)->data : XINT (num2); |
| 1601 | return (make_float (drem (f1,f2))); | 1641 | f1 = drem (f1, f2); |
| 1642 | if (f1 < 0) | ||
| 1643 | f1 += f2; | ||
| 1644 | return (make_float (f1)); | ||
| 1602 | } | 1645 | } |
| 1603 | #else /* not LISP_FLOAT_TYPE */ | 1646 | #else /* not LISP_FLOAT_TYPE */ |
| 1604 | CHECK_NUMBER_COERCE_MARKER (num1, 0); | 1647 | CHECK_NUMBER_COERCE_MARKER (num1, 0); |
diff --git a/src/filelock.c b/src/filelock.c index b76ee689d55..738cb382b98 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -40,6 +40,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 40 | extern int errno; | 40 | extern int errno; |
| 41 | 41 | ||
| 42 | extern char *egetenv (); | 42 | extern char *egetenv (); |
| 43 | extern char *strcpy (); | ||
| 43 | 44 | ||
| 44 | #ifdef CLASH_DETECTION | 45 | #ifdef CLASH_DETECTION |
| 45 | 46 | ||