gecko-dev/cck/globals/globals.cpp
1999-10-22 23:28:27 +00:00

54 lines
1009 B
C++

#include "stdafx.h"
#include "WizardTypes.h"
__declspec(dllexport) WIDGET GlobalWidgetArray[1000];
__declspec(dllexport) int GlobalArrayIndex=0;
extern "C" __declspec(dllexport)
WIDGET* findWidget(CString theName)
{
for (int i = 0; i < GlobalArrayIndex; i++)
{
if (GlobalWidgetArray[i].name == theName) {
return (&GlobalWidgetArray[i]);
}
}
return NULL;
}
extern "C" __declspec(dllexport)
WIDGET* SetGlobal(CString theName, CString theValue)
{
WIDGET* w = findWidget(theName);
if (w == NULL)
{
// Make sure we can add this value
if (GlobalArrayIndex >= sizeof(GlobalWidgetArray))
exit(11);
GlobalWidgetArray[GlobalArrayIndex].name = theName;
GlobalWidgetArray[GlobalArrayIndex].value = theValue;
w = &GlobalWidgetArray[GlobalArrayIndex];
GlobalArrayIndex++;
}
else
w->value = theValue;
return w;
}
extern "C" __declspec(dllexport)
char *GetGlobal(CString theName)
{
WIDGET *w = findWidget(theName);
if (w)
return (char *) (LPCTSTR) w->value;
return "";
}