Functions 1-8 just call another function using the appropriate custom character number. Ex.:
Code: Select all
extern "C" DLLEXPORT char *
__stdcall function1(char *param1, char *param2)
{
return bar(1, param1, param2);
}
Code: Select all
char* bar (int no, char* param1, char* param2)
{
//param1 is the value of bar 1, param2 is bar2
double vala = atof (param1);
double valb = atof (param2);
//start with a blank custom character
int graph[] = {0,0,0,0,0,0,0,0};
//and also define the $Chr numbers
static const char* const chrs[] = {"176", "158", "131", "132", "133", "134", "135", "136"};
//define the breakpoints for each pixel
static const double breaks[] = {88.89, 77.78, 66.67, 55.56, 44.44, 33.33, 22.22, 11.11};
//define the custom character
for (int i = 0; i<8; i++)
{
if (vala >= breaks[i]) graph[i] += 24;
if (valb >= breaks[i]) graph[i] += 3;
}
//build the string to return
std::stringstream ret;
ret << "$CustomChar(" << no << ",";
for (int i = 0; i < 7; i++)
ret << graph[i] << ", ";
ret << graph[7] << ")$Chr(" << chrs[no-1] << ")";
static char out[100];
strcpy(out, ret.str().c_str());
return(out);
}