From cbeb0b26e4c7caa8d1b47de791a7418dc20a4567 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 1 Apr 2006 19:24:03 +0000 Subject: Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. --- src/libhtml/build.c | 656 ++++++++++++++++++++++++------------------------ src/libhtml/impl.h | 34 +-- src/libhtml/lex.c | 226 ++++++++--------- src/libhtml/runetab.h | 2 +- src/libhtml/strinttab.c | 16 +- src/libhtml/utils.c | 116 ++++----- 6 files changed, 526 insertions(+), 524 deletions(-) (limited to 'src/libhtml') diff --git a/src/libhtml/build.c b/src/libhtml/build.c index 7cae15d4..c65918c2 100644 --- a/src/libhtml/build.c +++ b/src/libhtml/build.c @@ -5,45 +5,45 @@ #include #include "impl.h" -// A stack for holding integer values +/* A stack for holding integer values */ enum { - Nestmax = 40 // max nesting level of lists, font styles, etc. + Nestmax = 40 /* max nesting level of lists, font styles, etc. */ }; struct Stack { - int n; // next available slot (top of stack is stack[n-1]) - int slots[Nestmax]; // stack entries + int n; /* next available slot (top of stack is stack[n-1]) */ + int slots[Nestmax]; /* stack entries */ }; -// Parsing state +/* Parsing state */ struct Pstate { - Pstate* next; // in stack of Pstates - int skipping; // true when we shouldn't add items - int skipwhite; // true when we should strip leading space - int curfont; // font index for current font - int curfg; // current foreground color - Background curbg; // current background - int curvoff; // current baseline offset - uchar curul; // current underline/strike state - uchar curjust; // current justify state - int curanchor; // current (href) anchor id (if in one), or 0 - int curstate; // current value of item state - int literal; // current literal state - int inpar; // true when in a paragraph-like construct - int adjsize; // current font size adjustment - Item* items; // dummy head of item list we're building - Item* lastit; // tail of item list we're building - Item* prelastit; // item before lastit - Stack fntstylestk; // style stack - Stack fntsizestk; // size stack - Stack fgstk; // text color stack - Stack ulstk; // underline stack - Stack voffstk; // vertical offset stack - Stack listtypestk; // list type stack - Stack listcntstk; // list counter stack - Stack juststk; // justification stack - Stack hangstk; // hanging stack + Pstate* next; /* in stack of Pstates */ + int skipping; /* true when we shouldn't add items */ + int skipwhite; /* true when we should strip leading space */ + int curfont; /* font index for current font */ + int curfg; /* current foreground color */ + Background curbg; /* current background */ + int curvoff; /* current baseline offset */ + uchar curul; /* current underline/strike state */ + uchar curjust; /* current justify state */ + int curanchor; /* current (href) anchor id (if in one), or 0 */ + int curstate; /* current value of item state */ + int literal; /* current literal state */ + int inpar; /* true when in a paragraph-like construct */ + int adjsize; /* current font size adjustment */ + Item* items; /* dummy head of item list we're building */ + Item* lastit; /* tail of item list we're building */ + Item* prelastit; /* item before lastit */ + Stack fntstylestk; /* style stack */ + Stack fntsizestk; /* size stack */ + Stack fgstk; /* text color stack */ + Stack ulstk; /* underline stack */ + Stack voffstk; /* vertical offset stack */ + Stack listtypestk; /* list type stack */ + Stack listcntstk; /* list counter stack */ + Stack juststk; /* justification stack */ + Stack hangstk; /* hanging stack */ }; struct ItemSource @@ -60,23 +60,23 @@ struct ItemSource Kidinfo* kidstk; }; -// Some layout parameters +/* Some layout parameters */ enum { - FRKIDMARGIN = 6, // default margin around kid frames - IMGHSPACE = 0, // default hspace for images (0 matches IE, Netscape) - IMGVSPACE = 0, // default vspace for images - FLTIMGHSPACE = 2, // default hspace for float images - TABSP = 5, // default cellspacing for tables - TABPAD = 1, // default cell padding for tables - LISTTAB = 1, // number of tabs to indent lists - BQTAB = 1, // number of tabs to indent blockquotes - HRSZ = 2, // thickness of horizontal rules - SUBOFF = 4, // vertical offset for subscripts - SUPOFF = 6, // vertical offset for superscripts - NBSP = 160 // non-breaking space character + FRKIDMARGIN = 6, /* default margin around kid frames */ + IMGHSPACE = 0, /* default hspace for images (0 matches IE, Netscape) */ + IMGVSPACE = 0, /* default vspace for images */ + FLTIMGHSPACE = 2, /* default hspace for float images */ + TABSP = 5, /* default cellspacing for tables */ + TABPAD = 1, /* default cell padding for tables */ + LISTTAB = 1, /* number of tabs to indent lists */ + BQTAB = 1, /* number of tabs to indent blockquotes */ + HRSZ = 2, /* thickness of horizontal rules */ + SUBOFF = 4, /* vertical offset for subscripts */ + SUPOFF = 6, /* vertical offset for superscripts */ + NBSP = 160 /* non-breaking space character */ }; -// These tables must be sorted +/* These tables must be sorted */ static StringInt *align_tab; static AsciiInt _align_tab[] = { {"baseline", ALbaseline}, @@ -147,7 +147,7 @@ static char* _roman[15]= { }; #define NROMAN 15 -// List number types +/* List number types */ enum { LTdisc, LTsquare, LTcircle, LT1, LTa, LTA, LTi, LTI }; @@ -159,11 +159,11 @@ enum { BLBA = (BL|SPBefore|SPAfter) }; -// blockbrk[tag] is break info for a block level element, or one -// of a few others that get the same treatment re ending open paragraphs -// and requiring a line break / vertical space before them. -// If we want a line of space before the given element, SPBefore is OR'd in. -// If we want a line of space after the given element, SPAfter is OR'd in. +/* blockbrk[tag] is break info for a block level element, or one */ +/* of a few others that get the same treatment re ending open paragraphs */ +/* and requiring a line break / vertical space before them. */ +/* If we want a line of space before the given element, SPBefore is OR'd in. */ +/* If we want a line of space after the given element, SPAfter is OR'd in. */ static uchar blockbrk[Numtags]= { /*Notfound*/ 0, @@ -268,8 +268,8 @@ enum { AGEN = 1 }; -// attrinfo is information about attributes. -// The AGEN value means that the attribute is generic (applies to almost all elements) +/* attrinfo is information about attributes. */ +/* The AGEN value means that the attribute is generic (applies to almost all elements) */ static uchar attrinfo[Numattrs]= { /*Aabbr*/ 0, /*Aaccept_charset*/ 0, @@ -508,7 +508,7 @@ static uchar scriptev[Numattrs]= { /*Awidth*/ 0, }; -// Color lookup table +/* Color lookup table */ static StringInt *color_tab; static AsciiInt _color_tab[] = { {"aqua", 0x00FFFF}, @@ -691,11 +691,11 @@ newitemsource(Docinfo* di) static Item *getitems(ItemSource* is, uchar* data, int datalen); -// Parse an html document and create a list of layout items. -// Allocate and return document info in *pdi. -// When caller is done with the items, it should call -// freeitems on the returned result, and then -// freedocinfo(*pdi). +/* Parse an html document and create a list of layout items. */ +/* Allocate and return document info in *pdi. */ +/* When caller is done with the items, it should call */ +/* freeitems on the returned result, and then */ +/* freedocinfo(*pdi). */ Item* parsehtml(uchar* data, int datalen, Rune* pagesrc, int mtype, int chset, Docinfo** pdi) { @@ -716,10 +716,10 @@ parsehtml(uchar* data, int datalen, Rune* pagesrc, int mtype, int chset, Docinfo return it; } -// Get a group of tokens for lexer, parse them, and create -// a list of layout items. -// When caller is done with the items, it should call -// freeitems on the returned result. +/* Get a group of tokens for lexer, parse them, and create */ +/* a list of layout items. */ +/* When caller is done with the items, it should call */ +/* freeitems on the returned result. */ static Item* getitems(ItemSource* is, uchar* data, int datalen) { @@ -796,7 +796,7 @@ getitems(ItemSource* is, uchar* data, int datalen) if(!buildinited) buildinit(); - doscripts = 0; // for now + doscripts = 0; /* for now */ ps = is->psstk; curtab = is->tabstk; di = is->doc; @@ -826,15 +826,15 @@ getitems(ItemSource* is, uchar* data, int datalen) ps->inpar = 0; } } - // check common case first (Data), then switch statement on tag + /* check common case first (Data), then switch statement on tag */ if(tag == Data) { - // Lexing didn't pay attention to SGML record boundary rules: - // \n after start tag or before end tag to be discarded. - // (Lex has already discarded all \r's). - // Some pages assume this doesn't happen in
 text,
-			// so we won't do it if literal is true.
-			// BUG: won't discard \n before a start tag that begins
-			// the next bufferful of tokens.
+			/* Lexing didn't pay attention to SGML record boundary rules: */
+			/* \n after start tag or before end tag to be discarded. */
+			/* (Lex has already discarded all \r's). */
+			/* Some pages assume this doesn't happen in 
 text, */
+			/* so we won't do it if literal is true. */
+			/* BUG: won't discard \n before a start tag that begins */
+			/* the next bufferful of tokens. */
 			s = tok->text;
 			n = _Strlen(s);
 			if(!ps->literal) {
@@ -842,8 +842,8 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				j = n;
 				if(toki > 0) {
 					pt = toks[toki - 1].tag;
-					// IE and Netscape both ignore this rule (contrary to spec)
-					// if previous tag was img
+					/* IE and Netscape both ignore this rule (contrary to spec) */
+					/* if previous tag was img */
 					if(pt < Numtags && pt != Timg && j > 0 && s[0] == '\n')
 						i++;
 				}
@@ -873,26 +873,28 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				if(s != nil)
 					ps->skipwhite = 0;
 			}
-			tok->text = nil;		// token doesn't own string anymore
-			if(s != nil)
+			tok->text = nil;		/* token doesn't own string anymore */
+			if(s != nil){
 				addtext(ps, s);
+				s = nil;
+			}
 		}
 		else
 			switch(tag) {
-			// Some abbrevs used in following DTD comments
-			// %text = 	#PCDATA
-			//		| TT | I | B | U | STRIKE | BIG | SMALL | SUB | SUP
-			//		| EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE
-			//		| A | IMG | APPLET | FONT | BASEFONT | BR | SCRIPT | MAP
-			//		| INPUT | SELECT | TEXTAREA
-			// %block = P | UL | OL | DIR | MENU | DL | PRE | DL | DIV | CENTER
-			//		| BLOCKQUOTE | FORM | ISINDEX | HR | TABLE
-			// %flow = (%text | %block)*
-			// %body.content = (%heading | %text | %block | ADDRESS)*
-
-			// 
-			// Anchors are not supposed to be nested, but you sometimes see
-			// href anchors inside destination anchors.
+			/* Some abbrevs used in following DTD comments */
+			/* %text = 	#PCDATA */
+			/*		| TT | I | B | U | STRIKE | BIG | SMALL | SUB | SUP */
+			/*		| EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE */
+			/*		| A | IMG | APPLET | FONT | BASEFONT | BR | SCRIPT | MAP */
+			/*		| INPUT | SELECT | TEXTAREA */
+			/* %block = P | UL | OL | DIR | MENU | DL | PRE | DL | DIV | CENTER */
+			/*		| BLOCKQUOTE | FORM | ISINDEX | HR | TABLE */
+			/* %flow = (%text | %block)* */
+			/* %body.content = (%heading | %text | %block | ADDRESS)* */
+
+			/*  */
+			/* Anchors are not supposed to be nested, but you sometimes see */
+			/* href anchors inside destination anchors. */
 			case Ta:
 				if(ps->curanchor != 0) {
 					if(warn)
@@ -901,18 +903,18 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				}
 				name = aval(tok, Aname);
 				href = aurlval(tok, Ahref, nil, di->base);
-				// ignore rel, rev, and title attrs
+				/* ignore rel, rev, and title attrs */
 				if(href != nil) {
 					target = atargval(tok, di->target);
 					di->anchors = newanchor(++is->nanchors, name, href, target, di->anchors);
 					if(name != nil)
-						name = _Strdup(name);	// for DestAnchor construction, below
+						name = _Strdup(name);	/* for DestAnchor construction, below */
 					ps->curanchor = is->nanchors;
 					ps->curfg = push(&ps->fgstk, di->link);
 					ps->curul = push(&ps->ulstk, ULunder);
 				}
 				if(name != nil) {
-					// add a null item to be destination
+					/* add a null item to be destination */
 					additem(ps, newispacer(ISPnull), tok);
 					di->dests = newdestanchor(++is->nanchors, name, ps->lastit, di->dests);
 				}
@@ -926,16 +928,16 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				}
 				break;
 
-			// 
-			// We can't do applets, so ignore PARAMS, and let
-			// the %text contents appear for the alternative rep
+			/*  */
+			/* We can't do applets, so ignore PARAMS, and let */
+			/* the %text contents appear for the alternative rep */
 			case Tapplet:
 			case Tapplet+RBRA:
 				if(warn && tag == Tapplet)
 					fprint(2, "warning:  ignored\n");
 				break;
 
-			// 
+			/*  */
 			case Tarea:
 				map = di->maps;
 				if(map == nil) {
@@ -950,7 +952,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				setdimarray(tok, Acoords, &map->areas->coords, &map->areas->ncoords);
 				break;
 
-			// 
+			/*  */
 			case Tb:
 			case Tstrong:
 				pushfontstyle(ps, FntB);
@@ -971,7 +973,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				popfontstyle(ps);
 				break;
 
-			// 
+			/*  */
 			case Tbase:
 				t = di->base;
 				di->base = aurlval(tok, Ahref, di->base, di->base);
@@ -980,12 +982,12 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				di->target = atargval(tok, di->target);
 				break;
 
-			// 
+			/*  */
 			case Tbasefont:
 				ps->adjsize = aintval(tok, Asize, 3) - 3;
 				break;
 
-			// 
+			/*  */
 			case Tbig:
 			case Tsmall:
 				sz = ps->adjsize;
@@ -1001,7 +1003,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				popfontsize(ps);
 				break;
 
-			// 
+			/*  */
 			case Tblockquote:
 				changeindent(ps, BQTAB);
 				break;
@@ -1010,7 +1012,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				changeindent(ps, -BQTAB);
 				break;
 
-			// 
+			/*  */
 			case Tbody:
 				ps->skipping = 0;
 				bg = makebackground(nil, acolorval(tok, Abgcolor, di->background.color));
@@ -1018,8 +1020,8 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				if(bgurl != nil) {
 					if(di->backgrounditem != nil)
 						freeitem((Item*)di->backgrounditem);
-						// really should remove old item from di->images list,
-						// but there should only be one BODY element ...
+						/* really should remove old item from di->images list, */
+						/* but there should only be one BODY element ... */
 					di->backgrounditem = (Iimage*)newiimage(bgurl, nil, ALnone, 0, 0, 0, 0, 0, 0, nil);
 					di->backgrounditem->nextimage = di->images;
 					di->images = di->backgrounditem;
@@ -1037,17 +1039,17 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				break;
 
 			case Tbody+RBRA:
-				// HTML spec says ignore things after ,
-				// but IE and Netscape don't
-				// ps.skipping = 1;
+				/* HTML spec says ignore things after , */
+				/* but IE and Netscape don't */
+				/* ps.skipping = 1; */
 				break;
 
-			// 
+			/*  */
 			case Tbr:
 				addlinebrk(ps, atabval(tok, Aclear, clear_tab, NCLEARTAB, 0));
 				break;
 
-			// 
+			/*  */
 			case Tcaption:
 				if(curtab == nil) {
 					if(warn)
@@ -1089,7 +1091,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				popjust(ps);
 				break;
 
-			// 
+			/*  */
 			case Tdd:
 				if(ps->hangstk.n == 0) {
 					if(warn)
@@ -1104,8 +1106,8 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				push(&ps->hangstk, 0);
 				break;
 
-			//
-			//
+			/* */
+			/* */
 			case Tdir:
 			case Tmenu:
 			case Tol:
@@ -1130,7 +1132,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				changeindent(ps, -LISTTAB);
 				break;
 
-			// 
+			/*  */
 			case Tdl:
 				changeindent(ps, LISTTAB);
 				push(&ps->hangstk, 0);
@@ -1148,7 +1150,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				pop(&ps->hangstk);
 				break;
 
-			// 
+			/*  */
 			case Tdt:
 				if(ps->hangstk.n == 0) {
 					if(warn)
@@ -1163,7 +1165,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				push(&ps->hangstk, 1);
 				break;
 
-			// 
+			/*  */
 			case Tfont:
 				sz = top(&ps->fntsizestk, Normal);
 				if(_tokaval(tok, Asize, &nsz, 0)) {
@@ -1188,7 +1190,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				popfontsize(ps);
 				break;
 
-			// 
+			/*  */
 			case Tform:
 				if(is->curform != nil) {
 					if(warn)
@@ -1216,12 +1218,12 @@ getitems(ItemSource* is, uchar* data, int datalen)
 						fprint(2, "warning: unexpected \n");
 					continue;
 				}
-				// put fields back in input order
+				/* put fields back in input order */
 				is->curform->fields = (Formfield*)_revlist((List*)is->curform->fields);
 				is->curform = nil;
 				break;
 
-			// 
+			/*  */
 			case Tframe:
 				ks = is->kidstk;
 				if(ks == nil) {
@@ -1246,7 +1248,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 					kd->flags |= FRnoresize;
 				break;
 
-			// 
+			/*  */
 			case Tframeset:
 				ks = newkidinfo(1, nil);
 				pks = is->kidstk;
@@ -1279,8 +1281,8 @@ getitems(ItemSource* is, uchar* data, int datalen)
 					continue;
 				}
 				ks = is->kidstk;
-				// put kids back in original order
-				// and add blank frames to fill out cells
+				/* put kids back in original order */
+				/* and add blank frames to fill out cells */
 				n = ks->nrows*ks->ncols;
 				nblank = n - _listlen((List*)ks->kidinfos);
 				while(nblank-- > 0)
@@ -1288,13 +1290,13 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				ks->kidinfos = (Kidinfo*)_revlist((List*)ks->kidinfos);
 				is->kidstk = is->kidstk->nextframeset;
 				if(is->kidstk == nil) {
-					// end input
+					/* end input */
 					ans = nil;
 					goto return_ans;
 				}
 				break;
 
-			// , etc.
+			/* , etc. */
 			case Th1:
 			case Th2:
 			case Th3:
@@ -1330,16 +1332,16 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				break;
 
 			case Thead:
-				// HTML spec says ignore regular markup in head,
-				// but Netscape and IE don't
-				// ps.skipping = 1;
+				/* HTML spec says ignore regular markup in head, */
+				/* but Netscape and IE don't */
+				/* ps.skipping = 1; */
 				break;
 
 			case Thead+RBRA:
 				ps->skipping = 0;
 				break;
 
-			// 
+			/*  */
 			case Thr:
 				al = atabval(tok, Aalign, align_tab, NALIGNTAB, ALcenter);
 				sz = auintval(tok, Asize, HRSZ);
@@ -1360,7 +1362,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				pushfontstyle(ps, FntI);
 				break;
 
-			// 
+			/*  */
 			case Timg:
 				map = nil;
 				oldcuranchor = ps->curanchor;
@@ -1400,7 +1402,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 						map);
 				if(align == ALleft || align == ALright) {
 					additem(ps, newifloat(img, align), tok);
-					// if no hspace specified, use FLTIMGHSPACE
+					/* if no hspace specified, use FLTIMGHSPACE */
 					if(!_tokaval(tok, Ahspace, &val, 0))
 						((Iimage*)img)->hspace = FLTIMGHSPACE;
 				}
@@ -1415,7 +1417,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				ps->curanchor = oldcuranchor;
 				break;
 
-			// 
+			/*  */
 			case Tinput:
 				ps->skipwhite = 0;
 				if(is->curform == nil) {
@@ -1475,9 +1477,9 @@ getitems(ItemSource* is, uchar* data, int datalen)
 							fprint(2, "warning: image form field missing src\n");
 						continue;
 					}
-					// width and height attrs aren't specified in HTML 3.2,
-					// but some people provide them and they help avoid
-					// a relayout
+					/* width and height attrs aren't specified in HTML 3.2, */
+					/* but some people provide them and they help avoid */
+					/* a relayout */
 					field->image = newiimage(src,
 						astrval(tok, Aalt, L(Lsubmit)),
 						atabval(tok, Aalign, align_tab, NALIGNTAB, ALbottom),
@@ -1504,7 +1506,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 					field->events = ffit->genattr->events;
 				break;
 
-			// 
+			/*  */
 			case Tisindex:
 				ps->skipwhite = 0;
 				prompt = astrval(tok, Aprompt, L(Lindex));
@@ -1531,7 +1533,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				addbrk(ps, 1, 0);
 				break;
 
-			// 
+			/*  */
 			case Tli:
 				if(ps->listtypestk.n == 0) {
 					if(warn)
@@ -1556,7 +1558,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				ps->skipwhite = 1;
 				break;
 
-			// 
+			/*  */
 			case Tmap:
 				if(_tokaval(tok, Aname, &name, 0))
 					is->curmap = getmap(di, name);
@@ -1595,7 +1597,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				}
 				break;
 
-			// Nobr is NOT in HMTL 4.0, but it is ubiquitous on the web
+			/* Nobr is NOT in HMTL 4.0, but it is ubiquitous on the web */
 			case Tnobr:
 				ps->skipwhite = 0;
 				ps->curstate &= ~IFwrap;
@@ -1605,7 +1607,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				ps->curstate |= IFwrap;
 				break;
 
-			// We do frames, so skip stuff in noframes
+			/* We do frames, so skip stuff in noframes */
 			case Tnoframes:
 				ps->skipping = 1;
 				break;
@@ -1614,7 +1616,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				ps->skipping = 0;
 				break;
 
-			// We do scripts (if enabled), so skip stuff in noscripts
+			/* We do scripts (if enabled), so skip stuff in noscripts */
 			case Tnoscript:
 				if(doscripts)
 					ps->skipping = 1;
@@ -1625,7 +1627,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 					ps->skipping = 0;
 				break;
 
-			// 
+			/*  */
 			case Toption:
 				if(is->curform == nil || is->curform->fields == nil) {
 					if(warn)
@@ -1646,7 +1648,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 					option->value = _Strdup(option->display);
 				break;
 
-			// 
+			/*  */
 			case Tp:
 				pushjust(ps, atabval(tok, Aalign, align_tab, NALIGNTAB, ps->curjust));
 				ps->inpar = 1;
@@ -1656,12 +1658,12 @@ getitems(ItemSource* is, uchar* data, int datalen)
 			case Tp+RBRA:
 				break;
 
-			// 
-			// Do something when we do applets...
+			/*  */
+			/* Do something when we do applets... */
 			case Tparam:
 				break;
 
-			// 
+			/*  */
 			case Tpre:
 				ps->curstate &= ~IFwrap;
 				ps->literal = 1;
@@ -1677,13 +1679,13 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				}
 				break;
 
-			// 
+			/*  */
 			case Tscript:
 				if(doscripts) {
 					if(!di->hasscripts) {
 						if(di->scripttype == TextJavascript) {
-							// TODO: initialize script if nec.
-							// initjscript(di);
+							/* TODO: initialize script if nec. */
+							/* initjscript(di); */
 							di->hasscripts = 1;
 						}
 					}
@@ -1716,7 +1718,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				ps->skipping = 0;
 				break;
 
-			// 
+			/*  */
 			case Tselect:
 				if(is->curform == nil) {
 					if(warn)
@@ -1738,7 +1740,7 @@ getitems(ItemSource* is, uchar* data, int datalen)
 				additem(ps, ffit, tok);
 				if(ffit->genattr != nil)
 					field->events = ffit->genattr->events;
-				// throw away stuff until next tag (should be