81 {
"iexcl",
"\241", 0 },
82 {
"cent",
"\242", 0 },
83 {
"pound",
"\243", 0 },
84 {
"curren",
"\244", 0 },
86 {
"brvbar",
"\246", 0 },
87 {
"sect",
"\247", 0 },
89 {
"copy",
"\251", 0 },
90 {
"ordf",
"\252", 0 },
91 {
"laquo",
"\253", 0 },
95 {
"macr",
"\257", 0 },
97 {
"plusmn",
"\261", 0 },
98 {
"sup2",
"\262", 0 },
99 {
"sup3",
"\263", 0 },
100 {
"acute",
"\264", 0 },
101 {
"micro",
"\265", 0 },
102 {
"para",
"\266", 0 },
103 {
"middot",
"\267", 0 },
104 {
"cedil",
"\270", 0 },
105 {
"sup1",
"\271", 0 },
106 {
"ordm",
"\272", 0 },
107 {
"raquo",
"\273", 0 },
108 {
"frac14",
"\274", 0 },
109 {
"frac12",
"\275", 0 },
110 {
"frac34",
"\276", 0 },
111 {
"iquest",
"\277", 0 },
112 {
"Agrave",
"\300", 0 },
113 {
"Aacute",
"\301", 0 },
114 {
"Acirc",
"\302", 0 },
115 {
"Atilde",
"\303", 0 },
116 {
"Auml",
"\304", 0 },
117 {
"Aring",
"\305", 0 },
118 {
"AElig",
"\306", 0 },
119 {
"Ccedil",
"\307", 0 },
120 {
"Egrave",
"\310", 0 },
121 {
"Eacute",
"\311", 0 },
122 {
"Ecirc",
"\312", 0 },
123 {
"Euml",
"\313", 0 },
124 {
"Igrave",
"\314", 0 },
125 {
"Iacute",
"\315", 0 },
126 {
"Icirc",
"\316", 0 },
127 {
"Iuml",
"\317", 0 },
128 {
"ETH",
"\320", 0 },
129 {
"Ntilde",
"\321", 0 },
130 {
"Ograve",
"\322", 0 },
131 {
"Oacute",
"\323", 0 },
132 {
"Ocirc",
"\324", 0 },
133 {
"Otilde",
"\325", 0 },
134 {
"Ouml",
"\326", 0 },
135 {
"times",
"\327", 0 },
136 {
"Oslash",
"\330", 0 },
137 {
"Ugrave",
"\331", 0 },
138 {
"Uacute",
"\332", 0 },
139 {
"Ucirc",
"\333", 0 },
140 {
"Uuml",
"\334", 0 },
141 {
"Yacute",
"\335", 0 },
142 {
"THORN",
"\336", 0 },
143 {
"szlig",
"\337", 0 },
144 {
"agrave",
"\340", 0 },
145 {
"aacute",
"\341", 0 },
146 {
"acirc",
"\342", 0 },
147 {
"atilde",
"\343", 0 },
148 {
"auml",
"\344", 0 },
149 {
"aring",
"\345", 0 },
150 {
"aelig",
"\346", 0 },
151 {
"ccedil",
"\347", 0 },
152 {
"egrave",
"\350", 0 },
153 {
"eacute",
"\351", 0 },
154 {
"ecirc",
"\352", 0 },
155 {
"euml",
"\353", 0 },
156 {
"igrave",
"\354", 0 },
157 {
"iacute",
"\355", 0 },
158 {
"icirc",
"\356", 0 },
159 {
"iuml",
"\357", 0 },
160 {
"eth",
"\360", 0 },
161 {
"ntilde",
"\361", 0 },
162 {
"ograve",
"\362", 0 },
163 {
"oacute",
"\363", 0 },
164 {
"ocirc",
"\364", 0 },
165 {
"otilde",
"\365", 0 },
166 {
"ouml",
"\366", 0 },
167 {
"divide",
"\367", 0 },
168 {
"oslash",
"\370", 0 },
169 {
"ugrave",
"\371", 0 },
170 {
"uacute",
"\372", 0 },
171 {
"ucirc",
"\373", 0 },
172 {
"uuml",
"\374", 0 },
173 {
"yacute",
"\375", 0 },
174 {
"thorn",
"\376", 0 },
175 {
"yuml",
"\377", 0 },
183#define ESC_HASH_SIZE (sizeof(gEscSequences)/sizeof(gEscSequences[0])+7)
202 while ((
c = *zName) != 0) {
215static void EscHashStats()
233 if (cnt > max) max =
cnt;
235 printf(
"Longest chain=%d avg=%g slots=%d empty=%d (%g%%)\n",
236 max, (
double)
sum/(
double)notempty, i, i-notempty,
237 100.0*(i-notempty)/(
double)i);
322 static int isInit = 0;
330 if (z[from] ==
'&') {
331 if (z[from+1] ==
'#') {
334 while (isdigit(z[i])) {
335 v =
v*10 + z[i] -
'0';
338 if (z[i] ==
';') { i++; }
343 if (
v >= 0x80 &&
v < 0xa0) {
355 while (z[i] && isalnum(z[i])) ++i;
360 while (
p && strcmp(
p->fZName, &z[from+1]) != 0)
p =
p->fPNext;
364 for (j = 0;
p->fValue[j]; ++j) z[to++] =
p->fValue[j];
366 if (
c ==
';') from++;
376 }
else if (((
unsigned char) z[from]) >= 0x80 &&
377 ((
unsigned char) z[from]) < 0xa0) {
415 while ((
c = *zName) != 0) {
434static void HtmlHashStats() {
451 if (cnt > max) max =
cnt;
454 printf(
"longest chain=%d avg=%g slots=%d empty=%d (%g%%)\n",
455 max, (
double)
sum/(
double)notempty, i, i-notempty,
456 100.0*(i-notempty)/(
double)i);
515 if (
p->fPPrev)
p->fPPrev->fPNext = pNew;
532 case '\t':
return (iCol | 7) + 1;
533 default:
return iCol+1;
544 if (isupper(*z)) *z = tolower(*z);
581 int pIsInNoScript = 0;
582 int pIsInNoFrames = 0;
586 static char null[1] = {
"" };
591 if (inpCol < 0)
return n;
595 while ((
c = z[
n]) != 0) {
597 if (
c == -64 && z[
n+1] == -128) {
617 zEnd =
"</noscript>";
620 zEnd =
"</noframes>";
631 for (i =
n ; z[i]; i++) {
632 if (z[i] ==
'\'' || z[i] ==
'"') {
634 }
else if (z[i] ==
'\n') {
637 if (z[i] ==
'<' && z[i+1] ==
'/' &&
638 strncasecmp(&z[i], zEnd, nEnd) == 0) {
639 if (zEnd[3] ==
'c' && ((sqcnt % 2) == 1))
continue;
646 if (z[i] == 0)
goto incomplete;
656 if (pIsInScript && !pIsInNoScript && !pIsInNoFrames) {
677 z =
fZText = HtmlRealloc(z, ol+rl);
678 memmove(z +
n + rl, z+
n, ol -
n);
690 else if (isspace((
unsigned char)
c)) {
694 (
c = z[
n+i]) != 0 && isspace((
unsigned char)
c) &&
c !=
'\n' &&
c !=
'\r';
696 if (
c ==
'\r' && z[
n+i+1] ==
'\n') ++i;
698 if (pElem == 0)
goto incomplete;
702 if (
c ==
'\n' ||
c ==
'\r') {
708 int iColStart = inpCol;
710 for (j = 0; j < i; j++) {
713 pElem->
fCount = inpCol - iColStart;
720 (!isalpha(z[
n+1]) && z[
n+1] !=
'/' && z[
n+1] !=
'!' && z[
n+1] !=
'?')) {
723 for (i = 1; (
c = z[
n+i]) != 0 && !isspace((
unsigned char)
c) &&
c !=
'<'; i++) {}
724 if (
c == 0)
goto incomplete;
728 if (i >= 10 && strncasecmp(&z[
n],
"</listing>", 10) == 0) {
735 if (i >= 6 && strncasecmp(&z[
n],
"</xmp>", 6) == 0) {
742 if (i >= 11 && strncasecmp(&z[
n],
"</textarea>", 11) == 0) {
753 if (pElem == 0)
goto incomplete;
757 strncpy(tpElem->
fZText, &z[
n], i);
767 }
else if (strncmp(&z[
n],
"<!--", 4) == 0) {
770 for (i = 4; z[
n+i]; i++) {
771 if (z[
n+i] ==
'-' && strncmp(&z[
n+i],
"-->", 3) == 0)
break;
773 if (z[
n+i] == 0)
goto incomplete;
776 if (pElem == 0)
goto incomplete;
781 strncpy(tpElem->
fZText, &z[
n+4], i-4);
789 for (j = 0; j < i+3; j++) {
804 (
c = z[
n+i]) != 0 && !isspace((
unsigned char)
c) &&
c !=
'>' && (i < 2 ||
c !=
'/');
807 if (
c == 0)
goto incomplete;
811 while (isspace((
unsigned char)z[
n+i])) ++i;
812 while ((
c = z[
n+i]) != 0 &&
c !=
'>' && (
c !=
'/' || z[
n+i+1] !=
'>')) {
814 argv[argc] = &z[
n+i];
816 while ((
c = z[
n+i+j]) != 0 && !isspace((
unsigned char)
c) &&
c !=
'>' &&
817 c !=
'=' && (
c !=
'/' || z[
n+i+j+1] !=
'>')) ++j;
819 if (
c == 0)
goto incomplete;
821 while (isspace((
unsigned char)
c)) {
825 if (
c == 0)
goto incomplete;
835 while (isspace((
unsigned char)
c)) {
839 if (
c == 0)
goto incomplete;
840 if (
c ==
'\'' ||
c ==
'"') {
843 argv[argc] = &z[
n+i];
844 for (j = 0; (
c = z[
n+i+j]) != 0 &&
c != cQuote; j++) {}
845 if (
c == 0)
goto incomplete;
849 argv[argc] = &z[
n+i];
850 for (j = 0; (
c = z[
n+i+j]) != 0 && !isspace((
unsigned char)
c) &&
c !=
'>'; j++) {}
851 if (
c == 0)
goto incomplete;
856 while (isspace(z[
n+i])) ++i;
865 if (
c == 0)
goto incomplete;
866 for (j = 0; j < i+1; j++) {
877 c = argv[0][arglen[0]];
878 argv[0][arglen[0]] = 0;
881 if (strcasecmp(pMap->
fZName, argv[0]) == 0)
break;
883 argv[0][arglen[0]] =
c;
884 if (pMap == 0)
continue;
890 if (pElem == 0)
goto incomplete;
920 switch (pMap->
fType) {
984 if (selfClose && argv[0][0] !=
'/' &&
985 strcmp(&pMap[1].fZName[1], pMap->
fZName) == 0) {
989 goto makeMarkupEntry;
1007 int arglen[],
char *argv[])
1080 char *tmp =
new char[
fNAlloc];
1114 char *zType,
char *zArgs,
int offs)
1127 if (strcmp(zType,
"Text") == 0) {
1129 if (pElem == 0)
return 0;
1135 }
else if (!strcmp(zType,
"Space")) {
1137 if (pElem == 0)
return 0;
1141 if (strcasecmp(pMap->
fZName, zType) == 0)
break;
1143 if (pMap == 0)
return 0;
1144 if (zArgs == 0 || *zArgs == 0) {
1148 if (pElem == 0)
return 0;
1157 if (!SplitList(zArgs, &argc, &argv))
return 0;
1162 if (pElem == 0)
return 1;
1164 while (--argc >= 0)
if (argv[argc])
delete[] argv[argc];
1192 char *cp = 0,
c, *cp2;
1205 if (argv[2][0] ==
'b') {
1206 if (!istxt)
return 1;
1207 if (i == 0 || i ==
l)
return 1;
1216 if ((!istxt) || (!
l) || (!i)) {
1219 RemoveElements(
p,
p);
1223 RemoveElements(
p,
p);
1229 memcpy(cp+i-1, cp+i,
l-i+1);
1231 cp[--
p->fCount] = 0;
1232 if (ins.i-- <= 0) ins.i = 0;
1236 if (
c ==
'\n' ||
c ==
'\r') {
1240 int t, j, alen = strlen(argv[4]);
1245 if (
text->fZText == (
char*) ((&
text->fZText)+1)) {
1247 strcpy(cp,
text->fZText);
1250 strcpy(cp,
text->fZText);
1252 cp2 =
new char[alen+1];
1253 memcpy(cp2, argv[4], alen+1);
1256 memmove(cp+alen+i, cp+i,
l-i+1);
1257 for (j = 0; j < alen; j++) cp[i+j] = cp2[j];
1259 delete[]
text->fZText;
1261 p->fCount = strlen(cp);
1273 AddStrOffset(
p, argv[4], i);
1293 if (strcasecmp(pMap->
fZName, zType) == 0)
break;
1327 static char zBuf[200];
1342 snprintf(zBuf, 200,
"space: \"\\n\"");
1344 snprintf(zBuf, 200,
"space: \" \"");
1350 if (block->
fN > 0) {
1352 if (
n > 150)
n = 150;
1353 snprintf(zBuf, 200,
"<Block z=\"%.*s\">",
n, block->
fZ);
1367 snprintf(zBuf, 200,
"markup (%d) <%s",
p->fType, zName);
1368 for (j = 1 ; j <
p->fCount; j += 2) {
1369 snprintf(&zBuf[strlen(zBuf)], 200-strlen(zBuf),
" %s=\"%s\"",
1374 strlcat(zBuf,
">",
sizeof(zBuf));
1398 for (i = 0; i + 1 < pElem->
fCount; i += 2) {
1411 static char zBuf[200];
1418 strcpy(zBuf,
"NULL");
1436 strlcpy(zBuf, zName,
sizeof(zBuf));
1462 while (
p &&
p != pEnd) {
1468 str->
Append(
"{ Text \"");
1474 snprintf(zLine, 100,
"Space %d %d ",
1484 str->
Append(
"{ Markup ");
1493 for (i = 0; i <
p->fCount; ++i) {
1513 for (
p =
first;
p != last;
p =
p->fPNext) {
1516 const char *z = block->
fZ;
1518 if (
n == 0 || z == 0) {
1522 printf(
"Block flags=%02x cnt=%d x=%d..%d y=%d..%d z=\"%.*s\"\n",
1526 printf(
"Token font=%2d color=%2d align=%d flags=0x%04x name=%s\n",
1527 p->fStyle.fFont,
p->fStyle.fColor,
void HtmlTranslateEscapes(char *z)
Translate escape sequences in the string "z".
void ToLower(char *z)
Convert a string to all lower-case letters.
static int EscHash(const char *zName)
static int HtmlHash(const char *zName)
static int NextColumn(int iCol, char c)
Compute the new column index following the given character.
static SHtmlTokenMap_t * gApMap[HTML_MARKUP_HASH_SIZE]
void HtmlTranslateEscapes(char *z)
Translate escape sequences in the string "z".
SHtmlTokenMap_t HtmlMarkupMap[]
static struct SgEsc_t gEscSequences[]
static void HtmlHashInit(void)
static struct SgEsc_t * gApEscHash[(sizeof(gEscSequences)/sizeof(gEscSequences[0])+7)]
#define HTML_MARKUP_HASH_SIZE
#define HTML_MARKUP_COUNT
#define O_HtmlImageMarkup
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char text
TGString * ListTokens(TGHtmlElement *p, TGHtmlElement *pEnd)
Return all tokens between the two elements as a string list.
void AppToken(TGHtmlElement *pNew, TGHtmlElement *p, int offs)
Insert token pNew before token p.
int TextInsertCmd(int argc, char **argv)
Insert text into text token, or break token into two text tokens.
void TokenizerAppend(const char *text)
Append text to the tokenizer engine.
void AddStyle(TGHtmlElement *p)
This routine adds information to the input texts that doesn't change when the display is resized or w...
virtual char * ProcessScript(TGHtmlScript *)
TGHtmlElement * InsertToken(TGHtmlElement *pToken, char *zType, char *zArgs, int offs)
This routine takes a text representation of a token, converts it into an TGHtmlElement object and ins...
const char * TypeToName(int type)
Convert a type into a symbolic name.
int Tokenize()
Process as much of the input HTML as possible.
int NameToType(char *zType)
Convert a markup name into a type integer.
void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem)
Append all the arguments of the given markup to the given TGString.
void AppendElement(TGHtmlElement *pElem)
Append the given TGHtmlElement to the tokenizers list of elements.
virtual int ProcessToken(TGHtmlElement *, const char *, int)
TGHtmlMarkupElement * MakeMarkupEntry(int objType, int type, int argc, int arglen[], char *argv[])
Make one markup entry.
SHtmlTokenMap_t * GetMarkupMap(int n)
Returns token map at location n.
SHtmlTokenMap_t * NameToPmap(char *zType)
Returns token map matching zType name.
char * DumpToken(TGHtmlElement *p)
For debugging purposes, print information about a token.
char * GetTokenName(TGHtmlElement *p)
Returns token name of html element p.
int GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex)
This routine decodes a complete index specification.
void PrintList(TGHtmlElement *first, TGHtmlElement *last)
Print a list of tokens.
void AddFormInfo(TGHtmlElement *p)
Add the DOM control information for form elements.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
TString & Append(const char *cs)
SHtmlTokenMap_t * fPCollide
static uint64_t sum(uint64_t i)