Diff for /np2/win9x/trace.cpp between versions 1.12 and 1.15

version 1.12, 2005/02/16 09:31:55 version 1.15, 2005/03/24 04:40:33
Line 70  static int   devpos; Line 70  static int   devpos;
 static  char            devstr[256];  static  char            devstr[256];
   
 static const OEMCHAR np2trace[] = OEMTEXT("np2trace.ini");  static const OEMCHAR np2trace[] = OEMTEXT("np2trace.ini");
 static const char       inititle[] = "TRACE";  static const OEMCHAR inititle[] = OEMTEXT("TRACE");
 static const INITBL     initbl[4] = {  static const PFTBL initbl[4] = {
                         {"posx",        INITYPE_SINT32, &tracecfg.posx,         0},                          PFVAL("posx",   PFTYPE_SINT32,  &tracecfg.posx),
                         {"posy",        INITYPE_SINT32, &tracecfg.posy,         0},                          PFVAL("posy",   PFTYPE_SINT32,  &tracecfg.posy),
                         {"width",       INITYPE_SINT32, &tracecfg.width,        0},                          PFVAL("width",  PFTYPE_SINT32,  &tracecfg.width),
                         {"height",      INITYPE_SINT32, &tracecfg.height,       0}};                          PFVAL("height", PFTYPE_SINT32,  &tracecfg.height)};
   
 static void View_ScrollToBottom(HWND hWnd) {  static void View_ScrollToBottom(HWND hWnd) {
   
Line 128  static void View_AddString(const TCHAR * Line 128  static void View_AddString(const TCHAR *
         viewbuf[vpos + vlen + 0] = '\r';          viewbuf[vpos + vlen + 0] = '\r';
         viewbuf[vpos + vlen + 1] = '\n';          viewbuf[vpos + vlen + 1] = '\n';
         viewbuf[vpos + vlen + 2] = '\0';          viewbuf[vpos + vlen + 2] = '\0';
         viewleng = vlen + 3;          viewleng = vlen + 2;
         SetWindowText(hView, viewbuf + vpos);          SetWindowText(hView, viewbuf + vpos);
         View_ScrollToBottom(hView);          View_ScrollToBottom(hView);
 }  }
Line 137  static void View_AddString(const TCHAR * Line 137  static void View_AddString(const TCHAR *
 // ----  // ----
   
 #if defined(FILEBUFSIZE)  #if defined(FILEBUFSIZE)
 static  char    filebuf[FILEBUFSIZE];  static  TCHAR   filebuf[FILEBUFSIZE];
 static  UINT32  filebufpos;  static  UINT32  filebufpos;
 #endif  #endif
   
Line 172  static void trfh_open(const OEMCHAR *fna Line 172  static void trfh_open(const OEMCHAR *fna
 #endif  #endif
 }  }
   
 static void trfh_add(const char *buf) {  static void trfh_add(const TCHAR *buf) {
   
         UINT    size;          UINT    size;
   
         size = strlen(buf);          size = lstrlen(buf);
 #if defined(FILEBUFSIZE)  #if defined(FILEBUFSIZE)
         while(size) {          while(size) {
                 UINT pos = filebufpos & (FILEBUFSIZE - 1);                  UINT pos = filebufpos & (FILEBUFSIZE - 1);
Line 284  static LRESULT CALLBACK traceproc(HWND h Line 284  static LRESULT CALLBACK traceproc(HWND h
                                                 trfh_close();                                                  trfh_close();
                                         }                                          }
                                         else {                                          else {
                                                 trfh_open("traceout.txt");                                                  trfh_open(OEMTEXT("traceout.txt"));
                                         }                                          }
                                         hmenu = GetSystemMenu(hWnd, FALSE);                                          hmenu = GetSystemMenu(hWnd, FALSE);
                                         CheckMenuItem(hmenu, IDM_TRACEFH,                                          CheckMenuItem(hmenu, IDM_TRACEFH,
Line 379  void trace_init(void) { Line 379  void trace_init(void) {
                 wc.hCursor = LoadCursor(NULL, IDC_ARROW);                  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
                 wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);                  wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
                 wc.lpszMenuName = NULL;                  wc.lpszMenuName = NULL;
                 wc.lpszClassName = (LPCSTR)ClassName;                  wc.lpszClassName = (LPCTSTR)ClassName;
                 if (!RegisterClass(&wc)) {                  if (!RegisterClass(&wc)) {
                         return;                          return;
                 }                  }
Line 428  void trace_fmt(const char *fmt, ...) { Line 428  void trace_fmt(const char *fmt, ...) {
   
         BOOL    en;          BOOL    en;
         va_list ap;          va_list ap;
         char    buf[0x1000];          OEMCHAR buf[0x1000];
   
         en = (tracewin.en & 1) &&          en = (tracewin.en & 1) &&
                 ((tracewin.en & 4) || (tracewin.fh != FILEH_INVALID));                  ((tracewin.en & 4) || (tracewin.fh != FILEH_INVALID));
         if (en) {          if (en) {
                 va_start(ap, fmt);                  va_start(ap, fmt);
   #if defined(_UNICODE)
                   TCHAR cnvfmt[0x800];
                   MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, fmt, -1,
                                                                                                   cnvfmt, NELEMENTS(cnvfmt));
                   vswprintf(buf, cnvfmt, ap);
   #else
                 vsprintf(buf, fmt, ap);                  vsprintf(buf, fmt, ap);
   #endif
                 va_end(ap);                  va_end(ap);
                 if ((tracewin.en & 4) && (hView)) {                  if ((tracewin.en & 4) && (hView)) {
                         View_AddString(buf);                          View_AddString(buf);
Line 450  void trace_fmt2(const char *fmt, ...) { Line 457  void trace_fmt2(const char *fmt, ...) {
   
         BOOL    en;          BOOL    en;
         va_list ap;          va_list ap;
         char    buf[0x1000];          OEMCHAR buf[0x1000];
   
         en = (tracewin.en & 2) &&          en = (tracewin.en & 2) &&
                 ((tracewin.en & 4) || (tracewin.fh != FILEH_INVALID));                  ((tracewin.en & 4) || (tracewin.fh != FILEH_INVALID));
         if (en) {          if (en) {
                 va_start(ap, fmt);                  va_start(ap, fmt);
   #if defined(_UNICODE)
                   TCHAR cnvfmt[0x800];
                   MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, fmt, -1,
                                                                                                   cnvfmt, NELEMENTS(cnvfmt));
                   vswprintf(buf, cnvfmt, ap);
   #else
                 vsprintf(buf, fmt, ap);                  vsprintf(buf, fmt, ap);
   #endif
                 va_end(ap);                  va_end(ap);
                 if ((tracewin.en & 4) && (hView)) {                  if ((tracewin.en & 4) && (hView)) {
                         View_AddString(buf);                          View_AddString(buf);
Line 473  void trace_char(char c) { Line 487  void trace_char(char c) {
         if ((c == 0x0a) || (c == 0x0d)) {          if ((c == 0x0a) || (c == 0x0d)) {
                 if (devpos) {                  if (devpos) {
                         devstr[devpos] = '\0';                          devstr[devpos] = '\0';
   #if defined(_UNICODE)
                           TCHAR pdevstr[0x800];
                           MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, devstr, -1,
                                                                                                   pdevstr, NELEMENTS(pdevstr));
   #else
                           const TCHAR *pdevstr = devstr;
   #endif
                         if ((tracewin.en & 4) && (hView)) {                          if ((tracewin.en & 4) && (hView)) {
                                 View_AddString(devstr);                                  View_AddString(pdevstr);
                         }                          }
                         if (tracewin.fh != FILEH_INVALID) {                          if (tracewin.fh != FILEH_INVALID) {
                                 trfh_add(devstr);                                  trfh_add(pdevstr);
                                 trfh_add(crlf);                                  trfh_add(crlf);
                         }                          }
                         devpos = 0;                          devpos = 0;

Removed from v.1.12  
changed lines
  Added in v.1.15


RetroPC.NET-CVS <cvs@retropc.net>