Improved userhooks
This commit is contained in:
		
							parent
							
								
									b457c3dc09
								
							
						
					
					
						commit
						eb5d7ef3fe
					
				
					 1 changed files with 21 additions and 11 deletions
				
			
		|  | @ -57,8 +57,13 @@ LLerror(t) { | ||||||
| 
 | 
 | ||||||
| #ifdef LL_NEWMESS | #ifdef LL_NEWMESS | ||||||
| 	if (t == EOFILE) { | 	if (t == EOFILE) { | ||||||
|  | #ifdef LL_USERHOOK | ||||||
|  | 		LLuserhook(EOFILE); | ||||||
|  | #endif LL_USERHOOK | ||||||
|  | 		if (LLsymb != EOFILE) { | ||||||
| 			LLmessage(-1); | 			LLmessage(-1); | ||||||
| 			while ((LLsymb = LL_LEXI()) > 0) /* nothing */ ; | 			while ((LLsymb = LL_LEXI()) > 0) /* nothing */ ; | ||||||
|  | 		} | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  | @ -98,6 +103,14 @@ LLskip() { | ||||||
| 	return LLdoskip(0); | 	return LLdoskip(0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | LLuserhook(exp) | ||||||
|  | { | ||||||
|  | 	int old = LLsymb; | ||||||
|  | 	LL_USERHOOK(exp); | ||||||
|  | 	LLread(); | ||||||
|  | 	return LLsymb != old; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| LLdoskip(exp) { | LLdoskip(exp) { | ||||||
| #endif LL_USERHOOK | #endif LL_USERHOOK | ||||||
| 	register int i; | 	register int i; | ||||||
|  | @ -106,22 +119,19 @@ LLdoskip(exp) { | ||||||
| 
 | 
 | ||||||
| 	retval = 0; | 	retval = 0; | ||||||
| 	for (;;) { | 	for (;;) { | ||||||
|  | #ifdef LL_USERHOOK | ||||||
|  | 		if (LLuserhook(exp)) continue; | ||||||
|  | #endif LL_USERHOOK | ||||||
| 		if (LLtcnt[LLcsymb] != 0) return retval; | 		if (LLtcnt[LLcsymb] != 0) return retval; | ||||||
| 		LLi = LLcsymb >> 3; | 		LLi = LLcsymb >> 3; | ||||||
| 		LLb = 1 << (LLcsymb & 07); | 		LLb = 1 << (LLcsymb & 07); | ||||||
| 		for (i = LL_NSETS - 1; i >= 0; i--) { | 		for (i = LL_NSETS - 1; i >= 0; i--) { | ||||||
| 			if (LLscnt[i] != 0) { | 			if (LLscnt[i] != 0) { | ||||||
| 				if (LLsets[LL_SSIZE*i+LLi] & LLb) return retval; | 				if (LLsets[LL_SSIZE*i+LLi] & LLb) { | ||||||
|  | 					return retval; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| #ifdef LL_USERHOOK |  | ||||||
| 		{ |  | ||||||
| 			int old = LLsymb; |  | ||||||
| 			LL_USERHOOK(exp); |  | ||||||
| 			LLread(); |  | ||||||
| 			if (LLsymb != old) continue; |  | ||||||
| 		} | 		} | ||||||
| #endif LL_USERHOOK |  | ||||||
| 		LLmessage(0); | 		LLmessage(0); | ||||||
| 		retval = 1; | 		retval = 1; | ||||||
| 		LLread(); | 		LLread(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue