0
|
1 /****************************************************************************
|
|
2 ***
|
|
3 *** Copyright (c) 1990 by Sun/Lucid, All Rights Reserved.
|
|
4 *** Copyright (c) 1991-1993 by Lucid, Inc. All Rights Reserved.
|
|
5 ***
|
|
6 *****************************************************************************/
|
|
7
|
|
8 /* Synched up with: Not in FSF. */
|
|
9 #ifndef _XEMACS_ENERGIZE_H_
|
|
10 #define _XEMACS_ENERGIZE_H_
|
|
11
|
|
12 #ifndef ENERGIZE
|
|
13 ERROR! energize.h is an Energize-only file
|
|
14 #endif
|
|
15
|
|
16 #include <connection.h>
|
|
17 #include <editorreq.h>
|
|
18 #include <editorconn.h>
|
|
19 #include <editoption.h>
|
|
20 #include <request.h>
|
|
21
|
|
22 #include "hash.h"
|
|
23 #include "extents.h"
|
|
24
|
|
25 /* Product name... */
|
|
26 #ifndef NCR486
|
|
27 # define IDENTITY_CRISIS "Energize"
|
|
28 #else
|
|
29 # define IDENTITY_CRISIS "C++ Workbench"
|
|
30 #endif
|
|
31
|
|
32 /* This represents the emacs connection to the Energize server.
|
|
33 */
|
|
34 typedef struct {
|
|
35 Connection* conn; /* connection to Energize */
|
|
36 Lisp_Object proc; /* Emacs process */
|
|
37 c_hashtable binfo_hash; /* hashtable for buffers */
|
|
38 Lisp_Object gc_save; /* Objects saved for GC */
|
|
39 int major; /* protocol version number */
|
|
40 int minor;
|
|
41 c_hashtable image_table; /* glyphs table */
|
|
42 } Editor;
|
|
43
|
|
44
|
|
45 typedef BITS32 EId; /* Energize id */
|
|
46
|
|
47 /* In general, we keep positions in Energize form in our data structures,
|
|
48 and only convert to Emacs positions as needed for Emacs operations. */
|
|
49 typedef BITS32 EnergizePos; /* Energize position = (Emacs position-1) */
|
|
50
|
|
51
|
|
52
|
|
53 /* Generic extent data and classes
|
|
54 This "seal" junk is a completely bogus data type system that should be
|
|
55 replaced with something implemented using Lisp_Records.
|
|
56 */
|
|
57 #define GDATA_CLASS_SEAL 0x12345678
|
|
58 #define GDATA_SEAL 0x67654321
|
|
59 #define EXTENT_SEAL 0x45612378
|
|
60 #define DUP_SEAL 0x13524768
|
|
61 #define BUF_INFO_SEAL 0x5F7F6F5F
|
|
62 #define OBJECT_SEAL_MASK 0x7FFFFFFF
|
|
63 #define OBJECT_FREE_BIT 0x80000000
|
|
64
|
|
65 #define OBJECT_SEAL(x) (((Energize_Extent_Data *)(x))->seal & OBJECT_SEAL_MASK)
|
|
66 #define OBJECT_FREE(x) (((Energize_Extent_Data *)(x))->seal & OBJECT_FREE_BIT)
|
|
67 #define SET_OBJECT_FREE(x) \
|
|
68 { \
|
|
69 /* if (OBJECT_FREE (x)) \
|
|
70 error ("Free'ing already freed object 0x%x", x); \
|
|
71 ((Energize_Extent_Data *)(x))->seal |= OBJECT_FREE_BIT; \ */ \
|
|
72 xfree(x); \
|
|
73 }
|
|
74
|
|
75 #define CHECK_OBJECT(x) \
|
|
76 { /* if (OBJECT_FREE (x)) error ("Using freed object 0x%x", x); */ }
|
|
77
|
|
78 #define PUT_ABLE_OBJECT(x) \
|
|
79 ((OBJECT_SEAL(x) == BUF_INFO_SEAL) || (OBJECT_SEAL(x) == EXTENT_SEAL) || \
|
|
80 (OBJECT_SEAL(x) == GDATA_CLASS_SEAL) || (OBJECT_SEAL(x) == GDATA_SEAL))
|
|
81
|
|
82 enum Energize_Object_Free_Type
|
|
83 { OFT_MAPHASH, OFT_STANDALONE, OFT_GC };
|
|
84
|
|
85 typedef struct
|
|
86 {
|
|
87 int seal; /* must be GDATA_CLASS_SEAL */
|
|
88 EId id;
|
|
89 short flags;
|
|
90 GLYPH glyph;
|
|
91 } GDataClass;
|
|
92
|
|
93 typedef struct
|
|
94 {
|
|
95 int seal; /* must be GDATA_SEAL */
|
|
96 EId id;
|
|
97 GDataClass *cl;
|
|
98 GLYPH glyph;
|
|
99 short flags;
|
|
100 short attribute; /* graphic attribute for extent chars */
|
|
101 short modified_state;
|
|
102 } GenericData;
|
|
103
|
|
104
|
|
105 #ifdef I18N4
|
|
106
|
|
107 typedef struct
|
|
108 {
|
|
109 Bufpos pos, endpos; /* emacs buffer start & end positions */
|
|
110 int eucsize; /* number of EUC bytes to encode */
|
|
111 } WCharMapRec;
|
|
112
|
|
113 typedef struct
|
|
114 {
|
|
115 int valid; /* flag */
|
|
116 int modiff_stamp; /* val of BUF_MODIFF(buffer) at last update */
|
|
117 int mapsize; /* number of elements in wc_map */
|
|
118 WCharMapRec *map; /* where's the beef? */
|
|
119 } WCharSizeTable;
|
|
120
|
|
121 #endif
|
|
122
|
|
123
|
|
124 /* Internal, Energize-specific information about each Energize-created extent.
|
|
125 */
|
|
126
|
|
127 typedef struct Energize_Extent_Data
|
|
128 {
|
|
129 int seal; /* must be EXTENT_SEAL */
|
|
130 EId id;
|
|
131 int extentType; /* oneof CEAttribute, CEAbbreviation, etc. */
|
|
132 Lisp_Object extent; /* corresponding extent (never nil) */
|
|
133 struct x_pixmap *start_pixmap;
|
|
134 struct x_pixmap *end_pixmap;
|
|
135 int warn_modify;
|
|
136 union
|
|
137 {
|
|
138 struct
|
|
139 { /* CEAttribute */
|
|
140 int attrValue;
|
|
141 } attr;
|
|
142 struct
|
|
143 { /* CEAbbreviation */
|
|
144 Boolean isOpened;
|
|
145 } abbrev;
|
|
146 struct
|
|
147 { /* CEGeneric */
|
|
148 GenericData* gData;
|
|
149 } generic;
|
|
150 } u;
|
|
151 } Energize_Extent_Data;
|
|
152
|
|
153
|
|
154 /* Internal, Energize-specific information about each Energize-created buffer.
|
|
155 */
|
|
156
|
|
157 typedef struct
|
|
158 {
|
|
159 int seal; /* must be BUF_INFO_SEAL */
|
|
160 EId id; /* Energize id for buffer */
|
|
161 int flags; /* e.g. CBReadOnly or CBStandard */
|
|
162 Editor *editor; /* corresponding editor structure */
|
|
163 c_hashtable id_to_object; /* energize ids to extents, gdata & classes */
|
|
164 Lisp_Object emacs_buffer; /* corresponding emacs buffer */
|
|
165 char modified_state; /* modified state as notified to Energize */
|
|
166 char editable; /* Energize authorized user to edit buffer */
|
|
167 Lisp_Object output_mark; /* analog to process_mark (see process.c) */
|
|
168 char *buffer_type; /* string denoting buffer type; see below */
|
|
169 int* p_sheet_ids; /* psheets associated with the buffer */
|
|
170 int n_p_sheets; /* number of p_sheets */
|
|
171 int* note_ids; /* id of opened postit notes */
|
|
172 int n_notes; /* number of notes */
|
|
173 Lisp_Object frame; /* frame that was created for the buffer */
|
|
174 #ifdef I18N4
|
|
175 WCharSizeTable wcmap; /* for char_offset <-> buffer_pos xlation */
|
|
176 #endif
|
|
177 } BufferInfo;
|
|
178
|
|
179 /* "Types" of buffers, according to the Energize server.
|
|
180
|
|
181 Source files: SOURCE source_class, source_as_component_class
|
|
182 Projects: PROJECT project_class
|
|
183 Log Files: LOG_FILE log_file_class
|
|
184 Debugger log: DEBUGGER debugger_tool_class
|
|
185 Breakpoints: BREAKPOINT breaklist_class
|
|
186 Unix Man: UNIX_MANUAL unix_man_file_class (no longer used?)
|
|
187 File: FILE lazy_file_class
|
|
188 Energize: ENERGIZE_BUFFER energize_class
|
|
189
|
|
190 Unspecified: UNINITIALIZED_BUFFER_TYPE
|
|
191 Unknown: UNKNOWN_BUFFER_TYPE
|
|
192
|
|
193 There should be a BROWSER type as well, but there isn't, so we have
|
|
194 a kludge to fake it up in lisp.
|
|
195 */
|
|
196
|
|
197 struct buffer_type_struct
|
|
198 {
|
|
199 char *kernel_name;
|
|
200 char *elisp_name;
|
|
201 };
|
|
202
|
|
203 static struct buffer_type_struct
|
|
204 kernel_buffer_types_to_elisp_buffer_types_vector[] =
|
|
205 {
|
|
206 { "FILE", "energize-source-buffer" }, /* #### Is this necessary? */
|
|
207 { "SOURCE", "energize-source-buffer" },
|
|
208 { "PROJECT", "energize-project-buffer" },
|
|
209 { "LOG_FILE", "energize-log-file-buffer" },
|
|
210 { "DEBUGGER", "energize-debugger-buffer" },
|
|
211 { "BREAKPOINT", "energize-breakpoint-buffer" },
|
|
212 { "UNIX_MANUAL", "energize-unix-manual-buffer" },
|
|
213 { "ENERGIZE_BUFFER", "energize-top-level-buffer" },
|
|
214 /* { "CADILLAC_BUFFER", "energize-top-level-buffer" }, /* #### rename me */
|
|
215 /* { "POSTIT", "energize-postit-buffer-type" }, */
|
|
216 /* #### There needs to be a "browser" buffer type in here too */
|
|
217 { 0 , 0 }
|
|
218 };
|
|
219
|
|
220 #define UNINITIALIZED_BUFFER_TYPE "energize-unspecified-buffer"
|
|
221 #define UNKNOWN_BUFFER_TYPE "energize-unknown-buffer"
|
|
222
|
|
223 Energize_Extent_Data *energize_extent_data (EXTENT);
|
|
224
|
|
225 #endif /* _XEMACS_ENERGIZE_H_ */
|