⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lymainloop.c

📁 基于rtos开发的浏览器!
💻 C
📖 第 1 页 / 共 5 页
字号:
		    /*		     *	If we are going to a target line or		     *	the first page of a popped document,		     *	override any www_search line result.		     */		    if (Newline > 1 || popped_doc == TRUE)			 www_search_result = -1;		    /*		     *	Make sure curdoc.line will not be equal		     *	to Newline, so we get a redraw.		     */		    curdoc.line = -1;		    break;		}  /* end switch */	    if (TRACE) {		if (!LYTraceLogFP || trace_mode_flag) {		    sleep(AlertSecs); /* allow me to look at the results */		}	    }	    /*	     *	Set the files the same.	     */	    StrAllocCopy(curdoc.address, newdoc.address);	    StrAllocCopy(curdoc.post_data, newdoc.post_data);	    StrAllocCopy(curdoc.post_content_type, newdoc.post_content_type);	    StrAllocCopy(curdoc.bookmark, newdoc.bookmark);#ifdef USE_HASH	    StrAllocCopy(curdoc.style, HText_getStyle());	    if (curdoc.style != NULL)		style_readFromFile (curdoc.style);#endif	    curdoc.isHEAD = newdoc.isHEAD;	    curdoc.internal_link = newdoc.internal_link;	    /*	     *	Set the remaining document elements and add to	     *	the visitied links list. - FM	     */	    if (ownerS_address != NULL) {		if (HTOutputFormat == WWW_SOURCE && !HText_getOwner())		    HText_setMainTextOwner(ownerS_address);		FREE(ownerS_address);	    }	    if (HText_getTitle()) {		StrAllocCopy(curdoc.title, HText_getTitle());	    } else if (!dump_output_immediately) {		StrAllocCopy(curdoc.title, newdoc.title);	    }	    owner_address = HText_getOwner();	    curdoc.safe = HTLoadedDocumentIsSafe();	    if (!dump_output_immediately) {		LYAddVisitedLink(&curdoc);	    }	   /*	    *  Reset WWW present mode so that if we were getting	    *  the source, we get rendered HTML from now on.	    */	   HTOutputFormat = WWW_PRESENT;	   /*	    *  Reset all of the other relevant flags. - FM	    */	   LYUserSpecifiedURL = FALSE;	/* only set for goto's and jumps's */	   LYJumpFileURL = FALSE;	/* only set for jump's */	   LYNoRefererForThis = FALSE;	/* always reset on return here */	   reloading = FALSE;		/* only set for RELOAD and RESUBMIT */	   HEAD_request = FALSE;	/* only set for HEAD requests */	   LYPermitURL = FALSE; 	/* only set for LYValidate */	   ForcePush = FALSE;		/* only set for some PRINT requests. */	   LYforce_HTML_mode = FALSE;	   popped_doc = FALSE;	} /* end if (LYforce_no_cache || force_load || are_different(...)) */	if (dump_output_immediately) {	    if (crawl) {		print_crawl_to_fd(stdout, curdoc.address, curdoc.title);	    } else {		print_wwwfile_to_fd(stdout,0);	    }	    return(0);	}	/*	 *  If the recent_sizechange variable is set to TRUE	 *  then the window size changed recently.	 */	if (recent_sizechange) {		stop_curses();		start_curses();		clear();		refresh_screen = TRUE; /* to force a redraw */		recent_sizechange = FALSE;		if (user_mode == NOVICE_MODE) {		    display_lines = LYlines-4;		} else {		    display_lines = LYlines-2;		}	}	if (www_search_result != -1) {	     /*	      *  This was a WWW search, set the line	      *  to the result of the search.	      */	     Newline = www_search_result;	     www_search_result = -1;  /* reset */	     more = HText_canScrollDown();	}	if (first_file == TRUE) {	    /*	     *	We can never again have the first file.	     */	    first_file = FALSE;	    /*	     *	Set the startrealm, and deal as best we can	     *	with preserving forced HTML mode for a local	     *	startfile. - FM	     */	    temp = HTParse(curdoc.address, "",			   PARSE_ACCESS+PARSE_HOST+PARSE_PUNCTUATION);	    if (!temp || *temp == '\0') {		StrAllocCopy(startrealm, "None");	    } else {		StrAllocCopy(startrealm, temp);		FREE(temp);		if (!(temp = HTParse(curdoc.address, "",				     PARSE_PATH+PARSE_PUNCTUATION))) {		    if (startrealm[strlen(startrealm)-1] != '/') {			StrAllocCat(startrealm, "/");		    }		} else {		    if (forced_HTML_mode &&			!dump_output_immediately &&			!curdoc.bookmark &&			!strncasecomp(curdoc.address, "file:", 5) &&			strlen(temp) > 1) {			/*			 *  We forced HTML for a local startfile which			 *  is not a bookmark file and has a path of at			 *  least two letters.	If it doesn't have a			 *  suffix mapped to text/html, we'll set the			 *  entire path (including the lead slash) as a			 *  "suffix" mapped to text/html to ensure it is			 *  always treated as an HTML source file.  We			 *  are counting on a tail match to this full path			 *  for some other URL fetched during the session			 *  having too low a probability to worry about,			 *  but it could happen. - FM			 */			HTAtom *encoding;			if (HTFileFormat(temp, &encoding, NULL) != WWW_HTML) {			    HTSetSuffix(temp, "text/html", "8bit", 1.0);			}		    }		    if ((cp = strrchr(temp, '/')) != NULL) {			*(cp+1) = '\0';			StrAllocCat(startrealm, temp);		    }		}	    }	    FREE(temp);	    if (TRACE) {		fprintf(stderr, "Starting realm is '%s'\n\n", startrealm);	    }	    if (traversal) {		/*		 *  Set up the crawl output stuff.		 */		if (curdoc.address && !lookup(curdoc.address)) {		    if (strncmp(curdoc.address, "LYNXIMGMAP:", 11))			crawl_ok = TRUE;		    add_to_table(curdoc.address);		}		/*		 *  Set up the traversal_host comparison string.		 */		if (strncmp((curdoc.address ? curdoc.address : "NULL"),			    "http", 4)) {		    StrAllocCopy(traversal_host, "None");		} else if (check_realm) {		    StrAllocCopy(traversal_host, startrealm);		} else {		    temp = HTParse(curdoc.address, "",				   PARSE_ACCESS+PARSE_HOST+PARSE_PUNCTUATION);		    if (!temp || *temp == '\0') {			StrAllocCopy(traversal_host, "None");		    } else {			StrAllocCopy(traversal_host, temp);			if (traversal_host[strlen(traversal_host)-1] != '/') {			    StrAllocCat(traversal_host, "/");			}		    }		    FREE(temp);		}		if (TRACE) {		    fprintf(stderr,			    "Traversal host is '%s'\n\n", traversal_host);		}	    }	    if (startfile) {		/*		 *  If homepage was not equated to startfile,		 *  make the homepage URL the first goto		 *  entry. - FM		 */		if (homepage && strcmp(startfile, homepage))		    HTAddGotoURL(homepage);		/*		 *  If we are not starting up with startfile		 *  (e.g., had -book), or if we are using the		 *  startfile and it has no POST content, make		 *  the startfile URL a goto entry. - FM		 */		if (strcmp(startfile, newdoc.address) ||		    newdoc.post_data == NULL)		    HTAddGotoURL(startfile);	    }	    if (TRACE) {		refresh_screen = TRUE;		if (!LYTraceLogFP || trace_mode_flag) {		    sleep(AlertSecs);		}	    }	}	/*	 *  If the curdoc.line is different than Newline then there must	 *  have been a change since last update.  Run HText_pageDisplay()	 *  create a fresh screen of text out.	 */	if (curdoc.line != Newline) {	    refresh_screen = FALSE;	    HText_pageDisplay(Newline, prev_target);#ifdef DIRED_SUPPORT	    if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))	      showtags(tagged);#endif /* DIRED_SUPPORT */	    /*	     *	If more equals TRUE, then there is more	     *	info below this page .	     */	    more = HText_canScrollDown();	    curdoc.line = Newline = HText_getTopOfScreen()+1;	    lines_in_file = HText_getNumOfLines();	    if (curdoc.title == NULL) {		/*		 *  If we don't yet have a title, try to get it,		 *  or set to that for newdoc.title. - FM		 */		if (HText_getTitle()) {		    StrAllocCopy(curdoc.title, HText_getTitle());		} else {		    StrAllocCopy(curdoc.title, newdoc.title);		}	    }	    if (arrowup) {		/*		 *  arrowup is set if we just came up from		 *  a page below.		 */		curdoc.link = nlinks - 1;		arrowup = FALSE;	    } else {		curdoc.link = newdoc.link;		if (curdoc.link >= nlinks) {		    curdoc.link = nlinks - 1;		} else if (curdoc.link < 0 && nlinks > 0) {		    /*		     *	We may have popped a doc (possibly in local_dired)		     *	which didn't have any links when it was pushed, but		     *	does have links now (e.g. a file was created) - KW		     */		    curdoc.link = 0;		}	    }	    show_help = FALSE; /* reset */	    newdoc.line = 1;	    newdoc.link = 0;	    curdoc.line = Newline; /* set */	}	/*	 *  Refresh the screen if necessary.	 */	if (refresh_screen) {#if defined(FANCY_CURSES) || defined (USE_SLANG)	    if (enable_scrollback) {		clear();	    } else {		erase();	    }#else	    clear();#endif /* FANCY_CURSES || USE_SLANG */	    HText_pageDisplay(Newline, prev_target);#ifdef DIRED_SUPPORT	    if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))		showtags(tagged);#endif /* DIRED_SUPPORT */	    if (user_mode == NOVICE_MODE)		noviceline(more);  /* print help message */	    refresh_screen = FALSE;	}	/*	 *  Report unread or new mail, if appropriate.	 */	if (check_mail && !no_mail && LYCheckMail())	    sleep(MessageSecs);	/*	 *  If help is not on the screen,	 *  then put a message on the screen	 *  to tell the user other misc info.	 */	if (!show_help) {	    /*	     *	Make sure form novice lines are replaced.	     */	    if (user_mode == NOVICE_MODE) {		noviceline(more);	    }	    /*	     *	If we are in forms mode then explicitly	     *	tell the user what each kind of link is.	     */	    if (HTisDocumentSource()) {		/*		 *  Currently displaying HTML source.		 */		_statusline(SOURCE_HELP);#ifdef INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0) {#else#ifdef NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&		       !(links[curdoc.link].type & WWW_LINK_TYPE)) {#else	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&		       !(user_mode == ADVANCED_MODE &&			 (links[curdoc.link].type & WWW_LINK_TYPE))) {#endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */#endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */		if (links[curdoc.link].type == WWW_FORM_LINK_TYPE)		    switch(links[curdoc.link].form->type) {		    case F_PASSWORD_TYPE:			if (links[curdoc.link].form->disabled == YES)			    statusline(FORM_LINK_PASSWORD_UNM_MSG);			else			    statusline(FORM_LINK_PASSWORD_MESSAGE);			break;		    case F_OPTION_LIST_TYPE:			if (links[curdoc.link].form->disabled == YES)			    statusline(FORM_LINK_OPTION_LIST_UNM_MSG);			else			    statusline(FORM_LINK_OPTION_LIST_MESSAGE);			break;		    case F_CHECKBOX_TYPE:			if (links[curdoc.link].form->disabled == YES)			    statusline(FORM_LINK_CHECKBOX_UNM_MSG);			else			    statusline(FORM_LINK_CHECKBOX_MESSAGE);			break;		    case F_RADIO_TYPE:			if (links[curdoc.link].form->disabled == YES)			    statusline(FORM_LINK_RADIO_UNM_MSG);			else			    statusline(FORM_LINK_RADIO_MESSAGE);			break;		    case F_TEXT_SUBMIT_TYPE:			if (links[curdoc.link].form->disabled == YES) {			    statusline(FORM_LINK_TEXT_SUBMIT_UNM_MSG);			} else if (links[curdoc.link].form->submit_method ==				 URL_MAIL_METHOD) {			    if (no_mail)				statusline(				       FORM_LINK_TEXT_SUBMIT_MAILTO_DIS_MSG);			    else				statusline(FORM_LINK_TEXT_SUBMIT_MAILTO_MSG);			} else if (links[curdoc.link].form->no_cache) {			    statusline(FORM_LINK_TEXT_RESUBMIT_MESSAGE);			} else {			    statusline(FORM_LINK_TEXT_SUBMIT_MESSAGE);			}			break;		    case F_SUBMIT_TYPE:		    case F_IMAGE_SUBMIT_TYPE:			if (links[curdoc.link].form->disabled == YES) {			    statusline(FORM_LINK_SUBMIT_DIS_MSG);			} else if (links[curdoc.link].form->submit_method ==				 URL_MAIL_METHOD) {			    if (no_mail) {				statusline(FORM_LINK_SUBMIT_MAILTO_DIS_MSG);			    } else {				statusline(FORM_LINK_SUBMIT_MAILTO_MSG);			    }			} else if (links[curdoc.link].form->no_cache) {			    statusline(FORM_LINK_RESUBMIT_MESSAGE);			} else {			    statusline(FORM_LINK_SUBMIT_MESSAGE);			}			break;		    case F_RESET_TYPE:			if (links[curdoc.link].form->disabled == YES)			    statusline(FORM_LINK_RESET_DIS_MSG);			else			    statusline(FORM_LINK_RESET_MESSAGE);			break;		    case F_TEXT_TYPE:		    case F_TEXTAREA_TYPE:			if (links[curdoc.link].form->disabled == YES)			    statusline(FORM_LINK_TEXT_UNM_MSG);			else			    statusline(FORM_LINK_TEXT_MESSAGE);			break;		    }		else		    statusline(NORMAL_LINK_MESSAGE);		/*		 *  Let them know if it's an index -- very rare.		 */		if (is_www_index) {		    move(LYlines-1,LYcols-8);		    start_reverse();		    addstr("-index-");		    stop_reverse();		}	    } else if (user_mode == ADVANCED_MODE && nlinks > 0) {		/*		 *  Show the URL or, for some internal links, the fragment		 */		cp = NULL;		if (links[curdoc.link].type == WWW_INTERN_LINK_TYPE &&		    strncmp(links[curdoc.link].lname, "LYNXIMGMAP:", 11)) {		    cp = strchr(links[curdoc.link].lname, '#');		}		if (!cp)		    cp = links[curdoc.link].lname;		if (more)		    if (is_www_index)			_user_message("-more- -index- %s",						 cp);		    else			_user_message("-more- %s",cp);		else		    if (is_www_index)			_user_message("-index- %s",cp);		    else			statusline(cp);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -