Mercurial > hg > xemacs-beta
comparison man/internals/internals.texi @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 84b14dcb0985 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
5 @c %**end of header | 5 @c %**end of header |
6 | 6 |
7 @ifinfo | 7 @ifinfo |
8 @dircategory XEmacs Editor | 8 @dircategory XEmacs Editor |
9 @direntry | 9 @direntry |
10 * Internals: (internals). XEmacs Internals Manual. | 10 * Internals: (internals). XEmacs Internals Manual. |
11 @end direntry | 11 @end direntry |
12 | 12 |
13 Copyright @copyright{} 1992 - 1996 Ben Wing. | 13 Copyright @copyright{} 1992 - 1996 Ben Wing. |
14 Copyright @copyright{} 1996, 1997 Sun Microsystems. | 14 Copyright @copyright{} 1996, 1997 Sun Microsystems. |
15 Copyright @copyright{} 1994 - 1998 Free Software Foundation. | 15 Copyright @copyright{} 1994 - 1998 Free Software Foundation. |
698 windows, frames, events) that are useful for implementing an editor. | 698 windows, frames, events) that are useful for implementing an editor. |
699 Some of these objects (in particular windows and frames) have | 699 Some of these objects (in particular windows and frames) have |
700 displayable representations, and XEmacs provides a function | 700 displayable representations, and XEmacs provides a function |
701 @code{redisplay()} that ensures that the display of all such objects | 701 @code{redisplay()} that ensures that the display of all such objects |
702 matches their internal state. Most of the time, a standard Lisp | 702 matches their internal state. Most of the time, a standard Lisp |
703 environment is in a @dfn{read-eval-print} loop -- i.e. ``read some Lisp | 703 environment is in a @dfn{read-eval-print} loop---i.e. ``read some Lisp |
704 code, execute it, and print the results''. XEmacs has a similar loop: | 704 code, execute it, and print the results''. XEmacs has a similar loop: |
705 | 705 |
706 @itemize @bullet | 706 @itemize @bullet |
707 @item | 707 @item |
708 read an event | 708 read an event |
873 handler for some or all classes of errors. (If no handler is registered, | 873 handler for some or all classes of errors. (If no handler is registered, |
874 a default handler, generally installed by the top-level event loop, is | 874 a default handler, generally installed by the top-level event loop, is |
875 executed; this prints out the error and continues.) Routines can also | 875 executed; this prints out the error and continues.) Routines can also |
876 specify cleanup code (called an @dfn{unwind-protect}) that will be | 876 specify cleanup code (called an @dfn{unwind-protect}) that will be |
877 called when control exits from a block of code, no matter how that exit | 877 called when control exits from a block of code, no matter how that exit |
878 occurs -- i.e. even if a function deeply nested below it causes a | 878 occurs---i.e. even if a function deeply nested below it causes a |
879 non-local exit back to the top level. | 879 non-local exit back to the top level. |
880 | 880 |
881 Note that this facility has appeared in some recent vintages of C, in | 881 Note that this facility has appeared in some recent vintages of C, in |
882 particular Visual C++ and other PC compilers written for the Microsoft | 882 particular Visual C++ and other PC compilers written for the Microsoft |
883 Win32 API. | 883 Win32 API. |
887 that if you declare a local variable in a particular function, and then | 887 that if you declare a local variable in a particular function, and then |
888 call another function, that subfunction can ``see'' the local variable | 888 call another function, that subfunction can ``see'' the local variable |
889 you declared. This is actually considered a bug in Emacs Lisp and in | 889 you declared. This is actually considered a bug in Emacs Lisp and in |
890 all other early dialects of Lisp, and was corrected in Common Lisp. (In | 890 all other early dialects of Lisp, and was corrected in Common Lisp. (In |
891 Common Lisp, you can still declare dynamically scoped variables if you | 891 Common Lisp, you can still declare dynamically scoped variables if you |
892 want to -- they are sometimes useful -- but variables by default are | 892 want to---they are sometimes useful---but variables by default are |
893 @dfn{lexically scoped} as in C.) | 893 @dfn{lexically scoped} as in C.) |
894 @end enumerate | 894 @end enumerate |
895 | 895 |
896 For those familiar with Lisp, Emacs Lisp is modelled after MacLisp, an | 896 For those familiar with Lisp, Emacs Lisp is modelled after MacLisp, an |
897 early dialect of Lisp developed at MIT (no relation to the Macintosh | 897 early dialect of Lisp developed at MIT (no relation to the Macintosh |
1245 most other data structures in Lisp. | 1245 most other data structures in Lisp. |
1246 @item char | 1246 @item char |
1247 An object representing a single character of text; chars behave like | 1247 An object representing a single character of text; chars behave like |
1248 integers in many ways but are logically considered text rather than | 1248 integers in many ways but are logically considered text rather than |
1249 numbers and have a different read syntax. (the read syntax for a char | 1249 numbers and have a different read syntax. (the read syntax for a char |
1250 contains the char itself or some textual encoding of it -- for example, | 1250 contains the char itself or some textual encoding of it---for example, |
1251 a Japanese Kanji character might be encoded as @samp{^[$(B#&^[(B} using the | 1251 a Japanese Kanji character might be encoded as @samp{^[$(B#&^[(B} using the |
1252 ISO-2022 encoding standard -- rather than the numerical representation | 1252 ISO-2022 encoding standard---rather than the numerical representation |
1253 of the char; this way, if the mapping between chars and integers | 1253 of the char; this way, if the mapping between chars and integers |
1254 changes, which is quite possible for Kanji characters and other extended | 1254 changes, which is quite possible for Kanji characters and other extended |
1255 characters, the same character will still be created. Note that some | 1255 characters, the same character will still be created. Note that some |
1256 primitives confuse chars and integers. The worst culprit is @code{eq}, | 1256 primitives confuse chars and integers. The worst culprit is @code{eq}, |
1257 which makes a special exception and considers a char to be @code{eq} to | 1257 which makes a special exception and considers a char to be @code{eq} to |
1599 The tag describes the type of the Lisp object. For integers and chars, | 1599 The tag describes the type of the Lisp object. For integers and chars, |
1600 the lower 28 bits contain the value of the integer or char; for all | 1600 the lower 28 bits contain the value of the integer or char; for all |
1601 others, the lower 28 bits contain a pointer. The mark bit is used | 1601 others, the lower 28 bits contain a pointer. The mark bit is used |
1602 during garbage-collection, and is always 0 when garbage collection is | 1602 during garbage-collection, and is always 0 when garbage collection is |
1603 not happening. (The way that garbage collection works, basically, is that it | 1603 not happening. (The way that garbage collection works, basically, is that it |
1604 loops over all places where Lisp objects could exist -- this includes | 1604 loops over all places where Lisp objects could exist---this includes |
1605 all global variables in C that contain Lisp objects [including | 1605 all global variables in C that contain Lisp objects [including |
1606 @code{Vobarray}, the C equivalent of @code{obarray}; through this, all | 1606 @code{Vobarray}, the C equivalent of @code{obarray}; through this, all |
1607 Lisp variables will get marked], plus various other places -- and | 1607 Lisp variables will get marked], plus various other places---and |
1608 recursively scans through the Lisp objects, marking each object it finds | 1608 recursively scans through the Lisp objects, marking each object it finds |
1609 by setting the mark bit. Then it goes through the lists of all objects | 1609 by setting the mark bit. Then it goes through the lists of all objects |
1610 allocated, freeing the ones that are not marked and turning off the mark | 1610 allocated, freeing the ones that are not marked and turning off the mark |
1611 bit of the ones that are marked.) | 1611 bit of the ones that are marked.) |
1612 | 1612 |
1716 machines/compilers do this, and on the ones that don't, a more | 1716 machines/compilers do this, and on the ones that don't, a more |
1717 complicated definition is selected by defining | 1717 complicated definition is selected by defining |
1718 @code{EXPLICIT_SIGN_EXTEND}. | 1718 @code{EXPLICIT_SIGN_EXTEND}. |
1719 | 1719 |
1720 Note that when @code{ERROR_CHECK_TYPECHECK} is defined, the extractor | 1720 Note that when @code{ERROR_CHECK_TYPECHECK} is defined, the extractor |
1721 macros become more complicated -- they check the tag bits and/or the | 1721 macros become more complicated---they check the tag bits and/or the |
1722 type field in the first four bytes of a record type to ensure that the | 1722 type field in the first four bytes of a record type to ensure that the |
1723 object is really of the correct type. This is great for catching places | 1723 object is really of the correct type. This is great for catching places |
1724 where an incorrect type is being dereferenced -- this typically results | 1724 where an incorrect type is being dereferenced---this typically results |
1725 in a pointer being dereferenced as the wrong type of structure, with | 1725 in a pointer being dereferenced as the wrong type of structure, with |
1726 unpredictable (and sometimes not easily traceable) results. | 1726 unpredictable (and sometimes not easily traceable) results. |
1727 | 1727 |
1728 There are similar @code{XSET@var{TYPE}()} macros that construct a Lisp | 1728 There are similar @code{XSET@var{TYPE}()} macros that construct a Lisp |
1729 object. These macros are of the form @code{XSET@var{TYPE} | 1729 object. These macros are of the form @code{XSET@var{TYPE} |
1796 the same directory as the C sources) and @file{lisp.h}. @file{config.h} | 1796 the same directory as the C sources) and @file{lisp.h}. @file{config.h} |
1797 must always be included before any other header files (including | 1797 must always be included before any other header files (including |
1798 system header files) to ensure that certain tricks played by various | 1798 system header files) to ensure that certain tricks played by various |
1799 @file{s/} and @file{m/} files work out correctly. | 1799 @file{s/} and @file{m/} files work out correctly. |
1800 | 1800 |
1801 When including header files, always use angle brackets, not double | |
1802 quotes, except when the file to be included is in the same directory as | |
1803 the including file. If either file is a generated file, then that is | |
1804 not likely to be the case. In order to understand why we have this | |
1805 rule, imagine what happens when you do a build in the source directory | |
1806 using @samp{./configure} and another build in another directory using | |
1807 @samp{../work/configure}. There will be two different @file{config.h} | |
1808 files. Which one will be used if you @samp{#include "config.h"}? | |
1809 | |
1801 @strong{All global and static variables that are to be modifiable must | 1810 @strong{All global and static variables that are to be modifiable must |
1802 be declared uninitialized.} This means that you may not use the | 1811 be declared uninitialized.} This means that you may not use the |
1803 ``declare with initializer'' form for these variables, such as @code{int | 1812 ``declare with initializer'' form for these variables, such as @code{int |
1804 some_variable = 0;}. The reason for this has to do with some kludges | 1813 some_variable = 0;}. The reason for this has to do with some kludges |
1805 done during the dumping process: If possible, the initialized data | 1814 done during the dumping process: If possible, the initialized data |
1806 segment is re-mapped so that it becomes part of the (unmodifiable) code | 1815 segment is re-mapped so that it becomes part of the (unmodifiable) code |
1807 segment in the dumped executable. This allows this memory to be shared | 1816 segment in the dumped executable. This allows this memory to be shared |
1808 among multiple running XEmacs processes. XEmacs is careful to place as | 1817 among multiple running XEmacs processes. XEmacs is careful to place as |
1809 much constant data as possible into initialized variables (in | 1818 much constant data as possible into initialized variables (in |
1810 particular, into what's called the @dfn{pure space} -- see below) during | 1819 particular, into what's called the @dfn{pure space}---see below) during |
1811 the @file{temacs} phase. | 1820 the @file{temacs} phase. |
1812 | 1821 |
1813 @cindex copy-on-write | 1822 @cindex copy-on-write |
1814 @strong{Please note:} This kludge only works on a few systems nowadays, | 1823 @strong{Please note:} This kludge only works on a few systems nowadays, |
1815 and is rapidly becoming irrelevant because most modern operating systems | 1824 and is rapidly becoming irrelevant because most modern operating systems |
1840 | 1849 |
1841 The C source code makes heavy use of C preprocessor macros. One popular | 1850 The C source code makes heavy use of C preprocessor macros. One popular |
1842 macro style is: | 1851 macro style is: |
1843 | 1852 |
1844 @example | 1853 @example |
1845 #define FOO(var, value) do @{ \ | 1854 #define FOO(var, value) do @{ \ |
1846 Lisp_Object FOO_value = (value); \ | 1855 Lisp_Object FOO_value = (value); \ |
1847 ... /* compute using FOO_value */ \ | 1856 ... /* compute using FOO_value */ \ |
1848 (var) = bar; \ | 1857 (var) = bar; \ |
1849 @} while (0) | 1858 @} while (0) |
1850 @end example | 1859 @end example |
1851 | 1860 |
1852 The @code{do @{...@} while (0)} is a standard trick to allow FOO to have | 1861 The @code{do @{...@} while (0)} is a standard trick to allow FOO to have |
1853 statement semantics, so that it can safely be used within an @code{if} | 1862 statement semantics, so that it can safely be used within an @code{if} |
2981 declarations (i.e. a simple declaration like @code{struct foo;} where | 2990 declarations (i.e. a simple declaration like @code{struct foo;} where |
2982 the structure itself is defined elsewhere) should be placed into the | 2991 the structure itself is defined elsewhere) should be placed into the |
2983 typedefs section as necessary. | 2992 typedefs section as necessary. |
2984 | 2993 |
2985 @file{lrecord.h} contains the basic structures and macros that implement | 2994 @file{lrecord.h} contains the basic structures and macros that implement |
2986 all record-type Lisp objects -- i.e. all objects whose type is a field | 2995 all record-type Lisp objects---i.e. all objects whose type is a field |
2987 in their C structure, which includes all objects except the few most | 2996 in their C structure, which includes all objects except the few most |
2988 basic ones. | 2997 basic ones. |
2989 | 2998 |
2990 @file{lisp.h} contains prototypes for most of the exported functions in | 2999 @file{lisp.h} contains prototypes for most of the exported functions in |
2991 the various modules. Lisp primitives defined using @code{DEFUN} that | 3000 the various modules. Lisp primitives defined using @code{DEFUN} that |
3017 not dependent on any particular object type, and interfaces to | 3026 not dependent on any particular object type, and interfaces to |
3018 particular types of objects using a standardized interface of | 3027 particular types of objects using a standardized interface of |
3019 type-specific methods. This scheme is a fundamental principle of | 3028 type-specific methods. This scheme is a fundamental principle of |
3020 object-oriented programming and is heavily used throughout XEmacs. The | 3029 object-oriented programming and is heavily used throughout XEmacs. The |
3021 great advantage of this is that it allows for a clean separation of | 3030 great advantage of this is that it allows for a clean separation of |
3022 functionality into different modules -- new classes of Lisp objects, new | 3031 functionality into different modules---new classes of Lisp objects, new |
3023 event interfaces, new device types, new stream interfaces, etc. can be | 3032 event interfaces, new device types, new stream interfaces, etc. can be |
3024 added transparently without affecting code anywhere else in XEmacs. | 3033 added transparently without affecting code anywhere else in XEmacs. |
3025 Because the different subsystems are divided into general and specific | 3034 Because the different subsystems are divided into general and specific |
3026 code, adding a new subtype within a subsystem will in general not | 3035 code, adding a new subtype within a subsystem will in general not |
3027 require changes to the generic subsystem code or affect any of the other | 3036 require changes to the generic subsystem code or affect any of the other |
3108 @end example | 3117 @end example |
3109 | 3118 |
3110 @file{symbols.c} implements the handling of symbols, obarrays, and | 3119 @file{symbols.c} implements the handling of symbols, obarrays, and |
3111 retrieving the values of symbols. Much of the code is devoted to | 3120 retrieving the values of symbols. Much of the code is devoted to |
3112 handling the special @dfn{symbol-value-magic} objects that define | 3121 handling the special @dfn{symbol-value-magic} objects that define |
3113 special types of variables -- this includes buffer-local variables, | 3122 special types of variables---this includes buffer-local variables, |
3114 variable aliases, variables that forward into C variables, etc. This | 3123 variable aliases, variables that forward into C variables, etc. This |
3115 module is initialized extremely early (right after @file{alloc.c}), | 3124 module is initialized extremely early (right after @file{alloc.c}), |
3116 because it is here that the basic symbols @code{t} and @code{nil} are | 3125 because it is here that the basic symbols @code{t} and @code{nil} are |
3117 created, and those symbols are used everywhere throughout XEmacs. | 3126 created, and those symbols are used everywhere throughout XEmacs. |
3118 | 3127 |
3387 @example | 3396 @example |
3388 keyboard.c | 3397 keyboard.c |
3389 @end example | 3398 @end example |
3390 | 3399 |
3391 @file{keyboard.c} contains functions that implement the actual editor | 3400 @file{keyboard.c} contains functions that implement the actual editor |
3392 command loop -- i.e. the event loop that cyclically retrieves and | 3401 command loop---i.e. the event loop that cyclically retrieves and |
3393 dispatches events. This code is also rather tricky, just like | 3402 dispatches events. This code is also rather tricky, just like |
3394 @file{event-stream.c}. | 3403 @file{event-stream.c}. |
3395 | 3404 |
3396 | 3405 |
3397 | 3406 |
3555 | 3564 |
3556 @example | 3565 @example |
3557 font-lock.c | 3566 font-lock.c |
3558 @end example | 3567 @end example |
3559 | 3568 |
3560 This file provides C support for syntax highlighting -- i.e. | 3569 This file provides C support for syntax highlighting---i.e. |
3561 highlighting different syntactic constructs of a source file in | 3570 highlighting different syntactic constructs of a source file in |
3562 different colors, for easy reading. The C support is provided so that | 3571 different colors, for easy reading. The C support is provided so that |
3563 this is fast. | 3572 this is fast. |
3564 | 3573 |
3565 | 3574 |
3860 @cindex mark method | 3869 @cindex mark method |
3861 Opaque objects can also have an arbitrary @dfn{mark method} associated | 3870 Opaque objects can also have an arbitrary @dfn{mark method} associated |
3862 with them, in case the block of memory contains other Lisp objects that | 3871 with them, in case the block of memory contains other Lisp objects that |
3863 need to be marked for garbage-collection purposes. (If you need other | 3872 need to be marked for garbage-collection purposes. (If you need other |
3864 object methods, such as a finalize method, you should just go ahead and | 3873 object methods, such as a finalize method, you should just go ahead and |
3865 create a new Lisp object type -- it's not hard.) | 3874 create a new Lisp object type---it's not hard.) |
3866 | 3875 |
3867 | 3876 |
3868 | 3877 |
3869 @example | 3878 @example |
3870 abbrev.c | 3879 abbrev.c |
4437 format; this includes conses, strings, vectors, and sometimes symbols. | 4446 format; this includes conses, strings, vectors, and sometimes symbols. |
4438 With the exception of vectors, objects in this category are allocated in | 4447 With the exception of vectors, objects in this category are allocated in |
4439 @dfn{frob blocks}, i.e. large blocks of memory that are subdivided into | 4448 @dfn{frob blocks}, i.e. large blocks of memory that are subdivided into |
4440 individual objects. This saves a lot on malloc overhead, since there | 4449 individual objects. This saves a lot on malloc overhead, since there |
4441 are typically quite a lot of these objects around, and the objects are | 4450 are typically quite a lot of these objects around, and the objects are |
4442 small. (A cons, for example, occupies 8 bytes on 32-bit machines -- 4 | 4451 small. (A cons, for example, occupies 8 bytes on 32-bit machines---4 |
4443 bytes for each of the two objects it contains.) Vectors are individually | 4452 bytes for each of the two objects it contains.) Vectors are individually |
4444 @code{malloc()}ed since they are of variable size. (It would be | 4453 @code{malloc()}ed since they are of variable size. (It would be |
4445 possible, and desirable, to allocate vectors of certain small sizes out | 4454 possible, and desirable, to allocate vectors of certain small sizes out |
4446 of frob blocks, but it isn't currently done.) Strings are handled | 4455 of frob blocks, but it isn't currently done.) Strings are handled |
4447 specially: Each string is allocated in two parts, a fixed size structure | 4456 specially: Each string is allocated in two parts, a fixed size structure |
4627 variable @samp{gcprolist} pointing to the head of the list and the nth | 4636 variable @samp{gcprolist} pointing to the head of the list and the nth |
4628 local @code{gcpro} variable pointing to the first @code{gcpro} variable | 4637 local @code{gcpro} variable pointing to the first @code{gcpro} variable |
4629 in the next enclosing stack frame. Each @code{GCPRO}ed thing is an | 4638 in the next enclosing stack frame. Each @code{GCPRO}ed thing is an |
4630 lvalue, and the @code{struct gcpro} local variable contains a pointer to | 4639 lvalue, and the @code{struct gcpro} local variable contains a pointer to |
4631 this lvalue. This is why things will mess up badly if you don't pair up | 4640 this lvalue. This is why things will mess up badly if you don't pair up |
4632 the @code{GCPRO}s and @code{UNGCPRO}s -- you will end up with | 4641 the @code{GCPRO}s and @code{UNGCPRO}s---you will end up with |
4633 @code{gcprolist}s containing pointers to @code{struct gcpro}s or local | 4642 @code{gcprolist}s containing pointers to @code{struct gcpro}s or local |
4634 @code{Lisp_Object} variables in no-longer-active stack frames. | 4643 @code{Lisp_Object} variables in no-longer-active stack frames. |
4635 | 4644 |
4636 @item | 4645 @item |
4637 It is actually possible for a single @code{struct gcpro} to | 4646 It is actually possible for a single @code{struct gcpro} to |
5665 Note that there is one situation not handled: a string that is too big | 5674 Note that there is one situation not handled: a string that is too big |
5666 to fit into a string-chars block. Such strings, called @dfn{big | 5675 to fit into a string-chars block. Such strings, called @dfn{big |
5667 strings}, are all @code{malloc()}ed as their own block. (#### Although it | 5676 strings}, are all @code{malloc()}ed as their own block. (#### Although it |
5668 would make more sense for the threshold for big strings to be somewhat | 5677 would make more sense for the threshold for big strings to be somewhat |
5669 lower, e.g. 1/2 or 1/4 the size of a string-chars block. It seems that | 5678 lower, e.g. 1/2 or 1/4 the size of a string-chars block. It seems that |
5670 this was indeed the case formerly -- indeed, the threshold was set at | 5679 this was indeed the case formerly---indeed, the threshold was set at |
5671 1/8 -- but Mly forgot about this when rewriting things for 19.8.) | 5680 1/8---but Mly forgot about this when rewriting things for 19.8.) |
5672 | 5681 |
5673 Note also that the string data in string-chars blocks is padded as | 5682 Note also that the string data in string-chars blocks is padded as |
5674 necessary so that proper alignment constraints on the @code{struct | 5683 necessary so that proper alignment constraints on the @code{struct |
5675 Lisp_String} back pointers are maintained. | 5684 Lisp_String} back pointers are maintained. |
5676 | 5685 |
5745 XEmacs has its own types of events (called @dfn{Emacs events}), | 5754 XEmacs has its own types of events (called @dfn{Emacs events}), |
5746 which provides an abstract layer on top of the system-dependent | 5755 which provides an abstract layer on top of the system-dependent |
5747 nature of the most basic events that are received. Part of the | 5756 nature of the most basic events that are received. Part of the |
5748 complex nature of the XEmacs event collection process involves | 5757 complex nature of the XEmacs event collection process involves |
5749 converting from the operating-system events into the proper | 5758 converting from the operating-system events into the proper |
5750 Emacs events -- there may not be a one-to-one correspondence. | 5759 Emacs events---there may not be a one-to-one correspondence. |
5751 | 5760 |
5752 Emacs events are documented in @file{events.h}; I'll discuss them | 5761 Emacs events are documented in @file{events.h}; I'll discuss them |
5753 later. | 5762 later. |
5754 | 5763 |
5755 @node Main Loop | 5764 @node Main Loop |
5770 one console), and the engine that looks up keystrokes and | 5779 one console), and the engine that looks up keystrokes and |
5771 constructs full key sequences is called the @dfn{command builder}. | 5780 constructs full key sequences is called the @dfn{command builder}. |
5772 This is documented elsewhere. | 5781 This is documented elsewhere. |
5773 | 5782 |
5774 The guts of the command loop are in @code{command_loop_1()}. This | 5783 The guts of the command loop are in @code{command_loop_1()}. This |
5775 function doesn't catch errors, though -- that's the job of | 5784 function doesn't catch errors, though---that's the job of |
5776 @code{command_loop_2()}, which is a condition-case (i.e. error-trapping) | 5785 @code{command_loop_2()}, which is a condition-case (i.e. error-trapping) |
5777 wrapper around @code{command_loop_1()}. @code{command_loop_1()} never | 5786 wrapper around @code{command_loop_1()}. @code{command_loop_1()} never |
5778 returns, but may get thrown out of. | 5787 returns, but may get thrown out of. |
5779 | 5788 |
5780 When an error occurs, @code{cmd_error()} is called, which usually | 5789 When an error occurs, @code{cmd_error()} is called, which usually |
7490 @end deftypefn | 7499 @end deftypefn |
7491 | 7500 |
7492 @deftypefn Macro void Lstream_ungetc (Lstream *@var{stream}, int @var{c}) | 7501 @deftypefn Macro void Lstream_ungetc (Lstream *@var{stream}, int @var{c}) |
7493 Push one byte back onto the input queue. This will be the next byte | 7502 Push one byte back onto the input queue. This will be the next byte |
7494 read from the stream. Any number of bytes can be pushed back and will | 7503 read from the stream. Any number of bytes can be pushed back and will |
7495 be read in the reverse order they were pushed back -- most recent | 7504 be read in the reverse order they were pushed back---most recent |
7496 first. (This is necessary for consistency -- if there are a number of | 7505 first. (This is necessary for consistency---if there are a number of |
7497 bytes that have been unread and I read and unread a byte, it needs to be | 7506 bytes that have been unread and I read and unread a byte, it needs to be |
7498 the first to be read again.) This is a macro and so it is very | 7507 the first to be read again.) This is a macro and so it is very |
7499 efficient. The @var{c} argument is only evaluated once but the @var{stream} | 7508 efficient. The @var{c} argument is only evaluated once but the @var{stream} |
7500 argument is evaluated more than once. | 7509 argument is evaluated more than once. |
7501 @end deftypefn | 7510 @end deftypefn |
7529 @end deftypefun | 7538 @end deftypefun |
7530 | 7539 |
7531 @deftypefun void Lstream_reopen (Lstream *@var{stream}) | 7540 @deftypefun void Lstream_reopen (Lstream *@var{stream}) |
7532 Reopen a closed stream. This enables I/O on it again. This is not | 7541 Reopen a closed stream. This enables I/O on it again. This is not |
7533 meant to be called except from a wrapper routine that reinitializes | 7542 meant to be called except from a wrapper routine that reinitializes |
7534 variables and such -- the close routine may well have freed some | 7543 variables and such---the close routine may well have freed some |
7535 necessary storage structures, for example. | 7544 necessary storage structures, for example. |
7536 @end deftypefun | 7545 @end deftypefun |
7537 | 7546 |
7538 @deftypefun void Lstream_rewind (Lstream *@var{stream}) | 7547 @deftypefun void Lstream_rewind (Lstream *@var{stream}) |
7539 Rewind the stream to the beginning. | 7548 Rewind the stream to the beginning. |
7575 @deftypefn {Lstream Method} int rewinder (Lstream *@var{stream}) | 7584 @deftypefn {Lstream Method} int rewinder (Lstream *@var{stream}) |
7576 Rewind the stream. If this is @code{NULL}, the stream is not seekable. | 7585 Rewind the stream. If this is @code{NULL}, the stream is not seekable. |
7577 @end deftypefn | 7586 @end deftypefn |
7578 | 7587 |
7579 @deftypefn {Lstream Method} int seekable_p (Lstream *@var{stream}) | 7588 @deftypefn {Lstream Method} int seekable_p (Lstream *@var{stream}) |
7580 Indicate whether this stream is seekable -- i.e. it can be rewound. | 7589 Indicate whether this stream is seekable---i.e. it can be rewound. |
7581 This method is ignored if the stream does not have a rewind method. If | 7590 This method is ignored if the stream does not have a rewind method. If |
7582 this method is not present, the result is determined by whether a rewind | 7591 this method is not present, the result is determined by whether a rewind |
7583 method is present. | 7592 method is present. |
7584 @end deftypefn | 7593 @end deftypefn |
7585 | 7594 |
7744 @dfn{one above the other}. | 7753 @dfn{one above the other}. |
7745 | 7754 |
7746 @item | 7755 @item |
7747 Leaf windows also have markers in their @code{start} (the | 7756 Leaf windows also have markers in their @code{start} (the |
7748 first buffer position displayed in the window) and @code{pointm} | 7757 first buffer position displayed in the window) and @code{pointm} |
7749 (the window's stashed value of @code{point} -- see above) fields, | 7758 (the window's stashed value of @code{point}---see above) fields, |
7750 while combination windows have nil in these fields. | 7759 while combination windows have nil in these fields. |
7751 | 7760 |
7752 @item | 7761 @item |
7753 The list of children for a window is threaded through the | 7762 The list of children for a window is threaded through the |
7754 @code{next} and @code{prev} fields of each child window. | 7763 @code{next} and @code{prev} fields of each child window. |
7760 does nothing except set a special @code{dead} bit to 1 and clear out the | 7769 does nothing except set a special @code{dead} bit to 1 and clear out the |
7761 @code{next}, @code{prev}, @code{hchild}, and @code{vchild} fields, for | 7770 @code{next}, @code{prev}, @code{hchild}, and @code{vchild} fields, for |
7762 GC purposes. | 7771 GC purposes. |
7763 | 7772 |
7764 @item | 7773 @item |
7765 Most frames actually have two top-level windows -- one for the | 7774 Most frames actually have two top-level windows---one for the |
7766 minibuffer and one (the @dfn{root}) for everything else. The modeline | 7775 minibuffer and one (the @dfn{root}) for everything else. The modeline |
7767 (if present) separates these two. The @code{next} field of the root | 7776 (if present) separates these two. The @code{next} field of the root |
7768 points to the minibuffer, and the @code{prev} field of the minibuffer | 7777 points to the minibuffer, and the @code{prev} field of the minibuffer |
7769 points to the root. The other @code{next} and @code{prev} fields are | 7778 points to the root. The other @code{next} and @code{prev} fields are |
7770 @code{nil}, and the frame points to both of these windows. | 7779 @code{nil}, and the frame points to both of these windows. |
7981 information basically for free. In those cases where a user is simply | 7990 information basically for free. In those cases where a user is simply |
7982 scrolling around viewing a buffer there is a high probability that this | 7991 scrolling around viewing a buffer there is a high probability that this |
7983 is sufficient to always provide the needed information. The second | 7992 is sufficient to always provide the needed information. The second |
7984 thing we can do is be smart about invalidating the cache. | 7993 thing we can do is be smart about invalidating the cache. |
7985 | 7994 |
7986 TODO -- Be smart about invalidating the cache. Potential places: | 7995 TODO---Be smart about invalidating the cache. Potential places: |
7987 | 7996 |
7988 @itemize @bullet | 7997 @itemize @bullet |
7989 @item | 7998 @item |
7990 Insertions at end-of-line which don't cause line-wraps do not alter the | 7999 Insertions at end-of-line which don't cause line-wraps do not alter the |
7991 starting positions of any display lines. These types of buffer | 8000 starting positions of any display lines. These types of buffer |
8123 @section Format of the Extent Info | 8132 @section Format of the Extent Info |
8124 | 8133 |
8125 An extent-info structure consists of a list of the buffer or string's | 8134 An extent-info structure consists of a list of the buffer or string's |
8126 extents and a @dfn{stack of extents} that lists all of the extents over | 8135 extents and a @dfn{stack of extents} that lists all of the extents over |
8127 a particular position. The stack-of-extents info is used for | 8136 a particular position. The stack-of-extents info is used for |
8128 optimization purposes -- it basically caches some info that might | 8137 optimization purposes---it basically caches some info that might |
8129 be expensive to compute. Certain otherwise hard computations are easy | 8138 be expensive to compute. Certain otherwise hard computations are easy |
8130 given the stack of extents over a particular position, and if the | 8139 given the stack of extents over a particular position, and if the |
8131 stack of extents over a nearby position is known (because it was | 8140 stack of extents over a nearby position is known (because it was |
8132 calculated at some prior point in time), it's easy to move the stack | 8141 calculated at some prior point in time), it's easy to move the stack |
8133 of extents to the proper position. | 8142 of extents to the proper position. |
8325 @dfn{runs} of text such that no extent starts or ends within a run | 8334 @dfn{runs} of text such that no extent starts or ends within a run |
8326 (extents that abut the run don't count). | 8335 (extents that abut the run don't count). |
8327 | 8336 |
8328 An extent fragment is a structure that holds data about the run that | 8337 An extent fragment is a structure that holds data about the run that |
8329 contains a particular buffer position (if the buffer position is at the | 8338 contains a particular buffer position (if the buffer position is at the |
8330 junction of two runs, the run after the position is used) -- the | 8339 junction of two runs, the run after the position is used)---the |
8331 beginning and end of the run, a list of all of the extents in that run, | 8340 beginning and end of the run, a list of all of the extents in that run, |
8332 the @dfn{merged face} that results from merging all of the faces | 8341 the @dfn{merged face} that results from merging all of the faces |
8333 corresponding to those extents, the begin and end glyphs at the | 8342 corresponding to those extents, the begin and end glyphs at the |
8334 beginning of the run, etc. This is the information that redisplay needs | 8343 beginning of the run, etc. This is the information that redisplay needs |
8335 in order to display this run. | 8344 in order to display this run. |
8375 cached on a window basis. | 8384 cached on a window basis. |
8376 | 8385 |
8377 Any action on a glyph first consults the cache before actually | 8386 Any action on a glyph first consults the cache before actually |
8378 instantiating a widget. | 8387 instantiating a widget. |
8379 | 8388 |
8380 @section Widget-Glyphs in the MS-WIndows Environment | 8389 @section Widget-Glyphs in the MS-Windows Environment |
8381 | 8390 |
8382 To Do | 8391 To Do |
8383 | 8392 |
8384 @section Widget-Glyphs in the X Environment | 8393 @section Widget-Glyphs in the X Environment |
8385 | 8394 |