| 2760 | // Set an AstroExpression custom string or string list to the given input. |
| 2761 | |
| 2762 | flag ExpSetString(int i, CONST char *sz, flag fList) |
| 2763 | { |
| 2764 | int csz, j; |
| 2765 | char *szAlloc = NULL, *pch, *pchT; |
| 2766 | |
| 2767 | // Simple case: Simply assign input string to AstroExpression string. |
| 2768 | if (!FEnsureExpStr(i+1)) |
| 2769 | return fFalse; |
| 2770 | if (!fList) |
| 2771 | return FCloneSz(sz, &xi.rgszExpStr[i]); |
| 2772 | if (!FCloneSz(sz, &szAlloc)) |
| 2773 | return fFalse; |
| 2774 | |
| 2775 | // Complex case: Use first character as delimeter within list of strings. |
| 2776 | for (pch = szAlloc, csz = 0; *pch; pch++) |
| 2777 | if (*pch == szAlloc[0]) |
| 2778 | csz++; |
| 2779 | if (csz <= 0) |
| 2780 | goto LDone; |
| 2781 | pch = szAlloc + 1; |
| 2782 | for (j = 0; j < csz; j++) { |
| 2783 | for (pchT = pch; *pchT && *pchT != szAlloc[0]; pchT++) |
| 2784 | ; |
| 2785 | *pchT = chNull; |
| 2786 | if (!ExpSetString(i + j, pch, fFalse)) |
| 2787 | break; |
| 2788 | pch = pchT + 1; |
| 2789 | } |
| 2790 | LDone: |
| 2791 | DeallocateP(szAlloc); |
| 2792 | return fTrue; |
| 2793 | } |
| 2794 | |
| 2795 | |
| 2796 | // Set a sequence of AstroExpression custom variables based on values |
no test coverage detected