void SetOutput(char *in, char * pre, char *post){ int i = 0; ClearOutput(); for(i = 0; i < SIZE && in[i] != '\0'; i++) in_output[i] = in[i]; for(i = 0; i < SIZE && pre[i] != '\0'; i++) pre_output[i] = pre[i]; for(i = 0; i < SIZE && post[i] != '\0'; i++) post_output[i] = post[i]; }
struct binaryTree * SampleTree1() { struct binaryTree * tree = create_node(1); ClearOutput(); insert(tree, 2, LEFT); insert(tree, 3, RIGHT); insert(tree, 4, LEFT); insert(tree, 5, RIGHT); SetOutput("42135", "12435", "42531"); return tree; }
kexConsole::kexConsole(void) { this->scrollBackPos = 0; this->historyTop = 0; this->historyCur = -1; this->typeStrPos = 0; this->scrollBackLines = 0; this->bShiftDown = false; this->bCtrlDown = false; this->state = CON_STATE_UP; this->blinkTime = 0; this->bKeyHeld = false; this->bStickyActive = false; this->lastKeyPressed = 0; this->timePressed = 0; this->bShowPrompt = true; this->outputLength = 0; ClearOutput(); }
/*--------------------------------------------------------------------------------------- -- FUNCTION: MenuDispatch -- -- DATE: January 26, 2009 -- -- REVISIONS: -- -- DESIGNER: Steffen L. Norgren -- -- PROGRAMMER: Steffen L. Norgren -- -- INTERFACE: MenuDispatch(UINT iMenuChoice, HWND hWnd, LPARAM lParam) -- UINT iMenuChoice: ID of the menu choice (from resource file) -- HWND hWnd: Window handle of menu owner -- LPARAM lParam: Window message parameter (depends on message) -- -- RETURNS: void -- -- NOTES: This function simply deals with menu events caused by user input and -- calls the appropriate function based on the user's input. -- ---------------------------------------------------------------------------------------*/ void MenuDispatch(UINT iMenuChoice, HWND hWnd, LPARAM lParam) { HMENU hMenu; hMenu = GetMenu(ghWndMain); switch (iMenuChoice) { // File Menu case ID_FILE_EXIT: PostMessage(hWnd, WM_CLOSE, 0, 0); break; case ID_EDIT_CLEAROUTPUT: ClearOutput(); break; case ID_WINSOCK_RESOLVEIPADDRESS: DialogBox(ghInst, MAKEINTRESOURCE(IDD_IP_INPUT), hWnd, Input_IP); break; case ID_WINSOCK_RESOLVEHOSTNAME: DialogBox(ghInst, MAKEINTRESOURCE(IDD_HOST_INPUT), hWnd, Input_Host); break; case ID_WINSOCK_RESOLVESVCNAME: DialogBox(ghInst, MAKEINTRESOURCE(IDD_PORT_INPUT), hWnd, Input_Port); break; case ID_WINSOCK_RESOLVESVCPORT: DialogBox(ghInst, MAKEINTRESOURCE(IDD_SVC_INPUT), hWnd, Input_Service); break; default: // No action necessary break; } return; }
void kexConsole::Clear(void) { ClearOutput(); ResetInputText(); }
kexConsole::~kexConsole(void) { ClearOutput(); }
void CMUSHclientDoc::DeleteOutput() { ClearOutput (); } // end of CMUSHclientDoc::DeleteOutput
////////////////////////////////////////////////////////////////////// /// Draw void COGLWin::Draw() { if (!m_Parse.IsCodeOK()) { m_ToolBox.ResetToolInUseFlags(); // Keep fixed tools but do not redraw here m_ToolBox.PruneToolMap(true, false); // Redraw tools here explicitly // m_ToolBox.Update(); if (m_pOutput) m_pOutput->SetText(" "); // Standard reason for re-evaluation of script. SetExecModeVar(EXEC_MODE_NONE); return; } // Set standard color if (m_bUseLighting) { m_Filter.SetColor(MGray); m_StdMaterial.Apply(); } else { m_Filter.SetColor(MGray); } m_ToolBox.ResetToolInUseFlags(); m_Parse.ToggleTempImageList(); m_Parse.ResetTempImageList(); // Reset Filter Modes m_Filter.ResetModes(); m_bFrameTransChanged = false; MultiV<float> vR(m_vRMain); m_mTransform[0].ResetTransChanged(); ClearOutput(); ClearError(); //m_Parse.ResetTempVexList(); if (!m_Parse.RunCode()) { int iErrLine, iErrPos, iErrInPos; cStr csErrFile, csText; CCLUCodeBase::SOutputObject OutObj; /* m_sError = "<b>Runtime Errors:</b><p>"; m_sError += m_Parse.PrintCodeErrors().Str(); m_sError += "</p> <p>"; //csText << "Vars:\n" << m_Parse.PrintVars() << "\n"; m_sError += "<b>Stack:</b><br> <br>"; m_sError += m_Parse.PrintStack().Str(); m_sError += "</p>"; */ OutObj.sName = "Output up to Error"; OutObj.bCanChangeSize = false; OutObj.bCanHideValue = false; OutObj.bBRAfterValue = true; OutObj.bBRBeforeValue = true; OutObj.bShowInfo = false; OutObj.bShowValue = true; OutObj.sRelSym = ":"; OutObj.sType = " "; OutObj.iSize = 0; OutObj.sValue = " "; m_Parse.InsertOutputObject(OutObj); OutObj.sName = "Stack"; OutObj.bCanChangeSize = true; OutObj.bCanHideValue = true; OutObj.bBRAfterValue = true; OutObj.bBRBeforeValue = true; OutObj.bShowInfo = false; OutObj.bShowValue = false; OutObj.sRelSym = ":"; OutObj.sType = "stack"; OutObj.iSize = 0; OutObj.sValue = m_Parse.PrintStack().Str(); m_Parse.InsertOutputObject(OutObj); OutObj.sName = "Runtime Error"; OutObj.bCanChangeSize = false; OutObj.bCanHideValue = true; OutObj.bBRAfterValue = true; OutObj.bBRBeforeValue = true; OutObj.bShowInfo = true; OutObj.bShowValue = true; OutObj.sRelSym = " "; OutObj.sType = "error message"; OutObj.iSize = 0; m_Parse.GetCodeErrorPos(iErrLine, iErrPos, iErrInPos, csErrFile); csText = ""; csText << "Line " << iErrLine << ", Pos " << iErrPos; OutObj.sInfo = csText; csText = "<font size=\"10\">File: <i>"; csText << csErrFile << "</i></font><p>"; csText << m_Parse.PrintCodeErrors().Str(); OutObj.sValue = csText; m_Parse.InsertOutputObject(OutObj); m_bHasError = true; m_bHasOutput = true; /* cStr &rText = m_Parse.GetTextOutput(); if (rText.Len()) { m_sError += "<br><b>Script Output:</b><br> <br>"; m_sError += rText.Str(); } */ /* if (m_pOutput && !m_bVizOnlyMode) { m_pOutput->SetText(m_sError.c_str()); m_pOutput->show(); } */ //ClearError(); if (m_pEditor && !m_bVizOnlyMode) { cStr csFilename; int iLine, iPos, iInputPos; if (m_Parse.GetCodeErrorPos(iLine, iPos, iInputPos, csFilename)) m_pEditor->HighlightLinePos(csFilename.Str(), iInputPos); m_pEditor->show(); } m_Parse.ResetErrors(); m_bExecCode = false; SetAnimCode(false); StopAnimation(); m_Parse.OverrideSetRenderLatex(false); } else { //m_vecOutObj = m_Parse.GetOutputObjectList(); //cStr &rText = m_Parse.GetTextOutput(); m_bHasOutput = true; if (m_mTransform[0].HasTransChanged(0) || m_mTransform[0].HasTransChanged(1) || m_mTransform[0].HasTransChanged(2)) { m_mTransform[0].iFlags = 0; m_bFrameTransChanged = true; } if (vR != m_vRMain) { m_bFrameTransChanged = true; } m_Parse.OverrideSetRenderLatex(false); } // Keep fixed tools but do not redraw here m_ToolBox.PruneToolMap(true, false); // Redraw tools here explicitly // m_ToolBox.Update(); // Reset Tool Name Variable if (m_iExecMode & (EXEC_MODE_TOOL | EXEC_MODE_LINK | EXEC_MODE_KEYUP | EXEC_MODE_KEYDOWN | EXEC_MODE_ANIM)) { SetToolNameVar("None"); SetLinkDataVar("None"); } // Standard reason for re-evaluation of script. SetExecModeVar(EXEC_MODE_NONE); }
void COGLWin::IdleFunc() { bool bRedisplay = false; if (m_bHasOutput && m_pOutput) { m_pOutput->SetOutputObjectList(m_Parse.GetOutputObjectList()); //m_sOutput.insert(0, "<body size=\"14\">"); //m_sOutput += "</body>"; //m_pOutput->SetText(m_sOutput.c_str()); // Uncomment this block in order to bring output window to front // when new output text is available. /* if (!m_bInFullScreenMode && (!m_pOutput->shown() || (m_pOutput->shown() && !m_pOutput->visible()))) m_pOutput->show(); */ ClearOutput(); } if (m_bInFullScreenMode) { if (m_pOutput && m_pOutput->shown()) m_pOutput->iconize(); } // Have to check global variables of script only after script // has been executed once. if (!m_bWaitWithIdleForNextDisplay) { /// If script can be animated then animate it. if (m_bCheckForAnimate) { m_bCheckForAnimate = false; if (!m_bIsAnimated && CanAnimateScript()) { m_bAnimPauseChanged = false; // Set by SetAnimationTimeStep StartAnimation(m_iAnimPause); SetAnimCode(true); m_sMessage += "Switching to animation mode...\n"; m_bHasMessage = true; } else { m_bCodeChangedForAnim = false; } } if (m_bCheckToolBoxSize) { m_ToolBox.Update(); CheckToolBoxSize(); m_bCheckToolBoxSize = false; } if (m_dNewInfoWidth >= 0) { COGLWinFLTK::SetInfoWidth(m_dNewInfoWidth); m_dNewInfoWidth = -1.0; } if (m_bScriptChangedOGLSize) { COGLWinFLTK::SetOGLSize(m_dNewOGLWidth, m_dNewOGLHeight); m_bScriptChangedOGLSize = false; } } /* else { printf("Waiting to check global vars.\n"); } */ Sleep(1); }
// CheckSerial // Checks for commands on the serial port int Panel8x8Serial::CheckSerial() { static int i,j,k; static int iReceiveBuffer; static int iBufferBlock; uint8_t sr; uint16_t *ptr; static byte sCommand = 0; static byte inbuffer[16]; if (Serial.available()>0) { while (Serial.available()>0) { sr = Serial.read(); // Look for start of command if (sr==27 && sCommand==0) { sCommand = 255; } // Command processing // If HaveCommand then we saw an escape which is a start of command sequence character // Look for Esc-C, Esc-F, Esc-L, or ESC-S else if (sCommand == 255) { if (sr=='C') {WriteByte(0,0); iBufferLen=0; NewMessage(); sCommand=0;} else if (sr=='T') {PanelMode=11; sCommand=1;} //Loading Text else if (sr=='F') {PanelMode=12; sCommand=2;} //Loading Animation else if (sr=='L') {PanelMode=13; sCommand=3;} //Live Animation else if (sr=='S') { sCommand=4;} //Settings mode #ifdef DEBUG8X8SERIAL (*_debug) << "Command Decoded " << _DEC(sCommand) << crlf; #endif i=0; //Index into char text buffer j=0; //Packet length k=0; //Parameters buffer length } // Text Loading else if (sCommand == 1) { //Text Loading Mode if (k<=3) { #ifdef DEBUG8X8SERIAL (*_debug) << "Param: " << _DEC(k) << " = " << _DEC(sr) << crlf; #endif inbuffer[k++]=char(sr); if (k==4) { k++; ClearOutput(); bIsScrolling=true; ptr = (uint16_t *)inbuffer; frameDelay = *ptr++; iReceiveBuffer = *ptr; #ifdef DEBUG8X8SERIAL (*_debug) << "frameDelay: " << frameDelay << crlf; (*_debug) << "Length: " << iReceiveBuffer << crlf; #endif iBufferLen=0; iBufferBlock=0; if (iReceiveBuffer>iBufferSize) {iReceiveBuffer=0;} if (iReceiveBuffer==0) {Serial.print(char(1)); PanelMode=1; NewMessage(); sCommand=0;} // End of processing if 0 length buffer } } else { WriteByte(iBufferLen++,sr); #ifdef DEBUG8X8SERIAL (*_debug) << iBufferLen << "/" << iReceiveBuffer << ": " << sr << crlf; #endif if (++iBufferBlock==64) {Serial.print(char(0)); iBufferBlock=0;} if (iBufferLen>=iReceiveBuffer) {Serial.print(char(0)); WriteByte(iBufferLen,0); PanelMode=1; NewMessage(); sCommand=0;} // End of processing if no more text } } // Animation Loading else if (sCommand == 2) { // Animation Load Mode // Parameter Processing if (k<=7) { #ifdef DEBUG8X8SERIAL (*_debug) << "Param: " << _DEC(k) << " = " << _DEC(sr) << crlf; #endif inbuffer[k++]=char(sr); if (k==8) { // Parameters idxScroll=0; //Reset buffer pointer bIsScrolling=false; ptr = (uint16_t *)inbuffer; i = *(ptr++); #ifdef DEBUG8X8SERIAL (*_debug) << "Version: " << _DEC(i) << crlf; #endif if (i!=PANEL8X8SERIALFILE) {Serial.print(char(1)); PanelMode=2; sCommand=0;} //Send back a 1 as error, wrong version. iPanels = *(ptr++); iFrames = *(ptr++); frameDelay = *(ptr); #ifdef DEBUG8X8SERIAL (*_debug) << "Panels: " << iPanels << crlf; (*_debug) << "Fames: " << iFrames << crlf; (*_debug) << "Delay: " << frameDelay << crlf; #endif l = iPanels * 8 * iFrames; i=0; iBufferBlock =0; if (isBufferProgMem || l > iBufferSize) {l=0;} if (l==0) {Serial.print(char(1)); PanelMode=2; sCommand=0;} // End of processing if 0 length buffer } } // Data Processing else { #ifdef DEBUG8X8SERIAL (*_debug) << i << "/" << l << ": " << sr << crlf; #endif WriteByte(i++,sr); if (++iBufferBlock==8) {Serial.print(char(0)); iBufferBlock=0;} if (i==l) {Serial.print(char(0)); PanelMode=2; sCommand=0;} // End of processing no more data. } } // Live Animation Loading else if (sCommand == 3) { // Live Animation Load Mode // Parameter Processing if (k<=5) { #ifdef DEBUG8X8SERIAL (*_debug) << "Param: " << _DEC(k) << " = " << _DEC(sr) << crlf; #endif inbuffer[k++]=char(sr); if (k==6) { // Parameters idxScroll=0; //Reset buffer pointer bIsScrolling=false; ptr = (uint16_t *)inbuffer; i = *(ptr++); #ifdef DEBUG8X8SERIAL (*_debug) << "Version: " << _DEC(i) << crlf; #endif if (i!=PANEL8X8SERIALFILE) {Serial.print(char(1)); PanelMode=3; sCommand=0;} //Send back a 1 as error, wrong version. iPanels = *(ptr++); iFrames = 1; frameDelay = *(ptr); #ifdef DEBUG8X8SERIAL (*_debug) << "Panels: " << iPanels << crlf; (*_debug) << "Fames: " << iFrames << crlf; (*_debug) << "Delay: " << frameDelay << crlf; #endif l = iPanels * 8; j = 0; i = 0; if (l==0) {PanelMode=3; sCommand=0;} // End of processing if 0 length buffer } } // Data Processing else { #ifdef DEBUG8X8SERIAL (*_debug) << i << "/" << l << ": " << sr << crlf; #endif iScroll[j][i++] = sr; if (i==8) {i=0; j++;} --l; if (l==0) {Serial.print(char(0)); PanelMode=3; sCommand=0; Scroll();} // End of processing no more data. } } // Settings commands else if (sCommand == 4) { if (sr==0) {Begin((char *)ramBuffer,iBufferSize,iBufferLen,(int)isBufferProgMem); sCommand=0;} else if (sr==1) {frameDelay = sr; sCommand=0;} else if (sr==2) {sCommand=0;} } } } }