00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 #include "camtypes.h"
00106
00107
00108 #include "camelot.h"
00109 #include "gdraw.h"
00110 #include "cversion.h"
00111
00112 #if !defined(EXCLUDE_FROM_XARLIB)
00113
00114 #include "helpuser.h"
00115 #include "basebar.h"
00116
00117 #include "ralphdoc.h"
00118
00119 #include "ralpherr.h"
00120 #include "camprofile.h"
00121 #include "cartprov.h"
00122 #include "dragmgr.h"
00123 #endif
00124
00125
00126 DECLARE_SOURCE("$Revision: 1783 $");
00127
00128 #if 0
00129 #ifdef _DEBUG
00130 #undef THIS_FILE
00131 static char BASED_CODE THIS_FILE[] = __FILE__;
00132 #endif
00133 #endif
00134
00135 static BOOL ErrorHasBeenReported = TRUE;
00136 static UINT32 InSetError = 0;
00137 UINT32 Error::ErrorBoxRecurse = 0;
00138
00139
00140 typedef enum
00141 {
00142 ERRORSTAT_NONE,
00143 ERRORSTAT_TEXT,
00144 ERRORSTAT_ID
00145 } ErrorStatus;
00146
00147 static ErrorStatus ErrStatus = ERRORSTAT_NONE;
00148
00149
00150 UINT32 Error::RenderThread = 0;
00151
00152 wxString Error::UserName;
00153
00154 #if !defined(EXCLUDE_FROM_XARLIB)
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 ErrorInfo::ErrorInfo()
00166 {
00167 ErrorMsg = 0;
00168 Title = 0;
00169 Button[0] = _R(IDS_OK);
00170 Button[1] = 0;
00171 Button[2] = 0;
00172 Button[3] = 0;
00173 OK = 1;
00174 Cancel = 2;
00175 Help = 0;
00176 }
00177 #endif
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 HRESULT Error::ErrIDToHRESULT(UINT32 ErrID)
00189 {
00190 #ifdef RALPH
00191 return GetHRESULTFromID(ErrID);
00192 #endif
00193 return S_OK;
00194 }
00195
00196 #if !defined(EXCLUDE_FROM_XARLIB)
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 HRESULT Error::GetRalphError()
00209 {
00210
00211 UINT32 Err = Error::GetRalphErrorNumber();
00212 wxString ErrStr( Error::GetErrorString() );
00213 HRESULT hr = S_OK;
00214
00215
00216 if(Err==0)
00217 {
00218 if(!ErrStr.IsEmpty())
00219 {
00220 #if defined(_DEBUG) && defined(__WXMSW__)
00221 MessageBox(NULL,ErrStr,_T("Error"),MB_OK);
00222 #endif
00223
00224 Error::ClearError();
00225 }
00226 }
00227
00228
00229 if(Err!=0)
00230 {
00231
00232 hr = ErrIDToHRESULT(Err);
00233
00234 }
00235
00236 if(Err==0)
00237 {
00238 if(!ErrStr.IsEmpty())
00239 hr = RALPH_E_INTERNAL;
00240 }
00241
00242 return hr;
00243 }
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270 #ifdef RALPH
00271
00272
00273 INT32 InformGeneral(UINT32 Error, UINT32 modID, UINT32 ErrorMsg,
00274 UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4,
00275 UINT32 OK, UINT32 Cancel)
00276 {
00277
00278
00279
00280
00281
00282
00283 Document *pkDoc = Document::GetCurrent();
00284 RalphDocument * pRalphDoc = NULL;
00285 if(pkDoc==NULL)
00286 return _R(IDS_OK);
00287
00288 pRalphDoc = pkDoc->GetRalphDoc();
00289
00290 if(pRalphDoc== NULL)
00291 return _R(IDS_OK);
00292
00293
00294 if (ErrorMsg != 0)
00295 {
00296
00297 Error::SetError(ErrorMsg, modID);
00298 }
00299
00300
00301
00302
00303
00304 if ( Error::IsInRenderThread() )
00305 TRACE( _T("Ralph InformGeneral called within RenderThread => serious rendering error"));
00306
00307
00308 ErrStatus = ERRORSTAT_NONE;
00309
00310 if ( Error::IsInRenderThread() )
00311 {
00312 TRACE( _T("In RenderThread so clearing up system"));
00313 Error::RenderThreadReset();
00314 CamProfile::AtBase(CAMPROFILE_OTHER);
00315 }
00316
00317
00318
00319
00320
00321 HRESULT hr = Error::GetRalphError();
00322 if(!pRalphDoc->IsInRalphMethod())
00323 {
00324
00325 if(hr !=S_OK && hr!= RALPH_E_INTERNAL)
00326 {
00327 if(pRalphDoc)
00328 {
00329 pRalphDoc->PassErrorToHarness(hr);
00330 }
00331 }
00332
00333 Error::ClearError();
00334 }
00335
00336
00337 ErrorHasBeenReported = TRUE;
00338 ErrorBoxRecurse--;
00339 return _R(IDS_OK) ;
00340 }
00341
00342 #else
00343
00344 #ifdef HAVE_DEBUGREPORT
00345 class wxCamDebugReport : public wxDebugReport
00346 {
00347 public:
00348 virtual void DoAddCustomContext(wxXmlNode * nodeRoot)
00349 {
00350 wxString strMessage;
00351
00352 #if FALSE == wxUSE_UNICODE
00353 TCHAR* pszCDrawVer = GDraw_GetSvnVersion();
00354 #else
00355 TCHAR pszCDrawVer[32];
00356 camMbstowcs( pszCDrawVer, GDraw_GetSvnVersion(), 31 );
00357 #endif
00358
00359 wxXmlNode *nodeVersion = new wxXmlNode(wxXML_ELEMENT_NODE, _T("camelot"));
00360 nodeVersion->AddProperty(_T("xtremeversion"), wxString(g_pszAppVersion));
00361 nodeVersion->AddProperty(_T("xtremerevision"), wxString(g_pszSvnVersion));
00362 nodeVersion->AddProperty(_T("xaradrawversion"), wxString::Format(_T("%d.03d"), HIWORD(GDraw_GetVersion()), LOWORD(GDraw_GetVersion())));
00363 nodeVersion->AddProperty(_T("xaradrawrevision"), pszCDrawVer);
00364 nodeVersion->AddProperty(_T("builddate"), CAMELOT_BUILD_DATE);
00365 nodeRoot->AddChild(nodeVersion);
00366 }
00367 };
00368 #endif
00369
00370 class CamErrorDialog : public wxDialog
00371 {
00372 public:
00373 CamErrorDialog(ResourceID TitleID) : wxDialog( NULL, -1, CamResource::GetText(TitleID),
00374 wxDefaultPosition, wxDefaultSize,
00375 wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP )
00376 {
00377 m_nHelpContext = Error::GetErrorNumber();
00378 if (! m_nHelpContext) m_nHelpContext = GetNextMsgHelpContext();
00379 }
00380
00381 wxButton * AddErrorButton(wxSizer * pButtonSizer, const TCHAR * pText, INT32 id)
00382 {
00383 wxButton* pButton = new wxButton( this, id, pText, wxDefaultPosition, wxDefaultSize, 0 );
00384 if (!pButton)
00385 return NULL;
00386 pButtonSizer->Add(pButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00387 return pButton;
00388 }
00389
00390 void ButtonClicked(wxCommandEvent &event)
00391 {
00392 ResourceID id = event.GetId();
00393 if (id == _R(IDS_HELP))
00394 {
00395 #if !defined(EXCLUDE_FROM_RALPH)
00396
00397 HelpUser(m_nHelpContext);
00398 #endif
00399 }
00400 else if (id == _R(IDS_ERRORBOX_DEBUGREPORT))
00401 {
00402 #ifdef HAVE_DEBUGREPORT
00403 wxCamDebugReport report;
00404 wxDebugReportPreviewStd preview;
00405
00406 report.AddAll();
00407
00408 if ( preview.Show(report) )
00409 report.Process();
00410 #else
00411
00412
00413
00414 ::wxMessageBox(_T("Your build was not compiled to support debug reports"));
00415 #endif
00416 }
00417 else
00418 {
00419 EndModal(id);
00420 }
00421 }
00422
00423 INT32 m_nHelpContext;
00424
00425 DECLARE_EVENT_TABLE()
00426 };
00427
00428 BEGIN_EVENT_TABLE( CamErrorDialog, wxDialog )
00429 EVT_COMMAND (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, CamErrorDialog::ButtonClicked)
00430 END_EVENT_TABLE()
00431
00432
00433
00434 INT32 InformGeneral(UINT32 Error, UINT32 modID, UINT32 ErrorMsg,
00435 UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4,
00436 UINT32 OK, UINT32 Cancel)
00437 {
00438
00439 if (Butt1 == 0) Butt1 = _R(IDS_OK);
00440
00441 if (Error::ErrorBoxRecurse)
00442 {
00443
00444
00445
00446 TRACE( _T("Recursive InformGeneral - Error in error handler! (1)\n"));
00447
00448 Beep();
00449 return(OK);
00450 }
00451
00452 Error::ErrorBoxRecurse++;
00453 if (ErrorMsg != 0)
00454 {
00455
00456 Error::SetError(ErrorMsg, modID);
00457 }
00458
00459
00460 ENSURE((!ErrorHasBeenReported),
00461 "InformGeneral: This error has already been reported!");
00462
00463
00464
00465
00466
00467 ResourceID TitleID = 0;
00468
00469 ResourceID DebugReport = 0;
00470
00471 wxArtID bitmap=wxART_MISSING_IMAGE;
00472
00473 switch (Error)
00474 {
00475 case ERRORTYPE_NORMAL:
00476
00477 bitmap = wxART_INFORMATION;
00478 TitleID = _R(IDS_ERRORBOX_NORMAL);
00479 break;
00480
00481 case ERRORTYPE_QUESTION:
00482
00483 bitmap = wxART_QUESTION;
00484 TitleID = _R(IDS_ERRORBOX_NORMAL);
00485 break;
00486
00487 case ERRORTYPE_WARNING:
00488
00489 bitmap = wxART_WARNING;
00490 TitleID = _R(IDS_ERRORBOX_WARNING);
00491 break;
00492
00493 case ERRORTYPE_SERIOUS:
00494
00495 bitmap = wxART_ERROR;
00496 TitleID = _R(IDS_ERRORBOX_SERIOUS);
00497 DebugReport = _R(IDS_ERRORBOX_DEBUGREPORT);
00498 break;
00499
00500 case ERRORTYPE_ENSURE:
00501
00502 bitmap = wxART_ERROR;
00503 TitleID = _R(IDS_ERRORBOX_ENSURE);
00504 DebugReport = _R(IDS_ERRORBOX_DEBUGREPORT);
00505 break;
00506
00507 case ERRORTYPE_ERROR:
00508 default:
00509
00510 bitmap = wxART_ERROR;
00511 TitleID = _R(IDS_ERRORBOX_ERROR);
00512 break;
00513
00514 }
00515
00516
00517
00518
00519
00520 wxDialog * pBox = new CamErrorDialog(TitleID);
00521
00522 if (!pBox)
00523 {
00524 Beep();
00525 Error::ErrorBoxRecurse--;
00526 return OK;
00527 }
00528
00529 #ifdef __WXMAC__
00530 pBox->SetExtraStyle(wxDIALOG_EX_METAL);
00531 pBox->SetBackgroundStyle(wxBG_STYLE_COLOUR);
00532 pBox->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
00533 #endif
00534
00535
00536
00537 wxBoxSizer* pVSizer = new wxBoxSizer(wxVERTICAL);
00538 if (!pVSizer)
00539 {
00540 Beep();
00541 Error::ErrorBoxRecurse--;
00542 delete pBox;
00543 return OK;
00544 }
00545 pBox->SetSizer(pVSizer);
00546
00547 wxBoxSizer* pMessageSizer = new wxBoxSizer(wxHORIZONTAL);
00548 if (!pMessageSizer)
00549 {
00550 Beep();
00551 Error::ErrorBoxRecurse--;
00552 delete pBox;
00553 return OK;
00554 }
00555 pVSizer->Add(pMessageSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00556
00557
00558 CamArtProvider * pArtProv = CamArtProvider::Get();
00559
00560 if (pArtProv)
00561 {
00562 wxStaticBitmap* pStaticBitmap = new wxStaticBitmap( pBox, -1,
00563 wxArtProvider::GetBitmap(bitmap, wxART_MESSAGE_BOX),
00564 wxDefaultPosition, wxDefaultSize, 0 );
00565 if (!pStaticBitmap)
00566 {
00567 Beep();
00568 Error::ErrorBoxRecurse--;
00569 delete pBox;
00570 return OK;
00571 }
00572 pMessageSizer->Add(pStaticBitmap, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00573 }
00574
00575
00576 wxString temp = (TCHAR *)Error::GetErrorString();
00577 temp.Replace(_T("\\n"), _T("\n"), TRUE);
00578
00579
00580
00581
00582
00583 wxStaticText* pMessage = new wxStaticText( pBox, -1, temp,
00584 wxDefaultPosition, wxSize(400, -1),
00585 wxALIGN_CENTRE|wxNO_BORDER );
00586 if (!pMessage)
00587 {
00588 Beep();
00589 Error::ErrorBoxRecurse--;
00590 delete pBox;
00591 return OK;
00592 }
00593
00594 CamResource::DoneInit();
00595
00596 pMessage->Wrap(400);
00597
00598
00599 pMessageSizer->Add(pMessage, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
00600
00601 wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
00602 if (!pButtonSizer)
00603 {
00604 Beep();
00605 Error::ErrorBoxRecurse--;
00606 delete pBox;
00607 return OK;
00608 }
00609 pVSizer->Add(pButtonSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00610
00611 #define EB_MAXBUTS 7
00612 wxButton * pButt[EB_MAXBUTS];
00613 ResourceID butres[EB_MAXBUTS];
00614 butres[0]=0;
00615 butres[1]=Butt1;
00616 butres[2]=Butt2;
00617 butres[3]=Butt3;
00618 butres[4]=Butt4;
00619 butres[5]=0;
00620 butres[6]=DebugReport;
00621
00622 #if !defined(EXCLUDE_FROM_RALPH)
00623
00624
00625 if (CanHelpUser(Error::GetErrorNumber()))
00626 butres[5]=_R(IDS_HELP);
00627 #endif
00628
00629 INT32 butt;
00630 for (butt=0; butt<EB_MAXBUTS; butt++)
00631 {
00632 if (butres[butt])
00633 {
00634 pButt[butt] = ((CamErrorDialog *)pBox)->AddErrorButton(pButtonSizer, CamResource::GetText(butres[butt]),
00635 butres[butt]);
00636 if (!pButt[butt])
00637 {
00638 Beep();
00639 Error::ErrorBoxRecurse--;
00640 delete pBox;
00641 return OK;
00642 }
00643
00644 #ifndef HAVE_DEBUGREPORT
00645 if (butt==6)
00646 {
00647 pButt[butt]->Enable(FALSE);
00648 }
00649 #endif
00650
00651 }
00652 else
00653 pButt[butt]=NULL;
00654 }
00655
00656
00657 if ( ((UINT32)OK <EB_MAXBUTS) && butres[OK] && pButt[OK])
00658 {
00659 pButt[OK]->SetDefault();
00660 pBox->SetDefaultItem(pButt[OK]);
00661 }
00662
00663 pBox->GetSizer()->Fit(pBox);
00664 pBox->GetSizer()->SetSizeHints(pBox);
00665 pBox->Centre();
00666
00667
00668 if (Error == ERRORTYPE_SERIOUS || Error == ERRORTYPE_ENSURE) CCamApp::DisableSystem(pBox);
00669
00670 if ( Error::IsInRenderThread() )
00671 TRACE( _T("InformGeneral called within RenderThread => serious rendering error"));
00672
00673
00674
00675 if (wxWindow::GetCapture()) wxWindow::GetCapture()->ReleaseMouse();
00676
00677 #if !defined(EXCLUDE_FROM_RALPH)
00678 #ifndef EXCLUDE_FROM_XARALX
00679
00680 ControlHelper::InformModalDialogOpened();
00681 #endif
00682
00683 BaseBar::StartErrorBox();
00684 #endif
00685
00686
00687 ResourceID pressed = pBox->ShowModal();
00688 INT32 result = Cancel;
00689
00690 for (butt=0; butt<EB_MAXBUTS; butt++)
00691 {
00692 if (butres[butt] == pressed)
00693 result = butt;
00694 }
00695
00696 ErrStatus = ERRORSTAT_NONE;
00697
00698 delete pBox;
00699
00700 #if !defined(EXCLUDE_FROM_RALPH)
00701
00702 SetNextMsgHelpContext(0);
00703
00704 #ifndef EXCLUDE_FROM_XARALX
00705
00706 ControlHelper::InformModalDialogClosed();
00707 #endif
00708
00709
00710 BaseBar::FinishErrorBox();
00711 #endif
00712
00713 if ( Error::IsInRenderThread() )
00714 {
00715 TRACE( _T("In RenderThread so clearing up system"));
00716 Error::RenderThreadReset();
00717 CamProfile::AtBase(CAMPROFILE_OTHER);
00718 }
00719
00720
00721 if (Error == ERRORTYPE_SERIOUS || Error == ERRORTYPE_ENSURE) CCamApp::EnableSystem();
00722
00723
00724 ErrorHasBeenReported = TRUE;
00725 Error::ClearError();
00726
00727 Error::ErrorBoxRecurse--;
00728
00729
00730 DragManagerOp::AbortDrag();
00731
00732 return result;
00733 }
00734
00735 #endif
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754 INT32 InformGeneral(UINT32 Error, ErrorInfo* pInfo, UINT32 ModID)
00755 {
00756 if (!pInfo) return _R(IDS_OK);
00757 INT32 num = InformGeneral(Error,ModID, pInfo->ErrorMsg,
00758 pInfo->Button[0],pInfo->Button[1],pInfo->Button[2],pInfo->Button[3],
00759 pInfo->OK,pInfo->Cancel);
00760 return num?pInfo->Button[num-1]:_R(IDS_OK);
00761
00762 }
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783 void InformLastError(UINT32)
00784 {
00785 if (ErrStatus != ERRORSTAT_NONE)
00786 {
00787 InformError();
00788 ErrStatus = ERRORSTAT_NONE;
00789 }
00790 }
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870 #endif // EXCLUDE_FROM_XARLIB
00871
00872
00873
00874 TCHAR Error::ErrorString[256];
00875 UINT32 Error::ErrorID = 0;
00876 UINT32 Error::RalphErrorID = 0;
00877 UINT32 Error::ModuleID = 0;
00878 UINT32 Error::LastErrorLine;
00879 const char* Error::LastErrorFile = "Unknown.File";
00880
00881
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912 void Error::SetError(UINT32 number, const TCHAR* errstring, UINT32 module)
00913 {
00914 static TCHAR BASED_CODE LastResort[] = wxT("Cannot perform SetError (1)");
00915
00916
00917
00918 if (InSetError)
00919 {
00920 TRACE(_T("SetError really has been called recursively (1)\n"));
00921 RalphErrorID =ErrorID = _R(IDE_EX_BADOP);
00922 ErrStatus = ERRORSTAT_TEXT;
00923 ErrorHasBeenReported=FALSE;
00924 ModuleID = module;
00925 camStrcpy( ErrorString, LastResort );
00926 return;
00927 }
00928 InSetError++;
00929
00930
00931
00932
00933 #if 0
00934 if (!ErrorHasBeenReported)
00935 {
00936
00937 TRACE( _T("SetError called twice: ID = %u: %s\n"), number, errstring);
00938 InSetError--;
00939 return;
00940 }
00941 #endif
00942
00943 RalphErrorID = ErrorID = number;
00944 camStrcpy(ErrorString, errstring);
00945 ModuleID = module;
00946 ErrStatus = ERRORSTAT_TEXT;
00947 ErrorHasBeenReported = FALSE;
00948 TRACE( _T("Setting error: ID = %u: %s\n"), ErrorID, ErrorString);
00949 InSetError--;
00950 }
00951
00952 void Error::SetErrorSerious( const TCHAR* errstring )
00953 {
00954
00955 ErrorID = 0;
00956 ModuleID = 0;
00957 InSetError = 0;
00958 ErrStatus = ERRORSTAT_TEXT;
00959 ErrorHasBeenReported = FALSE;
00960 camStrcpy( ErrorString, errstring );
00961 }
00962
00963 void Error::SetError(UINT32 number, UINT32 module)
00964 {
00965 static TCHAR BASED_CODE LastResort[] = _T("Cannot perform SetError (2)");
00966
00967
00968
00969 if (InSetError)
00970 {
00971 TRACE(_T("SetError really has been called recursively (2)\n"));
00972 ErrorID = _R(IDE_EX_BADOP);
00973 ErrStatus = ERRORSTAT_TEXT;
00974 ErrorHasBeenReported=FALSE;
00975 ModuleID = module;
00976 camStrcpy( ErrorString, LastResort );
00977 return;
00978 }
00979 InSetError++;
00980 if (!ErrorHasBeenReported)
00981 {
00982
00983 TRACE( _T("SetError called twice: ID = %u Module = %u\n"), number, module);
00984 InSetError--;
00985 return;
00986 }
00987 RalphErrorID = ErrorID = number;
00988 ModuleID = module;
00989 ErrorString[0] = 0;
00990 ErrStatus = ERRORSTAT_ID;
00991 ErrorHasBeenReported = FALSE;
00992 if (!SmartLoadString(module, ErrorID, ErrorString, 256 * sizeof(TCHAR)) )
00993 {
00994 camSnprintf( ErrorString, 256, _T("Error Number %u from module ID %u"), ErrorID, ModuleID );
00995 }
00996
00997 TRACE( _T("Setting error: ID = %d: \"%s\"\n"), ErrorID, ErrorString);
00998 InSetError--;
00999 }
01000
01001 #if !defined(EXCLUDE_FROM_XARLIB)
01002 void Error::SetErrorTool(UINT32 number, UINT32 toolID)
01003 {
01004 Error::SetError(number, Tool::GetModuleID(toolID));
01005 }
01006 #endif
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024 void Error::ClearError()
01025 {
01026 TRACEUSER( "Chris", _T("Clear Error now \n") );
01027 RalphErrorID = ErrorID = ModuleID = 0;
01028 ErrorString[0] = 0;
01029
01030
01031
01032
01033 ErrorHasBeenReported = TRUE;
01034 ErrStatus = ERRORSTAT_NONE;
01035 }
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057 #if !INLINE_MARKERROR
01058
01059 void Error::MarkError( UINT32 LineNumber, const char *Filename )
01060 MARKERROR_BODY( LineNumber, Filename )
01061
01062 #endif
01063
01064 #define ResetWhere() LastErrorLine = 0; LastErrorFile = "Unknown.File";
01065
01066
01067
01068 BOOL Error::IsUserName(const char *wanted)
01069 {
01070
01071
01072 if (!UserName.CmpNoCase(_T("ALL")))
01073 return TRUE;
01074
01075 if (!UserName.CmpNoCase(_T("")))
01076 return FALSE;
01077
01078 wxString target (wanted, wxConvUTF8);
01079
01080 if (!target.CmpNoCase(_T("ALL")))
01081 return TRUE;
01082
01083 return (!UserName.CmpNoCase(target));
01084 }
01085
01086 #ifdef _DEBUG
01087
01088 void Error::TraceWrite(const TCHAR * bufp, va_list args)
01089 {
01090
01091
01092 #if 1
01093
01094 TCHAR buf[MAXERRORFORMATLENGTH];
01095 camStrncpy(buf, bufp, MAXERRORFORMATLENGTH);
01096 buf[MAXERRORFORMATLENGTH-1]=0;
01097 TCHAR * b=buf;
01098 do
01099 {
01100 if (*b == '\n') *b=' ';
01101 } while(*b++);
01102 wxVLogDebug(buf, args);
01103
01104 #else
01105
01106
01107 TCHAR * newline;
01108
01109 do
01110 {
01111 newline = camStrchr(bufp, _T('\n'));
01112 if (newline) *newline++=0;
01113
01114 wxVLogDebug(bufp, args);
01115
01116 bufp=newline;
01117 } while (bufp && *bufp);
01118 #endif
01119 }
01120
01121 #if 0 != wxUSE_UNICODE
01122
01123
01124
01125 void Error::FixFormat (const char * fmt, TCHAR * fmt2)
01126 {
01127 wxString FString(fmt, wxConvUTF8);
01128 FixFormat(FString.c_str(), fmt2);
01129 }
01130 #endif
01131
01132
01133
01134 void Error::FixFormat (const TCHAR * fmt, TCHAR * fmt2)
01135 {
01136
01137 INT32 i=0;
01138 INT32 j=0;
01139 TCHAR c;
01140
01141 do
01142 {
01143 c = fmt[i++];
01144 fmt2[j++]=c;
01145 if ( (c == _T('%')) && (fmt[i]==_T('s')) )
01146 fmt2[j++]=_T('l');
01147 } while ( c && (j < MAXERRORFORMATLENGTH-1));
01148
01149
01150 fmt2[MAXERRORFORMATLENGTH-1]=_T('\0');
01151 }
01152
01153 void CDECL Error::TraceUser(const char *User, LPCTSTR fmt, ...)
01154 {
01155 if (!IsUserName(User)) return;
01156
01157 va_list marker;
01158 va_start( marker, fmt );
01159
01160 TraceWrite(fmt, marker);
01161 va_end( marker );
01162 }
01163
01164 void CDECL Error::TraceAll(LPCTSTR fmt, ...)
01165 {
01166 va_list marker;
01167 va_start( marker, fmt );
01168
01169 TraceWrite(fmt, marker);
01170 va_end( marker );
01171 }
01172
01173 void CDECL Error::TraceTime (TCHAR * t)
01174 {
01175 TCHAR buf[256];
01176 #if !defined(EXCLUDE_FROM_XARLIB)
01177 CamProfile::GetTimeString(buf, 256);
01178 #else
01179 camStrcpy(buf, _T("unknown"));
01180 #endif
01181 TraceAll(_T("[%s] %s"), buf, t);
01182 }
01183
01184 #endif
01185
01186 void CDECL Error::ReleaseTrace(LPCTSTR fmt, ...)
01187 {
01188 TCHAR buf[256];
01189 va_list marker;
01190 va_start( marker, fmt );
01191 camVsnprintf( buf, 256, fmt, marker );
01192
01193 #if defined( __WXMSW__ )
01194 OutputDebugString( buf );
01195 #elif defined( __WXGTK__ )
01196 camPrintf( buf );
01197 #else
01198 #pragma error( "Not support on this architechure" )
01199 #endif
01200
01201 va_end( marker );
01202 }
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220 static void CalcInternalMessage( LPTCHAR result, UINT32 Line, const TCHAR* Filename )
01221 {
01222 const TCHAR* Slash = camStrrchr( Filename, TEXT('\\') );
01223 const TCHAR* Dot = camStrrchr( Filename, TEXT('.') );
01224 TCHAR CodedFile[20];
01225
01226 if (Slash && Dot)
01227 {
01228 TCHAR* p = CodedFile;
01229
01230 *p++ = Filename[0];
01231 *p++ = TEXT('.');
01232 *p++ = Slash[1];
01233 *p++ = Slash[2];
01234 *p++ = TEXT('.');
01235 *p++ = Dot[-2];
01236 *p++ = Dot[-1];
01237 *p = 0;
01238
01239 Filename = CodedFile;
01240 }
01241
01242
01243 String_256 jcf(_R(IDS_INTERNAL_ERROR_MSG));
01244 camSnprintf(result, 256, jcf, (UINT32) Line, (LPCTSTR) Filename);
01245 }
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262 #ifndef RALPH
01263
01264 void CDECL Error::XSetError( const TCHAR *fmt, ...)
01265 {
01266 #ifdef _DEBUG
01267 TCHAR buf[256];
01268 #if 0 != wxUSE_UNICODE
01269 TCHAR fmt2[MAXERRORFORMATLENGTH];
01270 FixFormat(fmt, fmt2);
01271 #else
01272 const TCHAR * fmt2=fmt;
01273 #endif
01274
01275 va_list marker;
01276 va_start( marker, fmt );
01277 camVsnprintf( buf, 256, fmt2, marker );
01278 va_end( marker );
01279
01280
01281 EnsureFailedLine( buf, LastErrorFile, LastErrorLine );
01282
01283 #endif
01284
01285 XSetErrorC();
01286 return;
01287 }
01288 #if 0 != wxUSE_UNICODE
01289
01290 void CDECL Error::XSetError( const char *fmt, ...)
01291 {
01292 #ifdef _DEBUG
01293 TCHAR buf[256];
01294 TCHAR fmt2[MAXERRORFORMATLENGTH];
01295 FixFormat(fmt, fmt2);
01296
01297 va_list marker;
01298 va_start( marker, fmt );
01299 camVsnprintf( buf, 256, fmt2, marker );
01300 va_end( marker );
01301
01302
01303 EnsureFailedLine( buf, LastErrorFile, LastErrorLine );
01304
01305 #endif
01306
01307 XSetErrorC();
01308 return;
01309 }
01310 #endif
01311 #else
01312
01313 void CDECL Error::XSetError( const TCHAR *fmt, ...)
01314 {
01315 TCHAR buf[256];
01316 TRACEUSER( "Chris", _T("oOoOo Ralph Set Error \n"));
01317
01318 #ifdef _DEBUG
01319 #if 0 != wxUSE_UNICODE
01320 TCHAR fmt2[MAXERRORFORMATLENGTH];
01321 FixFormat(fmt, fmt2);
01322 #else
01323 const TCHAR * fmt2=fmt;
01324 #endif
01325
01326 va_list marker;
01327 va_start( marker, fmt );
01328 camVsnprintf( buf, 256, fmt2, marker );
01329 va_end( marker );
01330
01331 EnsureFailedLine( buf, LastErrorFile, LastErrorLine );
01332
01333 #else
01334 XSetErrorC();
01335 InformError();
01336 #endif
01337 return;
01338 }
01339 #if 0 != wxUSE_UNICODE
01340
01341 void CDECL Error::XSetError( const char *fmt, ...)
01342 {
01343 TCHAR buf[256];
01344 TRACEUSER( "Chris", _T("oOoOo Ralph Set Error \n"));
01345
01346 #ifdef _DEBUG
01347 TCHAR fmt2[MAXERRORFORMATLENGTH];
01348 FixFormat(fmt, fmt2);
01349
01350 va_list marker;
01351 va_start( marker, fmt );
01352 camVsnprintf( buf, 256, fmt2, marker );
01353 va_end( marker );
01354
01355 EnsureFailedLine( buf, LastErrorFile, LastErrorLine );
01356
01357 #else
01358 XSetErrorC();
01359 InformError();
01360 #endif
01361 return;
01362 }
01363 #endif
01364 #endif
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378 void CDECL Error::XSetErrorC()
01379 {
01380 TCHAR buf[256];
01381
01382 CalcInternalMessage( buf, LastErrorLine, String_256( LastErrorFile ) );
01383 SetErrorSerious( buf );
01384 ResetWhere();
01385 return;
01386 }
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400 void CDECL Error::XSetError( UINT32 errID, ...)
01401 {
01402
01403
01404 if ( (errID==FALSE) || (errID==TRUE) )
01405 {
01406
01407
01408 ERROR2RAW( "ERROR1 macro used with invalid parameters" );
01409 return;
01410 }
01411
01412 TCHAR buf[256];
01413
01414 va_list marker;
01415
01416 va_start( marker, errID );
01417
01418 String_256 result;
01419
01420
01421 if (!SmartLoadString(0, errID, buf, sizeof(buf)))
01422 {
01423 camSnprintf( buf, 256, wxT("Error<%u>"), errID );
01424 }
01425
01426
01427 result.CCvsprintf(buf, marker);
01428
01429 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
01430
01431 SetNextMsgHelpContext(errID);
01432 #endif
01433
01434
01435 TRACEUSER( "Chris", wxT("oOoOo Ralph Set Error %d \n"), RalphErrorID );
01436
01437 RalphErrorID =errID;
01438
01439
01440 SetErrorSerious( result );
01441
01442
01443 TRACE( wxT("Setting error: ID = %d: \"%s\"\n"), errID, ErrorString);
01444
01445
01446 va_end( marker );
01447
01448 ResetWhere();
01449 }
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465 #ifdef _DEBUG
01466 void CDECL Error::XComplain( const TCHAR *fmt, ...)
01467 {
01468 TCHAR buf[256];
01469
01470 #if 0 != wxUSE_UNICODE
01471 TCHAR fmt2[MAXERRORFORMATLENGTH];
01472 FixFormat(fmt, fmt2);
01473 #else
01474 const TCHAR * fmt2=fmt;
01475 #endif
01476
01477 va_list marker;
01478 va_start( marker, fmt );
01479 camVsnprintf( buf, 256, fmt2, marker );
01480 va_end( marker );
01481
01482 EnsureFailedLine( buf, LastErrorFile, LastErrorLine );
01483 ResetWhere();
01484 }
01485
01486 #if 0 != wxUSE_UNICODE
01487 void CDECL Error::XComplain( const char *fmt, ...)
01488 {
01489 TCHAR buf[256];
01490 TCHAR fmt2[MAXERRORFORMATLENGTH];
01491 FixFormat(fmt, fmt2);
01492
01493 va_list marker;
01494 va_start( marker, fmt );
01495 camVsnprintf( buf, 256, fmt2, marker );
01496 va_end( marker );
01497
01498 EnsureFailedLine( buf, LastErrorFile, LastErrorLine );
01499 ResetWhere();
01500 }
01501 #endif
01502
01503 #endif
01504
01505
01506 #if !defined(EXCLUDE_FROM_XARLIB)
01507 INT32 InformError(UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01508 {
01509 return InformGeneral(ERRORTYPE_ERROR, 0, ErrorMsg,
01510 Butt1, Butt2, Butt3, Butt4,
01511 OK, Cancel);
01512
01513 }
01514
01515
01516 INT32 ToolInformError(UINT32 ToolID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01517 {
01518 return InformGeneral(ERRORTYPE_ERROR, Tool::GetModuleID(ToolID), ErrorMsg,
01519 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01520
01521 }
01522
01523
01524 INT32 ModuleInformError(UINT32 ModID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01525 {
01526 return InformGeneral(ERRORTYPE_ERROR, ModID, ErrorMsg,
01527 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01528
01529 }
01530
01531
01532 INT32 InformError(ErrorInfo *pInfo)
01533 {
01534 return InformGeneral(ERRORTYPE_ERROR, pInfo);
01535 }
01536
01537
01538 INT32 ToolInformError(UINT32 ToolID, ErrorInfo *pInfo)
01539 {
01540 return InformGeneral(ERRORTYPE_ERROR, pInfo, Tool::GetModuleID(ToolID));
01541 }
01542
01543
01544 INT32 ModuleInformError(UINT32 ModID, ErrorInfo *pInfo)
01545 {
01546 return InformGeneral(ERRORTYPE_ERROR, pInfo, ModID);
01547 }
01548
01549
01550 INT32 InformSeriousError(UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01551 {
01552 return InformGeneral(ERRORTYPE_SERIOUS, 0, ErrorMsg,
01553 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01554 }
01555
01556
01557 INT32 ToolInformSeriousError(UINT32 ToolID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01558 {
01559 return InformGeneral(ERRORTYPE_SERIOUS, Tool::GetModuleID(ToolID), ErrorMsg,
01560 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01561 }
01562
01563
01564 INT32 ModuleInformSeriousError(UINT32 ModID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01565 {
01566 return InformGeneral(ERRORTYPE_SERIOUS, ModID, ErrorMsg,
01567 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01568 }
01569
01570
01571 INT32 InformSeriousError(ErrorInfo *pInfo)
01572 {
01573 return InformGeneral(ERRORTYPE_SERIOUS, pInfo);
01574 }
01575
01576 INT32 ToolInformSeriousError(UINT32 ToolID, ErrorInfo *pInfo)
01577 {
01578 return InformGeneral(ERRORTYPE_SERIOUS, pInfo, Tool::GetModuleID(ToolID));
01579 }
01580
01581 INT32 ModuleInformSeriousError(UINT32 ModID, ErrorInfo *pInfo)
01582 {
01583 return InformGeneral(ERRORTYPE_SERIOUS, pInfo, ModID);
01584 }
01585
01586 INT32 InformWarning(UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01587 {
01588
01589 return InformGeneral(ERRORTYPE_WARNING, 0, ErrorMsg,
01590 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01591 }
01592
01593 INT32 ToolInformWarning(UINT32 ToolID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01594 {
01595 return InformGeneral(ERRORTYPE_WARNING, Tool::GetModuleID(ToolID), ErrorMsg,
01596 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01597 }
01598
01599 INT32 ModuleInformWarning(UINT32 ModID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01600 {
01601 return InformGeneral(ERRORTYPE_WARNING, ModID, ErrorMsg,
01602 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01603 }
01604
01605 INT32 InformWarning(ErrorInfo *pInfo)
01606 {
01607 return InformGeneral(ERRORTYPE_WARNING, pInfo);
01608 }
01609
01610
01611 INT32 ToolInformWarning(UINT32 ToolID, ErrorInfo *pInfo)
01612 {
01613 return InformGeneral(ERRORTYPE_WARNING, pInfo, Tool::GetModuleID(ToolID));
01614 }
01615
01616
01617 INT32 ModuleInformWarning(UINT32 ModID, ErrorInfo *pInfo)
01618 {
01619 return InformGeneral(ERRORTYPE_WARNING, pInfo, ModID);
01620 }
01621
01622
01623
01624 UINT32 AskQuestion(UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01625 {
01626 return InformGeneral(ERRORTYPE_QUESTION, 0, ErrorMsg,
01627 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01628 }
01629
01630 UINT32 ToolAskQuestion(UINT32 ToolID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01631 {
01632 return InformGeneral(ERRORTYPE_QUESTION, Tool::GetModuleID(ToolID), ErrorMsg,
01633 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01634 }
01635
01636
01637
01638 INT32 ModuleAskQuestion(UINT32 ModID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01639 {
01640 return InformGeneral(ERRORTYPE_QUESTION, ModID, ErrorMsg,
01641 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01642 }
01643
01644
01645 INT32 AskQuestion(ErrorInfo *pInfo)
01646 {
01647 return InformGeneral(ERRORTYPE_QUESTION, pInfo);
01648 }
01649
01650
01651 INT32 ToolAskQuestion(UINT32 ToolID, ErrorInfo *pInfo)
01652 {
01653 return InformGeneral(ERRORTYPE_QUESTION, pInfo, Tool::GetModuleID(ToolID));
01654 }
01655
01656
01657 INT32 ModuleAskQuestion(UINT32 ModID, ErrorInfo *pInfo)
01658 {
01659 return InformGeneral(ERRORTYPE_QUESTION, pInfo, ModID);
01660 }
01661
01662
01663
01664 INT32 InformMessage(UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01665 {
01666 return InformGeneral(ERRORTYPE_NORMAL, 0, ErrorMsg,
01667 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01668
01669 }
01670
01671
01672 INT32 ToolInformMessage(UINT32 ToolID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01673 {
01674 return InformGeneral(ERRORTYPE_NORMAL, Tool::GetModuleID(ToolID), ErrorMsg,
01675 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01676
01677 }
01678
01679
01680 INT32 ModuleInformMessage(UINT32 ModID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
01681 {
01682 return InformGeneral(ERRORTYPE_NORMAL, ModID, ErrorMsg,
01683 Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01684 }
01685
01686
01687 INT32 InformMessage(ErrorInfo *pInfo)
01688 {
01689 return InformGeneral(ERRORTYPE_NORMAL, pInfo);
01690 }
01691
01692
01693 INT32 ToolInformMessage(UINT32 ToolID, ErrorInfo *pInfo)
01694 {
01695 return InformGeneral(ERRORTYPE_NORMAL, pInfo, Tool::GetModuleID(ToolID));
01696 }
01697
01698
01699 INT32 ModuleInformMessage(UINT32 ModID, ErrorInfo *pInfo)
01700 {
01701 return InformGeneral(ERRORTYPE_NORMAL, pInfo, ModID);
01702 }
01703 #endif
01704
01705
01706 #if 0
01707
01708
01709 INT32 test1(INT32 which)
01710 {
01711 if (which==0)
01712 {
01713 ERROR1RAW( _R(IDE_INTERNAL_ERROR) );
01714 return 0;
01715 }
01716 if (which==1)
01717 ERROR1( 10, _R(IDE_INTERNAL_ERROR) );
01718 if (which==2)
01719 ERROR1IF( TRUE, 20, _R(IDE_INTERNAL_ERROR) );
01720 if (which==3)
01721 ERROR1_MSG( 30, (_R(IDT_EPS_BADSYNTAX), 2, 200) );
01722 if (which==4)
01723 ERROR1IF_MSG( TRUE, 40, (_R(IDT_EPS_BADSYNTAX), 1, 100) );
01724 return 0;
01725 }
01726
01727
01728
01729 INT32 test2(INT32 which)
01730 {
01731 if (which==0)
01732 {
01733 ERROR2RAW( "Simple raw error" );
01734 return 0;
01735 }
01736 if (which==1)
01737 ERROR2( 10, "Simple error" );
01738 if (which==2)
01739 ERROR2IF( TRUE, 20, "Simple error if");
01740 if (which==3)
01741 ERROR2_PF( 30, ("String (%s)", "blobby") );
01742 if (which==4)
01743 ERROR2IF_PF( TRUE, 40, ("Numbers (%d,%d)" , 42,43) );
01744 return 0;
01745 }
01746
01748
01749
01750 void TestErrorStuff()
01751 {
01752 test1(0);
01753 test1(1);
01754 test1(2);
01755 test1(3);
01756 test1(4);
01757
01758 InformError();
01759
01760 test2(0);
01761 test2(1);
01762 test2(2);
01763 test2(3);
01764 test2(4);
01765
01766 InformError();
01767
01768 ERROR3("simple");
01769 ERROR3IF( TRUE, "simple" );
01770 ERROR3_PF( ("doc is %lx", 0x123456) );
01771 ERROR3IF_PF( TRUE, ("doc %s is %lx", "blobdoc", 0x123456) );
01772
01773 TRACEUSER( "Andy", _T("simple trace\n"));
01774 TRACEUSER( "Andy", "complex %d %s trace", 42, _T("blobby\n") );
01775 }
01776
01777 #endif
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792 void Error::DumpStack(UINT32 frames)
01793 {
01794 #ifdef _DEBUG
01795 #if !defined(__WXMAC__) && !defined(__FreeBSD__)
01796 Error::StackWalker s;
01797 s.Walk(frames);
01798 #else
01799 TRACE( _T("Request to dump stack not supported on this platform") );
01800 #endif
01801 #endif
01802 }
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816 #if !defined(__WXMAC__) && !defined(__FreeBSD__)
01817 void Error::StackWalker::OnStackFrame(const wxStackFrame & frame)
01818 {
01819 #ifdef _DEBUG
01820 wxString l;
01821 l.Printf(_T("%d %s:%d %s"), frame.GetLevel(), frame.GetFileName().c_str(), frame.GetLine(), frame.GetName().c_str());
01822
01823 wxLogDebug(l);
01824 #endif
01825 }
01826 #endif