Mercurial > hg > xemacs-beta
comparison src/eval.c @ 802:19dfb459d51a
[xemacs-hg @ 2002-04-03 10:47:37 by ben]
fix tty problem et al
internals/internals.texi: Add section on correctly merging a branch back into the trunk.
console-tty.c, eval.c, event-unixoid.c, file-coding.c, file-coding.h, lisp.h, print.c, sysdep.c: Fix data corruption error in print.c from print_depth becoming
negative. Borrow primitives internal_bind_int,
internal_bind_lisp_object from my stderr-proc ws, soon to be
integrated; use them to properly bind print_depth et al.
First fix for TTY problem. The basic problem is I switched things
so that the TTY I/O is filtered through a coding system, for the
support of kterm and such, that speak JIS or similar
encodings. (#### I ***swear*** I had this working way back in
19.12.) Anyway, this introduced buffering issues, in which instead
of one char being read, it tried to read 1024 chars. I tried
setting the stdin descriptor non-blocking, but it doesn't appear
to work on Cygwin. (#### Andy, do you know anything about this?)
So I fixed it elsewhere. If you get weirdness on the TTY, look in
console-tty.c and see how it gets the coding system; maybe there's
a way to change it (and if not, there should be!).
Also fix warning in sysdep.c.
author | ben |
---|---|
date | Wed, 03 Apr 2002 10:47:52 +0000 |
parents | 2b676dc88c66 |
children | a634e3b7acc8 |
comparison
equal
deleted
inserted
replaced
801:2b676dc88c66 | 802:19dfb459d51a |
---|---|
4904 specpdl_depth_counter++; | 4904 specpdl_depth_counter++; |
4905 return specpdl_depth_counter - 1; | 4905 return specpdl_depth_counter - 1; |
4906 } | 4906 } |
4907 | 4907 |
4908 static Lisp_Object | 4908 static Lisp_Object |
4909 restore_lisp_object (Lisp_Object cons) | |
4910 { | |
4911 Lisp_Object opaque = XCAR (cons); | |
4912 Lisp_Object *addr = (Lisp_Object *) get_opaque_ptr (opaque); | |
4913 *addr = XCDR (cons); | |
4914 free_opaque_ptr (opaque); | |
4915 free_cons (XCONS (cons)); | |
4916 return Qnil; | |
4917 } | |
4918 | |
4919 /* Establish an unwind-protect which will restore the Lisp_Object pointed to | |
4920 by ADDR with the value VAL. */ | |
4921 int | |
4922 record_unwind_protect_restoring_lisp_object (Lisp_Object *addr, | |
4923 Lisp_Object val) | |
4924 { | |
4925 Lisp_Object opaque = make_opaque_ptr (addr); | |
4926 return record_unwind_protect (restore_lisp_object, | |
4927 noseeum_cons (opaque, val)); | |
4928 } | |
4929 | |
4930 /* Similar to specbind() but for any C variable whose value is a | |
4931 Lisp_Object. Sets up an unwind-protect to restore the variable | |
4932 pointed to by ADDR to its existing value, and then changes its | |
4933 value to NEWVAL. Returns the previous value of specpdl_depth(); | |
4934 pass this to unbind_to() after you are done. */ | |
4935 int | |
4936 internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval) | |
4937 { | |
4938 int count = specpdl_depth (); | |
4939 record_unwind_protect_restoring_lisp_object (addr, *addr); | |
4940 *addr = newval; | |
4941 return count; | |
4942 } | |
4943 | |
4944 static Lisp_Object | |
4945 restore_int (Lisp_Object cons) | |
4946 { | |
4947 Lisp_Object opaque = XCAR (cons); | |
4948 Lisp_Object lval = XCDR (cons); | |
4949 int *addr = (int *) get_opaque_ptr (opaque); | |
4950 int val; | |
4951 | |
4952 if (INTP (lval)) | |
4953 val = XINT (lval); | |
4954 else | |
4955 { | |
4956 val = (int) get_opaque_ptr (lval); | |
4957 free_opaque_ptr (lval); | |
4958 } | |
4959 | |
4960 *addr = val; | |
4961 free_opaque_ptr (opaque); | |
4962 free_cons (XCONS (cons)); | |
4963 return Qnil; | |
4964 } | |
4965 | |
4966 /* Establish an unwind-protect which will restore the int pointed to | |
4967 by ADDR with the value VAL. This function works correctly with | |
4968 all ints, even those that don't fit into a Lisp integer. */ | |
4969 int | |
4970 record_unwind_protect_restoring_int (int *addr, int val) | |
4971 { | |
4972 Lisp_Object opaque = make_opaque_ptr (addr); | |
4973 Lisp_Object lval; | |
4974 | |
4975 if (NUMBER_FITS_IN_AN_EMACS_INT (val)) | |
4976 lval = make_int (val); | |
4977 else | |
4978 lval = make_opaque_ptr ((void *) val); | |
4979 return record_unwind_protect (restore_int, noseeum_cons (opaque, lval)); | |
4980 } | |
4981 | |
4982 /* Similar to specbind() but for any C variable whose value is an int. | |
4983 Sets up an unwind-protect to restore the variable pointed to by | |
4984 ADDR to its existing value, and then changes its value to NEWVAL. | |
4985 Returns the previous value of specpdl_depth(); pass this to | |
4986 unbind_to() after you are done. This function works correctly with | |
4987 all ints, even those that don't fit into a Lisp integer. */ | |
4988 int | |
4989 internal_bind_int (int *addr, int newval) | |
4990 { | |
4991 int count = specpdl_depth (); | |
4992 record_unwind_protect_restoring_int (addr, *addr); | |
4993 *addr = newval; | |
4994 return count; | |
4995 } | |
4996 | |
4997 static Lisp_Object | |
4909 free_pointer (Lisp_Object opaque) | 4998 free_pointer (Lisp_Object opaque) |
4910 { | 4999 { |
4911 xfree (get_opaque_ptr (opaque)); | 5000 xfree (get_opaque_ptr (opaque)); |
4912 free_opaque_ptr (opaque); | 5001 free_opaque_ptr (opaque); |
4913 return Qnil; | 5002 return Qnil; |