read.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* read.h Copyright (C) Codemist Ltd, 1989-2002 */
  2. /*
  3. * Header defining the structure of the package system for use by
  4. * intern and its friends.
  5. */
  6. /*
  7. * This code may be used and modified, and redistributed in binary
  8. * or source form, subject to the "CCL Public License", which should
  9. * accompany it. This license is a variant on the BSD license, and thus
  10. * permits use of code derived from this in either open and commercial
  11. * projects: but it does require that updates to this code be made
  12. * available back to the originators of the package.
  13. * Before merging other code in with this or linking this code
  14. * with other packages or libraries please check that the license terms
  15. * of the other material are compatible with those of this.
  16. */
  17. /* Signature: 31644019 08-Apr-2002 */
  18. #ifndef header_read_h
  19. #define header_read_h 1
  20. typedef struct Package
  21. {
  22. Header header;
  23. Lisp_Object packageid; /* 'package as type of this struct */
  24. Lisp_Object internals; /* either vector or list of vectors */
  25. Lisp_Object vinternals; /* number of 16K vectors in this package */
  26. Lisp_Object ninternals; /* number of symbols in this package */
  27. Lisp_Object pkgflags; /* place to put randomish flags etc */
  28. #ifdef COMMON
  29. /*
  30. * Standard Lisp can have a much simpler setup than Common Lisp here
  31. */
  32. Lisp_Object externals; /* vector or list of vectors */
  33. Lisp_Object vexternals; /* number of vectors in above */
  34. Lisp_Object nexternals; /* number of symbols involved */
  35. Lisp_Object name; /* name of this package */
  36. Lisp_Object nicknames; /* list of nicknames */
  37. Lisp_Object use_list; /* list of things that this package uses */
  38. Lisp_Object used_by_list; /* list of packages that use this one */
  39. Lisp_Object shadowing_symbols; /* magic to cope with name clashes */
  40. #endif
  41. } Package;
  42. /*
  43. * The following macros are coded the way they are so as to encourage the
  44. * C compiler into using the address modes I want...
  45. * Rationalize at your peril!
  46. */
  47. #define packhdr_(p) (*(Header *) ((char *)(p) + (0 - TAG_VECTOR)))
  48. #define packid_(p) (*(Lisp_Object *)((char *)(p) + (CELL - TAG_VECTOR)))
  49. #define packint_(p) (*(Lisp_Object *)((char *)(p) + (2*CELL - TAG_VECTOR)))
  50. #define packvint_(p) (*(Lisp_Object *)((char *)(p) + (3*CELL - TAG_VECTOR)))
  51. #define packnint_(p) (*(Lisp_Object *)((char *)(p) + (4*CELL - TAG_VECTOR)))
  52. #define packflags_(p) (*(Lisp_Object *)((char *)(p) + (5*CELL - TAG_VECTOR)))
  53. #ifdef COMMON
  54. #define packext_(p) (*(Lisp_Object *)((char *)(p) + (6*CELL - TAG_VECTOR)))
  55. #define packvext_(p) (*(Lisp_Object *)((char *)(p) + (7*CELL - TAG_VECTOR)))
  56. #define packnext_(p) (*(Lisp_Object *)((char *)(p) + (8*CELL - TAG_VECTOR)))
  57. #define packname_(p) (*(Lisp_Object *)((char *)(p) + (9*CELL - TAG_VECTOR)))
  58. #define packnick_(p) (*(Lisp_Object *)((char *)(p) + (10*CELL - TAG_VECTOR)))
  59. #define packuses_(p) (*(Lisp_Object *)((char *)(p) + (11*CELL - TAG_VECTOR)))
  60. #define packused_(p) (*(Lisp_Object *)((char *)(p) + (12*CELL - TAG_VECTOR)))
  61. #define packshade_(p) (*(Lisp_Object *)((char *)(p) + (13*CELL - TAG_VECTOR)))
  62. #endif
  63. #define CP qvalue(current_package)
  64. #ifdef COMMON
  65. # define ESCAPE_CHAR '\\'
  66. #else
  67. # define ESCAPE_CHAR '!'
  68. #endif
  69. #define NO_PREFIX 'x'
  70. extern CSLbool is_constituent(int c);
  71. extern Lisp_Object intern(int len, CSLbool escaped);
  72. extern Lisp_Object iintern(Lisp_Object str, int32 h, Lisp_Object p,
  73. int str_is_ok /* NOT a bool */);
  74. extern Lisp_Object find_package(char *name, int len);
  75. extern Lisp_Object read_from_vector(char *v);
  76. extern char prompt_string[32];
  77. #define INIT_OBVECI_SIZE 4096
  78. #define INIT_OBVECX_SIZE 4096
  79. #endif /* header_read_h */
  80. /* end of read.h */