diff options
| author | Eli Zaretskii | 2012-10-20 18:17:25 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-10-20 18:17:25 +0200 |
| commit | 6d03e7beda333663080a64af902231342fd941cf (patch) | |
| tree | bd4521483ad70701e3dbf2c32e2910947bad5b53 /src | |
| parent | 87c6b4e6bd7e023bd57c709bb6af59bca27bf4f6 (diff) | |
| parent | 83c85d8e2e6c1e1cb309f554555e1aebc1dcb44f (diff) | |
| download | emacs-6d03e7beda333663080a64af902231342fd941cf.tar.gz emacs-6d03e7beda333663080a64af902231342fd941cf.zip | |
Merge from trunk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/lisp.h | 51 | ||||
| -rw-r--r-- | src/lread.c | 23 |
3 files changed, 65 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f61c2ccdb00..c81009928de 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-10-20 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * lread.c (Fload): Doc fix (Bug#12592). | ||
| 4 | |||
| 1 | 2012-10-19 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change) | 5 | 2012-10-19 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change) |
| 2 | 6 | ||
| 3 | * font.c (Ffont_at): Fix previous change. | 7 | * font.c (Ffont_at): Fix previous change. |
diff --git a/src/lisp.h b/src/lisp.h index b9e78385313..7b9654e89e8 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -222,7 +222,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; | |||
| 222 | 222 | ||
| 223 | /* Define the fundamental Lisp data structures. */ | 223 | /* Define the fundamental Lisp data structures. */ |
| 224 | 224 | ||
| 225 | /* This is the set of Lisp data types. */ | 225 | /* This is the set of Lisp data types. If you want to define a new |
| 226 | data type, read the comments after Lisp_Fwd_Type definition | ||
| 227 | below. */ | ||
| 226 | 228 | ||
| 227 | /* Lisp integers use 2 tags, to give them one extra bit, thus | 229 | /* Lisp integers use 2 tags, to give them one extra bit, thus |
| 228 | extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ | 230 | extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ |
| @@ -298,6 +300,53 @@ enum Lisp_Fwd_Type | |||
| 298 | Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ | 300 | Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ |
| 299 | }; | 301 | }; |
| 300 | 302 | ||
| 303 | /* If you want to define a new Lisp data type, here are some | ||
| 304 | instructions. See the thread at | ||
| 305 | http://lists.gnu.org/archive/html/emacs-devel/2012-10/msg00561.html | ||
| 306 | for more info. | ||
| 307 | |||
| 308 | First, there are already a couple of Lisp types that can be used if | ||
| 309 | your new type does not need to be exposed to Lisp programs nor | ||
| 310 | displayed to users. These are Lisp_Save_Value, a Lisp_Misc | ||
| 311 | subtype, and PVEC_OTHER, a kind of vectorlike object. The former | ||
| 312 | is suitable for temporarily stashing away pointers and integers in | ||
| 313 | a Lisp object (see the existing uses of make_save_value and | ||
| 314 | XSAVE_VALUE). The latter is useful for vector-like Lisp objects | ||
| 315 | that need to be used as part of other objects, but which are never | ||
| 316 | shown to users or Lisp code (search for PVEC_OTHER in xterm.c for | ||
| 317 | an example). | ||
| 318 | |||
| 319 | These two types don't look pretty when printed, so they are | ||
| 320 | unsuitable for Lisp objects that can be exposed to users. | ||
| 321 | |||
| 322 | To define a new data type, add one more Lisp_Misc subtype or one | ||
| 323 | more pseudovector subtype. Pseudovectors are more suitable for | ||
| 324 | objects with several slots that need to support fast random access, | ||
| 325 | whil Lisp_Misc types are foreverything else. A pseudovector object | ||
| 326 | provides one or more slots for Lisp objects, followed by struct | ||
| 327 | members that are accessible only from C. A Lisp_Misc object is a | ||
| 328 | wrapper for a C struct that can contain anything you like. | ||
| 329 | |||
| 330 | To add a new pseudovector type, extend the pvec_type enumeration; | ||
| 331 | to add a new Lisp_Misc, extend the Lisp_Misc_Type enumeration. | ||
| 332 | |||
| 333 | For a Lisp_Misc, you will also need to add your entry to union | ||
| 334 | Lisp_Misc (but make sure the first word has the same structure as | ||
| 335 | the others, starting with a 16-bit member of the Lisp_Misc_Type | ||
| 336 | enumeration and a 1-bit GC markbit) and make sure the overall size | ||
| 337 | of the union is not increased by your addition. | ||
| 338 | |||
| 339 | Then you will need to add switch branches in print.c (in | ||
| 340 | print_object, to print your object, and possibly also in | ||
| 341 | print_preprocess) and to alloc.c, to mark your object (in | ||
| 342 | mark_object) and to free it (in gc_sweep). The latter is also the | ||
| 343 | right place to call any code specific to your data type that needs | ||
| 344 | to run when the object is recycled -- e.g., free any additional | ||
| 345 | resources allocated for it that are not Lisp objects. You can even | ||
| 346 | make a pointer to the function that frees the resources a slot in | ||
| 347 | your object -- this way, the same object could be used to represent | ||
| 348 | several disparate C structures. */ | ||
| 349 | |||
| 301 | #ifdef CHECK_LISP_OBJECT_TYPE | 350 | #ifdef CHECK_LISP_OBJECT_TYPE |
| 302 | 351 | ||
| 303 | typedef struct { EMACS_INT i; } Lisp_Object; | 352 | typedef struct { EMACS_INT i; } Lisp_Object; |
diff --git a/src/lread.c b/src/lread.c index 6d4c0d990af..94744620279 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -996,18 +996,17 @@ If optional fifth arg MUST-SUFFIX is non-nil, insist on | |||
| 996 | the suffix `.elc' or `.el'; don't accept just FILE unless | 996 | the suffix `.elc' or `.el'; don't accept just FILE unless |
| 997 | it ends in one of those suffixes or includes a directory name. | 997 | it ends in one of those suffixes or includes a directory name. |
| 998 | 998 | ||
| 999 | If this function fails to find a file, it may look for different | 999 | If NOSUFFIX is nil, then if a file could not be found, try looking for |
| 1000 | representations of that file before trying another file. | 1000 | a different representation of the file by adding non-empty suffixes to |
| 1001 | It does so by adding the non-empty suffixes in `load-file-rep-suffixes' | 1001 | its name, before trying another file. Emacs uses this feature to find |
| 1002 | to the file name. Emacs uses this feature mainly to find compressed | 1002 | compressed versions of files when Auto Compression mode is enabled. |
| 1003 | versions of files when Auto Compression mode is enabled. | 1003 | If NOSUFFIX is non-nil, disable this feature. |
| 1004 | 1004 | ||
| 1005 | The exact suffixes that this function tries out, in the exact order, | 1005 | The suffixes that this function tries out, when NOSUFFIX is nil, are |
| 1006 | are given by the value of the variable `load-file-rep-suffixes' if | 1006 | given by the return value of `get-load-suffixes' and the values listed |
| 1007 | NOSUFFIX is non-nil and by the return value of the function | 1007 | in `load-file-rep-suffixes'. If MUST-SUFFIX is non-nil, only the |
| 1008 | `get-load-suffixes' if MUST-SUFFIX is non-nil. If both NOSUFFIX and | 1008 | return value of `get-load-suffixes' is used, i.e. the file name is |
| 1009 | MUST-SUFFIX are nil, this function first tries out the latter suffixes | 1009 | required to have a non-empty suffix. |
| 1010 | and then the former. | ||
| 1011 | 1010 | ||
| 1012 | Loading a file records its definitions, and its `provide' and | 1011 | Loading a file records its definitions, and its `provide' and |
| 1013 | `require' calls, in an element of `load-history' whose | 1012 | `require' calls, in an element of `load-history' whose |