// This is called when the user clicks "Create..." on the New Project dialog CAppWizStepDlg* CXtensnTplAppWiz::Next(CAppWizStepDlg* pDlg) { ASSERT(pDlg == NULL); // By default, this custom AppWizard has no steps // Set template macros based on the project name entered by the user. // Get value of $$root$$ (already set by AppWizard) CString strRoot; m_Dictionary.Lookup(_T("root"), strRoot); // Set value of $$Doc$$, $$DOC$$ CString strDoc = strRoot.Left(6); m_Dictionary[_T("Doc")] = strDoc; strDoc.MakeUpper(); m_Dictionary[_T("DOC")] = strDoc; // Set value of $$MAC_TYPE$$ strRoot = strRoot.Left(4); int nLen = strRoot.GetLength(); if (strRoot.GetLength() < 4) { CString strPad(_T(' '), 4 - nLen); strRoot += strPad; } strRoot.MakeUpper(); m_Dictionary[_T("MAC_TYPE")] = strRoot; // diverse Guids zum dictionary hinzufügen AddGuid (_T("LIBID_GUID")); AddGuid (_T("XTENSION_GUID")); AddGuid (_T("STDAFX_H_GUID"), TRUE); AddGuid (_T("CONFIG_H_GUID"), TRUE); AddGuid (_T("VERSION_H_GUID"), TRUE); AddGuid (_T("XTENSION_H_GUID"), TRUE); AddGuid (_T("XTENSIONUTIL_H_GUID"), TRUE); // aktuelles Datum erzeugen (für VersionsInfo) char buf[128]; time_t timeval; time(&timeval); buf[strftime(buf, sizeof(buf) - 1, "%y%m%d", localtime(&timeval))] = 0; m_Dictionary[_T("version_date")] = buf; buf[strftime(buf, sizeof(buf) - 1, "%d.%m.%Y %H:%M:%S", localtime(&timeval))] = 0; m_Dictionary[_T("date_n_time")] = buf; // Return NULL to indicate there are no more steps. (In this case, there are // no steps at all.) return NULL; }
void Reader::dumpNode(bsl::ostream & os) const { const char *name = nodeName(); const char *value = nodeValue(); const char *nsUri = nodeNamespaceUri(); int line = getLineNumber(); int column = getColumnNumber(); int depth = nodeDepth(); NodeType type = nodeType(); bsl::string strPad((bsl::string::size_type)depth*2, ' '); os << strPad << "Node pos=" << line << ":" << column << " type=" << type << "(" << nodeTypeAsString(type) << ") empty=" << isEmptyElement() << " hasValue=" << nodeHasValue() << " name=" << CHK(name) << " value=" << CHK(value) << " uri=" << CHK(nsUri) << bsl::endl; int numAttr = numAttributes(); for (int i = 0; i < numAttr; ++i) { ElementAttribute attr; lookupAttribute(&attr, i); os << strPad << " ATTRIBUTE " << CHK(attr.qualifiedName()) << "=" << CHK(attr.value()) << " uri=" << CHK(attr.namespaceUri()) << bsl::endl; } }
BOOL MapLine(CString& strLine, BOOL fHTMLFormat ) { static TCHAR szWhiteSpace1[] = _T("\t "); static TCHAR szWhiteSpace2[] = _T("\t\n "); static TCHAR szDefine[] = _T("#define"); TCHAR* pszCopy = _tcsdup(strLine); if (pszCopy == NULL) { AfxThrowMemoryException(); } TCHAR* psz; TCHAR* pszSymbol; TCHAR* pszValue; DWORD dwValue; CString strNewName; TCHAR* pContext=NULL; // '//{{NOHELP}}' can be placed on the line and it will not be included if (_tcsstr(strLine, _T("//{{NOHELP}}")) != NULL) goto RetFalse; psz = _tcstok_s(pszCopy, szWhiteSpace1, &pContext); if (psz == NULL) goto RetFalse; if (_tcscmp(psz, szDefine) != 0) goto RetFalse; pszSymbol = _tcstok_s(NULL, szWhiteSpace1, &pContext); if (pszSymbol == NULL) goto RetFalse; pszValue = _tcstok_s(NULL, szWhiteSpace2, &pContext); if (pszValue == NULL) goto RetFalse; if (!IsValidSymbol(pszSymbol)) goto RetFalse; if (!IsValidValue(pszValue, dwValue)) goto RetFalse; if (!MapNameValue(pszSymbol, strNewName, dwValue)) goto RetFalse; //BLOCK: format output line { CString strPad(_T(' '), 40-strNewName.GetLength()); if (strPad.IsEmpty()) strPad = _T('\t'); if( fHTMLFormat ) strLine = _T("#define ") + strNewName + strPad + StringFromDword(dwValue) + _T("\n"); else strLine = strNewName + strPad + StringFromDword(dwValue) + _T("\n"); } ASSERT(pszCopy != NULL); free(pszCopy); return TRUE; RetFalse: ASSERT(pszCopy != NULL); free(pszCopy); return FALSE; }
void Crosstable::PrintSwiss (DString * dstr, uint playerLimit) { char stemp [1000]; uint player; const char * resultStr [NUM_RESULT_TYPES]; if (OutputFormat == CROSSTABLE_LaTeX) { resultStr[RESULT_White] = "{\\tt +}"; resultStr[RESULT_Draw] = "{\\tt =}"; resultStr[RESULT_Black] = "{\\tt -}"; resultStr[RESULT_None] = "{\\tt *}"; } else { resultStr[RESULT_White] = "+"; resultStr[RESULT_Draw] = "="; resultStr[RESULT_Black] = "-"; resultStr[RESULT_None] = "*"; } dstr->Append (StartTable); if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append ("\\begin{tabular}{rl"); if (PrintRatings) { dstr->Append ("r"); } if (PrintTitles) { dstr->Append ("r"); } if (PrintAges) { dstr->Append ("r"); } if (PrintCountries) { dstr->Append ("l"); } dstr->Append ("r@{ / }r"); if (PrintTiebreaks) { dstr->Append ("r"); } for (uint i=0; i < MaxRound; i++) { dstr->Append ("r"); if (i < MaxRound-1) { dstr->Append ("@{ }"); } } if (PrintRatings) { dstr->Append ("r"); } dstr->Append ("r}\n"); } dstr->Append (StartRow); if (OutputFormat == CROSSTABLE_Html) { dstr->Append ("<th></th> <th>Player</th> "); } else if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append (" & \\bf Player & "); } else { strPad (stemp, "", LongestNameLen + 2 + PlayerNumWidth, ' '); dstr->Append (stemp); } if (PrintRatings) { dstr->Append (StartBoldCol, " Rtng", EndBoldCol); } if (PrintTitles) { dstr->Append (StartBoldCol, " Ti", EndBoldCol); } if (PrintAges) { dstr->Append (StartBoldCol, " Age", EndBoldCol); } if (PrintCountries) { dstr->Append (StartBoldCol, " Nat", EndBoldCol); } if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append (" \\multicolumn{2}{c}{\\bf Score} & "); } else { if (ThreeWin) dstr->Append (" ", StartBoldCol, "Score", EndBoldCol, " "); else dstr->Append (" ", StartBoldCol, " Score ", EndBoldCol, " "); } if (PrintTiebreaks) { dstr->Append (StartBoldCol, "(Tie)", EndBoldCol); } for (uint round = 1; round <= MaxRound; round++) { if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append (" \\multicolumn{1}{c}{\\bf ", round, "} & "); } else { sprintf (stemp, " %s%*d ", SwissColors ? " " : "", PlayerNumWidth, round); dstr->Append (StartBoldCol, stemp, EndBoldCol); } } if (PrintRatings) { dstr->Append (" ", StartBoldCol, "Perf Chg", EndBoldCol); } if (PrintTallies && OutputFormat == CROSSTABLE_Html) { dstr->Append (" ", StartBoldCol, "+/-/=", EndBoldCol); } dstr->Append (EndRow, NewLine); PrintDashesLine (dstr); // Print the rows of players and results: uint previousScore = 0; for (player = 0; player < playerLimit; player++) { uint index = SortedIndex[player]; playerDataT * pdata = PlayerData[index]; // Print a blank line if we are at a new score group: if (SeparateScoreGroups && SortOption == CROSSTABLE_SortScore) { if (player > 0 && pdata->score != previousScore) { dstr->Append (BlankRowLine); } } previousScore = pdata->score; sprintf (stemp, "%*u: ", PlayerNumWidth, player+1); dstr->Append (StartRow, StartRightCol, stemp, EndRightCol); PrintPlayer (dstr, pdata); if (OutputFormat == CROSSTABLE_LaTeX) { sprintf (stemp, " %2u%c%c ", pdata->score / 2, DecimalPointChar, (pdata->score & 1 ? '5' : '0')); dstr->Append (StartRightCol, stemp, EndRightCol); sprintf (stemp, " %2u ", pdata->gameCount); dstr->Append (StartRightCol, stemp, EndRightCol); } else { if (ThreeWin) { sprintf (stemp, " %2u%c%c ", pdata->score / 2, DecimalPointChar, (pdata->score & 1 ? '5' : '0')); } else { sprintf (stemp, " %2u%c%c / %2u ", pdata->score / 2, DecimalPointChar, (pdata->score & 1 ? '5' : '0'), pdata->gameCount); } dstr->Append (StartRightCol, stemp, EndRightCol); } if (PrintTiebreaks) { sprintf (stemp, "%2u%c%c ", pdata->tiebreak / 2, DecimalPointChar, (pdata->tiebreak & 1 ? '5' : '0')); dstr->Append (StartRightCol, stemp, EndRightCol); } uint r_won = 0, r_loss = 0, r_draw = 0; for (uint round = 1; round <= MaxRound; round++) { clashT * clash = pdata->roundClash[round]; dstr->AddChar (' '); dstr->Append (StartRightCol); if (clash == NULL) { dstr->Append ("..."); if (PlayerNumWidth == 3) { dstr->AddChar ('.'); } if (SwissColors) { dstr->AddChar ('.'); } } else { if (OutputFormat == CROSSTABLE_Hypertext) { if (CurrentGame == clash->gameNum) sprintf (stemp, "<green><g_%u>", clash->gameNum); else sprintf (stemp, "<blue><g_%u>", clash->gameNum); dstr->Append (stemp); } if (SwissColors) { sprintf (stemp, "%*d%c%s", PlayerNumWidth, InvertedIndex[clash->opponent] + 1, clash->color == WHITE ? 'w' : 'b', resultStr[clash->result]); } else { sprintf (stemp, "%*d%s", PlayerNumWidth, InvertedIndex[clash->opponent] + 1, resultStr[clash->result]); } dstr->Append (stemp); if (OutputFormat == CROSSTABLE_Hypertext) { if (CurrentGame == clash->gameNum) dstr->Append ("</g></green>"); else dstr->Append ("</g></blue>"); } switch (clash->result) { case 1: r_won++; break; case 2: r_loss++; break; case 3: r_draw++; break; } } dstr->Append (EndCol); } PrintPerformance (dstr, pdata); if (PrintTallies) { dstr->Append (StartCol); sprintf (stemp, " (+%u -%u =%u)", r_won, r_loss, r_draw); dstr->Append (stemp); dstr->Append (EndCol); } dstr->Append (EndRow, NewLine); } PrintDashesLine (dstr); dstr->Append (EndTable); }
void Crosstable::PrintAllPlayAll (DString * dstr, uint playerLimit) { char stemp [1000]; uint player; dstr->Append (StartTable); if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append ("\\begin{tabular}{rl"); if (PrintRatings) { dstr->Append ("r"); } if (PrintTitles) { dstr->Append ("r"); } if (PrintAges) { dstr->Append ("r"); } if (PrintCountries) { dstr->Append ("l"); } dstr->Append ("r@{ / }r"); if (PrintTiebreaks) { dstr->Append ("r"); } for (uint i=0; i < playerLimit; i++) { dstr->Append ("c"); if (i < playerLimit-1) { dstr->Append ("@{ }"); } } if (PrintRatings) { dstr->Append ("r"); } dstr->Append ("r}\n"); } dstr->Append (StartRow); if (OutputFormat == CROSSTABLE_Html) { dstr->Append ("<th></th> <th>Player</th> "); } else if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append (" & \\bf Player & "); } else { strPad (stemp, "", LongestNameLen + 2 + PlayerNumWidth, ' '); dstr->Append (stemp); } if (PrintRatings) { dstr->Append (StartBoldCol, " Rtng", EndBoldCol); } if (PrintTitles) { dstr->Append (StartBoldCol, " Ti", EndBoldCol); } if (PrintAges) { dstr->Append (StartBoldCol, " Age", EndBoldCol); } if (PrintCountries) { dstr->Append (StartBoldCol, " Nat", EndBoldCol); } if (OutputFormat == CROSSTABLE_LaTeX) { // Todo : fix LateX Score column allignment with 3 points for win. dstr->Append (" \\multicolumn{2}{c}{\\bf Score} & "); } else { if (ThreeWin) dstr->Append (" ", StartBoldCol, "Score", EndBoldCol, " "); else dstr->Append (" ", StartBoldCol, " Score ", EndBoldCol, " "); } if (PrintTiebreaks) { dstr->Append (StartBoldCol, " (Tie) ", EndBoldCol); } for (player = 0; player < playerLimit; player++) { strPad (stemp, PlayerData[SortedIndex[player]]->name, MaxClashes, ' '); if (APAColumnNums) { // Print numbers instead of names over columns: strPad (stemp, "", MaxClashes, ' '); uint pnum = player + 1; stemp[MaxClashes-1] = (pnum % 10) + '0'; if (MaxClashes >= 2 && pnum >= 10) { stemp[MaxClashes-2] = ((pnum / 10) % 10) + '0'; } if (MaxClashes >= 3 && pnum >= 100) { stemp[MaxClashes-3] = ((pnum / 10) % 10) + '0'; } } if (playerLimit == 2) { // Make two-player crosstable look better: player = 1; strPad (stemp, "12345678901234567890123456789012345678901234567890", MaxClashes, ' '); } if (OutputFormat == CROSSTABLE_LaTeX) { dstr->Append (" \\tt ", stemp, " &"); } else { dstr->Append (" ", StartBoldCol, stemp, EndBoldCol); } } if (PrintRatings) { dstr->Append (" ", StartBoldCol, "Perf Chg", EndBoldCol); } if (PrintTallies && OutputFormat == CROSSTABLE_Html) { dstr->Append (" ", StartBoldCol, "+/-/=", EndBoldCol); } dstr->Append (EndRow, NewLine); PrintDashesLine (dstr); // Print the rows of players and results: uint previousScore = 0; for (player = 0; player < playerLimit; player++) { uint index = SortedIndex[player]; playerDataT * pdata = PlayerData[index]; // Print a blank line if we are at a new score group: if (SeparateScoreGroups && SortOption == CROSSTABLE_SortScore) { if (player > 0 && pdata->score != previousScore) { dstr->Append (BlankRowLine); } } previousScore = pdata->score; sprintf (stemp, "%*u: ", PlayerNumWidth, player+1); dstr->Append (StartRow, StartRightCol, stemp, EndRightCol); PrintPlayer (dstr, pdata); if (OutputFormat == CROSSTABLE_LaTeX) { sprintf (stemp, " %2u%c%c ", pdata->score / 2, DecimalPointChar, (pdata->score & 1 ? '5' : '0')); dstr->Append (StartRightCol, stemp, EndRightCol); sprintf (stemp, " %2u ", pdata->gameCount); dstr->Append (StartRightCol, stemp, EndRightCol); } else { if (ThreeWin) { sprintf (stemp, " %2u%c%c ", pdata->score / 2, DecimalPointChar, (pdata->score & 1 ? '5' : '0')); } else { sprintf (stemp, " %2u%c%c / %2u ", pdata->score / 2, DecimalPointChar, (pdata->score & 1 ? '5' : '0'), pdata->gameCount); } dstr->Append (StartRightCol, stemp, EndRightCol); } if (PrintTiebreaks) { sprintf (stemp, "%3u%c%02u ", pdata->tiebreak / 4, DecimalPointChar, (pdata->tiebreak % 4) * 25); dstr->Append (StartRightCol, stemp, EndRightCol); } uint r_won = 0, r_loss = 0, r_draw = 0; for (uint oppCount = 0; oppCount < playerLimit; oppCount++) { if (playerLimit == 2 && oppCount == player) { continue; } uint opp = SortedIndex[oppCount]; dstr->AddChar (' '); dstr->Append (StartRightCol); clashT * clash = pdata->firstClash[opp]; for (uint count = 0; count < MaxClashes; count++) { if (clash != NULL) { if (OutputFormat == CROSSTABLE_Hypertext) { if (CurrentGame == clash->gameNum) sprintf (stemp, "<green><g_%u>%c</g></green>", clash->gameNum, RESULT_CHAR[clash->result]); else sprintf (stemp, "<blue><g_%u>%c</g></blue>", clash->gameNum, RESULT_CHAR[clash->result]); dstr->Append (stemp); } else { dstr->AddChar (RESULT_CHAR[clash->result]); } switch (clash->result) { case 1: r_won++; break; case 2: r_loss++; break; case 3: r_draw++; break; } clash = clash->next; } else { dstr->AddChar (index == opp ? 'X' : '.'); } } dstr->Append (EndCol); } PrintPerformance (dstr, pdata); if (PrintTallies) { dstr->Append (StartCol); sprintf (stemp, " (+%u -%u =%u)", r_won, r_loss, r_draw); dstr->Append (stemp); dstr->Append (EndCol); } dstr->Append (EndRow, NewLine); } PrintDashesLine (dstr); dstr->Append (EndTable); }