Mercurial > hg > xemacs-beta
comparison man/internals/internals.texi @ 2028:2ba4f06a264d
[xemacs-hg @ 2004-04-19 08:02:27 by stephent]
texi doc improvements <87zn98wg4q.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 19 Apr 2004 08:02:38 +0000 |
parents | c66036f59678 |
children | 97a3d9ad40e2 |
comparison
equal
deleted
inserted
replaced
2027:71477bc21fe8 | 2028:2ba4f06a264d |
---|---|
1485 | 1485 |
1486 The basic Lisp objects are | 1486 The basic Lisp objects are |
1487 | 1487 |
1488 @table @code | 1488 @table @code |
1489 @item integer | 1489 @item integer |
1490 28 or 31 bits of precision, or 60 or 63 bits on 64-bit machines; the | 1490 31 bits of precision, or 63 bits on 64-bit machines; the |
1491 reason for this is described below when the internal Lisp object | 1491 reason for this is described below when the internal Lisp object |
1492 representation is described. | 1492 representation is described. |
1493 @item float | |
1494 Same precision as a double in C. | |
1495 @item cons | |
1496 A simple container for two Lisp objects, used to implement lists and | |
1497 most other data structures in Lisp. | |
1498 @item char | 1493 @item char |
1499 An object representing a single character of text; chars behave like | 1494 An object representing a single character of text; chars behave like |
1500 integers in many ways but are logically considered text rather than | 1495 integers in many ways but are logically considered text rather than |
1501 numbers and have a different read syntax. (the read syntax for a char | 1496 numbers and have a different read syntax. (the read syntax for a char |
1502 contains the char itself or some textual encoding of it---for example, | 1497 contains the char itself or some textual encoding of it---for example, |
1509 which makes a special exception and considers a char to be @code{eq} to | 1504 which makes a special exception and considers a char to be @code{eq} to |
1510 its integer equivalent, even though in no other case are objects of two | 1505 its integer equivalent, even though in no other case are objects of two |
1511 different types @code{eq}. The reason for this monstrosity is | 1506 different types @code{eq}. The reason for this monstrosity is |
1512 compatibility with existing code; the separation of char from integer | 1507 compatibility with existing code; the separation of char from integer |
1513 came fairly recently.) | 1508 came fairly recently.) |
1509 @item float | |
1510 Same precision as a double in C. | |
1511 @item bignum | |
1512 @itemx ratio | |
1513 @itemx bigfloat | |
1514 As build-time options, arbitrary-precision numbers are available. | |
1515 Bignums are integers, and when available they remove the restriction on | |
1516 buffer size. Ratios are non-integral rational numbers. Bigfloats are | |
1517 arbitrary-precision floating point numbers, with precision specified at | |
1518 runtime. | |
1514 @item symbol | 1519 @item symbol |
1515 An object that contains Lisp objects and is referred to by name; | 1520 An object that contains Lisp objects and is referred to by name; |
1516 symbols are used to implement variables and named functions | 1521 symbols are used to implement variables and named functions |
1517 and to provide the equivalent of preprocessor constants in C. | 1522 and to provide the equivalent of preprocessor constants in C. |
1518 @item vector | |
1519 A one-dimensional array of Lisp objects providing constant-time access | |
1520 to any of the objects; access to an arbitrary object in a vector is | |
1521 faster than for lists, but the operations that can be done on a vector | |
1522 are more limited. | |
1523 @item string | 1523 @item string |
1524 Self-explanatory; behaves much like a vector of chars | 1524 Self-explanatory; behaves much like a vector of chars |
1525 but has a different read syntax and is stored and manipulated | 1525 but has a different read syntax and is stored and manipulated |
1526 more compactly. | 1526 more compactly. |
1527 @item bit-vector | 1527 @item bit-vector |
1528 A vector of bits; similar to a string in spirit. | 1528 A vector of bits; similar to a string in spirit. |
1529 @item vector | |
1530 A one-dimensional array of Lisp objects providing constant-time access | |
1531 to any of the objects; access to an arbitrary object in a vector is | |
1532 faster than for lists, but the operations that can be done on a vector | |
1533 are more limited. | |
1529 @item compiled-function | 1534 @item compiled-function |
1530 An object containing compiled Lisp code, known as @dfn{byte code}. | 1535 An object containing compiled Lisp code, known as @dfn{byte code}. |
1531 @item subr | 1536 @item subr |
1532 A Lisp primitive, i.e. a Lisp-callable function implemented in C. | 1537 A Lisp primitive, i.e. a Lisp-callable function implemented in C. |
1538 @item cons | |
1539 A simple container for two Lisp objects, used to implement lists and | |
1540 most other data structures in Lisp. | |
1533 @end table | 1541 @end table |
1542 | |
1543 Objects which are not conses are called atoms. | |
1534 | 1544 |
1535 @cindex closure | 1545 @cindex closure |
1536 Note that there is no basic ``function'' type, as in more powerful | 1546 Note that there is no basic ``function'' type, as in more powerful |
1537 versions of Lisp (where it's called a @dfn{closure}). XEmacs Lisp does | 1547 versions of Lisp (where it's called a @dfn{closure}). XEmacs Lisp does |
1538 not provide the closure semantics implemented by Common Lisp and Scheme. | 1548 not provide the closure semantics implemented by Common Lisp and Scheme. |
1693 coding systems, cannot be deleted. Note also that windows are unique in | 1703 coding systems, cannot be deleted. Note also that windows are unique in |
1694 that they can be @emph{undeleted} after having previously been | 1704 that they can be @emph{undeleted} after having previously been |
1695 deleted. (This happens as a result of restoring a window configuration.) | 1705 deleted. (This happens as a result of restoring a window configuration.) |
1696 | 1706 |
1697 @cindex read syntax | 1707 @cindex read syntax |
1698 Note that many types of objects have a @dfn{read syntax}, i.e. a way of | 1708 Many types of objects have a @dfn{read syntax}, i.e. a way of |
1699 specifying an object of that type in Lisp code. When you load a Lisp | 1709 specifying an object of that type in Lisp code. When you load a Lisp |
1700 file, or type in code to be evaluated, what really happens is that the | 1710 file, or type in code to be evaluated, what really happens is that the |
1701 function @code{read} is called, which reads some text and creates an object | 1711 function @code{read} is called, which reads some text and creates an object |
1702 based on the syntax of that text; then @code{eval} is called, which | 1712 based on the syntax of that text; then @code{eval} is called, which |
1703 possibly does something special; then this loop repeats until there's | 1713 possibly does something special; then this loop repeats until there's |
1712 @example | 1722 @example |
1713 17297 | 1723 17297 |
1714 @end example | 1724 @end example |
1715 | 1725 |
1716 converts to an integer whose value is 17297. | 1726 converts to an integer whose value is 17297. |
1727 | |
1728 @example | |
1729 355/113 | |
1730 @end example | |
1731 | |
1732 converts to a ratio commonly used to approximate @emph{pi} when ratios | |
1733 are configured, and otherwise to a symbol whose name is ``355/113'' (for | |
1734 backward compatibility). | |
1717 | 1735 |
1718 @example | 1736 @example |
1719 1.983e-4 | 1737 1.983e-4 |
1720 @end example | 1738 @end example |
1721 | 1739 |
2259 situations, often in code far away from where the actual breakage is. | 2277 situations, often in code far away from where the actual breakage is. |
2260 | 2278 |
2261 @menu | 2279 @menu |
2262 * A Reader's Guide to XEmacs Coding Conventions:: | 2280 * A Reader's Guide to XEmacs Coding Conventions:: |
2263 * General Coding Rules:: | 2281 * General Coding Rules:: |
2282 * Object-Oriented Techniques for C:: | |
2264 * Writing Lisp Primitives:: | 2283 * Writing Lisp Primitives:: |
2265 * Writing Good Comments:: | 2284 * Writing Good Comments:: |
2266 * Adding Global Lisp Variables:: | 2285 * Adding Global Lisp Variables:: |
2267 * Proper Use of Unsigned Types:: | 2286 * Proper Use of Unsigned Types:: |
2268 * Coding for Mule:: | 2287 * Coding for Mule:: |
2478 @code{GET_LIST_LENGTH}, which calculate the length of a list, and in the | 2497 @code{GET_LIST_LENGTH}, which calculate the length of a list, and in the |
2479 case of @code{GET_EXTERNAL_LIST_LENGTH}, validating the properness of | 2498 case of @code{GET_EXTERNAL_LIST_LENGTH}, validating the properness of |
2480 the list. The macros @code{EXTERNAL_LIST_LOOP_DELETE_IF} and | 2499 the list. The macros @code{EXTERNAL_LIST_LOOP_DELETE_IF} and |
2481 @code{LIST_LOOP_DELETE_IF} delete elements from a lisp list satisfying some | 2500 @code{LIST_LOOP_DELETE_IF} delete elements from a lisp list satisfying some |
2482 predicate. | 2501 predicate. |
2502 | |
2503 @node Object-Oriented Techniques for C | |
2504 @section Object-Oriented Techniques for C | |
2505 @cindex coding rules, object-oriented | |
2506 @cindex object-oriented techniques | |
2507 | |
2508 At the lowest levels, XEmacs makes heavy use of object-oriented | |
2509 techniques to promote code-sharing and uniform interfaces for different | |
2510 devices and platforms. Commonly, but not always, such objects are | |
2511 ``wrapped'' and exported to Lisp as Lisp objects. Usually they use | |
2512 the internal structures developed for Lisp objects (the @samp{lrecord} | |
2513 structure) in order to take advantage of Lisp memory management. | |
2514 Unfortunately, XEmacs was originally written in C, so these techniques | |
2515 are based on heavy use of C macros. Since XEmacs has been rewritten in | |
2516 ``Clean C,'' @emph{i.e.}, it compiles under both C and C++, it should be | |
2517 possible to migrate to C++. It is hoped this documentation will help | |
2518 encourage this process. | |
2519 | |
2520 @c You can't use @var{} for type below, because case is important. | |
2521 A module defining a class is likely to use most of the following | |
2522 declarations and macros. In the following, the notation @samp{<type>} | |
2523 will stand for the full name of the class, and will be capitalized in | |
2524 the way normal for its context. The notation @samp{<typ>} will stand | |
2525 for the abbreviated form commonly used in macro names, while @samp{ty} | |
2526 will be used as the typical name for instances of the class. (See the | |
2527 entry for @samp{MAYBE_<TY>METH} below for an example using all three | |
2528 notations.) | |
2529 | |
2530 In the interface (@file{.h} file), the following declarations are used | |
2531 often. Others may be used in for particular modules. Since they're | |
2532 quite short in most cases, the definitions are given as well. The | |
2533 generic macros used are defined in @file{lisp.h} or @file{lrecord.h}. | |
2534 | |
2535 @c #### reorganize this table into stuff used in general code, and stuff | |
2536 @c used only in declarations or initializations | |
2537 @table @samp | |
2538 @c #### declaration | |
2539 @item typedef struct Lisp_<Type> Lisp_<Type> | |
2540 This refers to the internal structure used by C code. The XEmacs coding | |
2541 style now forbids passing pointers to @samp{Lisp_<Type>} structures into | |
2542 or out of a function; instead, a @samp{Lisp_Object} should be passed or | |
2543 returned (created using @samp{wrap_<type>}, if necessary). | |
2544 | |
2545 @c #### declaration | |
2546 @item DECLARE_LRECORD (<type>, Lisp_<Type>) | |
2547 Declares an @samp{lrecord} for @samp{<Type>}, which is the unit of | |
2548 allocation. | |
2549 | |
2550 @item #define X<TYPE>(x) XRECORD (x, <type>, Lisp_<Type>) | |
2551 Turns a @code{Lisp_Object} into a pointer to @samp{struct Lisp_<Type>}. | |
2552 | |
2553 @item #define wrap_<type>(p) wrap_record (p, <type>) | |
2554 Turns a pointer to @samp{struct Lisp_<Type>} into a @code{Lisp_Object}. | |
2555 | |
2556 @item #define <TYPE>P(x) RECORDP (x, <type>) | |
2557 Tests whether a given @code{Lisp_Object} is of type @samp{Lisp_<Type>}. | |
2558 Returns a C int, not a Lisp Boolean value. | |
2559 | |
2560 @item #define CHECK_<TYPE>(x) CHECK_RECORD (x, <type>) | |
2561 @itemx #define CONCHECK_<TYPE>(x) CONCHECK_RECORD (x, <type>) | |
2562 Tests whether a given @code{Lisp_Object} is of type @samp{Lisp_<Type>}, | |
2563 and signals a Lisp error if not. The @samp{CHECK} version of the macro | |
2564 never returns if the type is wrong, while the @samp{CONCHECK} version | |
2565 can return if the user catches it in the debugger and explicitly | |
2566 requests a return. | |
2567 | |
2568 @item #define RAW_<TYP>METH(ty, m) ((ty)->methods->m##_method) | |
2569 Return a function pointer for the method for an object @var{TY} of class | |
2570 @samp{Lisp_<Type>}, or @samp{NULL} if there is none for this type. | |
2571 | |
2572 @item #define HAS_<TYP>METH_P(ty, m) (!!RAW_<TYP>METH (ty, m)) | |
2573 Test whether the class that @var{TY} is an instance of has the method. | |
2574 | |
2575 @item #define <TYP>METH(ty, m, args) ((RAW_<TYP>METH (ty, m)) args) | |
2576 Call the method on @samp{args}. @samp{args} must be enclosed in | |
2577 parentheses in the call. It is the programmer's responsibility to | |
2578 ensure that the method is available. The standard convenience macro | |
2579 @samp{MAYBE_<TYP>METH} is often provided for the common case where a | |
2580 void-returning method of @samp{Type} is called. | |
2581 | |
2582 @item #define MAYBE_<TYP>METH(ty, m, args) do @{ ... @} while (0) | |
2583 Call a void-returning @samp{<Type>} method, if it exists. Note the use | |
2584 of the @samp{do ... while (0)} idiom to give the macro call C statement | |
2585 semantics. The full definition is equally idiomatic: | |
2586 | |
2587 @example | |
2588 #define MAYBE_<TYP>METH(ty, m, args) do @{ \ | |
2589 Lisp_<Type> *maybe_<typ>meth_ty = (ty); \ | |
2590 if (HAS_<TYP>METH_P (maybe_<typ>meth_ty, m)) \ | |
2591 <TYP>METH (maybe_<typ>meth_ty, m, args); \ | |
2592 @} while (0) | |
2593 @end example | |
2594 @end table | |
2595 | |
2596 The use of macros for invoking an object's methods makes life a bit | |
2597 difficult for the student or maintainer when browsing the code. In | |
2598 particular, calls are of the form @samp{<TYP>METH (ty, some_method, (x, | |
2599 y))}, but definitions typically are for @samp{<subtype>_some_method}. | |
2600 Thus, when you are trying to find calls, you need to grep for | |
2601 @samp{some_method}, but this will also catch calls and definitions of | |
2602 that method for instances of other subtypes of @samp{<Type>}, and there | |
2603 may be a rather large number of them. | |
2604 | |
2483 | 2605 |
2484 @node Writing Lisp Primitives | 2606 @node Writing Lisp Primitives |
2485 @section Writing Lisp Primitives | 2607 @section Writing Lisp Primitives |
2486 @cindex writing Lisp primitives | 2608 @cindex writing Lisp primitives |
2487 @cindex Lisp primitives, writing | 2609 @cindex Lisp primitives, writing |
2758 everything were always kept in CVS, there would be no need for this. | 2880 everything were always kept in CVS, there would be no need for this. |
2759 But in practice, this often doesn't happen, or the CVS repository is | 2881 But in practice, this often doesn't happen, or the CVS repository is |
2760 later on lost or unavailable to the person doing the update.) | 2882 later on lost or unavailable to the person doing the update.) |
2761 | 2883 |
2762 When putting in an explicit opinion in a comment, you should | 2884 When putting in an explicit opinion in a comment, you should |
2763 @emph{always} attribute it with your name, and optionally the date. | 2885 @emph{always} attribute it with your name and the date. This also goes |
2764 This also goes for long, complex comments explaining in detail the | 2886 for long, complex comments explaining in detail the workings of |
2765 workings of something -- by putting your name there, you make it | 2887 something -- by putting your name there, you make it possible for |
2766 possible for someone who has questions about how that thing works to | 2888 someone who has questions about how that thing works to determine who |
2767 determine who wrote the comment so they can write to them. Preferably, | 2889 wrote the comment so they can write to them. Use your actual name or |
2768 use your actual name and not your initials, unless your initials are | 2890 your alias at xemacs.org, and not your initials or nickname, unless that |
2769 generally recognized (e.g. @samp{jwz}). You can use only your first | 2891 is generally recognized (e.g. @samp{jwz}). Even then, please consider |
2770 name if it's obvious who you are; otherwise, give first and last name. | 2892 requesting a virtual user at xemacs.org (forwarding address; we can't |
2771 If you're not a regular contributor, you might consider putting your | 2893 provide an actual mailbox). Otherwise, give first and last name. If |
2772 email address in -- it may be in the ChangeLog, but after awhile | 2894 you're not a regular contributor, you might consider putting your email |
2773 ChangeLogs have a tendency of disappearing or getting | 2895 address in -- it may be in the ChangeLog, but after awhile ChangeLogs |
2774 muddled. (E.g. your comment may get copied somewhere else or even into | 2896 have a tendency of disappearing or getting muddled. (E.g. your comment |
2775 another program, and tracking down the proper ChangeLog may be very | 2897 may get copied somewhere else or even into another program, and tracking |
2776 difficult.) | 2898 down the proper ChangeLog may be very difficult.) |
2777 | 2899 |
2778 If you come across an opinion that is not or no longer valid, or you | 2900 If you come across an opinion that is not or is no longer valid, or you |
2779 come across any comment that no longer applies but you want to keep it | 2901 come across any comment that no longer applies but you want to keep it |
2780 around, enclose it in @samp{[[ } and @samp{ ]]} marks and add a comment | 2902 around, enclose it in @samp{[[ } and @samp{ ]]} marks and add a comment |
2781 afterwards explaining why the preceding comment is no longer valid. Put | 2903 afterwards explaining why the preceding comment is no longer valid. Put |
2782 your name on this comment, as explained above. | 2904 your name on this comment, as explained above. |
2783 | 2905 |
2932 An @code{Ichar} holds a single Emacs character. | 3054 An @code{Ichar} holds a single Emacs character. |
2933 | 3055 |
2934 Obviously, the equality between characters and bytes is lost in the Mule | 3056 Obviously, the equality between characters and bytes is lost in the Mule |
2935 world. Characters can be represented by one or more bytes in the | 3057 world. Characters can be represented by one or more bytes in the |
2936 buffer, and @code{Ichar} is a C type large enough to hold any | 3058 buffer, and @code{Ichar} is a C type large enough to hold any |
2937 character. | 3059 character. (This currently isn't quite true for ISO 10646, which |
3060 defines a character as a 31-bit non-negative quantity, while XEmacs | |
3061 characters are only 30-bits. This is irrelevant, unless you are | |
3062 considering using the ISO 10646 private groups to support really large | |
3063 private character sets---in particular, the Mule character set!---in | |
3064 a version of XEmacs using Unicode internally.) | |
2938 | 3065 |
2939 Without Mule support, an @code{Ichar} is equivalent to an | 3066 Without Mule support, an @code{Ichar} is equivalent to an |
2940 @code{unsigned char}. | 3067 @code{unsigned char}. [[This doesn't seem to be true; @file{lisp.h} |
3068 unconditionally @samp{typedef}s @code{Ichar} to @code{int}.]] | |
2941 | 3069 |
2942 @item Ibyte | 3070 @item Ibyte |
2943 @cindex Ibyte | 3071 @cindex Ibyte |
2944 The data representing the text in a buffer or string is logically a set | 3072 The data representing the text in a buffer or string is logically a set |
2945 of @code{Ibyte}s. | 3073 of @code{Ibyte}s. |
2952 encoded in the variable-width internal encoding. | 3080 encoded in the variable-width internal encoding. |
2953 | 3081 |
2954 One character can correspond to one or more @code{Ibyte}s. In the | 3082 One character can correspond to one or more @code{Ibyte}s. In the |
2955 current Mule implementation, an ASCII character is represented by the | 3083 current Mule implementation, an ASCII character is represented by the |
2956 same @code{Ibyte}, and other characters are represented by a sequence | 3084 same @code{Ibyte}, and other characters are represented by a sequence |
2957 of two or more @code{Ibyte}s. | 3085 of two or more @code{Ibyte}s. (This will also be true of an |
3086 implementation using UTF-8 as the internal encoding. In fact, only code | |
3087 that implements character code conversions and a very few macros used to | |
3088 implement motion by whole characters will notice the difference between | |
3089 UTF-8 and the Mule encoding.) | |
2958 | 3090 |
2959 Without Mule support, there are exactly 256 characters, implicitly | 3091 Without Mule support, there are exactly 256 characters, implicitly |
2960 Latin-1, and each character is represented using one @code{Ibyte}, and | 3092 Latin-1, and each character is represented using one @code{Ibyte}, and |
2961 there is a one-to-one correspondence between @code{Ibyte}s and | 3093 there is a one-to-one correspondence between @code{Ibyte}s and |
2962 @code{Ichar}s. | 3094 @code{Ichar}s. |
3044 If you followed the previous section, you can guess that, logically, | 3176 If you followed the previous section, you can guess that, logically, |
3045 multiplying a @code{Charcount} value with @code{MAX_ICHAR_LEN} produces | 3177 multiplying a @code{Charcount} value with @code{MAX_ICHAR_LEN} produces |
3046 a @code{Bytecount} value. | 3178 a @code{Bytecount} value. |
3047 | 3179 |
3048 In the current Mule implementation, @code{MAX_ICHAR_LEN} equals 4. | 3180 In the current Mule implementation, @code{MAX_ICHAR_LEN} equals 4. |
3049 Without Mule, it is 1. | 3181 Without Mule, it is 1. In a mature Unicode-based XEmacs, it will also |
3182 be 4 (since all Unicode characters can be encoded in UTF-8 in 4 bytes or | |
3183 less), but some versions may use up to 6, in order to use the large | |
3184 private space provided by ISO 10646 to ``mirror'' the Mule code space. | |
3050 | 3185 |
3051 @item itext_ichar | 3186 @item itext_ichar |
3052 @itemx set_itext_ichar | 3187 @itemx set_itext_ichar |
3053 @cindex itext_ichar | 3188 @cindex itext_ichar |
3054 @cindex set_itext_ichar | 3189 @cindex set_itext_ichar |
3182 | 3317 |
3183 @item Qnative | 3318 @item Qnative |
3184 Format used for the external Unix environment---@code{argv[]}, stuff | 3319 Format used for the external Unix environment---@code{argv[]}, stuff |
3185 from @code{getenv()}, stuff from the @file{/etc/passwd} file, etc. | 3320 from @code{getenv()}, stuff from the @file{/etc/passwd} file, etc. |
3186 This is encoded according to the encoding specified by the current locale. | 3321 This is encoded according to the encoding specified by the current locale. |
3322 [[This is dangerous; current locale is user preference, and the system | |
3323 is probably going to be something else. Is there anything we can do | |
3324 about it?]] | |
3187 | 3325 |
3188 @item Qfile_name | 3326 @item Qfile_name |
3189 Format used for filenames. This is normally the same as @code{Qnative}, | 3327 Format used for filenames. This is normally the same as @code{Qnative}, |
3190 but the two should be distinguished for clarity and possible future | 3328 but the two should be distinguished for clarity and possible future |
3191 separation -- and also because @code{Qfile_name} can be changed using either | 3329 separation -- and also because @code{Qfile_name} can be changed using either |
3371 @strong{encapsulated} equivalents that do the internal to external | 3509 @strong{encapsulated} equivalents that do the internal to external |
3372 conversion themselves. The encapsulated equivalents have a @code{qxe_} | 3510 conversion themselves. The encapsulated equivalents have a @code{qxe_} |
3373 prefix and have string arguments of type @code{Ibyte *}, and you can | 3511 prefix and have string arguments of type @code{Ibyte *}, and you can |
3374 pass internally encoded data to them, often from a Lisp string using | 3512 pass internally encoded data to them, often from a Lisp string using |
3375 @code{XSTRING_DATA}. (A better design might be to provide versions that | 3513 @code{XSTRING_DATA}. (A better design might be to provide versions that |
3376 accept Lisp strings directly.) | 3514 accept Lisp strings directly.) [[Really? Then they'd either take |
3515 @code{Lisp_Object}s and need to check type, or they'd take | |
3516 @code{Lisp_String}s, and violate the rules about passing any of the | |
3517 specific Lisp types.]] | |
3377 | 3518 |
3378 Also note that many internal functions, such as @code{make_string}, | 3519 Also note that many internal functions, such as @code{make_string}, |
3379 accept Ibytes, which removes the need for them to convert the data they | 3520 accept Ibytes, which removes the need for them to convert the data they |
3380 receive. This increases efficiency because that way external data needs | 3521 receive. This increases efficiency because that way external data needs |
3381 to be decoded only once, when it is read. After that, it is passed | 3522 to be decoded only once, when it is read. After that, it is passed |
3488 To make a quantified XEmacs, do: @code{make quantmacs}. | 3629 To make a quantified XEmacs, do: @code{make quantmacs}. |
3489 | 3630 |
3490 You simply can't dump Quantified and Purified images (unless using the | 3631 You simply can't dump Quantified and Purified images (unless using the |
3491 portable dumper). Purify gets confused when xemacs frees memory in one | 3632 portable dumper). Purify gets confused when xemacs frees memory in one |
3492 process that was allocated in a @emph{different} process on a different | 3633 process that was allocated in a @emph{different} process on a different |
3493 machine!. Run it like so: | 3634 machine! Run it like so: |
3494 @example | 3635 @example |
3495 temacs -batch -l loadup.el run-temacs @var{xemacs-args...} | 3636 temacs -batch -l loadup.el run-temacs @var{xemacs-args...} |
3496 @end example | 3637 @end example |
3497 | 3638 |
3498 @cindex error checking | 3639 @cindex error checking |
5772 @end example | 5913 @end example |
5773 | 5914 |
5774 @file{test-harness.el} defines the macros @code{Assert}, | 5915 @file{test-harness.el} defines the macros @code{Assert}, |
5775 @code{Check-Error}, @code{Check-Error-Message}, and | 5916 @code{Check-Error}, @code{Check-Error-Message}, and |
5776 @code{Check-Message}. The other files are test files, testing various | 5917 @code{Check-Message}. The other files are test files, testing various |
5777 XEmacs facilities. | 5918 XEmacs facilities. @xref{Regression Testing XEmacs}. |
5778 | 5919 |
5779 | 5920 |
5780 | 5921 |
5781 @node Allocation of Objects in XEmacs Lisp, Dumping, A Summary of the Various XEmacs Modules, Top | 5922 @node Allocation of Objects in XEmacs Lisp, Dumping, A Summary of the Various XEmacs Modules, Top |
5782 @chapter Allocation of Objects in XEmacs Lisp | 5923 @chapter Allocation of Objects in XEmacs Lisp |
7122 When starting xemacs, reload the dump file, relocate it to its new | 7263 When starting xemacs, reload the dump file, relocate it to its new |
7123 starting address if needed, and reinitialize all pointers to this | 7264 starting address if needed, and reinitialize all pointers to this |
7124 data. Also, rebuild all the quickly rebuildable data. | 7265 data. Also, rebuild all the quickly rebuildable data. |
7125 @end enumerate | 7266 @end enumerate |
7126 | 7267 |
7268 Note: As of 21.5.18, the dump file has been moved inside of the | |
7269 executable, although there are still problems with this on some systems. | |
7270 | |
7127 @node Data descriptions | 7271 @node Data descriptions |
7128 @section Data descriptions | 7272 @section Data descriptions |
7129 @cindex dumping data descriptions | 7273 @cindex dumping data descriptions |
7130 | 7274 |
7131 The more complex task of the dumper is to be able to write lisp objects | 7275 The more complex task of the dumper is to be able to write lisp objects |
7425 @section Remaining issues | 7569 @section Remaining issues |
7426 @cindex dumping, remaining issues | 7570 @cindex dumping, remaining issues |
7427 | 7571 |
7428 The build process will have to start a post-dump xemacs, ask it the | 7572 The build process will have to start a post-dump xemacs, ask it the |
7429 loading address (which will, hopefully, be always the same between | 7573 loading address (which will, hopefully, be always the same between |
7430 different xemacs invocations) and relocate the file to the new address. | 7574 different xemacs invocations) [[unfortunately, not true on Linux with |
7575 the ExecShield feature]] and relocate the file to the new address. | |
7431 This way the object relocation phase will not have to be done, which | 7576 This way the object relocation phase will not have to be done, which |
7432 means no writes in the objects and that, because of the use of mmap, the | 7577 means no writes in the objects and that, because of the use of mmap, the |
7433 dumped data will be shared between all the xemacs running on the | 7578 dumped data will be shared between all the xemacs running on the |
7434 computer. | 7579 computer. |
7435 | 7580 |
8696 certain charsets), but these do not require new concepts. The main | 8841 certain charsets), but these do not require new concepts. The main |
8697 exception is that wild-card matches in Mule have to be careful to | 8842 exception is that wild-card matches in Mule have to be careful to |
8698 swallow whole characters. This is handled using the same basic macros | 8843 swallow whole characters. This is handled using the same basic macros |
8699 that are used for buffer and string movements. | 8844 that are used for buffer and string movements. |
8700 | 8845 |
8846 This will also be true if a UTF-8 representation is used for the | |
8847 internal encoding. | |
8848 | |
8701 The complex algorithms for searching are for simple string searches. In | 8849 The complex algorithms for searching are for simple string searches. In |
8702 particular, the algorithm used for fast string searching is Boyer-Moore. | 8850 particular, the algorithm used for fast string searching is Boyer-Moore. |
8703 This algorithm is based on the idea that if you have a mismatch at a | 8851 This algorithm is based on the idea that if you have a mismatch at a |
8704 given position, you can precompute where to restart the search. This | 8852 given position, you can precompute where to restart the search. This |
8705 typically means that you can often make many fewer than N character | 8853 typically means that you can often make many fewer than N character |