// Write key values to a file static void createKeyValues(FILE* f, const KeyDesc* key) { // If the key is missing, don't write it. if (key->mMissing) return; // Write the key name _ftprintf(f, _T("%s="), key->mpName); switch (key->mType) { case kIntArray: case kInt: { // Write the key values separated by a space const TCHAR* space = _T(""); int i; for (i = 0; i < key->mValueCount; ++i) { int v = static_cast<int*>(key->mpValue)[i]; const TCHAR* fmt = getIntFormat(v); _ftprintf(f, _T("%s"), space); _ftprintf(f, fmt, v); space = _T(" "); } } break; case kFloatArray: case kFloat: { // Write the key values separated by a space const TCHAR* space = _T(""); int i; for (i = 0; i < key->mValueCount; ++i) { float v = static_cast<float*>(key->mpValue)[i]; const TCHAR* fmt = getFloatFormat(); _ftprintf(f, _T("%s"), space); _ftprintf(f, fmt, v); space = _T(" "); } } break; case kString: { // Write the key value TCHAR* v = static_cast<TCHAR*>(key->mpValue); _ftprintf(f, _T("%s"), v); } break; } _ftprintf(f, _T("\r\n")); }
const PUP::machineInfo &PUP::machineInfo::current(void) { static machineInfo *m=NULL; if (m==NULL) {//Allocate, initialize, and return m m=new machineInfo(); for (int i=0;i<4;i++) m->magic[i]=machInfo_magic[i]; m->version=0; m->intBytes[0]=sizeof(char); m->intBytes[1]=sizeof(short); m->intBytes[2]=sizeof(int); m->intBytes[3]=sizeof(long); m->intFormat=getIntFormat(); m->floatBytes=sizeof(float); m->doubleBytes=sizeof(double); m->floatFormat=getFloatFormat(); m->boolBytes=sizeof(CmiBool); m->pointerBytes=sizeof(void*); m->padding[0]=0; } return *m; }