void DefTermLogString(LPCWSTR asMessage, LPCWSTR asLabel /*= NULL*/) { if (!asMessage || !*asMessage) { return; } // To ensure that we may force debug output for troubleshooting // even from non-def-term-ed applications if (!gpDefTerm) { DebugStr(asMessage); if (asMessage[lstrlen(asMessage) - 1] != L'\n') { DebugStr(L"\n"); } return; } LPCWSTR pszReady = asMessage; CEStr lsBuf; if (asLabel && !asLabel) { lsBuf = lstrmerge(asLabel, asMessage); if (lsBuf.ms_Arg) pszReady = lsBuf.ms_Arg; } gpDefTerm->LogHookingStatus(pszReady); }
void show_alloc_list(void) { HeapStruct *alist = alloc_list; DebugStr("\n-------------------\n"); while (alist) { DebugStr("Head = %x, Tail = %x, Payload Head = %x, Payload Tail = %x\n", alist->bk_head, alist->bk_tail, alist->pl_head, alist->pl_tail); DebugStr("-------------------\n"); alist = alist->next; } }
void AWinControlBase::ShowModal() { AControl* pParent = dynamic_cast<AControl*>(GetParent()); //if( pParent ) pParent->Refresh(); HWND hWndParent = (pParent ? pParent->GetUICore()->GetHandle() : NULL ); HWND hFirstParent = hWndParent; HWND hWnd = GetHandle(); //显示自己 //ShowWindow(hWnd, SW_SHOW); //BringWindowToTop(hWnd); //if( pParent ) pParent->Refresh(); //disable掉父窗口 while(hWndParent != NULL) { EnableWindow(hWndParent, FALSE); //::InvalidateRect(hWndParent,NULL,FALSE); //::UpdateWindow(hWndParent); hWndParent = ::GetParent(hWndParent); } SetVisible(true); m_bModal = true; m_pWindow->SetPostQuitFlag(true); //接管消息循环 DebugStr(_T("\r\nBegin modalWin.Run")); while(true) { MSG msg; if (!GetMessage(&msg, NULL, 0, 0)) break; TranslateMessage(&msg); DispatchMessage(&msg); } DebugStr(_T("\r\nEnd ModalWin.Run")); //将自己隐藏 ShowWindow(hWnd, SW_HIDE); //Close(); //模态已经退出 //恢复父窗口的enable状态 hWndParent = hFirstParent; while (hWndParent != NULL) { EnableWindow(hWndParent, TRUE); //::InvalidateRect(hWndParent,NULL,TRUE); //::UpdateWindow(hWndParent); hWndParent = ::GetParent(hWndParent); } SetForegroundWindow(hFirstParent); //SetFocus(hFirstParent); }
void test15 () { printf("\n\n<TEST 15> send many notes in the future\n"); DebugStr ("--> use g or G to send many notes in the future and go to the next test\n"); SendMultipleNotes(10, 60, 250); printf("\n\n<TEST 15 bis> send more notes in the future\n"); DebugStr ("--> use g or G to send more notes in the future and go to the next test\n"); SendMultipleNotes(6, 60, 800); SendMultipleNotes(8, 72, 600); }
void test12 () { printf("\n\n<TEST 12> list the destinations of our application\n"); DebugStr ("--> use g or G to list the destinations of our application and go to the next test\n"); listOfDest(ourRefNum); }
void test10 () { printf("\n\n<TEST 10> connect the output of 'MidiShare Tutorial' to 'MidiShare'\n"); DebugStr ("--> use g or G to make the connection and go to the next test\n"); MidiConnect(ourRefNum, 0, true); }
void test7 () { printf("\n\n<TEST 7> search the reference number of 'MacOSX Tutorial'\n"); DebugStr ("--> use g or G to search the reference number of 'MacOSX Tutorial' and go to the next test\n"); printf("Reference number of '%#s' : %d\n", "MacOSX Tutorial", MidiGetNamedAppl("MacOSX_Tutorial")); }
void test6 () { printf("\n\n<TEST 6> List every MidiShare client applications\n"); DebugStr ("--> use g or G to list every MidiShare client applications and go to the next test\n"); listOfAppl(); }
static DialogPtr OpenThisDialog(StringPtr nameString, StringPtr descString) { short type; Handle hndl; Rect box; GrafPtr oldPort; DialogPtr dlog; unsigned char *p,str[256]; DebugStr ( "/pOpenThisDialog" ); DPRINT (( "OpenThisDialog - nameString : %s descString : %s", nameString, descString )); return NIL; GetPort(&oldPort); dlog = GetNewDialog(thisDialogID,NIL,FRONT_WINDOW); if (dlog == NIL) { SysBeep(1); return(NIL); } /* Poor man's error message */ CenterWindow(dlog,0); SetPort(dlog); // insert the initial values into our fields PutDlgString(dlog, EDIT6, descString, FALSE); PutDlgString(dlog, EDIT5, nameString, TRUE); ShowWindow(dlog); return(dlog); }
// Try to accept a remote connection from client. // Implement based on accept() and select() // 1. Input: // <1> socket // <2> timeout : in ms // - if > 0 block for timeout us // - if = 0 non-blocking // - if < 0 block forever if no remote connection // <3> retry : currently does not support // <4> client_addr: a pointer to a str buffer, length at least 100 // 2. Output: // <1> client_addr : client ip address string // <2> ret : client socket if success else -1 int Accept(int sock_fd, int timeout, int retry, char *client_addr) { struct timeval tv, *tv_ptr; if (timeout < 0) { tv_ptr = NULL; } else { tv.tv_sec = timeout / 1000; tv.tv_usec = timeout % 1000; tv_ptr = &tv; } fd_set read_fds; FD_ZERO(&read_fds); FD_SET(sock_fd, &read_fds); switch(select(sock_fd + 1, &read_fds, NULL, NULL, tv_ptr)) { case 0: return 0; // timeout case -1: return -1; // error } struct sockaddr_storage addr; socklen_t addr_size = sizeof(addr); int client_fd = accept(sock_fd, (struct sockaddr *)&addr, &addr_size); if (client_fd == -1) { unix_error("Accpet:"); } const int MAXSIZE = 100; if (client_addr) { inet_ntop(addr.ss_family, get_in_addr((struct sockaddr *)&addr), client_addr, MAXSIZE); DebugStr("Server: got connections from %s\n", client_addr); } return client_fd; }
short __assert (char *expr, char *file, short line) { bigstring bsfile, bsline, bsmessage; static boolean flnorentry = false; if (flnorentry) return (0); flnorentry = true; moveleft (file, bsfile, (long) lenbigstring); convertcstring (bsfile); numbertostring ((long) line, bsline); parsedialogstring ( "\pAssertion failed in file ^0, at line ^1.", bsfile, bsline, nil, nil, bsmessage); DebugStr (bsmessage); flnorentry = false; return (0); } /*__assert*/
int dprintf( const char *format, ...) { char buffer[257]; /* [length byte] + [255 string bytes] + [null] */ va_list arglist; int return_value; if (debug_status) { va_start(arglist, format); return_value= vsprintf(buffer+1, format, arglist); va_end(arglist); *buffer= strlen(buffer+1); #ifdef DEBUG if (debugger_installed) { DebugStr((StringPtr)buffer); } else #endif { ParamText((StringPtr)buffer, (StringPtr)"\p?", (StringPtr)"", (StringPtr)""); Alert(alrtNONFATAL_ERROR, (ModalFilterUPP) NULL); ParamText((StringPtr)"", (StringPtr)"", (StringPtr)"", (StringPtr)""); } } else {
void test13 () { printf("\n\n<TEST 13> list the sources of the MidiShare output driver\n"); DebugStr ("--> use g or G to list the sources of the MidiShare output driver and go to the next test\n"); listOfSrc(0); }
void test14 () { printf("\n\n<TEST 14> send a note\n"); DebugStr ("--> use g or G to send a note and go to the next test\n"); sendNote(60); }
static void jsdebugstr(const char *debuggerMsg) { Str255 pStr; PStrFromCStr(debuggerMsg, pStr); DebugStr(pStr); }
void wxMessageOutputDebug::Printf(const wxChar* format, ...) { wxString out; va_list args; va_start(args, format); out.PrintfV(format, args); va_end(args); #if defined(__WXMSW__) && !defined(__WXMICROWIN__) out.Replace(wxT("\t"), wxT(" ")); out.Replace(wxT("\n"), wxT("\r\n")); ::OutputDebugString(out); #elif defined(__WXMAC__) && !defined(__DARWIN__) if ( wxIsDebuggerRunning() ) { Str255 pstr; wxString output = out + wxT(";g") ; wxMacStringToPascal(output.c_str(), pstr); #ifdef __powerc DebugStr(pstr); #else SysBreakStr(pstr); #endif } #else wxFputs( out , stderr ) ; if ( out.Right(1) != wxT("\n") ) wxFputs( wxT("\n") , stderr ) ; fflush( stderr ) ; #endif // platform }
void CDefTermHk::LogHookingStatus(LPCWSTR asMessage) { if (!mp_FileLog || !mp_FileLog->IsLogOpened()) { if (asMessage && *asMessage) { DebugStr(asMessage); if (asMessage[lstrlen(asMessage)-1] != L'\n') { DebugStr(L"\n"); } } return; } mp_FileLog->LogString(asMessage); }
void test1 () { printf("\n\n <TEST 1 : Check if MidiShare is installed> \n"); DebugStr ("--> use g or G to run the next test\n"); printf("MidiShare installed : %s\n", (MidiShare() ? "YES" : "NO") ); }
void test3 () { printf("\n\n<TEST 3> Count MidiShare client applications\n"); DebugStr ("--> use g or G to count MidiShare client applications and go to the next test\n"); printf("Count of MidiShare client applications : %hi\n", MidiCountAppls()); }
void test20 () { printf("\n\n<TEST 20> transpose and delay in real-time\n"); DebugStr ("--> use g or G to start transposing incoming events\n"); MidiFlushEvs(ourRefNum); // MidiSetRcvAlarm(ourRefNum, transposeAndDelay); MidiConnect(0, ourRefNum, true); MidiConnect(ourRefNum, 0, true); printf("Now play on the Midi keyboard, notes are transposed and delayed\n"); DebugStr ("--> use g or G to stop transposing events and go to the next test\n"); MidiConnect(0, ourRefNum, false); // MidiSetRcvAlarm(ourRefNum, 0); }
void test19 () { printf("\n\n<TEST 19> thru incoming events\n"); DebugStr ("--> use g or G to start thruing incoming events\n"); MidiFlushEvs(ourRefNum); // MidiSetRcvAlarm(ourRefNum, thru); MidiConnect(0, ourRefNum, true); MidiConnect(ourRefNum, 0, true); printf("Now play on the Midi keyboard\n"); DebugStr ("--> use g or G to stop thruing incoming events and go to the next test\n"); MidiConnect(0, ourRefNum, false); // MidiSetRcvAlarm(ourRefNum, 0); }
void test18 () { printf("\n\n<TEST 18> send an SMPTE offset\n"); DebugStr ("--> use g or G to send an SMPTE offset to 'msDisplay' and go to the next test\n"); sendSMPTEOffset(1, 10, 24, 59, 12, 00); }
/* * Do a command with autosense using the original SCSI manager. */ OSErr DoOriginalSCSICommand( DeviceIdent scsiDevice, const SCSI_CommandPtr theSCSICommand, unsigned short cmdBlockLength, Ptr dataBuffer, ByteCount dataLength, UInt32 scsiFlags, ByteCount *actualTransferCount, SCSI_Sense_Data *sensePtr ) { OSErr status; UInt8 scsiStatusByte; SCSI_Command scsiStatusCommand; status = OriginalSCSI( scsiDevice, theSCSICommand, cmdBlockLength, dataBuffer, dataLength, scsiFlags, actualTransferCount, &scsiStatusByte ); if (status == scsiNonZeroStatus && scsiStatusByte == kScsiStatusCheckCondition && sensePtr != NULL) { CLEAR(scsiStatusCommand); CLEAR(*sensePtr); scsiStatusCommand.scsi6.opcode = kScsiCmdRequestSense; scsiStatusCommand.scsi[1] |= (scsiDevice.LUN & 0x03) << 5; scsiStatusCommand.scsi6.len = sizeof *sensePtr; status = OriginalSCSI( scsiDevice, &scsiStatusCommand, sizeof scsiStatusCommand.scsi6, (Ptr) sensePtr, sizeof *sensePtr, scsiDirectionIn, NULL, &scsiStatusByte ); if (status != noErr && status != scsiDataRunError) { #ifdef notdef if (gDebugOnError && scsiStatusByte != kScsiStatusCheckCondition) { Str255 work; pstrcpy(work, "\pAutosense failed "); AppendSigned(work, status); AppendChar(work, ' '); AppendHexLeadingZeros(work, scsiStatusByte, 2); DebugStr(work); } #endif sensePtr->errorCode = 0; status = scsiAutosenseFailed; }
void test8 () { printf("\n\n<TEST 8> search the reference number of 'XYZ'\n"); DebugStr ("--> use g or G to search the reference number of 'XYZ' and go to the next test\n"); printf("Reference number of '%#s' : %d\n", "XYZ", MidiGetNamedAppl("XYZ")); printf("A negative result means that the application was not found.\n"); }
//# include <stldebug.h> void STLPORT::__stl_debug_message(const char * format_str, ...) { std::va_list args; va_start( args, format_str ); char msg[256]; std::vsnprintf(msg, sizeof(msg)/sizeof(*msg) - 1, format_str, args ); DebugStr( c2pstr(msg) ); }
void test9 () { printf("\n\n<TEST 9> change the name of client application 'MacOSX Tutorial' to 'MidiShare Tutorial'\n"); DebugStr ("--> use g or G to change the name and go to the next test\n"); MidiSetName(MidiGetNamedAppl("MacOSX_Tutorial"), "MidiShare_Tutorial"); listOfAppl (); }
void test22 () { printf("\n\n<TEST 22> close the MidiShare session\n"); DebugStr ("--> use g or G to end the session and exit the tutorial\n"); MidiFreeFilter(ourFilter); MidiClose(ourRefNum); printf("\nTHE TUTORIAL IS NOW FINISHED!\n"); }
void test2 () { long v; printf("\n\n<TEST 2> Get MidiShare version\n"); DebugStr ("--> use g or G to get the MidiShare version and go to the next test\n"); v = MidiGetVersion(); printf("MidiShare version : %ld.%ld\n", v / 100, v % 100); }
void test11 () { printf("\n\n<TEST 11> test a connection\n"); DebugStr ("--> use g or G to test the connection and go to the next test\n"); if (MidiIsConnected(ourRefNum, 0)) printf("We are connected to the MidiShare output driver\n"); else printf("We are not connected\n"); }
void test4 () { printf("\n\n<TEST 4> Register as a client application\n"); DebugStr ("--> use g or G to register as a client application and go to the next test\n"); ourRefNum = MidiOpen("MacOSX_Tutorial"); if (ourRefNum > 0) printf("MidiOpen succeed. Our reference number is : %ld\n", ourRefNum); else printf("MidiOpen fail. The error code is : %ld\n", ourRefNum); }