MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / handleVFOR

Method handleVFOR

src/library/blas/gens/kprintf.cpp:1636–1731  ·  view source on GitHub ↗

PENDING: COMPLEX DATA TYPE HANDLING may need special attention

Source from the content-addressed store, hash-verified

1634// PENDING: COMPLEX DATA TYPE HANDLING may need special attention
1635//
1636void kprintf::handleVFOR(char **src, char **dst, bool isReal)
1637{
1638 char *start, *end;
1639 char *vforBody, *vforBodyTemp, *vforGeneratedBody;
1640 int bracecount = 0;
1641 int vforBodyLength;
1642
1643 if (isReal == false)
1644 {
1645 start = (*src) + strlen("%VFOR");
1646 } else {
1647 start = (*src) + strlen("%VFOR_REAL");
1648 }
1649
1650 while ( (*start != '{') && (*start != 0))
1651 {
1652 //PENDING: if (notwhitespace(*start)) { signal exception bad syntax }
1653 start++;
1654 }
1655 if (*start == 0)
1656 {
1657 // PENDING: Raise an EXCEPTION!
1658 printf("KPRINTF: handleVFOR: Bad Syntax...\n");
1659 return;
1660 }
1661
1662 bracecount = 1;
1663 end = start+1;
1664 while(bracecount)
1665 {
1666 if (*end == 0)
1667 {
1668 break;
1669 } else if (*end == '{')
1670 {
1671 bracecount++;
1672 } else if (*end == '}') {
1673 bracecount--;
1674 }
1675 end++;
1676 }
1677
1678 if (*end == 0)
1679 {
1680 // PENDING: Raise an EXCEPTION!
1681 printf("KPRINTF: handleVFOR: Bad Syntax...\n");
1682 return;
1683 }
1684
1685 vforBodyLength = end - start;
1686 vforBody = (char*)malloc((vforBodyLength + 1)*sizeof(char));
1687 vforBodyTemp = (char*)malloc((vforBodyLength + 1)*sizeof(char));
1688 vforGeneratedBody = (char*)malloc(((vforBodyLength + 1)*sizeof(char)) * vectorWidth * 2);
1689 memcpy(vforBody, start, vforBodyLength);
1690 vforBody[vforBodyLength] = 0;
1691
1692 for(int v=0; v<vectorWidth; v++)
1693 {

Callers

nothing calls this directly

Calls 3

itoaFunction · 0.85
putMethod · 0.80
spitMethod · 0.80

Tested by

no test coverage detected