本文整理汇总了C++中Quit函数的典型用法代码示例。如果您正苦于以下问题:C++ Quit函数的具体用法?C++ Quit怎么用?C++ Quit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Quit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BWindow
ShowImageWindow::ShowImageWindow(const entry_ref *ref,
const BMessenger& trackerMessenger)
:
BWindow(BRect(5, 24, 250, 100), "", B_DOCUMENT_WINDOW, 0),
fSavePanel(NULL),
fBar(NULL),
fOpenMenu(NULL),
fBrowseMenu(NULL),
fGoToPageMenu(NULL),
fSlideShowDelay(NULL),
fImageView(NULL),
fStatusView(NULL),
fModified(false),
fFullScreen(false),
fShowCaption(true),
fPrintSettings(NULL),
fResizerWindowMessenger(NULL),
fResizeItem(NULL),
fHeight(0),
fWidth(0)
{
_LoadSettings();
// create menu bar
fBar = new BMenuBar(BRect(0, 0, Bounds().right, 1), "menu_bar");
AddMenus(fBar);
AddChild(fBar);
BRect viewFrame = Bounds();
viewFrame.top = fBar->Bounds().Height() + 1;
viewFrame.right -= B_V_SCROLL_BAR_WIDTH;
viewFrame.bottom -= B_H_SCROLL_BAR_HEIGHT;
// create the image view
fImageView = new ShowImageView(viewFrame, "image_view", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED);
// wrap a scroll view around the view
BScrollView *scrollView = new BScrollView("image_scroller", fImageView,
B_FOLLOW_ALL, 0, false, false, B_PLAIN_BORDER);
AddChild(scrollView);
const int32 kstatusWidth = 190;
BRect rect;
rect = Bounds();
rect.top = viewFrame.bottom + 1;
rect.left = viewFrame.left + kstatusWidth;
rect.right = viewFrame.right + 1;
rect.bottom += 1;
BScrollBar *horizontalScrollBar = new BScrollBar(rect, "hscroll",
fImageView, 0, 150, B_HORIZONTAL);
AddChild(horizontalScrollBar);
rect.left = 0;
rect.right = kstatusWidth - 1;
rect.bottom -= 1;
fStatusView = new ShowImageStatusView(rect, "status_view", B_FOLLOW_BOTTOM,
B_WILL_DRAW);
AddChild(fStatusView);
rect = Bounds();
rect.top = viewFrame.top - 1;
rect.left = viewFrame.right + 1;
rect.bottom = viewFrame.bottom + 1;
rect.right += 1;
BScrollBar *verticalScrollBar = new BScrollBar(rect, "vscroll", fImageView,
0, 150, B_VERTICAL);
AddChild(verticalScrollBar);
SetSizeLimits(250, 100000, 100, 100000);
// finish creating the window
fImageView->SetImage(ref);
fImageView->SetTrackerMessenger(trackerMessenger);
if (InitCheck() != B_OK) {
BAlert* alert;
alert = new BAlert("ShowImage",
"Could not load image! Either the file or an image translator for "
"it does not exist.", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT);
alert->Go();
// quit if file could not be opened
Quit();
return;
}
// add View menu here so it can access ShowImageView methods
BMenu* menu = new BMenu("View");
_BuildViewMenu(menu, false);
fBar->AddItem(menu);
_MarkMenuItem(fBar, MSG_DITHER_IMAGE, fImageView->GetDither());
UpdateTitle();
SetPulseRate(100000);
// every 1/10 second; ShowImageView needs it for marching ants
WindowRedimension(fImageView->GetBitmap());
fImageView->MakeFocus(true); // to receive KeyDown messages
Show();
//.........这里部分代码省略.........
示例2: DoMuscle
void DoMuscle(CompositeVect*CVLocation)
{
SetOutputFileName(g_pstrOutFileName);
SetInputFileName(g_pstrInFileName);
SetMaxIters(g_uMaxIters);
SetSeqWeightMethod(g_SeqWeight1);
TextFile fileIn(g_pstrInFileName);
SeqVect v;
v.FromFASTAFile(fileIn);
const unsigned uSeqCount = v.Length();
if (0 == uSeqCount)
Quit("No sequences in input file");
ALPHA Alpha = ALPHA_Undefined;
switch (g_SeqType)
{
case SEQTYPE_Auto:
Alpha = v.GuessAlpha();
break;
case SEQTYPE_Protein:
Alpha = ALPHA_Amino;
break;
case SEQTYPE_DNA:
Alpha = ALPHA_DNA;
break;
case SEQTYPE_RNA:
Alpha = ALPHA_RNA;
break;
default:
Quit("Invalid seq type");
}
SetAlpha(Alpha);
v.FixAlpha();
PTR_SCOREMATRIX UserMatrix = 0;
if (0 != g_pstrMatrixFileName)
{
const char *FileName = g_pstrMatrixFileName;
const char *Path = getenv("MUSCLE_MXPATH");
if (Path != 0)
{
size_t n = strlen(Path) + 1 + strlen(FileName) + 1;
char *NewFileName = new char[n];
sprintf(NewFileName, "%s/%s", Path, FileName);
FileName = NewFileName;
}
TextFile File(FileName);
UserMatrix = ReadMx(File);
g_Alpha = ALPHA_Amino;
g_PPScore = PPSCORE_SP;
}
SetPPScore();
if (0 != UserMatrix)
g_ptrScoreMatrix = UserMatrix;
unsigned uMaxL = 0;
unsigned uTotL = 0;
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
{
unsigned L = v.GetSeq(uSeqIndex).Length();
uTotL += L;
if (L > uMaxL)
uMaxL = L;
}
SetIter(1);
g_bDiags = g_bDiags1;
SetSeqStats(uSeqCount, uMaxL, uTotL/uSeqCount);
SetMuscleSeqVect(v);
MSA::SetIdCount(uSeqCount);
// Initialize sequence ids.
// From this point on, ids must somehow propogate from here.
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
v.SetSeqId(uSeqIndex, uSeqIndex);
if (0 == uSeqCount)
Quit("Input file '%s' has no sequences", g_pstrInFileName);
if (1 == uSeqCount)
{
TextFile fileOut(g_pstrOutFileName, true);
v.ToFile(fileOut);
return;
}
if (uSeqCount > 1)
MHackStart(v);
// First iteration
//.........这里部分代码省略.........
示例3: switch
void C4Application::GameTick()
{
// Exec depending on game state
switch (AppState)
{
case C4AS_None:
assert(AppState != C4AS_None);
break;
case C4AS_Quit:
// Do nothing, the main loop will exit soon
break;
case C4AS_PreInit:
if (!PreInit()) Quit();
break;
case C4AS_Startup:
SoundSystem.Execute();
MusicSystem.Execute();
// wait for the user to start a game
break;
case C4AS_StartGame:
// immediate progress to next state; OpenGame will enter HandleMessage-loops in startup and lobby!
C4Startup::CloseStartup();
AppState = C4AS_Game;
// first-time game initialization
if (!Game.Init())
{
// set error flag (unless this was a lobby user abort)
if (!C4GameLobby::UserAbort)
Game.fQuitWithError = true;
// no start: Regular QuitGame; this may reset the engine to startup mode if desired
QuitGame();
break;
}
if(Config.Graphics.Windowed == 2 && FullScreenMode())
Application.SetVideoMode(GetConfigWidth(), GetConfigHeight(), Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, true);
break;
case C4AS_AfterGame:
// stop game
Game.Clear();
if(Config.Graphics.Windowed == 2 && !NextMission && !isEditor)
Application.SetVideoMode(GetConfigWidth(), GetConfigHeight(), Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, false);
AppState = C4AS_PreInit;
// if a next mission is desired, set to start it
if (NextMission)
{
Game.SetScenarioFilename(NextMission.getData());
Game.fLobby = Game.NetworkActive;
Game.fObserve = false;
NextMission.Clear();
}
break;
case C4AS_Game:
// Game
if (Game.IsRunning)
Game.Execute();
// Sound
SoundSystem.Execute();
MusicSystem.Execute();
// Gamepad
if (pGamePadControl) pGamePadControl->Execute();
break;
}
}
示例4: DebugKeys
int DebugKeys()
{
boolean esc;
int level;
if (IN_KeyDown(sc_C)) // C = count objects
{
CountObjects();
return 1;
}
if (IN_KeyDown(sc_E)) // E = quit level
{
playstate = ex_completed;
// gamestate.mapon++;
}
if (IN_KeyDown(sc_F)) // F = facing spot
{
CenterWindow (14,4);
US_Print ("X:");
US_PrintUnsigned (player->x);
US_Print ("\nY:");
US_PrintUnsigned (player->y);
US_Print ("\nA:");
US_PrintUnsigned (player->angle);
VW_UpdateScreen();
IN_Ack();
return 1;
}
if (IN_KeyDown(sc_G)) // G = god mode
{
CenterWindow (12,2);
if (godmode)
US_PrintCentered ("God mode OFF");
else
US_PrintCentered ("God mode ON");
VW_UpdateScreen();
IN_Ack();
godmode ^= 1;
return 1;
}
if (IN_KeyDown(sc_H)) // H = hurt self
{
IN_ClearKeysDown ();
TakeDamage (16,NULL);
}
else if (IN_KeyDown(sc_I)) // I = item cheat
{
CenterWindow (12,3);
US_PrintCentered ("Free items!");
VW_UpdateScreen();
GivePoints(100000);
HealSelf(99);
if (gamestate.bestweapon<wp_chaingun)
GiveWeapon (gamestate.bestweapon+1);
gamestate.ammo += 50;
if (gamestate.ammo > 99)
gamestate.ammo = 99;
DrawAmmo ();
IN_Ack ();
return 1;
}
else if (IN_KeyDown(sc_N)) // N = no clip
{
noclip^=1;
CenterWindow (18,3);
if (noclip)
US_PrintCentered ("No clipping ON");
else
US_PrintCentered ("No clipping OFF");
VW_UpdateScreen();
IN_Ack ();
return 1;
}
else if (IN_KeyDown(sc_P)) // P = pause with no screen disruptioon
{
PicturePause ();
return 1;
}
else if (IN_KeyDown(sc_Q)) // Q = fast quit
Quit(NULL);
else if (IN_KeyDown(sc_S)) // S = slow motion
{
singlestep^=1;
CenterWindow (18,3);
if (singlestep)
US_PrintCentered ("Slow motion ON");
else
US_PrintCentered ("Slow motion OFF");
VW_UpdateScreen();
IN_Ack ();
return 1;
}
else if (IN_KeyDown(sc_T)) // T = shape test
{
ShapeTest();
return 1;
}
//.........这里部分代码省略.........
示例5: Quit
void
EventQueue::OnSignal(int signo)
{
Quit();
}
示例6: QuitEmulator
void QuitEmulator(void)
{
Quit();
}
示例7: DeplanePic
void DeplanePic (int picnum)
{
byte far *plane0,far *plane1,far *plane2,far *plane3;
byte by0,by1,by2,by3;
unsigned x,y,b,color,shift,width,height;
byte *dest;
//
// convert ega pixels to byte color values in a temp buffer
//
width = pictable[picnum-STARTPICS].width;
height = pictable[picnum-STARTPICS].height;
if (width>8 || height!=64)
Quit ("DePlanePic: Bad size shape");
memset (spotvis,BACKGROUNDPIX,sizeof(spotvis));
plane0 = (byte _seg *)grsegs[picnum];
plane1 = plane0 + width*height;
plane2 = plane1 + width*height;
plane3 = plane2 + width*height;
for (y=0;y<height;y++)
{
dest = &spotvis[y][0];
for (x=0;x<width;x++)
{
by0 = *plane0++;
by1 = *plane1++;
by2 = *plane2++;
by3 = *plane3++;
for (b=0;b<8;b++)
{
shift=8-b;
color = 0;
asm mov cl,[BYTE PTR shift]
asm mov al,[BYTE PTR by3]
asm rcr al,cl;
asm rcl [BYTE PTR color],1;
asm mov cl,[BYTE PTR shift]
asm mov al,[BYTE PTR by2]
asm rcr al,cl;
asm rcl [BYTE PTR color],1;
asm mov cl,[BYTE PTR shift]
asm mov al,[BYTE PTR by1]
asm rcr al,cl;
asm rcl [BYTE PTR color],1;
asm mov cl,[BYTE PTR shift]
asm mov al,[BYTE PTR by0]
asm rcr al,cl;
asm rcl [BYTE PTR color],1;
*dest++ = color;
} // B
} // X
} // Y
}
示例8: WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
static UINT X = CLOCK_SIZE, Y = 2 * CLOCK_SIZE, unDir = 1;
PAINTSTRUCT PtStr;
HDC hDC;
POINT stPos;
static char lwP[20];
switch(message) {
case WM_TIMER:
CreateClockPic ();
InvalidateRect (hwnd, 0, FALSE);
//不要使用SendMessage (hwnd, WM_MOVE, 0, 20 * 1024 + 800);
//使用如下代码
if (unDir) X += 5;
else X-=5;
if (X <= 0) unDir = 1;
else if (X >= 1024-CLOCK_SIZE) unDir = 0;
MoveWindow(hwnd, X, Y, CLOCK_SIZE, CLOCK_SIZE, TRUE);
//UpdateWindow(hwnd);
break;
case WM_PAINT:
hDC = BeginPaint (hwnd, &PtStr);
BitBlt(hDC, PtStr.rcPaint.left, PtStr.rcPaint.top,
PtStr.rcPaint.right - PtStr.rcPaint.left,
PtStr.rcPaint.bottom - PtStr.rcPaint.top,
ghDcClock, PtStr.rcPaint.left, PtStr.rcPaint.top, SRCCOPY);
/*itoa(h2, lwP, 10);
TextOut (hDC, 50, 20, lwP, strlen(lwP));
itoa(hwnd, lwP, 10);
TextOut (hDC, 50, 40, lwP, strlen(lwP));
*/EndPaint(hwnd, &PtStr);
break;
case WM_CREATE:
//assert(hWinMain != hwnd);
//printf("%d %d\n", hWinMain, hwnd);
hWinMain = hwnd;
Init();
break;
case WM_COMMAND:
switch(LOWORD(wParam)){
case IDM_BACK1:
dwNowBack = IDB_BACK1;
CheckMenuRadioItem (hMenu, IDM_BACK1, IDM_BACK2, IDM_BACK1, 0);
break;
case IDM_BACK2:
dwNowBack = IDB_BACK2;
CheckMenuRadioItem (hMenu, IDM_BACK1, IDM_BACK2, IDM_BACK2, 0);
break;
case IDM_CIRCLE1:
dwNowCircle = IDB_CIRCLE1;
CheckMenuRadioItem (hMenu, IDM_CIRCLE1, IDM_CIRCLE2, IDM_CIRCLE1, 0);
break;
case IDM_CIRCLE2:
dwNowCircle = IDB_CIRCLE2;
CheckMenuRadioItem (hMenu, IDM_CIRCLE1, IDM_CIRCLE2, IDM_CIRCLE2, 0);
break;
case IDM_EXIT:
Quit();
return 0;
default:
break;
}
DeleteBackGround();
CreateBackGround();
CreateClockPic();
InvalidateRect (hwnd, NULL, FALSE);
break;
case WM_CLOSE:
Quit();
break;
case WM_RBUTTONDOWN:
GetCursorPos (&stPos);
TrackPopupMenu (hMenu, TPM_LEFTALIGN, stPos.x, stPos.y, 0, hwnd, 0);
break;
case WM_LBUTTONDOWN:
SetCursor (hCursorMove);
UpdateWindow(hwnd);
ReleaseCapture();
SendMessage (hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
SetCursor (hCursorMain);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
//.........这里部分代码省略.........
示例9: NWDASimple
//.........这里部分代码省略.........
#if TRACE
Log("DA Simple: MAB=%.4g DAB=%.4g EAB=%.4g IAB=%.4g JAB=%.4g best=%c\n",
M, D, E, I, J, cEdgeType);
#endif
unsigned PLA = uLengthA;
unsigned PLB = uLengthB;
for (;;)
{
PWEdge Edge;
Edge.cType = XlatEdgeType(cEdgeType);
Edge.uPrefixLengthA = PLA;
Edge.uPrefixLengthB = PLB;
#if TRACE
Log("Prepend %c%d.%d\n", Edge.cType, PLA, PLB);
#endif
Path.PrependEdge(Edge);
switch (cEdgeType)
{
case 'M':
assert(PLA > 0);
assert(PLB > 0);
cEdgeType = TBM(PLA, PLB);
--PLA;
--PLB;
break;
case 'D':
assert(PLA > 0);
cEdgeType = TBD(PLA, PLB);
--PLA;
break;
case 'E':
assert(PLA > 0);
cEdgeType = TBE(PLA, PLB);
--PLA;
break;
case 'I':
assert(PLB > 0);
cEdgeType = TBI(PLA, PLB);
--PLB;
break;
case 'J':
assert(PLB > 0);
cEdgeType = TBJ(PLA, PLB);
--PLB;
break;
default:
Quit("Invalid edge %c", cEdgeType);
}
if (0 == PLA && 0 == PLB)
break;
}
Path.Validate();
// SCORE Score = TraceBack(PA, uLengthA, PB, uLengthB, DPM_, DPD_, DPI_, Path);
#if TRACE
SCORE scorePath = FastScorePath2(PA, uLengthA, PB, uLengthB, Path);
Path.LogMe();
Log("Score = %s Path = %s\n", LocalScoreToStr(BestScore), LocalScoreToStr(scorePath));
#endif
if (g_bKeepSimpleDP.get())
{
g_DPM.get() = DPM_;
g_DPD.get() = DPD_;
g_DPE.get() = DPE_;
g_DPI.get() = DPI_;
g_DPJ.get() = DPJ_;
g_TBM.get() = TBM_;
g_TBD.get() = TBD_;
g_TBE.get() = TBE_;
g_TBI.get() = TBI_;
g_TBJ.get() = TBJ_;
}
else
{
delete[] DPM_;
delete[] DPD_;
delete[] DPE_;
delete[] DPI_;
delete[] DPJ_;
delete[] TBM_;
delete[] TBD_;
delete[] TBE_;
delete[] TBI_;
delete[] TBJ_;
}
return BestScore;
}
示例10: DEBUG
void CIRCSock::ReadLine(const CString& sData) {
CString sLine = sData;
sLine.TrimRight("\n\r");
DEBUG("(" << m_pUser->GetUserName() << ") IRC -> ZNC [" << sLine << "]");
MODULECALL(OnRaw(sLine), m_pUser, NULL, return);
if (sLine.Equals("PING ", false, 5)) {
// Generate a reply and don't forward this to any user,
// we don't want any PING forwarded
PutIRC("PONG " + sLine.substr(5));
return;
} else if (sLine.Token(1).Equals("PONG")) {
// Block PONGs, we already responded to the pings
return;
} else if (sLine.Equals("ERROR ", false, 6)) {
//ERROR :Closing Link: nick[24.24.24.24] (Excess Flood)
CString sError(sLine.substr(6));
if (sError.Left(1) == ":") {
sError.LeftChomp();
}
m_pUser->PutStatus("Error from Server [" + sError + "]");
return;
}
CString sCmd = sLine.Token(1);
if ((sCmd.length() == 3) && (isdigit(sCmd[0])) && (isdigit(sCmd[1])) && (isdigit(sCmd[2]))) {
CString sServer = sLine.Token(0); sServer.LeftChomp();
unsigned int uRaw = sCmd.ToUInt();
CString sNick = sLine.Token(2);
CString sRest = sLine.Token(3, true);
switch (uRaw) {
case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick
if (m_bAuthed && sServer == "irc.znc.in") {
// m_bAuthed == true => we already received another 001 => we might be in a traffic loop
m_pUser->PutStatus("ZNC seems to be connected to itself, disconnecting...");
Quit();
return;
}
m_pUser->SetIRCServer(sServer);
SetTimeout(240, TMO_READ); // Now that we are connected, let nature take its course
PutIRC("WHO " + sNick);
m_bAuthed = true;
m_pUser->PutStatus("Connected!");
vector<CClient*>& vClients = m_pUser->GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
CClient* pClient = vClients[a];
CString sClientNick = pClient->GetNick(false);
if (!sClientNick.Equals(sNick)) {
// If they connected with a nick that doesn't match the one we got on irc, then we need to update them
pClient->PutClient(":" + sClientNick + "!" + m_Nick.GetIdent() + "@" + m_Nick.GetHost() + " NICK :" + sNick);
}
}
SetNick(sNick);
MODULECALL(OnIRCConnected(), m_pUser, NULL, );
m_pUser->ClearRawBuffer();
m_pUser->AddRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
CZNC::Get().ReleaseISpoof();
m_bISpoofReleased = true;
break;
}
case 5:
ParseISupport(sRest);
m_pUser->UpdateExactRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 2:
case 3:
case 4:
case 250: // highest connection count
case 251: // user count
case 252: // oper count
case 254: // channel count
case 255: // client count
case 265: // local users
case 266: // global users
m_pUser->UpdateRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 305:
m_pUser->SetIRCAway(false);
break;
case 306:
m_pUser->SetIRCAway(true);
break;
case 324: { // MODE
//.........这里部分代码省略.........
示例11: MakeRootMSA
void MakeRootMSA(const SeqVect &v, const Tree &GuideTree, ProgNode Nodes[],
MSA &a)
{
#if TRACE
Log("MakeRootMSA Tree=");
GuideTree.LogMe();
#endif
const unsigned uSeqCount = v.GetSeqCount();
unsigned uColCount = uInsane;
unsigned uSeqIndex = 0;
const unsigned uTreeNodeCount = GuideTree.GetNodeCount();
const unsigned uRootNodeIndex = GuideTree.GetRootNodeIndex();
const PWPath &RootPath = Nodes[uRootNodeIndex].m_Path;
const unsigned uRootColCount = RootPath.GetEdgeCount();
const unsigned uEstringSize = uRootColCount + 1;
short *Estring1 = new short[uEstringSize];
short *Estring2 = new short[uEstringSize];
SetProgressDesc("Root alignment");
unsigned uTreeNodeIndex = GetFirstNodeIndex(GuideTree);
do
{
Progress(uSeqIndex, uSeqCount);
unsigned uId = GuideTree.GetLeafId(uTreeNodeIndex);
const Seq &s = *(v[uId]);
Seq sRootE;
short *es = MakeRootSeqE(s, GuideTree, uTreeNodeIndex, Nodes, sRootE,
Estring1, Estring2);
Nodes[uTreeNodeIndex].m_EstringL = EstringNewCopy(es);
#if VALIDATE
Seq sRoot;
MakeRootSeq(s, GuideTree, uTreeNodeIndex, Nodes, sRoot);
if (!sRoot.Eq(sRootE))
{
Log("sRoot=");
sRoot.LogMe();
Log("sRootE=");
sRootE.LogMe();
Quit("Root seqs differ");
}
#if TRACE
Log("MakeRootSeq=\n");
sRoot.LogMe();
#endif
#endif
if (uInsane == uColCount)
{
uColCount = sRootE.Length();
a.SetSize(uSeqCount, uColCount);
}
else
{
assert(uColCount == sRootE.Length());
}
a.SetSeqName(uSeqIndex, s.GetName());
a.SetSeqId(uSeqIndex, uId);
for (unsigned uColIndex = 0; uColIndex < uColCount; ++uColIndex)
a.SetChar(uSeqIndex, uColIndex, sRootE[uColIndex]);
++uSeqIndex;
uTreeNodeIndex = GetNextNodeIndex(GuideTree, uTreeNodeIndex);
}
while (NULL_NEIGHBOR != uTreeNodeIndex);
delete[] Estring1;
delete[] Estring2;
ProgressStepsDone();
assert(uSeqIndex == uSeqCount);
}
示例12: switch
void CFtpDialog::MessageReceived(BMessage *msg)
{
switch (msg->what)
{
case 'cnct':
Connect();
break;
case msg_ServerNameChanged:
fServerName->MarkAsInvalid(false);
break;
case msg_SelectedDirectory:
{
BMenuItem *src;
FailOSErr(msg->FindPointer("source", (void**)&src));
strcpy(fPath, "/");
if (src != fDirectoryField->Menu()->ItemAt(0))
{
int i = 1;
while (true)
{
if (i >= fDirectoryField->Menu()->CountItems())
break;
BMenuItem *I = fDirectoryField->Menu()->ItemAt(i);
strcat(fPath, I->Label());
strcat(fPath, "/");
if (src == I)
break;
++i;
}
}
ChangeDirectory();
break;
}
case msg_SelectedListItem:
{
CFtpListItem *i = dynamic_cast<CFtpListItem*>(
fListView->ItemAt(fListView->CurrentSelection()));
if (i == reinterpret_cast<CFtpListItem*>(NULL))
{
beep();
return;
}
if (i->IsDirectory())
{
strcat(fPath, *i);
strcat(fPath, "/");
ChangeDirectory();
}
else if (OkClicked())
Quit();
break;
}
case msg_ToggleDot:
ListDirectory();
break;
default:
HDialog::MessageReceived(msg);
break;
}
} // CFtpDialog::MessageReceived
示例13: U32
//
// Recycle
//
// Check timer and refund resources once recycled
//
void UnitRecycle::StateRecycle()
{
// Apply progress
progressTotal -= progressMax;
// Has recycling finished
if (progressTotal <= 0.0F)
{
// Refund the resources
if (subject->GetTeam() && refund > 0)
{
// Calculate the total refund
U32 totalRefund = U32(subject->UnitType()->GetRecyclePercentage() * refund);
// Add to the team
subject->GetTeam()->AddResourceStore(totalRefund);
// Report the resource type
subject->GetTeam()->ReportResource(totalRefund, "resource.recycled");
// Generate a message
if (Team::GetDisplayTeam() == subject->GetTeam())
{
CON_MSG((TRANSLATE(("#game.messages.recyclerefund", 2, subject->GetUpgradedUnit().GetDesc(), totalRefund))));
}
}
// Trigger finish FX
subject->StartGenericFX(0x2062BAAD, NULL, TRUE); // "Recycle::Finish"
// Did this building consume its constructor
if
(
subject->UnitType()->GetConstructorType() &&
!subject->UnitType()->GetConstructorType()->GetIsFacility() &&
subject->UnitType()->GetConstructorConsume()
)
{
// Ensure the constructors resources are initialized
subject->UnitType()->GetConstructorType()->InitializeResources();
// Create a fresh new constructor
UnitObj *unit = subject->UnitType()->GetConstructorType()->SpawnClosest
(
subject->Position(), subject->GetTeam()
);
// If this team is controlled by AI then assign the
// constructor to the primary base (if there is one)
if (unit && unit->GetTeam() && unit->GetTeam()->IsAI())
{
Strategic::Object *object = unit->GetTeam()->GetStrategicObject();
if (object)
{
Strategic::Base *base = object->GetBaseManager().GetPrimaryBase();
if (base)
{
base->AddUnit(unit);
base->AddConstructor(unit);
}
}
}
}
// Remove the object
subject->MarkForDeletion();
// Remove boarded object
if (subject->UnitType()->CanBoard() && subject->GetBoardManager()->InUse())
{
subject->GetBoardManager()->GetUnitObj()->SelfDestruct();
}
// Recycle completed
Quit();
}
}
示例14: GetSeqCount
void MSA::GetFractionalWeightedCounts(unsigned uColIndex, bool bNormalize,
FCOUNT fcCounts[], FCOUNT *ptrfcGapStart, FCOUNT *ptrfcGapEnd,
FCOUNT *ptrfcGapExtend, FCOUNT *ptrfOcc,
FCOUNT *ptrfcLL, FCOUNT *ptrfcLG, FCOUNT *ptrfcGL, FCOUNT *ptrfcGG) const
{
const unsigned uSeqCount = GetSeqCount();
const unsigned uColCount = GetColCount();
const char* seqName;
memset(fcCounts, 0, g_AlphaSize*sizeof(FCOUNT));
WEIGHT wTotal = 0;
FCOUNT fGap = 0;
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
{
const WEIGHT w = GetSeqWeight(uSeqIndex);
if (IsGap(uSeqIndex, uColIndex))
{
fGap += w;
continue;
}
else if (IsWildcard(uSeqIndex, uColIndex))
{
const unsigned uLetter = GetLetterEx(uSeqIndex, uColIndex);
switch (g_Alpha)
{
case ALPHA_Amino:
switch (uLetter)
{
case AX_B: // D or N
fcCounts[AX_D] += w/2;
fcCounts[AX_N] += w/2;
break;
case AX_Z: // E or Q
fcCounts[AX_E] += w/2;
fcCounts[AX_Q] += w/2;
break;
default: // any
{
const FCOUNT f = w/20;
for (unsigned uLetter = 0; uLetter < 20; ++uLetter)
fcCounts[uLetter] += f;
break;
}
}
break;
case ALPHA_DNA:
case ALPHA_RNA:
switch (uLetter)
{
case AX_R: // G or A
fcCounts[NX_G] += w/2;
fcCounts[NX_A] += w/2;
break;
case AX_Y: // C or T/U
fcCounts[NX_C] += w/2;
fcCounts[NX_T] += w/2;
break;
default: // any
const FCOUNT f = w/20;
for (unsigned uLetter = 0; uLetter < 4; ++uLetter)
fcCounts[uLetter] += f;
break;
}
break;
default:
Quit("Alphabet %d not supported", g_Alpha);
}
continue;
}
unsigned uLetter = GetLetter(uSeqIndex, uColIndex);
//BEGIN MODIFICATIONS TO MUSCLE
int original=0;
for(unsigned i=0; i<uColIndex; i++){
if (i >= this->GetColCount()){break;}
++original;
char c = GetChar(uSeqIndex, i);
if(c== '-'){
original--;
}
}
seqName = this->GetSeqName(uSeqIndex);
int compositeVectPosition;
compositeVectPosition = atoi(seqName);
CompositeVect CV = *CVLocation;
Composite* CVL = CV[compositeVectPosition];
Composite C = *CVL;
for(int j=0; j<21; j++){
fcCounts[j] = w*C[original][j];
wTotal = w*C[original][j];
}
//ORIGINAL MUSLCE LINE WAS:
//fcCounts[uLetter] += w;
//wTotal += w;
//END MODIFICATIONS TO MUSCLE
//.........这里部分代码省略.........
示例15: Quit
void
UrlWrapper::ReadyToRun(void)
{
Quit();
}