Lines Matching refs:stream

40 static	void				reset			(pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream); 
41 static void add (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el, void (ANTLR3_CDECL *f…
42 static void * next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
43 static pANTLR3_BASE_TREE nextTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
44 static void * nextToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
45 static void * _next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
46 static void * dupTok (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el);
47 static void * dupTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el);
48 static void * dupTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el);
49 static pANTLR3_BASE_TREE toTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element);
50 static pANTLR3_BASE_TREE toTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element);
51 static ANTLR3_BOOLEAN hasNext (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
52 static pANTLR3_BASE_TREE nextNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
53 static pANTLR3_BASE_TREE nextNodeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
54 static pANTLR3_BASE_TREE nextNodeToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
55 static ANTLR3_UINT32 size (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
56 static void * getDescription (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
57 static void freeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
58 static void expungeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream);
65 freeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in freeRS() argument
72 if (stream->elements != NULL) in freeRS()
77 if (stream->elements->factoryMade == ANTLR3_TRUE) in freeRS()
79 …pANTLR3_VECTOR_FACTORY factory = ((pANTLR3_COMMON_TREE_ADAPTOR)(stream->adaptor->super))->arboretu… in freeRS()
80 factory->returnVector(factory, stream->elements); in freeRS()
82 stream->elements = NULL; in freeRS()
89 stream->elements->clear(stream->elements); in freeRS()
90 stream->freeElements = ANTLR3_TRUE; in freeRS()
95 stream->freeElements = ANTLR3_FALSE; // Just in case in freeRS()
102stream->rec->state->rStreams->add(stream->rec->state->rStreams, stream, (void(*)(void *))expungeRS… in freeRS()
108 freeNodeRS(pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in freeNodeRS() argument
120 if (stream->elements != NULL) in freeNodeRS()
126 for (i = 1; i<= stream->elements->count; i++) in freeNodeRS()
128 tree = (pANTLR3_BASE_TREE)(stream->elements->elements[i-1].element); in freeNodeRS()
139 if (stream->elements->factoryMade == ANTLR3_TRUE) in freeNodeRS()
141 …pANTLR3_VECTOR_FACTORY factory = ((pANTLR3_COMMON_TREE_ADAPTOR)(stream->adaptor->super))->arboretu… in freeNodeRS()
142 factory->returnVector(factory, stream->elements); in freeNodeRS()
144 stream->elements = NULL; in freeNodeRS()
148 stream->elements->clear(stream->elements); in freeNodeRS()
149 stream->freeElements = ANTLR3_TRUE; in freeNodeRS()
154 if (stream->singleElement != NULL) in freeNodeRS()
156 tree = (pANTLR3_BASE_TREE)(stream->singleElement); in freeNodeRS()
163 stream->singleElement = NULL; in freeNodeRS()
164 stream->freeElements = ANTLR3_FALSE; // Just in case in freeNodeRS()
171stream->rec->state->rStreams->add(stream->rec->state->rStreams, stream, (void(*)(void *))expungeRS… in freeNodeRS()
174 expungeRS(pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in expungeRS() argument
177 if (stream->freeElements == ANTLR3_TRUE && stream->elements != NULL) in expungeRS()
179 stream->elements->free(stream->elements); in expungeRS()
181 ANTLR3_FREE(stream); in expungeRS()
189 pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream; in antlr3RewriteRuleElementStreamNewAE() local
200 stream = rec->state->rStreams->remove(rec->state->rStreams, rec->state->rStreams->count - 1); in antlr3RewriteRuleElementStreamNewAE()
212stream = (pANTLR3_REWRITE_RULE_ELEMENT_STREAM) ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_REWRITE_RULE_E… in antlr3RewriteRuleElementStreamNewAE()
214 if (stream == NULL) in antlr3RewriteRuleElementStreamNewAE()
218 stream->elements = NULL; in antlr3RewriteRuleElementStreamNewAE()
219 stream->freeElements = ANTLR3_FALSE; in antlr3RewriteRuleElementStreamNewAE()
224 stream->rec = rec; in antlr3RewriteRuleElementStreamNewAE()
225 stream->reset = reset; in antlr3RewriteRuleElementStreamNewAE()
226 stream->add = add; in antlr3RewriteRuleElementStreamNewAE()
227 stream->next = next; in antlr3RewriteRuleElementStreamNewAE()
228 stream->nextTree = nextTree; in antlr3RewriteRuleElementStreamNewAE()
229 stream->nextNode = nextNode; in antlr3RewriteRuleElementStreamNewAE()
230 stream->nextToken = nextToken; in antlr3RewriteRuleElementStreamNewAE()
231 stream->_next = _next; in antlr3RewriteRuleElementStreamNewAE()
232 stream->hasNext = hasNext; in antlr3RewriteRuleElementStreamNewAE()
233 stream->size = size; in antlr3RewriteRuleElementStreamNewAE()
234 stream->getDescription = getDescription; in antlr3RewriteRuleElementStreamNewAE()
235 stream->toTree = toTree; in antlr3RewriteRuleElementStreamNewAE()
236 stream->free = freeRS; in antlr3RewriteRuleElementStreamNewAE()
237 stream->singleElement = NULL; in antlr3RewriteRuleElementStreamNewAE()
242 stream->cursor = 0; in antlr3RewriteRuleElementStreamNewAE()
243 stream->dirty = ANTLR3_FALSE; in antlr3RewriteRuleElementStreamNewAE()
247 stream->elementDescription = description; in antlr3RewriteRuleElementStreamNewAE()
251 stream->adaptor = adaptor; in antlr3RewriteRuleElementStreamNewAE()
253 return stream; in antlr3RewriteRuleElementStreamNewAE()
259 pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream; in antlr3RewriteRuleElementStreamNewAEE() local
263 stream = antlr3RewriteRuleElementStreamNewAE(adaptor, rec, description); in antlr3RewriteRuleElementStreamNewAEE()
265 if (stream == NULL) in antlr3RewriteRuleElementStreamNewAEE()
274 stream->add(stream, oneElement, NULL); in antlr3RewriteRuleElementStreamNewAEE()
276 return stream; in antlr3RewriteRuleElementStreamNewAEE()
282 pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream; in antlr3RewriteRuleElementStreamNewAEV() local
286 stream = antlr3RewriteRuleElementStreamNewAE(adaptor, rec, description); in antlr3RewriteRuleElementStreamNewAEV()
288 if (stream == NULL) in antlr3RewriteRuleElementStreamNewAEV()
290 return stream; in antlr3RewriteRuleElementStreamNewAEV()
297 …if (stream->elements != NULL && stream->elements->factoryMade == ANTLR3_FALSE && stream->freeEleme… in antlr3RewriteRuleElementStreamNewAEV()
299 stream->elements->free(stream->elements); in antlr3RewriteRuleElementStreamNewAEV()
301 stream->elements = vector; in antlr3RewriteRuleElementStreamNewAEV()
302 stream->freeElements = ANTLR3_FALSE; in antlr3RewriteRuleElementStreamNewAEV()
303 return stream; in antlr3RewriteRuleElementStreamNewAEV()
311 pANTLR3_REWRITE_RULE_TOKEN_STREAM stream; in antlr3RewriteRuleTOKENStreamNewAE() local
315 stream = antlr3RewriteRuleElementStreamNewAE(adaptor, rec, description); in antlr3RewriteRuleTOKENStreamNewAE()
317 if (stream == NULL) in antlr3RewriteRuleTOKENStreamNewAE()
319 return stream; in antlr3RewriteRuleTOKENStreamNewAE()
324 stream->dup = dupTok; in antlr3RewriteRuleTOKENStreamNewAE()
325 stream->nextNode = nextNodeToken; in antlr3RewriteRuleTOKENStreamNewAE()
329 return stream; in antlr3RewriteRuleTOKENStreamNewAE()
335 pANTLR3_REWRITE_RULE_TOKEN_STREAM stream; in antlr3RewriteRuleTOKENStreamNewAEE() local
339 stream = antlr3RewriteRuleElementStreamNewAEE(adaptor, rec, description, oneElement); in antlr3RewriteRuleTOKENStreamNewAEE()
343 stream->dup = dupTok; in antlr3RewriteRuleTOKENStreamNewAEE()
344 stream->nextNode = nextNodeToken; in antlr3RewriteRuleTOKENStreamNewAEE()
348 return stream; in antlr3RewriteRuleTOKENStreamNewAEE()
354 pANTLR3_REWRITE_RULE_TOKEN_STREAM stream; in antlr3RewriteRuleTOKENStreamNewAEV() local
358 stream = antlr3RewriteRuleElementStreamNewAEV(adaptor, rec, description, vector); in antlr3RewriteRuleTOKENStreamNewAEV()
362 stream->dup = dupTok; in antlr3RewriteRuleTOKENStreamNewAEV()
363 stream->nextNode = nextNodeToken; in antlr3RewriteRuleTOKENStreamNewAEV()
367 return stream; in antlr3RewriteRuleTOKENStreamNewAEV()
375 pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream; in antlr3RewriteRuleSubtreeStreamNewAE() local
379 stream = antlr3RewriteRuleElementStreamNewAE(adaptor, rec, description); in antlr3RewriteRuleSubtreeStreamNewAE()
381 if (stream == NULL) in antlr3RewriteRuleSubtreeStreamNewAE()
383 return stream; in antlr3RewriteRuleSubtreeStreamNewAE()
388 stream->dup = dupTree; in antlr3RewriteRuleSubtreeStreamNewAE()
389 stream->nextNode = nextNode; in antlr3RewriteRuleSubtreeStreamNewAE()
390 stream->free = freeNodeRS; in antlr3RewriteRuleSubtreeStreamNewAE()
391 return stream; in antlr3RewriteRuleSubtreeStreamNewAE()
397 pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream; in antlr3RewriteRuleSubtreeStreamNewAEE() local
401 stream = antlr3RewriteRuleElementStreamNewAEE(adaptor, rec, description, oneElement); in antlr3RewriteRuleSubtreeStreamNewAEE()
403 if (stream == NULL) in antlr3RewriteRuleSubtreeStreamNewAEE()
405 return stream; in antlr3RewriteRuleSubtreeStreamNewAEE()
410 stream->dup = dupTree; in antlr3RewriteRuleSubtreeStreamNewAEE()
411 stream->nextNode = nextNode; in antlr3RewriteRuleSubtreeStreamNewAEE()
412 stream->free = freeNodeRS; in antlr3RewriteRuleSubtreeStreamNewAEE()
414 return stream; in antlr3RewriteRuleSubtreeStreamNewAEE()
420 pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream; in antlr3RewriteRuleSubtreeStreamNewAEV() local
424 stream = antlr3RewriteRuleElementStreamNewAEV(adaptor, rec, description, vector); in antlr3RewriteRuleSubtreeStreamNewAEV()
426 if (stream == NULL) in antlr3RewriteRuleSubtreeStreamNewAEV()
433 stream->dup = dupTree; in antlr3RewriteRuleSubtreeStreamNewAEV()
434 stream->nextNode = nextNode; in antlr3RewriteRuleSubtreeStreamNewAEV()
435 stream->free = freeNodeRS; in antlr3RewriteRuleSubtreeStreamNewAEV()
437 return stream; in antlr3RewriteRuleSubtreeStreamNewAEV()
444 pANTLR3_REWRITE_RULE_NODE_STREAM stream; in antlr3RewriteRuleNODEStreamNewAE() local
448 stream = antlr3RewriteRuleElementStreamNewAE(adaptor, rec, description); in antlr3RewriteRuleNODEStreamNewAE()
450 if (stream == NULL) in antlr3RewriteRuleNODEStreamNewAE()
452 return stream; in antlr3RewriteRuleNODEStreamNewAE()
457 stream->dup = dupTreeNode; in antlr3RewriteRuleNODEStreamNewAE()
458 stream->toTree = toTreeNode; in antlr3RewriteRuleNODEStreamNewAE()
459 stream->nextNode = nextNodeNode; in antlr3RewriteRuleNODEStreamNewAE()
460 stream->free = freeNodeRS; in antlr3RewriteRuleNODEStreamNewAE()
462 return stream; in antlr3RewriteRuleNODEStreamNewAE()
468 pANTLR3_REWRITE_RULE_NODE_STREAM stream; in antlr3RewriteRuleNODEStreamNewAEE() local
472 stream = antlr3RewriteRuleElementStreamNewAEE(adaptor, rec, description, oneElement); in antlr3RewriteRuleNODEStreamNewAEE()
476 stream->dup = dupTreeNode; in antlr3RewriteRuleNODEStreamNewAEE()
477 stream->toTree = toTreeNode; in antlr3RewriteRuleNODEStreamNewAEE()
478 stream->nextNode = nextNodeNode; in antlr3RewriteRuleNODEStreamNewAEE()
479 stream->free = freeNodeRS; in antlr3RewriteRuleNODEStreamNewAEE()
481 return stream; in antlr3RewriteRuleNODEStreamNewAEE()
487 pANTLR3_REWRITE_RULE_NODE_STREAM stream; in antlr3RewriteRuleNODEStreamNewAEV() local
491 stream = antlr3RewriteRuleElementStreamNewAEV(adaptor, rec, description, vector); in antlr3RewriteRuleNODEStreamNewAEV()
495 stream->dup = dupTreeNode; in antlr3RewriteRuleNODEStreamNewAEV()
496 stream->toTree = toTreeNode; in antlr3RewriteRuleNODEStreamNewAEV()
497 stream->nextNode = nextNodeNode; in antlr3RewriteRuleNODEStreamNewAEV()
498 stream->free = freeNodeRS; in antlr3RewriteRuleNODEStreamNewAEV()
500 return stream; in antlr3RewriteRuleNODEStreamNewAEV()
510 reset (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in reset() argument
512 stream->dirty = ANTLR3_TRUE; in reset()
513 stream->cursor = 0; in reset()
519 add (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el, void (ANTLR3_CDECL *freePtr)(void *… in add() argument
529 if (stream->elements != NULL && stream->elements->count > 0) in add()
534 stream->elements->add(stream->elements, el, freePtr); in add()
537 if (stream->singleElement == NULL) in add()
539 stream->singleElement = el; in add()
546 if (stream->elements == NULL) in add()
548 …pANTLR3_VECTOR_FACTORY factory = ((pANTLR3_COMMON_TREE_ADAPTOR)(stream->adaptor->super))->arboretu… in add()
551 stream->elements = factory->newVector(factory); in add()
552 stream->freeElements = ANTLR3_TRUE; // We 'ummed it, so we play it son. in add()
555 stream->elements->add (stream->elements, stream->singleElement, freePtr); in add()
556 stream->elements->add (stream->elements, el, freePtr); in add()
557 stream->singleElement = NULL; in add()
568 nextTree(pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in nextTree() argument
573 n = stream->size(stream); in nextTree()
575 if ( stream->dirty || (stream->cursor >=n && n==1) ) in nextTree()
579 el = stream->_next(stream); in nextTree()
580 return stream->dup(stream, el); in nextTree()
585 el = stream->_next(stream); in nextTree()
592 nextToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in nextToken() argument
594 return stream->_next(stream); in nextToken()
601 next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in next() argument
605 s = stream->size(stream); in next()
606 if (stream->cursor >= s && s == 1) in next()
610 el = stream->_next(stream); in next()
612 return stream->dup(stream, el); in next()
615 return stream->_next(stream); in next()
625 _next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in _next() argument
630 n = stream->size(stream); in _next()
641 if (stream->cursor >= n) in _next()
647 return stream->toTree(stream, stream->singleElement); in _next()
659 if (stream->singleElement != NULL) in _next()
661 stream->cursor++; // Cursor advances even for single element as this tells us to dup() in _next()
662 return stream->toTree(stream, stream->singleElement); in _next()
668 t = stream->toTree(stream, stream->elements->get(stream->elements, stream->cursor)); in _next()
669 stream->cursor++; in _next()
682 dupTok (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el) in dupTok() argument
696 dupTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) in dupTree() argument
698 return stream->adaptor->dupNode(stream->adaptor, (pANTLR3_BASE_TREE)element); in dupTree()
710 dupTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) in dupTreeNode() argument
721 toTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) in toTree() argument
738 toTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) in toTreeNode() argument
740 return stream->adaptor->dupNode(stream->adaptor, (pANTLR3_BASE_TREE)element); in toTreeNode()
750 hasNext (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in hasNext() argument
752 if ( (stream->singleElement != NULL && stream->cursor < 1) in hasNext()
753 || (stream->elements != NULL && stream->cursor < stream->elements->size(stream->elements))) in hasNext()
767 nextNodeToken(pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in nextNodeToken() argument
769 return stream->adaptor->create(stream->adaptor, stream->_next(stream)); in nextNodeToken()
773 nextNodeNode(pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in nextNodeNode() argument
775 return stream->_next(stream); in nextNodeNode()
788 nextNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in nextNode() argument
792 pANTLR3_BASE_TREE el = stream->_next(stream); in nextNode()
794 n = stream->size(stream); in nextNode()
795 if (stream->dirty == ANTLR3_TRUE || (stream->cursor > n && n == 1)) in nextNode()
800 return stream->adaptor->dupNode(stream->adaptor, el); in nextNode()
811 size (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in size() argument
819 if (stream->singleElement != NULL) in size()
825 if (stream->elements != NULL) in size()
827 return (ANTLR3_UINT32)(stream->elements->count); in size()
836 getDescription (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) in getDescription() argument
838 if (stream->elementDescription == NULL) in getDescription()
840 stream->elementDescription = "<unknown source>"; in getDescription()
843 return stream->elementDescription; in getDescription()