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

📄 nvi-1.79-gtags.diff

📁 代码检索工具GLOBAL源码。可用来浏览分析LINUX源码。
💻 DIFF
📖 第 1 页 / 共 2 页
字号:
! 		if ((tqp = ctag_slist(sp, exp->tag_last)) == NULL)! 			return (1);! 	}    	/*  	 * Allocate all necessary memory before swapping screens.  Initialize****************** 969,974 ****--- 1067,1255 ----  	return (0);  }  + /* #ifdef GTAGS */+ /*+  * The getentry() parses both standard and extended ctags -x format.+  *+  * [standard format]+  * <tag>   <lineno>  <file>         <image>+  * +------------------------------------------------+  * |main     30      main.c         main(argc, argv)+  * |func     21      subr.c         func(arg)+  *+  * The following commands write this format.+  *	o Traditinal Ctags with -x option+  *	o Global with -x option+  *		See <http://www.gnu.org/software/global>+  *+  * [extended format]+  * <tag>   <type>  <lineno>   <file>        <image>+  * +----------------------------------------------------------+  * |main     function 30      main.c         main(argc, argv)+  * |func     function 21      subr.c         func(arg)+  *+  * The following commands write this format.+  *	o Exuberant Ctags with -x option+  *		See <http://ctags.sourceforge.net>+  *+  * Returns 0 on success, -1 on error.+  * The tag, file, and line will each be NUL-terminated pointers+  * into buf.+  */+ static int+ getentry(buf, tag, file, line)+ 	char *buf;	/* standard or extended ctags -x format data */+ 	char **tag;	/* name of the tag we actually found */+ 	char **file;	/* file in which to find this tag */+ 	char **line;	/* line number of file where this tag is found */+ {+ 	char *p = buf;+ + 	for (*tag = p; *p && !isspace(*p); p++)		/* tag name */+ 		;+ 	if (*p == 0)+ 		goto err;+ 	*p++ = 0;+ 	for (; *p && isspace(*p); p++)			/* (skip blanks) */+ 		;+ 	if (*p == 0)+ 		goto err;+ 	/*+ 	 * If the second part begin with other than digit,+ 	 * it is assumed tag type. Skip it.+ 	 */+ 	if (!isdigit(*p)) {+ 		for (; *p && !isspace(*p); p++)		/* (skip tag type) */+ 			;+ 		for (; *p && isspace(*p); p++)		/* (skip blanks) */+ 			;+ 	}+ 	if (!isdigit(*p))+ 		goto err;+ 	*line = p;					/* line no */+ 	for (*line = p; *p && !isspace(*p); p++)+ 		;+ 	if (*p == 0)+ 		goto err;+ 	*p++ = 0;+ 	for (; *p && isspace(*p); p++)			/* (skip blanks) */+ 		;+ 	if (*p == 0)+ 		goto err;+ 	*file = p;					/* file name */+ 	for (*file = p; *p && !isspace(*p); p++)+ 		;+ 	if (*p == 0)+ 		goto err;+ 	*p = 0;+ + 	/* value check */+ 	if (strlen(*tag) && strlen(*line) && strlen(*file) && atoi(*line) > 0)+ 		return (0);	/* OK */+ err:+ 	return (-1);		/* ERROR */+ }+ + /*+  * gtag_slist --+  *	Search the list of tags files for a tag, and return tag queue.+  *+  *	In almost case, quote should be 1.+  *	quote = 0 enables ':tag -f *.c'.+  */+ static TAGQ *+ gtag_slist(sp, options, tag, quote)+ 	SCR *sp;+ 	char *options;+ 	char *tag;+ 	int quote;+ {+ 	EX_PRIVATE *exp;+ 	TAGF *tfp;+ 	TAGQ *tqp;+ 	size_t len;+ 	TAG *tp;+ 	char *name, *file, *line;+ 	char command[BUFSIZ];+ 	char buf[BUFSIZ];+ 	char tmp[30];+ 	char *tmpname, *com;+ 	FILE *fp;+ + 	/* Allocate and initialize the tag queue structure. */+ 	len = strlen(tag);+ 	CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);+ 	CIRCLEQ_INIT(&tqp->tagq);+ 	tqp->tag = tqp->buf;+ 	memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);+ + 	/*+ 	 * Find the tag, only display missing file messages once, and+ 	 * then only if we didn't find the tag.+ 	 */+ 	strcpy(tmp, "/tmp/.nvi+global.XXXX");+ 	tmpname = mktemp(tmp);+ 	com = (quote) ? "global -xa %s '%s' 2>%s" : "global -xa %s %s 2>%s";+ 	snprintf(command, sizeof(command), com, options, tag, tmpname);+ 	if (fp = popen(command, "r")) {+ 		int status;+ 		while (fgets(buf, sizeof(buf), fp)) {+ 			if (buf[strlen(buf)-1] == '\n')		/* chop(buf) */+ 				buf[strlen(buf)-1] = 0;+ 			else+ 				while (fgetc(fp) != '\n')+ 					;+ 			if (getentry(buf, &name, &file, &line) < 0)+ 				break;+ 			CALLOC_GOTO(sp, tp,+ 			    TAG *, 1, sizeof(TAG) + strlen(file) + 1 + strlen(line) + 1);+ 			tp->fname = tp->buf;+ 			strcpy(tp->fname, file);+ 			tp->fnlen = strlen(file);+ 			tp->search = tp->fname + tp->fnlen + 1;+ 			strcpy(tp->search, line);+ 			CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);+ 		}+ 		status = pclose(fp);+ 		if (status) {+ 			if (WEXITSTATUS(status) == 2)+ 				msgq(sp, M_ERR, "invalid option of global(1).");+ 			else {+ 				char msg[128];+ 				FILE *ip = fopen(tmpname, "r");+ 				msg[0] = '\0';+ 				if (ip) {+ 					if (fgets(msg, sizeof(msg), ip)) {+ 						if (msg[strlen(msg) - 1] == '\n')+ 							msg[strlen(msg) - 1] = '\0';+ 					}+ 					fclose(ip);+ 				}+ 				if (msg[0] == '\0')+ 					strcpy(msg, "global(1) ended abnormally.");+ 				msgq(sp, M_ERR, "%s", msg);+ 			}+ 			(void)unlink(tmpname);+ 			free(tqp);+ 			return (NULL);+ 		}+ 	}+ 	(void)unlink(tmpname);+ + 	/* Check to see if we found anything. */+ 	if (tqp->tagq.cqh_first == (void *)&tqp->tagq) {+ 		msgq_str(sp, M_ERR, tag, "162|%s: tag not found");+ 		free(tqp);+ 		return (NULL);+ 	}+ + 	tqp->current = tqp->tagq.cqh_first;+ 	return (tqp);+ + alloc_err:+ 	return (NULL);+ }+ /* #endif */  /*   * ctag_slist --   *	Search the list of tags files for a tag, and return tag queue.diff -c -r -N ../nvi-1.79.org/include/options_def.h ./include/options_def.h*** ../nvi-1.79.org/include/options_def.h	Wed Oct 23 22:53:10 1996--- ./include/options_def.h	Fri Jul 13 13:38:45 2001****************** 16,79 ****  #define O_EXTENDED 15  #define O_FILEC 16  #define O_FLASH 17! #define O_HARDTABS 18! #define O_ICLOWER 19! #define O_IGNORECASE 20! #define O_KEYTIME 21! #define O_LEFTRIGHT 22! #define O_LINES 23! #define O_LISP 24! #define O_LIST 25! #define O_LOCKFILES 26! #define O_MAGIC 27! #define O_MATCHTIME 28! #define O_MESG 29! #define O_MODELINE 30! #define O_MSGCAT 31! #define O_NOPRINT 32! #define O_NUMBER 33! #define O_OCTAL 34! #define O_OPEN 35! #define O_OPTIMIZE 36! #define O_PARAGRAPHS 37! #define O_PATH 38! #define O_PRINT 39! #define O_PROMPT 40! #define O_READONLY 41! #define O_RECDIR 42! #define O_REDRAW 43! #define O_REMAP 44! #define O_REPORT 45! #define O_RULER 46! #define O_SCROLL 47! #define O_SEARCHINCR 48! #define O_SECTIONS 49! #define O_SECURE 50! #define O_SHELL 51! #define O_SHELLMETA 52! #define O_SHIFTWIDTH 53! #define O_SHOWMATCH 54! #define O_SHOWMODE 55! #define O_SIDESCROLL 56! #define O_SLOWOPEN 57! #define O_SOURCEANY 58! #define O_TABSTOP 59! #define O_TAGLENGTH 60! #define O_TAGS 61! #define O_TERM 62! #define O_TERSE 63! #define O_TILDEOP 64! #define O_TIMEOUT 65! #define O_TTYWERASE 66! #define O_VERBOSE 67! #define O_W1200 68! #define O_W300 69! #define O_W9600 70! #define O_WARN 71! #define O_WINDOW 72! #define O_WINDOWNAME 73! #define O_WRAPLEN 74! #define O_WRAPMARGIN 75! #define O_WRAPSCAN 76! #define O_WRITEANY 77! #define O_OPTIONCOUNT 78--- 16,80 ----  #define O_EXTENDED 15  #define O_FILEC 16  #define O_FLASH 17! #define O_GTAGSMODE 18! #define O_HARDTABS 19! #define O_ICLOWER 20! #define O_IGNORECASE 21! #define O_KEYTIME 22! #define O_LEFTRIGHT 23! #define O_LINES 24! #define O_LISP 25! #define O_LIST 26! #define O_LOCKFILES 27! #define O_MAGIC 28! #define O_MATCHTIME 29! #define O_MESG 30! #define O_MODELINE 31! #define O_MSGCAT 32! #define O_NOPRINT 33! #define O_NUMBER 34! #define O_OCTAL 35! #define O_OPEN 36! #define O_OPTIMIZE 37! #define O_PARAGRAPHS 38! #define O_PATH 39! #define O_PRINT 40! #define O_PROMPT 41! #define O_READONLY 42! #define O_RECDIR 43! #define O_REDRAW 44! #define O_REMAP 45! #define O_REPORT 46! #define O_RULER 47! #define O_SCROLL 48! #define O_SEARCHINCR 49! #define O_SECTIONS 50! #define O_SECURE 51! #define O_SHELL 52! #define O_SHELLMETA 53! #define O_SHIFTWIDTH 54! #define O_SHOWMATCH 55! #define O_SHOWMODE 56! #define O_SIDESCROLL 57! #define O_SLOWOPEN 58! #define O_SOURCEANY 59! #define O_TABSTOP 60! #define O_TAGLENGTH 61! #define O_TAGS 62! #define O_TERM 63! #define O_TERSE 64! #define O_TILDEOP 65! #define O_TIMEOUT 66! #define O_TTYWERASE 67! #define O_VERBOSE 68! #define O_W1200 69! #define O_W300 70! #define O_W9600 71! #define O_WARN 72! #define O_WINDOW 73! #define O_WINDOWNAME 74! #define O_WRAPLEN 75! #define O_WRAPMARGIN 76! #define O_WRAPSCAN 77! #define O_WRITEANY 78! #define O_OPTIONCOUNT 79diff -c -r -N ../nvi-1.79.org/vi/v_ex.c ./vi/v_ex.c*** ../nvi-1.79.org/vi/v_ex.c	Mon Sep 16 05:03:02 1996--- ./vi/v_ex.c	Fri Jul 13 13:38:45 2001****************** 223,233 ****  	SCR *sp;  	VICMD *vp;  {! 	ARGS *ap[2], a;  	EXCMD cmd;    	ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);  	ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));  	return (v_exec_ex(sp, vp, &cmd));  }  --- 223,269 ----  	SCR *sp;  	VICMD *vp;  {! /* #ifdef GTAGS */! 	ARGS *ap[2], a[2];! /*! #else! 	ARGS *ap[3], a;! #endif! */  	EXCMD cmd;+ /* #ifdef GTAGS */+ 	size_t len;+ 	int isempty;+ 	char *p, *opt;+ /* #endif */  + /* #ifdef GTAGS */+ 	if (O_ISSET(sp, O_GTAGSMODE)) {+ 		if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty) == 0) {+ 			p += vp->m_start.cno;+ 			if (!isalpha(*p) && *p != '_')+ 				return 0;+ 			while (*p && (isalnum(*p) || *p == '_'))+ 				p++;+ 			while (*p && isblank(*p))+ 				p++;+ 			if (*p == '(')	/* function */+ 				opt = (vp->m_start.cno == 0) ? "-r" : "-x";+ 			else		/* other symbol */+ 				opt = "-s";+ 		}+ 	}+ /* #endif */  	ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);+ /* #ifdef GTAGS */+ 	if (O_ISSET(sp, O_GTAGSMODE))+ 		ex_cadd(&cmd, &a[0], opt, strlen(opt));+ 	ex_cadd(&cmd, &a[1], VIP(sp)->keyw, strlen(VIP(sp)->keyw));+ /*+ #else  	ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));+ #endif+ */  	return (v_exec_ex(sp, vp, &cmd));  }  

⌨️ 快捷键说明

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