gawk-patches

来自「ftam等标准协议服务器和客户端的源代码。」· 代码 · 共 781 行 · 第 1/2 页

TXT
781
字号
diff -rc gawk-2.13.orig/array.c gawk-2.13/array.c*** gawk-2.13.orig/array.c	Fri May 31 17:59:43 1991--- gawk-2.13/array.c	Wed Dec 11 21:47:37 1991****************** 28,34 ****--- 28,39 ----  static NODE *assoc_find P((NODE *symbol, NODE *subs, int hash1));    NODE *+ #ifndef	SNMP  concat_exp(tree)+ #else+ concat_exp(tree,isnmp)+ int	isnmp;+ #endif  register NODE *tree;  {  	register NODE *r;****************** 44,51 ****--- 49,66 ----  	r = force_string(tree_eval(tree->lnode));  	if (tree->rnode == NULL)  		return r;+ #ifdef	SNMP+ 	if (isnmp) {+ 	    subseplen = Ndot_string -> stlen;+ 	    subsep = Ndot_string -> stptr;+ 	}+ 	else {+ #endif  	subseplen = SUBSEP_node->lnode->stlen;  	subsep = SUBSEP_node->lnode->stptr;+ #ifdef	SNMP+ 	}+ #endif  	len = r->stlen + subseplen + 2;  	emalloc(str, char *, len, "concat_exp");  	memcpy(str, r->stptr, r->stlen+1);****************** 82,87 ****--- 97,106 ----  	int i;  	NODE *bucket, *next;  + #ifdef	SNMP+ 	if (symbol -> magic)+ 	    fatal ("split into SNMP array variable not allowed");+ #endif  	if (symbol->var_array == 0)  		return;  	for (i = 0; i < HASHSIZE; i++) {****************** 131,136 ****--- 150,160 ----  	register NODE *bucket;  	int chained = 0;  + #ifdef	SNMP+ 	if (symbol -> magic)+ 	    fatal ("assoc_find: internal error");+ #endif+   	for (bucket = symbol->var_array[hash1]; bucket; bucket = bucket->ahnext) {  		if (cmp_nodes(bucket->ahname, subs) == 0) {  			if (chained) {	/* move found to front of chain */****************** 163,171 ****--- 187,204 ----    	if (symbol->type == Node_param_list)  		symbol = stack_ptr[symbol->param_cnt];+ #ifdef	SNMP+ 	if (symbol -> magic)+ 	    return *assoc_lookup (symbol, concat_exp (subs, 1))+ 			!= Nnull_string;+ #endif  	if (symbol->var_array == 0)  		return 0;+ #ifndef	SNMP  	subs = concat_exp(subs);	/* concat_exp returns a string node */+ #else+ 	subs = concat_exp(subs,0);	/* concat_exp returns a string node */+ #endif  	hash1 = hash(subs->stptr, subs->stlen);  	if (assoc_find(symbol, subs, hash1) == NULL) {  		free_temp(subs);****************** 193,198 ****--- 226,237 ----  	(void) force_string(subs);  	hash1 = hash(subs->stptr, subs->stlen);  + #ifdef	SNMP+ 	if (symbol -> magic) {+ 	    snmp_get (symbol, force_string (subs) -> stptr);+ 	    return &symbol -> var_value;+ 	}+ #endif  	if (symbol->var_array == 0) {	/* this table really should grow  					 * dynamically */  		unsigned size;****************** 228,236 ****--- 267,283 ----    	if (symbol->type == Node_param_list)  		symbol = stack_ptr[symbol->param_cnt];+ #ifdef	SNMP+ 	if (symbol -> magic)+ 	    fatal ("delete into SNMP array variable not allowed");+ #endif  	if (symbol->var_array == 0)  		return;+ #ifndef	SNMP  	subs = concat_exp(tree);	/* concat_exp returns string node */+ #else+ 	subs = concat_exp(tree,0);	/* concat_exp returns string node */+ #endif  	hash1 = hash(subs->stptr, subs->stlen);    	last = NULL;****************** 250,259 ****--- 297,317 ----  }    void+ #ifndef	SNMP  assoc_scan(symbol, lookat)+ #else+ assoc_scan(symbol, lookat, instance)+ NODE *instance;+ #endif  NODE *symbol;  struct search *lookat;  {+ #ifdef	SNMP+ 	if (symbol -> magic) {+ 	    snmp_assoc_scan (symbol, lookat, instance);+ 	    return;+ 	}+ #endif  	if (!symbol->var_array) {  		lookat->retval = NULL;  		return;****************** 261,273 ****--- 319,346 ----  	lookat->arr_ptr = symbol->var_array;  	lookat->arr_end = lookat->arr_ptr + HASHSIZE;	/* added */  	lookat->bucket = symbol->var_array[0];+ #ifndef	SNMP  	assoc_next(lookat);+ #else+ 	assoc_next(symbol,lookat);+ #endif  }    void+ #ifndef	SNMP  assoc_next(lookat)+ #else+ assoc_next(symbol,lookat)+ NODE *symbol;+ #endif  struct search *lookat;  {+ #ifdef	SNMP+ 	if (symbol -> magic) {+ 	    snmp_assoc_next (lookat, 0);+ 	    return;+ 	}+ #endif  	while (lookat->arr_ptr < lookat->arr_end) {  		if (lookat->bucket != 0) {  			lookat->retval = lookat->bucket->ahname;Common subdirectories: gawk-2.13.orig/atari and gawk-2.13/ataridiff -rc gawk-2.13.orig/awk.h gawk-2.13/awk.h*** gawk-2.13.orig/awk.h	Mon Jul  8 19:02:14 1991--- gawk-2.13/awk.h	Thu Dec 12 09:36:49 1991****************** 230,235 ****--- 230,241 ----  	Node_K_while,		/* lnode is condtional, rnode is stuff to run */  	Node_K_for,		/* lnode is for_struct, rnode is stuff to run */  	Node_K_arrayfor,	/* lnode is for_struct, rnode is stuff to run */+ #ifdef	SNMP+ 				/* init: target+ 				   cond: instance (optional)+ 				   incr: array+ 				 */+ #endif  	Node_K_break,		/* no subs */  	Node_K_continue,	/* no stuff */  	Node_K_print,		/* lnode is exp_list, rnode is redirect */****************** 251,256 ****--- 257,265 ----    	/* Variables */  /*60*/	Node_var,		/* rnode is value, lnode is array stuff */+ #ifdef	SNMP+ 				/* magic is pointer to (OT) */+ #endif  	Node_var_array,		/* array is ptr to elements, asize num of  				 * eles */  	Node_val,		/* node is a value - type in flags */****************** 319,324 ****--- 328,336 ----  #			define	CASE	1  #			define	CONST	2  #			define	FS_DFLT	4+ #ifdef	SNMP+ 			caddr_t cookie;+ #endif  		} nodep;  		struct {  			AWKNUM fltnum;	/* this is here for optimal packing of****************** 366,371 ****--- 378,386 ----  #define lnode	sub.nodep.l.lptr  #define nextp	sub.nodep.l.lptr  #define rnode	sub.nodep.r.rptr+ #ifdef	SNMP+ #define	magic	sub.nodep.cookie+ #endif  #define source_file	sub.nodep.x.name  #define	source_line	sub.nodep.number  #define	param_cnt	sub.nodep.number****************** 414,419 ****--- 429,437 ----  	NODE **arr_end;  	NODE *bucket;  	NODE *retval;+ #ifdef	SNMP+ 	caddr_t snmp;+ #endif  };    /* for faster input, bypass stdio */****************** 513,527 ****      #ifndef MPROF  #define	getnode(n)	if (nextfree) n = nextfree, nextfree = nextfree->nextp;\  			else n = more_nodes()  #define	freenode(n)	((n)->nextp = nextfree, nextfree = (n))  #else  #define	getnode(n)	emalloc(n, NODE *, sizeof(NODE), "getnode")  #define	freenode(n)	free(n)  #endif  ! #ifdef DEBUG  #define	tree_eval(t)	r_tree_eval(t)  #else  #define	tree_eval(t)	(_t = (t),(_t) == NULL ? Nnull_string : \--- 531,558 ----      #ifndef MPROF+ #ifndef	SNMP  #define	getnode(n)	if (nextfree) n = nextfree, nextfree = nextfree->nextp;\  			else n = more_nodes()+ #else+ #define	getnode(n)	if (nextfree) n = nextfree, n->magic = NULL, nextfree = nextfree->nextp;\+ 			else n = more_nodes(), n->magic = NULL+ #endif+ #ifndef	DEBUG  #define	freenode(n)	((n)->nextp = nextfree, nextfree = (n))+ #endif  #else+ #ifndef	SNMP  #define	getnode(n)	emalloc(n, NODE *, sizeof(NODE), "getnode")+ #else+ #define	getnode(n)	emalloc(n, NODE *, sizeof(NODE), "getnode"), n->magic = NULL+ #endif+ #ifndef	DEBUG  #define	freenode(n)	free(n)  #endif+ #endif  ! #ifdef	DEBUG  #define	tree_eval(t)	r_tree_eval(t)  #else  #define	tree_eval(t)	(_t = (t),(_t) == NULL ? Nnull_string : \****************** 610,623 ****--- 641,663 ----  extern void set_ORS();    /* array.c */+ #ifndef	SNMP  extern NODE *concat_exp P((NODE *tree));+ #else+ extern NODE *concat_exp P((NODE *tree, int isnmp));+ #endif  extern void assoc_clear P((NODE *symbol));  extern unsigned int hash P((char *s, int len));  extern int in_array P((NODE *symbol, NODE *subs));  extern NODE **assoc_lookup P((NODE *symbol, NODE *subs));  extern void do_delete P((NODE *symbol, NODE *tree));+ #ifndef	SNMP  extern void assoc_scan P((NODE *symbol, struct search *lookat));  extern void assoc_next P((struct search *lookat));+ #else+ extern void assoc_scan P((NODE *symbol, struct search *lookat, NODE *instance));+ extern void assoc_next P((NODE *symbol, struct search *lookat));+ #endif  /* awk.tab.c */  extern char *tokexpand P((void));  extern char nextc P((void));****************** 780,782 ****--- 820,848 ----  #endif    extern char casetable[];	/* for case-independent regexp matching */+ + + #ifdef	SNMP+ extern	NODE   *AGENT_node,+ 	       *COMMUNITY_node,+ 	       *DIAGNOSTIC_node,+ 	       *ERROR_node,+ 	       *RETRIES_node,+ 	       *TIMEOUT_node;+ + extern	NODE   *Ndot_string;+ + extern	NODE   *SET_node;+ extern	NODE   *SET_inst;+ + extern	int	snmp_enabled;+ extern	char   *snmp_file;+ + + extern	int	check_snmp P((NODE *r, char *name));+ extern	int	snmp_get P((NODE *ptr, char *instname));+ extern	void	snmp_set P((void));+ extern	char   *snmp_name P((NODE *ptr));+ extern	void	snmp_assoc_scan P((NODE *symbol));+ extern	void	snmp_assoc_next P((struct search *lookat, int done));+ #endifdiff -rc gawk-2.13.orig/awk.y gawk-2.13/awk.y*** gawk-2.13.orig/awk.y	Sat Jun 29 09:52:57 1991--- gawk-2.13/awk.y	Thu Dec 12 09:18:15 1991****************** 333,338 ****--- 333,343 ----  		{ $$ = node ($3, Node_K_while, $6); }  	| LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls  		{ $$ = node ($6, Node_K_do, $3); }+ 	| LEX_FOR '(' NAME LEX_IN NAME comma exp r_paren opt_nls statement+ 	  {+ 		$$ = node ($10, Node_K_arrayfor, make_for_loop(variable($3,1),+ 			$7, variable($5,1)));+ 	  }  	| LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement  	  {  		$$ = node ($8, Node_K_arrayfor, make_for_loop(variable($3,1),****************** 728,733 ****--- 733,741 ----  	*do_split(),	*do_system(),	*do_int(),	*do_close(),  	*do_atan2(),	*do_sin(),	*do_cos(),	*do_rand(),  	*do_srand(),	*do_match(),	*do_tolower(),	*do_toupper(),+ #ifdef	SNMP+ 	*do_band (),	*do_bor (),+ #endif  	*do_sub(),	*do_gsub(),	*do_strftime(),	*do_systime();    /* Tokentab is sorted ascii ascending order, so it can be binary searched. */****************** 736,741 ****--- 744,753 ----  {"BEGIN",	Node_illegal,	 LEX_BEGIN,	0,		0},  {"END",		Node_illegal,	 LEX_END,	0,		0},  {"atan2",	Node_builtin,	 LEX_BUILTIN,	NOT_OLD|A(2),	do_atan2},+ #ifdef	SNMP+ { "bit_and",	Node_builtin,	 LEX_BUILTIN,	0,		do_band},+ { "bit_or",	Node_builtin,	 LEX_BUILTIN,	0,		do_bor},+ #endif  {"break",	Node_K_break,	 LEX_BREAK,	0,		0},  {"close",	Node_builtin,	 LEX_BUILTIN,	NOT_OLD|A(1),	do_close},  {"continue",	Node_K_continue, LEX_CONTINUE,	0,		0},***************

⌨️ 快捷键说明

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