File: HText.h

package info (click to toggle)
cern-httpd 3.0A-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,392 kB
  • ctags: 6,554
  • sloc: ansic: 37,902; makefile: 1,746; perl: 535; csh: 167; sh: 143
file content (309 lines) | stat: -rw-r--r-- 8,398 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*                                                           Rich Hypertext object for libWWW
                                  RICH HYPERTEXT OBJECT
                                             
 */

/*

   This is the C interface to the Objective-C (or whatever) Style-oriented HyperText
   class. It is used when a style-oriented text object is available or craeted in order to
   display hypertext.
   
 */
#ifndef HTEXT_H
#define HTEXT_H
#include "HTAnchor.h"
#include "HTStyle.h"
#include "HTStream.h"
#include "SGML.h"

#ifdef SHORT_NAMES
#define HTMainText                      HTMaText
#define HTMainAnchor                    HtMaAnch
#define HText_new                       HTHTNew
#define HText_new2                      HTHTNew2
#define HText_free                      HTHTFree
#define HText_beginAppend               HTHTBeAp
#define HText_endAppend                 HTHTEnAp
#define HText_setStyle                  HTHTSeSt
#define HText_appendCharacter           HTHTApCh
#define HText_appendImage               HTHTApIm
#define HText_appendText                HTHTApTe
#define HText_appendParagraph           HTHTApPa
#define HText_beginAnchor               HTHTBeAn
#define HText_endAnchor                 HTHTEnAn
#define HText_dump                      HTHTDump
#define HText_nodeAnchor                HTHTNoAn
#define HText_select                    HTHTSele
#define HText_selectAnchor              HTHTSeAn
#define HText_applyStyle                HTHTApSt
#define HText_updateStyle               HTHTUpSt
#define HText_selectionStyle            HTHTStyl
#define HText_replaceSel                HTHTRepl
#define HText_applyToSimilar            HTHTApTo
#define HText_selectUnstyled            HTHTSeUn
#define HText_unlinkSelection           HTHTUnSe
#define HText_linkSelTo                 HTHTLiSe
#define HText_referenceSelected         HTHTRefS
#endif

#ifndef THINK_C
#ifndef HyperText               /* Objective C version defined HyperText */
typedef struct _HText HText;    /* Normal Library */
#else
@class HText;                   /* Objective C version for NeXTStep */
#endif
#else
class CHyperText;               /* Mac Think-C browser hook */
typedef CHyperText HText;
#endif

extern HText * HTMainText;              /* Pointer to current main text */
extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */

/*

Creation and deletion

  HTEXT_NEW: CREATE HYPERTEXT OBJECT
  
   There are several methods depending on how much you want to specify. The output stream
   is used with objects which need to output the hypertext to a stream.  The structure is
   for objects which need to refer to the structure which is kep by the creating stream.
   
 */
 extern HText * HText_new PARAMS((HTParentAnchor *      anchor));

 extern HText * HText_new2 PARAMS((HTParentAnchor *     anchor,
                                HTStream *              output_stream));

 extern HText * HText_new3 PARAMS((HTRequest *          request,
                                HTStream *              output_stream,
                                HTStructured *          structure));

/*

  FREE HYPERTEXT OBJECT
  
 */
extern void     HText_free PARAMS((HText * me));


/*

Object Building methods

   These are used by a parser to build the text in an object HText_beginAppend must be
   called, then any combination of other append calls, then HText_endAppend. This allows
   optimised handling using buffers and caches which are flushed at the end.
   
 */
extern void HText_beginAppend PARAMS((HText * text));

extern void HText_endAppend PARAMS((HText * text));

/*

  SET THE STYLE FOR FUTURE TEXT
  
 */

extern void HText_setStyle PARAMS((HText * text, HTStyle * style));

/*

  ADD ONE CHARACTER
  
 */
extern void HText_appendCharacter PARAMS((HText * text, char ch));

/*

  ADD A ZERO-TERMINATED STRING
  
 */

extern void HText_appendText PARAMS((HText * text, CONST char * str));

/*

  NEW PARAGRAPH
  
   and similar things
   
 */
extern void HText_appendParagraph PARAMS((HText * text));

extern void HText_appendLineBreak PARAMS((HText * text));

extern void HText_appendHorizontalRule PARAMS((HText * text));



/*

  START/END SENSITIVE TEXT
  
 */

/*

   The anchor object is created and passed to HText_beginAnchor. The senstive text is
   added to the text object, and then HText_endAnchor is called. Anchors may not be
   nested.
   
 */
extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
extern void HText_endAnchor PARAMS((HText * text));


/*

  SET THE NEXT FREE IDENTIFIER
  
   The string must be of the form aaannnnn where aaa is the prefix for automatically
   generated ids, normally "z", and nnnn is the next unused number.  If not present,
   defaults to z0.  An editor should pick up both the a and n bits, and increment n when
   generating ids. This ensures that old ids are not reused, even if the elements using
   them have been deleted from the document.
   
 */

extern void HText_setNextId PARAMS((
        HText *         text,
        CONST char *    s));

/*

  APPEND AN INLINE IMAGE
  
   The image is handled by the creation of an anchor whose destination is the image
   document to be included. The semantics is the intended inline display of the image.
   
   An alternative implementation could be, for example, to begin an anchor, append the
   alternative text or "IMAGE", then end the anchor. This would simply generate some text
   linked to the image itself as a separate document.
   
 */
extern void HText_appendImage PARAMS((
        HText *         text,
        HTChildAnchor * anc,
        CONST char *    alternative_text,
        CONST char *    alignment,
        BOOL            isMap));

/*

  HTEXT_APPENDOBJECT:  APPEND AN OBJECT WHICH DOES ITS OWN WORK
  
   The SGML parameters are passed untouched. Currently this is only used for empty
   elements.  Extensions could be (1) to pass CDATA contents as well as any attributes and
   (2) to pass the whole structured stream until the compound object has parsed itself.
   
 */
extern void HText_appendObject PARAMS((
        HText *                 text,
        int                     element_number,
        CONST BOOL *            present,
        CONST char * CONST *    value));

/*

  HTEXT_UNIMPLEMENTED: WARN THAT OBJECT IS NOT COMPLETELY RENDERED.
  
   If the parser realises that it has incompletely parsed an object, then it can call this
   to flag it to the object.  This will for example prevent editing or writing back.
   
 */
extern void HText_unimplemented PARAMS((
        HText *         text));


/*

Utilities

  DUMP DIAGNOSTICS TO STDERR
  
 */

extern void HText_dump PARAMS((HText * me));

/*

  RETURN THE ANCHOR ASSOCIATED WITH THIS NODE
  
 */
extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));


/*

Browsing functions

 */


/*

  BRING TO FRONT AND HIGHLIGHT IT
  
 */


extern BOOL HText_select PARAMS((HText * text));
extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));

/*

Editing functions

   These are called from the application. There are many more functions not included here
   from the orginal text object. These functions NEED NOT BE IMPLEMENTED in a browser
   which cannot edit.
   
 */
/*      Style handling:
*/
/*      Apply this style to the selection
*/
extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));

/*      Update all text with changed style.
*/
extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));

/*      Return style of  selection
*/
extern HTStyle * HText_selectionStyle PARAMS((
        HText * me,
        HTStyleSheet* sheet));

/*      Paste in styled text
*/
extern void HText_replaceSel PARAMS((HText * me,
        CONST char *aString,
        HTStyle* aStyle));

/*      Apply this style to the selection and all similarly formatted text
**      (style recovery only)
*/
extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));

/*      Select the first unstyled run.
**      (style recovery only)
*/
extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));


/*      Anchor handling:
*/
extern void             HText_unlinkSelection PARAMS((HText * me));
extern HTAnchor *       HText_referenceSelected PARAMS((HText * me));
extern HTAnchor *       HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));


#endif /* HTEXT_H */
/*

   end */