353 |
* cases. Thus, their tc7-codes are chosen to only differ in one bit. This |
* cases. Thus, their tc7-codes are chosen to only differ in one bit. This |
354 |
* makes it possible to check an object at the same time for being a vector |
* makes it possible to check an object at the same time for being a vector |
355 |
* or a weak vector by comparing its tc7 code with that bit masked (using |
* or a weak vector by comparing its tc7 code with that bit masked (using |
356 |
* the TYP7S macro). Two more special tc7-codes are of interest: ports and |
* the TYP7S macro). Three more special tc7-codes are of interest: |
357 |
* smobs in fact each represent collections of types, which are subdivided |
* numbers, ports and smobs in fact each represent collections of types, |
358 |
* using tc16-codes. |
* which are subdivided using tc16-codes. |
359 |
* |
* |
360 |
* tc16 (for tc7==scm_tc7_smob): |
* tc16 (for tc7==scm_tc7_smob): |
361 |
* The largest part of the space of smob types is not subdivided in a |
* The largest part of the space of smob types is not subdivided in a |
362 |
* predefined way, since smobs can be added arbitrarily by user C code. |
* predefined way, since smobs can be added arbitrarily by user C code. |
363 |
* However, while Guile also defines a number of smob types throughout, |
* However, while Guile also defines a number of smob types throughout, |
364 |
* there are four smob types for which Guile assumes that they are declared |
* there is one smob type, namely scm_tc_free_cell, for which Guile assumes |
365 |
* first and thus get known-in-advance tc16-codes. These are |
* that it is declared first and thus gets a known-in-advance tc16-code. |
366 |
* scm_tc_free_cell, scm_tc16_big, scm_tc16_real and scm_tc16_complex. The |
* The reason of requiring a fixed tc16-code for this type is performance. |
|
* reason of requiring fixed tc16-codes for these types is performance. For |
|
|
* the same reason, scm_tc16_real and scm_tc16_complex are given tc16-codes |
|
|
* that only differ in one bit: This way, checking if an object is an |
|
|
* inexact number can be done quickly (using the TYP16S macro) |
|
367 |
*/ |
*/ |
368 |
|
|
369 |
|
|
421 |
#define scm_tc7_wvect 15 |
#define scm_tc7_wvect 15 |
422 |
|
|
423 |
#define scm_tc7_string 21 |
#define scm_tc7_string 21 |
424 |
/* free 23 */ |
#define scm_tc7_number 23 |
425 |
|
|
426 |
/* Many of the following should be turned |
/* Many of the following should be turned |
427 |
* into structs or smobs. We need back some |
* into structs or smobs. We need back some |
472 |
|
|
473 |
#define SCM_TYP16_PREDICATE(tag, x) (!SCM_IMP (x) && SCM_TYP16 (x) == (tag)) |
#define SCM_TYP16_PREDICATE(tag, x) (!SCM_IMP (x) && SCM_TYP16 (x) == (tag)) |
474 |
|
|
475 |
/* Here are the first four smob subtypes. */ |
/* Here is the first smob subtype. */ |
476 |
|
|
477 |
/* scm_tc_free_cell is the 0th smob type. We place this in free cells to tell |
/* scm_tc_free_cell is the 0th smob type. We place this in free cells to tell |
478 |
* the conservative marker not to trace it. */ |
* the conservative marker not to trace it. */ |
479 |
#define scm_tc_free_cell (scm_tc7_smob + 0 * 256L) |
#define scm_tc_free_cell (scm_tc7_smob + 0 * 256L) |
480 |
|
|
|
/* Smob type 1 to 3 (note the dependency on the predicate SCM_NUMP) */ |
|
|
#define scm_tc16_big (scm_tc7_smob + 1 * 256L) |
|
|
#define scm_tc16_real (scm_tc7_smob + 2 * 256L) |
|
|
#define scm_tc16_complex (scm_tc7_smob + 3 * 256L) |
|
|
|
|
481 |
|
|
482 |
/* {Immediate Values} |
/* {Immediate Values} |
483 |
*/ |
*/ |