comparison man/internals/internals.texi @ 965:e51bd28995c0

[xemacs-hg @ 2002-08-16 12:37:35 by stephent] internals.texi <87fzxfkmlz.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Fri, 16 Aug 2002 12:37:45 +0000
parents 48eed784e93a
children a306b7c7742d
comparison
equal deleted inserted replaced
964:8d610ea37af8 965:e51bd28995c0
116 * XEmacs From the Inside:: 116 * XEmacs From the Inside::
117 * The XEmacs Object System (Abstractly Speaking):: 117 * The XEmacs Object System (Abstractly Speaking)::
118 * How Lisp Objects Are Represented in C:: 118 * How Lisp Objects Are Represented in C::
119 * Major Textual Changes:: 119 * Major Textual Changes::
120 * Rules When Writing New C Code:: 120 * Rules When Writing New C Code::
121 * Regression Testing XEmacs::
121 * CVS Techniques:: 122 * CVS Techniques::
122 * A Summary of the Various XEmacs Modules:: 123 * A Summary of the Various XEmacs Modules::
123 * Allocation of Objects in XEmacs Lisp:: 124 * Allocation of Objects in XEmacs Lisp::
124 * Dumping:: 125 * Dumping::
125 * Events and the Event Loop:: 126 * Events and the Event Loop::
172 173
173 CVS Techniques 174 CVS Techniques
174 175
175 * Merging a Branch into the Trunk:: 176 * Merging a Branch into the Trunk::
176 177
178 Regression Testing XEmacs
179
177 A Summary of the Various XEmacs Modules 180 A Summary of the Various XEmacs Modules
178 181
179 * Low-Level Modules:: 182 * Low-Level Modules::
180 * Basic Lisp Modules:: 183 * Basic Lisp Modules::
181 * Modules for Standard Editing Operations:: 184 * Modules for Standard Editing Operations::
186 * Modules for Interfacing with the File System:: 189 * Modules for Interfacing with the File System::
187 * Modules for Other Aspects of the Lisp Interpreter and Object System:: 190 * Modules for Other Aspects of the Lisp Interpreter and Object System::
188 * Modules for Interfacing with the Operating System:: 191 * Modules for Interfacing with the Operating System::
189 * Modules for Interfacing with X Windows:: 192 * Modules for Interfacing with X Windows::
190 * Modules for Internationalization:: 193 * Modules for Internationalization::
194 * Modules for Regression Testing::
191 195
192 Allocation of Objects in XEmacs Lisp 196 Allocation of Objects in XEmacs Lisp
193 197
194 * Introduction to Allocation:: 198 * Introduction to Allocation::
195 * Garbage Collection:: 199 * Garbage Collection::
2173 gr '_ITEXT' _CHARPTR $files 2177 gr '_ITEXT' _CHARPTR $files
2174 gr '_itext' _charptr $files 2178 gr '_itext' _charptr $files
2175 gr '_Itext' _CHARPTR $files 2179 gr '_Itext' _CHARPTR $files
2176 @end example 2180 @end example
2177 2181
2178 @node Rules When Writing New C Code, CVS Techniques, Major Textual Changes, Top 2182 @node Rules When Writing New C Code, Regression Testing XEmacs, Major Textual Changes, Top
2179 @chapter Rules When Writing New C Code 2183 @chapter Rules When Writing New C Code
2180 @cindex writing new C code, rules when 2184 @cindex writing new C code, rules when
2181 @cindex C code, rules when writing new 2185 @cindex C code, rules when writing new
2182 @cindex code, rules when writing new C 2186 @cindex code, rules when writing new C
2183 2187
3430 add a DEFINE_LRECORD_IMPLEMENTATION call to @file{@var{foo}.c} 3434 add a DEFINE_LRECORD_IMPLEMENTATION call to @file{@var{foo}.c}
3431 @item 3435 @item
3432 add an INIT_LRECORD_IMPLEMENTATION call to @code{syms_of_@var{foo}.c} 3436 add an INIT_LRECORD_IMPLEMENTATION call to @code{syms_of_@var{foo}.c}
3433 @end enumerate 3437 @end enumerate
3434 3438
3435 @node CVS Techniques, A Summary of the Various XEmacs Modules, Rules When Writing New C Code, Top 3439 @node Regression Testing XEmacs, CVS Techniques, Rules When Writing New C Code, Top
3440 @chapter Regression Testing XEmacs
3441 @cindex testing, regression
3442
3443 The source directory @file{tests/automated} contains XEmacs' automated
3444 test suite. The usual way of running all the tests is running
3445 @code{make check} from the top-level build directory.
3446
3447 The test suite is unfinished and it's still lacking some essential
3448 features. It is nevertheless recommended that you run the tests to
3449 confirm that XEmacs behaves correctly.
3450
3451 If you want to run a specific test case, you can do it from the
3452 command-line like this:
3453
3454 @example
3455 $ xemacs -batch -l test-harness.elc -f batch-test-emacs TEST-FILE
3456 @end{example}
3457
3458 If something goes wrong, you can run the test suite interactively by
3459 loading @file{test-harness.el} into a running XEmacs and typing
3460 @kbd{M-x test-emacs-test-file RET <filename> RET}. You will see a log of
3461 passed and failed tests, which should allow you to investigate the
3462 source of the error and ultimately fix the bug.
3463
3464 Adding a new test file is trivial: just create a new file here and it
3465 will be run. There is no need to byte-compile any of the files in
3466 this directory---the test-harness will take care of any necessary
3467 byte-compilation.
3468
3469 Look at the existing test cases for the examples of coding test cases.
3470 It all boils down to your imagination and judicious use of the macros
3471 @code{Assert}, @code{Check-Error}, @code{Check-Error-Message}, and
3472 @code{Check-Message}.
3473
3474 Here's a simple example checking case-sensitive and case-insensitive
3475 comparisons from @file{case-tests.el}.
3476
3477 @example
3478 (with-temp-buffer
3479 (insert "Test Buffer")
3480 (let ((case-fold-search t))
3481 (goto-char (point-min))
3482 (Assert (eq (search-forward "test buffer" nil t) 12))
3483 (goto-char (point-min))
3484 (Assert (eq (search-forward "Test buffer" nil t) 12))
3485 (goto-char (point-min))
3486 (Assert (eq (search-forward "Test Buffer" nil t) 12))
3487
3488 (setq case-fold-search nil)
3489 (goto-char (point-min))
3490 (Assert (not (search-forward "test buffer" nil t)))
3491 (goto-char (point-min))
3492 (Assert (not (search-forward "Test buffer" nil t)))
3493 (goto-char (point-min))
3494 (Assert (eq (search-forward "Test Buffer" nil t) 12))))
3495 @end{example}
3496
3497 This example could be inserted in a file in @file{tests/automated}, and
3498 it would be a complete test, automatically executed when you run
3499 @kbd{make check} after building XEmacs. More complex tests may require
3500 substantial temporary scaffolding to create the environment that elicits
3501 the bugs, but the top-level Makefile and @file{test-harness.el} handle
3502 the running and collection of results from the @code{Assert},
3503 @code{Check-Error}, @code{Check-Error-Message}, and @code{Check-Message}
3504 macros.
3505
3506 @node CVS Techniques, A Summary of the Various XEmacs Modules, Regression Testing XEmacs, Top
3436 @chapter CVS Techniques 3507 @chapter CVS Techniques
3437 @cindex CVS techniques 3508 @cindex CVS techniques
3438 3509
3439 @menu 3510 @menu
3440 * Merging a Branch into the Trunk:: 3511 * Merging a Branch into the Trunk::
3539 * Modules for Interfacing with the File System:: 3610 * Modules for Interfacing with the File System::
3540 * Modules for Other Aspects of the Lisp Interpreter and Object System:: 3611 * Modules for Other Aspects of the Lisp Interpreter and Object System::
3541 * Modules for Interfacing with the Operating System:: 3612 * Modules for Interfacing with the Operating System::
3542 * Modules for Interfacing with X Windows:: 3613 * Modules for Interfacing with X Windows::
3543 * Modules for Internationalization:: 3614 * Modules for Internationalization::
3615 * Modules for Regression Testing::
3544 @end menu 3616 @end menu
3545 3617
3546 @node Low-Level Modules 3618 @node Low-Level Modules
3547 @section Low-Level Modules 3619 @section Low-Level Modules
3548 @cindex low-level modules 3620 @cindex low-level modules
5203 Asian-language support, and is not currently used. 5275 Asian-language support, and is not currently used.
5204 5276
5205 5277
5206 5278
5207 5279
5280 @node Modules for Regression Testing
5281 @section Modules for Regression Testing
5282 @cindex modules for regression testing
5283 @cindex regression testing, modules for
5284
5285 @example
5286 test-harness.el
5287 base64-tests.el
5288 byte-compiler-tests.el
5289 case-tests.el
5290 ccl-tests.el
5291 c-tests.el
5292 database-tests.el
5293 extent-tests.el
5294 hash-table-tests.el
5295 lisp-tests.el
5296 md5-tests.el
5297 mule-tests.el
5298 regexp-tests.el
5299 symbol-tests.el
5300 syntax-tests.el
5301 @end example
5302
5303 @file{test-harness.el} defines the macros @code{Assert},
5304 @code{Check-Error}, @code{Check-Error-Message}, and
5305 @code{Check-Message}. The other files are test files, testing various
5306 XEmacs facilities.
5307
5308
5309
5208 @node Allocation of Objects in XEmacs Lisp, Dumping, A Summary of the Various XEmacs Modules, Top 5310 @node Allocation of Objects in XEmacs Lisp, Dumping, A Summary of the Various XEmacs Modules, Top
5209 @chapter Allocation of Objects in XEmacs Lisp 5311 @chapter Allocation of Objects in XEmacs Lisp
5210 @cindex allocation of objects in XEmacs Lisp 5312 @cindex allocation of objects in XEmacs Lisp
5211 @cindex objects in XEmacs Lisp, allocation of 5313 @cindex objects in XEmacs Lisp, allocation of
5212 @cindex Lisp objects, allocation of in XEmacs 5314 @cindex Lisp objects, allocation of in XEmacs
5469 @code{GCPRO}ing are intermittent and extremely difficult to track down, 5571 @code{GCPRO}ing are intermittent and extremely difficult to track down,
5470 often showing up in crashes inside of @code{garbage-collect} or in 5572 often showing up in crashes inside of @code{garbage-collect} or in
5471 weirdly corrupted objects or even in incorrect values in a totally 5573 weirdly corrupted objects or even in incorrect values in a totally
5472 different section of code. 5574 different section of code.
5473 @end enumerate 5575 @end enumerate
5576
5577 If you don't understand whether to @code{GCPRO} in a particular
5578 instance, ask on the mailing lists. A general hint is that @code{prog1}
5579 is the canonical example
5474 5580
5475 @cindex garbage collection, conservative 5581 @cindex garbage collection, conservative
5476 @cindex conservative garbage collection 5582 @cindex conservative garbage collection
5477 Given the extremely error-prone nature of the @code{GCPRO} scheme, and 5583 Given the extremely error-prone nature of the @code{GCPRO} scheme, and
5478 the difficulties in tracking down, it should be considered a deficiency 5584 the difficulties in tracking down, it should be considered a deficiency