home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / src / extents-data.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-11  |  5.7 KB  |  181 lines

  1. /* This file is part of GNU Emacs.
  2.  
  3. GNU Emacs is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 1, or (at your option)
  6. any later version.
  7.  
  8. GNU Emacs is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. GNU General Public License for more details.
  12.  
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Emacs; see the file COPYING.  If not, write to
  15. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  16.  
  17. #ifndef _EXTENTS_DATA_H_
  18. #define _EXTENTS_DATA_H_
  19.  
  20. #ifndef ENERGIZE
  21. ERROR! extents-data.h is an Energize-only file
  22. #endif
  23.  
  24. /****************************** Types *********************************/
  25.  
  26. #include <request.h>
  27. #include "editorside.h"
  28.  
  29. #include "extents.h"
  30.  
  31. typedef BITS32 EId;        /* Energize id */
  32.  
  33. /* In general, we keep positions in Energize form in our data structures,
  34.    and only convert to Emacs positions as needed for Emacs operations. */
  35. typedef BITS32 EnergizePos;    /* Energize position = (Emacs position-1) */
  36. typedef BITS32 EmacsPos;
  37.      
  38. /* Generic extent data and classes */
  39.      
  40. #define GDATA_CLASS_SEAL 0x12345678
  41. #define GDATA_SEAL       0x67654321
  42. #define EXTENT_SEAL      0x45612378
  43. #define DUP_SEAL         0x13524768
  44. #define BUF_INFO_SEAL    0x5F7F6F5F
  45. #define OBJECT_SEAL_MASK 0x7FFFFFFF
  46. #define OBJECT_FREE_BIT  0x80000000
  47.  
  48. #define OBJECT_SEAL(x) (((Energize_Extent_Data *)(x))->seal & OBJECT_SEAL_MASK)
  49. #define OBJECT_FREE(x) (((Energize_Extent_Data *)(x))->seal & OBJECT_FREE_BIT)
  50. #define SET_OBJECT_FREE(x) \
  51. { \
  52.   /* if (OBJECT_FREE (x)) \
  53.     error ("Free'ing already freed object 0x%x", x); \
  54.   ((Energize_Extent_Data *)(x))->seal |= OBJECT_FREE_BIT; \  */ \
  55.   xfree(x); \
  56. }
  57.  
  58. #define CHECK_OBJECT(x, y) \
  59. { /* if (OBJECT_FREE (x)) error ("Using freed object 0x%x", x); */ }
  60.  
  61. #define PUT_ABLE_OBJECT(x) \
  62. ((OBJECT_SEAL(x) == BUF_INFO_SEAL) || (OBJECT_SEAL(x) == EXTENT_SEAL) || \
  63.  (OBJECT_SEAL(x) == GDATA_CLASS_SEAL) || (OBJECT_SEAL(x) == GDATA_SEAL))
  64.  
  65. enum Energize_Object_Free_Type  
  66. { OFT_MAPHASH, OFT_STANDALONE, OFT_GC };
  67.  
  68. typedef struct 
  69. {
  70.   int seal;                     /* must be GDATA_CLASS_SEAL */
  71.   EId id;
  72.   short flags;
  73.   GLYPH glyph;
  74. } GDataClass;
  75.  
  76. typedef struct 
  77. {
  78.   int seal;                     /* must be GDATA_SEAL */
  79.   EId id;
  80.   GDataClass *cl;
  81.   GLYPH glyph;
  82.   short flags;
  83.   short attribute;              /* graphic attribute for extent chars */
  84.   short modified_state;
  85. } GenericData;
  86.  
  87. /* Information about each extent */
  88.  
  89. typedef struct 
  90. {
  91.   int seal;                     /* must be EXTENT_SEAL */
  92.   EId id;
  93.   int extentType;               /* oneof CEAttribute, CEAbbreviation, etc. */
  94.   Lisp_Object extent;           /* corresponding extent */
  95.   struct x_pixmap *start_pixmap;
  96.   struct x_pixmap *end_pixmap;
  97.   union
  98.     {
  99.       struct
  100.         {                       /* CEAttribute */
  101.           int attrValue;
  102.         } attr;
  103.       struct 
  104.         {                       /* CEAbbreviation */
  105.           Boolean isOpened;
  106.         } abbrev;
  107.       struct 
  108.         {                       /* CEGeneric */
  109.           GenericData* gData;
  110.         } generic;
  111.     } u;
  112. } Energize_Extent_Data;
  113.  
  114.  
  115. /* Information about each Energize buffer */
  116.  
  117. typedef struct 
  118. {
  119.   int seal;                     /* must be BUF_INFO_SEAL */
  120.   EId id;                        /* Energize id for buffer */
  121.   int flags;                    /* e.g. CBReadOnly or CBStandard */
  122.   Editor *editor;               /* corresponding editor structure */
  123.   c_hashtable id_to_object;     /* energize ids to extents, gdata & classes */
  124.   Lisp_Object emacs_buffer;     /* corresponding emacs buffer */
  125.   char    modified_state;        /* modified state as notified to Energize */
  126.   char    editable;        /* Energize authorized user to edit buffer */
  127.   Lisp_Object output_mark;      /* analog to process_mark (see process.c) */
  128.   char *buffer_type;            /* string denoting buffer type; see below */
  129.   int*    p_sheet_ids;        /* psheets associated with the buffer */
  130.   int    n_p_sheets;        /* number of p_sheets */
  131.   int*    note_ids;        /* id of opened postit notes */
  132.   int    n_notes;        /* number of notes */
  133.   Lisp_Object screen;        /* screen that was created for the buffer */
  134. } BufferInfo;
  135.  
  136. /* Buffer types */
  137. /*
  138.    Source files: SOURCE -- source_class, source_as_component_class
  139.    Projects: PROJECT -- project_class
  140.    Log Files: LOG_FILE -- log_file_class
  141.    Debugger log: DEBUGGER -- debugger_tool_class
  142.    Breakpoints: BREAKPOINT -- breaklist_class
  143.    Unix Man: UNIX_MANUAL -- unix_man_file_class
  144.    File: FILE -- lazy_file_class
  145.    Energize: ENERGIZE_BUFFER -- energize_class
  146.  
  147.    Unspecified: UNINITIALIZED_BUFFER_TYPE
  148.    Unknown: UNKNOWN_BUFFER_TYPE
  149. */
  150.  
  151. struct buffer_type_struct
  152. {
  153.   char *kernel_name;
  154.   char *elisp_name;
  155. };
  156.  
  157. static struct buffer_type_struct
  158.   kernel_buffer_types_to_elisp_buffer_types_vector[] =
  159.   { "FILE", "energize-source-buffer" }, /* #### Is this necessary? */
  160.   { "SOURCE", "energize-source-buffer" },
  161.   { "PROJECT", "energize-project-buffer" },
  162.   { "LOG_FILE", "energize-log-file-buffer" },
  163.   { "DEBUGGER", "energize-debugger-buffer" },
  164.   { "BREAKPOINT", "energize-breakpoint-buffer" },
  165.   { "UNIX_MANUAL", "energize-unix-manual-buffer" },
  166.   { "ENERGIZE_BUFFER", "energize-top-level-buffer" },
  167.   { "CADILLAC_BUFFER", "energize-top-level-buffer" }, /* #### rename me */
  168.   /* #### There needs to be a "browser" buffer type in here too */
  169.   { "POSTIT", "energize::postit-buffer-type" },
  170.   { 0 , 0 }
  171. };
  172.  
  173. #define UNINITIALIZED_BUFFER_TYPE "energize-unspecified-buffer"
  174. #define UNKNOWN_BUFFER_TYPE "energize-unknown-buffer"
  175.  
  176. Energize_Extent_Data *energize_extent_data (EXTENT);
  177. void set_energize_extent_data (EXTENT, void *);
  178.  
  179. #endif /* _EXTENTS_DATA_H_ */
  180.