CTRACE(tfp, "GridText: VMTotal = %d\n", VMTotal); #endif
CTRACE((tfp, "GridText: VMTotal = %d\n", VMTotal)); #endif    if (HTMainText) { if (HText_hasUTF8OutputSet(HTMainText) && HTLoadedDocumentEightbit() && LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) { self->had_utf8 = HTMainText->has_utf8; } else { self->had_utf8 = HTMainText->has_utf8; } HTMainText->has_utf8 = NO; }
PUBLIC HText *	HText_new ARGS1(	HTParentAnchor *,	anchor){#if defined(VMS) && defined(VAXC) && !defined(__DECC)#include <lib$routines.h>    int status, VMType=3, VMTotal;#endif /* VMS && VAXC && !__DECC */    HTLine * line = NULL;    HText * self = (HText *) calloc(1, sizeof(*self));    if (!self)	return self;#if defined(VMS) && defined (VAXC) && !defined(__DECC)    status = lib$stat_vm(&VMType, &VMTotal);    CTRACE(tfp, "GridText: VMTotal = %d\n", VMTotal);#endif /* VMS && VAXC && !__DECC */    if (!loaded_texts)	{	loaded_texts = HTList_new();#ifdef LY_FIND_LEAKS	atexit(free_all_texts);#endif    }    /*     *  Links between anchors & documents are a 1-1 relationship.  If     *  an anchor is already linked to a document we didn't call     *  HTuncache_current_document(), e.g., for the showinfo, options,     *  download, print, etc., temporary file URLs, so we'll check now     *  and free it before reloading. - Dick Wesseling (ftu@fi.ruu.nl)     */    if (anchor->document) {	HTList_removeObject(loaded_texts, anchor->document);	CTRACE(tfp, "GridText: Auto-uncaching\n") ;	((HText *)anchor->document)->node_anchor = NULL;	HText_free((HText *)anchor->document);	anchor->document = NULL;    }    HTList_addObject(loaded_texts, self);#if defined(VMS) && defined(VAXC) && !defined(__DECC)    while (HTList_count(loaded_texts) > HTCacheSize &&	   VMTotal > HTVirtualMemorySize)#else    if (HTList_count(loaded_texts) > HTCacheSize)#endif /* VMS && VAXC && !__DECC */    {	CTRACE(tfp, "GridText: Freeing off cached doc.\n");	HText_free((HText *)HTList_removeFirstObject(loaded_texts));#if defined(VMS) && defined (VAXC) && !defined(__DECC)	status = lib$stat_vm(&VMType, &VMTotal);	CTRACE(tfp, "GridText: VMTotal reduced to %d\n", VMTotal);#endif /* VMS && VAXC && !__DECC */    }    line = self->last_line = (HTLine *)calloc(1, LINE_SIZE(MAX_LINE));    if (line == NULL)	outofmem(__FILE__, "HText_New");    line->next = line->prev = line;    line->offset = line->size = 0;#ifdef USE_COLOR_STYLE    line->numstyles = 0;#endif    self->Lines = self->chars = 0;    self->first_anchor = self->last_anchor = NULL;    self->style = &default_style;    self->top_of_screen = 0;    self->node_anchor = anchor;    self->last_anchor_number = 0;	/* Numbering of them for references */    self->stale = YES;    self->toolbar = NO;    self->tabs = NULL;#ifdef SOURCE_CACHE    /*     * Yes, this is a Gross And Disgusting Hack(TM), I know...     */    self->source_cache_file = NULL;    if (LYCacheSource == SOURCE_CACHE_FILE && source_cache_filename) {      StrAllocCopy(self->source_cache_file, source_cache_filename);      FREE(source_cache_filename);    }    self->source_cache_chunk = NULL;    if (LYCacheSource == SOURCE_CACHE_MEMORY && source_cache_chunk) {	self->source_cache_chunk = source_cache_chunk;	source_cache_chunk = NULL;    }    /*     * Remember the parse settings.     */    self->clickable_images = clickable_images;    self->pseudo_inline_alts = pseudo_inline_alts;    self->raw_mode = LYUseDefaultRawMode;    self->historical_comments = historical_comments;    self->minimal_comments = minimal_comments;    self->soft_dquotes = soft_dquotes;    self->old_dtd = Old_DTD;    self->lines = LYlines;    self->cols = LYcols;#endif    /*     *  If we are going to render the List Page, always merge in hidden     *  links to get the numbering consistent if form fields are numbered     *  and show up as hidden links in the list of links.     *  If we are going to render a bookmark file, also always merge in     *	hidden links, to get the link numbers consistent with the counting     *  in remove_bookmark_link().  Normally a bookmark file shouldn't     *	contain any entries with empty titles, but it might happen. - kw     */    if (anchor->bookmark ||	(anchor->address && !strcmp(anchor->address, LYlist_temp_url())))	self->hiddenlinkflag = HIDDENLINKS_MERGE;    else	self->hiddenlinkflag = LYHiddenLinks;    self->hidden_links = NULL;    self->no_cache = ((anchor->no_cache || anchor->post_data) ?							  YES : NO);    self->LastChar = '\0';    self->IgnoreExcess = FALSE;#ifndef PSRC_TEST    if (HTOutputFormat == WWW_SOURCE)	self->source = YES;    else	self->source = NO;#else    self->source=( LYpsrc ? psrc_view : HTOutputFormat == WWW_SOURCE);#endif    HTAnchor_setDocument(anchor, (HyperDoc *)self);    HTFormNumber = 0;  /* no forms started yet */    HTMainText = self;    HTMainAnchor = anchor;    self->display_on_the_fly = 0;    self->kcode = NOKANJI;    self->state = S_text;    self->kanji_buf = '\0';    self->in_sjis = 0;    self->have_8bit_chars = NO;    HText_getChartransInfo(self);    UCSetTransParams(&self->T,		     self->UCLYhndl, self->UCI,		     current_char_set,		     &LYCharSet_UC[current_char_set]);    /*     *  Check the kcode setting if the anchor has a charset element. - FM     */    if (anchor->charset)	HText_setKcode(self, anchor->charset,		       HTAnchor_getUCInfoStage(anchor, UCT_STAGE_HTEXT));    /*     *	Memory leak fixed.     *  05-29-94 Lynx 2-3-1 Garrett Arch Blythe     *	Check to see if our underline and star_string need initialization     *		if the underline is not filled with dots.     */    if (underscore_string[0] != '.') {	/*	 *  Create an array of dots for the UNDERSCORES macro. - FM	 */	memset(underscore_string, '.', (MAX_LINE-1));	underscore_string[(MAX_LINE-1)] = '\0';	underscore_string[MAX_LINE] = '\0';	/*	 *  Create an array of underscores for the STARS macro. - FM	 */	memset(star_string, '_', (MAX_LINE-1));	star_string[(MAX_LINE-1)] = '\0';	star_string[MAX_LINE] = '\0';    }    underline_on = FALSE; /* reset */    bold_on = FALSE;#ifdef DISP_PARTIAL    /*     * By this function we create HText object and set new Lines counter     * so we may start displaying the document while downloading. - LP     */    if (display_partial)	 NumOfLines_partial = 0;  /* enable HTDisplayPartial() */    /*     *  These two fields should only be set to valid line numbers     *  by calls of display_page during partial displaying.  This     *  is just so that the FIRST display_page AFTER that can avoid     *  repainting the same lines on the screen. - kw     */    self->first_lineno_last_disp_partial =	self->last_lineno_last_disp_partial = -1;#endif    CTRACE(tfp, "GridText: start HText_new\n");    return self;}