• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/libantlr3c-3.2/src/

Lines Matching refs:factory

100 static  void                newPool             (pANTLR3_VECTOR_FACTORY factory);
101 static void closeVectorFactory (pANTLR3_VECTOR_FACTORY factory);
102 static pANTLR3_VECTOR newVector (pANTLR3_VECTOR_FACTORY factory);
103 static void returnVector (pANTLR3_VECTOR_FACTORY factory, pANTLR3_VECTOR vector);
1125 // Assume that this is not a factory made vector
1431 /// Vector factory creation
1436 pANTLR3_VECTOR_FACTORY factory;
1438 // Allocate memory for the factory
1440 factory = (pANTLR3_VECTOR_FACTORY)ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_VECTOR_FACTORY)));
1442 if (factory == NULL)
1449 factory->pools = NULL;
1450 factory->thisPool = -1;
1452 newPool(factory);
1457 antlr3SetVectorApi(&(factory->unTruc), ANTLR3_VECTOR_INTERNAL_SIZE);
1459 factory->unTruc.factoryMade = ANTLR3_TRUE;
1461 // Install the factory API
1463 factory->close = closeVectorFactory;
1464 factory->newVector = newVector;
1465 factory->returnVector = returnVector;
1469 factory->freeStack = antlr3StackNew(16);
1470 return factory;
1477 returnVector (pANTLR3_VECTOR_FACTORY factory, pANTLR3_VECTOR vector)
1485 // factory, so we already know how to release its memory when it
1486 // dies by virtue of the factory being closed.
1488 factory->freeStack->push(factory->freeStack, vector, NULL);
1490 // TODO: remove this line once happy printf("Returned vector %08X to the pool, stack size is %d\n", vector, factory->freeStack->size(factory->freeStack));
1494 newPool(pANTLR3_VECTOR_FACTORY factory)
1496 /* Increment factory count
1498 factory->thisPool++;
1502 factory->pools = (pANTLR3_VECTOR *)
1503 ANTLR3_REALLOC( (void *)factory->pools, /* Current pools pointer (starts at NULL) */
1504 (ANTLR3_UINT32)((factory->thisPool + 1) * sizeof(pANTLR3_VECTOR *)) /* Memory for new pool pointers */
1507 /* Allocate a new pool for the factory
1509 factory->pools[factory->thisPool] =
1516 factory->nextVector = 0;
1524 closeVectorFactory (pANTLR3_VECTOR_FACTORY factory)
1534 if (factory->freeStack != NULL)
1536 factory->freeStack->free(factory->freeStack);
1541 for (poolCount = 0; poolCount <= factory->thisPool; poolCount++)
1545 pool = factory->pools[poolCount];
1549 limit = (poolCount == factory->thisPool ? factory->nextVector : ANTLR3_FACTORY_VPOOL_SIZE);
1569 // this is a factory allocated pool vector and so it won't free things it
1583 for (poolCount = 0; poolCount <= factory->thisPool; poolCount++)
1587 pool = factory->pools[poolCount];
1591 limit = (poolCount == factory->thisPool ? factory->nextVector : ANTLR3_FACTORY_VPOOL_SIZE);
1606 // Anything in here should be factory made, but we do this just
1621 ANTLR3_FREE(factory->pools[poolCount]);
1622 factory->pools[poolCount] = NULL;
1628 ANTLR3_FREE(factory->pools);
1630 /* Finally, we can free the space for the factory itself
1632 ANTLR3_FREE(factory);
1637 newVector(pANTLR3_VECTOR_FACTORY factory)
1643 vector = factory->freeStack->peek(factory->freeStack);
1649 factory->freeStack->pop(factory->freeStack);
1651 // TODO: remove this line once happy printf("Reused vector %08X from stack, size is now %d\n", vector, factory->freeStack->size(factory->freeStack));
1659 if (factory->nextVector >= ANTLR3_FACTORY_VPOOL_SIZE)
1663 newPool(factory);
1669 vector = factory->pools[factory->thisPool] + factory->nextVector;
1670 factory->nextVector++;