Mercurial > emacs
comparison src/buffer.h @ 2390:e611237d4420
(struct buffer): Field `fieldlist' deleted.
(OVERLAY_START, OVERLAY_END, OVERLAY_VALID): New macros.
(OVERLAY_POSITION): Likewise.
(searchbuf): Decl deleted--doesn't belong here.
Delete include of regex.h for VMS.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Sat, 27 Mar 1993 18:04:02 +0000 |
| parents | e5928bec8d5d |
| children | 6fee7500fabd |
comparison
equal
deleted
inserted
replaced
| 2389:6048be0eedcd | 2390:e611237d4420 |
|---|---|
| 271 t means don't record anything. */ | 271 t means don't record anything. */ |
| 272 Lisp_Object undo_list; | 272 Lisp_Object undo_list; |
| 273 /* t means the mark and region are currently active. */ | 273 /* t means the mark and region are currently active. */ |
| 274 Lisp_Object mark_active; | 274 Lisp_Object mark_active; |
| 275 | 275 |
| 276 /* List of fields in this buffer. */ | 276 /* List of overlays that end at or before the current center, |
| 277 Lisp_Object fieldlist; | 277 in order of end-position. */ |
| 278 Lisp_Object overlays_before; | |
| 279 | |
| 280 /* List of overlays that end after the current center, | |
| 281 in order of start-position. */ | |
| 282 Lisp_Object overlays_after; | |
| 283 | |
| 284 /* Position where the overlay lists are centered. */ | |
| 285 Lisp_Object overlay_center; | |
| 278 }; | 286 }; |
| 287 | |
| 288 /* This points to the current buffer. */ | |
| 279 | 289 |
| 280 extern struct buffer *current_buffer; | 290 extern struct buffer *current_buffer; |
| 281 | 291 |
| 282 /* This structure holds the default values of the buffer-local variables | 292 /* This structure holds the default values of the buffer-local variables |
| 283 defined with DefBufferLispVar, that have special slots in each buffer. | 293 that have special slots in each buffer. |
| 284 The default value occupies the same slot in this structure | 294 The default value occupies the same slot in this structure |
| 285 as an individual buffer's value occupies in that buffer. | 295 as an individual buffer's value occupies in that buffer. |
| 286 Setting the default value also goes through the alist of buffers | 296 Setting the default value also goes through the alist of buffers |
| 287 and stores into each buffer that does not say it has a local value. */ | 297 and stores into each buffer that does not say it has a local value. */ |
| 288 | 298 |
| 296 When a buffer has its own local value for a slot, | 306 When a buffer has its own local value for a slot, |
| 297 the bit for that slot (found in the same slot in this structure) | 307 the bit for that slot (found in the same slot in this structure) |
| 298 is turned on in the buffer's local_var_flags slot. | 308 is turned on in the buffer's local_var_flags slot. |
| 299 | 309 |
| 300 If a slot in this structure is zero, then even though there may | 310 If a slot in this structure is zero, then even though there may |
| 301 be a DefBufferLispVar for the slot, there is no default valuefeor it; | 311 be a Lisp-level local variable for the slot, it has no default value, |
| 302 and the corresponding slot in buffer_defaults is not used. */ | 312 and the corresponding slot in buffer_defaults is not used. */ |
| 303 | 313 |
| 304 extern struct buffer buffer_local_flags; | 314 extern struct buffer buffer_local_flags; |
| 305 | 315 |
| 306 /* For each buffer slot, this points to the Lisp symbol name | 316 /* For each buffer slot, this points to the Lisp symbol name |
| 315 slot contains an integer, then prospective values' tags must be | 325 slot contains an integer, then prospective values' tags must be |
| 316 equal to that integer. When a tag does not match, the function | 326 equal to that integer. When a tag does not match, the function |
| 317 buffer_slot_type_mismatch will signal an error. The value Qnil may | 327 buffer_slot_type_mismatch will signal an error. The value Qnil may |
| 318 always be safely stored in any slot. */ | 328 always be safely stored in any slot. */ |
| 319 extern struct buffer buffer_local_types; | 329 extern struct buffer buffer_local_types; |
| 320 | 330 |
| 321 /* Point in the current buffer. */ | 331 /* Point in the current buffer. This is an obsolete alias |
| 322 | 332 and should be eliminated. */ |
| 323 #define point (current_buffer->text.pt + 0) | 333 #define point (current_buffer->text.pt + 0) |
| 324 | 334 |
| 325 /* Return character at position n. No range checking */ | 335 /* Return character at position n. No range checking. */ |
| 326 #define FETCH_CHAR(n) *(((n)>= GPT ? GAP_SIZE : 0) + (n) + BEG_ADDR - 1) | 336 #define FETCH_CHAR(n) *(((n)>= GPT ? GAP_SIZE : 0) + (n) + BEG_ADDR - 1) |
| 327 | 337 |
| 328 /* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return | 338 /* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return |
| 329 the max (resp. min) p such that | 339 the max (resp. min) p such that |
| 330 | 340 |
| 332 | 342 |
| 333 #define BUFFER_CEILING_OF(n) (((n) < GPT && GPT < ZV ? GPT : ZV) - 1) | 343 #define BUFFER_CEILING_OF(n) (((n) < GPT && GPT < ZV ? GPT : ZV) - 1) |
| 334 #define BUFFER_FLOOR_OF(n) (BEGV <= GPT && GPT <= (n) ? GPT : BEGV) | 344 #define BUFFER_FLOOR_OF(n) (BEGV <= GPT && GPT <= (n) ? GPT : BEGV) |
| 335 | 345 |
| 336 extern void reset_buffer (); | 346 extern void reset_buffer (); |
| 347 | |
| 348 extern Lisp_Object Fbuffer_name (); | |
| 349 extern Lisp_Object Fget_file_buffer (); | |
| 337 | 350 |
| 338 /* Functions to call before and after each text change. */ | 351 /* Functions to call before and after each text change. */ |
| 339 extern Lisp_Object Vbefore_change_function; | 352 extern Lisp_Object Vbefore_change_function; |
| 340 extern Lisp_Object Vafter_change_function; | 353 extern Lisp_Object Vafter_change_function; |
| 341 extern Lisp_Object Vfirst_change_hook; | 354 extern Lisp_Object Vfirst_change_hook; |
| 342 extern Lisp_Object Qfirst_change_hook; | 355 extern Lisp_Object Qfirst_change_hook; |
| 343 | 356 |
| 344 extern Lisp_Object Vdeactivate_mark; | 357 extern Lisp_Object Vdeactivate_mark; |
| 345 extern Lisp_Object Vtransient_mark_mode; | 358 extern Lisp_Object Vtransient_mark_mode; |
| 346 | 359 |
| 347 /* Fields. | 360 /* Overlays */ |
| 348 | 361 |
| 349 A field is like a marker but it defines a region rather than a | 362 /* Overlays are ordinary Lisp objects, and users can alter their contents. |
| 350 point. Like a marker, a field is asocated with a buffer. | 363 Therefore, we cannot assume that they remain valid--we must check. */ |
| 351 The field mechanism uses the marker mechanism in the | 364 |
| 352 sense that its start and end points are maintained as markers | 365 /* 1 if the OV is a cons cell whose car is a cons cell. */ |
| 353 updated in the usual way as the buffer changes. | 366 #define OVERLAY_VALID(OV) (CONSP ((OV)) && CONSP (XCONS ((OV))->car)) |
| 354 | 367 |
| 355 A field can be protected or unprotected. If it is protected, | 368 /* Return the marker that stands for where OV starts in the buffer. */ |
| 356 no modifications can be made that affect the field in its buffer, | 369 #define OVERLAY_START(OV) (XCONS (XCONS ((OV))->car)->car) |
| 357 when protected field checking is enabled. | 370 |
| 358 | 371 /* Return the marker that stands for where OV ends in the buffer. */ |
| 359 Each field also contains an alist, in which you can store | 372 #define OVERLAY_END(OV) (XCONS (XCONS ((OV))->car)->cdr) |
| 360 whatever you like. */ | 373 |
| 361 | 374 /* Return the actual buffer position for the marker P, |
| 362 /* Slots in a field: */ | 375 if it is a marker and points into the current buffer. |
| 363 | 376 Otherwise, zero. */ |
| 364 #define FIELD_BUFFER(f) (XVECTOR(f)->contents[1]) | 377 |
| 365 #define FIELD_START_MARKER(f) (XVECTOR(f)->contents[2]) | 378 #define OVERLAY_POSITION(P) \ |
| 366 #define FIELD_END_MARKER(f) (XVECTOR(f)->contents[3]) | 379 ((MARKERP ((P)) && XMARKER ((P))->buffer == current_buffer) \ |
| 367 #define FIELD_PROTECTED_FLAG(f) (XVECTOR(f)->contents[4]) | 380 ? marker_position ((P)) : 0) |
| 368 #define FIELD_ALIST(f) (XVECTOR(f)->contents[5]) | 381 |
| 369 | 382 |
| 370 /* Allocation of buffer data. */ | 383 /* Allocation of buffer text. */ |
| 384 | |
| 371 #ifdef REL_ALLOC | 385 #ifdef REL_ALLOC |
| 372 #define BUFFER_ALLOC(data,size) ((unsigned char *) r_alloc (&data, (size))) | 386 #define BUFFER_ALLOC(data,size) ((unsigned char *) r_alloc (&data, (size))) |
| 373 #define BUFFER_REALLOC(data,size) ((unsigned char *) r_re_alloc (&data, (size))) | 387 #define BUFFER_REALLOC(data,size) ((unsigned char *) r_re_alloc (&data, (size))) |
| 374 #define BUFFER_FREE(data) (r_alloc_free (&data)) | 388 #define BUFFER_FREE(data) (r_alloc_free (&data)) |
| 375 #define R_ALLOC_DECLARE(var,data) (r_alloc_declare (&var, (data))) | 389 #define R_ALLOC_DECLARE(var,data) (r_alloc_declare (&var, (data))) |
| 377 #define BUFFER_ALLOC(data,size) (data = (unsigned char *) malloc ((size))) | 391 #define BUFFER_ALLOC(data,size) (data = (unsigned char *) malloc ((size))) |
| 378 #define BUFFER_REALLOC(data,size) ((unsigned char *) realloc ((data), (size))) | 392 #define BUFFER_REALLOC(data,size) ((unsigned char *) realloc ((data), (size))) |
| 379 #define BUFFER_FREE(data) (free ((data))) | 393 #define BUFFER_FREE(data) (free ((data))) |
| 380 #define R_ALLOC_DECLARE(var,data) | 394 #define R_ALLOC_DECLARE(var,data) |
| 381 #endif | 395 #endif |
| 382 | |
| 383 /* VAX C is non-ANSI wrt extern declarations and requires the struct | |
| 384 re_pattern_buffer to completely defined for searchbuf's declaration. */ | |
| 385 #ifdef VMS | |
| 386 #include "regex.h" | |
| 387 #endif /* VMS */ | |
| 388 | |
| 389 /* A search buffer, with a fastmap allocated and ready to go. */ | |
| 390 extern struct re_pattern_buffer searchbuf; | |
| 391 | |
| 392 extern Lisp_Object Fbuffer_name (); | |
| 393 extern Lisp_Object Fget_file_buffer (); |
