- Timestamp:
- Nov 6, 2007, 11:00:00 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tools/qglobal.cpp
r133 r173 51 51 #if defined(Q_OS_OS2) 52 52 #include "qt_os2.h" 53 #include <time.h> 53 54 #endif 54 55 … … 448 449 449 450 450 #if def Q_CC_MWERKS451 #if defined(Q_CC_MWERKS) 451 452 452 453 #include "qt_mac.h" … … 464 465 } 465 466 466 #endif 467 467 #elif defined(Q_OS_OS2) 468 469 // OS/2 PmPrintf debug output function 470 471 static 472 void qPmPrint( const char *buf ) 473 { 474 // recognized environment variables: 475 // QT_PM_DEBUG_FILE=<filename> output to file 476 // QT_PM_DEBUG_QUEUE output to queue \QUEUES\PRINTF32 477 // that can be read e.g. by PmPrintf 478 // <nothing> output to stderr 479 480 char const *queue_env = ::getenv( "QT_PM_DEBUG_QUEUE" ), 481 *file_env = ::getenv( "QT_PM_DEBUG_FILE" ); 482 483 if ( queue_env != 0 ) { 484 PID srvPid; 485 HQUEUE queue; 486 if ( ::DosOpenQueue( &srvPid, &queue, "\\QUEUES\\PRINTF32" ) == NO_ERROR ) { 487 char* shrBuf; 488 unsigned long bufSize = ::strlen(buf) + 1; 489 if ( ::DosAllocSharedMem( (PPVOID) &shrBuf, NULL, bufSize, 490 OBJ_GIVEABLE | PAG_WRITE | 491 PAG_COMMIT ) != NO_ERROR ) { 492 ::DosSleep( 200 ); // give it a second chance... 493 if ( ::DosAllocSharedMem( (PPVOID) &shrBuf, NULL, bufSize, 494 OBJ_GIVEABLE | PAG_WRITE | 495 PAG_COMMIT ) != NO_ERROR ) { 496 ::DosCloseQueue( queue ); 497 return; // give up... 498 } 499 } 500 ::strcpy( shrBuf, buf ); 501 502 if ( ::DosGiveSharedMem( shrBuf, srvPid, PAG_READ ) == NO_ERROR ) { 503 time_t tt; 504 ::time(&tt); 505 ::DosWriteQueue( queue, (ULONG)tt, bufSize, shrBuf, 0 ); 506 } 507 508 ::DosFreeMem( shrBuf ); 509 ::DosCloseQueue( queue ); 510 511 return; 512 } 513 } else if ( file_env != 0 ) { 514 FILE* f = ::fopen( file_env, "a" ); 515 if( f != 0 ) 516 { 517 ::fprintf( f, "%s\n", buf ); 518 ::fclose( f ); 519 return; 520 } 521 } else { 522 ::fprintf( stderr, "%s\n", buf ); 523 } 524 } 525 526 #endif 468 527 469 528 void qDebug( const char *msg, ... ) … … 488 547 QString fstr( buf ); 489 548 OutputDebugString( (fstr + "\n").ucs2() ); 549 #elif defined(Q_OS_OS2) 550 qPmPrint( buf ); 490 551 #else 491 552 fprintf( stderr, "%s\n", buf ); // add newline … … 516 577 QString fstr( buf ); 517 578 OutputDebugString( (fstr + "\n").ucs2() ); 579 #elif defined(Q_OS_OS2) 580 qPmPrint( buf ); 518 581 #else 519 582 fprintf( stderr, "%s\n", buf ); // add newline … … 543 606 QString fstr( buf ); 544 607 OutputDebugString( (fstr + "\n").ucs2() ); 608 #elif defined(Q_OS_OS2) 609 qPmPrint( buf ); 545 610 #else 546 611 fprintf( stderr, "%s\n", buf ); // add newline … … 572 637 QString fstr( buf ); 573 638 OutputDebugString( (fstr + "\n").ucs2() ); 639 #elif defined(Q_OS_OS2) 640 qPmPrint( buf ); 574 641 #else 575 642 fprintf( stderr, "%s\n", buf ); // add newline … … 596 663 #if defined(Q_CC_MWERKS) 597 664 mac_default_handler(buf); 665 #elif defined(Q_OS_OS2) 666 qPmPrint( buf ); 598 667 #else 599 668 fprintf( stderr, "%s\n", buf ); // add newline … … 632 701 #if defined(Q_CC_MWERKS) 633 702 mac_default_handler(buf); 703 #elif defined(Q_OS_OS2) 704 qPmPrint( buf ); 634 705 #else 635 706 fprintf( stderr, "%s\n", buf ); // add newline … … 656 727 error code will be used if possible. Use this method to handle 657 728 failures in platform specific API calls. 658 729 659 730 Under OS/2, the value -1 for \a code should only be used after Presentation 660 731 Manager calls.
Note:
See TracChangeset
for help on using the changeset viewer.