File: HTStyle.html

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 (213 lines) | stat: -rw-r--r-- 6,297 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
<HTML>
<HEAD>
<TITLE>HTStyle: Style management for libwww</TITLE></HEAD>
<BODY>

<H1>Style Definition for Hypertext</H1>Styles allow the translation
between a logical property of a piece of text and its physical
representation.<P> A StyleSheet is a collection of styles, defining
the translation necessary to represent a document. It is a linked list
of styles.

<H2>Overriding this module</H2>

Why is the style structure declared in the HTStyle.h module, instead
of having the user browser define the structure, and the HTStyle
routines just use sizeof() for copying?<P>

It's not obvious whether HTStyle.c should be common code.  It's useful
to have common code for loading style sheets, especially if the
movement toward standard style sheets gets going.<P>

If it <B>is</B> common code, then both the hypertext object and
HTStyle.c must know the structure of a style, so HTStyle.h is a
suitable place to put that.<P>

If we take it out of the library, then of course HTStyle could be
declared as an undefined structure. The only references to it are in
the structure-flattening code HTML.c and HTPlain.c, which only use
HTStypeNamed().<P>

You can in any case override this function in your own code, which
will prevent the HTStyle from being loaded.  You will be able to
redefine your style structure in this case without problems, as no
other moule needs to know it.

<PRE>
#ifndef HTStyle_H
#define HTStyle_H

#include "HTUtils.h"
#include "HTFormat.h"
#include "HTAnchor.h"
#include "HTML.h"

typedef long int HTFont;	/* Dummy definition instead */



#ifdef SHORT_NAMES
#define HTStyleNew			HTStNew
#define HTStyleFree			HTStFree
#define HTStyleRead			HTStRead
#define HTStyleWrite			HTStWrite
#define HTStyleSheetNew			HTStShNe
#define HTStyleSheetFree		HTStShFr
#define HTStyleNamed			HTStName
#define HTStyleForParagraph		HTStFoPa
#define HTStyleMatching			HTStMatc
#define HTStyleForRun			HTStFoRu
#define HTStyleSheetAddStyle		HTStShAd
#define HTStyleSheetRemoveStyle		HTStShRm
#define HTStyleSheetRead		HTStShRe
#define HTStyleSheetWrite		HTStShWr
#endif

#ifdef DEFINE_STRUCT_HTSTYLE
#ifdef NeXT_suppressed
#include &lt;appkit/appkit.h>
typedef NXCoord HTCoord;
#define HTParagraphStyle NXTextStyle
#define HTCoord NXCoord
typedef struct _color {
	float	grey;
	int	RGBColor;
} HTColor;
#else

typedef float HTCoord;

typedef struct _HTParagraphStyle {
    HTCoord	left_indent;		/* @@@@ junk! etc etc*/
} HTParagraphStyle;

typedef int HTColor;		/* Sorry about the US spelling! */

#endif

typedef struct {
    short           	kind;		/* only NX_LEFTTAB implemented*/
    HTCoord         	position;	/* x coordinate for stop */
} HTTabStop;

#else
typedef struct _HTParagraphStyle HTParagraphStyle;
#endif



#define STYLE_NAME_LENGTH	80	/* @@@@@@@@@@@ */
	 

/*	The Style Structure
**	-------------------
*/

typedef struct _HTStyle
#ifdef DEFINE_STRUCT_HTSTYLE		/* Don't */
 {

/*	Style management information
*/
    struct _HTStyle	*next;		/* Link for putting into stylesheet */
    char *		name;		/* Style name */
    char *		SGMLTag;	/* Tag name to start */


/*	Character attributes	(a la NXRun)
*/
    HTFont 	    	font;		/* Font id */
    HTCoord		fontSize;	/* The size of font, not independent */
    HTColor	    	color;	/* text gray of current run */
    int   		superscript;	/* superscript (-sub) in points */

    HTAnchor		*anchor;	/* Anchor id if any, else zero */

/*	Paragraph Attribtes	(a la NXTextStyle)
*/
    HTCoord		indent1st;	/* how far first line in paragraph is
				 * indented */
    HTCoord		leftIndent;	/* how far second line is indented */
    HTCoord		rightIndent;	/* (Missing from NeXT version */
    short       	alignment;	/* quad justification */
    HTCoord		lineHt;		/* line height */
    HTCoord     	descentLine;	/* descender bottom from baseline */
    HTTabStop   	*tabs;		/* array of tab stops, 0 terminated */

    BOOL		wordWrap;	/* Yes means wrap at space not char */
    BOOL		freeFormat;	/* Yes means \n is just white space */
    HTCoord		spaceBefore;	/* Omissions from NXTextStyle */
    HTCoord		spaceAfter;
    int			paraFlags;	/* Paragraph flags, bits as follows: */

#define PARA_KEEP	1	/* Do not break page within this paragraph */
#define	PARA_WITH_NEXT	2	/* Do not break page after this paragraph */

#define HT_JUSTIFY 0		/* For alignment */
#define HT_LEFT	1
#define HT_RIGHT 2
#define HT_CENTER 3
  
}
#endif
 HTStyle;

</pre>
<h2>Style Creation</h2>
<h3>HtStyleModify</h3>
This routine is passed the style for a particular SGML nesting state,
and the element number of a new element whithin that state.
The routine returns a suitable style for text within the new element.
It is passed a popinter tothe nesting state so that it can link
the style back to the nesting state for later manipulation
of the SGML nesting tree.
<pre>

extern HTStyle * HTStyleModify PARAMS((
		HTStyle * 	style, 
		HTNesting* 	nesting,
                int 		element_number));



/*	Style functions:
*/
extern HTStyle * HTStyleNew NOPARAMS;
extern HTStyle* HTStyleNewNamed PARAMS ((CONST char * name));
extern HTStyle * HTStyleFree PARAMS((HTStyle * self));
#ifdef SUPRESS
extern HTStyle * HTStyleRead PARAMS((HTStyle * self, HTStream * stream));
extern HTStyle * HTStyleWrite PARAMS((HTStyle * self, HTStream * stream));
#endif
/*		Style Sheet
**		-----------
*/
typedef struct _HTStyleSheet {
	char *		name;
	HTStyle *	styles;
} HTStyleSheet;


/*	Stylesheet functions:
*/
extern HTStyleSheet * HTStyleSheetNew NOPARAMS;
extern HTStyleSheet * HTStyleSheetFree PARAMS((HTStyleSheet * self));
extern HTStyle * HTStyleNamed PARAMS((HTStyleSheet * self, CONST char * name));
extern HTStyle * HTStyleMatching PARAMS((HTStyleSheet *self, HTStyle * style));
/* extern HTStyle * HTStyleForRun PARAMS((HTStyleSheet *self, NXRun * run)); */
extern HTStyleSheet * HTStyleSheetAddStyle PARAMS((HTStyleSheet * self,
	HTStyle * style));
extern HTStyleSheet * HTStyleSheetRemoveStyle PARAMS((HTStyleSheet * self,
	HTStyle * style));
#ifdef SUPPRESS
extern HTStyleSheet * HTStyleSheetRead PARAMS((HTStyleSheet * self,
						HTStream * stream));
extern HTStyleSheet * HTStyleSheetWrite PARAMS((HTStyleSheet * self,
						HTStream * stream));
#endif
#define CLEAR_POINTER ((void *)-1)	/* Pointer value means "clear me" */
#endif /* HTStyle_H */


</BODY>
</HTML>