comparison src/buffer.h @ 2782:683f4472f1c8

* lisp.h (Lisp_Overlay): New tag. (OVERLAYP): New predicate. (CHECK_OVERLAY): New type-checker. (Qoverlayp): New extern declaration. * buffer.c (Foverlayp): New function. (Qoverlayp): New atom. (overlays_at, recenter_overlay_lists): Abort if we encounter an invalid overlay. (syms_of_buffer): defsubr Soverlayp; initialize Qoverlayp. (Fdelete_overlay): Set the overlay's markers to point nowhere. Use CHECK_OVERLAY instead of signalling a special error. (Fmove_overlay, Foverlay_put): Use CHECK_OVERLAY instead of signalling a special error. (Foverlay_get): Use CHECK_OVERLAY. * fns.c (internal_equal): Define this for overlays. * buffer.h (OVERLAY_VALID): Define in terms of OVERLAYP. * print.c (print): Give overlays their own print syntax. * alloc.c (mark_object): Treat overlays like conses.
author Jim Blandy <jimb@redhat.com>
date Fri, 14 May 1993 14:43:00 +0000
parents 6fee7500fabd
children e94a593c3952
comparison
equal deleted inserted replaced
2781:fde05936aebb 2782:683f4472f1c8
368 368
369 /* Overlays are ordinary Lisp objects, and users can alter their contents. 369 /* Overlays are ordinary Lisp objects, and users can alter their contents.
370 Therefore, we cannot assume that they remain valid--we must check. */ 370 Therefore, we cannot assume that they remain valid--we must check. */
371 371
372 /* 1 if the OV is a cons cell whose car is a cons cell. */ 372 /* 1 if the OV is a cons cell whose car is a cons cell. */
373 #define OVERLAY_VALID(OV) (CONSP ((OV)) && CONSP (XCONS ((OV))->car)) 373 #define OVERLAY_VALID(OV) (OVERLAYP (OV))
374 374
375 /* Return the marker that stands for where OV starts in the buffer. */ 375 /* Return the marker that stands for where OV starts in the buffer. */
376 #define OVERLAY_START(OV) (XCONS (XCONS ((OV))->car)->car) 376 #define OVERLAY_START(OV) (XCONS (XCONS ((OV))->car)->car)
377 377
378 /* Return the marker that stands for where OV ends in the buffer. */ 378 /* Return the marker that stands for where OV ends in the buffer. */
383 Otherwise, zero. */ 383 Otherwise, zero. */
384 384
385 #define OVERLAY_POSITION(P) \ 385 #define OVERLAY_POSITION(P) \
386 ((MARKERP ((P)) && XMARKER ((P))->buffer == current_buffer) \ 386 ((MARKERP ((P)) && XMARKER ((P))->buffer == current_buffer) \
387 ? marker_position ((P)) : 0) 387 ? marker_position ((P)) : 0)
388
389 388
390 /* Allocation of buffer text. */ 389 /* Allocation of buffer text. */
391 390
392 #ifdef REL_ALLOC 391 #ifdef REL_ALLOC
393 #define BUFFER_ALLOC(data,size) ((unsigned char *) r_alloc (&data, (size))) 392 #define BUFFER_ALLOC(data,size) ((unsigned char *) r_alloc (&data, (size)))