Mercurial > hg > xemacs-beta
annotate src/gutter.h @ 5560:58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
src/ChangeLog addition:
2011-09-04 Aidan Kehoe <kehoea@parhasard.net>
* alloc.c:
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT_1):
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT):
* alloc.c (cons_print_preprocess):
* alloc.c (vector_print_preprocess):
* alloc.c (vector_nsubst_structures_descend):
* alloc.c (Fmake_symbol):
* alloc.c (UNMARK_symbol):
* alloc.c (sweep_symbols):
* alloc.c (reinit_alloc_objects_early):
* alloc.c (reinit_alloc_early):
* bytecode.c:
* bytecode.c (compiled_function_print_preprocess):
* bytecode.c (compiled_function_nsubst_structures_descend):
* bytecode.c (set_compiled_function_arglist):
* bytecode.c (set_compiled_function_interactive):
* bytecode.c (bytecode_objects_create):
* chartab.c:
* chartab.c (print_preprocess_mapper):
* chartab.c (nsubst_structures_mapper):
* chartab.c (char_table_nsubst_structures_descend):
* chartab.c (chartab_objects_create):
* elhash.c:
* elhash.c (nsubst_structures_map_hash_table):
* elhash.c (hash_table_nsubst_structures_descend):
* elhash.c (print_preprocess_mapper):
* elhash.c (hash_table_print_preprocess):
* elhash.c (inchash_eq):
* elhash.c (hash_table_objects_create):
* elhash.c (syms_of_elhash):
* elhash.h:
* emacs.c (main_1):
* fns.c:
* fns.c (check_eq_nokey):
* fns.c (Fnsubst):
* fns.c (syms_of_fns):
* lisp.h:
* lisp.h (struct Lisp_Symbol):
* lisp.h (IN_OBARRAY):
* lisp.h (struct):
* lisp.h (PRINT_PREPROCESS):
* lread.c (read1):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (DEFINE_DUMPABLE_MODULE_LISP_OBJECT):
* print.c:
* print.c (PRINT_CIRCLE_LIMIT):
* print.c (print_continuous_numbering_changed):
* print.c (print_prepare):
* print.c (print_finish):
* print.c (Fprin1_to_string):
* print.c (print_cons):
* print.c (print_preprocess_inchash_eq):
* print.c (print_preprocess):
* print.c (print_sort_get_numbers):
* print.c (print_sort_compare_ordinals):
* print.c (print_gensym_or_circle):
* print.c (nsubst_structures_descend):
* print.c (nsubst_structures):
* print.c (print_internal):
* print.c (print_symbol):
* print.c (vars_of_print):
* rangetab.c:
* rangetab.c (range_table_print_preprocess):
* rangetab.c (range_table_nsubst_structures_descend):
* rangetab.c (rangetab_objects_create):
* rangetab.c (syms_of_rangetab):
* symbols.c:
* symbols.c (symbol_print_preprocess):
* symbols.c (Fintern):
* symbols.c (Funintern):
* symbols.c (reinit_symbol_objects_early):
* symbols.c (init_symbols_once_early):
* symsinit.h:
Implement print-circle, printing circular structures in a readable
fashion, and treating them appropriately on read. This is by means
of two new object methods, print_preprocess (detecting
circularities), and nsubst_structures_descend (replacing
placeholders with the read objects).
Expose the substitution to Lisp via #'nsubst and its new
:descend-structures keyword.
Store information as to whether symbols are interned in obarray or
not in their header, making checking for keywords and uninterned
symbols (and thus printing) cheaper.
Default print_gensym to t, as Common Lisp does, and as a
more-than-decade old comment suggests.
lisp/ChangeLog addition:
2011-09-04 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-output-file-form):
* bytecomp.el (byte-compile-output-docform):
Bind print-circle, print-continuous-numbering in these functions,
now those variables are available.
* lisp.el (forward-sexp):
* lisp.el (backward-sexp):
Recognise leading #N= as being part of an expression.
tests/ChangeLog addition:
2011-09-04 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-reader-tests.el:
* automated/lisp-tests.el (literal-with-uninterned):
* automated/symbol-tests.el (foo):
Test print-circle, for printing (mutually-)recursive and circular
structures.
Bind print-continuous-numbering where appropriate.
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Sun, 04 Sep 2011 19:51:35 +0100 |
| parents | 308d34e9f07d |
| children | 56144c8593a8 |
| rev | line source |
|---|---|
| 428 | 1 /* Define general gutter support. |
| 2 Copyright (C) 1999 Andy Piper. | |
|
5077
d372b17f63ce
clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents:
826
diff
changeset
|
3 Copyright (C) 2010 Ben Wing. |
| 428 | 4 |
| 5 This file is part of XEmacs. | |
| 6 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5090
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
| 428 | 8 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5090
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5090
diff
changeset
|
10 option) any later version. |
| 428 | 11 |
| 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 15 for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5090
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 19 |
| 20 /* Synched up with: Not in FSF. */ | |
| 21 | |
| 440 | 22 #ifndef INCLUDED_gutter_h_ |
| 23 #define INCLUDED_gutter_h_ | |
| 428 | 24 |
| 25 #include "specifier.h" | |
| 26 | |
| 434 | 27 #define DEVICE_SUPPORTS_GUTTERS_P(d) HAS_DEVMETH_P (d, output_frame_gutters) |
| 428 | 28 |
| 29 DECLARE_SPECIFIER_TYPE (gutter); | |
| 30 #define XGUTTER_SPECIFIER(x) XSPECIFIER_TYPE (x, gutter) | |
| 31 #define GUTTER_SPECIFIERP(x) SPECIFIER_TYPEP (x, gutter) | |
| 32 #define CHECK_GUTTER_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, gutter) | |
| 33 #define CONCHECK_GUTTER_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, gutter) | |
| 34 | |
| 35 #define DEFAULT_GUTTER_WIDTH 40 | |
| 36 #define DEFAULT_GUTTER_BORDER_WIDTH 2 | |
| 37 | |
| 38 extern Lisp_Object Qgutter; | |
| 39 | |
| 40 extern Lisp_Object Vgutter_size[4]; | |
| 41 extern Lisp_Object Vgutter_border_width[4]; | |
| 42 void update_frame_gutters (struct frame *f); | |
| 442 | 43 void update_frame_gutter_geometry (struct frame *f); |
| 44 void mark_gutters (struct frame* f); | |
| 428 | 45 void init_frame_gutters (struct frame *f); |
| 46 void init_device_gutters (struct device *d); | |
| 47 void init_global_gutters (struct device *d); | |
| 48 void free_frame_gutters (struct frame *f); | |
| 49 void redraw_exposed_gutters (struct frame *f, int x, int y, int width, | |
| 50 int height); | |
| 51 void reset_gutter_display_lines (struct frame* f); | |
| 442 | 52 void gutter_extent_signal_changed_region_maybe (Lisp_Object obj, |
| 665 | 53 Charbpos start, Charbpos end); |
| 446 | 54 int display_boxes_in_gutter_p (struct frame *f, struct display_box* db, |
| 55 struct display_glyph_area* dga); | |
| 428 | 56 |
| 57 #define WINDOW_GUTTER_BORDER_WIDTH(w, pos) \ | |
| 442 | 58 (INTP ((w)->gutter_border_width[pos]) ? XINT ((w)->gutter_border_width[pos]) : 0) |
| 428 | 59 #define WINDOW_GUTTER_SIZE(w, pos) \ |
| 442 | 60 (INTP ((w)->gutter_size[pos]) ? XINT ((w)->gutter_size[pos]) : 0) |
| 428 | 61 #define WINDOW_GUTTER_SIZE_INTERNAL(w, pos) \ |
| 442 | 62 (INTP ((w)->real_gutter_size[pos]) ? XINT ((w)->real_gutter_size[pos]) : 0) |
| 428 | 63 #define WINDOW_GUTTER_VISIBLE(w, pos) \ |
| 442 | 64 ((w)->gutter_visible_p[pos]) |
| 428 | 65 #define WINDOW_GUTTER(w, pos) \ |
| 442 | 66 ((w)->real_gutter[pos]) |
| 67 #define RAW_WINDOW_GUTTER(w, pos) \ | |
| 68 ((w)->gutter[pos]) | |
| 428 | 69 |
| 70 #define WINDOW_REAL_GUTTER_SIZE(w, pos) \ | |
| 71 (!NILP (WINDOW_GUTTER_VISIBLE (w, pos)) \ | |
| 72 ? WINDOW_GUTTER_SIZE_INTERNAL (w, pos) \ | |
| 73 : 0) | |
| 74 #define WINDOW_REAL_GUTTER_VISIBLE(f, pos) \ | |
| 75 (WINDOW_REAL_GUTTER_SIZE (f, pos) > 0) | |
| 76 #define WINDOW_REAL_GUTTER_BORDER_WIDTH(f, pos) \ | |
| 77 ((!NILP (WINDOW_GUTTER_VISIBLE (f, pos)) \ | |
| 78 && WINDOW_GUTTER_SIZE_INTERNAL (f,pos) > 0) \ | |
| 79 ? WINDOW_GUTTER_BORDER_WIDTH (f, pos) \ | |
| 80 : 0) | |
| 81 #define WINDOW_REAL_GUTTER_BOUNDS(f, pos) \ | |
| 82 (WINDOW_REAL_GUTTER_SIZE (f,pos) + \ | |
| 83 2 * WINDOW_REAL_GUTTER_BORDER_WIDTH (f,pos)) | |
| 84 | |
| 85 /* these macros predicate size on position and type of window */ | |
| 86 #define WINDOW_REAL_TOP_GUTTER_BOUNDS(w) \ | |
| 5090 | 87 WINDOW_REAL_GUTTER_BOUNDS (w, TOP_EDGE) |
| 428 | 88 #define WINDOW_REAL_BOTTOM_GUTTER_BOUNDS(w) \ |
| 5090 | 89 WINDOW_REAL_GUTTER_BOUNDS (w, BOTTOM_EDGE) |
| 428 | 90 #define WINDOW_REAL_LEFT_GUTTER_BOUNDS(w) \ |
| 5090 | 91 WINDOW_REAL_GUTTER_BOUNDS (w, LEFT_EDGE) |
| 428 | 92 #define WINDOW_REAL_RIGHT_GUTTER_BOUNDS(w) \ |
| 5090 | 93 WINDOW_REAL_GUTTER_BOUNDS (w, RIGHT_EDGE) |
| 428 | 94 |
| 95 #define FRAME_GUTTER_VISIBLE(f, pos) \ | |
| 96 WINDOW_REAL_GUTTER_VISIBLE (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) | |
| 97 #define FRAME_GUTTER_SIZE(f, pos) \ | |
| 98 WINDOW_REAL_GUTTER_SIZE (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) | |
| 99 #define FRAME_GUTTER_BOUNDS(f, pos) \ | |
| 100 WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) | |
| 101 #define FRAME_GUTTER_BORDER_WIDTH(f, pos) \ | |
| 102 WINDOW_REAL_GUTTER_BORDER_WIDTH (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) | |
| 103 | |
| 104 #define FRAME_GUTTER(f, pos) \ | |
| 105 WINDOW_GUTTER (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) | |
| 106 | |
| 107 /* these macros predicate size on position and type of window */ | |
| 5090 | 108 #define FRAME_TOP_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, TOP_EDGE) |
| 109 #define FRAME_BOTTOM_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, BOTTOM_EDGE) | |
| 110 #define FRAME_LEFT_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, LEFT_EDGE) | |
| 111 #define FRAME_RIGHT_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, RIGHT_EDGE) | |
| 428 | 112 |
| 440 | 113 #endif /* INCLUDED_gutter_h_ */ |
